-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding tracking as an option #17
Conversation
@@ -32,7 +32,7 @@ public function add_plugin_page() | |||
|
|||
protected function render_message($msg, $msg_type = 'error') | |||
{ | |||
echo "<div class='$msg_type notice is-dismissible'><p>$msg</p></div>"; | |||
echo '<div class="' . $msg_type . ' notice is-dismissible"><p>$msg</p></div>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think using sprintf or printf is even better than this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, and I did not realize that there was $msg
in it too.
@@ -21,6 +21,13 @@ public function configure_phpmailer($phpmailer) { | |||
if(!$options['enable_sparkpost'] || empty($options['password'])) { | |||
return; | |||
} | |||
$tracking_enabled = !!$options['enable_tracking']; | |||
$x_msys_api => array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$x_msys_api = array(
Seems you didn't run it ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not have time yet
Here are a few more observations:
Now, we always setting the tracking to either true or false. But we should have an option to use system default. So, we default is selected, we won't pass the options at all, leaving it to default behaviour.
|
@@ -32,7 +32,7 @@ public function add_plugin_page() | |||
|
|||
protected function render_message($msg, $msg_type = 'error') | |||
{ | |||
printf('<div class="%s notice is-dismissible"><p>$msg</p></div>', $msg_type); | |||
printf('<div class="%s notice is-dismissible"><p>%s</p></div>', $msg_type, $msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird, I had fixed that locally. Probably forgot to push before leaving
I disagree. The default for tracking can be set at various levels (system, per account, per template) and they can be different between SMTP and API at those levels. There's no simple way to expose it here, and at the end of the day, users want either to track or not, so showing a "Default" without saying what it is does not help much |
Hopefully this gets merged soon! We're switching from Mandrill and just ran into an issue related to this. We're trying to use the HTTP API version (instead of SMTP), but the Thanks for your work on this @max-mathieu! I appreciate it. I was going to work on the same thing until I saw this PR. |
@@ -28,9 +28,9 @@ | |||
} | |||
$sp = new SparkPost(); | |||
|
|||
if ($sp->get_option('enable_sparkpost')) { | |||
if ($sp::get_option('enable_sparkpost')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we do SparkPost::
instead of $sp::
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am even wonder how it works! Seems I can call static method through instance which is weird.
Ok, I see why it works
A property declared as static cannot be accessed with an instantiated class object (though a static method can).
So back to your question, why that's preferred while language supports this.
72d04d7
to
2dfa7b9
Compare
* @return array | ||
*/ | ||
protected function get_headers_in_content() | ||
protected function get_reply_to($body_content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems $body_content
not used. So we can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right, I planned to pass $body['content']
as reference there and changed my mind :)
@@ -48,7 +48,7 @@ public function sp_deactivate() | |||
|
|||
static function get_options() | |||
{ | |||
return array_merge(self::$options_default, get_option('sp_settings')); | |||
return array_merge(self::$options_default, get_option('sp_settings', [])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be array() for php < 5.4
No description provided.