Completed
Branch ENH/optimize-reset-reservation... (ea022f)
by
unknown
06:52 queued 04:53
created
core/libraries/messages/EE_Messages_Scheduler.lib.php 2 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -11,198 +11,198 @@
 block discarded – undo
11 11
 class EE_Messages_Scheduler extends EE_Base
12 12
 {
13 13
 
14
-    /**
15
-     * Number of seconds between batch sends/generates on the cron job.
16
-     * Defaults to 5 minutes in seconds.  If you want to change this interval, you can use the native WordPress
17
-     * `cron_schedules` filter and modify the existing custom `ee_message_cron` schedule interval added.
18
-     *
19
-     * @type int
20
-     */
21
-    const message_cron_schedule = 300;
22
-
23
-    /**
24
-     * Constructor
25
-     */
26
-    public function __construct()
27
-    {
28
-        // register tasks (and make sure only registered once).
29
-        if (! has_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'))) {
30
-            add_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'), 10);
31
-        }
32
-
33
-        // register callbacks for scheduled events (but make sure they are set only once).
34
-        if (! has_action(
35
-            'AHEE__EE_Messages_Scheduler__generation',
36
-            array('EE_Messages_Scheduler', 'batch_generation')
37
-        )) {
38
-            add_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation'));
39
-            add_action('AHEE__EE_Messages_Scheduler__sending', array('EE_Messages_Scheduler', 'batch_sending'));
40
-            add_action('AHEE__EE_Messages_Scheduler__cleanup', array('EE_Messages_Scheduler', 'cleanup'));
41
-        }
42
-
43
-        // add custom schedules
44
-        add_filter('cron_schedules', array($this, 'custom_schedules'));
45
-    }
46
-
47
-
48
-    /**
49
-     * Add custom schedules for wp_cron
50
-     *
51
-     * @param $schedules
52
-     */
53
-    public function custom_schedules($schedules)
54
-    {
55
-        $schedules['ee_message_cron'] = array(
56
-            'interval' => self::message_cron_schedule,
57
-            'display'  => __(
58
-                'This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)',
59
-                'event_espresso'
60
-            ),
61
-        );
62
-        return $schedules;
63
-    }
64
-
65
-
66
-    /**
67
-     * Callback for FHEE__EEH_Activation__get_cron_tasks that is used to retrieve scheduled Cron events to add and
68
-     * remove.
69
-     *
70
-     * @param array $tasks already existing scheduled tasks
71
-     * @return array
72
-     */
73
-    public function register_scheduled_tasks($tasks)
74
-    {
75
-        EE_Registry::instance()->load_helper('DTT_Helper');
76
-        $tasks['AHEE__EE_Messages_Scheduler__generation'] = 'ee_message_cron';
77
-        $tasks['AHEE__EE_Messages_Scheduler__sending']    = 'ee_message_cron';
78
-        $tasks['AHEE__EE_Messages_Scheduler__cleanup'] = array( EEH_DTT_Helper::tomorrow(), 'daily');
79
-        return $tasks;
80
-    }
81
-
82
-
83
-    /**
84
-     * This initiates a non-blocking separate request to execute on a scheduled task.
85
-     * Note: The EED_Messages module has the handlers for these requests.
86
-     *
87
-     * @param string $task The task the request is being generated for.
88
-     */
89
-    public static function initiate_scheduled_non_blocking_request($task)
90
-    {
91
-        if (apply_filters(
92
-            'EE_Messages_Scheduler__initiate_scheduled_non_blocking_request__do_separate_request',
93
-            true
94
-        )) {
95
-            $request_url  = add_query_arg(
96
-                array_merge(
97
-                    array('ee' => 'msg_cron_trigger'),
98
-                    EE_Messages_Scheduler::get_request_params($task)
99
-                ),
100
-                site_url()
101
-            );
102
-            $request_args = array(
103
-                'timeout'     => 300,
104
-                'blocking'    => (defined('DOING_CRON') && DOING_CRON) || (defined('DOING_AJAX') && DOING_AJAX) ? true : false,
105
-                'sslverify'   => false,
106
-                'redirection' => 10,
107
-            );
108
-            $response     = wp_remote_get($request_url, $request_args);
109
-            if (is_wp_error($response)) {
110
-                trigger_error($response->get_error_message());
111
-            }
112
-        } else {
113
-            EE_Messages_Scheduler::initiate_immediate_request_on_cron($task);
114
-        }
115
-    }
116
-
117
-
118
-    /**
119
-     * This returns
120
-     * the request params used for a scheduled message task request.
121
-     *
122
-     * @param string $task The task the request is for.
123
-     * @return array
124
-     */
125
-    public static function get_request_params($task)
126
-    {
127
-        // transient is used for flood control on msg_cron_trigger requests
128
-        $transient_key = 'ee_trans_' . uniqid($task);
129
-        set_transient($transient_key, 1, 5 * MINUTE_IN_SECONDS);
130
-        return array(
131
-            'type' => $task,
132
-            'key'  => $transient_key,
133
-        );
134
-    }
135
-
136
-
137
-    /**
138
-     * This is used to execute an immediate call to the run_cron task performed by EED_Messages
139
-     *
140
-     * @param string $task The task the request is being generated for.
141
-     */
142
-    public static function initiate_immediate_request_on_cron($task)
143
-    {
144
-        $request_args = EE_Messages_Scheduler::get_request_params($task);
145
-        // set those request args in the request so it gets picked up
146
-        foreach ($request_args as $request_key => $request_value) {
147
-            EE_Registry::instance()->REQ->set($request_key, $request_value);
148
-        }
149
-        EED_Messages::instance()->run_cron();
150
-    }
151
-
152
-
153
-    /**
154
-     * Callback for scheduled AHEE__EE_Messages_Scheduler__generation wp cron event
155
-     */
156
-    public static function batch_generation()
157
-    {
158
-        /**
159
-         * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
160
-         */
161
-        if (! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
162
-            || ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
163
-        ) {
164
-            EE_Messages_Scheduler::initiate_immediate_request_on_cron('generate');
165
-        }
166
-    }
167
-
168
-
169
-    /**
170
-     * Callback for scheduled AHEE__EE_Messages_Scheduler__sending
171
-     */
172
-    public static function batch_sending()
173
-    {
174
-        /**
175
-         * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
176
-         */
177
-        if (! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
178
-            || ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
179
-        ) {
180
-            EE_Messages_Scheduler::initiate_immediate_request_on_cron('send');
181
-        }
182
-    }
183
-
184
-
185
-    /**
186
-     * This is the callback for the `AHEE__EE_Messages_Scheduler__cleanup` scheduled event action.
187
-     * This runs once a day and if cleanup is active (set via messages settings), it will (by default) delete permanently
188
-     * from the database messages that have a MSG_modified date older than 30 days.
189
-     */
190
-    public static function cleanup()
191
-    {
192
-        // first check if user has cleanup turned on or if we're in maintenance mode.  If in maintenance mode we'll wait
193
-        // until the next scheduled event.
194
-        if (! EE_Registry::instance()->CFG->messages->delete_threshold
195
-            || ! EE_Maintenance_Mode::instance()->models_can_query()
196
-        ) {
197
-            return;
198
-        }
199
-
200
-        /**
201
-         * This filter switch allows other code (such as the EE_Worker_Queue add-on) to replace this with its own handling
202
-         * of deleting messages.
203
-         */
204
-        if (apply_filters('FHEE__EE_Messages_Scheduler__cleanup__handle_cleanup_on_cron', true)) {
205
-            EEM_Message::instance()->delete_old_messages(EE_Registry::instance()->CFG->messages->delete_threshold);
206
-        }
207
-    }
14
+	/**
15
+	 * Number of seconds between batch sends/generates on the cron job.
16
+	 * Defaults to 5 minutes in seconds.  If you want to change this interval, you can use the native WordPress
17
+	 * `cron_schedules` filter and modify the existing custom `ee_message_cron` schedule interval added.
18
+	 *
19
+	 * @type int
20
+	 */
21
+	const message_cron_schedule = 300;
22
+
23
+	/**
24
+	 * Constructor
25
+	 */
26
+	public function __construct()
27
+	{
28
+		// register tasks (and make sure only registered once).
29
+		if (! has_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'))) {
30
+			add_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'), 10);
31
+		}
32
+
33
+		// register callbacks for scheduled events (but make sure they are set only once).
34
+		if (! has_action(
35
+			'AHEE__EE_Messages_Scheduler__generation',
36
+			array('EE_Messages_Scheduler', 'batch_generation')
37
+		)) {
38
+			add_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation'));
39
+			add_action('AHEE__EE_Messages_Scheduler__sending', array('EE_Messages_Scheduler', 'batch_sending'));
40
+			add_action('AHEE__EE_Messages_Scheduler__cleanup', array('EE_Messages_Scheduler', 'cleanup'));
41
+		}
42
+
43
+		// add custom schedules
44
+		add_filter('cron_schedules', array($this, 'custom_schedules'));
45
+	}
46
+
47
+
48
+	/**
49
+	 * Add custom schedules for wp_cron
50
+	 *
51
+	 * @param $schedules
52
+	 */
53
+	public function custom_schedules($schedules)
54
+	{
55
+		$schedules['ee_message_cron'] = array(
56
+			'interval' => self::message_cron_schedule,
57
+			'display'  => __(
58
+				'This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)',
59
+				'event_espresso'
60
+			),
61
+		);
62
+		return $schedules;
63
+	}
64
+
65
+
66
+	/**
67
+	 * Callback for FHEE__EEH_Activation__get_cron_tasks that is used to retrieve scheduled Cron events to add and
68
+	 * remove.
69
+	 *
70
+	 * @param array $tasks already existing scheduled tasks
71
+	 * @return array
72
+	 */
73
+	public function register_scheduled_tasks($tasks)
74
+	{
75
+		EE_Registry::instance()->load_helper('DTT_Helper');
76
+		$tasks['AHEE__EE_Messages_Scheduler__generation'] = 'ee_message_cron';
77
+		$tasks['AHEE__EE_Messages_Scheduler__sending']    = 'ee_message_cron';
78
+		$tasks['AHEE__EE_Messages_Scheduler__cleanup'] = array( EEH_DTT_Helper::tomorrow(), 'daily');
79
+		return $tasks;
80
+	}
81
+
82
+
83
+	/**
84
+	 * This initiates a non-blocking separate request to execute on a scheduled task.
85
+	 * Note: The EED_Messages module has the handlers for these requests.
86
+	 *
87
+	 * @param string $task The task the request is being generated for.
88
+	 */
89
+	public static function initiate_scheduled_non_blocking_request($task)
90
+	{
91
+		if (apply_filters(
92
+			'EE_Messages_Scheduler__initiate_scheduled_non_blocking_request__do_separate_request',
93
+			true
94
+		)) {
95
+			$request_url  = add_query_arg(
96
+				array_merge(
97
+					array('ee' => 'msg_cron_trigger'),
98
+					EE_Messages_Scheduler::get_request_params($task)
99
+				),
100
+				site_url()
101
+			);
102
+			$request_args = array(
103
+				'timeout'     => 300,
104
+				'blocking'    => (defined('DOING_CRON') && DOING_CRON) || (defined('DOING_AJAX') && DOING_AJAX) ? true : false,
105
+				'sslverify'   => false,
106
+				'redirection' => 10,
107
+			);
108
+			$response     = wp_remote_get($request_url, $request_args);
109
+			if (is_wp_error($response)) {
110
+				trigger_error($response->get_error_message());
111
+			}
112
+		} else {
113
+			EE_Messages_Scheduler::initiate_immediate_request_on_cron($task);
114
+		}
115
+	}
116
+
117
+
118
+	/**
119
+	 * This returns
120
+	 * the request params used for a scheduled message task request.
121
+	 *
122
+	 * @param string $task The task the request is for.
123
+	 * @return array
124
+	 */
125
+	public static function get_request_params($task)
126
+	{
127
+		// transient is used for flood control on msg_cron_trigger requests
128
+		$transient_key = 'ee_trans_' . uniqid($task);
129
+		set_transient($transient_key, 1, 5 * MINUTE_IN_SECONDS);
130
+		return array(
131
+			'type' => $task,
132
+			'key'  => $transient_key,
133
+		);
134
+	}
135
+
136
+
137
+	/**
138
+	 * This is used to execute an immediate call to the run_cron task performed by EED_Messages
139
+	 *
140
+	 * @param string $task The task the request is being generated for.
141
+	 */
142
+	public static function initiate_immediate_request_on_cron($task)
143
+	{
144
+		$request_args = EE_Messages_Scheduler::get_request_params($task);
145
+		// set those request args in the request so it gets picked up
146
+		foreach ($request_args as $request_key => $request_value) {
147
+			EE_Registry::instance()->REQ->set($request_key, $request_value);
148
+		}
149
+		EED_Messages::instance()->run_cron();
150
+	}
151
+
152
+
153
+	/**
154
+	 * Callback for scheduled AHEE__EE_Messages_Scheduler__generation wp cron event
155
+	 */
156
+	public static function batch_generation()
157
+	{
158
+		/**
159
+		 * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
160
+		 */
161
+		if (! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
162
+			|| ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
163
+		) {
164
+			EE_Messages_Scheduler::initiate_immediate_request_on_cron('generate');
165
+		}
166
+	}
167
+
168
+
169
+	/**
170
+	 * Callback for scheduled AHEE__EE_Messages_Scheduler__sending
171
+	 */
172
+	public static function batch_sending()
173
+	{
174
+		/**
175
+		 * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
176
+		 */
177
+		if (! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
178
+			|| ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
179
+		) {
180
+			EE_Messages_Scheduler::initiate_immediate_request_on_cron('send');
181
+		}
182
+	}
183
+
184
+
185
+	/**
186
+	 * This is the callback for the `AHEE__EE_Messages_Scheduler__cleanup` scheduled event action.
187
+	 * This runs once a day and if cleanup is active (set via messages settings), it will (by default) delete permanently
188
+	 * from the database messages that have a MSG_modified date older than 30 days.
189
+	 */
190
+	public static function cleanup()
191
+	{
192
+		// first check if user has cleanup turned on or if we're in maintenance mode.  If in maintenance mode we'll wait
193
+		// until the next scheduled event.
194
+		if (! EE_Registry::instance()->CFG->messages->delete_threshold
195
+			|| ! EE_Maintenance_Mode::instance()->models_can_query()
196
+		) {
197
+			return;
198
+		}
199
+
200
+		/**
201
+		 * This filter switch allows other code (such as the EE_Worker_Queue add-on) to replace this with its own handling
202
+		 * of deleting messages.
203
+		 */
204
+		if (apply_filters('FHEE__EE_Messages_Scheduler__cleanup__handle_cleanup_on_cron', true)) {
205
+			EEM_Message::instance()->delete_old_messages(EE_Registry::instance()->CFG->messages->delete_threshold);
206
+		}
207
+	}
208 208
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
     public function __construct()
27 27
     {
28 28
         // register tasks (and make sure only registered once).
29
-        if (! has_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'))) {
29
+        if ( ! has_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'))) {
30 30
             add_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'), 10);
31 31
         }
32 32
 
33 33
         // register callbacks for scheduled events (but make sure they are set only once).
34
-        if (! has_action(
34
+        if ( ! has_action(
35 35
             'AHEE__EE_Messages_Scheduler__generation',
36 36
             array('EE_Messages_Scheduler', 'batch_generation')
37 37
         )) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         EE_Registry::instance()->load_helper('DTT_Helper');
76 76
         $tasks['AHEE__EE_Messages_Scheduler__generation'] = 'ee_message_cron';
77 77
         $tasks['AHEE__EE_Messages_Scheduler__sending']    = 'ee_message_cron';
78
-        $tasks['AHEE__EE_Messages_Scheduler__cleanup'] = array( EEH_DTT_Helper::tomorrow(), 'daily');
78
+        $tasks['AHEE__EE_Messages_Scheduler__cleanup'] = array(EEH_DTT_Helper::tomorrow(), 'daily');
79 79
         return $tasks;
80 80
     }
81 81
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             'EE_Messages_Scheduler__initiate_scheduled_non_blocking_request__do_separate_request',
93 93
             true
94 94
         )) {
95
-            $request_url  = add_query_arg(
95
+            $request_url = add_query_arg(
96 96
                 array_merge(
97 97
                     array('ee' => 'msg_cron_trigger'),
98 98
                     EE_Messages_Scheduler::get_request_params($task)
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                 'sslverify'   => false,
106 106
                 'redirection' => 10,
107 107
             );
108
-            $response     = wp_remote_get($request_url, $request_args);
108
+            $response = wp_remote_get($request_url, $request_args);
109 109
             if (is_wp_error($response)) {
110 110
                 trigger_error($response->get_error_message());
111 111
             }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     public static function get_request_params($task)
126 126
     {
127 127
         // transient is used for flood control on msg_cron_trigger requests
128
-        $transient_key = 'ee_trans_' . uniqid($task);
128
+        $transient_key = 'ee_trans_'.uniqid($task);
129 129
         set_transient($transient_key, 1, 5 * MINUTE_IN_SECONDS);
130 130
         return array(
131 131
             'type' => $task,
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         /**
159 159
          * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
160 160
          */
161
-        if (! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
161
+        if ( ! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
162 162
             || ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
163 163
         ) {
164 164
             EE_Messages_Scheduler::initiate_immediate_request_on_cron('generate');
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         /**
175 175
          * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
176 176
          */
177
-        if (! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
177
+        if ( ! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
178 178
             || ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
179 179
         ) {
180 180
             EE_Messages_Scheduler::initiate_immediate_request_on_cron('send');
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     {
192 192
         // first check if user has cleanup turned on or if we're in maintenance mode.  If in maintenance mode we'll wait
193 193
         // until the next scheduled event.
194
-        if (! EE_Registry::instance()->CFG->messages->delete_threshold
194
+        if ( ! EE_Registry::instance()->CFG->messages->delete_threshold
195 195
             || ! EE_Maintenance_Mode::instance()->models_can_query()
196 196
         ) {
197 197
             return;
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Repository.lib.php 2 patches
Indentation   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -12,256 +12,256 @@
 block discarded – undo
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 ($this->current()->priority() === $priority && (($status && in_array(
248
-                $this->current()->STS_ID(),
249
-                $status
250
-            )) || ! $status)
251
-            ) {
252
-                $count++;
253
-            }
254
-            $this->next();
255
-        }
256
-        return $count;
257
-    }
244
+		$count = 0;
245
+		$this->rewind();
246
+		while ($this->valid()) {
247
+			if ($this->current()->priority() === $priority && (($status && in_array(
248
+				$this->current()->STS_ID(),
249
+				$status
250
+			)) || ! $status)
251
+			) {
252
+				$count++;
253
+			}
254
+			$this->next();
255
+		}
256
+		return $count;
257
+	}
258 258
 
259 259
 
260
-    /**
261
-     * @return EE_Message
262
-     */
263
-    public function current()
264
-    {
265
-        return parent::current();
266
-    }
260
+	/**
261
+	 * @return EE_Message
262
+	 */
263
+	public function current()
264
+	{
265
+		return parent::current();
266
+	}
267 267
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Type_Collection.lib.php 2 patches
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -14,168 +14,168 @@
 block discarded – undo
14 14
 class EE_Message_Type_Collection extends EE_Object_Collection
15 15
 {
16 16
 
17
-    /**
18
-     * EE_Message_Type_Collection constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        $this->interface = 'EE_message_type';
23
-    }
24
-
25
-
26
-
27
-    /**
28
-     * add
29
-     *
30
-     * attaches an object to the Collection
31
-     * and sets any supplied data associated with the current iterator entry
32
-     * by calling EE_Object_Collection::set_info()
33
-     *
34
-     * @access public
35
-     * @param object $object
36
-     * @param mixed  $info
37
-     * @return bool
38
-     */
39
-    public function add($object, $info = null)
40
-    {
41
-        $info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
42
-        return parent::add($object, $info);
43
-    }
44
-
45
-
46
-
47
-    /**
48
-     * set_info
49
-     *
50
-     * Sets the data associated with an object in the Collection
51
-     * if no $info is supplied, then the spl_object_hash() is used
52
-     *
53
-     * @access public
54
-     * @param object $object
55
-     * @param mixed  $info
56
-     * @return bool
57
-     */
58
-    public function set_info($object, $info = null)
59
-    {
60
-        $info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
61
-        return parent::set_info($object, $info);
62
-    }
63
-
64
-
65
-
66
-    /**
67
-     * get_by_info
68
-     *
69
-     * finds and returns an object in the Collection based on the info that was set using addObject()
70
-     * PLZ NOTE: the pointer is reset to the beginning of the collection before returning
71
-     *
72
-     * @access public
73
-     * @param mixed
74
-     * @return null | object
75
-     */
76
-    public function get_by_info($info)
77
-    {
78
-        return parent::get_by_info(str_replace(' ', '_', strtolower($info)));
79
-    }
80
-
81
-
82
-
83
-    /**
84
-     * has
85
-     *
86
-     * returns TRUE or FALSE depending on whether the supplied object is within the Collection
87
-     *
88
-     * @access public
89
-     * @param object $object
90
-     * @return bool
91
-     */
92
-    public function has($object)
93
-    {
94
-        return parent::has($object);
95
-    }
96
-
97
-
98
-
99
-    /**
100
-     * has_by_name
101
-     *
102
-     * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection
103
-     *
104
-     * @access public
105
-     * @param string $message_type_name
106
-     * @return bool
107
-     */
108
-    public function has_by_name($message_type_name)
109
-    {
110
-        return $this->get_by_info($message_type_name) instanceof $this->interface ? true : false;
111
-    }
112
-
113
-
114
-
115
-    /**
116
-     * remove
117
-     *
118
-     * detaches an object from the Collection
119
-     *
120
-     * @access public
121
-     * @param $object
122
-     * @return bool
123
-     */
124
-    public function remove($object)
125
-    {
126
-        return parent::remove($object);
127
-    }
128
-
129
-
130
-
131
-    /**
132
-     * set_current
133
-     *
134
-     * advances pointer to the provided object
135
-     *
136
-     * @access public
137
-     * @param $object
138
-     * @return void
139
-     */
140
-    public function set_current($object)
141
-    {
142
-        parent::set_current($object);
143
-    }
144
-
145
-
146
-
147
-    /**
148
-     * set_current_by_info
149
-     *
150
-     * advances pointer to the object whose info matches that which was provided
151
-     *
152
-     * @access public
153
-     * @param $info
154
-     * @return void
155
-     */
156
-    public function set_current_by_info($info)
157
-    {
158
-        parent::set_current_by_info($info);
159
-    }
160
-
161
-
162
-
163
-    /**
164
-     * show_collection_classes
165
-     *
166
-     * displays list of collection classes if WP_DEBUG is on
167
-     *
168
-     * @access public
169
-     * @return void
170
-     */
171
-    public function show_collection_classes()
172
-    {
173
-        if (WP_DEBUG) {
174
-            $this->rewind();
175
-            while ($this->valid()) {
176
-                echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>';
177
-                $this->next();
178
-            }
179
-        }
180
-    }
17
+	/**
18
+	 * EE_Message_Type_Collection constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		$this->interface = 'EE_message_type';
23
+	}
24
+
25
+
26
+
27
+	/**
28
+	 * add
29
+	 *
30
+	 * attaches an object to the Collection
31
+	 * and sets any supplied data associated with the current iterator entry
32
+	 * by calling EE_Object_Collection::set_info()
33
+	 *
34
+	 * @access public
35
+	 * @param object $object
36
+	 * @param mixed  $info
37
+	 * @return bool
38
+	 */
39
+	public function add($object, $info = null)
40
+	{
41
+		$info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
42
+		return parent::add($object, $info);
43
+	}
44
+
45
+
46
+
47
+	/**
48
+	 * set_info
49
+	 *
50
+	 * Sets the data associated with an object in the Collection
51
+	 * if no $info is supplied, then the spl_object_hash() is used
52
+	 *
53
+	 * @access public
54
+	 * @param object $object
55
+	 * @param mixed  $info
56
+	 * @return bool
57
+	 */
58
+	public function set_info($object, $info = null)
59
+	{
60
+		$info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
61
+		return parent::set_info($object, $info);
62
+	}
63
+
64
+
65
+
66
+	/**
67
+	 * get_by_info
68
+	 *
69
+	 * finds and returns an object in the Collection based on the info that was set using addObject()
70
+	 * PLZ NOTE: the pointer is reset to the beginning of the collection before returning
71
+	 *
72
+	 * @access public
73
+	 * @param mixed
74
+	 * @return null | object
75
+	 */
76
+	public function get_by_info($info)
77
+	{
78
+		return parent::get_by_info(str_replace(' ', '_', strtolower($info)));
79
+	}
80
+
81
+
82
+
83
+	/**
84
+	 * has
85
+	 *
86
+	 * returns TRUE or FALSE depending on whether the supplied object is within the Collection
87
+	 *
88
+	 * @access public
89
+	 * @param object $object
90
+	 * @return bool
91
+	 */
92
+	public function has($object)
93
+	{
94
+		return parent::has($object);
95
+	}
96
+
97
+
98
+
99
+	/**
100
+	 * has_by_name
101
+	 *
102
+	 * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection
103
+	 *
104
+	 * @access public
105
+	 * @param string $message_type_name
106
+	 * @return bool
107
+	 */
108
+	public function has_by_name($message_type_name)
109
+	{
110
+		return $this->get_by_info($message_type_name) instanceof $this->interface ? true : false;
111
+	}
112
+
113
+
114
+
115
+	/**
116
+	 * remove
117
+	 *
118
+	 * detaches an object from the Collection
119
+	 *
120
+	 * @access public
121
+	 * @param $object
122
+	 * @return bool
123
+	 */
124
+	public function remove($object)
125
+	{
126
+		return parent::remove($object);
127
+	}
128
+
129
+
130
+
131
+	/**
132
+	 * set_current
133
+	 *
134
+	 * advances pointer to the provided object
135
+	 *
136
+	 * @access public
137
+	 * @param $object
138
+	 * @return void
139
+	 */
140
+	public function set_current($object)
141
+	{
142
+		parent::set_current($object);
143
+	}
144
+
145
+
146
+
147
+	/**
148
+	 * set_current_by_info
149
+	 *
150
+	 * advances pointer to the object whose info matches that which was provided
151
+	 *
152
+	 * @access public
153
+	 * @param $info
154
+	 * @return void
155
+	 */
156
+	public function set_current_by_info($info)
157
+	{
158
+		parent::set_current_by_info($info);
159
+	}
160
+
161
+
162
+
163
+	/**
164
+	 * show_collection_classes
165
+	 *
166
+	 * displays list of collection classes if WP_DEBUG is on
167
+	 *
168
+	 * @access public
169
+	 * @return void
170
+	 */
171
+	public function show_collection_classes()
172
+	{
173
+		if (WP_DEBUG) {
174
+			$this->rewind();
175
+			while ($this->valid()) {
176
+				echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>';
177
+				$this->next();
178
+			}
179
+		}
180
+	}
181 181
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@
 block discarded – undo
173 173
         if (WP_DEBUG) {
174 174
             $this->rewind();
175 175
             while ($this->valid()) {
176
-                echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>';
176
+                echo '<h5 style="color:#2EA2CC;">'.__CLASS__.' class : <span style="color:#E76700">'.$this->getInfo().'</span></h5>';
177 177
                 $this->next();
178 178
             }
179 179
         }
Please login to merge, or discard this patch.
core/libraries/messages/defaults/EE_Messages_Template_Pack.core.php 2 patches
Indentation   +469 added lines, -469 removed lines patch added patch discarded remove patch
@@ -14,511 +14,511 @@
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-    /**
18
-     * This defines the base_path where the templates are located.
19
-     *
20
-     * @since            4.5.0
21
-     *
22
-     * @var string
23
-     */
24
-    protected $_base_path;
17
+	/**
18
+	 * This defines the base_path where the templates are located.
19
+	 *
20
+	 * @since            4.5.0
21
+	 *
22
+	 * @var string
23
+	 */
24
+	protected $_base_path;
25 25
 
26 26
 
27 27
 
28 28
 
29
-    /**
30
-     * This defines the base_url where things are found for this template pack (possibly variations).
31
-     *
32
-     * @since 4.5.0
33
-     *
34
-     * @var string
35
-     */
36
-    protected $_base_url;
29
+	/**
30
+	 * This defines the base_url where things are found for this template pack (possibly variations).
31
+	 *
32
+	 * @since 4.5.0
33
+	 *
34
+	 * @var string
35
+	 */
36
+	protected $_base_url;
37 37
 
38 38
 
39 39
 
40
-    /**
41
-     * localized label for this template pack
42
-     *
43
-     * @since            4.5.0
44
-     *
45
-     * @var string
46
-     */
47
-    public $label;
40
+	/**
41
+	 * localized label for this template pack
42
+	 *
43
+	 * @since            4.5.0
44
+	 *
45
+	 * @var string
46
+	 */
47
+	public $label;
48 48
 
49 49
 
50 50
 
51 51
 
52
-    /**
53
-     * used to contain a description for the template pack.
54
-     *
55
-     * @since 4.5.0
56
-     *
57
-     * @var string
58
-     */
59
-    public $description;
52
+	/**
53
+	 * used to contain a description for the template pack.
54
+	 *
55
+	 * @since 4.5.0
56
+	 *
57
+	 * @var string
58
+	 */
59
+	public $description;
60 60
 
61 61
 
62 62
 
63 63
 
64
-    /**
65
-     * How this template is referenced in the db
66
-     *
67
-     * @since 4.5.0
68
-     *
69
-     * @var string
70
-     */
71
-    public $dbref;
64
+	/**
65
+	 * How this template is referenced in the db
66
+	 *
67
+	 * @since 4.5.0
68
+	 *
69
+	 * @var string
70
+	 */
71
+	public $dbref;
72 72
 
73 73
 
74 74
 
75 75
 
76
-    /**
77
-     * This is an array indexed by messenger and with an array of message types as values that indicate what messenger and message type this template pack supports by default.  It is possible for this to be modified by plugins via filters, but out of the box, this is what the template pack supports.
78
-     *
79
-     * @since 4.5.0
80
-     *
81
-     * @var array.
82
-     */
83
-    protected $_supports = array();
76
+	/**
77
+	 * This is an array indexed by messenger and with an array of message types as values that indicate what messenger and message type this template pack supports by default.  It is possible for this to be modified by plugins via filters, but out of the box, this is what the template pack supports.
78
+	 *
79
+	 * @since 4.5.0
80
+	 *
81
+	 * @var array.
82
+	 */
83
+	protected $_supports = array();
84 84
 
85 85
 
86 86
 
87 87
 
88 88
 
89
-    /**
90
-     * Holds the retrieved default templates for this template pack in a multidimensional array indexed by context and field, for a given messenger and message type.  Example format:
91
-     *
92
-     * $templates = array(
93
-     *  'email' => array(
94
-     *      'registration' => array(
95
-     *          'admin' => array(
96
-     *              'to' => 'contents',
97
-     *              'from' => 'contents',
98
-     *              'subject' => 'contents',
99
-     *              'content' => 'contents',
100
-     *              'event_list' => 'contents',
101
-     *              'attendee_list' => 'contents'
102
-     *          ),
103
-     *          'attendee' => array(
104
-     *              'to' => 'contents',
105
-     *              'from' => 'contents',
106
-     *              'subject' => 'contents',
107
-     *              'content' => 'contents',
108
-     *              'event_list' => 'contents',
109
-     *              'attendee_list' => 'contents',
110
-     *          ),
111
-     *      )
112
-     *  )
113
-     * )
114
-     *
115
-     * @since 4.5.0
116
-     *
117
-     * @var array
118
-     */
119
-    protected $_templates = array();
89
+	/**
90
+	 * Holds the retrieved default templates for this template pack in a multidimensional array indexed by context and field, for a given messenger and message type.  Example format:
91
+	 *
92
+	 * $templates = array(
93
+	 *  'email' => array(
94
+	 *      'registration' => array(
95
+	 *          'admin' => array(
96
+	 *              'to' => 'contents',
97
+	 *              'from' => 'contents',
98
+	 *              'subject' => 'contents',
99
+	 *              'content' => 'contents',
100
+	 *              'event_list' => 'contents',
101
+	 *              'attendee_list' => 'contents'
102
+	 *          ),
103
+	 *          'attendee' => array(
104
+	 *              'to' => 'contents',
105
+	 *              'from' => 'contents',
106
+	 *              'subject' => 'contents',
107
+	 *              'content' => 'contents',
108
+	 *              'event_list' => 'contents',
109
+	 *              'attendee_list' => 'contents',
110
+	 *          ),
111
+	 *      )
112
+	 *  )
113
+	 * )
114
+	 *
115
+	 * @since 4.5.0
116
+	 *
117
+	 * @var array
118
+	 */
119
+	protected $_templates = array();
120 120
 
121 121
 
122 122
 
123 123
 
124 124
 
125 125
 
126
-    /**
127
-     * Template Packs must ALWAYS have a default variation defined.  This property allow one to override the default variation labels per messenger.
128
-     * example:
129
-     * $this->_default_variation_labels = array( 'email' =>  __('Default', 'event_espresso' ) );
130
-     *
131
-     * @var array
132
-     */
133
-    protected $_default_variation_labels = array();
126
+	/**
127
+	 * Template Packs must ALWAYS have a default variation defined.  This property allow one to override the default variation labels per messenger.
128
+	 * example:
129
+	 * $this->_default_variation_labels = array( 'email' =>  __('Default', 'event_espresso' ) );
130
+	 *
131
+	 * @var array
132
+	 */
133
+	protected $_default_variation_labels = array();
134 134
 
135 135
 
136 136
 
137 137
 
138
-    /**
139
-     * This is an array of extra css variations for message templates indexed by messenger with the values as an array or message types the variations apply to as the key  and then values are an array with variation slugs as the key and label as the value. Note the default variation is not included in this array.  So the structure is:
140
-     * array(
141
-     *  'email' => array(
142
-     *  )
143
-     * )
144
-     *
145
-     * Keep in mind that this property is used both for indicating valid variations for a given message type and messenger but the variation files themselves are ONLY unique to the messenger.  So if you have a variation for the html messenger referenced by the slug "sunset_red" Then the variation file for the main type will be html_main_sunset_red.css.  All the array in this property allows you to do, is indicate that with certain message types the sunset_red variation is available but for other message types its not.  But you could NOT have a sunset_red variation file for one messenger/message_type and a different one for another messenger/message_type.  If you want different css looks then you can define a different structural layout for the template , messenger, message type combination and in the same sunset_red.css variation file just add css specific to that layout.
146
-     *
147
-     * @since 4.5.0
148
-     *
149
-     * @var array
150
-     */
151
-    public $_variations = array();
152
-
153
-
154
-
155
-
156
-    /**
157
-     * Template pack constructor
158
-     *
159
-     * @since 4.5.0
160
-     */
161
-    public function __construct()
162
-    {
163
-        $this->_set_props();
164
-        // make sure classname is correct
165
-        $classname = get_class($this);
166
-        // make sure required props have been set
167
-
168
-        // if label is empty then throw an error because we should have it defined by now.
169
-        if (! isset($this->label)) {
170
-            throw new EE_Error(sprintf(__('The label property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
171
-        }
172
-
173
-
174
-        // the reference for this template pack
175
-        if (! isset($this->dbref)) {
176
-            throw new EE_Error(sprintf(__('The dbref property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
177
-        }
178
-
179
-        // make sure dbref is safe
180
-        $this->dbref = str_replace('-', '_', sanitize_key($this->dbref));
181
-
182
-        $should_be = 'EE_Messages_Template_Pack_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', $this->dbref)));
183
-
184
-        if ($should_be !== $classname) {
185
-            throw new EE_Error(sprintf(__('The name of the template pack instantiated class is "%s".  It should be "%s".  Make sure that the name of the template pack class matches is prepended with "EE_Messages_Template_Pack_" and appended with a sentence case iteration of the value for your template pack\'s dbref property.', 'event_espresso'), $classname, $should_be));
186
-        }
187
-
188
-        // if _base_path is not set then throw an error because a base path string is needed.
189
-        if (empty($this->_base_path)) {
190
-            throw new EE_Error(sprintf(__('The _base_path property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
191
-        }
192
-
193
-
194
-        // if _base_url is not set then throw an error because a  string is needed for variations.
195
-        if (empty($this->_base_url)) {
196
-            throw new EE_Error(sprintf(__('The _base_url property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
197
-        }
198
-
199
-
200
-        // if $supports is not set then throw an error because that effectively means this template_pack does not have any templates!
201
-        if (empty($this->_supports)) {
202
-            throw new EE_Error(sprintf(__('The supports property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
203
-        }
204
-    }
205
-
206
-
207
-
208
-    /**
209
-     * This method should be used to define the following properties:
210
-     * - label
211
-     * - dbref
212
-     * - description
213
-     * - _base_path
214
-     * - _base_url
215
-     * - supports
216
-     * - variations
217
-     *
218
-     * @since 4.5.0
219
-     * @return void.
220
-     * @abstract
221
-     */
222
-    abstract protected function _set_props();
223
-
224
-
225
-
226
-
227
-    /**
228
-     * Wrapper for get_templates() ( @see get_templates() for documentation)
229
-     *
230
-     * @since 4.5.0
231
-     *
232
-     * @param EE_messenger    $messenger
233
-     * @param EE_message_type $message_type
234
-     *
235
-     * @return array
236
-     */
237
-    public function get_templates(EE_messenger $messenger, EE_message_type $message_type)
238
-    {
239
-        return isset($this->_templates[ $messenger->name ][ $message_type->name ]) ? $this->_templates[ $messenger->name ][ $message_type->name ] : $this->_get_templates($messenger, $message_type);
240
-    }
241
-
242
-
243
-
244
-
245
-    /**
246
-     * This takes the incoming messenger and message type objects, uses them to get the set fields and contexts, then attempts to retrieve the templates matching those for this given template pack.
247
-     *
248
-     * @since 4.5.0
249
-     *
250
-     * @param EE_messenger    $messenger
251
-     * @param EE_message_type $message_type
252
-     *
253
-     * @return array          Returns an multi-level associative array indexed by template context and field in the format:
254
-     *                                array( 'context' => array( 'field' => 'value', 'another-field', 'value' ) );
255
-     */
256
-    protected function _get_templates(EE_messenger $messenger, EE_message_type $message_type)
257
-    {
258
-        $templates = array();
259
-
260
-        /**
261
-         * Retrieving the default pack for later usage of default templates for template packs that
262
-         * are NOT the default pack ( or an extension of the default pack ).
263
-         * We ONLY set this variable to be the default pack IF the loaded class is NOT the default
264
-         * pack.  This prevents recursion in _get_specific_template().  The intention is that for
265
-         * template packs that are NOT default packs, we use the default template pack to provide
266
-         * the final fallback templates if there aren't any defined for the called template pack.
267
-         *
268
-         * @type EE_Messages_Template_Pack_Default | null $default_pack
269
-         */
270
-        $default_pack = ! $this instanceof EE_Messages_Template_Pack_Default ? new EE_Messages_Template_Pack_Default() : null;
271
-
272
-        $fields = $messenger->get_template_fields();
273
-        $contexts = $message_type->get_contexts();
274
-
275
-
276
-        foreach ($contexts as $context => $details) {
277
-            foreach ($fields as $field => $field_details) {
278
-                if (empty($field_details)) {
279
-                    continue;
280
-                }
281
-                /**
282
-                 * is this a field array (linked to a main field)?
283
-                 */
284
-                if ($field == 'extra') {
285
-                    foreach ($field_details as $main_field => $sub_fields) {
286
-                        foreach ($sub_fields as $sub_field => $sub_field_details) {
287
-                            // make sure that the template_field_ref matches what the main template field is for this template group.
288
-                            $template_field_ref = $sub_field == 'main' ? $main_field : $sub_field;
289
-                            $templates[ $context ][ $main_field ][ $sub_field ] = $this->_get_specific_template($default_pack, $messenger, $message_type, $template_field_ref, $context);
290
-                        }
291
-                    }
292
-                } else {
293
-                    $templates[ $context ][ $field ] = $this->_get_specific_template($default_pack, $messenger, $message_type, $field, $context);
294
-                }
295
-            }
296
-        }
297
-
298
-        $templates = apply_filters('FHEE__EE_Template_Pack___get_templates__templates', $templates, $messenger, $message_type, $this);
299
-
300
-        $this->_templates[ $messenger->name ][ $message_type->name ] = $templates;
301
-         return $templates;
302
-    }
303
-
304
-
305
-    /**
306
-     * Utility method for retrieving a specific template matching the given parameters
307
-     *
308
-     * @param null | EE_Messages_Template_Pack_Default $default_pack
309
-     * @param EE_messenger                             $messenger
310
-     * @param EE_message_type                          $message_type
311
-     * @param string                                   $field          The field reference for the specific template being looked up.
312
-     * @param string                                   $context      The context reference for the specific template being looked up
313
-     *
314
-     * @return string          The template contents.
315
-     */
316
-    protected function _get_specific_template($default_pack, EE_messenger $messenger, EE_message_type $message_type, $field, $context)
317
-    {
318
-
319
-        // default templates
320
-        $default_templates = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_templates($messenger, $message_type) : array();
321
-
322
-        // first we allow for the $_base_path to be filtered.  However, we assign this to a new variable so that we have the original base_path as a fallback.
323
-        $filtered_base_path = apply_filters('FHEE__EE_Template_Pack___get_specific_template__filtered_base_path', $this->_base_path, $messenger, $message_type, $field, $context, $this);
324
-
325
-        $master_templates = $message_type->get_master_templates();
326
-        $master_templates_mt = isset($master_templates[ $messenger->name ]) ? $master_templates[ $messenger->name ] : $message_type->name;
327
-        $full_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '_' . $context . '.template.php';
328
-        $fallback_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '.template.php';
329
-        $mt_defined_full_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php';
330
-        $mt_defined_fallback_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php';
331
-        $base_defined_full_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php';
332
-        $base_defined_fallback_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php';
333
-
334
-        /**
335
-         * Template checks are done hierarchically in the following order:
336
-         *
337
-         * - a match for the full messenger name, message type, context and field in the full path for the given template pack.
338
-         * - a match for the full messenger name, message type, field in the full path for the given template pack.
339
-         * - a match for the full messenger name, message type, field, context in the path grabbed for the related message type defined in the _master_templates property for the message type (i.e. all registration message types share the same template as the main registration message type).
340
-         * - match for the full messenger name, message type, field for the related message type defined in the _master templates property for the message type
341
-         * - a match for a default template matching the messenger, name, context, field (as set by the default template packs).
342
-         * - empty string.
343
-         */
344
-
345
-
346
-        if (is_readable($full_path)) {
347
-            $actual_path = $full_path;
348
-        } elseif (is_readable($fallback_path)) {
349
-            $actual_path = $fallback_path;
350
-        } elseif (is_readable($mt_defined_full_path)) {
351
-            $actual_path = $mt_defined_full_path;
352
-        } elseif (is_readable($mt_defined_fallback_path)) {
353
-            $actual_path = $mt_defined_fallback_path;
354
-        } elseif (is_readable($base_defined_full_path)) {
355
-            $actual_path = $base_defined_full_path;
356
-        } elseif (is_readable($base_defined_fallback_path)) {
357
-            $actual_path = $base_defined_fallback_path;
358
-        } else {
359
-            $actual_path = '';
360
-        }
361
-        if (empty($actual_path)) {
362
-            $contents = isset($default_templates[ $context ][ $field ]) ? $default_templates[ $context ][ $field ] : '';
363
-        } else {
364
-            $contents = EEH_Template::display_template($actual_path, array(), true);
365
-        }
366
-
367
-        return apply_filters('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', $contents, $actual_path, $messenger, $message_type, $field, $context, $this);
368
-    }
369
-
370
-
371
-
372
-
373
-
374
-    /**
375
-     * Return filtered _supports property.
376
-     *
377
-     * @since 4.5.0
378
-     *
379
-     * @return array
380
-     */
381
-    public function get_supports()
382
-    {
383
-        $supports = apply_filters('FHEE__' . get_class($this) . '__get_supports', $this->_supports);
384
-        return apply_filters('FHEE__EE_Messages_Template_Pack__get_supports', $supports, $this);
385
-    }
386
-
387
-
388
-
389
-
390
-    /**
391
-     * This simply returns the $_default_variation_labels property value.
392
-     *
393
-     * @since 4.5.0
394
-     *
395
-     * @param string $messenger if the messenger slug is returned then the default label for the specific messenger is retrieved.  If it doesn't exist then the __('Default', 'event_espresso') is returned.  If NO value is provided then whatever is set on the _default_variation_labels property is returned.
396
-     *
397
-     * @return array|string
398
-     */
399
-    public function get_default_variation_labels($messenger = '')
400
-    {
401
-        $label = empty($messenger) ? $this->_default_variation_labels : array();
402
-        $label = empty($label) && ! empty($this->_default_variation_labels[ $messenger ]) ? $this->_default_variation_labels[ $messenger ] : __('Default', 'event_espresso');
403
-
404
-        return apply_filters('FHEE__EE_Messages_Template_Pack__get_default_variation_labels', $label, $this->_default_variation_labels, $messenger);
405
-    }
406
-
407
-
408
-
409
-
410
-
411
-    /**
412
-     * This simply returns the _variations property.
413
-     *
414
-     * @since 4.5.0
415
-     *
416
-     * @param string $messenger if included then css variations matching the messenger are returned.  Otherwise, just the default variation is included.  If both message type AND messenger are empty then all variations are returned.
417
-     * @param string $message_type if included then css variations matching the message_type are returned (must have $messenger set).  Otherwise the array of variations per message type are returned.  If message_type is provided but NOT the messenger, then just all variations for all messengers are returned.
418
-     * @return array
419
-     */
420
-    public function get_variations($messenger = '', $message_type = '')
421
-    {
422
-        $messenger_variations = ! empty($messenger) && isset($this->_variations[ $messenger ]) ? $this->_variations[ $messenger ] : array();
423
-
424
-        // message_type provided? IF so, then we've requested a specific set of variations, so we need to make sure we set it as empty if that's not present.
425
-        $variations = !empty($messenger) && !empty($message_type) && isset($messenger_variations[ $message_type ]) ? $messenger_variations[ $message_type ] : array();
426
-
427
-        // now let's account for the possibility we just want all the variations for a messenger (which is indicated by providing the messenger but not the message type).
428
-        $variations = empty($variations) && !empty($messenger) && empty($message_type) ? $messenger_variations : $variations;
429
-
430
-        // filter per template pack and globally.
431
-        $variations = apply_filters('FHEE__' . get_class($this) . '__get_variations', $variations, $messenger, $message_type);
432
-        $variations = apply_filters('FHEE__EE_Messages_Template_Pack__get_variations', $variations, $messenger, $message_type, $this);
433
-
434
-        // prepend the _default_variation, but ONLY if we're returning the fully validated array.
435
-        if (!empty($messenger) && !empty($message_type) && ! empty($variations)) {
436
-            $variations = array( 'default' => $this->get_default_variation_labels($messenger) ) + $variations;
437
-        }
438
-
439
-        return empty($variations) ? array( 'default' => $this->get_default_variation_labels('dft') ): $variations;
440
-    }
441
-
442
-
443
-
444
-
445
-    /**
446
-     * This is typically called by EE_messenger objects to get the specific css variation defined for the messenger, message_type and type (i.e. inline, wpeditor, preview etc.)
447
-     *
448
-     * @since 4.5.0
449
-     *
450
-     * @param string $messenger messenger slug
451
-     * @param string $message_type message_type slug
452
-     * @param string $type           variation type (i.e. inline, base, wpeditor, preview etc. //this varies per messenger).
453
-     * @param string $variation    this should match one of the defined variations in the _variations property on this class.
454
-     * @param string $file_extension  What type of file the variation file is (defaults to css)
455
-     * @param bool   $url          if true then return the url otherwise path.
456
-     * @param bool   $skip_filters This should not be set directly, its used internally to skip filters when the default template pack is called internally as the fallback.
457
-     *
458
-     * @return string The variation path or url (typically css reference)
459
-     */
460
-    public function get_variation($messenger, $message_type, $type, $variation, $url = true, $file_extension = '.css', $skip_filters = false)
461
-    {
138
+	/**
139
+	 * This is an array of extra css variations for message templates indexed by messenger with the values as an array or message types the variations apply to as the key  and then values are an array with variation slugs as the key and label as the value. Note the default variation is not included in this array.  So the structure is:
140
+	 * array(
141
+	 *  'email' => array(
142
+	 *  )
143
+	 * )
144
+	 *
145
+	 * Keep in mind that this property is used both for indicating valid variations for a given message type and messenger but the variation files themselves are ONLY unique to the messenger.  So if you have a variation for the html messenger referenced by the slug "sunset_red" Then the variation file for the main type will be html_main_sunset_red.css.  All the array in this property allows you to do, is indicate that with certain message types the sunset_red variation is available but for other message types its not.  But you could NOT have a sunset_red variation file for one messenger/message_type and a different one for another messenger/message_type.  If you want different css looks then you can define a different structural layout for the template , messenger, message type combination and in the same sunset_red.css variation file just add css specific to that layout.
146
+	 *
147
+	 * @since 4.5.0
148
+	 *
149
+	 * @var array
150
+	 */
151
+	public $_variations = array();
152
+
153
+
154
+
155
+
156
+	/**
157
+	 * Template pack constructor
158
+	 *
159
+	 * @since 4.5.0
160
+	 */
161
+	public function __construct()
162
+	{
163
+		$this->_set_props();
164
+		// make sure classname is correct
165
+		$classname = get_class($this);
166
+		// make sure required props have been set
167
+
168
+		// if label is empty then throw an error because we should have it defined by now.
169
+		if (! isset($this->label)) {
170
+			throw new EE_Error(sprintf(__('The label property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
171
+		}
172
+
173
+
174
+		// the reference for this template pack
175
+		if (! isset($this->dbref)) {
176
+			throw new EE_Error(sprintf(__('The dbref property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
177
+		}
178
+
179
+		// make sure dbref is safe
180
+		$this->dbref = str_replace('-', '_', sanitize_key($this->dbref));
181
+
182
+		$should_be = 'EE_Messages_Template_Pack_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', $this->dbref)));
183
+
184
+		if ($should_be !== $classname) {
185
+			throw new EE_Error(sprintf(__('The name of the template pack instantiated class is "%s".  It should be "%s".  Make sure that the name of the template pack class matches is prepended with "EE_Messages_Template_Pack_" and appended with a sentence case iteration of the value for your template pack\'s dbref property.', 'event_espresso'), $classname, $should_be));
186
+		}
187
+
188
+		// if _base_path is not set then throw an error because a base path string is needed.
189
+		if (empty($this->_base_path)) {
190
+			throw new EE_Error(sprintf(__('The _base_path property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
191
+		}
192
+
193
+
194
+		// if _base_url is not set then throw an error because a  string is needed for variations.
195
+		if (empty($this->_base_url)) {
196
+			throw new EE_Error(sprintf(__('The _base_url property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
197
+		}
198
+
199
+
200
+		// if $supports is not set then throw an error because that effectively means this template_pack does not have any templates!
201
+		if (empty($this->_supports)) {
202
+			throw new EE_Error(sprintf(__('The supports property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
203
+		}
204
+	}
205
+
206
+
207
+
208
+	/**
209
+	 * This method should be used to define the following properties:
210
+	 * - label
211
+	 * - dbref
212
+	 * - description
213
+	 * - _base_path
214
+	 * - _base_url
215
+	 * - supports
216
+	 * - variations
217
+	 *
218
+	 * @since 4.5.0
219
+	 * @return void.
220
+	 * @abstract
221
+	 */
222
+	abstract protected function _set_props();
223
+
224
+
225
+
226
+
227
+	/**
228
+	 * Wrapper for get_templates() ( @see get_templates() for documentation)
229
+	 *
230
+	 * @since 4.5.0
231
+	 *
232
+	 * @param EE_messenger    $messenger
233
+	 * @param EE_message_type $message_type
234
+	 *
235
+	 * @return array
236
+	 */
237
+	public function get_templates(EE_messenger $messenger, EE_message_type $message_type)
238
+	{
239
+		return isset($this->_templates[ $messenger->name ][ $message_type->name ]) ? $this->_templates[ $messenger->name ][ $message_type->name ] : $this->_get_templates($messenger, $message_type);
240
+	}
241
+
242
+
243
+
244
+
245
+	/**
246
+	 * This takes the incoming messenger and message type objects, uses them to get the set fields and contexts, then attempts to retrieve the templates matching those for this given template pack.
247
+	 *
248
+	 * @since 4.5.0
249
+	 *
250
+	 * @param EE_messenger    $messenger
251
+	 * @param EE_message_type $message_type
252
+	 *
253
+	 * @return array          Returns an multi-level associative array indexed by template context and field in the format:
254
+	 *                                array( 'context' => array( 'field' => 'value', 'another-field', 'value' ) );
255
+	 */
256
+	protected function _get_templates(EE_messenger $messenger, EE_message_type $message_type)
257
+	{
258
+		$templates = array();
259
+
260
+		/**
261
+		 * Retrieving the default pack for later usage of default templates for template packs that
262
+		 * are NOT the default pack ( or an extension of the default pack ).
263
+		 * We ONLY set this variable to be the default pack IF the loaded class is NOT the default
264
+		 * pack.  This prevents recursion in _get_specific_template().  The intention is that for
265
+		 * template packs that are NOT default packs, we use the default template pack to provide
266
+		 * the final fallback templates if there aren't any defined for the called template pack.
267
+		 *
268
+		 * @type EE_Messages_Template_Pack_Default | null $default_pack
269
+		 */
270
+		$default_pack = ! $this instanceof EE_Messages_Template_Pack_Default ? new EE_Messages_Template_Pack_Default() : null;
271
+
272
+		$fields = $messenger->get_template_fields();
273
+		$contexts = $message_type->get_contexts();
274
+
275
+
276
+		foreach ($contexts as $context => $details) {
277
+			foreach ($fields as $field => $field_details) {
278
+				if (empty($field_details)) {
279
+					continue;
280
+				}
281
+				/**
282
+				 * is this a field array (linked to a main field)?
283
+				 */
284
+				if ($field == 'extra') {
285
+					foreach ($field_details as $main_field => $sub_fields) {
286
+						foreach ($sub_fields as $sub_field => $sub_field_details) {
287
+							// make sure that the template_field_ref matches what the main template field is for this template group.
288
+							$template_field_ref = $sub_field == 'main' ? $main_field : $sub_field;
289
+							$templates[ $context ][ $main_field ][ $sub_field ] = $this->_get_specific_template($default_pack, $messenger, $message_type, $template_field_ref, $context);
290
+						}
291
+					}
292
+				} else {
293
+					$templates[ $context ][ $field ] = $this->_get_specific_template($default_pack, $messenger, $message_type, $field, $context);
294
+				}
295
+			}
296
+		}
297
+
298
+		$templates = apply_filters('FHEE__EE_Template_Pack___get_templates__templates', $templates, $messenger, $message_type, $this);
299
+
300
+		$this->_templates[ $messenger->name ][ $message_type->name ] = $templates;
301
+		 return $templates;
302
+	}
303
+
304
+
305
+	/**
306
+	 * Utility method for retrieving a specific template matching the given parameters
307
+	 *
308
+	 * @param null | EE_Messages_Template_Pack_Default $default_pack
309
+	 * @param EE_messenger                             $messenger
310
+	 * @param EE_message_type                          $message_type
311
+	 * @param string                                   $field          The field reference for the specific template being looked up.
312
+	 * @param string                                   $context      The context reference for the specific template being looked up
313
+	 *
314
+	 * @return string          The template contents.
315
+	 */
316
+	protected function _get_specific_template($default_pack, EE_messenger $messenger, EE_message_type $message_type, $field, $context)
317
+	{
318
+
319
+		// default templates
320
+		$default_templates = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_templates($messenger, $message_type) : array();
321
+
322
+		// first we allow for the $_base_path to be filtered.  However, we assign this to a new variable so that we have the original base_path as a fallback.
323
+		$filtered_base_path = apply_filters('FHEE__EE_Template_Pack___get_specific_template__filtered_base_path', $this->_base_path, $messenger, $message_type, $field, $context, $this);
324
+
325
+		$master_templates = $message_type->get_master_templates();
326
+		$master_templates_mt = isset($master_templates[ $messenger->name ]) ? $master_templates[ $messenger->name ] : $message_type->name;
327
+		$full_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '_' . $context . '.template.php';
328
+		$fallback_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '.template.php';
329
+		$mt_defined_full_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php';
330
+		$mt_defined_fallback_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php';
331
+		$base_defined_full_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php';
332
+		$base_defined_fallback_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php';
333
+
334
+		/**
335
+		 * Template checks are done hierarchically in the following order:
336
+		 *
337
+		 * - a match for the full messenger name, message type, context and field in the full path for the given template pack.
338
+		 * - a match for the full messenger name, message type, field in the full path for the given template pack.
339
+		 * - a match for the full messenger name, message type, field, context in the path grabbed for the related message type defined in the _master_templates property for the message type (i.e. all registration message types share the same template as the main registration message type).
340
+		 * - match for the full messenger name, message type, field for the related message type defined in the _master templates property for the message type
341
+		 * - a match for a default template matching the messenger, name, context, field (as set by the default template packs).
342
+		 * - empty string.
343
+		 */
344
+
345
+
346
+		if (is_readable($full_path)) {
347
+			$actual_path = $full_path;
348
+		} elseif (is_readable($fallback_path)) {
349
+			$actual_path = $fallback_path;
350
+		} elseif (is_readable($mt_defined_full_path)) {
351
+			$actual_path = $mt_defined_full_path;
352
+		} elseif (is_readable($mt_defined_fallback_path)) {
353
+			$actual_path = $mt_defined_fallback_path;
354
+		} elseif (is_readable($base_defined_full_path)) {
355
+			$actual_path = $base_defined_full_path;
356
+		} elseif (is_readable($base_defined_fallback_path)) {
357
+			$actual_path = $base_defined_fallback_path;
358
+		} else {
359
+			$actual_path = '';
360
+		}
361
+		if (empty($actual_path)) {
362
+			$contents = isset($default_templates[ $context ][ $field ]) ? $default_templates[ $context ][ $field ] : '';
363
+		} else {
364
+			$contents = EEH_Template::display_template($actual_path, array(), true);
365
+		}
366
+
367
+		return apply_filters('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', $contents, $actual_path, $messenger, $message_type, $field, $context, $this);
368
+	}
369
+
370
+
371
+
372
+
373
+
374
+	/**
375
+	 * Return filtered _supports property.
376
+	 *
377
+	 * @since 4.5.0
378
+	 *
379
+	 * @return array
380
+	 */
381
+	public function get_supports()
382
+	{
383
+		$supports = apply_filters('FHEE__' . get_class($this) . '__get_supports', $this->_supports);
384
+		return apply_filters('FHEE__EE_Messages_Template_Pack__get_supports', $supports, $this);
385
+	}
386
+
387
+
388
+
389
+
390
+	/**
391
+	 * This simply returns the $_default_variation_labels property value.
392
+	 *
393
+	 * @since 4.5.0
394
+	 *
395
+	 * @param string $messenger if the messenger slug is returned then the default label for the specific messenger is retrieved.  If it doesn't exist then the __('Default', 'event_espresso') is returned.  If NO value is provided then whatever is set on the _default_variation_labels property is returned.
396
+	 *
397
+	 * @return array|string
398
+	 */
399
+	public function get_default_variation_labels($messenger = '')
400
+	{
401
+		$label = empty($messenger) ? $this->_default_variation_labels : array();
402
+		$label = empty($label) && ! empty($this->_default_variation_labels[ $messenger ]) ? $this->_default_variation_labels[ $messenger ] : __('Default', 'event_espresso');
403
+
404
+		return apply_filters('FHEE__EE_Messages_Template_Pack__get_default_variation_labels', $label, $this->_default_variation_labels, $messenger);
405
+	}
406
+
407
+
408
+
409
+
410
+
411
+	/**
412
+	 * This simply returns the _variations property.
413
+	 *
414
+	 * @since 4.5.0
415
+	 *
416
+	 * @param string $messenger if included then css variations matching the messenger are returned.  Otherwise, just the default variation is included.  If both message type AND messenger are empty then all variations are returned.
417
+	 * @param string $message_type if included then css variations matching the message_type are returned (must have $messenger set).  Otherwise the array of variations per message type are returned.  If message_type is provided but NOT the messenger, then just all variations for all messengers are returned.
418
+	 * @return array
419
+	 */
420
+	public function get_variations($messenger = '', $message_type = '')
421
+	{
422
+		$messenger_variations = ! empty($messenger) && isset($this->_variations[ $messenger ]) ? $this->_variations[ $messenger ] : array();
423
+
424
+		// message_type provided? IF so, then we've requested a specific set of variations, so we need to make sure we set it as empty if that's not present.
425
+		$variations = !empty($messenger) && !empty($message_type) && isset($messenger_variations[ $message_type ]) ? $messenger_variations[ $message_type ] : array();
426
+
427
+		// now let's account for the possibility we just want all the variations for a messenger (which is indicated by providing the messenger but not the message type).
428
+		$variations = empty($variations) && !empty($messenger) && empty($message_type) ? $messenger_variations : $variations;
429
+
430
+		// filter per template pack and globally.
431
+		$variations = apply_filters('FHEE__' . get_class($this) . '__get_variations', $variations, $messenger, $message_type);
432
+		$variations = apply_filters('FHEE__EE_Messages_Template_Pack__get_variations', $variations, $messenger, $message_type, $this);
433
+
434
+		// prepend the _default_variation, but ONLY if we're returning the fully validated array.
435
+		if (!empty($messenger) && !empty($message_type) && ! empty($variations)) {
436
+			$variations = array( 'default' => $this->get_default_variation_labels($messenger) ) + $variations;
437
+		}
438
+
439
+		return empty($variations) ? array( 'default' => $this->get_default_variation_labels('dft') ): $variations;
440
+	}
441
+
442
+
443
+
444
+
445
+	/**
446
+	 * This is typically called by EE_messenger objects to get the specific css variation defined for the messenger, message_type and type (i.e. inline, wpeditor, preview etc.)
447
+	 *
448
+	 * @since 4.5.0
449
+	 *
450
+	 * @param string $messenger messenger slug
451
+	 * @param string $message_type message_type slug
452
+	 * @param string $type           variation type (i.e. inline, base, wpeditor, preview etc. //this varies per messenger).
453
+	 * @param string $variation    this should match one of the defined variations in the _variations property on this class.
454
+	 * @param string $file_extension  What type of file the variation file is (defaults to css)
455
+	 * @param bool   $url          if true then return the url otherwise path.
456
+	 * @param bool   $skip_filters This should not be set directly, its used internally to skip filters when the default template pack is called internally as the fallback.
457
+	 *
458
+	 * @return string The variation path or url (typically css reference)
459
+	 */
460
+	public function get_variation($messenger, $message_type, $type, $variation, $url = true, $file_extension = '.css', $skip_filters = false)
461
+	{
462 462
 
463
-        $base = $url ? $this->_base_url : $this->_base_path;
464
-        $base_path = $this->_base_path;
463
+		$base = $url ? $this->_base_url : $this->_base_path;
464
+		$base_path = $this->_base_path;
465 465
 
466
-        if (! $skip_filters) {
467
-            $base =  apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url', $base, $messenger, $message_type, $type, $variation, $url, $file_extension, $this);
468
-            $base_path = apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path', $base_path, $messenger, $message_type, $type, $variation, false, $file_extension, $this);
469
-        }
466
+		if (! $skip_filters) {
467
+			$base =  apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url', $base, $messenger, $message_type, $type, $variation, $url, $file_extension, $this);
468
+			$base_path = apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path', $base_path, $messenger, $message_type, $type, $variation, false, $file_extension, $this);
469
+		}
470 470
 
471
-        $default_pack = get_class($this) != 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : $this;
472
-
473
-        // possible variation paths considering whether message type is present or not in the file name.
474
-        $path_string = 'variations/' . $messenger . '_' . $message_type . '_'  . $type . '_' . $variation . $file_extension;
475
-        $default_path_string = 'variations/' . $messenger . '_' . $type . '_' . $variation . $file_extension;
476
-
477
-        // first see if fully validated file exists.
478
-        if (is_readable($base_path . $path_string)) {
479
-            $variation_path = $base . $path_string;
480
-        // otherwise see if default exists.
481
-        } elseif (is_readable($base_path . $default_path_string)) {
482
-            $variation_path = $base . $default_path_string;
483
-        } else {
484
-            $variation_path = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_default_variation($messenger, $message_type, $type, $url, $file_extension) : '';
485
-        }
471
+		$default_pack = get_class($this) != 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : $this;
472
+
473
+		// possible variation paths considering whether message type is present or not in the file name.
474
+		$path_string = 'variations/' . $messenger . '_' . $message_type . '_'  . $type . '_' . $variation . $file_extension;
475
+		$default_path_string = 'variations/' . $messenger . '_' . $type . '_' . $variation . $file_extension;
476
+
477
+		// first see if fully validated file exists.
478
+		if (is_readable($base_path . $path_string)) {
479
+			$variation_path = $base . $path_string;
480
+		// otherwise see if default exists.
481
+		} elseif (is_readable($base_path . $default_path_string)) {
482
+			$variation_path = $base . $default_path_string;
483
+		} else {
484
+			$variation_path = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_default_variation($messenger, $message_type, $type, $url, $file_extension) : '';
485
+		}
486 486
 
487
-        if ($skip_filters) {
488
-            return $variation_path;
489
-        }
490
-
491
-        // filter result
492
-        $variation_path = apply_filters('FHEE__' . get_class($this) . '__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url);
493
-        return apply_filters('FHEE__EE_Messages_Template_Pack__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, $this);
494
-    }
495
-
496
-
497
-
498
-
499
-
500
-    /**
501
-     * This method is used to return the wrapper template for the given template pack.  If the given template pack does not include any wrapper templates then the default is used.
502
-     *
503
-     * @param string $messenger What messenger the wrapper is for.
504
-     * @param string $type           What type of wrapper is being returned ( for messengers that may have more than one wrapper )
505
-     *
506
-     * @return string returns the path for the requested wrapper template.
507
-     */
508
-    public function get_wrapper($messenger, $type = 'main')
509
-    {
510
-        $default_pack = get_class($this) !== 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : null;
511
-
512
-        $path_string = $this->_base_path . $messenger . '_' . $type . '_wrapper.template.php';
513
-
514
-        if (is_readable($path_string)) {
515
-            $template = $path_string;
516
-        } else {
517
-            $template = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_wrapper($messenger, $type) : '';
518
-        }
519
-
520
-        // filter
521
-        $template = apply_filters('FHEE__' . get_class($this) . '__get_wrapper', $template, $messenger, $type);
522
-        return apply_filters('FHEE__EE_Messages_Template_Pack__get_wrapper', $template, $messenger, $type, $this);
523
-    }
487
+		if ($skip_filters) {
488
+			return $variation_path;
489
+		}
490
+
491
+		// filter result
492
+		$variation_path = apply_filters('FHEE__' . get_class($this) . '__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url);
493
+		return apply_filters('FHEE__EE_Messages_Template_Pack__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, $this);
494
+	}
495
+
496
+
497
+
498
+
499
+
500
+	/**
501
+	 * This method is used to return the wrapper template for the given template pack.  If the given template pack does not include any wrapper templates then the default is used.
502
+	 *
503
+	 * @param string $messenger What messenger the wrapper is for.
504
+	 * @param string $type           What type of wrapper is being returned ( for messengers that may have more than one wrapper )
505
+	 *
506
+	 * @return string returns the path for the requested wrapper template.
507
+	 */
508
+	public function get_wrapper($messenger, $type = 'main')
509
+	{
510
+		$default_pack = get_class($this) !== 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : null;
511
+
512
+		$path_string = $this->_base_path . $messenger . '_' . $type . '_wrapper.template.php';
513
+
514
+		if (is_readable($path_string)) {
515
+			$template = $path_string;
516
+		} else {
517
+			$template = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_wrapper($messenger, $type) : '';
518
+		}
519
+
520
+		// filter
521
+		$template = apply_filters('FHEE__' . get_class($this) . '__get_wrapper', $template, $messenger, $type);
522
+		return apply_filters('FHEE__EE_Messages_Template_Pack__get_wrapper', $template, $messenger, $type, $this);
523
+	}
524 524
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
         // make sure required props have been set
167 167
 
168 168
         // if label is empty then throw an error because we should have it defined by now.
169
-        if (! isset($this->label)) {
169
+        if ( ! isset($this->label)) {
170 170
             throw new EE_Error(sprintf(__('The label property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
171 171
         }
172 172
 
173 173
 
174 174
         // the reference for this template pack
175
-        if (! isset($this->dbref)) {
175
+        if ( ! isset($this->dbref)) {
176 176
             throw new EE_Error(sprintf(__('The dbref property is not set for %s.  Please ensure that is set for the class.', 'event_espresso'), $classname));
177 177
         }
178 178
 
179 179
         // make sure dbref is safe
180 180
         $this->dbref = str_replace('-', '_', sanitize_key($this->dbref));
181 181
 
182
-        $should_be = 'EE_Messages_Template_Pack_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', $this->dbref)));
182
+        $should_be = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $this->dbref)));
183 183
 
184 184
         if ($should_be !== $classname) {
185 185
             throw new EE_Error(sprintf(__('The name of the template pack instantiated class is "%s".  It should be "%s".  Make sure that the name of the template pack class matches is prepended with "EE_Messages_Template_Pack_" and appended with a sentence case iteration of the value for your template pack\'s dbref property.', 'event_espresso'), $classname, $should_be));
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function get_templates(EE_messenger $messenger, EE_message_type $message_type)
238 238
     {
239
-        return isset($this->_templates[ $messenger->name ][ $message_type->name ]) ? $this->_templates[ $messenger->name ][ $message_type->name ] : $this->_get_templates($messenger, $message_type);
239
+        return isset($this->_templates[$messenger->name][$message_type->name]) ? $this->_templates[$messenger->name][$message_type->name] : $this->_get_templates($messenger, $message_type);
240 240
     }
241 241
 
242 242
 
@@ -286,18 +286,18 @@  discard block
 block discarded – undo
286 286
                         foreach ($sub_fields as $sub_field => $sub_field_details) {
287 287
                             // make sure that the template_field_ref matches what the main template field is for this template group.
288 288
                             $template_field_ref = $sub_field == 'main' ? $main_field : $sub_field;
289
-                            $templates[ $context ][ $main_field ][ $sub_field ] = $this->_get_specific_template($default_pack, $messenger, $message_type, $template_field_ref, $context);
289
+                            $templates[$context][$main_field][$sub_field] = $this->_get_specific_template($default_pack, $messenger, $message_type, $template_field_ref, $context);
290 290
                         }
291 291
                     }
292 292
                 } else {
293
-                    $templates[ $context ][ $field ] = $this->_get_specific_template($default_pack, $messenger, $message_type, $field, $context);
293
+                    $templates[$context][$field] = $this->_get_specific_template($default_pack, $messenger, $message_type, $field, $context);
294 294
                 }
295 295
             }
296 296
         }
297 297
 
298 298
         $templates = apply_filters('FHEE__EE_Template_Pack___get_templates__templates', $templates, $messenger, $message_type, $this);
299 299
 
300
-        $this->_templates[ $messenger->name ][ $message_type->name ] = $templates;
300
+        $this->_templates[$messenger->name][$message_type->name] = $templates;
301 301
          return $templates;
302 302
     }
303 303
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
         $filtered_base_path = apply_filters('FHEE__EE_Template_Pack___get_specific_template__filtered_base_path', $this->_base_path, $messenger, $message_type, $field, $context, $this);
324 324
 
325 325
         $master_templates = $message_type->get_master_templates();
326
-        $master_templates_mt = isset($master_templates[ $messenger->name ]) ? $master_templates[ $messenger->name ] : $message_type->name;
327
-        $full_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '_' . $context . '.template.php';
328
-        $fallback_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '.template.php';
329
-        $mt_defined_full_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php';
330
-        $mt_defined_fallback_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php';
331
-        $base_defined_full_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php';
332
-        $base_defined_fallback_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php';
326
+        $master_templates_mt = isset($master_templates[$messenger->name]) ? $master_templates[$messenger->name] : $message_type->name;
327
+        $full_path = $filtered_base_path.$messenger->name.'_'.$message_type->name.'_'.$field.'_'.$context.'.template.php';
328
+        $fallback_path = $filtered_base_path.$messenger->name.'_'.$message_type->name.'_'.$field.'.template.php';
329
+        $mt_defined_full_path = $filtered_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'_'.$context.'.template.php';
330
+        $mt_defined_fallback_path = $filtered_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'.template.php';
331
+        $base_defined_full_path = $this->_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'_'.$context.'.template.php';
332
+        $base_defined_fallback_path = $this->_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'.template.php';
333 333
 
334 334
         /**
335 335
          * Template checks are done hierarchically in the following order:
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             $actual_path = '';
360 360
         }
361 361
         if (empty($actual_path)) {
362
-            $contents = isset($default_templates[ $context ][ $field ]) ? $default_templates[ $context ][ $field ] : '';
362
+            $contents = isset($default_templates[$context][$field]) ? $default_templates[$context][$field] : '';
363 363
         } else {
364 364
             $contents = EEH_Template::display_template($actual_path, array(), true);
365 365
         }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
      */
381 381
     public function get_supports()
382 382
     {
383
-        $supports = apply_filters('FHEE__' . get_class($this) . '__get_supports', $this->_supports);
383
+        $supports = apply_filters('FHEE__'.get_class($this).'__get_supports', $this->_supports);
384 384
         return apply_filters('FHEE__EE_Messages_Template_Pack__get_supports', $supports, $this);
385 385
     }
386 386
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     public function get_default_variation_labels($messenger = '')
400 400
     {
401 401
         $label = empty($messenger) ? $this->_default_variation_labels : array();
402
-        $label = empty($label) && ! empty($this->_default_variation_labels[ $messenger ]) ? $this->_default_variation_labels[ $messenger ] : __('Default', 'event_espresso');
402
+        $label = empty($label) && ! empty($this->_default_variation_labels[$messenger]) ? $this->_default_variation_labels[$messenger] : __('Default', 'event_espresso');
403 403
 
404 404
         return apply_filters('FHEE__EE_Messages_Template_Pack__get_default_variation_labels', $label, $this->_default_variation_labels, $messenger);
405 405
     }
@@ -419,24 +419,24 @@  discard block
 block discarded – undo
419 419
      */
420 420
     public function get_variations($messenger = '', $message_type = '')
421 421
     {
422
-        $messenger_variations = ! empty($messenger) && isset($this->_variations[ $messenger ]) ? $this->_variations[ $messenger ] : array();
422
+        $messenger_variations = ! empty($messenger) && isset($this->_variations[$messenger]) ? $this->_variations[$messenger] : array();
423 423
 
424 424
         // message_type provided? IF so, then we've requested a specific set of variations, so we need to make sure we set it as empty if that's not present.
425
-        $variations = !empty($messenger) && !empty($message_type) && isset($messenger_variations[ $message_type ]) ? $messenger_variations[ $message_type ] : array();
425
+        $variations = ! empty($messenger) && ! empty($message_type) && isset($messenger_variations[$message_type]) ? $messenger_variations[$message_type] : array();
426 426
 
427 427
         // now let's account for the possibility we just want all the variations for a messenger (which is indicated by providing the messenger but not the message type).
428
-        $variations = empty($variations) && !empty($messenger) && empty($message_type) ? $messenger_variations : $variations;
428
+        $variations = empty($variations) && ! empty($messenger) && empty($message_type) ? $messenger_variations : $variations;
429 429
 
430 430
         // filter per template pack and globally.
431
-        $variations = apply_filters('FHEE__' . get_class($this) . '__get_variations', $variations, $messenger, $message_type);
431
+        $variations = apply_filters('FHEE__'.get_class($this).'__get_variations', $variations, $messenger, $message_type);
432 432
         $variations = apply_filters('FHEE__EE_Messages_Template_Pack__get_variations', $variations, $messenger, $message_type, $this);
433 433
 
434 434
         // prepend the _default_variation, but ONLY if we're returning the fully validated array.
435
-        if (!empty($messenger) && !empty($message_type) && ! empty($variations)) {
436
-            $variations = array( 'default' => $this->get_default_variation_labels($messenger) ) + $variations;
435
+        if ( ! empty($messenger) && ! empty($message_type) && ! empty($variations)) {
436
+            $variations = array('default' => $this->get_default_variation_labels($messenger)) + $variations;
437 437
         }
438 438
 
439
-        return empty($variations) ? array( 'default' => $this->get_default_variation_labels('dft') ): $variations;
439
+        return empty($variations) ? array('default' => $this->get_default_variation_labels('dft')) : $variations;
440 440
     }
441 441
 
442 442
 
@@ -463,23 +463,23 @@  discard block
 block discarded – undo
463 463
         $base = $url ? $this->_base_url : $this->_base_path;
464 464
         $base_path = $this->_base_path;
465 465
 
466
-        if (! $skip_filters) {
467
-            $base =  apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url', $base, $messenger, $message_type, $type, $variation, $url, $file_extension, $this);
466
+        if ( ! $skip_filters) {
467
+            $base = apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url', $base, $messenger, $message_type, $type, $variation, $url, $file_extension, $this);
468 468
             $base_path = apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path', $base_path, $messenger, $message_type, $type, $variation, false, $file_extension, $this);
469 469
         }
470 470
 
471 471
         $default_pack = get_class($this) != 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : $this;
472 472
 
473 473
         // possible variation paths considering whether message type is present or not in the file name.
474
-        $path_string = 'variations/' . $messenger . '_' . $message_type . '_'  . $type . '_' . $variation . $file_extension;
475
-        $default_path_string = 'variations/' . $messenger . '_' . $type . '_' . $variation . $file_extension;
474
+        $path_string = 'variations/'.$messenger.'_'.$message_type.'_'.$type.'_'.$variation.$file_extension;
475
+        $default_path_string = 'variations/'.$messenger.'_'.$type.'_'.$variation.$file_extension;
476 476
 
477 477
         // first see if fully validated file exists.
478
-        if (is_readable($base_path . $path_string)) {
479
-            $variation_path = $base . $path_string;
478
+        if (is_readable($base_path.$path_string)) {
479
+            $variation_path = $base.$path_string;
480 480
         // otherwise see if default exists.
481
-        } elseif (is_readable($base_path . $default_path_string)) {
482
-            $variation_path = $base . $default_path_string;
481
+        } elseif (is_readable($base_path.$default_path_string)) {
482
+            $variation_path = $base.$default_path_string;
483 483
         } else {
484 484
             $variation_path = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_default_variation($messenger, $message_type, $type, $url, $file_extension) : '';
485 485
         }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         }
490 490
 
491 491
         // filter result
492
-        $variation_path = apply_filters('FHEE__' . get_class($this) . '__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url);
492
+        $variation_path = apply_filters('FHEE__'.get_class($this).'__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url);
493 493
         return apply_filters('FHEE__EE_Messages_Template_Pack__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, $this);
494 494
     }
495 495
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     {
510 510
         $default_pack = get_class($this) !== 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : null;
511 511
 
512
-        $path_string = $this->_base_path . $messenger . '_' . $type . '_wrapper.template.php';
512
+        $path_string = $this->_base_path.$messenger.'_'.$type.'_wrapper.template.php';
513 513
 
514 514
         if (is_readable($path_string)) {
515 515
             $template = $path_string;
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
         }
519 519
 
520 520
         // filter
521
-        $template = apply_filters('FHEE__' . get_class($this) . '__get_wrapper', $template, $messenger, $type);
521
+        $template = apply_filters('FHEE__'.get_class($this).'__get_wrapper', $template, $messenger, $type);
522 522
         return apply_filters('FHEE__EE_Messages_Template_Pack__get_wrapper', $template, $messenger, $type, $this);
523 523
     }
524 524
 }
Please login to merge, or discard this patch.
libraries/messages/defaults/EE_Messages_Template_Pack_Default.class.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -11,71 +11,71 @@
 block discarded – undo
11 11
 class EE_Messages_Template_Pack_Default extends EE_Messages_Template_Pack
12 12
 {
13 13
 
14
-    public function _set_props()
15
-    {
16
-        $this->label = __('Default', 'event_espresso');
17
-        $this->dbref = 'default';
18
-        $this->description = __('This is the default template pack included with Event Espresso core messages system.', 'event_espresso');
19
-        $this->_base_url = EE_PLUGIN_DIR_URL . 'core/libraries/messages/defaults/default/';
20
-        $this->_base_path = EE_LIBRARIES . 'messages/defaults/default/';
21
-        $this->_supports = array(
22
-            'email' => array(
23
-                'cancelled_registration', 'declined_registration', 'not_approved_registration', 'pending_approval', 'registration',
24
-                    'registration_summary',
25
-                'payment_declined', 'payment', 'payment_refund', 'payment_reminder'
26
-                ),
27
-            'html' => array(
28
-                'receipt', 'invoice'
29
-                )
30
-            );
31
-        $this->_default_variation_labels= array(
32
-            'email' => __('Default', 'event_espresso'),
33
-            'html' =>  __('Simple', 'event_espresso')
34
-             );
35
-        $this->_variations = array(
36
-            'html' => array(
37
-                'receipt' =>
38
-                    array(
39
-                    'bauhaus' => __('Bauhaus', 'event_espresso'),
40
-                    'ejs' => __('Elliot Jay Stocks', 'event_espresso'),
41
-                    'horizon' => __('Horizon', 'event_espresso'),
42
-                    'lola' => __('Lola', 'event_espresso'),
43
-                    'tranquility' => __('Tranquility', 'event_espresso'),
44
-                    'union' => __('Union', 'event_espresso'),
45
-                    ),
46
-                'invoice' =>
47
-                    array(
48
-                    'bauhaus' => __('Bauhaus', 'event_espresso'),
49
-                    'ejs' => __('Elliot Jay Stocks', 'event_espresso'),
50
-                    'horizon' => __('Horizon', 'event_espresso'),
51
-                    'lola' => __('Lola', 'event_espresso'),
52
-                    'tranquility' => __('Tranquility', 'event_espresso'),
53
-                    'union' => __('Union', 'event_espresso'),
54
-                    )
55
-                )
56
-            );
57
-    }
14
+	public function _set_props()
15
+	{
16
+		$this->label = __('Default', 'event_espresso');
17
+		$this->dbref = 'default';
18
+		$this->description = __('This is the default template pack included with Event Espresso core messages system.', 'event_espresso');
19
+		$this->_base_url = EE_PLUGIN_DIR_URL . 'core/libraries/messages/defaults/default/';
20
+		$this->_base_path = EE_LIBRARIES . 'messages/defaults/default/';
21
+		$this->_supports = array(
22
+			'email' => array(
23
+				'cancelled_registration', 'declined_registration', 'not_approved_registration', 'pending_approval', 'registration',
24
+					'registration_summary',
25
+				'payment_declined', 'payment', 'payment_refund', 'payment_reminder'
26
+				),
27
+			'html' => array(
28
+				'receipt', 'invoice'
29
+				)
30
+			);
31
+		$this->_default_variation_labels= array(
32
+			'email' => __('Default', 'event_espresso'),
33
+			'html' =>  __('Simple', 'event_espresso')
34
+			 );
35
+		$this->_variations = array(
36
+			'html' => array(
37
+				'receipt' =>
38
+					array(
39
+					'bauhaus' => __('Bauhaus', 'event_espresso'),
40
+					'ejs' => __('Elliot Jay Stocks', 'event_espresso'),
41
+					'horizon' => __('Horizon', 'event_espresso'),
42
+					'lola' => __('Lola', 'event_espresso'),
43
+					'tranquility' => __('Tranquility', 'event_espresso'),
44
+					'union' => __('Union', 'event_espresso'),
45
+					),
46
+				'invoice' =>
47
+					array(
48
+					'bauhaus' => __('Bauhaus', 'event_espresso'),
49
+					'ejs' => __('Elliot Jay Stocks', 'event_espresso'),
50
+					'horizon' => __('Horizon', 'event_espresso'),
51
+					'lola' => __('Lola', 'event_espresso'),
52
+					'tranquility' => __('Tranquility', 'event_espresso'),
53
+					'union' => __('Union', 'event_espresso'),
54
+					)
55
+				)
56
+			);
57
+	}
58 58
 
59 59
 
60 60
 
61
-    public function get_default_variation($messenger, $message_type, $type, $url, $file_extension)
62
-    {
63
-        $base = $url ? $this->_base_url : $this->_base_path;
64
-        $base_path = $this->_base_path;
65
-        // possible variation paths considering whether message type is present or not in the file name.
66
-        $path_string = 'variations/' . $messenger . '_' . $message_type . '_'  . $type . '_default' . $file_extension;
67
-        $default_path_string = 'variations/' . $messenger . '_' . $type . '_default' . $file_extension;
68
-        // first see if fully validated file exists.
69
-        if (is_readable($base_path . $path_string)) {
70
-            $variation_path = $base . $path_string;
71
-        // otherwise see if default exists.
72
-        } elseif (is_readable($base_path . $default_path_string)) {
73
-            $variation_path = $base . $default_path_string;
74
-        } else {
75
-            // no matches found so nothing is present.
76
-            $variation_path = '';
77
-        }
61
+	public function get_default_variation($messenger, $message_type, $type, $url, $file_extension)
62
+	{
63
+		$base = $url ? $this->_base_url : $this->_base_path;
64
+		$base_path = $this->_base_path;
65
+		// possible variation paths considering whether message type is present or not in the file name.
66
+		$path_string = 'variations/' . $messenger . '_' . $message_type . '_'  . $type . '_default' . $file_extension;
67
+		$default_path_string = 'variations/' . $messenger . '_' . $type . '_default' . $file_extension;
68
+		// first see if fully validated file exists.
69
+		if (is_readable($base_path . $path_string)) {
70
+			$variation_path = $base . $path_string;
71
+		// otherwise see if default exists.
72
+		} elseif (is_readable($base_path . $default_path_string)) {
73
+			$variation_path = $base . $default_path_string;
74
+		} else {
75
+			// no matches found so nothing is present.
76
+			$variation_path = '';
77
+		}
78 78
 
79
-        return $variation_path;
80
-    }
79
+		return $variation_path;
80
+	}
81 81
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
         $this->label = __('Default', 'event_espresso');
17 17
         $this->dbref = 'default';
18 18
         $this->description = __('This is the default template pack included with Event Espresso core messages system.', 'event_espresso');
19
-        $this->_base_url = EE_PLUGIN_DIR_URL . 'core/libraries/messages/defaults/default/';
20
-        $this->_base_path = EE_LIBRARIES . 'messages/defaults/default/';
19
+        $this->_base_url = EE_PLUGIN_DIR_URL.'core/libraries/messages/defaults/default/';
20
+        $this->_base_path = EE_LIBRARIES.'messages/defaults/default/';
21 21
         $this->_supports = array(
22 22
             'email' => array(
23 23
                 'cancelled_registration', 'declined_registration', 'not_approved_registration', 'pending_approval', 'registration',
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
                 'receipt', 'invoice'
29 29
                 )
30 30
             );
31
-        $this->_default_variation_labels= array(
31
+        $this->_default_variation_labels = array(
32 32
             'email' => __('Default', 'event_espresso'),
33 33
             'html' =>  __('Simple', 'event_espresso')
34 34
              );
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
         $base = $url ? $this->_base_url : $this->_base_path;
64 64
         $base_path = $this->_base_path;
65 65
         // possible variation paths considering whether message type is present or not in the file name.
66
-        $path_string = 'variations/' . $messenger . '_' . $message_type . '_'  . $type . '_default' . $file_extension;
67
-        $default_path_string = 'variations/' . $messenger . '_' . $type . '_default' . $file_extension;
66
+        $path_string = 'variations/'.$messenger.'_'.$message_type.'_'.$type.'_default'.$file_extension;
67
+        $default_path_string = 'variations/'.$messenger.'_'.$type.'_default'.$file_extension;
68 68
         // first see if fully validated file exists.
69
-        if (is_readable($base_path . $path_string)) {
70
-            $variation_path = $base . $path_string;
69
+        if (is_readable($base_path.$path_string)) {
70
+            $variation_path = $base.$path_string;
71 71
         // otherwise see if default exists.
72
-        } elseif (is_readable($base_path . $default_path_string)) {
73
-            $variation_path = $base . $default_path_string;
72
+        } elseif (is_readable($base_path.$default_path_string)) {
73
+            $variation_path = $base.$default_path_string;
74 74
         } else {
75 75
             // no matches found so nothing is present.
76 76
             $variation_path = '';
Please login to merge, or discard this patch.
messages/defaults/default/html_receipt_ticket_line_item_no_pms.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 <tr class="item">
7 7
     <td>[LINE_ITEM_NAME][LINE_ITEM_TAXABLE_*]</td>
8 8
     <td colspan="2">[LINE_ITEM_DESCRIPTION]
9
-        <p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), '[TKT_USES_* schema=' . __('any', 'event_espresso') . ']'); ?></p>
9
+        <p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), '[TKT_USES_* schema='.__('any', 'event_espresso').']'); ?></p>
10 10
     </td>
11 11
     <td class="item_c">[LINE_ITEM_QUANTITY]</td>
12 12
     <td class="item_c">[LINE_ITEM_AMOUNT]</td>
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_event_list.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
  */
5 5
 ?>
6 6
 <h3 class="section-title event-name">
7
-    <img class="icon" src="<?php echo EE_IMAGES_URL . 'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso") ?>
7
+    <img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso") ?>
8 8
     <span class="plain-text">[EVENT_NAME]</span>
9 9
     <span class="small-text link">( <a href="[EVENT_URL]"><?php _e('view', 'event_espresso'); ?></a> )</span>
10 10
 </h3>
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_ticket_list.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
         <div class="ticket-time-and-place-details">
23 23
             <div class="ticket-time-details">
24 24
                 <h4 class="sub-section-title no-bottom-margin">
25
-                    <img class="icon" src="<?php echo EE_IMAGES_URL . 'clock-16x16.png'; ?>"><?php _e('Date/Time:', 'event_espresso'); ?>
25
+                    <img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php _e('Date/Time:', 'event_espresso'); ?>
26 26
                 </h4>
27 27
                 <ul class="event-dates">[DATETIME_LIST]</ul>
28 28
             </div>
29 29
             <div class="ticket-place-details">
30 30
                 <h4 class="sub-section-title no-bottom-margin">
31
-                    <img class="icon" src="<?php echo EE_IMAGES_URL . 'location-pin-16x16.png'; ?>"><?php _e('Venue', 'event_espresso'); ?>
31
+                    <img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php _e('Venue', 'event_espresso'); ?>
32 32
                 </h4>
33 33
                 <ul class="event-venues">
34 34
                     <li>[VENUE_TITLE]
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         </div>
40 40
         <div class="ticket-registrations-area">
41 41
             <h4 class="sub-section-title">
42
-                <img class="icon" src="<?php echo EE_IMAGES_URL . 'users-16x16.png'; ?>"><?php _e("Registration Details", "event_espresso"); ?>
42
+                <img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php _e("Registration Details", "event_espresso"); ?>
43 43
                 <span class="small-text link">( <a class="print_button noPrint" href="[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]"><?php _e('edit', 'event_espresso'); ?></a> )</span>
44 44
             </h4>
45 45
             <ul class="ticket-registrations-list">[ATTENDEE_LIST]</ul>
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_attendee_list.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
 <li class="ticket-registration">
7 7
     <table class="registration-details">
8 8
         <tr class="odd">
9
-            <th><?php	_e('Attendee', 'event_espresso');?></th>
9
+            <th><?php	_e('Attendee', 'event_espresso'); ?></th>
10 10
             <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td>
11 11
         </tr>
12 12
         <tr>
13
-            <th><?php _e("Registration Code:", "event_espresso");?></th>
13
+            <th><?php _e("Registration Code:", "event_espresso"); ?></th>
14 14
             <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td>
15 15
         </tr>
16 16
     </table>
Please login to merge, or discard this patch.