@@ -32,18 +32,18 @@ |
||
| 32 | 32 | |
| 33 | 33 | // modify just event_list |
| 34 | 34 | $new_config['event_list'] = array( |
| 35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 36 | 36 | ); |
| 37 | 37 | $new_config['ticket_list'] = array( |
| 38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
| 39 | 39 | ); |
| 40 | 40 | $new_config['content'] = array( |
| 41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 42 | 42 | ); |
| 43 | 43 | $this->_messenger->set_validator_config($new_config); |
| 44 | 44 | |
| 45 | 45 | if ($this->_context != 'admin') { |
| 46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -14,37 +14,37 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class EE_Messages_Email_Payment_Cancelled_Validator extends EE_Messages_Validator |
| 16 | 16 | { |
| 17 | - public function __construct($fields, $context) |
|
| 18 | - { |
|
| 19 | - $this->_m_name = 'email'; |
|
| 20 | - $this->_mt_name = 'payment_cancelled'; |
|
| 17 | + public function __construct($fields, $context) |
|
| 18 | + { |
|
| 19 | + $this->_m_name = 'email'; |
|
| 20 | + $this->_mt_name = 'payment_cancelled'; |
|
| 21 | 21 | |
| 22 | - parent::__construct($fields, $context); |
|
| 23 | - } |
|
| 22 | + parent::__construct($fields, $context); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
| 27 | - */ |
|
| 28 | - protected function _modify_validator() |
|
| 29 | - { |
|
| 30 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 25 | + /** |
|
| 26 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
| 27 | + */ |
|
| 28 | + protected function _modify_validator() |
|
| 29 | + { |
|
| 30 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 31 | 31 | |
| 32 | - // modify just event_list |
|
| 33 | - $new_config['event_list'] = array( |
|
| 34 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 35 | - ); |
|
| 36 | - $new_config['ticket_list'] = array( |
|
| 37 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
| 38 | - ); |
|
| 39 | - $new_config['content'] = array( |
|
| 40 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 41 | - ); |
|
| 42 | - $this->_messenger->set_validator_config($new_config); |
|
| 32 | + // modify just event_list |
|
| 33 | + $new_config['event_list'] = array( |
|
| 34 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 35 | + ); |
|
| 36 | + $new_config['ticket_list'] = array( |
|
| 37 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
| 38 | + ); |
|
| 39 | + $new_config['content'] = array( |
|
| 40 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 41 | + ); |
|
| 42 | + $this->_messenger->set_validator_config($new_config); |
|
| 43 | 43 | |
| 44 | - if ($this->_context != 'admin') { |
|
| 45 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 46 | - } |
|
| 44 | + if ($this->_context != 'admin') { |
|
| 45 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 49 | - } |
|
| 48 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -32,18 +32,18 @@ |
||
| 32 | 32 | |
| 33 | 33 | // modify just event_list |
| 34 | 34 | $new_config['event_list'] = array( |
| 35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 36 | 36 | ); |
| 37 | 37 | $new_config['ticket_list'] = array( |
| 38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
| 39 | 39 | ); |
| 40 | 40 | $new_config['content'] = array( |
| 41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 42 | 42 | ); |
| 43 | 43 | $this->_messenger->set_validator_config($new_config); |
| 44 | 44 | |
| 45 | 45 | if ($this->_context != 'admin') { |
| 46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -14,37 +14,37 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class EE_Messages_Email_Payment_Failed_Validator extends EE_Messages_Validator |
| 16 | 16 | { |
| 17 | - public function __construct($fields, $context) |
|
| 18 | - { |
|
| 19 | - $this->_m_name = 'email'; |
|
| 20 | - $this->_mt_name = 'payment_failed'; |
|
| 17 | + public function __construct($fields, $context) |
|
| 18 | + { |
|
| 19 | + $this->_m_name = 'email'; |
|
| 20 | + $this->_mt_name = 'payment_failed'; |
|
| 21 | 21 | |
| 22 | - parent::__construct($fields, $context); |
|
| 23 | - } |
|
| 22 | + parent::__construct($fields, $context); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
| 27 | - */ |
|
| 28 | - protected function _modify_validator() |
|
| 29 | - { |
|
| 30 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 25 | + /** |
|
| 26 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
| 27 | + */ |
|
| 28 | + protected function _modify_validator() |
|
| 29 | + { |
|
| 30 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 31 | 31 | |
| 32 | - // modify just event_list |
|
| 33 | - $new_config['event_list'] = array( |
|
| 34 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 35 | - ); |
|
| 36 | - $new_config['ticket_list'] = array( |
|
| 37 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
| 38 | - ); |
|
| 39 | - $new_config['content'] = array( |
|
| 40 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 41 | - ); |
|
| 42 | - $this->_messenger->set_validator_config($new_config); |
|
| 32 | + // modify just event_list |
|
| 33 | + $new_config['event_list'] = array( |
|
| 34 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 35 | + ); |
|
| 36 | + $new_config['ticket_list'] = array( |
|
| 37 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
| 38 | + ); |
|
| 39 | + $new_config['content'] = array( |
|
| 40 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 41 | + ); |
|
| 42 | + $this->_messenger->set_validator_config($new_config); |
|
| 43 | 43 | |
| 44 | - if ($this->_context != 'admin') { |
|
| 45 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 46 | - } |
|
| 44 | + if ($this->_context != 'admin') { |
|
| 45 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 49 | - } |
|
| 48 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $this->_messenger->set_validator_config($new_config); |
| 39 | 39 | |
| 40 | 40 | if ($this->_context != 'admin') { |
| 41 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 41 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,30 +13,30 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Messages_Email_Cancelled_Registration_Validator extends EE_Messages_Validator |
| 15 | 15 | { |
| 16 | - public function __construct($fields, $context) |
|
| 17 | - { |
|
| 18 | - $this->_m_name = 'email'; |
|
| 19 | - $this->_mt_name = 'cancelled_registration'; |
|
| 16 | + public function __construct($fields, $context) |
|
| 17 | + { |
|
| 18 | + $this->_m_name = 'email'; |
|
| 19 | + $this->_mt_name = 'cancelled_registration'; |
|
| 20 | 20 | |
| 21 | - parent::__construct($fields, $context); |
|
| 22 | - } |
|
| 21 | + parent::__construct($fields, $context); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * custom validator (will override what was originally set by the message_type and messenger) |
|
| 26 | - */ |
|
| 27 | - protected function _modify_validator() |
|
| 28 | - { |
|
| 29 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | - $new_config['event_list'] = array( |
|
| 31 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 32 | - 'required' => array('[EVENT_LIST]') |
|
| 33 | - ); |
|
| 34 | - $this->_messenger->set_validator_config($new_config); |
|
| 24 | + /** |
|
| 25 | + * custom validator (will override what was originally set by the message_type and messenger) |
|
| 26 | + */ |
|
| 27 | + protected function _modify_validator() |
|
| 28 | + { |
|
| 29 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | + $new_config['event_list'] = array( |
|
| 31 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 32 | + 'required' => array('[EVENT_LIST]') |
|
| 33 | + ); |
|
| 34 | + $this->_messenger->set_validator_config($new_config); |
|
| 35 | 35 | |
| 36 | - if ($this->_context != 'admin') { |
|
| 37 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 38 | - } |
|
| 36 | + if ($this->_context != 'admin') { |
|
| 37 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 41 | - } |
|
| 40 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $this->_messenger->set_validator_config($new_config); |
| 39 | 39 | |
| 40 | 40 | if ($this->_context != 'admin') { |
| 41 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 41 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,31 +13,31 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Messages_Email_Declined_Registration_Validator extends EE_Messages_Validator |
| 15 | 15 | { |
| 16 | - public function __construct($fields, $context) |
|
| 17 | - { |
|
| 18 | - $this->_m_name = 'email'; |
|
| 19 | - $this->_mt_name = 'declined_registration'; |
|
| 16 | + public function __construct($fields, $context) |
|
| 17 | + { |
|
| 18 | + $this->_m_name = 'email'; |
|
| 19 | + $this->_mt_name = 'declined_registration'; |
|
| 20 | 20 | |
| 21 | - parent::__construct($fields, $context); |
|
| 22 | - } |
|
| 21 | + parent::__construct($fields, $context); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * custom validator (restricting what was originally set by the messenger) |
|
| 26 | - */ |
|
| 27 | - protected function _modify_validator() |
|
| 28 | - { |
|
| 29 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | - // modify just event_list |
|
| 31 | - $new_config['event_list'] = array( |
|
| 32 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 33 | - 'required' => array('[EVENT_LIST]') |
|
| 34 | - ); |
|
| 35 | - $this->_messenger->set_validator_config($new_config); |
|
| 24 | + /** |
|
| 25 | + * custom validator (restricting what was originally set by the messenger) |
|
| 26 | + */ |
|
| 27 | + protected function _modify_validator() |
|
| 28 | + { |
|
| 29 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | + // modify just event_list |
|
| 31 | + $new_config['event_list'] = array( |
|
| 32 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 33 | + 'required' => array('[EVENT_LIST]') |
|
| 34 | + ); |
|
| 35 | + $this->_messenger->set_validator_config($new_config); |
|
| 36 | 36 | |
| 37 | - if ($this->_context != 'admin') { |
|
| 38 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 39 | - } |
|
| 37 | + if ($this->_context != 'admin') { |
|
| 38 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 42 | - } |
|
| 41 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $this->_messenger->set_validator_config($new_config); |
| 39 | 39 | |
| 40 | 40 | if ($this->_context != 'admin') { |
| 41 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 41 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,30 +13,30 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Messages_Email_Not_Approved_Registration_Validator extends EE_Messages_Validator |
| 15 | 15 | { |
| 16 | - public function __construct($fields, $context) |
|
| 17 | - { |
|
| 18 | - $this->_m_name = 'email'; |
|
| 19 | - $this->_mt_name = 'not_approved_registration'; |
|
| 16 | + public function __construct($fields, $context) |
|
| 17 | + { |
|
| 18 | + $this->_m_name = 'email'; |
|
| 19 | + $this->_mt_name = 'not_approved_registration'; |
|
| 20 | 20 | |
| 21 | - parent::__construct($fields, $context); |
|
| 22 | - } |
|
| 21 | + parent::__construct($fields, $context); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * custom validator (restricting what was originally set by the messenger) |
|
| 26 | - */ |
|
| 27 | - protected function _modify_validator() |
|
| 28 | - { |
|
| 29 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | - $new_config['event_list'] = array( |
|
| 31 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 32 | - 'required' => array('[EVENT_LIST]') |
|
| 33 | - ); |
|
| 34 | - $this->_messenger->set_validator_config($new_config); |
|
| 24 | + /** |
|
| 25 | + * custom validator (restricting what was originally set by the messenger) |
|
| 26 | + */ |
|
| 27 | + protected function _modify_validator() |
|
| 28 | + { |
|
| 29 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | + $new_config['event_list'] = array( |
|
| 31 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 32 | + 'required' => array('[EVENT_LIST]') |
|
| 33 | + ); |
|
| 34 | + $this->_messenger->set_validator_config($new_config); |
|
| 35 | 35 | |
| 36 | - if ($this->_context != 'admin') { |
|
| 37 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 38 | - } |
|
| 36 | + if ($this->_context != 'admin') { |
|
| 37 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 41 | - } |
|
| 40 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $this->_messenger->set_validator_config($new_config); |
| 39 | 39 | |
| 40 | 40 | if ($this->_context != 'admin') { |
| 41 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 41 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,31 +13,31 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Messages_Email_Pending_Approval_Validator extends EE_Messages_Validator |
| 15 | 15 | { |
| 16 | - public function __construct($fields, $context) |
|
| 17 | - { |
|
| 18 | - $this->_m_name = 'email'; |
|
| 19 | - $this->_mt_name = 'pending_approval'; |
|
| 16 | + public function __construct($fields, $context) |
|
| 17 | + { |
|
| 18 | + $this->_m_name = 'email'; |
|
| 19 | + $this->_mt_name = 'pending_approval'; |
|
| 20 | 20 | |
| 21 | - parent::__construct($fields, $context); |
|
| 22 | - } |
|
| 21 | + parent::__construct($fields, $context); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * custom validator (restricting what was originally set by the messenger) |
|
| 26 | - */ |
|
| 27 | - protected function _modify_validator() |
|
| 28 | - { |
|
| 29 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | - // modify just event_list |
|
| 31 | - $new_config['event_list'] = array( |
|
| 32 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 33 | - 'required' => array('[EVENT_LIST]') |
|
| 34 | - ); |
|
| 35 | - $this->_messenger->set_validator_config($new_config); |
|
| 24 | + /** |
|
| 25 | + * custom validator (restricting what was originally set by the messenger) |
|
| 26 | + */ |
|
| 27 | + protected function _modify_validator() |
|
| 28 | + { |
|
| 29 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | + // modify just event_list |
|
| 31 | + $new_config['event_list'] = array( |
|
| 32 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 33 | + 'required' => array('[EVENT_LIST]') |
|
| 34 | + ); |
|
| 35 | + $this->_messenger->set_validator_config($new_config); |
|
| 36 | 36 | |
| 37 | - if ($this->_context != 'admin') { |
|
| 38 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 39 | - } |
|
| 37 | + if ($this->_context != 'admin') { |
|
| 38 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 42 | - } |
|
| 41 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -32,18 +32,18 @@ |
||
| 32 | 32 | |
| 33 | 33 | // modify just event_list |
| 34 | 34 | $new_config['event_list'] = array( |
| 35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 36 | 36 | ); |
| 37 | 37 | $new_config['ticket_list'] = array( |
| 38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
| 39 | 39 | ); |
| 40 | 40 | $new_config['content'] = array( |
| 41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 42 | 42 | ); |
| 43 | 43 | $this->_messenger->set_validator_config($new_config); |
| 44 | 44 | |
| 45 | 45 | if ($this->_context != 'admin') { |
| 46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,37 +13,37 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Messages_Email_Payment_Validator extends EE_Messages_Validator |
| 15 | 15 | { |
| 16 | - public function __construct($fields, $context) |
|
| 17 | - { |
|
| 18 | - $this->_m_name = 'email'; |
|
| 19 | - $this->_mt_name = 'payment'; |
|
| 16 | + public function __construct($fields, $context) |
|
| 17 | + { |
|
| 18 | + $this->_m_name = 'email'; |
|
| 19 | + $this->_mt_name = 'payment'; |
|
| 20 | 20 | |
| 21 | - parent::__construct($fields, $context); |
|
| 22 | - } |
|
| 21 | + parent::__construct($fields, $context); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
| 26 | - */ |
|
| 27 | - protected function _modify_validator() |
|
| 28 | - { |
|
| 29 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 24 | + /** |
|
| 25 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
| 26 | + */ |
|
| 27 | + protected function _modify_validator() |
|
| 28 | + { |
|
| 29 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | 30 | |
| 31 | - // modify just event_list |
|
| 32 | - $new_config['event_list'] = array( |
|
| 33 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 34 | - ); |
|
| 35 | - $new_config['ticket_list'] = array( |
|
| 36 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
| 37 | - ); |
|
| 38 | - $new_config['content'] = array( |
|
| 39 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 40 | - ); |
|
| 41 | - $this->_messenger->set_validator_config($new_config); |
|
| 31 | + // modify just event_list |
|
| 32 | + $new_config['event_list'] = array( |
|
| 33 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
| 34 | + ); |
|
| 35 | + $new_config['ticket_list'] = array( |
|
| 36 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
| 37 | + ); |
|
| 38 | + $new_config['content'] = array( |
|
| 39 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
| 40 | + ); |
|
| 41 | + $this->_messenger->set_validator_config($new_config); |
|
| 42 | 42 | |
| 43 | - if ($this->_context != 'admin') { |
|
| 44 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 45 | - } |
|
| 43 | + if ($this->_context != 'admin') { |
|
| 44 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 48 | - } |
|
| 47 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $this->_messenger->set_validator_config($new_config); |
| 39 | 39 | |
| 40 | 40 | if ($this->_context != 'admin') { |
| 41 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 41 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,31 +13,31 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Messages_Email_Registration_Validator extends EE_Messages_Validator |
| 15 | 15 | { |
| 16 | - public function __construct($fields, $context) |
|
| 17 | - { |
|
| 18 | - $this->_m_name = 'email'; |
|
| 19 | - $this->_mt_name = 'registration'; |
|
| 16 | + public function __construct($fields, $context) |
|
| 17 | + { |
|
| 18 | + $this->_m_name = 'email'; |
|
| 19 | + $this->_mt_name = 'registration'; |
|
| 20 | 20 | |
| 21 | - parent::__construct($fields, $context); |
|
| 22 | - } |
|
| 21 | + parent::__construct($fields, $context); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * custom validator (restricting what was originally set by the messenger) |
|
| 26 | - */ |
|
| 27 | - protected function _modify_validator() |
|
| 28 | - { |
|
| 29 | - $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | - // modify just event_list |
|
| 31 | - $new_config['event_list'] = array( |
|
| 32 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 33 | - 'required' => array('[EVENT_LIST]') |
|
| 34 | - ); |
|
| 35 | - $this->_messenger->set_validator_config($new_config); |
|
| 24 | + /** |
|
| 25 | + * custom validator (restricting what was originally set by the messenger) |
|
| 26 | + */ |
|
| 27 | + protected function _modify_validator() |
|
| 28 | + { |
|
| 29 | + $new_config = $this->_messenger->get_validator_config(); |
|
| 30 | + // modify just event_list |
|
| 31 | + $new_config['event_list'] = array( |
|
| 32 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
| 33 | + 'required' => array('[EVENT_LIST]') |
|
| 34 | + ); |
|
| 35 | + $this->_messenger->set_validator_config($new_config); |
|
| 36 | 36 | |
| 37 | - if ($this->_context != 'admin') { |
|
| 38 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 39 | - } |
|
| 37 | + if ($this->_context != 'admin') { |
|
| 38 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 42 | - } |
|
| 41 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -89,8 +89,8 @@ |
||
| 89 | 89 | public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
| 90 | 90 | { |
| 91 | 91 | $options = $this->_allowed_enum_values(); |
| 92 | - if (isset($options[ $value_on_field_to_be_outputted ])) { |
|
| 93 | - return $options[ $value_on_field_to_be_outputted ]; |
|
| 92 | + if (isset($options[$value_on_field_to_be_outputted])) { |
|
| 93 | + return $options[$value_on_field_to_be_outputted]; |
|
| 94 | 94 | } else { |
| 95 | 95 | return $value_on_field_to_be_outputted; |
| 96 | 96 | } |
@@ -10,131 +10,131 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class EE_Enum_Text_Field extends EE_Text_Field_Base |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @var array $_allowed_enum_values |
|
| 15 | - */ |
|
| 16 | - public $_allowed_enum_values; |
|
| 13 | + /** |
|
| 14 | + * @var array $_allowed_enum_values |
|
| 15 | + */ |
|
| 16 | + public $_allowed_enum_values; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @param string $table_column |
|
| 20 | - * @param string $nice_name |
|
| 21 | - * @param boolean $nullable |
|
| 22 | - * @param mixed $default_value |
|
| 23 | - * @param array $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed |
|
| 24 | - */ |
|
| 25 | - public function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
|
| 26 | - { |
|
| 27 | - $this->_allowed_enum_values = $allowed_enum_values; |
|
| 28 | - parent::__construct($table_column, $nice_name, $nullable, $default_value); |
|
| 29 | - $this->setSchemaType('object'); |
|
| 30 | - } |
|
| 18 | + /** |
|
| 19 | + * @param string $table_column |
|
| 20 | + * @param string $nice_name |
|
| 21 | + * @param boolean $nullable |
|
| 22 | + * @param mixed $default_value |
|
| 23 | + * @param array $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed |
|
| 24 | + */ |
|
| 25 | + public function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
|
| 26 | + { |
|
| 27 | + $this->_allowed_enum_values = $allowed_enum_values; |
|
| 28 | + parent::__construct($table_column, $nice_name, $nullable, $default_value); |
|
| 29 | + $this->setSchemaType('object'); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Returns the list of allowed enum options, but filterable. |
|
| 36 | - * This is used internally |
|
| 37 | - * |
|
| 38 | - * @return array |
|
| 39 | - */ |
|
| 40 | - protected function _allowed_enum_values() |
|
| 41 | - { |
|
| 42 | - return apply_filters( |
|
| 43 | - 'FHEE__EE_Enum_Text_Field___allowed_enum_options', |
|
| 44 | - $this->_allowed_enum_values, |
|
| 45 | - $this |
|
| 46 | - ); |
|
| 47 | - } |
|
| 34 | + /** |
|
| 35 | + * Returns the list of allowed enum options, but filterable. |
|
| 36 | + * This is used internally |
|
| 37 | + * |
|
| 38 | + * @return array |
|
| 39 | + */ |
|
| 40 | + protected function _allowed_enum_values() |
|
| 41 | + { |
|
| 42 | + return apply_filters( |
|
| 43 | + 'FHEE__EE_Enum_Text_Field___allowed_enum_options', |
|
| 44 | + $this->_allowed_enum_values, |
|
| 45 | + $this |
|
| 46 | + ); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * When setting, just verify that the value being used matches what we've defined as allowable enum values. |
|
| 53 | - * If not, throw an error (but if WP_DEBUG is false, just set the value to default). |
|
| 54 | - * |
|
| 55 | - * @param string $value_inputted_for_field_on_model_object |
|
| 56 | - * @return string |
|
| 57 | - * @throws EE_Error |
|
| 58 | - */ |
|
| 59 | - public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 60 | - { |
|
| 61 | - if ( |
|
| 62 | - $value_inputted_for_field_on_model_object !== null |
|
| 63 | - && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values()) |
|
| 64 | - ) { |
|
| 65 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 66 | - $msg = sprintf( |
|
| 67 | - esc_html__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'), |
|
| 68 | - $value_inputted_for_field_on_model_object, |
|
| 69 | - $this->_name |
|
| 70 | - ); |
|
| 71 | - $msg2 = sprintf( |
|
| 72 | - esc_html__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'), |
|
| 73 | - $this->_name, |
|
| 74 | - implode(', ', array_keys($this->_allowed_enum_values())), |
|
| 75 | - $value_inputted_for_field_on_model_object |
|
| 76 | - ); |
|
| 77 | - EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__); |
|
| 78 | - } |
|
| 79 | - return $this->get_default_value(); |
|
| 80 | - } |
|
| 81 | - return $value_inputted_for_field_on_model_object; |
|
| 82 | - } |
|
| 51 | + /** |
|
| 52 | + * When setting, just verify that the value being used matches what we've defined as allowable enum values. |
|
| 53 | + * If not, throw an error (but if WP_DEBUG is false, just set the value to default). |
|
| 54 | + * |
|
| 55 | + * @param string $value_inputted_for_field_on_model_object |
|
| 56 | + * @return string |
|
| 57 | + * @throws EE_Error |
|
| 58 | + */ |
|
| 59 | + public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 60 | + { |
|
| 61 | + if ( |
|
| 62 | + $value_inputted_for_field_on_model_object !== null |
|
| 63 | + && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values()) |
|
| 64 | + ) { |
|
| 65 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 66 | + $msg = sprintf( |
|
| 67 | + esc_html__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'), |
|
| 68 | + $value_inputted_for_field_on_model_object, |
|
| 69 | + $this->_name |
|
| 70 | + ); |
|
| 71 | + $msg2 = sprintf( |
|
| 72 | + esc_html__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'), |
|
| 73 | + $this->_name, |
|
| 74 | + implode(', ', array_keys($this->_allowed_enum_values())), |
|
| 75 | + $value_inputted_for_field_on_model_object |
|
| 76 | + ); |
|
| 77 | + EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__); |
|
| 78 | + } |
|
| 79 | + return $this->get_default_value(); |
|
| 80 | + } |
|
| 81 | + return $value_inputted_for_field_on_model_object; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Gets the pretty version of the enum's value. |
|
| 87 | - * |
|
| 88 | - * @param int |string $value_on_field_to_be_outputted |
|
| 89 | - * @param null $schema |
|
| 90 | - * @return string |
|
| 91 | - */ |
|
| 92 | - public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
| 93 | - { |
|
| 94 | - $options = $this->_allowed_enum_values(); |
|
| 95 | - if (isset($options[ $value_on_field_to_be_outputted ])) { |
|
| 96 | - return $options[ $value_on_field_to_be_outputted ]; |
|
| 97 | - } else { |
|
| 98 | - return $value_on_field_to_be_outputted; |
|
| 99 | - } |
|
| 100 | - } |
|
| 85 | + /** |
|
| 86 | + * Gets the pretty version of the enum's value. |
|
| 87 | + * |
|
| 88 | + * @param int |string $value_on_field_to_be_outputted |
|
| 89 | + * @param null $schema |
|
| 90 | + * @return string |
|
| 91 | + */ |
|
| 92 | + public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
| 93 | + { |
|
| 94 | + $options = $this->_allowed_enum_values(); |
|
| 95 | + if (isset($options[ $value_on_field_to_be_outputted ])) { |
|
| 96 | + return $options[ $value_on_field_to_be_outputted ]; |
|
| 97 | + } else { |
|
| 98 | + return $value_on_field_to_be_outputted; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * When retrieving something from the DB, don't enforce the enum's options. If it's in the DB, we just have to live |
|
| 106 | - * with that. Note also: when we're saving to the DB again, we also don't enforce the enum options. It's ONLY |
|
| 107 | - * when we're receiving USER input from prepare_for_set() that we enforce the enum options. |
|
| 108 | - * |
|
| 109 | - * @param mixed $value_in_db |
|
| 110 | - * @return mixed |
|
| 111 | - */ |
|
| 112 | - public function prepare_for_set_from_db($value_in_db) |
|
| 113 | - { |
|
| 114 | - return $value_in_db; |
|
| 115 | - } |
|
| 104 | + /** |
|
| 105 | + * When retrieving something from the DB, don't enforce the enum's options. If it's in the DB, we just have to live |
|
| 106 | + * with that. Note also: when we're saving to the DB again, we also don't enforce the enum options. It's ONLY |
|
| 107 | + * when we're receiving USER input from prepare_for_set() that we enforce the enum options. |
|
| 108 | + * |
|
| 109 | + * @param mixed $value_in_db |
|
| 110 | + * @return mixed |
|
| 111 | + */ |
|
| 112 | + public function prepare_for_set_from_db($value_in_db) |
|
| 113 | + { |
|
| 114 | + return $value_in_db; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | - public function getSchemaProperties() |
|
| 119 | - { |
|
| 120 | - return array( |
|
| 121 | - 'raw' => array( |
|
| 122 | - 'description' => sprintf( |
|
| 123 | - esc_html__('%s - the value in the database.', 'event_espresso'), |
|
| 124 | - $this->get_nicename() |
|
| 125 | - ), |
|
| 126 | - 'type' => 'string', |
|
| 127 | - 'enum' => array_keys($this->_allowed_enum_values) |
|
| 128 | - ), |
|
| 129 | - 'pretty' => array( |
|
| 130 | - 'description' => sprintf( |
|
| 131 | - esc_html__('%s - the value for display.', 'event_espresso'), |
|
| 132 | - $this->get_nicename() |
|
| 133 | - ), |
|
| 134 | - 'type' => 'string', |
|
| 135 | - 'enum' => array_values($this->_allowed_enum_values), |
|
| 136 | - 'read_only' => true |
|
| 137 | - ) |
|
| 138 | - ); |
|
| 139 | - } |
|
| 118 | + public function getSchemaProperties() |
|
| 119 | + { |
|
| 120 | + return array( |
|
| 121 | + 'raw' => array( |
|
| 122 | + 'description' => sprintf( |
|
| 123 | + esc_html__('%s - the value in the database.', 'event_espresso'), |
|
| 124 | + $this->get_nicename() |
|
| 125 | + ), |
|
| 126 | + 'type' => 'string', |
|
| 127 | + 'enum' => array_keys($this->_allowed_enum_values) |
|
| 128 | + ), |
|
| 129 | + 'pretty' => array( |
|
| 130 | + 'description' => sprintf( |
|
| 131 | + esc_html__('%s - the value for display.', 'event_espresso'), |
|
| 132 | + $this->get_nicename() |
|
| 133 | + ), |
|
| 134 | + 'type' => 'string', |
|
| 135 | + 'enum' => array_values($this->_allowed_enum_values), |
|
| 136 | + 'read_only' => true |
|
| 137 | + ) |
|
| 138 | + ); |
|
| 139 | + } |
|
| 140 | 140 | } |