Manage subscriptions
- make use of the SubscriberSegment::status column to keep track of unsubscriptions - unsubscribed segments now appear grayed out in the Subscribers listing - added unsubscribed_at after segment names when editing a subscriber - added date() method for Twig (uses WP's date format / date_offset) - fixed typo in Form iframe export - fixed unit test for Newsletters - updated selection component (JSX) to allow more customization
This commit is contained in:
@@ -18,7 +18,13 @@ class i18n extends \Twig_Extension {
|
||||
// twig custom functions
|
||||
$twig_functions = array();
|
||||
// list of WP functions to map
|
||||
$functions = array('localize', '__', '_n');
|
||||
$functions = array(
|
||||
'localize',
|
||||
'__',
|
||||
'_n',
|
||||
'date',
|
||||
'date_format'
|
||||
);
|
||||
|
||||
foreach($functions as $function) {
|
||||
$twig_functions[] = new \Twig_SimpleFunction(
|
||||
@@ -57,6 +63,23 @@ class i18n extends \Twig_Extension {
|
||||
return call_user_func_array('_n', $this->setTextDomain($args));
|
||||
}
|
||||
|
||||
function date() {
|
||||
$args = func_get_args();
|
||||
$date = (isset($args[0])) ? $args[0] : null;
|
||||
$date_format = (isset($args[1])) ? $args[1] : get_option('date_format');
|
||||
|
||||
if(empty($date)) return;
|
||||
|
||||
// check if it's an int passed as a string
|
||||
if((string)(int)$date === $date) {
|
||||
$date = (int)$date;
|
||||
} else if(!is_int($date)) {
|
||||
$date = strtotime($date);
|
||||
}
|
||||
|
||||
return get_date_from_gmt(date('Y-m-d H:i:s', $date), $date_format);
|
||||
}
|
||||
|
||||
private function setTextDomain($args = array()) {
|
||||
// make sure that the last argument is our text domain
|
||||
if($args[count($args) - 1] !== $this->_text_domain) {
|
||||
|
Reference in New Issue
Block a user