Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WP Mail
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
Library
WP Mail
Commits
4ffdc837
Commit
4ffdc837
authored
2 years ago
by
Piotr Potrebka
Browse files
Options
Downloads
Patches
Plain Diff
init
parent
1df74b3a
No related branches found
No related tags found
1 merge request
!2
Devel
Pipeline
#150354
passed with stages
in 53 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Abstracts/ConditionInterface.php
+12
-0
12 additions, 0 deletions
src/Abstracts/ConditionInterface.php
src/Abstracts/EmailGettersAbstract.php
+5
-1
5 additions, 1 deletion
src/Abstracts/EmailGettersAbstract.php
src/EmailSender.php
+10
-3
10 additions, 3 deletions
src/EmailSender.php
with
27 additions
and
4 deletions
src/Abstracts/ConditionInterface.php
0 → 100644
+
12
−
0
View file @
4ffdc837
<?php
namespace
WPDesk\Library\WPEmail\Abstracts
;
use
WPDesk\View\Renderer\Renderer
;
interface
ConditionInterface
{
public
function
is_valid
():
bool
;
}
This diff is collapsed.
Click to expand it.
src/Abstracts/EmailGettersAbstract.php
+
5
−
1
View file @
4ffdc837
...
@@ -4,7 +4,7 @@ namespace WPDesk\Library\WPEmail\Abstracts;
...
@@ -4,7 +4,7 @@ namespace WPDesk\Library\WPEmail\Abstracts;
use
WPDesk\View\Renderer\Renderer
;
use
WPDesk\View\Renderer\Renderer
;
abstract
class
EmailGettersAbstract
implements
EmailGettersInterface
,
EmailSetters
Interface
{
abstract
class
EmailGettersAbstract
implements
EmailGettersInterface
,
Condition
Interface
{
/**
/**
* @var Renderer
* @var Renderer
...
@@ -142,4 +142,8 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, EmailSette
...
@@ -142,4 +142,8 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, EmailSette
return
$this
->
renderer
->
render
(
dirname
(
__DIR__
)
.
'/html/default.php'
,
[
'content'
=>
$this
->
get_content
(),
'heading'
=>
$this
->
get_heading
(),
'object'
=>
$this
->
get_object
()
]
);
return
$this
->
renderer
->
render
(
dirname
(
__DIR__
)
.
'/html/default.php'
,
[
'content'
=>
$this
->
get_content
(),
'heading'
=>
$this
->
get_heading
(),
'object'
=>
$this
->
get_object
()
]
);
}
}
public
function
is_valid
():
bool
{
return
true
;
}
}
}
This diff is collapsed.
Click to expand it.
src/EmailSender.php
+
10
−
3
View file @
4ffdc837
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
WPDesk\Library\WPEmail\Emails
;
namespace
WPDesk\Library\WPEmail\Emails
;
use
WPDesk\Library\WPEmail\Abstracts\ConditionInterface
;
use
WPDesk\Library\WPEmail\Abstracts\EmailGettersInterface
;
use
WPDesk\Library\WPEmail\Abstracts\EmailGettersInterface
;
class
EmailSender
{
class
EmailSender
{
...
@@ -81,9 +82,15 @@ class EmailSender {
...
@@ -81,9 +82,15 @@ class EmailSender {
public
function
send
()
{
public
function
send
()
{
foreach
(
$this
->
get_emails
()
as
$email
)
{
foreach
(
$this
->
get_emails
()
as
$email
)
{
$this
->
before_wp_mail
();
$this
->
before_wp_mail
();
wp_mail
(
$email
->
get_recipients
(),
$email
->
get_subject
(),
$email
->
render
(),
$email
->
get_headers
(),
$email
->
get_attachments
()
if
(
$email
instanceof
ConditionInterface
)
{
);
if
(
$email
->
is_valid
()
)
{
wp_mail
(
$email
->
get_recipients
(),
$email
->
get_subject
(),
$email
->
render
(),
$email
->
get_headers
(),
$email
->
get_attachments
()
);
}
}
$this
->
after_wp_mail
();
$this
->
after_wp_mail
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment