@@ -48,9 +48,9 @@ |
||
48 | 48 | { |
49 | 49 | global $wpdb; |
50 | 50 | $wpdb->delete( |
51 | - $wpdb->prefix . 'esp_answer', |
|
52 | - array( 'REG_ID' => 0 ), |
|
53 | - array( '%d' ) |
|
51 | + $wpdb->prefix.'esp_answer', |
|
52 | + array('REG_ID' => 0), |
|
53 | + array('%d') |
|
54 | 54 | ); |
55 | 55 | $this->set_completed(); |
56 | 56 | return 1; |
@@ -15,44 +15,44 @@ |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Just initializes the status of the migration |
|
20 | - * |
|
21 | - * @return EE_DMS_4_9_0_Answers_With_No_Registration |
|
22 | - */ |
|
23 | - public function __construct() |
|
24 | - { |
|
25 | - $this->_pretty_name = esc_html__('Answer Cleanup', 'event_espresso'); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
18 | + /** |
|
19 | + * Just initializes the status of the migration |
|
20 | + * |
|
21 | + * @return EE_DMS_4_9_0_Answers_With_No_Registration |
|
22 | + */ |
|
23 | + public function __construct() |
|
24 | + { |
|
25 | + $this->_pretty_name = esc_html__('Answer Cleanup', 'event_espresso'); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Counts the records to migrate; the public version may cache it |
|
31 | - * @return int |
|
32 | - */ |
|
33 | - protected function _count_records_to_migrate() |
|
34 | - { |
|
35 | - return 1; |
|
36 | - } |
|
29 | + /** |
|
30 | + * Counts the records to migrate; the public version may cache it |
|
31 | + * @return int |
|
32 | + */ |
|
33 | + protected function _count_records_to_migrate() |
|
34 | + { |
|
35 | + return 1; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly. |
|
40 | - * Note: it should not alter the count of items migrated. That is done in the public function that calls this. |
|
41 | - * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it |
|
42 | - * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50, |
|
43 | - * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated) |
|
44 | - * @param int $num_items_to_migrate |
|
45 | - * @return int number of items ACTUALLY migrated |
|
46 | - */ |
|
47 | - protected function _migration_step($num_items_to_migrate = 50) |
|
48 | - { |
|
49 | - global $wpdb; |
|
50 | - $wpdb->delete( |
|
51 | - $wpdb->prefix . 'esp_answer', |
|
52 | - array( 'REG_ID' => 0 ), |
|
53 | - array( '%d' ) |
|
54 | - ); |
|
55 | - $this->set_completed(); |
|
56 | - return 1; |
|
57 | - } |
|
38 | + /** |
|
39 | + * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly. |
|
40 | + * Note: it should not alter the count of items migrated. That is done in the public function that calls this. |
|
41 | + * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it |
|
42 | + * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50, |
|
43 | + * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated) |
|
44 | + * @param int $num_items_to_migrate |
|
45 | + * @return int number of items ACTUALLY migrated |
|
46 | + */ |
|
47 | + protected function _migration_step($num_items_to_migrate = 50) |
|
48 | + { |
|
49 | + global $wpdb; |
|
50 | + $wpdb->delete( |
|
51 | + $wpdb->prefix . 'esp_answer', |
|
52 | + array( 'REG_ID' => 0 ), |
|
53 | + array( '%d' ) |
|
54 | + ); |
|
55 | + $this->set_completed(); |
|
56 | + return 1; |
|
57 | + } |
|
58 | 58 | } |
@@ -37,103 +37,103 @@ |
||
37 | 37 | */ |
38 | 38 | abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base |
39 | 39 | { |
40 | - /** |
|
41 | - * The migration script this is a stage of |
|
42 | - * |
|
43 | - * @var EE_Data_Migration_Script_Base |
|
44 | - */ |
|
45 | - protected $_migration_script; |
|
40 | + /** |
|
41 | + * The migration script this is a stage of |
|
42 | + * |
|
43 | + * @var EE_Data_Migration_Script_Base |
|
44 | + */ |
|
45 | + protected $_migration_script; |
|
46 | 46 | |
47 | - /** |
|
48 | - * This should eb called to essentially 'finalize' construction of the stage. |
|
49 | - * This isn't done on the main constructor in order to avoid repetitive code. Instead, this is |
|
50 | - * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to |
|
51 | - * |
|
52 | - * @param EE_Data_Migration_Script_Base $migration_script |
|
53 | - */ |
|
54 | - public function _construct_finalize($migration_script) |
|
55 | - { |
|
56 | - $this->_migration_script = $migration_script; |
|
57 | - } |
|
47 | + /** |
|
48 | + * This should eb called to essentially 'finalize' construction of the stage. |
|
49 | + * This isn't done on the main constructor in order to avoid repetitive code. Instead, this is |
|
50 | + * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to |
|
51 | + * |
|
52 | + * @param EE_Data_Migration_Script_Base $migration_script |
|
53 | + */ |
|
54 | + public function _construct_finalize($migration_script) |
|
55 | + { |
|
56 | + $this->_migration_script = $migration_script; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Migrates X old records to the new format. If a fatal error is encountered it is NOT caught here, |
|
61 | - * but is propagated upwards for catching. So basically, the _migration_step() function implemented by children |
|
62 | - * needs to catch exceptions and decide what's a fatal error and what isn't. |
|
63 | - * |
|
64 | - * @param int $num_items_to_migrate |
|
65 | - * @return int |
|
66 | - */ |
|
67 | - public function migration_step($num_items_to_migrate = 50) |
|
68 | - { |
|
69 | - // before we run the migration step, we want ot take note of warnings that get outputted |
|
70 | - ob_start(); |
|
71 | - $items_migrated = $this->_migration_step($num_items_to_migrate); |
|
72 | - $output = ob_get_contents(); |
|
73 | - ob_end_clean(); |
|
74 | - if ($output) { |
|
75 | - $this->add_error($output); |
|
76 | - } |
|
77 | - $this->_records_migrated += $items_migrated; |
|
78 | - return $items_migrated; |
|
79 | - } |
|
59 | + /** |
|
60 | + * Migrates X old records to the new format. If a fatal error is encountered it is NOT caught here, |
|
61 | + * but is propagated upwards for catching. So basically, the _migration_step() function implemented by children |
|
62 | + * needs to catch exceptions and decide what's a fatal error and what isn't. |
|
63 | + * |
|
64 | + * @param int $num_items_to_migrate |
|
65 | + * @return int |
|
66 | + */ |
|
67 | + public function migration_step($num_items_to_migrate = 50) |
|
68 | + { |
|
69 | + // before we run the migration step, we want ot take note of warnings that get outputted |
|
70 | + ob_start(); |
|
71 | + $items_migrated = $this->_migration_step($num_items_to_migrate); |
|
72 | + $output = ob_get_contents(); |
|
73 | + ob_end_clean(); |
|
74 | + if ($output) { |
|
75 | + $this->add_error($output); |
|
76 | + } |
|
77 | + $this->_records_migrated += $items_migrated; |
|
78 | + return $items_migrated; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property |
|
84 | - * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that |
|
85 | - * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the |
|
86 | - * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees |
|
87 | - * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at |
|
88 | - * very least we MUST report/return 50 items migrated) |
|
89 | - * |
|
90 | - * @param int $num_items_to_migrate |
|
91 | - * @return int number of items ACTUALLY migrated |
|
92 | - */ |
|
93 | - abstract protected function _migration_step($num_items_to_migrate = 50); |
|
82 | + /** |
|
83 | + * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property |
|
84 | + * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that |
|
85 | + * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the |
|
86 | + * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees |
|
87 | + * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at |
|
88 | + * very least we MUST report/return 50 items migrated) |
|
89 | + * |
|
90 | + * @param int $num_items_to_migrate |
|
91 | + * @return int number of items ACTUALLY migrated |
|
92 | + */ |
|
93 | + abstract protected function _migration_step($num_items_to_migrate = 50); |
|
94 | 94 | |
95 | - /** |
|
96 | - * Counts the records that have been migrated so far |
|
97 | - * |
|
98 | - * @return int |
|
99 | - */ |
|
100 | - public function count_records_migrated() |
|
101 | - { |
|
102 | - return $this->_records_migrated; |
|
103 | - } |
|
95 | + /** |
|
96 | + * Counts the records that have been migrated so far |
|
97 | + * |
|
98 | + * @return int |
|
99 | + */ |
|
100 | + public function count_records_migrated() |
|
101 | + { |
|
102 | + return $this->_records_migrated; |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * returns an array of strings describing errors |
|
107 | - * |
|
108 | - * @return array |
|
109 | - */ |
|
110 | - public function get_errors() |
|
111 | - { |
|
112 | - return $this->_errors; |
|
113 | - } |
|
105 | + /** |
|
106 | + * returns an array of strings describing errors |
|
107 | + * |
|
108 | + * @return array |
|
109 | + */ |
|
110 | + public function get_errors() |
|
111 | + { |
|
112 | + return $this->_errors; |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * Sets all of the properties of this script stage to match what's in the array, which is assumed |
|
118 | - * to have been made from the properties_as_array() function. |
|
119 | - * |
|
120 | - * @param array $array_of_properties like what's produced from properties_as_array() method |
|
121 | - */ |
|
122 | - public function instantiate_from_array_of_properties($array_of_properties) |
|
123 | - { |
|
124 | - unset($array_of_properties['class']); |
|
125 | - foreach ($array_of_properties as $property_name => $property_value) { |
|
126 | - $this->{$property_name} = $property_value; |
|
127 | - } |
|
128 | - } |
|
116 | + /** |
|
117 | + * Sets all of the properties of this script stage to match what's in the array, which is assumed |
|
118 | + * to have been made from the properties_as_array() function. |
|
119 | + * |
|
120 | + * @param array $array_of_properties like what's produced from properties_as_array() method |
|
121 | + */ |
|
122 | + public function instantiate_from_array_of_properties($array_of_properties) |
|
123 | + { |
|
124 | + unset($array_of_properties['class']); |
|
125 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
126 | + $this->{$property_name} = $property_value; |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Gets the script this is a stage of |
|
132 | - * |
|
133 | - * @return EE_Data_Migration_Script_Base |
|
134 | - */ |
|
135 | - protected function get_migration_script() |
|
136 | - { |
|
137 | - return $this->_migration_script; |
|
138 | - } |
|
130 | + /** |
|
131 | + * Gets the script this is a stage of |
|
132 | + * |
|
133 | + * @return EE_Data_Migration_Script_Base |
|
134 | + */ |
|
135 | + protected function get_migration_script() |
|
136 | + { |
|
137 | + return $this->_migration_script; |
|
138 | + } |
|
139 | 139 | } |
@@ -17,38 +17,38 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @type \EventEspresso\core\Psr4Autoloader |
|
22 | - */ |
|
23 | - protected static $psr4_loader; |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * @return \EventEspresso\core\Psr4Autoloader |
|
28 | - */ |
|
29 | - public function initializeAutoloader() |
|
30 | - { |
|
31 | - static $initialized = false; |
|
32 | - if (! $initialized) { |
|
33 | - // instantiate PSR4 autoloader |
|
34 | - espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php'); |
|
35 | - EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader(); |
|
36 | - // register the autoloader |
|
37 | - EE_Psr4AutoloaderInit::$psr4_loader->register(); |
|
38 | - // register the base directories for the namespace prefix |
|
39 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
|
40 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch'); |
|
41 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY); |
|
42 | - $initialized = true; |
|
43 | - } |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * @return \EventEspresso\core\Psr4Autoloader |
|
49 | - */ |
|
50 | - public static function psr4_loader() |
|
51 | - { |
|
52 | - return self::$psr4_loader; |
|
53 | - } |
|
20 | + /** |
|
21 | + * @type \EventEspresso\core\Psr4Autoloader |
|
22 | + */ |
|
23 | + protected static $psr4_loader; |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * @return \EventEspresso\core\Psr4Autoloader |
|
28 | + */ |
|
29 | + public function initializeAutoloader() |
|
30 | + { |
|
31 | + static $initialized = false; |
|
32 | + if (! $initialized) { |
|
33 | + // instantiate PSR4 autoloader |
|
34 | + espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php'); |
|
35 | + EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader(); |
|
36 | + // register the autoloader |
|
37 | + EE_Psr4AutoloaderInit::$psr4_loader->register(); |
|
38 | + // register the base directories for the namespace prefix |
|
39 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
|
40 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch'); |
|
41 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY); |
|
42 | + $initialized = true; |
|
43 | + } |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * @return \EventEspresso\core\Psr4Autoloader |
|
49 | + */ |
|
50 | + public static function psr4_loader() |
|
51 | + { |
|
52 | + return self::$psr4_loader; |
|
53 | + } |
|
54 | 54 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | public function initializeAutoloader() |
30 | 30 | { |
31 | 31 | static $initialized = false; |
32 | - if (! $initialized) { |
|
32 | + if ( ! $initialized) { |
|
33 | 33 | // instantiate PSR4 autoloader |
34 | - espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php'); |
|
34 | + espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php'); |
|
35 | 35 | EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader(); |
36 | 36 | // register the autoloader |
37 | 37 | EE_Psr4AutoloaderInit::$psr4_loader->register(); |
38 | 38 | // register the base directories for the namespace prefix |
39 | 39 | EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
40 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch'); |
|
40 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES.'batch'); |
|
41 | 41 | EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY); |
42 | 42 | $initialized = true; |
43 | 43 | } |
@@ -16,98 +16,98 @@ |
||
16 | 16 | abstract class EE_Object_Repository extends EE_Object_Collection implements EEI_Repository |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * default persist method called on repository objects if none supplied |
|
21 | - * |
|
22 | - * @type string $persist_method |
|
23 | - */ |
|
24 | - protected $persist_method; |
|
19 | + /** |
|
20 | + * default persist method called on repository objects if none supplied |
|
21 | + * |
|
22 | + * @type string $persist_method |
|
23 | + */ |
|
24 | + protected $persist_method; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * _call_user_func_array_on_current |
|
29 | - * |
|
30 | - * calls the supplied callback method name on the current repository object, |
|
31 | - * an array of arguments can also be supplied that will be passed along to the callback method, |
|
32 | - * where each element of the $arguments array corresponds to a parameter for the callback method |
|
33 | - * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' ) |
|
34 | - * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) ) |
|
35 | - * |
|
36 | - * @access public |
|
37 | - * @param string $callback name of method found on object to be called. |
|
38 | - * @param array $arguments arrays of arguments that will be passed to the object's callback method |
|
39 | - * @return bool | int |
|
40 | - */ |
|
41 | - protected function _call_user_func_array_on_current($callback = '', $arguments = array()) |
|
42 | - { |
|
43 | - if ($callback !== '' && method_exists($this->current(), $callback)) { |
|
44 | - return call_user_func_array(array($this->current(), $callback), $arguments); |
|
45 | - } |
|
46 | - return false; |
|
47 | - } |
|
27 | + /** |
|
28 | + * _call_user_func_array_on_current |
|
29 | + * |
|
30 | + * calls the supplied callback method name on the current repository object, |
|
31 | + * an array of arguments can also be supplied that will be passed along to the callback method, |
|
32 | + * where each element of the $arguments array corresponds to a parameter for the callback method |
|
33 | + * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' ) |
|
34 | + * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) ) |
|
35 | + * |
|
36 | + * @access public |
|
37 | + * @param string $callback name of method found on object to be called. |
|
38 | + * @param array $arguments arrays of arguments that will be passed to the object's callback method |
|
39 | + * @return bool | int |
|
40 | + */ |
|
41 | + protected function _call_user_func_array_on_current($callback = '', $arguments = array()) |
|
42 | + { |
|
43 | + if ($callback !== '' && method_exists($this->current(), $callback)) { |
|
44 | + return call_user_func_array(array($this->current(), $callback), $arguments); |
|
45 | + } |
|
46 | + return false; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * _call_user_func_on_all |
|
52 | - * |
|
53 | - * calls the supplied callback method name on ALL repository objects, |
|
54 | - * |
|
55 | - * @access public |
|
56 | - * @param string $callback name of method found on repository objects to be called |
|
57 | - * @return bool | int |
|
58 | - */ |
|
59 | - protected function _call_user_func_on_all($callback = '') |
|
60 | - { |
|
61 | - $success = true; |
|
62 | - if ($this->valid()) { |
|
63 | - $this->rewind(); |
|
64 | - while ($this->valid()) { |
|
65 | - // any negative result will toggle success to false |
|
66 | - $success = $this->_call_user_func_array_on_current($callback) ? $success : false; |
|
67 | - $this->next(); |
|
68 | - } |
|
69 | - $this->rewind(); |
|
70 | - } |
|
71 | - return $success; |
|
72 | - } |
|
50 | + /** |
|
51 | + * _call_user_func_on_all |
|
52 | + * |
|
53 | + * calls the supplied callback method name on ALL repository objects, |
|
54 | + * |
|
55 | + * @access public |
|
56 | + * @param string $callback name of method found on repository objects to be called |
|
57 | + * @return bool | int |
|
58 | + */ |
|
59 | + protected function _call_user_func_on_all($callback = '') |
|
60 | + { |
|
61 | + $success = true; |
|
62 | + if ($this->valid()) { |
|
63 | + $this->rewind(); |
|
64 | + while ($this->valid()) { |
|
65 | + // any negative result will toggle success to false |
|
66 | + $success = $this->_call_user_func_array_on_current($callback) ? $success : false; |
|
67 | + $this->next(); |
|
68 | + } |
|
69 | + $this->rewind(); |
|
70 | + } |
|
71 | + return $success; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * persist |
|
77 | - * |
|
78 | - * primarily used for saving EE_Base_Class classes to the database, |
|
79 | - * but can be supplied with a "persistence callback" that can be used for classes that are not instances of |
|
80 | - * EE_Base_Class, or for providing alternate ways to persist an object such as session caching, etc... an array of |
|
81 | - * arguments can also be supplied that will be passed along to the object's persistence method |
|
82 | - * |
|
83 | - * @access public |
|
84 | - * @param string $persistence_callback name of method found on object that can |
|
85 | - * be used for persisting the object |
|
86 | - * defaults to |
|
87 | - * EE_Object_Repository::$persist_method |
|
88 | - * @param array $persistence_arguments arrays of arguments that will be passed |
|
89 | - * to the object's persistence method |
|
90 | - * @return bool | int |
|
91 | - */ |
|
92 | - public function persist($persistence_callback = '', $persistence_arguments = array()) |
|
93 | - { |
|
94 | - $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
95 | - return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments); |
|
96 | - } |
|
75 | + /** |
|
76 | + * persist |
|
77 | + * |
|
78 | + * primarily used for saving EE_Base_Class classes to the database, |
|
79 | + * but can be supplied with a "persistence callback" that can be used for classes that are not instances of |
|
80 | + * EE_Base_Class, or for providing alternate ways to persist an object such as session caching, etc... an array of |
|
81 | + * arguments can also be supplied that will be passed along to the object's persistence method |
|
82 | + * |
|
83 | + * @access public |
|
84 | + * @param string $persistence_callback name of method found on object that can |
|
85 | + * be used for persisting the object |
|
86 | + * defaults to |
|
87 | + * EE_Object_Repository::$persist_method |
|
88 | + * @param array $persistence_arguments arrays of arguments that will be passed |
|
89 | + * to the object's persistence method |
|
90 | + * @return bool | int |
|
91 | + */ |
|
92 | + public function persist($persistence_callback = '', $persistence_arguments = array()) |
|
93 | + { |
|
94 | + $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
95 | + return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments); |
|
96 | + } |
|
97 | 97 | |
98 | 98 | |
99 | - /** |
|
100 | - * persist_all |
|
101 | - * |
|
102 | - * calls \EE_Object_Repository::persist() on all objects within the repository |
|
103 | - * |
|
104 | - * @access public |
|
105 | - * @param string $persistence_callback name of method found on object that can be used for persisting the object |
|
106 | - * @return bool | int |
|
107 | - */ |
|
108 | - public function persist_all($persistence_callback = '') |
|
109 | - { |
|
110 | - $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
111 | - return $this->_call_user_func_on_all($persistence_callback); |
|
112 | - } |
|
99 | + /** |
|
100 | + * persist_all |
|
101 | + * |
|
102 | + * calls \EE_Object_Repository::persist() on all objects within the repository |
|
103 | + * |
|
104 | + * @access public |
|
105 | + * @param string $persistence_callback name of method found on object that can be used for persisting the object |
|
106 | + * @return bool | int |
|
107 | + */ |
|
108 | + public function persist_all($persistence_callback = '') |
|
109 | + { |
|
110 | + $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
111 | + return $this->_call_user_func_on_all($persistence_callback); |
|
112 | + } |
|
113 | 113 | } |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | public function get_stops() |
257 | 257 | { |
258 | 258 | foreach ($this->_stops as $ind => $stop) { |
259 | - if (! isset($stop['button_text'])) { |
|
260 | - $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
259 | + if ( ! isset($stop['button_text'])) { |
|
260 | + $this->_stops[$ind]['button_text'] = $this->_options['button_text']; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | return $this->_stops; |
@@ -277,6 +277,6 @@ discard block |
||
277 | 277 | $this->_options['pauseAfter'][] = $ind; |
278 | 278 | } |
279 | 279 | } |
280 | - return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
280 | + return apply_filters('FHEE__'.get_class($this).'__get_options', $this->_options, $this); |
|
281 | 281 | } |
282 | 282 | } |
@@ -18,271 +18,271 @@ |
||
18 | 18 | abstract class EE_Help_Tour extends EE_Base |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the |
|
23 | - * constructor of the child class. |
|
24 | - * |
|
25 | - * @access protected |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - protected $_label = ''; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * This is the slug for the tour. It should be unique from all tours and is used for starting a tour and setting |
|
33 | - * cookies for the tour. Set this in the constructor of the child class. |
|
34 | - * |
|
35 | - * @access protected |
|
36 | - * @var string |
|
37 | - */ |
|
38 | - protected $_slug = ''; |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for |
|
43 | - * setting up a tour on a given page. format for array is: array( |
|
44 | - * 0 => array( |
|
45 | - * 'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take |
|
46 | - * precendence even if you also set class. |
|
47 | - * 'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use |
|
48 | - * this param. The first element for that class is the anchor. If the class or the id are empty then the |
|
49 | - * stop will be a modal on the page anchored to the main body. |
|
50 | - * 'custom_class' => 'some_custom_class', //optional custom class to add for this stop. |
|
51 | - * 'button_text' => 'custom text for button', //optional |
|
52 | - * 'content' => 'The content for the stop', //required |
|
53 | - * 'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get |
|
54 | - * added to the pauseAfter global option array setup for the joyride instance. This is only applicable |
|
55 | - * when this tour has been set to run on timer. |
|
56 | - * 'options' => array( |
|
57 | - * //override any of the global options set via the help_tour "option_callback" for the joyride |
|
58 | - * instance on this specific stop. |
|
59 | - * ) |
|
60 | - * ) |
|
61 | - * ); |
|
62 | - * |
|
63 | - * @access protected |
|
64 | - * @var array |
|
65 | - */ |
|
66 | - protected $_stops = array(); |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * This contains any stop specific options for the tour. |
|
71 | - * defaults are set but child classes can override. |
|
72 | - * |
|
73 | - * @access protected |
|
74 | - * @var array |
|
75 | - */ |
|
76 | - protected $_options = array(); |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * holds anything found in the request object (however we override any _gets with _post data). |
|
81 | - * |
|
82 | - * @access protected |
|
83 | - * @var array |
|
84 | - */ |
|
85 | - protected $_req_data = array(); |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * a flag that is set on init for whether this help_tour is happening on a caf install or not. |
|
90 | - * |
|
91 | - * @var boolean |
|
92 | - */ |
|
93 | - protected $_is_caf = false; |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * _constructor |
|
98 | - * initialized the tour object and sets up important properties required to setup the tour. |
|
99 | - * |
|
100 | - * @access public |
|
101 | - * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
|
102 | - * @return void |
|
103 | - */ |
|
104 | - public function __construct($caf = false) |
|
105 | - { |
|
106 | - $this->_is_caf = $caf; |
|
107 | - /** @var RequestInterface $request */ |
|
108 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
109 | - $this->_req_data = $request->requestParams(); |
|
110 | - $this->_set_tour_properties(); |
|
111 | - $this->_set_tour_stops(); |
|
112 | - $this->_set_tour_options(); |
|
113 | - |
|
114 | - // make sure the last tour stop has "end tour" for its button |
|
115 | - $end = array_pop($this->_stops); |
|
116 | - $end['button_text'] = esc_html__('End Tour', 'event_espresso'); |
|
117 | - // add back to stops |
|
118 | - $this->_stops[] = $end; |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * required method that has the sole purpose of setting up the tour $_label and $_slug properties |
|
124 | - * |
|
125 | - * @abstract |
|
126 | - * @access protected |
|
127 | - * @return void |
|
128 | - */ |
|
129 | - abstract protected function _set_tour_properties(); |
|
130 | - |
|
131 | - |
|
132 | - /** |
|
133 | - * required method that's sole purpose is to setup the $_stops property |
|
134 | - * |
|
135 | - * @abstract |
|
136 | - * @access protected |
|
137 | - * @return void |
|
138 | - */ |
|
139 | - abstract protected function _set_tour_stops(); |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * The method can optionally be overridden by child classes to set the _options array if there are any default |
|
144 | - * options the child wishes to override for a this tour. See property definition for more info |
|
145 | - * |
|
146 | - * @access protected |
|
147 | - * @return void |
|
148 | - */ |
|
149 | - protected function _set_tour_options($options = array()) |
|
150 | - { |
|
151 | - $defaults = array( |
|
152 | - 'tipLocation' => 'bottom', |
|
153 | - // 'top', 'bottom', 'right', 'left' in relation to parent |
|
154 | - 'nubPosition' => 'auto', |
|
155 | - // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
156 | - 'tipAdjustmentY' => 0, |
|
157 | - // allow for adjustment of tip |
|
158 | - 'tipAdjustmentX' => 0, |
|
159 | - // allow for adjustment of tip |
|
160 | - 'scroll' => true, |
|
161 | - // whether to scrollTo the next step or not |
|
162 | - 'scrollSpeed' => 300, |
|
163 | - // Page scrolling speed in ms |
|
164 | - 'timer' => 0, |
|
165 | - // 0 = off, all other numbers = time(ms) |
|
166 | - 'autoStart' => true, |
|
167 | - // true or false - false tour starts when restart called |
|
168 | - 'startTimerOnClick' => true, |
|
169 | - // true/false to start timer on first click |
|
170 | - 'nextButton' => true, |
|
171 | - // true/false for next button visibility |
|
172 | - 'button_text' => esc_html__('Next', 'event_espresso'), |
|
173 | - 'tipAnimation' => 'fade', |
|
174 | - // 'pop' or 'fade' in each tip |
|
175 | - 'pauseAfter' => array(), |
|
176 | - // array of indexes where to pause the tour after |
|
177 | - 'tipAnimationFadeSpeed' => 300, |
|
178 | - // if 'fade'- speed in ms of transition |
|
179 | - 'cookieMonster' => true, |
|
180 | - // true/false for whether cookies are used |
|
181 | - 'cookieName' => $this->get_slug(), |
|
182 | - // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
183 | - // set to false or yoursite.com |
|
184 | - 'cookieDomain' => false, |
|
185 | - // Where the tip be attached if not inline |
|
186 | - // 'tipContainer' => 'body', |
|
187 | - 'modal' => false, |
|
188 | - // Whether to cover page with modal during the tour |
|
189 | - 'expose' => false, |
|
190 | - // Whether to expose the elements at each step in the tour (requires modal:true), |
|
191 | - 'postExposeCallback' => 'EEHelpTour.postExposeCallback', |
|
192 | - // A method to call after an element has been exposed |
|
193 | - 'preRideCallback' => 'EEHelpTour_preRideCallback', |
|
194 | - // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
195 | - 'postRideCallback' => 'EEHelpTour_postRideCallback', |
|
196 | - // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
197 | - 'preStepCallback' => 'EEHelpTour_preStepCallback', |
|
198 | - // A method to call before each step |
|
199 | - 'postStepCallback' => 'EEHelpTour_postStepCallback', |
|
200 | - // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
201 | - ); |
|
202 | - |
|
203 | - $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
204 | - $this->_options = $options; |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * getter functions to return all the properties for the tour. |
|
210 | - */ |
|
211 | - |
|
212 | - |
|
213 | - /** |
|
214 | - * get_slug |
|
215 | - * |
|
216 | - * @return string slug for the tour |
|
217 | - */ |
|
218 | - public function get_slug() |
|
219 | - { |
|
220 | - if (empty($this->_slug)) { |
|
221 | - throw new EE_Error( |
|
222 | - sprintf( |
|
223 | - esc_html__( |
|
224 | - 'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', |
|
225 | - 'event_espresso' |
|
226 | - ), |
|
227 | - get_class($this) |
|
228 | - ) |
|
229 | - ); |
|
230 | - } |
|
231 | - return $this->_slug; |
|
232 | - } |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * get_label |
|
237 | - * |
|
238 | - * @return string |
|
239 | - */ |
|
240 | - public function get_label() |
|
241 | - { |
|
242 | - if (empty($this->_label)) { |
|
243 | - throw new EE_Error( |
|
244 | - sprintf( |
|
245 | - esc_html__( |
|
246 | - 'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', |
|
247 | - 'event_espresso' |
|
248 | - ), |
|
249 | - get_class($this) |
|
250 | - ) |
|
251 | - ); |
|
252 | - } |
|
253 | - return $this->_label; |
|
254 | - } |
|
255 | - |
|
256 | - |
|
257 | - /** |
|
258 | - * get_stops |
|
259 | - * |
|
260 | - * @return array |
|
261 | - */ |
|
262 | - public function get_stops() |
|
263 | - { |
|
264 | - foreach ($this->_stops as $ind => $stop) { |
|
265 | - if (! isset($stop['button_text'])) { |
|
266 | - $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
267 | - } |
|
268 | - } |
|
269 | - return $this->_stops; |
|
270 | - } |
|
271 | - |
|
272 | - |
|
273 | - /** |
|
274 | - * get options |
|
275 | - * |
|
276 | - * @return array |
|
277 | - */ |
|
278 | - public function get_options() |
|
279 | - { |
|
280 | - // let's make sure there are not pauses set |
|
281 | - foreach ($this->_stops as $ind => $stop) { |
|
282 | - if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
283 | - $this->_options['pauseAfter'][] = $ind; |
|
284 | - } |
|
285 | - } |
|
286 | - return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
287 | - } |
|
21 | + /** |
|
22 | + * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the |
|
23 | + * constructor of the child class. |
|
24 | + * |
|
25 | + * @access protected |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + protected $_label = ''; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * This is the slug for the tour. It should be unique from all tours and is used for starting a tour and setting |
|
33 | + * cookies for the tour. Set this in the constructor of the child class. |
|
34 | + * |
|
35 | + * @access protected |
|
36 | + * @var string |
|
37 | + */ |
|
38 | + protected $_slug = ''; |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for |
|
43 | + * setting up a tour on a given page. format for array is: array( |
|
44 | + * 0 => array( |
|
45 | + * 'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take |
|
46 | + * precendence even if you also set class. |
|
47 | + * 'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use |
|
48 | + * this param. The first element for that class is the anchor. If the class or the id are empty then the |
|
49 | + * stop will be a modal on the page anchored to the main body. |
|
50 | + * 'custom_class' => 'some_custom_class', //optional custom class to add for this stop. |
|
51 | + * 'button_text' => 'custom text for button', //optional |
|
52 | + * 'content' => 'The content for the stop', //required |
|
53 | + * 'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get |
|
54 | + * added to the pauseAfter global option array setup for the joyride instance. This is only applicable |
|
55 | + * when this tour has been set to run on timer. |
|
56 | + * 'options' => array( |
|
57 | + * //override any of the global options set via the help_tour "option_callback" for the joyride |
|
58 | + * instance on this specific stop. |
|
59 | + * ) |
|
60 | + * ) |
|
61 | + * ); |
|
62 | + * |
|
63 | + * @access protected |
|
64 | + * @var array |
|
65 | + */ |
|
66 | + protected $_stops = array(); |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * This contains any stop specific options for the tour. |
|
71 | + * defaults are set but child classes can override. |
|
72 | + * |
|
73 | + * @access protected |
|
74 | + * @var array |
|
75 | + */ |
|
76 | + protected $_options = array(); |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * holds anything found in the request object (however we override any _gets with _post data). |
|
81 | + * |
|
82 | + * @access protected |
|
83 | + * @var array |
|
84 | + */ |
|
85 | + protected $_req_data = array(); |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * a flag that is set on init for whether this help_tour is happening on a caf install or not. |
|
90 | + * |
|
91 | + * @var boolean |
|
92 | + */ |
|
93 | + protected $_is_caf = false; |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * _constructor |
|
98 | + * initialized the tour object and sets up important properties required to setup the tour. |
|
99 | + * |
|
100 | + * @access public |
|
101 | + * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
|
102 | + * @return void |
|
103 | + */ |
|
104 | + public function __construct($caf = false) |
|
105 | + { |
|
106 | + $this->_is_caf = $caf; |
|
107 | + /** @var RequestInterface $request */ |
|
108 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
109 | + $this->_req_data = $request->requestParams(); |
|
110 | + $this->_set_tour_properties(); |
|
111 | + $this->_set_tour_stops(); |
|
112 | + $this->_set_tour_options(); |
|
113 | + |
|
114 | + // make sure the last tour stop has "end tour" for its button |
|
115 | + $end = array_pop($this->_stops); |
|
116 | + $end['button_text'] = esc_html__('End Tour', 'event_espresso'); |
|
117 | + // add back to stops |
|
118 | + $this->_stops[] = $end; |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * required method that has the sole purpose of setting up the tour $_label and $_slug properties |
|
124 | + * |
|
125 | + * @abstract |
|
126 | + * @access protected |
|
127 | + * @return void |
|
128 | + */ |
|
129 | + abstract protected function _set_tour_properties(); |
|
130 | + |
|
131 | + |
|
132 | + /** |
|
133 | + * required method that's sole purpose is to setup the $_stops property |
|
134 | + * |
|
135 | + * @abstract |
|
136 | + * @access protected |
|
137 | + * @return void |
|
138 | + */ |
|
139 | + abstract protected function _set_tour_stops(); |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * The method can optionally be overridden by child classes to set the _options array if there are any default |
|
144 | + * options the child wishes to override for a this tour. See property definition for more info |
|
145 | + * |
|
146 | + * @access protected |
|
147 | + * @return void |
|
148 | + */ |
|
149 | + protected function _set_tour_options($options = array()) |
|
150 | + { |
|
151 | + $defaults = array( |
|
152 | + 'tipLocation' => 'bottom', |
|
153 | + // 'top', 'bottom', 'right', 'left' in relation to parent |
|
154 | + 'nubPosition' => 'auto', |
|
155 | + // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
156 | + 'tipAdjustmentY' => 0, |
|
157 | + // allow for adjustment of tip |
|
158 | + 'tipAdjustmentX' => 0, |
|
159 | + // allow for adjustment of tip |
|
160 | + 'scroll' => true, |
|
161 | + // whether to scrollTo the next step or not |
|
162 | + 'scrollSpeed' => 300, |
|
163 | + // Page scrolling speed in ms |
|
164 | + 'timer' => 0, |
|
165 | + // 0 = off, all other numbers = time(ms) |
|
166 | + 'autoStart' => true, |
|
167 | + // true or false - false tour starts when restart called |
|
168 | + 'startTimerOnClick' => true, |
|
169 | + // true/false to start timer on first click |
|
170 | + 'nextButton' => true, |
|
171 | + // true/false for next button visibility |
|
172 | + 'button_text' => esc_html__('Next', 'event_espresso'), |
|
173 | + 'tipAnimation' => 'fade', |
|
174 | + // 'pop' or 'fade' in each tip |
|
175 | + 'pauseAfter' => array(), |
|
176 | + // array of indexes where to pause the tour after |
|
177 | + 'tipAnimationFadeSpeed' => 300, |
|
178 | + // if 'fade'- speed in ms of transition |
|
179 | + 'cookieMonster' => true, |
|
180 | + // true/false for whether cookies are used |
|
181 | + 'cookieName' => $this->get_slug(), |
|
182 | + // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
183 | + // set to false or yoursite.com |
|
184 | + 'cookieDomain' => false, |
|
185 | + // Where the tip be attached if not inline |
|
186 | + // 'tipContainer' => 'body', |
|
187 | + 'modal' => false, |
|
188 | + // Whether to cover page with modal during the tour |
|
189 | + 'expose' => false, |
|
190 | + // Whether to expose the elements at each step in the tour (requires modal:true), |
|
191 | + 'postExposeCallback' => 'EEHelpTour.postExposeCallback', |
|
192 | + // A method to call after an element has been exposed |
|
193 | + 'preRideCallback' => 'EEHelpTour_preRideCallback', |
|
194 | + // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
195 | + 'postRideCallback' => 'EEHelpTour_postRideCallback', |
|
196 | + // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
197 | + 'preStepCallback' => 'EEHelpTour_preStepCallback', |
|
198 | + // A method to call before each step |
|
199 | + 'postStepCallback' => 'EEHelpTour_postStepCallback', |
|
200 | + // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
201 | + ); |
|
202 | + |
|
203 | + $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
204 | + $this->_options = $options; |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * getter functions to return all the properties for the tour. |
|
210 | + */ |
|
211 | + |
|
212 | + |
|
213 | + /** |
|
214 | + * get_slug |
|
215 | + * |
|
216 | + * @return string slug for the tour |
|
217 | + */ |
|
218 | + public function get_slug() |
|
219 | + { |
|
220 | + if (empty($this->_slug)) { |
|
221 | + throw new EE_Error( |
|
222 | + sprintf( |
|
223 | + esc_html__( |
|
224 | + 'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', |
|
225 | + 'event_espresso' |
|
226 | + ), |
|
227 | + get_class($this) |
|
228 | + ) |
|
229 | + ); |
|
230 | + } |
|
231 | + return $this->_slug; |
|
232 | + } |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * get_label |
|
237 | + * |
|
238 | + * @return string |
|
239 | + */ |
|
240 | + public function get_label() |
|
241 | + { |
|
242 | + if (empty($this->_label)) { |
|
243 | + throw new EE_Error( |
|
244 | + sprintf( |
|
245 | + esc_html__( |
|
246 | + 'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', |
|
247 | + 'event_espresso' |
|
248 | + ), |
|
249 | + get_class($this) |
|
250 | + ) |
|
251 | + ); |
|
252 | + } |
|
253 | + return $this->_label; |
|
254 | + } |
|
255 | + |
|
256 | + |
|
257 | + /** |
|
258 | + * get_stops |
|
259 | + * |
|
260 | + * @return array |
|
261 | + */ |
|
262 | + public function get_stops() |
|
263 | + { |
|
264 | + foreach ($this->_stops as $ind => $stop) { |
|
265 | + if (! isset($stop['button_text'])) { |
|
266 | + $this->_stops[ $ind ]['button_text'] = $this->_options['button_text']; |
|
267 | + } |
|
268 | + } |
|
269 | + return $this->_stops; |
|
270 | + } |
|
271 | + |
|
272 | + |
|
273 | + /** |
|
274 | + * get options |
|
275 | + * |
|
276 | + * @return array |
|
277 | + */ |
|
278 | + public function get_options() |
|
279 | + { |
|
280 | + // let's make sure there are not pauses set |
|
281 | + foreach ($this->_stops as $ind => $stop) { |
|
282 | + if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
283 | + $this->_options['pauseAfter'][] = $ind; |
|
284 | + } |
|
285 | + } |
|
286 | + return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this); |
|
287 | + } |
|
288 | 288 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array()); |
101 | 101 | |
102 | - if (! $do_hooks_only) { |
|
102 | + if ( ! $do_hooks_only) { |
|
103 | 103 | $this->rewind(); |
104 | 104 | // exit early if there is nothing to save. |
105 | 105 | if ($this->count() < 1) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function get_generation_data() |
156 | 156 | { |
157 | 157 | // first verify we're at a valid iterator point. |
158 | - if (! $this->valid()) { |
|
158 | + if ( ! $this->valid()) { |
|
159 | 159 | return array(); |
160 | 160 | } |
161 | 161 | $info = $this->getInfo(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function get_data_handler() |
172 | 172 | { |
173 | - if (! $this->valid()) { |
|
173 | + if ( ! $this->valid()) { |
|
174 | 174 | return ''; |
175 | 175 | } |
176 | 176 | $info = $this->getInfo(); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function is_preview() |
187 | 187 | { |
188 | - if (! $this->valid()) { |
|
188 | + if ( ! $this->valid()) { |
|
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | $info = $this->getInfo(); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function is_test_send() |
202 | 202 | { |
203 | - if (! $this->valid()) { |
|
203 | + if ( ! $this->valid()) { |
|
204 | 204 | return false; |
205 | 205 | } |
206 | 206 | $info = $this->getInfo(); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | protected function _maybe_persist_attached_data() |
216 | 216 | { |
217 | - if (! $this->valid()) { |
|
217 | + if ( ! $this->valid()) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function count_by_priority_and_status($priority, $status = array()) |
239 | 239 | { |
240 | - if (! empty($status)) { |
|
240 | + if ( ! empty($status)) { |
|
241 | 241 | $status = is_array($status) ? $status : array($status); |
242 | 242 | } |
243 | 243 |
@@ -12,257 +12,257 @@ |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * EE_Message_Repository constructor |
|
17 | - */ |
|
18 | - public function __construct() |
|
19 | - { |
|
20 | - $this->interface = 'EE_Message'; |
|
21 | - parent::__construct(); |
|
22 | - } |
|
15 | + /** |
|
16 | + * EE_Message_Repository constructor |
|
17 | + */ |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + $this->interface = 'EE_Message'; |
|
21 | + parent::__construct(); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * Add the EE_Message to the repository. |
|
27 | - * This also ensures that the MSG_token is saves as a part of the info for retrieval. |
|
28 | - * |
|
29 | - * @param EE_Message $message |
|
30 | - * @param mixed $info Any included data is saved in the attached object info array indexed by 'data' |
|
31 | - * @return bool |
|
32 | - */ |
|
33 | - public function add($message, $info = null) |
|
34 | - { |
|
35 | - $attached = parent::add($message); |
|
36 | - // ensure $info is an array if not already |
|
37 | - $info = $info === null ? $info = array() : (array) $info; |
|
38 | - $data = $this->_init_data($info, $attached, $message); |
|
39 | - if ($attached) { |
|
40 | - $this->set_info($message, $data); |
|
41 | - } |
|
42 | - return $attached; |
|
43 | - } |
|
25 | + /** |
|
26 | + * Add the EE_Message to the repository. |
|
27 | + * This also ensures that the MSG_token is saves as a part of the info for retrieval. |
|
28 | + * |
|
29 | + * @param EE_Message $message |
|
30 | + * @param mixed $info Any included data is saved in the attached object info array indexed by 'data' |
|
31 | + * @return bool |
|
32 | + */ |
|
33 | + public function add($message, $info = null) |
|
34 | + { |
|
35 | + $attached = parent::add($message); |
|
36 | + // ensure $info is an array if not already |
|
37 | + $info = $info === null ? $info = array() : (array) $info; |
|
38 | + $data = $this->_init_data($info, $attached, $message); |
|
39 | + if ($attached) { |
|
40 | + $this->set_info($message, $data); |
|
41 | + } |
|
42 | + return $attached; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * Initializes the data from the incoming info. |
|
48 | - * |
|
49 | - * @param array $info incoming data. |
|
50 | - * @param bool $attached Indicates whether the object was attached successfully. |
|
51 | - * @param EE_Message $message |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - protected function _init_data($info, $attached, $message) |
|
55 | - { |
|
56 | - $data = array( |
|
57 | - 'test_send' => false, |
|
58 | - 'preview' => false, |
|
59 | - 'data_handler_class_name' => '', |
|
60 | - 'data' => array( |
|
61 | - 'MSG_generation_data' => array(), |
|
62 | - ), |
|
63 | - ); |
|
64 | - if (isset($info['preview'])) { |
|
65 | - $data['preview'] = $info['preview']; |
|
66 | - unset($info['preview']); |
|
67 | - } |
|
68 | - if (isset($info['test_send'])) { |
|
69 | - $data['test_send'] = $info['test_send']; |
|
70 | - unset($info['test_send']); |
|
71 | - } |
|
72 | - if (isset($info['data_handler_class_name'])) { |
|
73 | - $data['data_handler_class_name'] = $info['data_handler_class_name']; |
|
74 | - unset($info['data_handler_class_name']); |
|
75 | - } |
|
76 | - if ($attached && $message->STS_ID() === EEM_Message::status_incomplete) { |
|
77 | - $generation_data = isset($info['MSG_generation_data']) ? $info['MSG_generation_data'] : array(); |
|
78 | - // if data isn't in $info...let's see if its available via the message object |
|
79 | - $generation_data = ! $generation_data ? $message->get_generation_data() : $generation_data; |
|
80 | - // still empty then let's just use info |
|
81 | - $generation_data = ! $generation_data ? $info : $generation_data; |
|
82 | - $data['data']['MSG_generation_data'] = $generation_data; |
|
83 | - } |
|
84 | - return $data; |
|
85 | - } |
|
46 | + /** |
|
47 | + * Initializes the data from the incoming info. |
|
48 | + * |
|
49 | + * @param array $info incoming data. |
|
50 | + * @param bool $attached Indicates whether the object was attached successfully. |
|
51 | + * @param EE_Message $message |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + protected function _init_data($info, $attached, $message) |
|
55 | + { |
|
56 | + $data = array( |
|
57 | + 'test_send' => false, |
|
58 | + 'preview' => false, |
|
59 | + 'data_handler_class_name' => '', |
|
60 | + 'data' => array( |
|
61 | + 'MSG_generation_data' => array(), |
|
62 | + ), |
|
63 | + ); |
|
64 | + if (isset($info['preview'])) { |
|
65 | + $data['preview'] = $info['preview']; |
|
66 | + unset($info['preview']); |
|
67 | + } |
|
68 | + if (isset($info['test_send'])) { |
|
69 | + $data['test_send'] = $info['test_send']; |
|
70 | + unset($info['test_send']); |
|
71 | + } |
|
72 | + if (isset($info['data_handler_class_name'])) { |
|
73 | + $data['data_handler_class_name'] = $info['data_handler_class_name']; |
|
74 | + unset($info['data_handler_class_name']); |
|
75 | + } |
|
76 | + if ($attached && $message->STS_ID() === EEM_Message::status_incomplete) { |
|
77 | + $generation_data = isset($info['MSG_generation_data']) ? $info['MSG_generation_data'] : array(); |
|
78 | + // if data isn't in $info...let's see if its available via the message object |
|
79 | + $generation_data = ! $generation_data ? $message->get_generation_data() : $generation_data; |
|
80 | + // still empty then let's just use info |
|
81 | + $generation_data = ! $generation_data ? $info : $generation_data; |
|
82 | + $data['data']['MSG_generation_data'] = $generation_data; |
|
83 | + } |
|
84 | + return $data; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * Save all EE_Message objects to the db. |
|
90 | - * |
|
91 | - * @param bool $do_hooks_only When true, only the hooks related to saving are fired. |
|
92 | - * @return array array( |
|
93 | - * 'updated' => 0, //count of how many messages updated |
|
94 | - * 'notupdated' => 0, //count of how many messages not updated. |
|
95 | - * 'errors' => array( $token ), //array of message object tokens that had errors in saving |
|
96 | - * ) |
|
97 | - */ |
|
98 | - public function saveAll($do_hooks_only = false) |
|
99 | - { |
|
100 | - $save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array()); |
|
88 | + /** |
|
89 | + * Save all EE_Message objects to the db. |
|
90 | + * |
|
91 | + * @param bool $do_hooks_only When true, only the hooks related to saving are fired. |
|
92 | + * @return array array( |
|
93 | + * 'updated' => 0, //count of how many messages updated |
|
94 | + * 'notupdated' => 0, //count of how many messages not updated. |
|
95 | + * 'errors' => array( $token ), //array of message object tokens that had errors in saving |
|
96 | + * ) |
|
97 | + */ |
|
98 | + public function saveAll($do_hooks_only = false) |
|
99 | + { |
|
100 | + $save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array()); |
|
101 | 101 | |
102 | - if (! $do_hooks_only) { |
|
103 | - $this->rewind(); |
|
104 | - // exit early if there is nothing to save. |
|
105 | - if ($this->count() < 1) { |
|
106 | - return $save_tracking; |
|
107 | - } |
|
102 | + if (! $do_hooks_only) { |
|
103 | + $this->rewind(); |
|
104 | + // exit early if there is nothing to save. |
|
105 | + if ($this->count() < 1) { |
|
106 | + return $save_tracking; |
|
107 | + } |
|
108 | 108 | |
109 | - while ($this->valid()) { |
|
110 | - $saved = $this->current()->save(); |
|
111 | - if ($saved === false) { |
|
112 | - $save_tracking['errors'][] = $this->current()->MSG_token(); |
|
113 | - } elseif ($saved) { |
|
114 | - $save_tracking['updated']++; |
|
115 | - } else { |
|
116 | - $save_tracking['notupdated']++; |
|
117 | - } |
|
118 | - // maybe persist generation data if this is an incomplete EE_Message. |
|
119 | - $this->_maybe_persist_attached_data(); |
|
109 | + while ($this->valid()) { |
|
110 | + $saved = $this->current()->save(); |
|
111 | + if ($saved === false) { |
|
112 | + $save_tracking['errors'][] = $this->current()->MSG_token(); |
|
113 | + } elseif ($saved) { |
|
114 | + $save_tracking['updated']++; |
|
115 | + } else { |
|
116 | + $save_tracking['notupdated']++; |
|
117 | + } |
|
118 | + // maybe persist generation data if this is an incomplete EE_Message. |
|
119 | + $this->_maybe_persist_attached_data(); |
|
120 | 120 | |
121 | - $this->next(); |
|
122 | - } |
|
123 | - } |
|
124 | - do_action('AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this, $do_hooks_only); |
|
125 | - return $save_tracking; |
|
126 | - } |
|
121 | + $this->next(); |
|
122 | + } |
|
123 | + } |
|
124 | + do_action('AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this, $do_hooks_only); |
|
125 | + return $save_tracking; |
|
126 | + } |
|
127 | 127 | |
128 | 128 | |
129 | - /** |
|
130 | - * Retrieves a EE_Message from the repository that matches the given token. |
|
131 | - * |
|
132 | - * @param string $token Token. |
|
133 | - * @return EE_Message | null |
|
134 | - */ |
|
135 | - public function getMessageByToken($token) |
|
136 | - { |
|
137 | - $this->rewind(); |
|
138 | - while ($this->valid()) { |
|
139 | - if ($this->current()->MSG_token() === $token) { |
|
140 | - $message = $this->current(); |
|
141 | - $this->rewind(); |
|
142 | - return $message; |
|
143 | - } |
|
144 | - $this->next(); |
|
145 | - } |
|
146 | - return null; |
|
147 | - } |
|
129 | + /** |
|
130 | + * Retrieves a EE_Message from the repository that matches the given token. |
|
131 | + * |
|
132 | + * @param string $token Token. |
|
133 | + * @return EE_Message | null |
|
134 | + */ |
|
135 | + public function getMessageByToken($token) |
|
136 | + { |
|
137 | + $this->rewind(); |
|
138 | + while ($this->valid()) { |
|
139 | + if ($this->current()->MSG_token() === $token) { |
|
140 | + $message = $this->current(); |
|
141 | + $this->rewind(); |
|
142 | + return $message; |
|
143 | + } |
|
144 | + $this->next(); |
|
145 | + } |
|
146 | + return null; |
|
147 | + } |
|
148 | 148 | |
149 | 149 | |
150 | - /** |
|
151 | - * This retrieves any data required for generation that may be saved with the current EE_Message in storage. |
|
152 | - * |
|
153 | - * @return array(); |
|
154 | - */ |
|
155 | - public function get_generation_data() |
|
156 | - { |
|
157 | - // first verify we're at a valid iterator point. |
|
158 | - if (! $this->valid()) { |
|
159 | - return array(); |
|
160 | - } |
|
161 | - $info = $this->getInfo(); |
|
162 | - return isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
163 | - } |
|
150 | + /** |
|
151 | + * This retrieves any data required for generation that may be saved with the current EE_Message in storage. |
|
152 | + * |
|
153 | + * @return array(); |
|
154 | + */ |
|
155 | + public function get_generation_data() |
|
156 | + { |
|
157 | + // first verify we're at a valid iterator point. |
|
158 | + if (! $this->valid()) { |
|
159 | + return array(); |
|
160 | + } |
|
161 | + $info = $this->getInfo(); |
|
162 | + return isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
163 | + } |
|
164 | 164 | |
165 | 165 | |
166 | - /** |
|
167 | - * Retrieves the data_handler_class_name or reference associated with the current EE_Message object in the iterator. |
|
168 | - * |
|
169 | - * @return string |
|
170 | - */ |
|
171 | - public function get_data_handler() |
|
172 | - { |
|
173 | - if (! $this->valid()) { |
|
174 | - return ''; |
|
175 | - } |
|
176 | - $info = $this->getInfo(); |
|
177 | - return isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
178 | - } |
|
166 | + /** |
|
167 | + * Retrieves the data_handler_class_name or reference associated with the current EE_Message object in the iterator. |
|
168 | + * |
|
169 | + * @return string |
|
170 | + */ |
|
171 | + public function get_data_handler() |
|
172 | + { |
|
173 | + if (! $this->valid()) { |
|
174 | + return ''; |
|
175 | + } |
|
176 | + $info = $this->getInfo(); |
|
177 | + return isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
178 | + } |
|
179 | 179 | |
180 | 180 | |
181 | - /** |
|
182 | - * Returns whether this EE_Message is for a preview or not. |
|
183 | - * |
|
184 | - * @return bool |
|
185 | - */ |
|
186 | - public function is_preview() |
|
187 | - { |
|
188 | - if (! $this->valid()) { |
|
189 | - return false; |
|
190 | - } |
|
191 | - $info = $this->getInfo(); |
|
192 | - return $info['preview']; |
|
193 | - } |
|
181 | + /** |
|
182 | + * Returns whether this EE_Message is for a preview or not. |
|
183 | + * |
|
184 | + * @return bool |
|
185 | + */ |
|
186 | + public function is_preview() |
|
187 | + { |
|
188 | + if (! $this->valid()) { |
|
189 | + return false; |
|
190 | + } |
|
191 | + $info = $this->getInfo(); |
|
192 | + return $info['preview']; |
|
193 | + } |
|
194 | 194 | |
195 | 195 | |
196 | - /** |
|
197 | - * Returns whether the current message pointed to is for a test send. |
|
198 | - * |
|
199 | - * @return bool |
|
200 | - */ |
|
201 | - public function is_test_send() |
|
202 | - { |
|
203 | - if (! $this->valid()) { |
|
204 | - return false; |
|
205 | - } |
|
206 | - $info = $this->getInfo(); |
|
207 | - return $info['test_send']; |
|
208 | - } |
|
196 | + /** |
|
197 | + * Returns whether the current message pointed to is for a test send. |
|
198 | + * |
|
199 | + * @return bool |
|
200 | + */ |
|
201 | + public function is_test_send() |
|
202 | + { |
|
203 | + if (! $this->valid()) { |
|
204 | + return false; |
|
205 | + } |
|
206 | + $info = $this->getInfo(); |
|
207 | + return $info['test_send']; |
|
208 | + } |
|
209 | 209 | |
210 | 210 | |
211 | - /** |
|
212 | - * This checks if the current EE_Message in the iterator is incomplete. If it is, then |
|
213 | - * data is attached for later retrieval (batch generation). |
|
214 | - */ |
|
215 | - protected function _maybe_persist_attached_data() |
|
216 | - { |
|
217 | - if (! $this->valid()) { |
|
218 | - return; |
|
219 | - } |
|
211 | + /** |
|
212 | + * This checks if the current EE_Message in the iterator is incomplete. If it is, then |
|
213 | + * data is attached for later retrieval (batch generation). |
|
214 | + */ |
|
215 | + protected function _maybe_persist_attached_data() |
|
216 | + { |
|
217 | + if (! $this->valid()) { |
|
218 | + return; |
|
219 | + } |
|
220 | 220 | |
221 | - $info = $this->getInfo(); |
|
222 | - $data_handler_class_name = isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
223 | - $data = isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
224 | - if ($data && $this->current()->STS_ID() === EEM_Message::status_incomplete) { |
|
225 | - $this->current()->set_generation_data($data); |
|
226 | - $this->current()->set_field_or_extra_meta('data_handler_class_name', $data_handler_class_name); |
|
227 | - } |
|
228 | - } |
|
221 | + $info = $this->getInfo(); |
|
222 | + $data_handler_class_name = isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
223 | + $data = isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
224 | + if ($data && $this->current()->STS_ID() === EEM_Message::status_incomplete) { |
|
225 | + $this->current()->set_generation_data($data); |
|
226 | + $this->current()->set_field_or_extra_meta('data_handler_class_name', $data_handler_class_name); |
|
227 | + } |
|
228 | + } |
|
229 | 229 | |
230 | 230 | |
231 | - /** |
|
232 | - * This method returns a count of messages in the repository that have a given priority. |
|
233 | - * |
|
234 | - * @param int $priority the priority that is being filtered for the count. |
|
235 | - * @param array $status the optional status(es) that will also be filtered by when priority matches. |
|
236 | - * @return int count of messages in the queue matching the conditions. |
|
237 | - */ |
|
238 | - public function count_by_priority_and_status($priority, $status = array()) |
|
239 | - { |
|
240 | - if (! empty($status)) { |
|
241 | - $status = is_array($status) ? $status : array($status); |
|
242 | - } |
|
231 | + /** |
|
232 | + * This method returns a count of messages in the repository that have a given priority. |
|
233 | + * |
|
234 | + * @param int $priority the priority that is being filtered for the count. |
|
235 | + * @param array $status the optional status(es) that will also be filtered by when priority matches. |
|
236 | + * @return int count of messages in the queue matching the conditions. |
|
237 | + */ |
|
238 | + public function count_by_priority_and_status($priority, $status = array()) |
|
239 | + { |
|
240 | + if (! empty($status)) { |
|
241 | + $status = is_array($status) ? $status : array($status); |
|
242 | + } |
|
243 | 243 | |
244 | - $count = 0; |
|
245 | - $this->rewind(); |
|
246 | - while ($this->valid()) { |
|
247 | - if ( |
|
248 | - $this->current()->priority() === $priority && (($status && in_array( |
|
249 | - $this->current()->STS_ID(), |
|
250 | - $status |
|
251 | - )) || ! $status) |
|
252 | - ) { |
|
253 | - $count++; |
|
254 | - } |
|
255 | - $this->next(); |
|
256 | - } |
|
257 | - return $count; |
|
258 | - } |
|
244 | + $count = 0; |
|
245 | + $this->rewind(); |
|
246 | + while ($this->valid()) { |
|
247 | + if ( |
|
248 | + $this->current()->priority() === $priority && (($status && in_array( |
|
249 | + $this->current()->STS_ID(), |
|
250 | + $status |
|
251 | + )) || ! $status) |
|
252 | + ) { |
|
253 | + $count++; |
|
254 | + } |
|
255 | + $this->next(); |
|
256 | + } |
|
257 | + return $count; |
|
258 | + } |
|
259 | 259 | |
260 | 260 | |
261 | - /** |
|
262 | - * @return EE_Message |
|
263 | - */ |
|
264 | - public function current() |
|
265 | - { |
|
266 | - return parent::current(); |
|
267 | - } |
|
261 | + /** |
|
262 | + * @return EE_Message |
|
263 | + */ |
|
264 | + public function current() |
|
265 | + { |
|
266 | + return parent::current(); |
|
267 | + } |
|
268 | 268 | } |
@@ -11,19 +11,19 @@ |
||
11 | 11 | { |
12 | 12 | |
13 | 13 | |
14 | - public function __construct() |
|
15 | - { |
|
16 | - $this->interface = 'EE_Messages_Template_Pack'; |
|
17 | - } |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + $this->interface = 'EE_Messages_Template_Pack'; |
|
17 | + } |
|
18 | 18 | |
19 | - public function get_by_name($template_pack_name) |
|
20 | - { |
|
21 | - $this->rewind(); |
|
22 | - while ($this->valid()) { |
|
23 | - if ($this->current()->dbref == $template_pack_name) { |
|
24 | - return $this->current(); |
|
25 | - } |
|
26 | - $this->next(); |
|
27 | - } |
|
28 | - } |
|
19 | + public function get_by_name($template_pack_name) |
|
20 | + { |
|
21 | + $this->rewind(); |
|
22 | + while ($this->valid()) { |
|
23 | + if ($this->current()->dbref == $template_pack_name) { |
|
24 | + return $this->current(); |
|
25 | + } |
|
26 | + $this->next(); |
|
27 | + } |
|
28 | + } |
|
29 | 29 | } |
@@ -15,175 +15,175 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * @type EE_Message_Factory $_instance |
|
20 | - */ |
|
21 | - protected static $_instance = null; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @type EE_Message_Resource_Manager $_message_resource_manager |
|
26 | - */ |
|
27 | - protected $_message_resource_manager; |
|
28 | - |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * EE_Message_Factory constructor. |
|
33 | - * |
|
34 | - * @access protected |
|
35 | - * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
36 | - */ |
|
37 | - protected function __construct( |
|
38 | - EE_Message_Resource_Manager $Message_Resource_Manager |
|
39 | - ) { |
|
40 | - $this->_message_resource_manager = $Message_Resource_Manager; |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @singleton method used to instantiate class object |
|
47 | - * @access public |
|
48 | - * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
49 | - * @return \EE_Message_Factory instance |
|
50 | - */ |
|
51 | - public static function instance(EE_Message_Resource_Manager $Message_Resource_Manager) |
|
52 | - { |
|
53 | - // check if class object is instantiated, and instantiated properly |
|
54 | - if (! self::$_instance instanceof EE_Message_Factory) { |
|
55 | - self::$_instance = new EE_Message_Factory($Message_Resource_Manager); |
|
56 | - } |
|
57 | - return self::$_instance; |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * @access public |
|
64 | - * @param array $props_n_values |
|
65 | - * @return EE_Message |
|
66 | - */ |
|
67 | - public static function create($props_n_values = array()) |
|
68 | - { |
|
69 | - /** @type EE_Message_Factory $Message_Factory */ |
|
70 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
71 | - return $Message_Factory->_create($props_n_values); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @access public |
|
78 | - * @param \EE_Message $message |
|
79 | - * @return \EE_Message |
|
80 | - * @throws \EE_Error |
|
81 | - */ |
|
82 | - public static function set_messenger_and_message_type(EE_Message $message) |
|
83 | - { |
|
84 | - /** @type EE_Message_Factory $Message_Factory */ |
|
85 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
86 | - return $Message_Factory->_set_messenger_and_message_type($message); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @access public |
|
93 | - * @param \EE_Message $message |
|
94 | - * @return \EE_Message |
|
95 | - * @throws \EE_Error |
|
96 | - */ |
|
97 | - public static function set_messenger(EE_Message $message) |
|
98 | - { |
|
99 | - /** @type EE_Message_Factory $Message_Factory */ |
|
100 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
101 | - return $Message_Factory->_set_messenger($message); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @access public |
|
108 | - * @param \EE_Message $message |
|
109 | - * @return \EE_Message |
|
110 | - * @throws \EE_Error |
|
111 | - */ |
|
112 | - public static function set_message_type(EE_Message $message) |
|
113 | - { |
|
114 | - /** @type EE_Message_Factory $Message_Factory */ |
|
115 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
116 | - return $Message_Factory->_set_message_type($message); |
|
117 | - } |
|
118 | - |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * @access protected |
|
123 | - * @param array $props_n_values |
|
124 | - * @return \EE_Message |
|
125 | - * @throws \EE_Error |
|
126 | - */ |
|
127 | - protected function _create($props_n_values = array()) |
|
128 | - { |
|
129 | - $new_instance = false; |
|
130 | - if (! empty($props_n_values['MSG_ID'])) { |
|
131 | - $message = EE_Message::new_instance_from_db($props_n_values); |
|
132 | - } else { |
|
133 | - $message = EE_Message::new_instance($props_n_values); |
|
134 | - $new_instance = true; |
|
135 | - } |
|
136 | - return $this->_set_messenger_and_message_type($message, $new_instance); |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * @access public |
|
143 | - * @param \EE_Message $message |
|
144 | - * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
145 | - * @return \EE_Message |
|
146 | - * @throws \EE_Error |
|
147 | - */ |
|
148 | - protected function _set_messenger_and_message_type(EE_Message $message, $new_instance = false) |
|
149 | - { |
|
150 | - $message = $this->_set_messenger($message); |
|
151 | - $message = $this->_set_message_type($message, $new_instance); |
|
152 | - return $message; |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * @access protected |
|
159 | - * @param \EE_Message $message |
|
160 | - * @return \EE_Message |
|
161 | - * @throws \EE_Error |
|
162 | - */ |
|
163 | - protected function _set_messenger(EE_Message $message) |
|
164 | - { |
|
165 | - $messenger = $this->_message_resource_manager->get_messenger($message->messenger()); |
|
166 | - if ($messenger instanceof EE_messenger) { |
|
167 | - $message->set_messenger_object($messenger); |
|
168 | - } |
|
169 | - return $message; |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * @access protected |
|
176 | - * @param \EE_Message $message |
|
177 | - * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
178 | - * @return \EE_Message |
|
179 | - * @throws \EE_Error |
|
180 | - */ |
|
181 | - protected function _set_message_type(EE_Message $message, $new_instance = false) |
|
182 | - { |
|
183 | - $message_type = $this->_message_resource_manager->get_message_type($message->message_type()); |
|
184 | - if ($message_type instanceof EE_message_type) { |
|
185 | - $message->set_message_type_object($message_type, $new_instance); |
|
186 | - } |
|
187 | - return $message; |
|
188 | - } |
|
18 | + /** |
|
19 | + * @type EE_Message_Factory $_instance |
|
20 | + */ |
|
21 | + protected static $_instance = null; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @type EE_Message_Resource_Manager $_message_resource_manager |
|
26 | + */ |
|
27 | + protected $_message_resource_manager; |
|
28 | + |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * EE_Message_Factory constructor. |
|
33 | + * |
|
34 | + * @access protected |
|
35 | + * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
36 | + */ |
|
37 | + protected function __construct( |
|
38 | + EE_Message_Resource_Manager $Message_Resource_Manager |
|
39 | + ) { |
|
40 | + $this->_message_resource_manager = $Message_Resource_Manager; |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @singleton method used to instantiate class object |
|
47 | + * @access public |
|
48 | + * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
49 | + * @return \EE_Message_Factory instance |
|
50 | + */ |
|
51 | + public static function instance(EE_Message_Resource_Manager $Message_Resource_Manager) |
|
52 | + { |
|
53 | + // check if class object is instantiated, and instantiated properly |
|
54 | + if (! self::$_instance instanceof EE_Message_Factory) { |
|
55 | + self::$_instance = new EE_Message_Factory($Message_Resource_Manager); |
|
56 | + } |
|
57 | + return self::$_instance; |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * @access public |
|
64 | + * @param array $props_n_values |
|
65 | + * @return EE_Message |
|
66 | + */ |
|
67 | + public static function create($props_n_values = array()) |
|
68 | + { |
|
69 | + /** @type EE_Message_Factory $Message_Factory */ |
|
70 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
71 | + return $Message_Factory->_create($props_n_values); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @access public |
|
78 | + * @param \EE_Message $message |
|
79 | + * @return \EE_Message |
|
80 | + * @throws \EE_Error |
|
81 | + */ |
|
82 | + public static function set_messenger_and_message_type(EE_Message $message) |
|
83 | + { |
|
84 | + /** @type EE_Message_Factory $Message_Factory */ |
|
85 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
86 | + return $Message_Factory->_set_messenger_and_message_type($message); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @access public |
|
93 | + * @param \EE_Message $message |
|
94 | + * @return \EE_Message |
|
95 | + * @throws \EE_Error |
|
96 | + */ |
|
97 | + public static function set_messenger(EE_Message $message) |
|
98 | + { |
|
99 | + /** @type EE_Message_Factory $Message_Factory */ |
|
100 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
101 | + return $Message_Factory->_set_messenger($message); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @access public |
|
108 | + * @param \EE_Message $message |
|
109 | + * @return \EE_Message |
|
110 | + * @throws \EE_Error |
|
111 | + */ |
|
112 | + public static function set_message_type(EE_Message $message) |
|
113 | + { |
|
114 | + /** @type EE_Message_Factory $Message_Factory */ |
|
115 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
116 | + return $Message_Factory->_set_message_type($message); |
|
117 | + } |
|
118 | + |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * @access protected |
|
123 | + * @param array $props_n_values |
|
124 | + * @return \EE_Message |
|
125 | + * @throws \EE_Error |
|
126 | + */ |
|
127 | + protected function _create($props_n_values = array()) |
|
128 | + { |
|
129 | + $new_instance = false; |
|
130 | + if (! empty($props_n_values['MSG_ID'])) { |
|
131 | + $message = EE_Message::new_instance_from_db($props_n_values); |
|
132 | + } else { |
|
133 | + $message = EE_Message::new_instance($props_n_values); |
|
134 | + $new_instance = true; |
|
135 | + } |
|
136 | + return $this->_set_messenger_and_message_type($message, $new_instance); |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * @access public |
|
143 | + * @param \EE_Message $message |
|
144 | + * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
145 | + * @return \EE_Message |
|
146 | + * @throws \EE_Error |
|
147 | + */ |
|
148 | + protected function _set_messenger_and_message_type(EE_Message $message, $new_instance = false) |
|
149 | + { |
|
150 | + $message = $this->_set_messenger($message); |
|
151 | + $message = $this->_set_message_type($message, $new_instance); |
|
152 | + return $message; |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * @access protected |
|
159 | + * @param \EE_Message $message |
|
160 | + * @return \EE_Message |
|
161 | + * @throws \EE_Error |
|
162 | + */ |
|
163 | + protected function _set_messenger(EE_Message $message) |
|
164 | + { |
|
165 | + $messenger = $this->_message_resource_manager->get_messenger($message->messenger()); |
|
166 | + if ($messenger instanceof EE_messenger) { |
|
167 | + $message->set_messenger_object($messenger); |
|
168 | + } |
|
169 | + return $message; |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * @access protected |
|
176 | + * @param \EE_Message $message |
|
177 | + * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
178 | + * @return \EE_Message |
|
179 | + * @throws \EE_Error |
|
180 | + */ |
|
181 | + protected function _set_message_type(EE_Message $message, $new_instance = false) |
|
182 | + { |
|
183 | + $message_type = $this->_message_resource_manager->get_message_type($message->message_type()); |
|
184 | + if ($message_type instanceof EE_message_type) { |
|
185 | + $message->set_message_type_object($message_type, $new_instance); |
|
186 | + } |
|
187 | + return $message; |
|
188 | + } |
|
189 | 189 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public static function instance(EE_Message_Resource_Manager $Message_Resource_Manager) |
52 | 52 | { |
53 | 53 | // check if class object is instantiated, and instantiated properly |
54 | - if (! self::$_instance instanceof EE_Message_Factory) { |
|
54 | + if ( ! self::$_instance instanceof EE_Message_Factory) { |
|
55 | 55 | self::$_instance = new EE_Message_Factory($Message_Resource_Manager); |
56 | 56 | } |
57 | 57 | return self::$_instance; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | protected function _create($props_n_values = array()) |
128 | 128 | { |
129 | 129 | $new_instance = false; |
130 | - if (! empty($props_n_values['MSG_ID'])) { |
|
130 | + if ( ! empty($props_n_values['MSG_ID'])) { |
|
131 | 131 | $message = EE_Message::new_instance_from_db($props_n_values); |
132 | 132 | } else { |
133 | 133 | $message = EE_Message::new_instance($props_n_values); |
@@ -15,299 +15,299 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Identifier properties for the recipient |
|
20 | - */ |
|
21 | - |
|
22 | - /** |
|
23 | - * if available we'll use this to set the fname and lname (admin) |
|
24 | - * |
|
25 | - * @var int |
|
26 | - */ |
|
27 | - public $user_id; |
|
28 | - |
|
29 | - /** |
|
30 | - * this will always be the admin fname (set later via incoming user_id) |
|
31 | - * |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - public $fname; |
|
35 | - |
|
36 | - /** |
|
37 | - * this will always be the admin lname (set later via incoming user_id) |
|
38 | - * |
|
39 | - * @var string |
|
40 | - */ |
|
41 | - public $lname; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var int |
|
45 | - */ |
|
46 | - public $primary_registration_id; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var int |
|
50 | - */ |
|
51 | - public $attendee_registration_id; |
|
52 | - |
|
53 | - /** |
|
54 | - * This is should represent the data object that can be used to regenerate this addressee if needed. |
|
55 | - * It is saved to the MSG_recipient_ID column in the generated EE_Message using this data. |
|
56 | - * |
|
57 | - * @var int |
|
58 | - */ |
|
59 | - public $recipient_id; |
|
60 | - |
|
61 | - /** |
|
62 | - * This represents the reference to the EE_Base_Class child that the $recipient_ID is for (eg. 'Registration', |
|
63 | - * 'Attendee') It is saved to the MSG_recipient_type column in the generated EE_Message using this data. |
|
64 | - * |
|
65 | - * @var string |
|
66 | - */ |
|
67 | - public $recipient_type; |
|
68 | - |
|
69 | - /** |
|
70 | - * communication related |
|
71 | - */ |
|
72 | - /** |
|
73 | - * @var string |
|
74 | - */ |
|
75 | - public $attendee_email; |
|
76 | - |
|
77 | - /** |
|
78 | - * @var string |
|
79 | - */ |
|
80 | - public $primary_attendee_email; |
|
81 | - |
|
82 | - /** |
|
83 | - * @var string |
|
84 | - */ |
|
85 | - public $admin_email; |
|
86 | - |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * Attendee related |
|
91 | - */ |
|
92 | - |
|
93 | - /** |
|
94 | - * holds the attendee object for the primary attendee |
|
95 | - * |
|
96 | - * @var EE_Attendee |
|
97 | - */ |
|
98 | - public $primary_att_obj; |
|
99 | - |
|
100 | - /** |
|
101 | - * holds the registration object for the primary attendee |
|
102 | - * |
|
103 | - * @var EE_Registration |
|
104 | - */ |
|
105 | - public $primary_reg_obj; |
|
106 | - |
|
107 | - /** |
|
108 | - * holds the attendee object for an attendee |
|
109 | - * |
|
110 | - * @var EE_Attendee |
|
111 | - */ |
|
112 | - public $att_obj; |
|
113 | - |
|
114 | - /** |
|
115 | - * holds the registration object for an attendee |
|
116 | - * |
|
117 | - * @var EE_Registration |
|
118 | - */ |
|
119 | - public $reg_obj; |
|
120 | - |
|
121 | - /** |
|
122 | - * array of EE_Question objects (indexed by EE_Answer->ID()) |
|
123 | - * |
|
124 | - * @var EE_Question[] |
|
125 | - */ |
|
126 | - public $questions; |
|
127 | - |
|
128 | - /** |
|
129 | - * array of EE_Answer objects |
|
130 | - * |
|
131 | - * @var EE_Answer[] |
|
132 | - */ |
|
133 | - public $answers; |
|
134 | - |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * event related |
|
139 | - */ |
|
140 | - |
|
141 | - /** |
|
142 | - * This will hold all event info/ |
|
143 | - * @var EE_Event[] |
|
144 | - */ |
|
145 | - public $events; |
|
146 | - |
|
147 | - /** |
|
148 | - * holds all the attendees for an event. |
|
149 | - * |
|
150 | - * @var EE_Attendee[] |
|
151 | - */ |
|
152 | - public $attendees; |
|
153 | - |
|
154 | - /** |
|
155 | - * holds all the purchased tickets for an event |
|
156 | - * |
|
157 | - * @var EE_Ticket[] |
|
158 | - */ |
|
159 | - public $tickets; |
|
160 | - |
|
161 | - /** |
|
162 | - * holds an array of line items indexed by parent ticket line item ids and values are array of children of that |
|
163 | - * line item |
|
164 | - * |
|
165 | - * @var EE_Line_Item[] |
|
166 | - */ |
|
167 | - public $line_items_with_children; |
|
168 | - |
|
169 | - /** |
|
170 | - * holds all the datetimes accessed via the tickets purchased for the event |
|
171 | - * |
|
172 | - * @var EE_Datetime[] |
|
173 | - */ |
|
174 | - public $datetimes; |
|
175 | - |
|
176 | - /** |
|
177 | - * holds all registrations for a transaction (with cached relations on that registration) |
|
178 | - * |
|
179 | - * @var EE_Registration[] |
|
180 | - */ |
|
181 | - public $registrations; |
|
182 | - |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * txn related |
|
187 | - */ |
|
188 | - |
|
189 | - /** |
|
190 | - * @var array |
|
191 | - */ |
|
192 | - public $billing; |
|
193 | - |
|
194 | - /** |
|
195 | - *total taxes |
|
196 | - * |
|
197 | - * @var array |
|
198 | - */ |
|
199 | - public $taxes; |
|
200 | - |
|
201 | - /** |
|
202 | - * @var EE_Line_Item[] |
|
203 | - */ |
|
204 | - public $tax_line_items; |
|
205 | - |
|
206 | - /** |
|
207 | - * @var EE_Line_Item[] |
|
208 | - */ |
|
209 | - public $additional_line_items; |
|
210 | - |
|
211 | - /** |
|
212 | - * @var EE_Line_Item |
|
213 | - */ |
|
214 | - public $grand_total_line_item; |
|
215 | - |
|
216 | - /** |
|
217 | - * @var EE_Transaction |
|
218 | - */ |
|
219 | - public $txn; |
|
220 | - |
|
221 | - /** |
|
222 | - * @var EE_Payment |
|
223 | - */ |
|
224 | - public $payment; |
|
225 | - |
|
226 | - /** |
|
227 | - * @var EE_Payment[] |
|
228 | - */ |
|
229 | - public $payments; |
|
230 | - |
|
231 | - /** |
|
232 | - * @var EE_Transaction[] |
|
233 | - */ |
|
234 | - public $txn_objs; |
|
235 | - |
|
236 | - /** |
|
237 | - * @var EE_Registration[] |
|
238 | - */ |
|
239 | - public $reg_objs; |
|
240 | - |
|
241 | - /** |
|
242 | - * total number of ALL tickets purchased for the txn. |
|
243 | - * |
|
244 | - * @var int |
|
245 | - */ |
|
246 | - public $total_ticket_count; |
|
247 | - |
|
248 | - |
|
249 | - |
|
250 | - /** |
|
251 | - * things that get set later by parsers |
|
252 | - */ |
|
253 | - |
|
254 | - /** |
|
255 | - * @var string $event_list |
|
256 | - */ |
|
257 | - public $event_list; |
|
258 | - |
|
259 | - /** |
|
260 | - * @var string |
|
261 | - */ |
|
262 | - public $attendee_list; |
|
263 | - |
|
264 | - |
|
265 | - |
|
266 | - /** |
|
267 | - * This just holds the incoming data |
|
268 | - * |
|
269 | - * @var array |
|
270 | - */ |
|
271 | - protected $_data; |
|
272 | - |
|
273 | - |
|
274 | - |
|
275 | - /** |
|
276 | - * constructor |
|
277 | - * |
|
278 | - * @access public |
|
279 | - * @param array $addressee_data We're expecting an incoming array of data that will be used to fill the properties |
|
280 | - * for the object. |
|
281 | - */ |
|
282 | - public function __construct($addressee_data) |
|
283 | - { |
|
284 | - $this->_data = $addressee_data; |
|
285 | - $this->_set_properties(); |
|
286 | - } |
|
287 | - |
|
288 | - |
|
289 | - |
|
290 | - /** |
|
291 | - * This simply loops through the data and makes sure that each item is present in the incoming data. If it is then |
|
292 | - * it is assigned to the property. |
|
293 | - * |
|
294 | - * @access protected |
|
295 | - * @return void. |
|
296 | - */ |
|
297 | - protected function _set_properties() |
|
298 | - { |
|
299 | - foreach ($this->_data as $prop => $value) { |
|
300 | - if (property_exists($this, $prop)) { |
|
301 | - $this->{$prop} = $value; |
|
302 | - } |
|
303 | - } |
|
304 | - // if user_id present we'll use this to set the fname and lname and admin_email. |
|
305 | - if (! empty($this->user_id)) { |
|
306 | - $this->user_id = (int) $this->user_id; |
|
307 | - $user = get_userdata($this->user_id); |
|
308 | - $this->fname = $user->user_firstname; |
|
309 | - $this->lname = $user->user_lastname; |
|
310 | - $this->admin_email = $user->user_email; |
|
311 | - } |
|
312 | - } |
|
18 | + /** |
|
19 | + * Identifier properties for the recipient |
|
20 | + */ |
|
21 | + |
|
22 | + /** |
|
23 | + * if available we'll use this to set the fname and lname (admin) |
|
24 | + * |
|
25 | + * @var int |
|
26 | + */ |
|
27 | + public $user_id; |
|
28 | + |
|
29 | + /** |
|
30 | + * this will always be the admin fname (set later via incoming user_id) |
|
31 | + * |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + public $fname; |
|
35 | + |
|
36 | + /** |
|
37 | + * this will always be the admin lname (set later via incoming user_id) |
|
38 | + * |
|
39 | + * @var string |
|
40 | + */ |
|
41 | + public $lname; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var int |
|
45 | + */ |
|
46 | + public $primary_registration_id; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var int |
|
50 | + */ |
|
51 | + public $attendee_registration_id; |
|
52 | + |
|
53 | + /** |
|
54 | + * This is should represent the data object that can be used to regenerate this addressee if needed. |
|
55 | + * It is saved to the MSG_recipient_ID column in the generated EE_Message using this data. |
|
56 | + * |
|
57 | + * @var int |
|
58 | + */ |
|
59 | + public $recipient_id; |
|
60 | + |
|
61 | + /** |
|
62 | + * This represents the reference to the EE_Base_Class child that the $recipient_ID is for (eg. 'Registration', |
|
63 | + * 'Attendee') It is saved to the MSG_recipient_type column in the generated EE_Message using this data. |
|
64 | + * |
|
65 | + * @var string |
|
66 | + */ |
|
67 | + public $recipient_type; |
|
68 | + |
|
69 | + /** |
|
70 | + * communication related |
|
71 | + */ |
|
72 | + /** |
|
73 | + * @var string |
|
74 | + */ |
|
75 | + public $attendee_email; |
|
76 | + |
|
77 | + /** |
|
78 | + * @var string |
|
79 | + */ |
|
80 | + public $primary_attendee_email; |
|
81 | + |
|
82 | + /** |
|
83 | + * @var string |
|
84 | + */ |
|
85 | + public $admin_email; |
|
86 | + |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * Attendee related |
|
91 | + */ |
|
92 | + |
|
93 | + /** |
|
94 | + * holds the attendee object for the primary attendee |
|
95 | + * |
|
96 | + * @var EE_Attendee |
|
97 | + */ |
|
98 | + public $primary_att_obj; |
|
99 | + |
|
100 | + /** |
|
101 | + * holds the registration object for the primary attendee |
|
102 | + * |
|
103 | + * @var EE_Registration |
|
104 | + */ |
|
105 | + public $primary_reg_obj; |
|
106 | + |
|
107 | + /** |
|
108 | + * holds the attendee object for an attendee |
|
109 | + * |
|
110 | + * @var EE_Attendee |
|
111 | + */ |
|
112 | + public $att_obj; |
|
113 | + |
|
114 | + /** |
|
115 | + * holds the registration object for an attendee |
|
116 | + * |
|
117 | + * @var EE_Registration |
|
118 | + */ |
|
119 | + public $reg_obj; |
|
120 | + |
|
121 | + /** |
|
122 | + * array of EE_Question objects (indexed by EE_Answer->ID()) |
|
123 | + * |
|
124 | + * @var EE_Question[] |
|
125 | + */ |
|
126 | + public $questions; |
|
127 | + |
|
128 | + /** |
|
129 | + * array of EE_Answer objects |
|
130 | + * |
|
131 | + * @var EE_Answer[] |
|
132 | + */ |
|
133 | + public $answers; |
|
134 | + |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * event related |
|
139 | + */ |
|
140 | + |
|
141 | + /** |
|
142 | + * This will hold all event info/ |
|
143 | + * @var EE_Event[] |
|
144 | + */ |
|
145 | + public $events; |
|
146 | + |
|
147 | + /** |
|
148 | + * holds all the attendees for an event. |
|
149 | + * |
|
150 | + * @var EE_Attendee[] |
|
151 | + */ |
|
152 | + public $attendees; |
|
153 | + |
|
154 | + /** |
|
155 | + * holds all the purchased tickets for an event |
|
156 | + * |
|
157 | + * @var EE_Ticket[] |
|
158 | + */ |
|
159 | + public $tickets; |
|
160 | + |
|
161 | + /** |
|
162 | + * holds an array of line items indexed by parent ticket line item ids and values are array of children of that |
|
163 | + * line item |
|
164 | + * |
|
165 | + * @var EE_Line_Item[] |
|
166 | + */ |
|
167 | + public $line_items_with_children; |
|
168 | + |
|
169 | + /** |
|
170 | + * holds all the datetimes accessed via the tickets purchased for the event |
|
171 | + * |
|
172 | + * @var EE_Datetime[] |
|
173 | + */ |
|
174 | + public $datetimes; |
|
175 | + |
|
176 | + /** |
|
177 | + * holds all registrations for a transaction (with cached relations on that registration) |
|
178 | + * |
|
179 | + * @var EE_Registration[] |
|
180 | + */ |
|
181 | + public $registrations; |
|
182 | + |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * txn related |
|
187 | + */ |
|
188 | + |
|
189 | + /** |
|
190 | + * @var array |
|
191 | + */ |
|
192 | + public $billing; |
|
193 | + |
|
194 | + /** |
|
195 | + *total taxes |
|
196 | + * |
|
197 | + * @var array |
|
198 | + */ |
|
199 | + public $taxes; |
|
200 | + |
|
201 | + /** |
|
202 | + * @var EE_Line_Item[] |
|
203 | + */ |
|
204 | + public $tax_line_items; |
|
205 | + |
|
206 | + /** |
|
207 | + * @var EE_Line_Item[] |
|
208 | + */ |
|
209 | + public $additional_line_items; |
|
210 | + |
|
211 | + /** |
|
212 | + * @var EE_Line_Item |
|
213 | + */ |
|
214 | + public $grand_total_line_item; |
|
215 | + |
|
216 | + /** |
|
217 | + * @var EE_Transaction |
|
218 | + */ |
|
219 | + public $txn; |
|
220 | + |
|
221 | + /** |
|
222 | + * @var EE_Payment |
|
223 | + */ |
|
224 | + public $payment; |
|
225 | + |
|
226 | + /** |
|
227 | + * @var EE_Payment[] |
|
228 | + */ |
|
229 | + public $payments; |
|
230 | + |
|
231 | + /** |
|
232 | + * @var EE_Transaction[] |
|
233 | + */ |
|
234 | + public $txn_objs; |
|
235 | + |
|
236 | + /** |
|
237 | + * @var EE_Registration[] |
|
238 | + */ |
|
239 | + public $reg_objs; |
|
240 | + |
|
241 | + /** |
|
242 | + * total number of ALL tickets purchased for the txn. |
|
243 | + * |
|
244 | + * @var int |
|
245 | + */ |
|
246 | + public $total_ticket_count; |
|
247 | + |
|
248 | + |
|
249 | + |
|
250 | + /** |
|
251 | + * things that get set later by parsers |
|
252 | + */ |
|
253 | + |
|
254 | + /** |
|
255 | + * @var string $event_list |
|
256 | + */ |
|
257 | + public $event_list; |
|
258 | + |
|
259 | + /** |
|
260 | + * @var string |
|
261 | + */ |
|
262 | + public $attendee_list; |
|
263 | + |
|
264 | + |
|
265 | + |
|
266 | + /** |
|
267 | + * This just holds the incoming data |
|
268 | + * |
|
269 | + * @var array |
|
270 | + */ |
|
271 | + protected $_data; |
|
272 | + |
|
273 | + |
|
274 | + |
|
275 | + /** |
|
276 | + * constructor |
|
277 | + * |
|
278 | + * @access public |
|
279 | + * @param array $addressee_data We're expecting an incoming array of data that will be used to fill the properties |
|
280 | + * for the object. |
|
281 | + */ |
|
282 | + public function __construct($addressee_data) |
|
283 | + { |
|
284 | + $this->_data = $addressee_data; |
|
285 | + $this->_set_properties(); |
|
286 | + } |
|
287 | + |
|
288 | + |
|
289 | + |
|
290 | + /** |
|
291 | + * This simply loops through the data and makes sure that each item is present in the incoming data. If it is then |
|
292 | + * it is assigned to the property. |
|
293 | + * |
|
294 | + * @access protected |
|
295 | + * @return void. |
|
296 | + */ |
|
297 | + protected function _set_properties() |
|
298 | + { |
|
299 | + foreach ($this->_data as $prop => $value) { |
|
300 | + if (property_exists($this, $prop)) { |
|
301 | + $this->{$prop} = $value; |
|
302 | + } |
|
303 | + } |
|
304 | + // if user_id present we'll use this to set the fname and lname and admin_email. |
|
305 | + if (! empty($this->user_id)) { |
|
306 | + $this->user_id = (int) $this->user_id; |
|
307 | + $user = get_userdata($this->user_id); |
|
308 | + $this->fname = $user->user_firstname; |
|
309 | + $this->lname = $user->user_lastname; |
|
310 | + $this->admin_email = $user->user_email; |
|
311 | + } |
|
312 | + } |
|
313 | 313 | } |
@@ -302,7 +302,7 @@ |
||
302 | 302 | } |
303 | 303 | } |
304 | 304 | // if user_id present we'll use this to set the fname and lname and admin_email. |
305 | - if (! empty($this->user_id)) { |
|
305 | + if ( ! empty($this->user_id)) { |
|
306 | 306 | $this->user_id = (int) $this->user_id; |
307 | 307 | $user = get_userdata($this->user_id); |
308 | 308 | $this->fname = $user->user_firstname; |