Completed
Branch Gutenberg/test-block (c5ef4c)
by
unknown
74:37 queued 59:44
created
core/db_models/EEM_System_Status.model.php 3 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,8 +15,6 @@  discard block
 block discarded – undo
15 15
      *      This function is a singleton method used to instantiate the EEM_Attendee object
16 16
      *
17 17
      *      @access public
18
-     *      @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
19
-     *      @return EEM_System_Status
20 18
      */
21 19
     public static function instance()
22 20
     {
@@ -157,7 +155,7 @@  discard block
 block discarded – undo
157 155
 
158 156
     /**
159 157
      *
160
-     * @return array like EE_Config class
158
+     * @return EE_Config like EE_Config class
161 159
      */
162 160
     public function get_ee_config()
163 161
     {
@@ -214,7 +212,7 @@  discard block
 block discarded – undo
214 212
 
215 213
     /**
216 214
      * Checks if site responds ot HTTPS
217
-     * @return boolean
215
+     * @return string
218 216
      */
219 217
     public function get_https_enabled()
220 218
     {
Please login to merge, or discard this patch.
Indentation   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -6,75 +6,75 @@  discard block
 block discarded – undo
6 6
 class EEM_System_Status
7 7
 {
8 8
 
9
-    // private instance of the EEM_System_Status object
10
-    protected static $_instance = null;
9
+	// private instance of the EEM_System_Status object
10
+	protected static $_instance = null;
11 11
 
12 12
 
13 13
 
14
-    /**
15
-     *      This function is a singleton method used to instantiate the EEM_Attendee object
16
-     *
17
-     *      @access public
18
-     *      @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
19
-     *      @return EEM_System_Status
20
-     */
21
-    public static function instance()
22
-    {
14
+	/**
15
+	 *      This function is a singleton method used to instantiate the EEM_Attendee object
16
+	 *
17
+	 *      @access public
18
+	 *      @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
19
+	 *      @return EEM_System_Status
20
+	 */
21
+	public static function instance()
22
+	{
23 23
 
24
-        // check if instance of EEM_System_Status already exists
25
-        if (self::$_instance === null) {
26
-            // instantiate EEM_System_Status
27
-            self::$_instance = new self();
28
-        }
29
-        return self::$_instance;
30
-    }
31
-    private function __construct()
32
-    {
33
-    }
34
-    /**
35
-     *
36
-     * @return array where each key is a function name on this class, and each value is SOMETHING--
37
-     * it might be a value, an array, or an object
38
-     */
39
-    public function get_system_stati()
40
-    {
41
-        return array(
42
-                'ee_version'=>$this->get_ee_version(),
43
-                'ee_activation_history'=>$this->get_ee_activation_history(),
44
-                'ee_config'=>$this->get_ee_config(),
45
-                'ee_migration_history'=>$this->get_ee_migration_history(),
46
-                'active_plugins'=>$this->get_active_plugins(),
47
-                'wp_settings'=>$this->get_wp_settings(),
48
-                'wp_maintenance_mode' => $this->get_wp_maintenance_mode(),
49
-                'https_enabled'=>$this->get_https_enabled(),
50
-                'logging_enabled' => $this->get_logging_enabled(),
51
-                'remote_posting' => $this->get_remote_posting(),
52
-                'php_version'=>$this->php_version(),
53
-                'php.ini_settings'=>$this->get_php_ini_all(),
54
-                'php_info'=>$this->get_php_info(),
55
-        );
56
-    }
57
-    /**
58
-     *
59
-     * @return string
60
-     */
61
-    public function get_ee_version()
62
-    {
63
-        return espresso_version();
64
-    }
65
-    /**
66
-     *
67
-     * @return string
68
-     */
69
-    public function php_version()
70
-    {
71
-        return phpversion();
72
-    }
73
-    /**
74
-     *
75
-     * @return array, where each key is a plugin name (lower-cased), values are sub-arrays.
76
-     * Sub-arrays like described in wp function get_plugin_data. Ie,     *
77
-     *  'Name' => 'Plugin Name',
24
+		// check if instance of EEM_System_Status already exists
25
+		if (self::$_instance === null) {
26
+			// instantiate EEM_System_Status
27
+			self::$_instance = new self();
28
+		}
29
+		return self::$_instance;
30
+	}
31
+	private function __construct()
32
+	{
33
+	}
34
+	/**
35
+	 *
36
+	 * @return array where each key is a function name on this class, and each value is SOMETHING--
37
+	 * it might be a value, an array, or an object
38
+	 */
39
+	public function get_system_stati()
40
+	{
41
+		return array(
42
+				'ee_version'=>$this->get_ee_version(),
43
+				'ee_activation_history'=>$this->get_ee_activation_history(),
44
+				'ee_config'=>$this->get_ee_config(),
45
+				'ee_migration_history'=>$this->get_ee_migration_history(),
46
+				'active_plugins'=>$this->get_active_plugins(),
47
+				'wp_settings'=>$this->get_wp_settings(),
48
+				'wp_maintenance_mode' => $this->get_wp_maintenance_mode(),
49
+				'https_enabled'=>$this->get_https_enabled(),
50
+				'logging_enabled' => $this->get_logging_enabled(),
51
+				'remote_posting' => $this->get_remote_posting(),
52
+				'php_version'=>$this->php_version(),
53
+				'php.ini_settings'=>$this->get_php_ini_all(),
54
+				'php_info'=>$this->get_php_info(),
55
+		);
56
+	}
57
+	/**
58
+	 *
59
+	 * @return string
60
+	 */
61
+	public function get_ee_version()
62
+	{
63
+		return espresso_version();
64
+	}
65
+	/**
66
+	 *
67
+	 * @return string
68
+	 */
69
+	public function php_version()
70
+	{
71
+		return phpversion();
72
+	}
73
+	/**
74
+	 *
75
+	 * @return array, where each key is a plugin name (lower-cased), values are sub-arrays.
76
+	 * Sub-arrays like described in wp function get_plugin_data. Ie,     *
77
+	 *  'Name' => 'Plugin Name',
78 78
         'PluginURI' => 'Plugin URI',
79 79
         'Version' => 'Version',
80 80
         'Description' => 'Description',
@@ -83,221 +83,221 @@  discard block
 block discarded – undo
83 83
         'TextDomain' => 'Text Domain',
84 84
         'DomainPath' => 'Domain Path',
85 85
         'Network' => 'Network',
86
-     */
87
-    public function get_active_plugins()
88
-    {
89
-        $active_plugins = (array) get_option('active_plugins', array());
90
-        if (is_multisite()) {
91
-            $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
92
-        }
93
-        $active_plugins = array_map('strtolower', $active_plugins);
94
-        $plugin_info = array();
95
-        foreach ($active_plugins as $plugin) {
96
-                $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
86
+	 */
87
+	public function get_active_plugins()
88
+	{
89
+		$active_plugins = (array) get_option('active_plugins', array());
90
+		if (is_multisite()) {
91
+			$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
92
+		}
93
+		$active_plugins = array_map('strtolower', $active_plugins);
94
+		$plugin_info = array();
95
+		foreach ($active_plugins as $plugin) {
96
+				$plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
97 97
 
98
-                $plugin_info[ $plugin ] = $plugin_data;
99
-        }
100
-        return $plugin_info;
101
-    }
98
+				$plugin_info[ $plugin ] = $plugin_data;
99
+		}
100
+		return $plugin_info;
101
+	}
102 102
 
103
-    /**
104
-     *
105
-     * @return array with keys 'home_url' and 'site_url'
106
-     */
107
-    public function get_wp_settings()
108
-    {
109
-        $wp_memory_int = $this->let_to_num(WP_MEMORY_LIMIT);
110
-        if ($wp_memory_int < 67108864) {
111
-            $wp_memory_to_display = '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', 'event_espresso'), WP_MEMORY_LIMIT, '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', '</a>"') . '</mark>';
112
-        } else {
113
-            $wp_memory_to_display = '<mark class="yes">' . size_format($wp_memory_int) . '</mark>';
114
-        }
115
-        return array(
116
-            'name'=>get_bloginfo('name', 'display'),
117
-            'is_multisite'=>is_multisite(),
118
-            'version'=>  get_bloginfo('version', 'display'),
119
-            'home_url'=>home_url(),
120
-            'site_url'=>site_url(),
121
-            'WP_DEBUG'=>WP_DEBUG,
122
-            'permalink_structure'=>get_option('permalink_structure'),
123
-            'theme'=>wp_get_theme(),
124
-            'gmt_offset'=>get_option('gmt_offset'),
125
-            'timezone_string'=>get_option('timezone_string'),
126
-            'admin_email'=>  get_bloginfo('admin_email', 'display'),
127
-            'language'=>get_bloginfo('language', 'display'),
128
-            'wp_max_upload_size' => size_format(wp_max_upload_size()),
129
-            'wp_memory' => $wp_memory_to_display
130
-            );
131
-    }
103
+	/**
104
+	 *
105
+	 * @return array with keys 'home_url' and 'site_url'
106
+	 */
107
+	public function get_wp_settings()
108
+	{
109
+		$wp_memory_int = $this->let_to_num(WP_MEMORY_LIMIT);
110
+		if ($wp_memory_int < 67108864) {
111
+			$wp_memory_to_display = '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', 'event_espresso'), WP_MEMORY_LIMIT, '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', '</a>"') . '</mark>';
112
+		} else {
113
+			$wp_memory_to_display = '<mark class="yes">' . size_format($wp_memory_int) . '</mark>';
114
+		}
115
+		return array(
116
+			'name'=>get_bloginfo('name', 'display'),
117
+			'is_multisite'=>is_multisite(),
118
+			'version'=>  get_bloginfo('version', 'display'),
119
+			'home_url'=>home_url(),
120
+			'site_url'=>site_url(),
121
+			'WP_DEBUG'=>WP_DEBUG,
122
+			'permalink_structure'=>get_option('permalink_structure'),
123
+			'theme'=>wp_get_theme(),
124
+			'gmt_offset'=>get_option('gmt_offset'),
125
+			'timezone_string'=>get_option('timezone_string'),
126
+			'admin_email'=>  get_bloginfo('admin_email', 'display'),
127
+			'language'=>get_bloginfo('language', 'display'),
128
+			'wp_max_upload_size' => size_format(wp_max_upload_size()),
129
+			'wp_memory' => $wp_memory_to_display
130
+			);
131
+	}
132 132
 
133
-    /**
134
-     * Gets an array of information about the history of ee versions installed
135
-     * @return array
136
-     */
137
-    public function get_ee_activation_history()
138
-    {
139
-        return get_option('espresso_db_update');
140
-    }
133
+	/**
134
+	 * Gets an array of information about the history of ee versions installed
135
+	 * @return array
136
+	 */
137
+	public function get_ee_activation_history()
138
+	{
139
+		return get_option('espresso_db_update');
140
+	}
141 141
 
142 142
 
143
-    /**
144
-     * Gets an array where keys are ee versions, and their values are arrays indicating all the different times that version was installed
145
-     * @return EE_Data_Migration_Script_Base[]
146
-     */
147
-    public function get_ee_migration_history()
148
-    {
149
-        $options = EE_Data_Migration_Manager::instance()->get_all_migration_script_options();
150
-        $presentable_migration_scripts = array();
151
-        foreach ($options as $option_array) {
152
-            $presentable_migration_scripts[ str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name']) ] = maybe_unserialize($option_array['option_value']);
153
-        }
154
-        return $presentable_migration_scripts;
143
+	/**
144
+	 * Gets an array where keys are ee versions, and their values are arrays indicating all the different times that version was installed
145
+	 * @return EE_Data_Migration_Script_Base[]
146
+	 */
147
+	public function get_ee_migration_history()
148
+	{
149
+		$options = EE_Data_Migration_Manager::instance()->get_all_migration_script_options();
150
+		$presentable_migration_scripts = array();
151
+		foreach ($options as $option_array) {
152
+			$presentable_migration_scripts[ str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name']) ] = maybe_unserialize($option_array['option_value']);
153
+		}
154
+		return $presentable_migration_scripts;
155 155
 //      return get_option(EE_Data_Migration_Manager::data_migrations_option_name);//EE_Data_Migration_Manager::instance()->get_data_migrations_ran();
156
-    }
156
+	}
157 157
 
158
-    /**
159
-     *
160
-     * @return array like EE_Config class
161
-     */
162
-    public function get_ee_config()
163
-    {
164
-        return EE_Config::instance();
165
-    }
158
+	/**
159
+	 *
160
+	 * @return array like EE_Config class
161
+	 */
162
+	public function get_ee_config()
163
+	{
164
+		return EE_Config::instance();
165
+	}
166 166
 
167
-    /**
168
-     * Gets an array of php setup info, pilfered from http://www.php.net/manual/en/function.phpinfo.php#87463
169
-     * @return array like the output of phpinfo(), but in an array
170
-     */
171
-    public function get_php_info()
172
-    {
173
-        ob_start();
174
-        phpinfo(-1);
167
+	/**
168
+	 * Gets an array of php setup info, pilfered from http://www.php.net/manual/en/function.phpinfo.php#87463
169
+	 * @return array like the output of phpinfo(), but in an array
170
+	 */
171
+	public function get_php_info()
172
+	{
173
+		ob_start();
174
+		phpinfo(-1);
175 175
 
176
-        $pi = preg_replace(
177
-            array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
178
-            '#<h1>Configuration</h1>#',  "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
179
-            "#[ \t]+#", '#&nbsp;#', '#  +#', '# class=".*?"#', '%&#039;%',
180
-            '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
181
-            .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
182
-            '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
183
-            '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#',
184
-            "# +#", '#<tr>#', '#</tr>#'),
185
-            array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ',
186
-            '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'.
187
-            "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
188
-            '<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
189
-            '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
190
-            '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
191
-            ob_get_clean()
192
-        );
176
+		$pi = preg_replace(
177
+			array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
178
+			'#<h1>Configuration</h1>#',  "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
179
+			"#[ \t]+#", '#&nbsp;#', '#  +#', '# class=".*?"#', '%&#039;%',
180
+			'#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
181
+			.'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
182
+			'#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
183
+			'#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#',
184
+			"# +#", '#<tr>#', '#</tr>#'),
185
+			array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ',
186
+			'<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'.
187
+			"\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
188
+			'<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
189
+			'<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
190
+			'<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
191
+			ob_get_clean()
192
+		);
193 193
 
194
-        $sections = explode('<h2>', strip_tags($pi, '<h2><th><td>'));
195
-        unset($sections[0]);
194
+		$sections = explode('<h2>', strip_tags($pi, '<h2><th><td>'));
195
+		unset($sections[0]);
196 196
 
197
-        $pi = array();
198
-        foreach ($sections as $section) {
199
-            $n = substr($section, 0, strpos($section, '</h2>'));
200
-            preg_match_all(
201
-                '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',
202
-                $section,
203
-                $askapache,
204
-                PREG_SET_ORDER
205
-            );
206
-            foreach ($askapache as $m) {
207
-                $m2 = isset($m[2]) ? $m[2] : null;
208
-            }
209
-              $pi[ $n ][ $m[1] ]=(!isset($m[3])||$m2==$m[3]) ? $m2 : array_slice($m, 2);
210
-        }
197
+		$pi = array();
198
+		foreach ($sections as $section) {
199
+			$n = substr($section, 0, strpos($section, '</h2>'));
200
+			preg_match_all(
201
+				'#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',
202
+				$section,
203
+				$askapache,
204
+				PREG_SET_ORDER
205
+			);
206
+			foreach ($askapache as $m) {
207
+				$m2 = isset($m[2]) ? $m[2] : null;
208
+			}
209
+			  $pi[ $n ][ $m[1] ]=(!isset($m[3])||$m2==$m[3]) ? $m2 : array_slice($m, 2);
210
+		}
211 211
 
212
-        return $pi;
213
-    }
212
+		return $pi;
213
+	}
214 214
 
215
-    /**
216
-     * Checks if site responds ot HTTPS
217
-     * @return boolean
218
-     */
219
-    public function get_https_enabled()
220
-    {
221
-        $home = str_replace("http://", "https://", home_url());
222
-        $response = wp_remote_get($home);
223
-        if ($response instanceof WP_Error) {
224
-            $error_string = '';
225
-            foreach ($response->errors as $short_name => $description_array) {
226
-                $error_string .= "<b>$short_name</b>: ".implode(", ", $description_array);
227
-            }
228
-            return $error_string;
229
-        }
230
-        return "ok!";
231
-    }
232
-    /**
233
-     * Whether or not a .maintenance file is detected
234
-     * @return string descripting wp_maintenance_mode status
235
-     */
236
-    public function get_wp_maintenance_mode()
237
-    {
238
-        $opened = file_exists(ABSPATH . '.maintenance');
239
-        return $opened ? sprintf(__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso')  ;
240
-    }
241
-    /**
242
-     * Whether or not logging is enabled
243
-     * @return string descripting logging's status
244
-     */
245
-    public function get_logging_enabled()
246
-    {
247
-            $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a');
248
-            return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf(__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>') ;
249
-    }
250
-    /**
251
-     *  Whether curl ro fsock works
252
-     * @return string describing posting's status
253
-     */
254
-    public function get_remote_posting()
255
-    {
256
-        $fsock_works = function_exists('fsockopen');
257
-        $curl_works = function_exists('curl_init');
258
-        if ($fsock_works && $curl_works) {
259
-            $status = __('Your server has fsockopen and cURL enabled.', 'event_espresso');
260
-        } elseif ($fsock_works) {
261
-            $status = __('Your server has fsockopen enabled, cURL is disabled.', 'event_espresso');
262
-        } elseif ($curl_works) {
263
-            $status = __('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso');
264
-        } else {
265
-            $status = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso'). '</mark>';
266
-        }
267
-        return $status;
268
-    }
269
-    /**
270
-     * Gets all the php.ini settings
271
-     * @return array
272
-     */
273
-    public function get_php_ini_all()
274
-    {
275
-        return ini_get_all();
276
-    }
277
-    /**
278
-     * Transforms the php.ini notation for numbers (like '2M') to an integer.
279
-     *
280
-     * @param type $size
281
-     * @return int
282
-     */
283
-    public function let_to_num($size)
284
-    {
285
-        $l      = substr($size, -1);
286
-        $ret    = substr($size, 0, -1);
287
-        // phpcs:disable PSR2.ControlStructures.SwitchDeclaration.TerminatingComment
288
-        switch (strtoupper($l)) {
289
-            case 'P':
290
-                $ret *= 1024;
291
-            case 'T':
292
-                $ret *= 1024;
293
-            case 'G':
294
-                $ret *= 1024;
295
-            case 'M':
296
-                $ret *= 1024;
297
-            case 'K':
298
-                $ret *= 1024;
299
-        }
300
-        // phpcs:enable
301
-        return $ret;
302
-    }
215
+	/**
216
+	 * Checks if site responds ot HTTPS
217
+	 * @return boolean
218
+	 */
219
+	public function get_https_enabled()
220
+	{
221
+		$home = str_replace("http://", "https://", home_url());
222
+		$response = wp_remote_get($home);
223
+		if ($response instanceof WP_Error) {
224
+			$error_string = '';
225
+			foreach ($response->errors as $short_name => $description_array) {
226
+				$error_string .= "<b>$short_name</b>: ".implode(", ", $description_array);
227
+			}
228
+			return $error_string;
229
+		}
230
+		return "ok!";
231
+	}
232
+	/**
233
+	 * Whether or not a .maintenance file is detected
234
+	 * @return string descripting wp_maintenance_mode status
235
+	 */
236
+	public function get_wp_maintenance_mode()
237
+	{
238
+		$opened = file_exists(ABSPATH . '.maintenance');
239
+		return $opened ? sprintf(__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso')  ;
240
+	}
241
+	/**
242
+	 * Whether or not logging is enabled
243
+	 * @return string descripting logging's status
244
+	 */
245
+	public function get_logging_enabled()
246
+	{
247
+			$opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a');
248
+			return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf(__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>') ;
249
+	}
250
+	/**
251
+	 *  Whether curl ro fsock works
252
+	 * @return string describing posting's status
253
+	 */
254
+	public function get_remote_posting()
255
+	{
256
+		$fsock_works = function_exists('fsockopen');
257
+		$curl_works = function_exists('curl_init');
258
+		if ($fsock_works && $curl_works) {
259
+			$status = __('Your server has fsockopen and cURL enabled.', 'event_espresso');
260
+		} elseif ($fsock_works) {
261
+			$status = __('Your server has fsockopen enabled, cURL is disabled.', 'event_espresso');
262
+		} elseif ($curl_works) {
263
+			$status = __('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso');
264
+		} else {
265
+			$status = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso'). '</mark>';
266
+		}
267
+		return $status;
268
+	}
269
+	/**
270
+	 * Gets all the php.ini settings
271
+	 * @return array
272
+	 */
273
+	public function get_php_ini_all()
274
+	{
275
+		return ini_get_all();
276
+	}
277
+	/**
278
+	 * Transforms the php.ini notation for numbers (like '2M') to an integer.
279
+	 *
280
+	 * @param type $size
281
+	 * @return int
282
+	 */
283
+	public function let_to_num($size)
284
+	{
285
+		$l      = substr($size, -1);
286
+		$ret    = substr($size, 0, -1);
287
+		// phpcs:disable PSR2.ControlStructures.SwitchDeclaration.TerminatingComment
288
+		switch (strtoupper($l)) {
289
+			case 'P':
290
+				$ret *= 1024;
291
+			case 'T':
292
+				$ret *= 1024;
293
+			case 'G':
294
+				$ret *= 1024;
295
+			case 'M':
296
+				$ret *= 1024;
297
+			case 'K':
298
+				$ret *= 1024;
299
+		}
300
+		// phpcs:enable
301
+		return $ret;
302
+	}
303 303
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
         $active_plugins = array_map('strtolower', $active_plugins);
94 94
         $plugin_info = array();
95 95
         foreach ($active_plugins as $plugin) {
96
-                $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
96
+                $plugin_data = @get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin);
97 97
 
98
-                $plugin_info[ $plugin ] = $plugin_data;
98
+                $plugin_info[$plugin] = $plugin_data;
99 99
         }
100 100
         return $plugin_info;
101 101
     }
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $wp_memory_int = $this->let_to_num(WP_MEMORY_LIMIT);
110 110
         if ($wp_memory_int < 67108864) {
111
-            $wp_memory_to_display = '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', 'event_espresso'), WP_MEMORY_LIMIT, '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', '</a>"') . '</mark>';
111
+            $wp_memory_to_display = '<mark class="error">'.sprintf(__('%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', 'event_espresso'), WP_MEMORY_LIMIT, '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', '</a>"').'</mark>';
112 112
         } else {
113
-            $wp_memory_to_display = '<mark class="yes">' . size_format($wp_memory_int) . '</mark>';
113
+            $wp_memory_to_display = '<mark class="yes">'.size_format($wp_memory_int).'</mark>';
114 114
         }
115 115
         return array(
116 116
             'name'=>get_bloginfo('name', 'display'),
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $options = EE_Data_Migration_Manager::instance()->get_all_migration_script_options();
150 150
         $presentable_migration_scripts = array();
151 151
         foreach ($options as $option_array) {
152
-            $presentable_migration_scripts[ str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name']) ] = maybe_unserialize($option_array['option_value']);
152
+            $presentable_migration_scripts[str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name'])] = maybe_unserialize($option_array['option_value']);
153 153
         }
154 154
         return $presentable_migration_scripts;
155 155
 //      return get_option(EE_Data_Migration_Manager::data_migrations_option_name);//EE_Data_Migration_Manager::instance()->get_data_migrations_ran();
@@ -175,18 +175,18 @@  discard block
 block discarded – undo
175 175
 
176 176
         $pi = preg_replace(
177 177
             array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
178
-            '#<h1>Configuration</h1>#',  "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
178
+            '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
179 179
             "#[ \t]+#", '#&nbsp;#', '#  +#', '# class=".*?"#', '%&#039;%',
180 180
             '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
181 181
             .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
182 182
             '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
183 183
             '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#',
184 184
             "# +#", '#<tr>#', '#</tr>#'),
185
-            array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ',
185
+            array('$1', '', '', '', '</$1>'."\n", '<', ' ', ' ', ' ', '', ' ',
186 186
             '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'.
187 187
             "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
188 188
             '<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
189
-            '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
189
+            '<tr><td>Zend Engine</td><td>$2</td></tr>'."\n".
190 190
             '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
191 191
             ob_get_clean()
192 192
         );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             foreach ($askapache as $m) {
207 207
                 $m2 = isset($m[2]) ? $m[2] : null;
208 208
             }
209
-              $pi[ $n ][ $m[1] ]=(!isset($m[3])||$m2==$m[3]) ? $m2 : array_slice($m, 2);
209
+              $pi[$n][$m[1]] = ( ! isset($m[3]) || $m2 == $m[3]) ? $m2 : array_slice($m, 2);
210 210
         }
211 211
 
212 212
         return $pi;
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function get_wp_maintenance_mode()
237 237
     {
238
-        $opened = file_exists(ABSPATH . '.maintenance');
239
-        return $opened ? sprintf(__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso')  ;
238
+        $opened = file_exists(ABSPATH.'.maintenance');
239
+        return $opened ? sprintf(__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso');
240 240
     }
241 241
     /**
242 242
      * Whether or not logging is enabled
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function get_logging_enabled()
246 246
     {
247
-            $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a');
248
-            return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf(__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>') ;
247
+            $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR.'/logs/espresso_log.txt', 'a');
248
+            return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf(__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>');
249 249
     }
250 250
     /**
251 251
      *  Whether curl ro fsock works
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         } elseif ($curl_works) {
263 263
             $status = __('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso');
264 264
         } else {
265
-            $status = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso'). '</mark>';
265
+            $status = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso').'</mark>';
266 266
         }
267 267
         return $status;
268 268
     }
Please login to merge, or discard this patch.
core/db_models/fields/EE_WP_Post_Status_Field.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,6 @@
 block discarded – undo
32 32
      *                                    )
33 33
      *                                    )
34 34
      * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info
35
-     * @param boolean $store_in_db_as_int By default, enums are stored as STRINGS in the DB. However, if this var is
36
-     *                                    set to true, it will be stored as an INT
37 35
      */
38 36
     public function __construct($table_column, $nicename, $nullable, $default_value, $new_stati = array())
39 37
     {
Please login to merge, or discard this patch.
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -3,114 +3,114 @@
 block discarded – undo
3 3
 class EE_WP_Post_Status_Field extends EE_Enum_Text_Field
4 4
 {
5 5
 
6
-    protected $_wp_post_stati;
6
+	protected $_wp_post_stati;
7 7
 
8 8
 
9
-    /**
10
-     * constructor
11
-     *
12
-     * @param string  $table_column       column on table
13
-     * @param string  $nicename           nice name for column(field)
14
-     * @param bool    $nullable           is this field nullable
15
-     * @param string  $default_value      default status
16
-     * @param array   $new_stati          If additional stati are to be used other than the default WP statuses then
17
-     *                                    they can be registered via this property.  The format of the array should be
18
-     *                                    as follows: array(
19
-     *                                    'status_reference' => array(
20
-     *                                    'label' => __('Status Reference Label', 'event_espresso')
21
-     *                                    'public' => true, //'Whether posts of this status should be shown on the
22
-     *                                    frontend of the site'
23
-     *                                    'exclude_from_search' => false, //'Whether posts of this status should be
24
-     *                                    excluded from wp searches'
25
-     *                                    'show_in_admin_all_list' => true, //whether posts of this status are included
26
-     *                                    in queries for the admin "all" view in list table views.
27
-     *                                    'show_in_admin_status_list' => true, //Show in the list of statuses with post
28
-     *                                    counts at the top of the admin list tables (i.e. Status Reference(2) )
29
-     *                                    'label_count' => _n_noop( 'Status Reference <span class="count">(%s)</span>',
30
-     *                                    'Status References <span class="count">(%s)</span>' ), //the text to display
31
-     *                                    on the admin screen( or you won't see your status count ).
32
-     *                                    )
33
-     *                                    )
34
-     * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info
35
-     * @param boolean $store_in_db_as_int By default, enums are stored as STRINGS in the DB. However, if this var is
36
-     *                                    set to true, it will be stored as an INT
37
-     */
38
-    public function __construct($table_column, $nicename, $nullable, $default_value, $new_stati = array())
39
-    {
40
-        $this->_register_new_stati($new_stati);
41
-        $this->_set_allowed_enum_values();
42
-        parent::__construct($table_column, $nicename, $nullable, $default_value, $this->_allowed_enum_values);
43
-    }
9
+	/**
10
+	 * constructor
11
+	 *
12
+	 * @param string  $table_column       column on table
13
+	 * @param string  $nicename           nice name for column(field)
14
+	 * @param bool    $nullable           is this field nullable
15
+	 * @param string  $default_value      default status
16
+	 * @param array   $new_stati          If additional stati are to be used other than the default WP statuses then
17
+	 *                                    they can be registered via this property.  The format of the array should be
18
+	 *                                    as follows: array(
19
+	 *                                    'status_reference' => array(
20
+	 *                                    'label' => __('Status Reference Label', 'event_espresso')
21
+	 *                                    'public' => true, //'Whether posts of this status should be shown on the
22
+	 *                                    frontend of the site'
23
+	 *                                    'exclude_from_search' => false, //'Whether posts of this status should be
24
+	 *                                    excluded from wp searches'
25
+	 *                                    'show_in_admin_all_list' => true, //whether posts of this status are included
26
+	 *                                    in queries for the admin "all" view in list table views.
27
+	 *                                    'show_in_admin_status_list' => true, //Show in the list of statuses with post
28
+	 *                                    counts at the top of the admin list tables (i.e. Status Reference(2) )
29
+	 *                                    'label_count' => _n_noop( 'Status Reference <span class="count">(%s)</span>',
30
+	 *                                    'Status References <span class="count">(%s)</span>' ), //the text to display
31
+	 *                                    on the admin screen( or you won't see your status count ).
32
+	 *                                    )
33
+	 *                                    )
34
+	 * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info
35
+	 * @param boolean $store_in_db_as_int By default, enums are stored as STRINGS in the DB. However, if this var is
36
+	 *                                    set to true, it will be stored as an INT
37
+	 */
38
+	public function __construct($table_column, $nicename, $nullable, $default_value, $new_stati = array())
39
+	{
40
+		$this->_register_new_stati($new_stati);
41
+		$this->_set_allowed_enum_values();
42
+		parent::__construct($table_column, $nicename, $nullable, $default_value, $this->_allowed_enum_values);
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * This registers any new statuses sent via the $new_stati array on construct
48
-     *
49
-     * @access protected
50
-     * @param  array $new_stati statuses
51
-     * @return void
52
-     */
53
-    protected function _register_new_stati($new_stati)
54
-    {
46
+	/**
47
+	 * This registers any new statuses sent via the $new_stati array on construct
48
+	 *
49
+	 * @access protected
50
+	 * @param  array $new_stati statuses
51
+	 * @return void
52
+	 */
53
+	protected function _register_new_stati($new_stati)
54
+	{
55 55
 
56
-        foreach ((array) $new_stati as $status_key => $status_args) {
57
-            $args = array(
58
-                'label'                     => isset($status_args['label']) ? $status_args['label'] : $status_key,
59
-                'public'                    => isset($status_args['public']) && is_bool($status_args['public']) ? $status_args['public'] : true,
60
-                'exclude_from_search'       => isset($status_args['exclude_from_search']) && is_bool($status_args['exclude_from_search']) ? $status_args['exclude_from_search'] : false,
61
-                'show_in_admin_all_list'    => isset($status_args['show_in_admin_all_list']) && is_bool($status_args['show_in_admin_all_list']) ? $status_args['show_in_admin_all_list'] : false,
62
-                'show_in_admin_status_list' => isset($status_args['show_in_admin_status_list']) && is_bool($status_args['show_in_admin_status_list']) ? $status_args['show_in_admin_status_list'] : true,
63
-                'label_count'               => isset($status_args['label_count']) ? $status_args['label_count'] : '',
64
-            );
65
-            register_post_status($status_key, $status_args);
66
-        }
67
-    }
56
+		foreach ((array) $new_stati as $status_key => $status_args) {
57
+			$args = array(
58
+				'label'                     => isset($status_args['label']) ? $status_args['label'] : $status_key,
59
+				'public'                    => isset($status_args['public']) && is_bool($status_args['public']) ? $status_args['public'] : true,
60
+				'exclude_from_search'       => isset($status_args['exclude_from_search']) && is_bool($status_args['exclude_from_search']) ? $status_args['exclude_from_search'] : false,
61
+				'show_in_admin_all_list'    => isset($status_args['show_in_admin_all_list']) && is_bool($status_args['show_in_admin_all_list']) ? $status_args['show_in_admin_all_list'] : false,
62
+				'show_in_admin_status_list' => isset($status_args['show_in_admin_status_list']) && is_bool($status_args['show_in_admin_status_list']) ? $status_args['show_in_admin_status_list'] : true,
63
+				'label_count'               => isset($status_args['label_count']) ? $status_args['label_count'] : '',
64
+			);
65
+			register_post_status($status_key, $status_args);
66
+		}
67
+	}
68 68
 
69 69
 
70
-    /**
71
-     * This sets the _allowed_enum_values property using the $wp_post_stati array
72
-     *
73
-     * @access protected
74
-     * @regurn void
75
-     */
76
-    protected function _set_allowed_enum_values()
77
-    {
78
-        // first let's get the post_statuses
79
-        global $wp_post_statuses;
80
-        $this->_wp_post_stati = $wp_post_statuses;
70
+	/**
71
+	 * This sets the _allowed_enum_values property using the $wp_post_stati array
72
+	 *
73
+	 * @access protected
74
+	 * @regurn void
75
+	 */
76
+	protected function _set_allowed_enum_values()
77
+	{
78
+		// first let's get the post_statuses
79
+		global $wp_post_statuses;
80
+		$this->_wp_post_stati = $wp_post_statuses;
81 81
 
82
-        foreach ($this->_wp_post_stati as $post_status => $args_object) {
83
-            $this->_allowed_enum_values[ $post_status ] = $args_object->label;
84
-        }
85
-    }
82
+		foreach ($this->_wp_post_stati as $post_status => $args_object) {
83
+			$this->_allowed_enum_values[ $post_status ] = $args_object->label;
84
+		}
85
+	}
86 86
 
87
-    /**
88
-     * Before calling parent, first double-checks our list of acceptable post
89
-     * types is up-to-date
90
-     *
91
-     * @param string $value_inputted_for_field_on_model_object
92
-     * @return string
93
-     */
94
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
95
-    {
96
-        $this->_set_allowed_enum_values();
97
-        return parent::prepare_for_set($value_inputted_for_field_on_model_object);
98
-    }
87
+	/**
88
+	 * Before calling parent, first double-checks our list of acceptable post
89
+	 * types is up-to-date
90
+	 *
91
+	 * @param string $value_inputted_for_field_on_model_object
92
+	 * @return string
93
+	 */
94
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
95
+	{
96
+		$this->_set_allowed_enum_values();
97
+		return parent::prepare_for_set($value_inputted_for_field_on_model_object);
98
+	}
99 99
 
100 100
 
101 101
 
102
-    // helper methods for getting various $wp_post_statuses stuff.
102
+	// helper methods for getting various $wp_post_statuses stuff.
103 103
 
104
-    /**
105
-     * This just returns the status object for the given status
106
-     *
107
-     * @access public
108
-     * @see    wp_register_post_status in wp-includes/post.php for a list of properties of the status object
109
-     * @param  string $status What status object you want
110
-     * @return std_object         the status object or FALSE if it doesn't exist.
111
-     */
112
-    public function get_status_object($status)
113
-    {
114
-        return isset($this->_wp_post_stati[ $status ]) ? $this->_wp_post_stati[ $status ] : false;
115
-    }
104
+	/**
105
+	 * This just returns the status object for the given status
106
+	 *
107
+	 * @access public
108
+	 * @see    wp_register_post_status in wp-includes/post.php for a list of properties of the status object
109
+	 * @param  string $status What status object you want
110
+	 * @return std_object         the status object or FALSE if it doesn't exist.
111
+	 */
112
+	public function get_status_object($status)
113
+	{
114
+		return isset($this->_wp_post_stati[ $status ]) ? $this->_wp_post_stati[ $status ] : false;
115
+	}
116 116
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $this->_wp_post_stati = $wp_post_statuses;
81 81
 
82 82
         foreach ($this->_wp_post_stati as $post_status => $args_object) {
83
-            $this->_allowed_enum_values[ $post_status ] = $args_object->label;
83
+            $this->_allowed_enum_values[$post_status] = $args_object->label;
84 84
         }
85 85
     }
86 86
 
@@ -111,6 +111,6 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function get_status_object($status)
113 113
     {
114
-        return isset($this->_wp_post_stati[ $status ]) ? $this->_wp_post_stati[ $status ] : false;
114
+        return isset($this->_wp_post_stati[$status]) ? $this->_wp_post_stati[$status] : false;
115 115
     }
116 116
 }
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Model_Query_Info_Carrier.php 3 patches
Doc Comments   +14 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,19 +44,33 @@  discard block
 block discarded – undo
44 44
    
45 45
     private $_group_by_sql;
46 46
    
47
+    /**
48
+     * @param string $limit_sql
49
+     */
47 50
     public function set_limit_sql($limit_sql)
48 51
     {
49 52
         $this->_limit_sql = $limit_sql;
50 53
     }
51 54
     
55
+    /**
56
+     * @param string $order_by_sql
57
+     */
52 58
     public function set_order_by_sql($order_by_sql)
53 59
     {
54 60
         $this->_order_by_sql = $order_by_sql;
55 61
     }
62
+
63
+    /**
64
+     * @param string $group_by_sql
65
+     */
56 66
     public function set_group_by_sql($group_by_sql)
57 67
     {
58 68
         $this->_group_by_sql = $group_by_sql;
59 69
     }
70
+
71
+    /**
72
+     * @param string $having_sql
73
+     */
60 74
     public function set_having_sql($having_sql)
61 75
     {
62 76
         $this->_having_sql = $having_sql;
@@ -81,7 +95,6 @@  discard block
 block discarded – undo
81 95
     *
82 96
     * @param type $model_included_name
83 97
     * @param type $join_sql
84
-    * @param type $data_types
85 98
     */
86 99
     public function __construct($model_included_name = array(), $join_sql = '')
87 100
     {
Please login to merge, or discard this patch.
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -14,141 +14,141 @@  discard block
 block discarded – undo
14 14
    /**
15 15
     * @var string SQL for performing joins (Eg, "INNER JOIN blah ON blah=blah INNER JOIN FOO ON foo=foo...")
16 16
     */
17
-    private $_join_sql;
17
+	private $_join_sql;
18 18
    /**
19 19
     *
20 20
     * @var array stating all the models that have been included thus far,so we don't get duplicates.
21 21
     * Keys are the model relation chains to them from the queried model
22 22
     * (eg, "Registration.Transaction.Payment"), and valuesare model names (eg "Payment")
23 23
     */
24
-    private $_models_included;
24
+	private $_models_included;
25 25
    
26 26
    /**
27 27
     * After we've acquired all the data types, we can create this sql.
28 28
     * @var string
29 29
     */
30
-    private $_where_sql;
30
+	private $_where_sql;
31 31
    /**
32 32
     * Full join sql. Eg, in a select query, that's everything after the "FROM", and before the "WHERE", so it includes
33 33
     * the declaration of the main model's tables, and then appends all the joining sql to other models
34 34
     * @var string
35 35
     */
36
-    private $_main_join_sql;
36
+	private $_main_join_sql;
37 37
    
38 38
    
39
-    private $_limit_sql;
39
+	private $_limit_sql;
40 40
    
41
-    private $_order_by_sql;
41
+	private $_order_by_sql;
42 42
    
43
-    private $_having_sql;
43
+	private $_having_sql;
44 44
    
45
-    private $_group_by_sql;
45
+	private $_group_by_sql;
46 46
    
47
-    public function set_limit_sql($limit_sql)
48
-    {
49
-        $this->_limit_sql = $limit_sql;
50
-    }
47
+	public function set_limit_sql($limit_sql)
48
+	{
49
+		$this->_limit_sql = $limit_sql;
50
+	}
51 51
     
52
-    public function set_order_by_sql($order_by_sql)
53
-    {
54
-        $this->_order_by_sql = $order_by_sql;
55
-    }
56
-    public function set_group_by_sql($group_by_sql)
57
-    {
58
-        $this->_group_by_sql = $group_by_sql;
59
-    }
60
-    public function set_having_sql($having_sql)
61
-    {
62
-        $this->_having_sql = $having_sql;
63
-    }
64
-    public function get_limit_sql()
65
-    {
66
-        return $this->_limit_sql;
67
-    }
68
-    public function get_order_by_sql()
69
-    {
70
-        return $this->_order_by_sql;
71
-    }
72
-    public function get_group_by_sql()
73
-    {
74
-        return $this->_group_by_sql;
75
-    }
76
-    public function get_having_sql()
77
-    {
78
-        return $this->_having_sql;
79
-    }
52
+	public function set_order_by_sql($order_by_sql)
53
+	{
54
+		$this->_order_by_sql = $order_by_sql;
55
+	}
56
+	public function set_group_by_sql($group_by_sql)
57
+	{
58
+		$this->_group_by_sql = $group_by_sql;
59
+	}
60
+	public function set_having_sql($having_sql)
61
+	{
62
+		$this->_having_sql = $having_sql;
63
+	}
64
+	public function get_limit_sql()
65
+	{
66
+		return $this->_limit_sql;
67
+	}
68
+	public function get_order_by_sql()
69
+	{
70
+		return $this->_order_by_sql;
71
+	}
72
+	public function get_group_by_sql()
73
+	{
74
+		return $this->_group_by_sql;
75
+	}
76
+	public function get_having_sql()
77
+	{
78
+		return $this->_having_sql;
79
+	}
80 80
    /**
81 81
     *
82 82
     * @param type $model_included_name
83 83
     * @param type $join_sql
84 84
     * @param type $data_types
85 85
     */
86
-    public function __construct($model_included_name = array(), $join_sql = '')
87
-    {
88
-        $this->_models_included = $model_included_name;
89
-        $this->_join_sql = $join_sql;
90
-    }
86
+	public function __construct($model_included_name = array(), $join_sql = '')
87
+	{
88
+		$this->_models_included = $model_included_name;
89
+		$this->_join_sql = $join_sql;
90
+	}
91 91
    
92 92
    /**
93 93
     * Merges info from the other EEM_Related_Model_Info_Carrier into this one.
94 94
     * @param EE_Model_Query_Info_Carrier $other_model_query_info_carrier
95 95
     */
96
-    public function merge($other_model_query_info_carrier)
97
-    {
98
-        if ($other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) {
99
-            $model_included_on_other_join_sql_and_data_types_carrier =  $other_model_query_info_carrier->get_model_names_included();
100
-            $this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier);
101
-            $this->_join_sql .= $other_model_query_info_carrier->_join_sql;
102
-        }
103
-        // otherwise don't merge our data.
104
-        // yes, this means that we must immediately merge any model data into our grand list
105
-        // as soon as we get some from ONE model, or else we could reject a EEM_Related_Model_Info_Carrier
106
-        // which is carrying info from two models WHERE one is already included but the other is NOT
107
-    }
96
+	public function merge($other_model_query_info_carrier)
97
+	{
98
+		if ($other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) {
99
+			$model_included_on_other_join_sql_and_data_types_carrier =  $other_model_query_info_carrier->get_model_names_included();
100
+			$this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier);
101
+			$this->_join_sql .= $other_model_query_info_carrier->_join_sql;
102
+		}
103
+		// otherwise don't merge our data.
104
+		// yes, this means that we must immediately merge any model data into our grand list
105
+		// as soon as we get some from ONE model, or else we could reject a EEM_Related_Model_Info_Carrier
106
+		// which is carrying info from two models WHERE one is already included but the other is NOT
107
+	}
108 108
    /**
109 109
     * Checks whether or not we have already included all the models mentione din $model_names on the query info varrier
110 110
     * @param array $model_names just like EE_MOdel_QUery_Info_Carrier::_models_included: keys are model chain paths, values are the model names only
111 111
     * @return boolean
112 112
     */
113
-    protected function _have_already_included_one_of_these_models($model_names)
114
-    {
115
-        foreach ($this->_models_included as $model_relation_path => $model_included) {
116
-            if (array_key_exists($model_relation_path, $model_names)) {
117
-                return true;
118
-            }
119
-        }
120
-        return false;
121
-    }
113
+	protected function _have_already_included_one_of_these_models($model_names)
114
+	{
115
+		foreach ($this->_models_included as $model_relation_path => $model_included) {
116
+			if (array_key_exists($model_relation_path, $model_names)) {
117
+				return true;
118
+			}
119
+		}
120
+		return false;
121
+	}
122 122
    /**
123 123
     * Array keys are model names, values are "model relation paths". See EE_Model_Query_Info_Carrier::_models_included for details
124 124
     * @return array like EE_Model_Query_Info_Carrier::_models_included
125 125
     */
126
-    public function get_model_names_included()
127
-    {
128
-        return $this->_models_included;
129
-    }
126
+	public function get_model_names_included()
127
+	{
128
+		return $this->_models_included;
129
+	}
130 130
    /**
131 131
     * sets the $where_sql for later use from client code
132 132
     * @param string $where_sql
133 133
     */
134
-    public function set_where_sql($where_sql)
135
-    {
136
-        $this->_where_sql = $where_sql;
137
-    }
138
-    public function get_where_sql()
139
-    {
140
-        return $this->_where_sql;
141
-    }
134
+	public function set_where_sql($where_sql)
135
+	{
136
+		$this->_where_sql = $where_sql;
137
+	}
138
+	public function get_where_sql()
139
+	{
140
+		return $this->_where_sql;
141
+	}
142 142
 
143 143
    /**
144 144
     * Gets the SQL for joining the main model to other models involves in the query, which was set earlier on
145 145
     * the EE_Model_Query_info_Carrier by calling set_main_model_join_sql()
146 146
     * @return string
147 147
     */
148
-    public function get_main_model_join_sql()
149
-    {
150
-        return $this->_main_join_sql;
151
-    }
148
+	public function get_main_model_join_sql()
149
+	{
150
+		return $this->_main_join_sql;
151
+	}
152 152
 
153 153
 
154 154
    /**
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
     * after the FROM and before the WHERE.)
159 159
     * @param string $join_sql
160 160
     */
161
-    public function set_main_model_join_sql($join_sql)
162
-    {
163
-        $this->_main_join_sql = $join_sql;
164
-    }
165
-    public function get_full_join_sql()
166
-    {
167
-        return $this->_main_join_sql . $this->_join_sql;
168
-    }
161
+	public function set_main_model_join_sql($join_sql)
162
+	{
163
+		$this->_main_join_sql = $join_sql;
164
+	}
165
+	public function get_full_join_sql()
166
+	{
167
+		return $this->_main_join_sql . $this->_join_sql;
168
+	}
169 169
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function merge($other_model_query_info_carrier)
97 97
     {
98 98
         if ($other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) {
99
-            $model_included_on_other_join_sql_and_data_types_carrier =  $other_model_query_info_carrier->get_model_names_included();
99
+            $model_included_on_other_join_sql_and_data_types_carrier = $other_model_query_info_carrier->get_model_names_included();
100 100
             $this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier);
101 101
             $this->_join_sql .= $other_model_query_info_carrier->_join_sql;
102 102
         }
@@ -164,6 +164,6 @@  discard block
 block discarded – undo
164 164
     }
165 165
     public function get_full_join_sql()
166 166
     {
167
-        return $this->_main_join_sql . $this->_join_sql;
167
+        return $this->_main_join_sql.$this->_join_sql;
168 168
     }
169 169
 }
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Secondary_Table.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * creates join statement FROM primary table
55 55
      * gets SQL like "LEFT JOIN table_name AS table_alias ON other_table_alias.pk = table_alias.fk
56 56
      *
57
-     * @param string $table allows us to set special conditions on the $table_name portion of the join query (i.e. doing a subquery)
57
+     * @param string $primary_table_alias_with_model_chain_prefix
58 58
      * @return string of SQL
59 59
      */
60 60
     public function get_join_sql($primary_table_alias_with_model_chain_prefix)
@@ -78,6 +78,7 @@  discard block
 block discarded – undo
78 78
      * " LEFT JOIN secondary_table_table AS Secondary ON ..." like get_join_sql, this function returns
79 79
      * " LEFT JOIN primary_table AS Primary ON ...".
80 80
      * This is useful if the secondary table is already included in the SQL, but the primary table is not yet.
81
+     * @param string $secondary_table_alias_with_model_chain_prefix
81 82
      * @return string
82 83
      */
83 84
     public function get_inverse_join_sql($secondary_table_alias_with_model_chain_prefix)
Please login to merge, or discard this patch.
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -7,118 +7,118 @@
 block discarded – undo
7 7
  */
8 8
 class EE_Secondary_Table extends EE_Table_Base
9 9
 {
10
-    protected $_extra_join_conditions;
10
+	protected $_extra_join_conditions;
11 11
 
12
-    /**
13
-     *
14
-     * @global type $wpdb
15
-     * @param string $table_name with or without wpdb prefix
16
-     * @param string $pk_column name of primary key column on THIS table
17
-     * @param string $fk_column the name of the COLUMN that is a foreign key to the primary table's primary key
18
-     * @param string $extra_join_conditions string for additional SQL to add onto the join statement's ON condition
19
-     * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
20
-     *                  or whether each site on a multisite install has a copy of this table
21
-     */
22
-    public function __construct($table_name, $pk_column, $fk_column = null, $extra_join_conditions = null, $global = false)
23
-    {
24
-        $this->_fk_on_table = $fk_column;
25
-        $this->_extra_join_conditions = $extra_join_conditions;
26
-        parent::__construct($table_name, $pk_column, $global);
27
-    }
28
-    public function get_fk_on_table()
29
-    {
30
-        return $this->_fk_on_table;
31
-    }
32
-    public function _construct_finalize_set_table_to_join_with(EE_Table_Base $table)
33
-    {
34
-        $this->_table_to_join_with = $table;
35
-    }
36
-    /**
37
-     *
38
-     * @return string of sql like "Event.post_type = 'event'", which gets added to
39
-     * the end of the join statement with the primary table
40
-     */
41
-    public function get_extra_join_conditions()
42
-    {
43
-        return $this->_extra_join_conditions;
44
-    }
45
-    /**
46
-     *
47
-     * @return EE_Primary_Table
48
-     */
49
-    public function get_table_to_join_with()
50
-    {
51
-        return $this->_table_to_join_with;
52
-    }
53
-    /**
54
-     * creates join statement FROM primary table
55
-     * gets SQL like "LEFT JOIN table_name AS table_alias ON other_table_alias.pk = table_alias.fk
56
-     *
57
-     * @param string $table allows us to set special conditions on the $table_name portion of the join query (i.e. doing a subquery)
58
-     * @return string of SQL
59
-     */
60
-    public function get_join_sql($primary_table_alias_with_model_chain_prefix)
61
-    {
12
+	/**
13
+	 *
14
+	 * @global type $wpdb
15
+	 * @param string $table_name with or without wpdb prefix
16
+	 * @param string $pk_column name of primary key column on THIS table
17
+	 * @param string $fk_column the name of the COLUMN that is a foreign key to the primary table's primary key
18
+	 * @param string $extra_join_conditions string for additional SQL to add onto the join statement's ON condition
19
+	 * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
20
+	 *                  or whether each site on a multisite install has a copy of this table
21
+	 */
22
+	public function __construct($table_name, $pk_column, $fk_column = null, $extra_join_conditions = null, $global = false)
23
+	{
24
+		$this->_fk_on_table = $fk_column;
25
+		$this->_extra_join_conditions = $extra_join_conditions;
26
+		parent::__construct($table_name, $pk_column, $global);
27
+	}
28
+	public function get_fk_on_table()
29
+	{
30
+		return $this->_fk_on_table;
31
+	}
32
+	public function _construct_finalize_set_table_to_join_with(EE_Table_Base $table)
33
+	{
34
+		$this->_table_to_join_with = $table;
35
+	}
36
+	/**
37
+	 *
38
+	 * @return string of sql like "Event.post_type = 'event'", which gets added to
39
+	 * the end of the join statement with the primary table
40
+	 */
41
+	public function get_extra_join_conditions()
42
+	{
43
+		return $this->_extra_join_conditions;
44
+	}
45
+	/**
46
+	 *
47
+	 * @return EE_Primary_Table
48
+	 */
49
+	public function get_table_to_join_with()
50
+	{
51
+		return $this->_table_to_join_with;
52
+	}
53
+	/**
54
+	 * creates join statement FROM primary table
55
+	 * gets SQL like "LEFT JOIN table_name AS table_alias ON other_table_alias.pk = table_alias.fk
56
+	 *
57
+	 * @param string $table allows us to set special conditions on the $table_name portion of the join query (i.e. doing a subquery)
58
+	 * @return string of SQL
59
+	 */
60
+	public function get_join_sql($primary_table_alias_with_model_chain_prefix)
61
+	{
62 62
 
63
-        $table_name = $this->get_table_name();
64
-        $secondary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($primary_table_alias_with_model_chain_prefix) . $this->get_table_alias();
65
-        $other_table_pk = $this->get_table_to_join_with()->get_pk_column();
66
-        $fk = $this->get_fk_on_table();
67
-        $join_sql = " LEFT JOIN $table_name AS $secondary_table_alias ON $primary_table_alias_with_model_chain_prefix.$other_table_pk = $secondary_table_alias.$fk ";
68
-        if ($this->get_extra_join_conditions()) {
69
-            $join_sql.="AND ".$this->get_extra_join_conditions();
70
-        }
71
-        return $join_sql;
72
-    }
63
+		$table_name = $this->get_table_name();
64
+		$secondary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($primary_table_alias_with_model_chain_prefix) . $this->get_table_alias();
65
+		$other_table_pk = $this->get_table_to_join_with()->get_pk_column();
66
+		$fk = $this->get_fk_on_table();
67
+		$join_sql = " LEFT JOIN $table_name AS $secondary_table_alias ON $primary_table_alias_with_model_chain_prefix.$other_table_pk = $secondary_table_alias.$fk ";
68
+		if ($this->get_extra_join_conditions()) {
69
+			$join_sql.="AND ".$this->get_extra_join_conditions();
70
+		}
71
+		return $join_sql;
72
+	}
73 73
 
74 74
 
75
-    /**
76
-     * Produces join SQL like get_join_sql, except instead of joining the primary table to the
77
-     * secondary table, does the inverse: joins the secondary table to the primary one. (Eg, isntead of
78
-     * " LEFT JOIN secondary_table_table AS Secondary ON ..." like get_join_sql, this function returns
79
-     * " LEFT JOIN primary_table AS Primary ON ...".
80
-     * This is useful if the secondary table is already included in the SQL, but the primary table is not yet.
81
-     * @return string
82
-     */
83
-    public function get_inverse_join_sql($secondary_table_alias_with_model_chain_prefix)
84
-    {
85
-        $primary_table_name =$this->get_table_to_join_with()->get_table_name();
86
-        $primary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($secondary_table_alias_with_model_chain_prefix) . $this->get_table_to_join_with()->get_table_alias();
87
-        $primary_table_pk = $this->get_table_to_join_with()->get_pk_column();// $this->get_pk_column();
88
-        $fk = $this->get_fk_on_table();
89
-        $join_sql = " LEFT JOIN $primary_table_name AS $primary_table_alias ON $primary_table_alias.$primary_table_pk = $secondary_table_alias_with_model_chain_prefix.$fk ";
90
-        if ($this->get_extra_join_conditions()) {
91
-            $join_sql.="AND ".$this->get_extra_join_conditions();
92
-        }
93
-        return $join_sql;
94
-    }
75
+	/**
76
+	 * Produces join SQL like get_join_sql, except instead of joining the primary table to the
77
+	 * secondary table, does the inverse: joins the secondary table to the primary one. (Eg, isntead of
78
+	 * " LEFT JOIN secondary_table_table AS Secondary ON ..." like get_join_sql, this function returns
79
+	 * " LEFT JOIN primary_table AS Primary ON ...".
80
+	 * This is useful if the secondary table is already included in the SQL, but the primary table is not yet.
81
+	 * @return string
82
+	 */
83
+	public function get_inverse_join_sql($secondary_table_alias_with_model_chain_prefix)
84
+	{
85
+		$primary_table_name =$this->get_table_to_join_with()->get_table_name();
86
+		$primary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($secondary_table_alias_with_model_chain_prefix) . $this->get_table_to_join_with()->get_table_alias();
87
+		$primary_table_pk = $this->get_table_to_join_with()->get_pk_column();// $this->get_pk_column();
88
+		$fk = $this->get_fk_on_table();
89
+		$join_sql = " LEFT JOIN $primary_table_name AS $primary_table_alias ON $primary_table_alias.$primary_table_pk = $secondary_table_alias_with_model_chain_prefix.$fk ";
90
+		if ($this->get_extra_join_conditions()) {
91
+			$join_sql.="AND ".$this->get_extra_join_conditions();
92
+		}
93
+		return $join_sql;
94
+	}
95 95
 
96
-    /**
97
-     * This prepares the join on the other table using a select with a internal limit.
98
-     * @param  mixed (array|string) $limit limit
99
-     * @return string                       SQL to return
100
-     */
101
-    public function get_select_join_limit_join($limit)
102
-    {
103
-        // first get the select
104
-        $select = $this->get_select_join_limit($limit);
105
-        $join_sql = $this->get_join_sql($select);
106
-        return $join_sql;
107
-    }
96
+	/**
97
+	 * This prepares the join on the other table using a select with a internal limit.
98
+	 * @param  mixed (array|string) $limit limit
99
+	 * @return string                       SQL to return
100
+	 */
101
+	public function get_select_join_limit_join($limit)
102
+	{
103
+		// first get the select
104
+		$select = $this->get_select_join_limit($limit);
105
+		$join_sql = $this->get_join_sql($select);
106
+		return $join_sql;
107
+	}
108 108
 
109 109
 
110 110
 
111
-    public function get_fully_qualified_fk_column()
112
-    {
113
-        $table_alias = $this->get_table_alias();
114
-        $fk = $this->get_fk_on_table();
115
-        return $table_alias . '.' . $fk;
116
-    }
111
+	public function get_fully_qualified_fk_column()
112
+	{
113
+		$table_alias = $this->get_table_alias();
114
+		$fk = $this->get_fk_on_table();
115
+		return $table_alias . '.' . $fk;
116
+	}
117 117
 
118
-    public function get_fully_qualified_pk_on_fk_table()
119
-    {
120
-        $table_alias = $this->get_table_to_join_with()->get_table_alias();
121
-        $pk = $this->get_table_to_join_with()->get_pk_column();
122
-        return $table_alias . '.' . $pk;
123
-    }
118
+	public function get_fully_qualified_pk_on_fk_table()
119
+	{
120
+		$table_alias = $this->get_table_to_join_with()->get_table_alias();
121
+		$pk = $this->get_table_to_join_with()->get_pk_column();
122
+		return $table_alias . '.' . $pk;
123
+	}
124 124
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
     {
62 62
 
63 63
         $table_name = $this->get_table_name();
64
-        $secondary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($primary_table_alias_with_model_chain_prefix) . $this->get_table_alias();
64
+        $secondary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($primary_table_alias_with_model_chain_prefix).$this->get_table_alias();
65 65
         $other_table_pk = $this->get_table_to_join_with()->get_pk_column();
66 66
         $fk = $this->get_fk_on_table();
67 67
         $join_sql = " LEFT JOIN $table_name AS $secondary_table_alias ON $primary_table_alias_with_model_chain_prefix.$other_table_pk = $secondary_table_alias.$fk ";
68 68
         if ($this->get_extra_join_conditions()) {
69
-            $join_sql.="AND ".$this->get_extra_join_conditions();
69
+            $join_sql .= "AND ".$this->get_extra_join_conditions();
70 70
         }
71 71
         return $join_sql;
72 72
     }
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function get_inverse_join_sql($secondary_table_alias_with_model_chain_prefix)
84 84
     {
85
-        $primary_table_name =$this->get_table_to_join_with()->get_table_name();
86
-        $primary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($secondary_table_alias_with_model_chain_prefix) . $this->get_table_to_join_with()->get_table_alias();
87
-        $primary_table_pk = $this->get_table_to_join_with()->get_pk_column();// $this->get_pk_column();
85
+        $primary_table_name = $this->get_table_to_join_with()->get_table_name();
86
+        $primary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($secondary_table_alias_with_model_chain_prefix).$this->get_table_to_join_with()->get_table_alias();
87
+        $primary_table_pk = $this->get_table_to_join_with()->get_pk_column(); // $this->get_pk_column();
88 88
         $fk = $this->get_fk_on_table();
89 89
         $join_sql = " LEFT JOIN $primary_table_name AS $primary_table_alias ON $primary_table_alias.$primary_table_pk = $secondary_table_alias_with_model_chain_prefix.$fk ";
90 90
         if ($this->get_extra_join_conditions()) {
91
-            $join_sql.="AND ".$this->get_extra_join_conditions();
91
+            $join_sql .= "AND ".$this->get_extra_join_conditions();
92 92
         }
93 93
         return $join_sql;
94 94
     }
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $table_alias = $this->get_table_alias();
114 114
         $fk = $this->get_fk_on_table();
115
-        return $table_alias . '.' . $fk;
115
+        return $table_alias.'.'.$fk;
116 116
     }
117 117
 
118 118
     public function get_fully_qualified_pk_on_fk_table()
119 119
     {
120 120
         $table_alias = $this->get_table_to_join_with()->get_table_alias();
121 121
         $pk = $this->get_table_to_join_with()->get_pk_column();
122
-        return $table_alias . '.' . $pk;
122
+        return $table_alias.'.'.$pk;
123 123
     }
124 124
 }
Please login to merge, or discard this patch.
core/db_models/strategies/EE_CPT_Minimum_Where_Conditions.strategy.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,10 @@  discard block
 block discarded – undo
18 18
 
19 19
     protected $_post_type;
20 20
     protected $_meta_field;
21
+
22
+    /**
23
+     * @param string $post_type
24
+     */
21 25
     public function __construct($post_type, $meta_field_to_chk = '')
22 26
     {
23 27
         $this->_post_type = $post_type;
@@ -40,7 +44,6 @@  discard block
 block discarded – undo
40 44
     }
41 45
     /**
42 46
      * Gets the where default where conditions for a custom post type model
43
-     * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
44 47
      * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
45 48
      */
46 49
     protected function _get_default_where_conditions()
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  *
5 5
  * Class EE_CPT_Minimum_Where_Conditions
6
-  *
6
+ *
7 7
  * Strategy specifically for adding where conditions specific to CPT models.
8 8
  * But only sets the minimum, so any row of the right type will get used
9 9
  *
@@ -16,39 +16,39 @@  discard block
 block discarded – undo
16 16
 class EE_CPT_Minimum_Where_Conditions extends EE_Default_Where_Conditions
17 17
 {
18 18
 
19
-    protected $_post_type;
20
-    protected $_meta_field;
21
-    public function __construct($post_type, $meta_field_to_chk = '')
22
-    {
23
-        $this->_post_type = $post_type;
24
-        $this->_meta_field = $meta_field_to_chk;
25
-    }
26
-    /**
27
-     * Gets the field with the specified column. Note, this function might not work
28
-     * properly if two fields refer to columns with the same name on different tables
29
-     * @param string $column column name
30
-     * @return EE_Model_Field_Base
31
-     */
32
-    protected function _get_field_on_column($column)
33
-    {
34
-        $all_fields = $this->_model->field_settings(true);
35
-        foreach ($all_fields as $field_name => $field_obj) {
36
-            if ($column == $field_obj->get_table_column()) {
37
-                return $field_obj;
38
-            }
39
-        }
40
-    }
41
-    /**
42
-     * Gets the where default where conditions for a custom post type model
43
-     * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
44
-     * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
45
-     */
46
-    protected function _get_default_where_conditions()
47
-    {
48
-        // find post_type field
49
-        $post_type_field = $this->_get_field_on_column('post_type');
50
-        return array(
51
-            $post_type_field->get_name() => $this->_post_type
52
-        );
53
-    }
19
+	protected $_post_type;
20
+	protected $_meta_field;
21
+	public function __construct($post_type, $meta_field_to_chk = '')
22
+	{
23
+		$this->_post_type = $post_type;
24
+		$this->_meta_field = $meta_field_to_chk;
25
+	}
26
+	/**
27
+	 * Gets the field with the specified column. Note, this function might not work
28
+	 * properly if two fields refer to columns with the same name on different tables
29
+	 * @param string $column column name
30
+	 * @return EE_Model_Field_Base
31
+	 */
32
+	protected function _get_field_on_column($column)
33
+	{
34
+		$all_fields = $this->_model->field_settings(true);
35
+		foreach ($all_fields as $field_name => $field_obj) {
36
+			if ($column == $field_obj->get_table_column()) {
37
+				return $field_obj;
38
+			}
39
+		}
40
+	}
41
+	/**
42
+	 * Gets the where default where conditions for a custom post type model
43
+	 * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
44
+	 * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
45
+	 */
46
+	protected function _get_default_where_conditions()
47
+	{
48
+		// find post_type field
49
+		$post_type_field = $this->_get_field_on_column('post_type');
50
+		return array(
51
+			$post_type_field->get_name() => $this->_post_type
52
+		);
53
+	}
54 54
 }
Please login to merge, or discard this patch.
core/db_models/strategies/EE_CPT_Where_Conditions.strategy.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 {
17 17
     /**
18 18
      * Gets the where default where conditions for a custom post type model
19
-     * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
20 19
      * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
21 20
      */
22 21
     protected function _get_default_where_conditions()
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  *
5 5
  * Class EE_Default_Where_Conditions
6
-  *
6
+ *
7 7
  * Strategy specifically for adding where conditions specific to CPT models.
8 8
  *
9 9
  * @package         Event Espresso
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class EE_CPT_Where_Conditions extends EE_CPT_Minimum_Where_Conditions
16 16
 {
17
-    /**
18
-     * Gets the where default where conditions for a custom post type model
19
-     * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
20
-     * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
21
-     */
22
-    protected function _get_default_where_conditions()
23
-    {
24
-        $status_field = $this->_get_field_on_column('post_status');
25
-        return array_merge(
26
-            parent::_get_default_where_conditions(),
27
-            array(
28
-                $status_field->get_name() => array('NOT IN',array('auto-draft','trash') )
29
-            )
30
-        );
31
-    }
17
+	/**
18
+	 * Gets the where default where conditions for a custom post type model
19
+	 * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
20
+	 * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
21
+	 */
22
+	protected function _get_default_where_conditions()
23
+	{
24
+		$status_field = $this->_get_field_on_column('post_status');
25
+		return array_merge(
26
+			parent::_get_default_where_conditions(),
27
+			array(
28
+				$status_field->get_name() => array('NOT IN',array('auto-draft','trash') )
29
+			)
30
+		);
31
+	}
32 32
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         return array_merge(
26 26
             parent::_get_default_where_conditions(),
27 27
             array(
28
-                $status_field->get_name() => array('NOT IN',array('auto-draft','trash') )
28
+                $status_field->get_name() => array('NOT IN', array('auto-draft', 'trash'))
29 29
             )
30 30
         );
31 31
     }
Please login to merge, or discard this patch.
core/EE_Deprecated.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1049,7 +1049,7 @@
 block discarded – undo
1049 1049
 
1050 1050
     /**
1051 1051
      * @deprecated 4.9.0
1052
-     * @return array
1052
+     * @return EE_messenger[]
1053 1053
      */
1054 1054
     public function get_installed_messengers()
1055 1055
     {
Please login to merge, or discard this patch.
Indentation   +1121 added lines, -1121 removed lines patch added patch discarded remove patch
@@ -37,31 +37,31 @@  discard block
 block discarded – undo
37 37
  * @param string $action_or_filter
38 38
  */
39 39
 function deprecated_espresso_action_or_filter_doing_it_wrong(
40
-    $deprecated_filter,
41
-    $replacement,
42
-    $replacement_location,
43
-    $version_deprecated,
44
-    $version_applies,
45
-    $action_or_filter = 'action'
40
+	$deprecated_filter,
41
+	$replacement,
42
+	$replacement_location,
43
+	$version_deprecated,
44
+	$version_applies,
45
+	$action_or_filter = 'action'
46 46
 ) {
47
-    $action_or_filter = $action_or_filter === 'action'
48
-        ? esc_html__('action', 'event_espresso')
49
-        : esc_html__('filter', 'event_espresso');
50
-    EE_Error::doing_it_wrong(
51
-        $deprecated_filter,
52
-        sprintf(
53
-            __(
54
-                'This %1$s is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new %1$s: %4$s"%2$s" found in "%3$s"',
55
-                'event_espresso'
56
-            ),
57
-            $action_or_filter,
58
-            $replacement,
59
-            $replacement_location,
60
-            '<br />'
61
-        ),
62
-        $version_deprecated,
63
-        $version_applies
64
-    );
47
+	$action_or_filter = $action_or_filter === 'action'
48
+		? esc_html__('action', 'event_espresso')
49
+		: esc_html__('filter', 'event_espresso');
50
+	EE_Error::doing_it_wrong(
51
+		$deprecated_filter,
52
+		sprintf(
53
+			__(
54
+				'This %1$s is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new %1$s: %4$s"%2$s" found in "%3$s"',
55
+				'event_espresso'
56
+			),
57
+			$action_or_filter,
58
+			$replacement,
59
+			$replacement_location,
60
+			'<br />'
61
+		),
62
+		$version_deprecated,
63
+		$version_applies
64
+	);
65 65
 }
66 66
 
67 67
 /**
@@ -73,90 +73,90 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout)
75 75
 {
76
-    // list of old filters
77
-    $deprecated_filters = array(
78
-        'update_registration_details' => true,
79
-        'process_payment'             => true,
80
-        'finalize_registration'       => true,
81
-        'and_proceed_to_payment'      => true,
82
-        'proceed_to'                  => true,
83
-    );
84
-    // loop thru and call doing_it_wrong() or remove any that aren't being used
85
-    foreach ($deprecated_filters as $deprecated_filter => $on) {
86
-        // was this filter called ?
87
-        if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) {
88
-            // only display doing_it_wrong() notice to Event Admins during non-AJAX requests
89
-            if (EE_Registry::instance()->CAP->current_user_can(
90
-                    'ee_read_ee',
91
-                    'hide_doing_it_wrong_for_deprecated_SPCO_filter'
92
-                ) && ! defined('DOING_AJAX')) {
93
-                EE_Error::doing_it_wrong(
94
-                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
95
-                    sprintf(
96
-                        __(
97
-                            'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"',
98
-                            'event_espresso'
99
-                        ),
100
-                        'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
101
-                        '<br />',
102
-                        'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
103
-                        '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
104
-                    ),
105
-                    '4.6.10'
106
-                );
107
-            }
108
-        } else {
109
-            unset($deprecated_filters[ $deprecated_filter ]);
110
-        }
111
-    }
112
-    if (! empty($deprecated_filters)) {
113
-
114
-        if ($checkout->current_step->slug(
115
-            ) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
116
-            $submit_button_text = apply_filters(
117
-                'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details',
118
-                $submit_button_text
119
-            );
120
-        } elseif ($checkout->current_step->slug(
121
-            ) == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
122
-            $submit_button_text = apply_filters(
123
-                'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment',
124
-                $submit_button_text
125
-            );
126
-        } elseif ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug(
127
-            ) == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
128
-            $submit_button_text = apply_filters(
129
-                'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration',
130
-                $submit_button_text
131
-            );
132
-        }
133
-        if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
134
-            if ($checkout->payment_required() && $checkout->next_step->slug(
135
-                ) == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
136
-                $submit_button_text .= apply_filters(
137
-                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment',
138
-                    $submit_button_text
139
-                );
140
-            }
141
-            if ($checkout->next_step->slug(
142
-                ) != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) {
143
-                $submit_button_text = apply_filters(
144
-                                          'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to',
145
-                                          $submit_button_text
146
-                                      ) . $checkout->next_step->name();
147
-            }
148
-        }
149
-
150
-    }
151
-    return $submit_button_text;
76
+	// list of old filters
77
+	$deprecated_filters = array(
78
+		'update_registration_details' => true,
79
+		'process_payment'             => true,
80
+		'finalize_registration'       => true,
81
+		'and_proceed_to_payment'      => true,
82
+		'proceed_to'                  => true,
83
+	);
84
+	// loop thru and call doing_it_wrong() or remove any that aren't being used
85
+	foreach ($deprecated_filters as $deprecated_filter => $on) {
86
+		// was this filter called ?
87
+		if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) {
88
+			// only display doing_it_wrong() notice to Event Admins during non-AJAX requests
89
+			if (EE_Registry::instance()->CAP->current_user_can(
90
+					'ee_read_ee',
91
+					'hide_doing_it_wrong_for_deprecated_SPCO_filter'
92
+				) && ! defined('DOING_AJAX')) {
93
+				EE_Error::doing_it_wrong(
94
+					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
95
+					sprintf(
96
+						__(
97
+							'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"',
98
+							'event_espresso'
99
+						),
100
+						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
101
+						'<br />',
102
+						'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
103
+						'/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
104
+					),
105
+					'4.6.10'
106
+				);
107
+			}
108
+		} else {
109
+			unset($deprecated_filters[ $deprecated_filter ]);
110
+		}
111
+	}
112
+	if (! empty($deprecated_filters)) {
113
+
114
+		if ($checkout->current_step->slug(
115
+			) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
116
+			$submit_button_text = apply_filters(
117
+				'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details',
118
+				$submit_button_text
119
+			);
120
+		} elseif ($checkout->current_step->slug(
121
+			) == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
122
+			$submit_button_text = apply_filters(
123
+				'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment',
124
+				$submit_button_text
125
+			);
126
+		} elseif ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug(
127
+			) == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
128
+			$submit_button_text = apply_filters(
129
+				'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration',
130
+				$submit_button_text
131
+			);
132
+		}
133
+		if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
134
+			if ($checkout->payment_required() && $checkout->next_step->slug(
135
+				) == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
136
+				$submit_button_text .= apply_filters(
137
+					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment',
138
+					$submit_button_text
139
+				);
140
+			}
141
+			if ($checkout->next_step->slug(
142
+				) != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) {
143
+				$submit_button_text = apply_filters(
144
+										  'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to',
145
+										  $submit_button_text
146
+									  ) . $checkout->next_step->name();
147
+			}
148
+		}
149
+
150
+	}
151
+	return $submit_button_text;
152 152
 
153 153
 }
154 154
 
155 155
 add_filter(
156
-    'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
157
-    'ee_deprecated__registration_checkout__button_text',
158
-    10,
159
-    2
156
+	'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
157
+	'ee_deprecated__registration_checkout__button_text',
158
+	10,
159
+	2
160 160
 );
161 161
 
162 162
 
@@ -168,54 +168,54 @@  discard block
 block discarded – undo
168 168
  */
169 169
 function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates)
170 170
 {
171
-    $action_ref = null;
172
-    $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction')
173
-        ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
174
-    $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction')
175
-        ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
176
-    if ($action_ref) {
177
-
178
-        EE_Error::doing_it_wrong(
179
-            $action_ref,
180
-            sprintf(
181
-                __(
182
-                    'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"',
183
-                    'event_espresso'
184
-                ),
185
-                '<br />',
186
-                '/core/business/EE_Transaction_Processor.class.php',
187
-                'AHEE__EE_Transaction_Processor__finalize',
188
-                'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
189
-                'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events',
190
-                'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing'
191
-            ),
192
-            '4.6.0'
193
-        );
194
-        switch ($action_ref) {
195
-            case 'AHEE__EE_Transaction__finalize__new_transaction' :
196
-                do_action(
197
-                    'AHEE__EE_Transaction__finalize__new_transaction',
198
-                    $checkout->transaction,
199
-                    $checkout->admin_request
200
-                );
201
-                break;
202
-            case 'AHEE__EE_Transaction__finalize__all_transaction' :
203
-                do_action(
204
-                    'AHEE__EE_Transaction__finalize__new_transaction',
205
-                    $checkout->transaction,
206
-                    array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates),
207
-                    $checkout->admin_request
208
-                );
209
-                break;
210
-        }
211
-    }
171
+	$action_ref = null;
172
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction')
173
+		? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
174
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction')
175
+		? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
176
+	if ($action_ref) {
177
+
178
+		EE_Error::doing_it_wrong(
179
+			$action_ref,
180
+			sprintf(
181
+				__(
182
+					'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"',
183
+					'event_espresso'
184
+				),
185
+				'<br />',
186
+				'/core/business/EE_Transaction_Processor.class.php',
187
+				'AHEE__EE_Transaction_Processor__finalize',
188
+				'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
189
+				'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events',
190
+				'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing'
191
+			),
192
+			'4.6.0'
193
+		);
194
+		switch ($action_ref) {
195
+			case 'AHEE__EE_Transaction__finalize__new_transaction' :
196
+				do_action(
197
+					'AHEE__EE_Transaction__finalize__new_transaction',
198
+					$checkout->transaction,
199
+					$checkout->admin_request
200
+				);
201
+				break;
202
+			case 'AHEE__EE_Transaction__finalize__all_transaction' :
203
+				do_action(
204
+					'AHEE__EE_Transaction__finalize__new_transaction',
205
+					$checkout->transaction,
206
+					array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates),
207
+					$checkout->admin_request
208
+				);
209
+				break;
210
+		}
211
+	}
212 212
 }
213 213
 
214 214
 add_action(
215
-    'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed',
216
-    'ee_deprecated_finalize_transaction',
217
-    10,
218
-    2
215
+	'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed',
216
+	'ee_deprecated_finalize_transaction',
217
+	10,
218
+	2
219 219
 );
220 220
 /**
221 221
  * ee_deprecated_finalize_registration
@@ -224,35 +224,35 @@  discard block
 block discarded – undo
224 224
  */
225 225
 function ee_deprecated_finalize_registration(EE_Registration $registration)
226 226
 {
227
-    $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg')
228
-        ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : null;
229
-    if ($action_ref) {
230
-        EE_Error::doing_it_wrong(
231
-            $action_ref,
232
-            sprintf(
233
-                __(
234
-                    'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"',
235
-                    'event_espresso'
236
-                ),
237
-                '<br />',
238
-                '/core/business/EE_Registration_Processor.class.php',
239
-                'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook'
240
-            ),
241
-            '4.6.0'
242
-        );
243
-        do_action(
244
-            'AHEE__EE_Registration__finalize__update_and_new_reg',
245
-            $registration,
246
-            (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))
247
-        );
248
-    }
227
+	$action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg')
228
+		? 'AHEE__EE_Registration__finalize__update_and_new_reg' : null;
229
+	if ($action_ref) {
230
+		EE_Error::doing_it_wrong(
231
+			$action_ref,
232
+			sprintf(
233
+				__(
234
+					'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"',
235
+					'event_espresso'
236
+				),
237
+				'<br />',
238
+				'/core/business/EE_Registration_Processor.class.php',
239
+				'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook'
240
+			),
241
+			'4.6.0'
242
+		);
243
+		do_action(
244
+			'AHEE__EE_Registration__finalize__update_and_new_reg',
245
+			$registration,
246
+			(is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))
247
+		);
248
+	}
249 249
 }
250 250
 
251 251
 add_action(
252
-    'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
253
-    'ee_deprecated_finalize_registration',
254
-    10,
255
-    1
252
+	'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
253
+	'ee_deprecated_finalize_registration',
254
+	10,
255
+	1
256 256
 );
257 257
 
258 258
 
@@ -262,44 +262,44 @@  discard block
 block discarded – undo
262 262
  */
263 263
 function ee_deprecated_hooks()
264 264
 {
265
-    /**
266
-     * @var          $hooks       array where keys are hook names, and their values are array{
267
-     * @type string  $version     when deprecated
268
-     * @type string  $alternative saying what to use instead
269
-     * @type boolean $still_works whether or not the hook still works
270
-     *        }
271
-     */
272
-    $hooks = array(
273
-        'AHEE__EE_System___do_setup_validations' => array(
274
-            'version'     => '4.6.0',
275
-            'alternative' => __(
276
-                'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)',
277
-                'event_espresso'
278
-            ),
279
-            'still_works' => false,
280
-        ),
281
-    );
282
-    foreach ($hooks as $name => $deprecation_info) {
283
-        if (has_action($name)) {
284
-            EE_Error::doing_it_wrong(
285
-                $name,
286
-                sprintf(
287
-                    __('This filter is deprecated. %1$s%2$s', 'event_espresso'),
288
-                    $deprecation_info['still_works'] ? __(
289
-                        'It *may* work as an attempt to build in backwards compatibility.',
290
-                        'event_espresso'
291
-                    ) : __('It has been completely removed.', 'event_espresso'),
292
-                    isset($deprecation_info['alternative'])
293
-                        ? $deprecation_info['alternative']
294
-                        : __(
295
-                        'Please read the current EE4 documentation further or contact Support.',
296
-                        'event_espresso'
297
-                    )
298
-                ),
299
-                isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso')
300
-            );
301
-        }
302
-    }
265
+	/**
266
+	 * @var          $hooks       array where keys are hook names, and their values are array{
267
+	 * @type string  $version     when deprecated
268
+	 * @type string  $alternative saying what to use instead
269
+	 * @type boolean $still_works whether or not the hook still works
270
+	 *        }
271
+	 */
272
+	$hooks = array(
273
+		'AHEE__EE_System___do_setup_validations' => array(
274
+			'version'     => '4.6.0',
275
+			'alternative' => __(
276
+				'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)',
277
+				'event_espresso'
278
+			),
279
+			'still_works' => false,
280
+		),
281
+	);
282
+	foreach ($hooks as $name => $deprecation_info) {
283
+		if (has_action($name)) {
284
+			EE_Error::doing_it_wrong(
285
+				$name,
286
+				sprintf(
287
+					__('This filter is deprecated. %1$s%2$s', 'event_espresso'),
288
+					$deprecation_info['still_works'] ? __(
289
+						'It *may* work as an attempt to build in backwards compatibility.',
290
+						'event_espresso'
291
+					) : __('It has been completely removed.', 'event_espresso'),
292
+					isset($deprecation_info['alternative'])
293
+						? $deprecation_info['alternative']
294
+						: __(
295
+						'Please read the current EE4 documentation further or contact Support.',
296
+						'event_espresso'
297
+					)
298
+				),
299
+				isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso')
300
+			);
301
+		}
302
+	}
303 303
 }
304 304
 
305 305
 add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks');
@@ -314,34 +314,34 @@  discard block
 block discarded – undo
314 314
  */
315 315
 function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
316 316
 {
317
-    $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns')
318
-              || has_action(
319
-                  'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'
320
-              );
321
-    if ($in_use) {
322
-        $msg = __(
323
-            'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.'
324
-            . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,'
325
-            . 'use FHEE__EE_Form_Section_Proper__receive_form_submission__req_data to customize the submission data, or AHEE__EE_Form_Section_Proper__receive_form_submission__end '
326
-            . 'to add other actions after a form submission has been received.',
327
-            'event_espresso'
328
-        );
329
-        EE_Error::doing_it_wrong(
330
-            __CLASS__ . '::' . __FUNCTION__,
331
-            $msg,
332
-            '4.8.32.rc.000'
333
-        );
334
-        // it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed
335
-        if (is_admin() && ! defined('DOING_AJAX')) {
336
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
337
-        }
338
-    }
339
-    return $in_use;
317
+	$in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns')
318
+			  || has_action(
319
+				  'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'
320
+			  );
321
+	if ($in_use) {
322
+		$msg = __(
323
+			'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.'
324
+			. 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,'
325
+			. 'use FHEE__EE_Form_Section_Proper__receive_form_submission__req_data to customize the submission data, or AHEE__EE_Form_Section_Proper__receive_form_submission__end '
326
+			. 'to add other actions after a form submission has been received.',
327
+			'event_espresso'
328
+		);
329
+		EE_Error::doing_it_wrong(
330
+			__CLASS__ . '::' . __FUNCTION__,
331
+			$msg,
332
+			'4.8.32.rc.000'
333
+		);
334
+		// it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed
335
+		if (is_admin() && ! defined('DOING_AJAX')) {
336
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
337
+		}
338
+	}
339
+	return $in_use;
340 340
 }
341 341
 
342 342
 add_action(
343
-    'AHEE__Registrations_Admin_Page___registration_details_metabox__start',
344
-    'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'
343
+	'AHEE__Registrations_Admin_Page___registration_details_metabox__start',
344
+	'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'
345 345
 );
346 346
 
347 347
 /**
@@ -353,77 +353,77 @@  discard block
 block discarded – undo
353 353
  */
354 354
 function ee_deprecated_update_attendee_registration_form_old($admin_page)
355 355
 {
356
-    // check if the old hooks are in use. If not, do the default
357
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
358
-        || ! $admin_page instanceof EE_Admin_Page) {
359
-        return;
360
-    }
361
-    $req_data = $admin_page->get_request_data();
362
-    $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false;
363
-    $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false;
364
-    $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
365
-    if (! $REG_ID || ! $qstns) {
366
-        EE_Error::add_error(
367
-            __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'),
368
-            __FILE__,
369
-            __FUNCTION__,
370
-            __LINE__
371
-        );
372
-    }
373
-    $success = true;
374
-
375
-    // allow others to get in on this awesome fun   :D
376
-    do_action(
377
-        'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save',
378
-        $REG_ID,
379
-        $qstns
380
-    );
381
-    // loop thru questions... FINALLY!!!
382
-
383
-    foreach ($qstns as $QST_ID => $qstn) {
384
-        // if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
385
-        if (! is_array($qstn)) {
386
-            $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
387
-            continue;
388
-        }
389
-
390
-
391
-        foreach ($qstn as $ANS_ID => $ANS_value) {
392
-            // get answer
393
-            $query_params = array(
394
-                0 => array(
395
-                    'ANS_ID' => $ANS_ID,
396
-                    'REG_ID' => $REG_ID,
397
-                    'QST_ID' => $QST_ID,
398
-                ),
399
-            );
400
-            $answer = EEM_Answer::instance()->get_one($query_params);
401
-            // this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
402
-            if (! $answer instanceof EE_Answer) {
403
-                $set_values = array(
404
-                    'QST_ID'    => $QST_ID,
405
-                    'REG_ID'    => $REG_ID,
406
-                    'ANS_value' => $qstn,
407
-                );
408
-                $success = EEM_Answer::instance()->insert($set_values);
409
-                continue 2;
410
-            }
411
-
412
-            $answer->set('ANS_value', $ANS_value);
413
-            $success = $answer->save();
414
-        }
415
-    }
416
-    $what = __('Registration Form', 'event_espresso');
417
-    $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
418
-    $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
419
-    exit;
356
+	// check if the old hooks are in use. If not, do the default
357
+	if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
358
+		|| ! $admin_page instanceof EE_Admin_Page) {
359
+		return;
360
+	}
361
+	$req_data = $admin_page->get_request_data();
362
+	$qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false;
363
+	$REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false;
364
+	$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
365
+	if (! $REG_ID || ! $qstns) {
366
+		EE_Error::add_error(
367
+			__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'),
368
+			__FILE__,
369
+			__FUNCTION__,
370
+			__LINE__
371
+		);
372
+	}
373
+	$success = true;
374
+
375
+	// allow others to get in on this awesome fun   :D
376
+	do_action(
377
+		'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save',
378
+		$REG_ID,
379
+		$qstns
380
+	);
381
+	// loop thru questions... FINALLY!!!
382
+
383
+	foreach ($qstns as $QST_ID => $qstn) {
384
+		// if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
385
+		if (! is_array($qstn)) {
386
+			$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
387
+			continue;
388
+		}
389
+
390
+
391
+		foreach ($qstn as $ANS_ID => $ANS_value) {
392
+			// get answer
393
+			$query_params = array(
394
+				0 => array(
395
+					'ANS_ID' => $ANS_ID,
396
+					'REG_ID' => $REG_ID,
397
+					'QST_ID' => $QST_ID,
398
+				),
399
+			);
400
+			$answer = EEM_Answer::instance()->get_one($query_params);
401
+			// this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
402
+			if (! $answer instanceof EE_Answer) {
403
+				$set_values = array(
404
+					'QST_ID'    => $QST_ID,
405
+					'REG_ID'    => $REG_ID,
406
+					'ANS_value' => $qstn,
407
+				);
408
+				$success = EEM_Answer::instance()->insert($set_values);
409
+				continue 2;
410
+			}
411
+
412
+			$answer->set('ANS_value', $ANS_value);
413
+			$success = $answer->save();
414
+		}
415
+	}
416
+	$what = __('Registration Form', 'event_espresso');
417
+	$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
418
+	$admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
419
+	exit;
420 420
 }
421 421
 
422 422
 add_action(
423
-    'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start',
424
-    'ee_deprecated_update_attendee_registration_form_old',
425
-    10,
426
-    1
423
+	'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start',
424
+	'ee_deprecated_update_attendee_registration_form_old',
425
+	10,
426
+	1
427 427
 );
428 428
 /**
429 429
  * Render the registration admin page's custom questions area in the old fashion
@@ -439,50 +439,50 @@  discard block
 block discarded – undo
439 439
  */
440 440
 function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration)
441 441
 {
442
-    // check if the old hooks are in use. If not, do the default
443
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
444
-        || ! $admin_page instanceof EE_Admin_Page) {
445
-        return $do_default_action;
446
-    }
447
-    add_filter(
448
-        'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',
449
-        array($admin_page, 'form_before_question_group'),
450
-        10,
451
-        1
452
-    );
453
-    add_filter(
454
-        'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',
455
-        array($admin_page, 'form_after_question_group'),
456
-        10,
457
-        1
458
-    );
459
-    add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1);
460
-    add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1);
461
-
462
-    $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options(
463
-        $registration,
464
-        $registration->get(
465
-            'EVT_ID'
466
-        )
467
-    );
468
-
469
-    EE_Registry::instance()->load_helper('Form_Fields');
470
-    $template_args = array(
471
-        'att_questions'             => EEH_Form_Fields::generate_question_groups_html($question_groups),
472
-        'reg_questions_form_action' => 'edit_registration',
473
-        'REG_ID'                    => $registration->ID(),
474
-    );
475
-    $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
476
-    echo EEH_Template::display_template($template_path, $template_args, true);
477
-    // indicate that we should not do the default admin page code
478
-    return false;
442
+	// check if the old hooks are in use. If not, do the default
443
+	if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
444
+		|| ! $admin_page instanceof EE_Admin_Page) {
445
+		return $do_default_action;
446
+	}
447
+	add_filter(
448
+		'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',
449
+		array($admin_page, 'form_before_question_group'),
450
+		10,
451
+		1
452
+	);
453
+	add_filter(
454
+		'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',
455
+		array($admin_page, 'form_after_question_group'),
456
+		10,
457
+		1
458
+	);
459
+	add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1);
460
+	add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1);
461
+
462
+	$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options(
463
+		$registration,
464
+		$registration->get(
465
+			'EVT_ID'
466
+		)
467
+	);
468
+
469
+	EE_Registry::instance()->load_helper('Form_Fields');
470
+	$template_args = array(
471
+		'att_questions'             => EEH_Form_Fields::generate_question_groups_html($question_groups),
472
+		'reg_questions_form_action' => 'edit_registration',
473
+		'REG_ID'                    => $registration->ID(),
474
+	);
475
+	$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
476
+	echo EEH_Template::display_template($template_path, $template_args, true);
477
+	// indicate that we should not do the default admin page code
478
+	return false;
479 479
 }
480 480
 
481 481
 add_action(
482
-    'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default',
483
-    'ee_deprecated_reg_questions_meta_box_old',
484
-    10,
485
-    3
482
+	'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default',
483
+	'ee_deprecated_reg_questions_meta_box_old',
484
+	10,
485
+	3
486 486
 );
487 487
 
488 488
 
@@ -499,42 +499,42 @@  discard block
 block discarded – undo
499 499
 class EE_Message_Template_Defaults extends EE_Base
500 500
 {
501 501
 
502
-    /**
503
-     * EE_Message_Template_Defaults constructor.
504
-     *
505
-     * @param EE_messages $messages
506
-     * @param             $messenger_name
507
-     * @param             $message_type_name
508
-     * @param int         $GRP_ID
509
-     * @return EE_Messages_Template_Defaults
510
-     */
511
-    public function __construct(
512
-        EE_messages $messages,
513
-        $messenger_name,
514
-        $message_type_name,
515
-        $GRP_ID = 0
516
-    ) {
517
-        EE_Error::doing_it_wrong(
518
-            __FUNCTION__,
519
-            __(
520
-                'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.',
521
-                'event_espresso'
522
-            ),
523
-            '4.9.0'
524
-        );
525
-        /** @var EE_Message_Resource_Manager $message_resource_manager */
526
-        $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
527
-        $messenger = $message_resource_manager->get_messenger($messenger_name);
528
-        $message_type = $message_resource_manager->get_message_type($message_type_name);
529
-        return EE_Registry::instance()->load_lib(
530
-            'Messages_Template_Defaults',
531
-            array(
532
-                $GRP_ID,
533
-                $messenger,
534
-                $message_type,
535
-            )
536
-        );
537
-    }
502
+	/**
503
+	 * EE_Message_Template_Defaults constructor.
504
+	 *
505
+	 * @param EE_messages $messages
506
+	 * @param             $messenger_name
507
+	 * @param             $message_type_name
508
+	 * @param int         $GRP_ID
509
+	 * @return EE_Messages_Template_Defaults
510
+	 */
511
+	public function __construct(
512
+		EE_messages $messages,
513
+		$messenger_name,
514
+		$message_type_name,
515
+		$GRP_ID = 0
516
+	) {
517
+		EE_Error::doing_it_wrong(
518
+			__FUNCTION__,
519
+			__(
520
+				'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.',
521
+				'event_espresso'
522
+			),
523
+			'4.9.0'
524
+		);
525
+		/** @var EE_Message_Resource_Manager $message_resource_manager */
526
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
527
+		$messenger = $message_resource_manager->get_messenger($messenger_name);
528
+		$message_type = $message_resource_manager->get_message_type($message_type_name);
529
+		return EE_Registry::instance()->load_lib(
530
+			'Messages_Template_Defaults',
531
+			array(
532
+				$GRP_ID,
533
+				$messenger,
534
+				$message_type,
535
+			)
536
+		);
537
+	}
538 538
 }
539 539
 
540 540
 
@@ -552,525 +552,525 @@  discard block
 block discarded – undo
552 552
 class EE_messages
553 553
 {
554 554
 
555
-    /** @type EE_messenger[] */
556
-    protected $_active_messengers = array();
557
-
558
-    /** @type array */
559
-    protected $_active_message_types = array();
560
-
561
-    /** @type EE_message_type[] */
562
-    protected $_installed_message_types = array();
563
-
564
-    /** @type EE_messenger */
565
-    protected $_messenger;
566
-
567
-    /** @type EE_message_type */
568
-    protected $_message_type;
569
-
570
-    /** @type array */
571
-    protected $_contexts = array();
572
-
573
-    /** @type EE_Message_Resource_Manager $_message_resource_manager */
574
-    protected $_message_resource_manager;
575
-
576
-
577
-    /**
578
-     * EE_messages constructor.
579
-     *
580
-     * @deprecated 4.9.0
581
-     */
582
-    public function __construct()
583
-    {
584
-    }
585
-
586
-
587
-    /**
588
-     * @param string $method
589
-     */
590
-    public function _class_is_deprecated($method)
591
-    {
592
-        EE_Error::doing_it_wrong(
593
-            'EE_messages::' . $method,
594
-            __('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
595
-            '4.9.0',
596
-            '4.10.0.p'
597
-        );
598
-        // Please use EE_Message_Resource_Manager instead
599
-        $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
600
-    }
601
-
602
-
603
-    /**
604
-     * @deprecated 4.9.0
605
-     * @param string $messenger_name
606
-     * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive
607
-     */
608
-    public function ensure_messenger_is_active($messenger_name)
609
-    {
610
-        // EE_messages has been deprecated
611
-        $this->_class_is_deprecated(__FUNCTION__);
612
-        return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name);
613
-    }
614
-
615
-
616
-    /**
617
-     * @deprecated 4.9.0
618
-     * @param string $message_type message type name
619
-     * @param        $messenger
620
-     * @return bool true if it got activated (or was active) and false if not.
621
-     * @throws \EE_Error
622
-     */
623
-    public function ensure_message_type_is_active($message_type, $messenger)
624
-    {
625
-        // EE_messages has been deprecated
626
-        $this->_class_is_deprecated(__FUNCTION__);
627
-        return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger);
628
-    }
629
-
630
-
631
-    /**
632
-     * @deprecated 4.9.0
633
-     * @param string $messenger_name
634
-     * @param array  $mts_to_activate             (optional) An array of message types to activate with this messenger.
635
-     *                                             If included we do NOT setup the default message types (assuming they
636
-     *                                             are already setup.)
637
-     * @return boolean an array of generated templates or false if nothing generated/activated.
638
-     */
639
-    public function activate_messenger($messenger_name, $mts_to_activate = array())
640
-    {
641
-        // EE_messages has been deprecated
642
-        $this->_class_is_deprecated(__FUNCTION__);
643
-        return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate);
644
-    }
645
-
646
-
647
-    /**
648
-     * @deprecated 4.9.0
649
-     * @param EE_messenger    $messenger    messenger used in trigger
650
-     * @param EE_message_type $message_type message type used in trigger
651
-     *
652
-     * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
653
-     */
654
-    public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type)
655
-    {
656
-        // EE_messages has been deprecated
657
-        $this->_class_is_deprecated(__FUNCTION__);
658
-        return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type);
659
-    }
660
-
661
-
662
-    /**
663
-     * @deprecated 4.9.0
664
-     * @param string $messenger
665
-     * @return EE_messenger | null
666
-     */
667
-    public function get_messenger_if_active($messenger)
668
-    {
669
-        // EE_messages has been deprecated
670
-        $this->_class_is_deprecated(__FUNCTION__);
671
-        return $this->_message_resource_manager->get_active_messenger($messenger);
672
-    }
673
-
674
-
675
-    /**
676
-     * @deprecated 4.9.0
677
-     * @param EE_Message $message
678
-     * @return array  An array with 'messenger' and 'message_type' as the index and the corresponding valid object if
679
-     *                  available.
680
-     *                  Eg. Valid Messenger and Message Type:
681
-     *                  array(
682
-     *                  'messenger' => new EE_Email_messenger(),
683
-     *                  'message_type' => new EE_Registration_Approved_message_type()
684
-     *                  )
685
-     *                  Valid Messenger and Invalid Message Type:
686
-     *                  array(
687
-     *                  'messenger' => new EE_Email_messenger(),
688
-     *                  'message_type' => null
689
-     *                  )
690
-     */
691
-    public function validate_for_use(EE_Message $message)
692
-    {
693
-        // EE_messages has been deprecated
694
-        $this->_class_is_deprecated(__FUNCTION__);
695
-        return array(
696
-            'messenger'    => $message->messenger_object(),
697
-            'message_type' => $message->message_type_object(),
698
-        );
699
-    }
700
-
701
-
702
-    /**
703
-     * @deprecated 4.9.0
704
-     * @param  string $type                 What type of message are we sending (corresponds to message types)
705
-     * @param  mixed  $vars                 Data being sent for parsing in the message
706
-     * @param  string $sending_messenger    if included then we ONLY use the specified messenger for delivery.
707
-     *                                      Otherwise we cycle through all active messengers.
708
-     * @param string  $generating_messenger if included then this messenger is used for generating the message
709
-     *                                      templates (but not for sending).
710
-     * @param string  $context              If included then only a message type for a specific context will be
711
-     *                                      generated.
712
-     * @param bool    $send                 Default TRUE.  If false, then this will just return the generated
713
-     *                                      EE_messages objects which might be used by the trigger to setup a batch
714
-     *                                      message (typically html messenger uses it).
715
-     * @return bool
716
-     */
717
-    public function send_message(
718
-        $type,
719
-        $vars,
720
-        $sending_messenger = '',
721
-        $generating_messenger = '',
722
-        $context = '',
723
-        $send = true
724
-    ) {
725
-        // EE_messages has been deprecated
726
-        $this->_class_is_deprecated(__FUNCTION__);
727
-        /** @type EE_Messages_Processor $processor */
728
-        $processor = EE_Registry::instance()->load_lib('Messages_Processor');
729
-        $error = false;
730
-        // try to intelligently determine what method we'll call based on the incoming data.
731
-        // if generating and sending are different then generate and send immediately.
732
-        if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
733
-            // in the legacy system, when generating and sending were different, that means all the
734
-            // vars are already in the request object.  So let's just use that.
735
-            try {
736
-                /** @type EE_Message_To_Generate_From_Request $mtg */
737
-                $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
738
-                $processor->generate_and_send_now($mtg);
739
-            } catch (EE_Error $e) {
740
-                $error_msg = __(
741
-                    'Please note that a system message failed to send due to a technical issue.',
742
-                    'event_espresso'
743
-                );
744
-                // add specific message for developers if WP_DEBUG in on
745
-                $error_msg .= '||' . $e->getMessage();
746
-                EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
747
-                $error = true;
748
-            }
749
-        } else {
750
-            $processor->generate_for_all_active_messengers($type, $vars, $send);
751
-            // let's find out if there were any errors and how many successfully were queued.
752
-            $count_errors = $processor->get_queue()->count_STS_in_queue(
753
-                array(EEM_Message::status_failed, EEM_Message::status_debug_only)
754
-            );
755
-            $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
756
-            $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry);
757
-            $count_errors = $count_errors + $count_retry;
758
-            if ($count_errors > 0) {
759
-                $error = true;
760
-                if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) {
761
-                    $message = sprintf(
762
-                        __(
763
-                            'There were %d errors and %d messages successfully queued for generation and sending',
764
-                            'event_espresso'
765
-                        ),
766
-                        $count_errors,
767
-                        $count_queued
768
-                    );
769
-                } elseif ($count_errors > 1 && $count_queued === 1) {
770
-                    $message = sprintf(
771
-                        __(
772
-                            'There were %d errors and %d message successfully queued for generation.',
773
-                            'event_espresso'
774
-                        ),
775
-                        $count_errors,
776
-                        $count_queued
777
-                    );
778
-                } elseif ($count_errors === 1 && $count_queued > 1) {
779
-                    $message = sprintf(
780
-                        __(
781
-                            'There was %d error and %d messages successfully queued for generation.',
782
-                            'event_espresso'
783
-                        ),
784
-                        $count_errors,
785
-                        $count_queued
786
-                    );
787
-                } else {
788
-                    $message = sprintf(
789
-                        __(
790
-                            'There was %d message that failed to be queued for generation.',
791
-                            'event_espresso'
792
-                        ),
793
-                        $count_errors
794
-                    );
795
-                }
796
-                EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__);
797
-            } else {
798
-                if ($count_queued === 1) {
799
-                    $message = sprintf(
800
-                        __(
801
-                            '%d message successfully queued for generation.',
802
-                            'event_espresso'
803
-                        ),
804
-                        $count_queued
805
-                    );
806
-                } else {
807
-                    $message = sprintf(
808
-                        __(
809
-                            '%d messages were successfully queued for generation.',
810
-                            'event_espresso'
811
-                        ),
812
-                        $count_queued
813
-                    );
814
-                }
815
-                EE_Error::add_success($message);
816
-            }
817
-        }
818
-        // if no error then return the generated message(s).
819
-        if (! $error && ! $send) {
820
-            $generated_queue = $processor->generate_queue(false);
821
-            // get message and return.
822
-            $generated_queue->get_message_repository()->rewind();
823
-            $messages = array();
824
-            while ($generated_queue->get_message_repository()->valid()) {
825
-                $message = $generated_queue->get_message_repository()->current();
826
-                if ($message instanceof EE_Message) {
827
-                    // set properties that might be expected by add-ons (backward compat)
828
-                    $message->content = $message->content();
829
-                    $message->template_pack = $message->get_template_pack();
830
-                    $message->template_variation = $message->get_template_pack_variation();
831
-                    $messages[] = $message;
832
-                }
833
-                $generated_queue->get_message_repository()->next();
834
-            }
835
-            return $messages;
836
-        }
837
-        return $error ? false
838
-            : true; // yeah backwards eh?  Really what we're returning is if there is a total success for all the messages or not.  We'll modify this once we get message recording in place.
839
-    }
840
-
841
-
842
-    /**
843
-     * @deprecated 4.9.0
844
-     * @param  string $type      This should correspond with a valid message type
845
-     * @param  string $context   This should correspond with a valid context for the message type
846
-     * @param  string $messenger This should correspond with a valid messenger.
847
-     * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular
848
-     *                           preview
849
-     * @return string          The body of the message.
850
-     */
851
-    public function preview_message($type, $context, $messenger, $send = false)
852
-    {
853
-        // EE_messages has been deprecated
854
-        $this->_class_is_deprecated(__FUNCTION__);
855
-        return EED_Messages::preview_message($type, $context, $messenger, $send);
856
-    }
857
-
858
-
859
-    /**
860
-     * @since      4.5.0
861
-     * @deprecated 4.9.0   Moved to EED_Messages Module
862
-     * @param string   $messenger    a string matching a valid active messenger in the system
863
-     * @param string   $message_type Although it seems contrary to the name of the method, a message type name is still
864
-     *                               required to send along the message type to the messenger because this is used for
865
-     *                               determining what specific variations might be loaded for the generated message.
866
-     * @param stdClass $message      a stdClass object in the format expected by the messenger.
867
-     *
868
-     * @return bool          success or fail.
869
-     */
870
-    public function send_message_with_messenger_only($messenger, $message_type, $message)
871
-    {
872
-        // EE_messages has been deprecated
873
-        $this->_class_is_deprecated(__FUNCTION__);
874
-        // setup for sending to new method.
875
-        /** @type EE_Messages_Queue $queue */
876
-        $queue = EE_Registry::instance()->load_lib('Messages_Queue');
877
-        // make sure we have a proper message object
878
-        if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
879
-            $msg = EE_Message_Factory::create(
880
-                array(
881
-                    'MSG_messenger'    => $messenger,
882
-                    'MSG_message_type' => $message_type,
883
-                    'MSG_content'      => $message->content,
884
-                    'MSG_subject'      => $message->subject,
885
-                )
886
-            );
887
-        } else {
888
-            $msg = $message;
889
-        }
890
-        if (! $msg instanceof EE_Message) {
891
-            return false;
892
-        }
893
-        // make sure any content in a content property (if not empty) is set on the MSG_content.
894
-        if (! empty($msg->content)) {
895
-            $msg->set('MSG_content', $msg->content);
896
-        }
897
-        $queue->add($msg);
898
-        return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue);
899
-    }
900
-
901
-
902
-    /**
903
-     * @deprecated 4.9.0
904
-     * @param         $messenger
905
-     * @param  string $message_type message type that the templates are being created for
906
-     * @param int     $GRP_ID
907
-     * @param bool    $is_global
908
-     * @return array|object if creation is successful then we return an array of info, otherwise an error_object is
909
-     *                      returned.
910
-     * @throws \EE_Error
911
-     */
912
-    public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false)
913
-    {
914
-        // EE_messages has been deprecated
915
-        $this->_class_is_deprecated(__FUNCTION__);
916
-        EE_Registry::instance()->load_helper('MSG_Template');
917
-        return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global);
918
-    }
919
-
920
-
921
-    /**
922
-     * @deprecated 4.9.0
923
-     * @param  string $messenger_name    name of EE_messenger
924
-     * @param  string $message_type_name name of EE_message_type
925
-     * @return array
926
-     */
927
-    public function get_fields($messenger_name, $message_type_name)
928
-    {
929
-        // EE_messages has been deprecated
930
-        $this->_class_is_deprecated(__FUNCTION__);
931
-        EE_Registry::instance()->load_helper('MSG_Template');
932
-        return EEH_MSG_Template::get_fields($messenger_name, $message_type_name);
933
-    }
934
-
935
-
936
-    /**
937
-     * @deprecated 4.9.0
938
-     * @access     public
939
-     * @param string $type                we can indicate just returning installed message types
940
-     *                                    or messengers (or both) via this parameter.
941
-     * @param bool   $skip_cache          if true then we skip the cache and retrieve via files.
942
-     * @return array                    multidimensional array of messenger and message_type objects
943
-     *                                    (messengers index, and message_type index);
944
-     */
945
-    public function get_installed($type = 'all', $skip_cache = false)
946
-    {
947
-        // EE_messages has been deprecated
948
-        $this->_class_is_deprecated(__FUNCTION__);
949
-        if ($skip_cache) {
950
-            $this->_message_resource_manager->reset_active_messengers_and_message_types();
951
-        }
952
-        switch ($type) {
953
-            case 'messengers' :
954
-                return array(
955
-                    'messenger' => $this->_message_resource_manager->installed_messengers(),
956
-                );
957
-                break;
958
-            case 'message_types' :
959
-                return array(
960
-                    'message_type' => $this->_message_resource_manager->installed_message_types(),
961
-                );
962
-                break;
963
-            case 'all' :
964
-            default :
965
-                return array(
966
-                    'messenger'    => $this->_message_resource_manager->installed_messengers(),
967
-                    'message_type' => $this->_message_resource_manager->installed_message_types(),
968
-                );
969
-                break;
970
-        }
971
-    }
972
-
973
-
974
-    /**
975
-     * @deprecated 4.9.0
976
-     * @return \EE_messenger[]
977
-     */
978
-    public function get_active_messengers()
979
-    {
980
-        // EE_messages has been deprecated
981
-        $this->_class_is_deprecated(__FUNCTION__);
982
-        return $this->_message_resource_manager->active_messengers();
983
-    }
984
-
985
-
986
-    /**
987
-     * @deprecated 4.9.0
988
-     * @return array array of message_type references (string)
989
-     */
990
-    public function get_active_message_types()
991
-    {
992
-        // EE_messages has been deprecated
993
-        $this->_class_is_deprecated(__FUNCTION__);
994
-        return $this->_message_resource_manager->list_of_active_message_types();
995
-    }
996
-
997
-
998
-    /**
999
-     * @deprecated 4.9.0
1000
-     * @return EE_message_type[]
1001
-     */
1002
-    public function get_active_message_type_objects()
1003
-    {
1004
-        // EE_messages has been deprecated
1005
-        $this->_class_is_deprecated(__FUNCTION__);
1006
-        return $this->_message_resource_manager->get_active_message_type_objects();
1007
-    }
1008
-
1009
-
1010
-    /**
1011
-     * @deprecated 4.9.0
1012
-     * @since      4.5.0
1013
-     * @param string $messenger The messenger being checked
1014
-     * @return EE_message_type[]    (or empty array if none present)
1015
-     */
1016
-    public function get_active_message_types_per_messenger($messenger)
1017
-    {
1018
-        // EE_messages has been deprecated
1019
-        $this->_class_is_deprecated(__FUNCTION__);
1020
-        return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger);
1021
-    }
1022
-
1023
-
1024
-    /**
1025
-     * @deprecated 4.9.0
1026
-     * @param string $messenger    The string should correspond to the messenger (message types are
1027
-     * @param string $message_type The string should correspond to a message type.
1028
-     * @return EE_message_type|null
1029
-     */
1030
-    public function get_active_message_type($messenger, $message_type)
1031
-    {
1032
-        // EE_messages has been deprecated
1033
-        $this->_class_is_deprecated(__FUNCTION__);
1034
-        return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type);
1035
-    }
1036
-
1037
-
1038
-    /**
1039
-     * @deprecated 4.9.0
1040
-     * @return array|\EE_message_type[]
1041
-     */
1042
-    public function get_installed_message_types()
1043
-    {
1044
-        // EE_messages has been deprecated
1045
-        $this->_class_is_deprecated(__FUNCTION__);
1046
-        return $this->_message_resource_manager->installed_message_types();
1047
-    }
1048
-
1049
-
1050
-    /**
1051
-     * @deprecated 4.9.0
1052
-     * @return array
1053
-     */
1054
-    public function get_installed_messengers()
1055
-    {
1056
-        // EE_messages has been deprecated
1057
-        $this->_class_is_deprecated(__FUNCTION__);
1058
-        return $this->_message_resource_manager->installed_messengers();
1059
-    }
1060
-
1061
-
1062
-    /**
1063
-     * @deprecated 4.9.0
1064
-     * @param   bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by
1065
-     *                           message type.
1066
-     * @return array
1067
-     */
1068
-    public function get_all_contexts($slugs_only = true)
1069
-    {
1070
-        // EE_messages has been deprecated
1071
-        $this->_class_is_deprecated(__FUNCTION__);
1072
-        return $this->_message_resource_manager->get_all_contexts($slugs_only);
1073
-    }
555
+	/** @type EE_messenger[] */
556
+	protected $_active_messengers = array();
557
+
558
+	/** @type array */
559
+	protected $_active_message_types = array();
560
+
561
+	/** @type EE_message_type[] */
562
+	protected $_installed_message_types = array();
563
+
564
+	/** @type EE_messenger */
565
+	protected $_messenger;
566
+
567
+	/** @type EE_message_type */
568
+	protected $_message_type;
569
+
570
+	/** @type array */
571
+	protected $_contexts = array();
572
+
573
+	/** @type EE_Message_Resource_Manager $_message_resource_manager */
574
+	protected $_message_resource_manager;
575
+
576
+
577
+	/**
578
+	 * EE_messages constructor.
579
+	 *
580
+	 * @deprecated 4.9.0
581
+	 */
582
+	public function __construct()
583
+	{
584
+	}
585
+
586
+
587
+	/**
588
+	 * @param string $method
589
+	 */
590
+	public function _class_is_deprecated($method)
591
+	{
592
+		EE_Error::doing_it_wrong(
593
+			'EE_messages::' . $method,
594
+			__('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
595
+			'4.9.0',
596
+			'4.10.0.p'
597
+		);
598
+		// Please use EE_Message_Resource_Manager instead
599
+		$this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
600
+	}
601
+
602
+
603
+	/**
604
+	 * @deprecated 4.9.0
605
+	 * @param string $messenger_name
606
+	 * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive
607
+	 */
608
+	public function ensure_messenger_is_active($messenger_name)
609
+	{
610
+		// EE_messages has been deprecated
611
+		$this->_class_is_deprecated(__FUNCTION__);
612
+		return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name);
613
+	}
614
+
615
+
616
+	/**
617
+	 * @deprecated 4.9.0
618
+	 * @param string $message_type message type name
619
+	 * @param        $messenger
620
+	 * @return bool true if it got activated (or was active) and false if not.
621
+	 * @throws \EE_Error
622
+	 */
623
+	public function ensure_message_type_is_active($message_type, $messenger)
624
+	{
625
+		// EE_messages has been deprecated
626
+		$this->_class_is_deprecated(__FUNCTION__);
627
+		return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger);
628
+	}
629
+
630
+
631
+	/**
632
+	 * @deprecated 4.9.0
633
+	 * @param string $messenger_name
634
+	 * @param array  $mts_to_activate             (optional) An array of message types to activate with this messenger.
635
+	 *                                             If included we do NOT setup the default message types (assuming they
636
+	 *                                             are already setup.)
637
+	 * @return boolean an array of generated templates or false if nothing generated/activated.
638
+	 */
639
+	public function activate_messenger($messenger_name, $mts_to_activate = array())
640
+	{
641
+		// EE_messages has been deprecated
642
+		$this->_class_is_deprecated(__FUNCTION__);
643
+		return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate);
644
+	}
645
+
646
+
647
+	/**
648
+	 * @deprecated 4.9.0
649
+	 * @param EE_messenger    $messenger    messenger used in trigger
650
+	 * @param EE_message_type $message_type message type used in trigger
651
+	 *
652
+	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
653
+	 */
654
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type)
655
+	{
656
+		// EE_messages has been deprecated
657
+		$this->_class_is_deprecated(__FUNCTION__);
658
+		return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type);
659
+	}
660
+
661
+
662
+	/**
663
+	 * @deprecated 4.9.0
664
+	 * @param string $messenger
665
+	 * @return EE_messenger | null
666
+	 */
667
+	public function get_messenger_if_active($messenger)
668
+	{
669
+		// EE_messages has been deprecated
670
+		$this->_class_is_deprecated(__FUNCTION__);
671
+		return $this->_message_resource_manager->get_active_messenger($messenger);
672
+	}
673
+
674
+
675
+	/**
676
+	 * @deprecated 4.9.0
677
+	 * @param EE_Message $message
678
+	 * @return array  An array with 'messenger' and 'message_type' as the index and the corresponding valid object if
679
+	 *                  available.
680
+	 *                  Eg. Valid Messenger and Message Type:
681
+	 *                  array(
682
+	 *                  'messenger' => new EE_Email_messenger(),
683
+	 *                  'message_type' => new EE_Registration_Approved_message_type()
684
+	 *                  )
685
+	 *                  Valid Messenger and Invalid Message Type:
686
+	 *                  array(
687
+	 *                  'messenger' => new EE_Email_messenger(),
688
+	 *                  'message_type' => null
689
+	 *                  )
690
+	 */
691
+	public function validate_for_use(EE_Message $message)
692
+	{
693
+		// EE_messages has been deprecated
694
+		$this->_class_is_deprecated(__FUNCTION__);
695
+		return array(
696
+			'messenger'    => $message->messenger_object(),
697
+			'message_type' => $message->message_type_object(),
698
+		);
699
+	}
700
+
701
+
702
+	/**
703
+	 * @deprecated 4.9.0
704
+	 * @param  string $type                 What type of message are we sending (corresponds to message types)
705
+	 * @param  mixed  $vars                 Data being sent for parsing in the message
706
+	 * @param  string $sending_messenger    if included then we ONLY use the specified messenger for delivery.
707
+	 *                                      Otherwise we cycle through all active messengers.
708
+	 * @param string  $generating_messenger if included then this messenger is used for generating the message
709
+	 *                                      templates (but not for sending).
710
+	 * @param string  $context              If included then only a message type for a specific context will be
711
+	 *                                      generated.
712
+	 * @param bool    $send                 Default TRUE.  If false, then this will just return the generated
713
+	 *                                      EE_messages objects which might be used by the trigger to setup a batch
714
+	 *                                      message (typically html messenger uses it).
715
+	 * @return bool
716
+	 */
717
+	public function send_message(
718
+		$type,
719
+		$vars,
720
+		$sending_messenger = '',
721
+		$generating_messenger = '',
722
+		$context = '',
723
+		$send = true
724
+	) {
725
+		// EE_messages has been deprecated
726
+		$this->_class_is_deprecated(__FUNCTION__);
727
+		/** @type EE_Messages_Processor $processor */
728
+		$processor = EE_Registry::instance()->load_lib('Messages_Processor');
729
+		$error = false;
730
+		// try to intelligently determine what method we'll call based on the incoming data.
731
+		// if generating and sending are different then generate and send immediately.
732
+		if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
733
+			// in the legacy system, when generating and sending were different, that means all the
734
+			// vars are already in the request object.  So let's just use that.
735
+			try {
736
+				/** @type EE_Message_To_Generate_From_Request $mtg */
737
+				$mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
738
+				$processor->generate_and_send_now($mtg);
739
+			} catch (EE_Error $e) {
740
+				$error_msg = __(
741
+					'Please note that a system message failed to send due to a technical issue.',
742
+					'event_espresso'
743
+				);
744
+				// add specific message for developers if WP_DEBUG in on
745
+				$error_msg .= '||' . $e->getMessage();
746
+				EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
747
+				$error = true;
748
+			}
749
+		} else {
750
+			$processor->generate_for_all_active_messengers($type, $vars, $send);
751
+			// let's find out if there were any errors and how many successfully were queued.
752
+			$count_errors = $processor->get_queue()->count_STS_in_queue(
753
+				array(EEM_Message::status_failed, EEM_Message::status_debug_only)
754
+			);
755
+			$count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
756
+			$count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry);
757
+			$count_errors = $count_errors + $count_retry;
758
+			if ($count_errors > 0) {
759
+				$error = true;
760
+				if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) {
761
+					$message = sprintf(
762
+						__(
763
+							'There were %d errors and %d messages successfully queued for generation and sending',
764
+							'event_espresso'
765
+						),
766
+						$count_errors,
767
+						$count_queued
768
+					);
769
+				} elseif ($count_errors > 1 && $count_queued === 1) {
770
+					$message = sprintf(
771
+						__(
772
+							'There were %d errors and %d message successfully queued for generation.',
773
+							'event_espresso'
774
+						),
775
+						$count_errors,
776
+						$count_queued
777
+					);
778
+				} elseif ($count_errors === 1 && $count_queued > 1) {
779
+					$message = sprintf(
780
+						__(
781
+							'There was %d error and %d messages successfully queued for generation.',
782
+							'event_espresso'
783
+						),
784
+						$count_errors,
785
+						$count_queued
786
+					);
787
+				} else {
788
+					$message = sprintf(
789
+						__(
790
+							'There was %d message that failed to be queued for generation.',
791
+							'event_espresso'
792
+						),
793
+						$count_errors
794
+					);
795
+				}
796
+				EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__);
797
+			} else {
798
+				if ($count_queued === 1) {
799
+					$message = sprintf(
800
+						__(
801
+							'%d message successfully queued for generation.',
802
+							'event_espresso'
803
+						),
804
+						$count_queued
805
+					);
806
+				} else {
807
+					$message = sprintf(
808
+						__(
809
+							'%d messages were successfully queued for generation.',
810
+							'event_espresso'
811
+						),
812
+						$count_queued
813
+					);
814
+				}
815
+				EE_Error::add_success($message);
816
+			}
817
+		}
818
+		// if no error then return the generated message(s).
819
+		if (! $error && ! $send) {
820
+			$generated_queue = $processor->generate_queue(false);
821
+			// get message and return.
822
+			$generated_queue->get_message_repository()->rewind();
823
+			$messages = array();
824
+			while ($generated_queue->get_message_repository()->valid()) {
825
+				$message = $generated_queue->get_message_repository()->current();
826
+				if ($message instanceof EE_Message) {
827
+					// set properties that might be expected by add-ons (backward compat)
828
+					$message->content = $message->content();
829
+					$message->template_pack = $message->get_template_pack();
830
+					$message->template_variation = $message->get_template_pack_variation();
831
+					$messages[] = $message;
832
+				}
833
+				$generated_queue->get_message_repository()->next();
834
+			}
835
+			return $messages;
836
+		}
837
+		return $error ? false
838
+			: true; // yeah backwards eh?  Really what we're returning is if there is a total success for all the messages or not.  We'll modify this once we get message recording in place.
839
+	}
840
+
841
+
842
+	/**
843
+	 * @deprecated 4.9.0
844
+	 * @param  string $type      This should correspond with a valid message type
845
+	 * @param  string $context   This should correspond with a valid context for the message type
846
+	 * @param  string $messenger This should correspond with a valid messenger.
847
+	 * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular
848
+	 *                           preview
849
+	 * @return string          The body of the message.
850
+	 */
851
+	public function preview_message($type, $context, $messenger, $send = false)
852
+	{
853
+		// EE_messages has been deprecated
854
+		$this->_class_is_deprecated(__FUNCTION__);
855
+		return EED_Messages::preview_message($type, $context, $messenger, $send);
856
+	}
857
+
858
+
859
+	/**
860
+	 * @since      4.5.0
861
+	 * @deprecated 4.9.0   Moved to EED_Messages Module
862
+	 * @param string   $messenger    a string matching a valid active messenger in the system
863
+	 * @param string   $message_type Although it seems contrary to the name of the method, a message type name is still
864
+	 *                               required to send along the message type to the messenger because this is used for
865
+	 *                               determining what specific variations might be loaded for the generated message.
866
+	 * @param stdClass $message      a stdClass object in the format expected by the messenger.
867
+	 *
868
+	 * @return bool          success or fail.
869
+	 */
870
+	public function send_message_with_messenger_only($messenger, $message_type, $message)
871
+	{
872
+		// EE_messages has been deprecated
873
+		$this->_class_is_deprecated(__FUNCTION__);
874
+		// setup for sending to new method.
875
+		/** @type EE_Messages_Queue $queue */
876
+		$queue = EE_Registry::instance()->load_lib('Messages_Queue');
877
+		// make sure we have a proper message object
878
+		if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
879
+			$msg = EE_Message_Factory::create(
880
+				array(
881
+					'MSG_messenger'    => $messenger,
882
+					'MSG_message_type' => $message_type,
883
+					'MSG_content'      => $message->content,
884
+					'MSG_subject'      => $message->subject,
885
+				)
886
+			);
887
+		} else {
888
+			$msg = $message;
889
+		}
890
+		if (! $msg instanceof EE_Message) {
891
+			return false;
892
+		}
893
+		// make sure any content in a content property (if not empty) is set on the MSG_content.
894
+		if (! empty($msg->content)) {
895
+			$msg->set('MSG_content', $msg->content);
896
+		}
897
+		$queue->add($msg);
898
+		return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue);
899
+	}
900
+
901
+
902
+	/**
903
+	 * @deprecated 4.9.0
904
+	 * @param         $messenger
905
+	 * @param  string $message_type message type that the templates are being created for
906
+	 * @param int     $GRP_ID
907
+	 * @param bool    $is_global
908
+	 * @return array|object if creation is successful then we return an array of info, otherwise an error_object is
909
+	 *                      returned.
910
+	 * @throws \EE_Error
911
+	 */
912
+	public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false)
913
+	{
914
+		// EE_messages has been deprecated
915
+		$this->_class_is_deprecated(__FUNCTION__);
916
+		EE_Registry::instance()->load_helper('MSG_Template');
917
+		return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global);
918
+	}
919
+
920
+
921
+	/**
922
+	 * @deprecated 4.9.0
923
+	 * @param  string $messenger_name    name of EE_messenger
924
+	 * @param  string $message_type_name name of EE_message_type
925
+	 * @return array
926
+	 */
927
+	public function get_fields($messenger_name, $message_type_name)
928
+	{
929
+		// EE_messages has been deprecated
930
+		$this->_class_is_deprecated(__FUNCTION__);
931
+		EE_Registry::instance()->load_helper('MSG_Template');
932
+		return EEH_MSG_Template::get_fields($messenger_name, $message_type_name);
933
+	}
934
+
935
+
936
+	/**
937
+	 * @deprecated 4.9.0
938
+	 * @access     public
939
+	 * @param string $type                we can indicate just returning installed message types
940
+	 *                                    or messengers (or both) via this parameter.
941
+	 * @param bool   $skip_cache          if true then we skip the cache and retrieve via files.
942
+	 * @return array                    multidimensional array of messenger and message_type objects
943
+	 *                                    (messengers index, and message_type index);
944
+	 */
945
+	public function get_installed($type = 'all', $skip_cache = false)
946
+	{
947
+		// EE_messages has been deprecated
948
+		$this->_class_is_deprecated(__FUNCTION__);
949
+		if ($skip_cache) {
950
+			$this->_message_resource_manager->reset_active_messengers_and_message_types();
951
+		}
952
+		switch ($type) {
953
+			case 'messengers' :
954
+				return array(
955
+					'messenger' => $this->_message_resource_manager->installed_messengers(),
956
+				);
957
+				break;
958
+			case 'message_types' :
959
+				return array(
960
+					'message_type' => $this->_message_resource_manager->installed_message_types(),
961
+				);
962
+				break;
963
+			case 'all' :
964
+			default :
965
+				return array(
966
+					'messenger'    => $this->_message_resource_manager->installed_messengers(),
967
+					'message_type' => $this->_message_resource_manager->installed_message_types(),
968
+				);
969
+				break;
970
+		}
971
+	}
972
+
973
+
974
+	/**
975
+	 * @deprecated 4.9.0
976
+	 * @return \EE_messenger[]
977
+	 */
978
+	public function get_active_messengers()
979
+	{
980
+		// EE_messages has been deprecated
981
+		$this->_class_is_deprecated(__FUNCTION__);
982
+		return $this->_message_resource_manager->active_messengers();
983
+	}
984
+
985
+
986
+	/**
987
+	 * @deprecated 4.9.0
988
+	 * @return array array of message_type references (string)
989
+	 */
990
+	public function get_active_message_types()
991
+	{
992
+		// EE_messages has been deprecated
993
+		$this->_class_is_deprecated(__FUNCTION__);
994
+		return $this->_message_resource_manager->list_of_active_message_types();
995
+	}
996
+
997
+
998
+	/**
999
+	 * @deprecated 4.9.0
1000
+	 * @return EE_message_type[]
1001
+	 */
1002
+	public function get_active_message_type_objects()
1003
+	{
1004
+		// EE_messages has been deprecated
1005
+		$this->_class_is_deprecated(__FUNCTION__);
1006
+		return $this->_message_resource_manager->get_active_message_type_objects();
1007
+	}
1008
+
1009
+
1010
+	/**
1011
+	 * @deprecated 4.9.0
1012
+	 * @since      4.5.0
1013
+	 * @param string $messenger The messenger being checked
1014
+	 * @return EE_message_type[]    (or empty array if none present)
1015
+	 */
1016
+	public function get_active_message_types_per_messenger($messenger)
1017
+	{
1018
+		// EE_messages has been deprecated
1019
+		$this->_class_is_deprecated(__FUNCTION__);
1020
+		return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger);
1021
+	}
1022
+
1023
+
1024
+	/**
1025
+	 * @deprecated 4.9.0
1026
+	 * @param string $messenger    The string should correspond to the messenger (message types are
1027
+	 * @param string $message_type The string should correspond to a message type.
1028
+	 * @return EE_message_type|null
1029
+	 */
1030
+	public function get_active_message_type($messenger, $message_type)
1031
+	{
1032
+		// EE_messages has been deprecated
1033
+		$this->_class_is_deprecated(__FUNCTION__);
1034
+		return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type);
1035
+	}
1036
+
1037
+
1038
+	/**
1039
+	 * @deprecated 4.9.0
1040
+	 * @return array|\EE_message_type[]
1041
+	 */
1042
+	public function get_installed_message_types()
1043
+	{
1044
+		// EE_messages has been deprecated
1045
+		$this->_class_is_deprecated(__FUNCTION__);
1046
+		return $this->_message_resource_manager->installed_message_types();
1047
+	}
1048
+
1049
+
1050
+	/**
1051
+	 * @deprecated 4.9.0
1052
+	 * @return array
1053
+	 */
1054
+	public function get_installed_messengers()
1055
+	{
1056
+		// EE_messages has been deprecated
1057
+		$this->_class_is_deprecated(__FUNCTION__);
1058
+		return $this->_message_resource_manager->installed_messengers();
1059
+	}
1060
+
1061
+
1062
+	/**
1063
+	 * @deprecated 4.9.0
1064
+	 * @param   bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by
1065
+	 *                           message type.
1066
+	 * @return array
1067
+	 */
1068
+	public function get_all_contexts($slugs_only = true)
1069
+	{
1070
+		// EE_messages has been deprecated
1071
+		$this->_class_is_deprecated(__FUNCTION__);
1072
+		return $this->_message_resource_manager->get_all_contexts($slugs_only);
1073
+	}
1074 1074
 
1075 1075
 
1076 1076
 }
@@ -1129,88 +1129,88 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
 
1131 1131
 add_filter(
1132
-    'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1133
-    function ($event_list_iframe_css) {
1134
-        if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1135
-            return $event_list_iframe_css;
1136
-        }
1137
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1138
-            'FHEE__EventsArchiveIframe__event_list_iframe__css',
1139
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1140
-            '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1141
-            '4.9.14',
1142
-            '5.0.0',
1143
-            'filter'
1144
-        );
1145
-        return apply_filters(
1146
-            'FHEE__EventsArchiveIframe__event_list_iframe__css',
1147
-            $event_list_iframe_css
1148
-        );
1149
-    }
1132
+	'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1133
+	function ($event_list_iframe_css) {
1134
+		if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1135
+			return $event_list_iframe_css;
1136
+		}
1137
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1138
+			'FHEE__EventsArchiveIframe__event_list_iframe__css',
1139
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1140
+			'\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1141
+			'4.9.14',
1142
+			'5.0.0',
1143
+			'filter'
1144
+		);
1145
+		return apply_filters(
1146
+			'FHEE__EventsArchiveIframe__event_list_iframe__css',
1147
+			$event_list_iframe_css
1148
+		);
1149
+	}
1150 1150
 );
1151 1151
 add_filter(
1152
-    'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1153
-    function ($event_list_iframe_js) {
1154
-        if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1155
-            return $event_list_iframe_js;
1156
-        }
1157
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1158
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1159
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1160
-            '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1161
-            '4.9.14',
1162
-            '5.0.0',
1163
-            'filter'
1164
-        );
1165
-        return apply_filters(
1166
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1167
-            $event_list_iframe_js
1168
-        );
1169
-    }
1152
+	'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1153
+	function ($event_list_iframe_js) {
1154
+		if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1155
+			return $event_list_iframe_js;
1156
+		}
1157
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1158
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1159
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1160
+			'\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1161
+			'4.9.14',
1162
+			'5.0.0',
1163
+			'filter'
1164
+		);
1165
+		return apply_filters(
1166
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1167
+			$event_list_iframe_js
1168
+		);
1169
+	}
1170 1170
 );
1171 1171
 add_action(
1172
-    'AHEE__EE_Capabilities__addCaps__complete',
1173
-    function ($capabilities_map) {
1174
-        if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1175
-            return;
1176
-        }
1177
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1178
-            'AHEE__EE_Capabilities__init_role_caps__complete',
1179
-            'AHEE__EE_Capabilities__addCaps__complete',
1180
-            '\EE_Capabilities::addCaps()',
1181
-            '4.9.42',
1182
-            '5.0.0'
1183
-        );
1184
-        do_action(
1185
-            'AHEE__EE_Capabilities__init_role_caps__complete',
1186
-            $capabilities_map
1187
-        );
1188
-    }
1172
+	'AHEE__EE_Capabilities__addCaps__complete',
1173
+	function ($capabilities_map) {
1174
+		if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1175
+			return;
1176
+		}
1177
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1178
+			'AHEE__EE_Capabilities__init_role_caps__complete',
1179
+			'AHEE__EE_Capabilities__addCaps__complete',
1180
+			'\EE_Capabilities::addCaps()',
1181
+			'4.9.42',
1182
+			'5.0.0'
1183
+		);
1184
+		do_action(
1185
+			'AHEE__EE_Capabilities__init_role_caps__complete',
1186
+			$capabilities_map
1187
+		);
1188
+	}
1189 1189
 );
1190 1190
 
1191 1191
 add_filter(
1192
-    'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1193
-    function ($existing_attendee, $registration, $attendee_data) {
1194
-        if (! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1195
-            return $existing_attendee;
1196
-        }
1197
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1198
-            'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1199
-            'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1200
-            '\EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler::findExistingAttendee()',
1201
-            '4.9.34',
1202
-            '5.0.0',
1203
-            'filter'
1204
-        );
1205
-        return apply_filters(
1206
-            'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1207
-            $existing_attendee,
1208
-            $registration,
1209
-            $attendee_data
1210
-        );
1211
-    },
1212
-    10,
1213
-    3
1192
+	'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1193
+	function ($existing_attendee, $registration, $attendee_data) {
1194
+		if (! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1195
+			return $existing_attendee;
1196
+		}
1197
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1198
+			'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1199
+			'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1200
+			'\EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler::findExistingAttendee()',
1201
+			'4.9.34',
1202
+			'5.0.0',
1203
+			'filter'
1204
+		);
1205
+		return apply_filters(
1206
+			'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1207
+			$existing_attendee,
1208
+			$registration,
1209
+			$attendee_data
1210
+		);
1211
+	},
1212
+	10,
1213
+	3
1214 1214
 );
1215 1215
 
1216 1216
 /**
@@ -1221,88 +1221,88 @@  discard block
 block discarded – undo
1221 1221
 class EE_Event_List_Query extends WP_Query
1222 1222
 {
1223 1223
 
1224
-    private $title;
1225
-
1226
-    private $css_class;
1227
-
1228
-    private $category_slug;
1229
-
1230
-    /**
1231
-     * EE_Event_List_Query constructor.
1232
-     *
1233
-     * @param array $args
1234
-     */
1235
-    public function __construct($args = array())
1236
-    {
1237
-        \EE_Error::doing_it_wrong(
1238
-            __METHOD__,
1239
-            __(
1240
-                'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.',
1241
-                'event_espresso'
1242
-            ),
1243
-            '4.9.27',
1244
-            '5.0.0'
1245
-        );
1246
-        $this->title = isset($args['title']) ? $args['title'] : '';
1247
-        $this->css_class = isset($args['css_class']) ? $args['css_class'] : '';
1248
-        $this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : '';
1249
-        $limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10;
1250
-        // the current "page" we are viewing
1251
-        $paged = max(1, get_query_var('paged'));
1252
-        // Force these args
1253
-        $args = array_merge(
1254
-            $args,
1255
-            array(
1256
-                'post_type'              => 'espresso_events',
1257
-                'posts_per_page'         => $limit,
1258
-                'update_post_term_cache' => false,
1259
-                'update_post_meta_cache' => false,
1260
-                'paged'                  => $paged,
1261
-                'offset'                 => ($paged - 1) * $limit,
1262
-            )
1263
-        );
1264
-        // run the query
1265
-        parent::__construct($args);
1266
-    }
1267
-
1268
-
1269
-    /**
1270
-     * event_list_title
1271
-     *
1272
-     * @param string $event_list_title
1273
-     * @return string
1274
-     */
1275
-    public function event_list_title($event_list_title = '')
1276
-    {
1277
-        if (! empty($this->title)) {
1278
-            return $this->title;
1279
-        }
1280
-        return $event_list_title;
1281
-    }
1282
-
1283
-
1284
-    /**
1285
-     * event_list_css
1286
-     *
1287
-     * @param string $event_list_css
1288
-     * @return string
1289
-     */
1290
-    public function event_list_css($event_list_css = '')
1291
-    {
1292
-        $event_list_css .= ! empty($event_list_css)
1293
-            ? ' '
1294
-            : '';
1295
-        $event_list_css .= ! empty($this->css_class)
1296
-            ? $this->css_class
1297
-            : '';
1298
-        $event_list_css .= ! empty($event_list_css)
1299
-            ? ' '
1300
-            : '';
1301
-        $event_list_css .= ! empty($this->category_slug)
1302
-            ? $this->category_slug
1303
-            : '';
1304
-        return $event_list_css;
1305
-    }
1224
+	private $title;
1225
+
1226
+	private $css_class;
1227
+
1228
+	private $category_slug;
1229
+
1230
+	/**
1231
+	 * EE_Event_List_Query constructor.
1232
+	 *
1233
+	 * @param array $args
1234
+	 */
1235
+	public function __construct($args = array())
1236
+	{
1237
+		\EE_Error::doing_it_wrong(
1238
+			__METHOD__,
1239
+			__(
1240
+				'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.',
1241
+				'event_espresso'
1242
+			),
1243
+			'4.9.27',
1244
+			'5.0.0'
1245
+		);
1246
+		$this->title = isset($args['title']) ? $args['title'] : '';
1247
+		$this->css_class = isset($args['css_class']) ? $args['css_class'] : '';
1248
+		$this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : '';
1249
+		$limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10;
1250
+		// the current "page" we are viewing
1251
+		$paged = max(1, get_query_var('paged'));
1252
+		// Force these args
1253
+		$args = array_merge(
1254
+			$args,
1255
+			array(
1256
+				'post_type'              => 'espresso_events',
1257
+				'posts_per_page'         => $limit,
1258
+				'update_post_term_cache' => false,
1259
+				'update_post_meta_cache' => false,
1260
+				'paged'                  => $paged,
1261
+				'offset'                 => ($paged - 1) * $limit,
1262
+			)
1263
+		);
1264
+		// run the query
1265
+		parent::__construct($args);
1266
+	}
1267
+
1268
+
1269
+	/**
1270
+	 * event_list_title
1271
+	 *
1272
+	 * @param string $event_list_title
1273
+	 * @return string
1274
+	 */
1275
+	public function event_list_title($event_list_title = '')
1276
+	{
1277
+		if (! empty($this->title)) {
1278
+			return $this->title;
1279
+		}
1280
+		return $event_list_title;
1281
+	}
1282
+
1283
+
1284
+	/**
1285
+	 * event_list_css
1286
+	 *
1287
+	 * @param string $event_list_css
1288
+	 * @return string
1289
+	 */
1290
+	public function event_list_css($event_list_css = '')
1291
+	{
1292
+		$event_list_css .= ! empty($event_list_css)
1293
+			? ' '
1294
+			: '';
1295
+		$event_list_css .= ! empty($this->css_class)
1296
+			? $this->css_class
1297
+			: '';
1298
+		$event_list_css .= ! empty($event_list_css)
1299
+			? ' '
1300
+			: '';
1301
+		$event_list_css .= ! empty($this->category_slug)
1302
+			? $this->category_slug
1303
+			: '';
1304
+		return $event_list_css;
1305
+	}
1306 1306
 
1307 1307
 }
1308 1308
 
@@ -1319,66 +1319,66 @@  discard block
 block discarded – undo
1319 1319
 {
1320 1320
 
1321 1321
 
1322
-    /**
1323
-     *    class constructor
1324
-     *
1325
-     * @deprecated 4.9.59.p
1326
-     */
1327
-    public function __construct()
1328
-    {
1329
-        EE_Error::doing_it_wrong(
1330
-            __METHOD__,
1331
-            sprintf(
1332
-                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1333
-                __CLASS__,
1334
-                'EventEspresso\core\services\licensing\LicenseServices'
1335
-            ),
1336
-            '4.9.59.p'
1337
-        );
1338
-    }
1339
-
1340
-
1341
-    /**
1342
-     * The purpose of this function is to display information about Event Espresso data collection
1343
-     * and a optin selection for extra data collecting by users.
1344
-     *
1345
-     * @param bool $extra
1346
-     * @return string html.
1347
-     * @deprecated 4.9.59.p
1348
-     */
1349
-    public static function espresso_data_collection_optin_text($extra = true)
1350
-    {
1351
-        EE_Error::doing_it_wrong(
1352
-            __METHOD__,
1353
-            sprintf(
1354
-                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1355
-                __METHOD__,
1356
-                'EventEspresso\core\domain\services\Stats::optinText'
1357
-            ),
1358
-            '4.9.59.p'
1359
-        );
1360
-        Stats::optinText($extra);
1361
-    }
1362
-
1363
-    /**
1364
-     * This is a handy helper method for retrieving whether there is an update available for the given plugin.
1365
-     *
1366
-     * @param  string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to
1367
-     *                          identify plugins. Defaults to core update
1368
-     * @return boolean           True if update available, false if not.
1369
-     * @deprecated 4.9.59.p
1370
-     */
1371
-    public static function is_update_available($basename = '')
1372
-    {
1373
-        EE_Error::doing_it_wrong(
1374
-            __METHOD__,
1375
-            sprintf(
1376
-                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1377
-                __METHOD__,
1378
-                'EventEspresso\core\services\licensing\LicenseService::isUpdateAvailable'
1379
-            ),
1380
-            '4.9.59.p'
1381
-        );
1382
-        return LicenseService::isUpdateAvailable($basename);
1383
-    }
1322
+	/**
1323
+	 *    class constructor
1324
+	 *
1325
+	 * @deprecated 4.9.59.p
1326
+	 */
1327
+	public function __construct()
1328
+	{
1329
+		EE_Error::doing_it_wrong(
1330
+			__METHOD__,
1331
+			sprintf(
1332
+				esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1333
+				__CLASS__,
1334
+				'EventEspresso\core\services\licensing\LicenseServices'
1335
+			),
1336
+			'4.9.59.p'
1337
+		);
1338
+	}
1339
+
1340
+
1341
+	/**
1342
+	 * The purpose of this function is to display information about Event Espresso data collection
1343
+	 * and a optin selection for extra data collecting by users.
1344
+	 *
1345
+	 * @param bool $extra
1346
+	 * @return string html.
1347
+	 * @deprecated 4.9.59.p
1348
+	 */
1349
+	public static function espresso_data_collection_optin_text($extra = true)
1350
+	{
1351
+		EE_Error::doing_it_wrong(
1352
+			__METHOD__,
1353
+			sprintf(
1354
+				esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1355
+				__METHOD__,
1356
+				'EventEspresso\core\domain\services\Stats::optinText'
1357
+			),
1358
+			'4.9.59.p'
1359
+		);
1360
+		Stats::optinText($extra);
1361
+	}
1362
+
1363
+	/**
1364
+	 * This is a handy helper method for retrieving whether there is an update available for the given plugin.
1365
+	 *
1366
+	 * @param  string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to
1367
+	 *                          identify plugins. Defaults to core update
1368
+	 * @return boolean           True if update available, false if not.
1369
+	 * @deprecated 4.9.59.p
1370
+	 */
1371
+	public static function is_update_available($basename = '')
1372
+	{
1373
+		EE_Error::doing_it_wrong(
1374
+			__METHOD__,
1375
+			sprintf(
1376
+				esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1377
+				__METHOD__,
1378
+				'EventEspresso\core\services\licensing\LicenseService::isUpdateAvailable'
1379
+			),
1380
+			'4.9.59.p'
1381
+		);
1382
+		return LicenseService::isUpdateAvailable($basename);
1383
+	}
1384 1384
 }
1385 1385
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
     // loop thru and call doing_it_wrong() or remove any that aren't being used
85 85
     foreach ($deprecated_filters as $deprecated_filter => $on) {
86 86
         // was this filter called ?
87
-        if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) {
87
+        if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) {
88 88
             // only display doing_it_wrong() notice to Event Admins during non-AJAX requests
89 89
             if (EE_Registry::instance()->CAP->current_user_can(
90 90
                     'ee_read_ee',
91 91
                     'hide_doing_it_wrong_for_deprecated_SPCO_filter'
92 92
                 ) && ! defined('DOING_AJAX')) {
93 93
                 EE_Error::doing_it_wrong(
94
-                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
94
+                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
95 95
                     sprintf(
96 96
                         __(
97 97
                             'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"',
98 98
                             'event_espresso'
99 99
                         ),
100
-                        'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
100
+                        'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
101 101
                         '<br />',
102 102
                         'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
103 103
                         '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
                 );
107 107
             }
108 108
         } else {
109
-            unset($deprecated_filters[ $deprecated_filter ]);
109
+            unset($deprecated_filters[$deprecated_filter]);
110 110
         }
111 111
     }
112
-    if (! empty($deprecated_filters)) {
112
+    if ( ! empty($deprecated_filters)) {
113 113
 
114 114
         if ($checkout->current_step->slug(
115 115
             ) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 $submit_button_text = apply_filters(
144 144
                                           'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to',
145 145
                                           $submit_button_text
146
-                                      ) . $checkout->next_step->name();
146
+                                      ).$checkout->next_step->name();
147 147
             }
148 148
         }
149 149
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             'event_espresso'
328 328
         );
329 329
         EE_Error::doing_it_wrong(
330
-            __CLASS__ . '::' . __FUNCTION__,
330
+            __CLASS__.'::'.__FUNCTION__,
331 331
             $msg,
332 332
             '4.8.32.rc.000'
333 333
         );
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 function ee_deprecated_update_attendee_registration_form_old($admin_page)
355 355
 {
356 356
     // check if the old hooks are in use. If not, do the default
357
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
357
+    if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
358 358
         || ! $admin_page instanceof EE_Admin_Page) {
359 359
         return;
360 360
     }
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
     $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false;
363 363
     $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false;
364 364
     $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
365
-    if (! $REG_ID || ! $qstns) {
365
+    if ( ! $REG_ID || ! $qstns) {
366 366
         EE_Error::add_error(
367 367
             __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'),
368 368
             __FILE__,
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
     foreach ($qstns as $QST_ID => $qstn) {
384 384
         // if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
385
-        if (! is_array($qstn)) {
385
+        if ( ! is_array($qstn)) {
386 386
             $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
387 387
             continue;
388 388
         }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
             );
400 400
             $answer = EEM_Answer::instance()->get_one($query_params);
401 401
             // this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
402
-            if (! $answer instanceof EE_Answer) {
402
+            if ( ! $answer instanceof EE_Answer) {
403 403
                 $set_values = array(
404 404
                     'QST_ID'    => $QST_ID,
405 405
                     'REG_ID'    => $REG_ID,
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration)
441 441
 {
442 442
     // check if the old hooks are in use. If not, do the default
443
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
443
+    if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
444 444
         || ! $admin_page instanceof EE_Admin_Page) {
445 445
         return $do_default_action;
446 446
     }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         'reg_questions_form_action' => 'edit_registration',
473 473
         'REG_ID'                    => $registration->ID(),
474 474
     );
475
-    $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
475
+    $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
476 476
     echo EEH_Template::display_template($template_path, $template_args, true);
477 477
     // indicate that we should not do the default admin page code
478 478
     return false;
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     public function _class_is_deprecated($method)
591 591
     {
592 592
         EE_Error::doing_it_wrong(
593
-            'EE_messages::' . $method,
593
+            'EE_messages::'.$method,
594 594
             __('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
595 595
             '4.9.0',
596 596
             '4.10.0.p'
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
         $error = false;
730 730
         // try to intelligently determine what method we'll call based on the incoming data.
731 731
         // if generating and sending are different then generate and send immediately.
732
-        if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
732
+        if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
733 733
             // in the legacy system, when generating and sending were different, that means all the
734 734
             // vars are already in the request object.  So let's just use that.
735 735
             try {
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
                     'event_espresso'
743 743
                 );
744 744
                 // add specific message for developers if WP_DEBUG in on
745
-                $error_msg .= '||' . $e->getMessage();
745
+                $error_msg .= '||'.$e->getMessage();
746 746
                 EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
747 747
                 $error = true;
748 748
             }
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
             }
817 817
         }
818 818
         // if no error then return the generated message(s).
819
-        if (! $error && ! $send) {
819
+        if ( ! $error && ! $send) {
820 820
             $generated_queue = $processor->generate_queue(false);
821 821
             // get message and return.
822 822
             $generated_queue->get_message_repository()->rewind();
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
         /** @type EE_Messages_Queue $queue */
876 876
         $queue = EE_Registry::instance()->load_lib('Messages_Queue');
877 877
         // make sure we have a proper message object
878
-        if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
878
+        if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
879 879
             $msg = EE_Message_Factory::create(
880 880
                 array(
881 881
                     'MSG_messenger'    => $messenger,
@@ -887,11 +887,11 @@  discard block
 block discarded – undo
887 887
         } else {
888 888
             $msg = $message;
889 889
         }
890
-        if (! $msg instanceof EE_Message) {
890
+        if ( ! $msg instanceof EE_Message) {
891 891
             return false;
892 892
         }
893 893
         // make sure any content in a content property (if not empty) is set on the MSG_content.
894
-        if (! empty($msg->content)) {
894
+        if ( ! empty($msg->content)) {
895 895
             $msg->set('MSG_content', $msg->content);
896 896
         }
897 897
         $queue->add($msg);
@@ -1130,8 +1130,8 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 add_filter(
1132 1132
     'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1133
-    function ($event_list_iframe_css) {
1134
-        if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1133
+    function($event_list_iframe_css) {
1134
+        if ( ! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1135 1135
             return $event_list_iframe_css;
1136 1136
         }
1137 1137
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
 );
1151 1151
 add_filter(
1152 1152
     'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1153
-    function ($event_list_iframe_js) {
1154
-        if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1153
+    function($event_list_iframe_js) {
1154
+        if ( ! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1155 1155
             return $event_list_iframe_js;
1156 1156
         }
1157 1157
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 );
1171 1171
 add_action(
1172 1172
     'AHEE__EE_Capabilities__addCaps__complete',
1173
-    function ($capabilities_map) {
1174
-        if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1173
+    function($capabilities_map) {
1174
+        if ( ! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1175 1175
             return;
1176 1176
         }
1177 1177
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1190,8 +1190,8 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 add_filter(
1192 1192
     'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1193
-    function ($existing_attendee, $registration, $attendee_data) {
1194
-        if (! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1193
+    function($existing_attendee, $registration, $attendee_data) {
1194
+        if ( ! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1195 1195
             return $existing_attendee;
1196 1196
         }
1197 1197
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
      */
1275 1275
     public function event_list_title($event_list_title = '')
1276 1276
     {
1277
-        if (! empty($this->title)) {
1277
+        if ( ! empty($this->title)) {
1278 1278
             return $this->title;
1279 1279
         }
1280 1280
         return $event_list_title;
Please login to merge, or discard this patch.
core/EE_Object_Collection.core.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -84,6 +84,7 @@
 block discarded – undo
84 84
      *
85 85
      * @access public
86 86
      * @param mixed
87
+     * @param string $info
87 88
      * @return null | object
88 89
      */
89 90
     public function get_by_info($info)
Please login to merge, or discard this patch.
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -16,160 +16,160 @@
 block discarded – undo
16 16
 abstract class EE_Object_Collection extends SplObjectStorage implements EEI_Collection
17 17
 {
18 18
 
19
-    /**
20
-     * an interface (or class) name to be used for restricting the type of objects added to the storage
21
-     * this should be set from within the child class constructor
22
-     *
23
-     * @type string $interface
24
-     */
25
-    protected $interface;
26
-
27
-
28
-    /**
29
-     * add
30
-     *
31
-     * attaches an object to the Collection
32
-     * and sets any supplied data associated with the current iterator entry
33
-     * by calling EE_Object_Collection::set_info()
34
-     *
35
-     * @access public
36
-     * @param object $object
37
-     * @param mixed  $info
38
-     * @return bool
39
-     */
40
-    public function add($object, $info = null)
41
-    {
42
-        $class = $this->interface;
43
-        if (! $object instanceof $class) {
44
-            return false;
45
-        }
46
-        $this->attach($object);
47
-        $this->set_info($object, $info);
48
-        return $this->contains($object);
49
-    }
50
-
51
-
52
-    /**
53
-     * set_info
54
-     *
55
-     * Sets the data associated with an object in the Collection
56
-     * if no $info is supplied, then the spl_object_hash() is used
57
-     *
58
-     * @access public
59
-     * @param object $object
60
-     * @param mixed  $info
61
-     * @return bool
62
-     */
63
-    public function set_info($object, $info = null)
64
-    {
65
-        $info = ! empty($info) ? $info : spl_object_hash($object);
66
-        $this->rewind();
67
-        while ($this->valid()) {
68
-            if ($object == $this->current()) {
69
-                $this->setInfo($info);
70
-                $this->rewind();
71
-                return true;
72
-            }
73
-            $this->next();
74
-        }
75
-        return false;
76
-    }
77
-
78
-
79
-    /**
80
-     * get_by_info
81
-     *
82
-     * finds and returns an object in the Collection based on the info that was set using addObject()
83
-     * PLZ NOTE: the pointer is reset to the beginning of the collection before returning
84
-     *
85
-     * @access public
86
-     * @param mixed
87
-     * @return null | object
88
-     */
89
-    public function get_by_info($info)
90
-    {
91
-        $this->rewind();
92
-        while ($this->valid()) {
93
-            if ($info === $this->getInfo()) {
94
-                $object = $this->current();
95
-                $this->rewind();
96
-                return $object;
97
-            }
98
-            $this->next();
99
-        }
100
-        return null;
101
-    }
102
-
103
-
104
-    /**
105
-     * has
106
-     *
107
-     * returns TRUE or FALSE depending on whether the supplied object is within the Collection
108
-     *
109
-     * @access public
110
-     * @param object $object
111
-     * @return bool
112
-     */
113
-    public function has($object)
114
-    {
115
-        return $this->contains($object);
116
-    }
117
-
118
-
119
-    /**
120
-     * remove
121
-     *
122
-     * detaches an object from the Collection
123
-     *
124
-     * @access public
125
-     * @param $object
126
-     * @return bool
127
-     */
128
-    public function remove($object)
129
-    {
130
-        $this->detach($object);
131
-        return true;
132
-    }
133
-
134
-
135
-    /**
136
-     * set_current
137
-     *
138
-     * advances pointer to the provided object
139
-     *
140
-     * @access public
141
-     * @param $object
142
-     * @return void
143
-     */
144
-    public function set_current($object)
145
-    {
146
-        $this->rewind();
147
-        while ($this->valid()) {
148
-            if ($this->current() === $object) {
149
-                break;
150
-            }
151
-            $this->next();
152
-        }
153
-    }
154
-
155
-
156
-    /**
157
-     * set_current_by_info
158
-     *
159
-     * advances pointer to the object whose info matches that which was provided
160
-     *
161
-     * @access public
162
-     * @param $info
163
-     * @return void
164
-     */
165
-    public function set_current_by_info($info)
166
-    {
167
-        $this->rewind();
168
-        while ($this->valid()) {
169
-            if ($info === $this->getInfo()) {
170
-                break;
171
-            }
172
-            $this->next();
173
-        }
174
-    }
19
+	/**
20
+	 * an interface (or class) name to be used for restricting the type of objects added to the storage
21
+	 * this should be set from within the child class constructor
22
+	 *
23
+	 * @type string $interface
24
+	 */
25
+	protected $interface;
26
+
27
+
28
+	/**
29
+	 * add
30
+	 *
31
+	 * attaches an object to the Collection
32
+	 * and sets any supplied data associated with the current iterator entry
33
+	 * by calling EE_Object_Collection::set_info()
34
+	 *
35
+	 * @access public
36
+	 * @param object $object
37
+	 * @param mixed  $info
38
+	 * @return bool
39
+	 */
40
+	public function add($object, $info = null)
41
+	{
42
+		$class = $this->interface;
43
+		if (! $object instanceof $class) {
44
+			return false;
45
+		}
46
+		$this->attach($object);
47
+		$this->set_info($object, $info);
48
+		return $this->contains($object);
49
+	}
50
+
51
+
52
+	/**
53
+	 * set_info
54
+	 *
55
+	 * Sets the data associated with an object in the Collection
56
+	 * if no $info is supplied, then the spl_object_hash() is used
57
+	 *
58
+	 * @access public
59
+	 * @param object $object
60
+	 * @param mixed  $info
61
+	 * @return bool
62
+	 */
63
+	public function set_info($object, $info = null)
64
+	{
65
+		$info = ! empty($info) ? $info : spl_object_hash($object);
66
+		$this->rewind();
67
+		while ($this->valid()) {
68
+			if ($object == $this->current()) {
69
+				$this->setInfo($info);
70
+				$this->rewind();
71
+				return true;
72
+			}
73
+			$this->next();
74
+		}
75
+		return false;
76
+	}
77
+
78
+
79
+	/**
80
+	 * get_by_info
81
+	 *
82
+	 * finds and returns an object in the Collection based on the info that was set using addObject()
83
+	 * PLZ NOTE: the pointer is reset to the beginning of the collection before returning
84
+	 *
85
+	 * @access public
86
+	 * @param mixed
87
+	 * @return null | object
88
+	 */
89
+	public function get_by_info($info)
90
+	{
91
+		$this->rewind();
92
+		while ($this->valid()) {
93
+			if ($info === $this->getInfo()) {
94
+				$object = $this->current();
95
+				$this->rewind();
96
+				return $object;
97
+			}
98
+			$this->next();
99
+		}
100
+		return null;
101
+	}
102
+
103
+
104
+	/**
105
+	 * has
106
+	 *
107
+	 * returns TRUE or FALSE depending on whether the supplied object is within the Collection
108
+	 *
109
+	 * @access public
110
+	 * @param object $object
111
+	 * @return bool
112
+	 */
113
+	public function has($object)
114
+	{
115
+		return $this->contains($object);
116
+	}
117
+
118
+
119
+	/**
120
+	 * remove
121
+	 *
122
+	 * detaches an object from the Collection
123
+	 *
124
+	 * @access public
125
+	 * @param $object
126
+	 * @return bool
127
+	 */
128
+	public function remove($object)
129
+	{
130
+		$this->detach($object);
131
+		return true;
132
+	}
133
+
134
+
135
+	/**
136
+	 * set_current
137
+	 *
138
+	 * advances pointer to the provided object
139
+	 *
140
+	 * @access public
141
+	 * @param $object
142
+	 * @return void
143
+	 */
144
+	public function set_current($object)
145
+	{
146
+		$this->rewind();
147
+		while ($this->valid()) {
148
+			if ($this->current() === $object) {
149
+				break;
150
+			}
151
+			$this->next();
152
+		}
153
+	}
154
+
155
+
156
+	/**
157
+	 * set_current_by_info
158
+	 *
159
+	 * advances pointer to the object whose info matches that which was provided
160
+	 *
161
+	 * @access public
162
+	 * @param $info
163
+	 * @return void
164
+	 */
165
+	public function set_current_by_info($info)
166
+	{
167
+		$this->rewind();
168
+		while ($this->valid()) {
169
+			if ($info === $this->getInfo()) {
170
+				break;
171
+			}
172
+			$this->next();
173
+		}
174
+	}
175 175
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     public function add($object, $info = null)
41 41
     {
42 42
         $class = $this->interface;
43
-        if (! $object instanceof $class) {
43
+        if ( ! $object instanceof $class) {
44 44
             return false;
45 45
         }
46 46
         $this->attach($object);
Please login to merge, or discard this patch.
core/helpers/EEH_Event_View.helper.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * get_event
23 23
      * attempts to retrieve an EE_Event object any way it can
24 24
      *
25
-     * @param int|WP_Post $EVT_ID
25
+     * @param integer $EVT_ID
26 26
      * @return EE_Event|null
27 27
      * @throws \EE_Error
28 28
      */
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      *
116 116
      *  @access     public
117 117
      * @param    int $EVT_ID
118
-     *  @return     string
118
+     *  @return     boolean
119 119
      */
120 120
     public static function event_has_content_or_excerpt($EVT_ID = 0)
121 121
     {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      *    event_active_status
137 137
      *
138 138
      * @access    public
139
-     * @param null $num_words
139
+     * @param integer $num_words
140 140
      * @param null $more
141 141
      * @return    string
142 142
      */
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      *
479 479
      * @access    public
480 480
      * @param int $EVT_ID
481
-     * @param null $include_expired
481
+     * @param false|null $include_expired
482 482
      * @param bool $include_deleted
483 483
      * @param null $limit
484 484
      * @return EE_Datetime[]
Please login to merge, or discard this patch.
Indentation   +569 added lines, -569 removed lines patch added patch discarded remove patch
@@ -11,578 +11,578 @@
 block discarded – undo
11 11
 class EEH_Event_View extends EEH_Base
12 12
 {
13 13
 
14
-    /**
15
-     * @var EE_Event $_event
16
-     */
17
-    private static $_event = null;
18
-
19
-
20
-
21
-    /**
22
-     * get_event
23
-     * attempts to retrieve an EE_Event object any way it can
24
-     *
25
-     * @param int|WP_Post $EVT_ID
26
-     * @return EE_Event|null
27
-     * @throws \EE_Error
28
-     */
29
-    public static function get_event($EVT_ID = 0)
30
-    {
31
-        // international newspaper?
32
-        global $post;
33
-        $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events'
34
-            ? $EVT_ID->ID
35
-            : absint($EVT_ID);
36
-        // do we already have the Event  you are looking for?
37
-        if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
38
-            return EEH_Event_View::$_event;
39
-        }
40
-        // reset property so that the new event is cached.
41
-        EEH_Event_View::$_event = null;
42
-        if (! $EVT_ID && $post instanceof EE_Event) {
43
-            EEH_Event_View::$_event = $post;
44
-            return EEH_Event_View::$_event;
45
-        }
46
-        // if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID
47
-        // then let's just use that cached event on the $post object.
48
-        if ($post instanceof WP_Post
49
-            && $post->post_type === 'espresso_events'
50
-            && isset($post->EE_Event)
51
-            && (
52
-                $EVT_ID === 0
53
-                || $EVT_ID === $post->ID
54
-            )
55
-        ) {
56
-            EEH_Event_View::$_event = $post->EE_Event;
57
-            return EEH_Event_View::$_event;
58
-        }
59
-        // If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID.
60
-        if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
61
-            EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
62
-        }
63
-        return EEH_Event_View::$_event;
64
-    }
65
-
66
-
67
-
68
-    /**
69
-     *    display_ticket_selector
70
-     *
71
-     * @access    public
72
-     * @param    int $EVT_ID
73
-     * @return    boolean
74
-     */
75
-    public static function display_ticket_selector($EVT_ID = 0)
76
-    {
77
-        $event = EEH_Event_View::get_event($EVT_ID);
78
-        return $event instanceof EE_Event ? $event->display_ticket_selector() : false;
79
-    }
80
-
81
-
82
-
83
-    /**
84
-     *    event_status
85
-     *
86
-     * @access    public
87
-     * @param    int $EVT_ID
88
-     * @return    string
89
-     */
90
-    public static function event_status($EVT_ID = 0)
91
-    {
92
-        $event = EEH_Event_View::get_event($EVT_ID);
93
-        return $event instanceof EE_Event ? $event->pretty_active_status(false) : '';
94
-    }
95
-
96
-
97
-
98
-    /**
99
-     *  event_active_status
100
-     *
101
-     *  @access     public
102
-     * @param    int $EVT_ID
103
-     *  @return     string
104
-     */
105
-    public static function event_active_status($EVT_ID = 0)
106
-    {
107
-        $event = EEH_Event_View::get_event($EVT_ID);
108
-        return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive';
109
-    }
110
-
111
-
112
-
113
-    /**
114
-     *  event_has_content_or_excerpt
115
-     *
116
-     *  @access     public
117
-     * @param    int $EVT_ID
118
-     *  @return     string
119
-     */
120
-    public static function event_has_content_or_excerpt($EVT_ID = 0)
121
-    {
122
-        $event = EEH_Event_View::get_event($EVT_ID);
123
-        $has_content_or_excerpt = false;
124
-        if ($event instanceof EE_Event) {
125
-            $has_content_or_excerpt = $event->description() != '' || $event->short_description(null, null, true) != '' ? true : false;
126
-        }
127
-        if (is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) {
128
-            $has_content_or_excerpt = false;
129
-        }
130
-        return $has_content_or_excerpt;
131
-    }
132
-
133
-
134
-
135
-    /**
136
-     *    event_active_status
137
-     *
138
-     * @access    public
139
-     * @param null $num_words
140
-     * @param null $more
141
-     * @return    string
142
-     */
143
-    public static function event_content_or_excerpt($num_words = null, $more = null)
144
-    {
145
-        global $post;
146
-        ob_start();
147
-        if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
148
-            // admin has chosen "full description"
149
-            // for the "Event Espresso - Events > Templates > Display Description" option
150
-            the_content();
151
-        } elseif (( is_archive() && espresso_display_excerpt_in_event_list() )) {
152
-            if (has_excerpt($post->ID)) {
153
-                // admin has chosen "excerpt (short desc)"
154
-                // for the "Event Espresso - Events > Templates > Display Description" option
155
-                // AND an excerpt actually exists
156
-                the_excerpt();
157
-            } else {
158
-                // admin has chosen "excerpt (short desc)"
159
-                // for the "Event Espresso - Events > Templates > Display Description" option
160
-                // but NO excerpt actually exists, so we need to create one
161
-                if (! empty($num_words)) {
162
-                    if (empty($more)) {
163
-                        $more_link_text = __('(more&hellip;)', 'event_espresso');
164
-                        $more = ' <a href="' . get_permalink() . '"';
165
-                        $more .= ' class="more-link"';
166
-                        $more .= \EED_Events_Archive::link_target();
167
-                        $more .= '>' . $more_link_text . '</a>';
168
-                        $more = apply_filters('the_content_more_link', $more, $more_link_text);
169
-                    }
170
-                    $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
171
-
172
-                    $content =  wp_trim_words($content, $num_words, ' ') . $more;
173
-                } else {
174
-                    $content =  get_the_content();
175
-                }
176
-                global $allowedtags;
177
-                // make sure links are allowed
178
-                $allowedtags['a'] = isset($allowedtags['a'])
179
-                    ? $allowedtags['a']
180
-                    : array();
181
-                // as well as target attribute
182
-                $allowedtags['a']['target'] = isset($allowedtags['a']['target'])
183
-                    ? $allowedtags['a']['target']
184
-                    : false;
185
-                // but get previous value so we can reset it
186
-                $prev_value = $allowedtags['a']['target'];
187
-                $allowedtags['a']['target'] = true;
188
-                $content = wp_kses($content, $allowedtags);
189
-                $content = strip_shortcodes($content);
190
-                echo apply_filters('the_content', $content);
191
-                $allowedtags['a']['target'] = $prev_value;
192
-            }
193
-        } else {
194
-            // admin has chosen "none"
195
-            // for the "Event Espresso - Events > Templates > Display Description" option
196
-            echo apply_filters('the_content', '');
197
-        }
198
-        return ob_get_clean();
199
-    }
200
-
201
-
202
-
203
-    /**
204
-     *  event_tickets_available
205
-     *
206
-     *  @access     public
207
-     * @param    int $EVT_ID
208
-     *  @return     EE_Ticket[]
209
-     */
210
-    public static function event_tickets_available($EVT_ID = 0)
211
-    {
212
-        $event = EEH_Event_View::get_event($EVT_ID);
213
-        $tickets_available_for_purchase = array();
214
-        if ($event instanceof EE_Event) {
215
-            $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, false);
216
-            foreach ($datetimes as $datetime) {
217
-                $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
218
-            }
219
-        }
220
-        return $tickets_available_for_purchase;
221
-    }
222
-
223
-
224
-
225
-    /**
226
-     *    the_event_date
227
-     *
228
-     * @access    public
229
-     * @param    int $EVT_ID
230
-     * @param     bool   $hide_uncategorized
231
-     * @return    string
232
-     */
233
-    public static function event_categories($EVT_ID = 0, $hide_uncategorized = true)
234
-    {
235
-        $category_links = array();
236
-        $event = EEH_Event_View::get_event($EVT_ID);
237
-        if ($event instanceof EE_Event) {
238
-            $event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
239
-            if ($event_categories) {
240
-                // loop thru terms and create links
241
-                foreach ($event_categories as $term) {
242
-                    $url = get_term_link($term, 'espresso_venue_categories');
243
-                    if (! is_wp_error($url) && (( $hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized )) {
244
-                        $category_links[] = '<a href="' . esc_url($url)
245
-                                            . '" rel="tag"'
246
-                                            . \EED_Events_Archive::link_target()
247
-                                            .'>'
248
-                                            . $term->name
249
-                                            . '</a>';
250
-                    }
251
-                }
252
-            }
253
-        }
254
-        return implode(', ', $category_links);
255
-    }
256
-
257
-
258
-
259
-    /**
260
-     *    the_event_date - first date by date order
261
-     *
262
-     * @access    public
263
-     * @param string $dt_frmt
264
-     * @param string $tm_frmt
265
-     * @param int    $EVT_ID
266
-     * @return    string
267
-     */
268
-    public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
269
-    {
270
-        $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
271
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
272
-        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) :  '';
273
-    }
274
-
275
-
276
-
277
-    /**
278
-     *    the_event_end_date - last date by date order
279
-     *
280
-     * @access    public
281
-     * @param string $dt_frmt
282
-     * @param string $tm_frmt
283
-     * @param int    $EVT_ID
284
-     * @return    string
285
-     */
286
-    public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
287
-    {
288
-        $datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
289
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
290
-        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
291
-    }
292
-
293
-
294
-
295
-    /**
296
-     *    the_earliest_event_date - first date chronologically
297
-     *
298
-     * @access    public
299
-     * @param string $dt_frmt
300
-     * @param string $tm_frmt
301
-     * @param int    $EVT_ID
302
-     * @return    string
303
-     */
304
-    public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
305
-    {
306
-        $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
307
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
308
-        return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
309
-    }
310
-
311
-
312
-
313
-    /**
314
-     *    the_latest_event_date - latest date chronologically
315
-     *
316
-     * @access    public
317
-     * @param string $dt_frmt
318
-     * @param string $tm_frmt
319
-     * @param int    $EVT_ID
320
-     * @return    string
321
-     */
322
-    public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
323
-    {
324
-        $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID);
325
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
326
-        return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
327
-    }
328
-
329
-
330
-
331
-    /**
332
-     *    event_date_as_calendar_page
333
-     *
334
-     * @access    public
335
-     * @param int $EVT_ID
336
-     * @return    string
337
-     */
338
-    public static function event_date_as_calendar_page($EVT_ID = 0)
339
-    {
340
-        $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
341
-        if ($datetime instanceof EE_Datetime) {
342
-    ?>
14
+	/**
15
+	 * @var EE_Event $_event
16
+	 */
17
+	private static $_event = null;
18
+
19
+
20
+
21
+	/**
22
+	 * get_event
23
+	 * attempts to retrieve an EE_Event object any way it can
24
+	 *
25
+	 * @param int|WP_Post $EVT_ID
26
+	 * @return EE_Event|null
27
+	 * @throws \EE_Error
28
+	 */
29
+	public static function get_event($EVT_ID = 0)
30
+	{
31
+		// international newspaper?
32
+		global $post;
33
+		$EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events'
34
+			? $EVT_ID->ID
35
+			: absint($EVT_ID);
36
+		// do we already have the Event  you are looking for?
37
+		if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
38
+			return EEH_Event_View::$_event;
39
+		}
40
+		// reset property so that the new event is cached.
41
+		EEH_Event_View::$_event = null;
42
+		if (! $EVT_ID && $post instanceof EE_Event) {
43
+			EEH_Event_View::$_event = $post;
44
+			return EEH_Event_View::$_event;
45
+		}
46
+		// if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID
47
+		// then let's just use that cached event on the $post object.
48
+		if ($post instanceof WP_Post
49
+			&& $post->post_type === 'espresso_events'
50
+			&& isset($post->EE_Event)
51
+			&& (
52
+				$EVT_ID === 0
53
+				|| $EVT_ID === $post->ID
54
+			)
55
+		) {
56
+			EEH_Event_View::$_event = $post->EE_Event;
57
+			return EEH_Event_View::$_event;
58
+		}
59
+		// If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID.
60
+		if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
61
+			EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
62
+		}
63
+		return EEH_Event_View::$_event;
64
+	}
65
+
66
+
67
+
68
+	/**
69
+	 *    display_ticket_selector
70
+	 *
71
+	 * @access    public
72
+	 * @param    int $EVT_ID
73
+	 * @return    boolean
74
+	 */
75
+	public static function display_ticket_selector($EVT_ID = 0)
76
+	{
77
+		$event = EEH_Event_View::get_event($EVT_ID);
78
+		return $event instanceof EE_Event ? $event->display_ticket_selector() : false;
79
+	}
80
+
81
+
82
+
83
+	/**
84
+	 *    event_status
85
+	 *
86
+	 * @access    public
87
+	 * @param    int $EVT_ID
88
+	 * @return    string
89
+	 */
90
+	public static function event_status($EVT_ID = 0)
91
+	{
92
+		$event = EEH_Event_View::get_event($EVT_ID);
93
+		return $event instanceof EE_Event ? $event->pretty_active_status(false) : '';
94
+	}
95
+
96
+
97
+
98
+	/**
99
+	 *  event_active_status
100
+	 *
101
+	 *  @access     public
102
+	 * @param    int $EVT_ID
103
+	 *  @return     string
104
+	 */
105
+	public static function event_active_status($EVT_ID = 0)
106
+	{
107
+		$event = EEH_Event_View::get_event($EVT_ID);
108
+		return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive';
109
+	}
110
+
111
+
112
+
113
+	/**
114
+	 *  event_has_content_or_excerpt
115
+	 *
116
+	 *  @access     public
117
+	 * @param    int $EVT_ID
118
+	 *  @return     string
119
+	 */
120
+	public static function event_has_content_or_excerpt($EVT_ID = 0)
121
+	{
122
+		$event = EEH_Event_View::get_event($EVT_ID);
123
+		$has_content_or_excerpt = false;
124
+		if ($event instanceof EE_Event) {
125
+			$has_content_or_excerpt = $event->description() != '' || $event->short_description(null, null, true) != '' ? true : false;
126
+		}
127
+		if (is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) {
128
+			$has_content_or_excerpt = false;
129
+		}
130
+		return $has_content_or_excerpt;
131
+	}
132
+
133
+
134
+
135
+	/**
136
+	 *    event_active_status
137
+	 *
138
+	 * @access    public
139
+	 * @param null $num_words
140
+	 * @param null $more
141
+	 * @return    string
142
+	 */
143
+	public static function event_content_or_excerpt($num_words = null, $more = null)
144
+	{
145
+		global $post;
146
+		ob_start();
147
+		if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
148
+			// admin has chosen "full description"
149
+			// for the "Event Espresso - Events > Templates > Display Description" option
150
+			the_content();
151
+		} elseif (( is_archive() && espresso_display_excerpt_in_event_list() )) {
152
+			if (has_excerpt($post->ID)) {
153
+				// admin has chosen "excerpt (short desc)"
154
+				// for the "Event Espresso - Events > Templates > Display Description" option
155
+				// AND an excerpt actually exists
156
+				the_excerpt();
157
+			} else {
158
+				// admin has chosen "excerpt (short desc)"
159
+				// for the "Event Espresso - Events > Templates > Display Description" option
160
+				// but NO excerpt actually exists, so we need to create one
161
+				if (! empty($num_words)) {
162
+					if (empty($more)) {
163
+						$more_link_text = __('(more&hellip;)', 'event_espresso');
164
+						$more = ' <a href="' . get_permalink() . '"';
165
+						$more .= ' class="more-link"';
166
+						$more .= \EED_Events_Archive::link_target();
167
+						$more .= '>' . $more_link_text . '</a>';
168
+						$more = apply_filters('the_content_more_link', $more, $more_link_text);
169
+					}
170
+					$content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
171
+
172
+					$content =  wp_trim_words($content, $num_words, ' ') . $more;
173
+				} else {
174
+					$content =  get_the_content();
175
+				}
176
+				global $allowedtags;
177
+				// make sure links are allowed
178
+				$allowedtags['a'] = isset($allowedtags['a'])
179
+					? $allowedtags['a']
180
+					: array();
181
+				// as well as target attribute
182
+				$allowedtags['a']['target'] = isset($allowedtags['a']['target'])
183
+					? $allowedtags['a']['target']
184
+					: false;
185
+				// but get previous value so we can reset it
186
+				$prev_value = $allowedtags['a']['target'];
187
+				$allowedtags['a']['target'] = true;
188
+				$content = wp_kses($content, $allowedtags);
189
+				$content = strip_shortcodes($content);
190
+				echo apply_filters('the_content', $content);
191
+				$allowedtags['a']['target'] = $prev_value;
192
+			}
193
+		} else {
194
+			// admin has chosen "none"
195
+			// for the "Event Espresso - Events > Templates > Display Description" option
196
+			echo apply_filters('the_content', '');
197
+		}
198
+		return ob_get_clean();
199
+	}
200
+
201
+
202
+
203
+	/**
204
+	 *  event_tickets_available
205
+	 *
206
+	 *  @access     public
207
+	 * @param    int $EVT_ID
208
+	 *  @return     EE_Ticket[]
209
+	 */
210
+	public static function event_tickets_available($EVT_ID = 0)
211
+	{
212
+		$event = EEH_Event_View::get_event($EVT_ID);
213
+		$tickets_available_for_purchase = array();
214
+		if ($event instanceof EE_Event) {
215
+			$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, false);
216
+			foreach ($datetimes as $datetime) {
217
+				$tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
218
+			}
219
+		}
220
+		return $tickets_available_for_purchase;
221
+	}
222
+
223
+
224
+
225
+	/**
226
+	 *    the_event_date
227
+	 *
228
+	 * @access    public
229
+	 * @param    int $EVT_ID
230
+	 * @param     bool   $hide_uncategorized
231
+	 * @return    string
232
+	 */
233
+	public static function event_categories($EVT_ID = 0, $hide_uncategorized = true)
234
+	{
235
+		$category_links = array();
236
+		$event = EEH_Event_View::get_event($EVT_ID);
237
+		if ($event instanceof EE_Event) {
238
+			$event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
239
+			if ($event_categories) {
240
+				// loop thru terms and create links
241
+				foreach ($event_categories as $term) {
242
+					$url = get_term_link($term, 'espresso_venue_categories');
243
+					if (! is_wp_error($url) && (( $hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized )) {
244
+						$category_links[] = '<a href="' . esc_url($url)
245
+											. '" rel="tag"'
246
+											. \EED_Events_Archive::link_target()
247
+											.'>'
248
+											. $term->name
249
+											. '</a>';
250
+					}
251
+				}
252
+			}
253
+		}
254
+		return implode(', ', $category_links);
255
+	}
256
+
257
+
258
+
259
+	/**
260
+	 *    the_event_date - first date by date order
261
+	 *
262
+	 * @access    public
263
+	 * @param string $dt_frmt
264
+	 * @param string $tm_frmt
265
+	 * @param int    $EVT_ID
266
+	 * @return    string
267
+	 */
268
+	public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
269
+	{
270
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
271
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
272
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) :  '';
273
+	}
274
+
275
+
276
+
277
+	/**
278
+	 *    the_event_end_date - last date by date order
279
+	 *
280
+	 * @access    public
281
+	 * @param string $dt_frmt
282
+	 * @param string $tm_frmt
283
+	 * @param int    $EVT_ID
284
+	 * @return    string
285
+	 */
286
+	public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
287
+	{
288
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
289
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
290
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
291
+	}
292
+
293
+
294
+
295
+	/**
296
+	 *    the_earliest_event_date - first date chronologically
297
+	 *
298
+	 * @access    public
299
+	 * @param string $dt_frmt
300
+	 * @param string $tm_frmt
301
+	 * @param int    $EVT_ID
302
+	 * @return    string
303
+	 */
304
+	public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
305
+	{
306
+		$datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
307
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
308
+		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
309
+	}
310
+
311
+
312
+
313
+	/**
314
+	 *    the_latest_event_date - latest date chronologically
315
+	 *
316
+	 * @access    public
317
+	 * @param string $dt_frmt
318
+	 * @param string $tm_frmt
319
+	 * @param int    $EVT_ID
320
+	 * @return    string
321
+	 */
322
+	public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
323
+	{
324
+		$datetime = EEH_Event_View::get_latest_date_obj($EVT_ID);
325
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
326
+		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
327
+	}
328
+
329
+
330
+
331
+	/**
332
+	 *    event_date_as_calendar_page
333
+	 *
334
+	 * @access    public
335
+	 * @param int $EVT_ID
336
+	 * @return    string
337
+	 */
338
+	public static function event_date_as_calendar_page($EVT_ID = 0)
339
+	{
340
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
341
+		if ($datetime instanceof EE_Datetime) {
342
+	?>
343 343
         <div class="event-date-calendar-page-dv">
344 344
             <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M');?></div>
345 345
             <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d');?></div>
346 346
         </div>
347 347
     <?php
348
-        }
349
-    }
350
-
351
-
352
-
353
-    /**
354
-     *    get_primary_date_obj - orders date by DTT_order
355
-     *
356
-     * @access    public
357
-     * @param int $EVT_ID
358
-     * @return    string
359
-     */
360
-    public static function get_primary_date_obj($EVT_ID = 0)
361
-    {
362
-        $event = EEH_Event_View::get_event($EVT_ID);
363
-        if ($event instanceof EE_Event) {
364
-            $datetimes = $event->get_many_related(
365
-                'Datetime',
366
-                array(
367
-                    'limit' => 1,
368
-                    'order_by' => array( 'DTT_order' => 'ASC' )
369
-                )
370
-            );
371
-            return reset($datetimes);
372
-        } else {
373
-             return false;
374
-        }
375
-    }
376
-
377
-
378
-
379
-    /**
380
-     *    get_last_date_obj - orders date by DTT_order
381
-     *
382
-     * @access    public
383
-     * @param int $EVT_ID
384
-     * @return    string
385
-     */
386
-    public static function get_last_date_obj($EVT_ID = 0)
387
-    {
388
-        $event = EEH_Event_View::get_event($EVT_ID);
389
-        if ($event instanceof EE_Event) {
390
-            $datetimes = $event->get_many_related(
391
-                'Datetime',
392
-                array(
393
-                    'limit' => 1,
394
-                    'order_by' => array( 'DTT_order' => 'DESC' )
395
-                )
396
-            );
397
-            return end($datetimes);
398
-        } else {
399
-            return false;
400
-        }
401
-    }
402
-
403
-
404
-
405
-    /**
406
-     *    get_earliest_date_obj - orders date chronologically
407
-     *
408
-     * @access    public
409
-     * @param int $EVT_ID
410
-     * @return    string
411
-     */
412
-    public static function get_earliest_date_obj($EVT_ID = 0)
413
-    {
414
-        $event = EEH_Event_View::get_event($EVT_ID);
415
-        if ($event instanceof EE_Event) {
416
-            $datetimes = $event->get_many_related(
417
-                'Datetime',
418
-                array(
419
-                    'limit' => 1,
420
-                    'order_by' => array( 'DTT_EVT_start' => 'ASC' )
421
-                )
422
-            );
423
-            return reset($datetimes);
424
-        } else {
425
-             return false;
426
-        }
427
-    }
428
-
429
-
430
-
431
-    /**
432
-     *    get_latest_date_obj - orders date chronologically
433
-     *
434
-     * @access    public
435
-     * @param int $EVT_ID
436
-     * @return    string
437
-     */
438
-    public static function get_latest_date_obj($EVT_ID = 0)
439
-    {
440
-        $event = EEH_Event_View::get_event($EVT_ID);
441
-        if ($event instanceof EE_Event) {
442
-            $datetimes = $event->get_many_related(
443
-                'Datetime',
444
-                array(
445
-                    'limit' => 1,
446
-                    'order_by' => array( 'DTT_EVT_start' => 'DESC' )
447
-                )
448
-            );
449
-            return end($datetimes);
450
-        } else {
451
-            return false;
452
-        }
453
-    }
454
-
455
-    /**
456
-     *    get_next_upcoming_date_obj - return the next upcoming datetime
457
-     *
458
-     * @access    public
459
-     * @param int $EVT_ID
460
-     * @return    EE_Datetime|null
461
-     */
462
-    public static function get_next_upcoming_date_obj($EVT_ID = 0)
463
-    {
464
-        $datetime = EEM_Datetime::instance()->get_one(
465
-            array(
466
-                array(
467
-                    'Event.EVT_ID' => $EVT_ID,
468
-                    'DTT_EVT_start' => array('>=', current_time('mysql', true))
469
-                ),
470
-                'order_by' => array('DTT_EVT_start' => 'asc')
471
-            )
472
-        );
473
-        return $datetime instanceof EE_Datetime ? $datetime : null;
474
-    }
475
-
476
-    /**
477
-     *    get_all_date_obj
478
-     *
479
-     * @access    public
480
-     * @param int $EVT_ID
481
-     * @param null $include_expired
482
-     * @param bool $include_deleted
483
-     * @param null $limit
484
-     * @return EE_Datetime[]
485
-     */
486
-    public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = null)
487
-    {
488
-        $event = EEH_Event_View::get_event($EVT_ID);
489
-        if ($include_expired === null) {
490
-            if ($event instanceof EE_Event && $event->is_expired()) {
491
-                $include_expired = true;
492
-            } else {
493
-                $include_expired = false;
494
-            }
495
-        }
496
-
497
-        if ($event instanceof EE_Event) {
498
-            return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
499
-        } else {
500
-             return array();
501
-        }
502
-    }
503
-
504
-
505
-
506
-    /**
507
-     *    event_link_url
508
-     *
509
-     * @access    public
510
-     * @param int $EVT_ID
511
-     * @return    string
512
-     */
513
-    public static function event_link_url($EVT_ID = 0)
514
-    {
515
-        $event = EEH_Event_View::get_event($EVT_ID);
516
-        if ($event instanceof EE_Event) {
517
-            $url = $event->external_url() !== null && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID());
518
-            return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://' . $url;
519
-        }
520
-        return null;
521
-    }
522
-
523
-
524
-
525
-    /**
526
-     *    event_phone
527
-     *
528
-     * @access    public
529
-     * @param int $EVT_ID
530
-     * @return    string
531
-     */
532
-    public static function event_phone($EVT_ID = 0)
533
-    {
534
-        $event = EEH_Event_View::get_event($EVT_ID);
535
-        if ($event instanceof EE_Event) {
536
-            return EEH_Schema::telephone($event->phone());
537
-        }
538
-        return null;
539
-    }
540
-
541
-
542
-
543
-    /**
544
-     *    edit_event_link
545
-     *
546
-     * @access    public
547
-     * @param int    $EVT_ID
548
-     * @param string $link
549
-     * @param string $before
550
-     * @param string $after
551
-     * @return    string
552
-     */
553
-    public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '')
554
-    {
555
-        $event = EEH_Event_View::get_event($EVT_ID);
556
-        if ($event instanceof EE_Event) {
557
-            // can the user edit this post ?
558
-            if (current_user_can('edit_post', $event->ID())) {
559
-                // set link text
560
-                $link_text = ! empty($link) ? $link : __('edit this event', 'event_espresso');
561
-                // generate nonce
562
-                $nonce = wp_create_nonce('edit_nonce');
563
-                // generate url to event editor for this event
564
-                $url = add_query_arg(array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url());
565
-                // get edit CPT text
566
-                $post_type_obj = get_post_type_object('espresso_events');
567
-                // build final link html
568
-                $link = '<a class="post-edit-link" href="' . $url . '" ';
569
-                $link .= ' title="' . esc_attr($post_type_obj->labels->edit_item) . '"';
570
-                $link .= \EED_Events_Archive::link_target();
571
-                $link .='>' . $link_text . '</a>';
572
-                // put it all together
573
-                return $before . apply_filters('edit_post_link', $link, $event->ID()) . $after;
574
-            }
575
-        }
576
-        return '';
577
-    }
578
-
579
-
580
-
581
-    /**
582
-     * @return string
583
-     */
584
-    public static function event_archive_url()
585
-    {
586
-        return get_post_type_archive_link('espresso_events');
587
-    }
348
+		}
349
+	}
350
+
351
+
352
+
353
+	/**
354
+	 *    get_primary_date_obj - orders date by DTT_order
355
+	 *
356
+	 * @access    public
357
+	 * @param int $EVT_ID
358
+	 * @return    string
359
+	 */
360
+	public static function get_primary_date_obj($EVT_ID = 0)
361
+	{
362
+		$event = EEH_Event_View::get_event($EVT_ID);
363
+		if ($event instanceof EE_Event) {
364
+			$datetimes = $event->get_many_related(
365
+				'Datetime',
366
+				array(
367
+					'limit' => 1,
368
+					'order_by' => array( 'DTT_order' => 'ASC' )
369
+				)
370
+			);
371
+			return reset($datetimes);
372
+		} else {
373
+			 return false;
374
+		}
375
+	}
376
+
377
+
378
+
379
+	/**
380
+	 *    get_last_date_obj - orders date by DTT_order
381
+	 *
382
+	 * @access    public
383
+	 * @param int $EVT_ID
384
+	 * @return    string
385
+	 */
386
+	public static function get_last_date_obj($EVT_ID = 0)
387
+	{
388
+		$event = EEH_Event_View::get_event($EVT_ID);
389
+		if ($event instanceof EE_Event) {
390
+			$datetimes = $event->get_many_related(
391
+				'Datetime',
392
+				array(
393
+					'limit' => 1,
394
+					'order_by' => array( 'DTT_order' => 'DESC' )
395
+				)
396
+			);
397
+			return end($datetimes);
398
+		} else {
399
+			return false;
400
+		}
401
+	}
402
+
403
+
404
+
405
+	/**
406
+	 *    get_earliest_date_obj - orders date chronologically
407
+	 *
408
+	 * @access    public
409
+	 * @param int $EVT_ID
410
+	 * @return    string
411
+	 */
412
+	public static function get_earliest_date_obj($EVT_ID = 0)
413
+	{
414
+		$event = EEH_Event_View::get_event($EVT_ID);
415
+		if ($event instanceof EE_Event) {
416
+			$datetimes = $event->get_many_related(
417
+				'Datetime',
418
+				array(
419
+					'limit' => 1,
420
+					'order_by' => array( 'DTT_EVT_start' => 'ASC' )
421
+				)
422
+			);
423
+			return reset($datetimes);
424
+		} else {
425
+			 return false;
426
+		}
427
+	}
428
+
429
+
430
+
431
+	/**
432
+	 *    get_latest_date_obj - orders date chronologically
433
+	 *
434
+	 * @access    public
435
+	 * @param int $EVT_ID
436
+	 * @return    string
437
+	 */
438
+	public static function get_latest_date_obj($EVT_ID = 0)
439
+	{
440
+		$event = EEH_Event_View::get_event($EVT_ID);
441
+		if ($event instanceof EE_Event) {
442
+			$datetimes = $event->get_many_related(
443
+				'Datetime',
444
+				array(
445
+					'limit' => 1,
446
+					'order_by' => array( 'DTT_EVT_start' => 'DESC' )
447
+				)
448
+			);
449
+			return end($datetimes);
450
+		} else {
451
+			return false;
452
+		}
453
+	}
454
+
455
+	/**
456
+	 *    get_next_upcoming_date_obj - return the next upcoming datetime
457
+	 *
458
+	 * @access    public
459
+	 * @param int $EVT_ID
460
+	 * @return    EE_Datetime|null
461
+	 */
462
+	public static function get_next_upcoming_date_obj($EVT_ID = 0)
463
+	{
464
+		$datetime = EEM_Datetime::instance()->get_one(
465
+			array(
466
+				array(
467
+					'Event.EVT_ID' => $EVT_ID,
468
+					'DTT_EVT_start' => array('>=', current_time('mysql', true))
469
+				),
470
+				'order_by' => array('DTT_EVT_start' => 'asc')
471
+			)
472
+		);
473
+		return $datetime instanceof EE_Datetime ? $datetime : null;
474
+	}
475
+
476
+	/**
477
+	 *    get_all_date_obj
478
+	 *
479
+	 * @access    public
480
+	 * @param int $EVT_ID
481
+	 * @param null $include_expired
482
+	 * @param bool $include_deleted
483
+	 * @param null $limit
484
+	 * @return EE_Datetime[]
485
+	 */
486
+	public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = null)
487
+	{
488
+		$event = EEH_Event_View::get_event($EVT_ID);
489
+		if ($include_expired === null) {
490
+			if ($event instanceof EE_Event && $event->is_expired()) {
491
+				$include_expired = true;
492
+			} else {
493
+				$include_expired = false;
494
+			}
495
+		}
496
+
497
+		if ($event instanceof EE_Event) {
498
+			return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
499
+		} else {
500
+			 return array();
501
+		}
502
+	}
503
+
504
+
505
+
506
+	/**
507
+	 *    event_link_url
508
+	 *
509
+	 * @access    public
510
+	 * @param int $EVT_ID
511
+	 * @return    string
512
+	 */
513
+	public static function event_link_url($EVT_ID = 0)
514
+	{
515
+		$event = EEH_Event_View::get_event($EVT_ID);
516
+		if ($event instanceof EE_Event) {
517
+			$url = $event->external_url() !== null && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID());
518
+			return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://' . $url;
519
+		}
520
+		return null;
521
+	}
522
+
523
+
524
+
525
+	/**
526
+	 *    event_phone
527
+	 *
528
+	 * @access    public
529
+	 * @param int $EVT_ID
530
+	 * @return    string
531
+	 */
532
+	public static function event_phone($EVT_ID = 0)
533
+	{
534
+		$event = EEH_Event_View::get_event($EVT_ID);
535
+		if ($event instanceof EE_Event) {
536
+			return EEH_Schema::telephone($event->phone());
537
+		}
538
+		return null;
539
+	}
540
+
541
+
542
+
543
+	/**
544
+	 *    edit_event_link
545
+	 *
546
+	 * @access    public
547
+	 * @param int    $EVT_ID
548
+	 * @param string $link
549
+	 * @param string $before
550
+	 * @param string $after
551
+	 * @return    string
552
+	 */
553
+	public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '')
554
+	{
555
+		$event = EEH_Event_View::get_event($EVT_ID);
556
+		if ($event instanceof EE_Event) {
557
+			// can the user edit this post ?
558
+			if (current_user_can('edit_post', $event->ID())) {
559
+				// set link text
560
+				$link_text = ! empty($link) ? $link : __('edit this event', 'event_espresso');
561
+				// generate nonce
562
+				$nonce = wp_create_nonce('edit_nonce');
563
+				// generate url to event editor for this event
564
+				$url = add_query_arg(array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url());
565
+				// get edit CPT text
566
+				$post_type_obj = get_post_type_object('espresso_events');
567
+				// build final link html
568
+				$link = '<a class="post-edit-link" href="' . $url . '" ';
569
+				$link .= ' title="' . esc_attr($post_type_obj->labels->edit_item) . '"';
570
+				$link .= \EED_Events_Archive::link_target();
571
+				$link .='>' . $link_text . '</a>';
572
+				// put it all together
573
+				return $before . apply_filters('edit_post_link', $link, $event->ID()) . $after;
574
+			}
575
+		}
576
+		return '';
577
+	}
578
+
579
+
580
+
581
+	/**
582
+	 * @return string
583
+	 */
584
+	public static function event_archive_url()
585
+	{
586
+		return get_post_type_archive_link('espresso_events');
587
+	}
588 588
 }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         }
40 40
         // reset property so that the new event is cached.
41 41
         EEH_Event_View::$_event = null;
42
-        if (! $EVT_ID && $post instanceof EE_Event) {
42
+        if ( ! $EVT_ID && $post instanceof EE_Event) {
43 43
             EEH_Event_View::$_event = $post;
44 44
             return EEH_Event_View::$_event;
45 45
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             return EEH_Event_View::$_event;
58 58
         }
59 59
         // If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID.
60
-        if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
60
+        if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
61 61
             EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
62 62
         }
63 63
         return EEH_Event_View::$_event;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         if ($event instanceof EE_Event) {
125 125
             $has_content_or_excerpt = $event->description() != '' || $event->short_description(null, null, true) != '' ? true : false;
126 126
         }
127
-        if (is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) {
127
+        if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) {
128 128
             $has_content_or_excerpt = false;
129 129
         }
130 130
         return $has_content_or_excerpt;
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
     {
145 145
         global $post;
146 146
         ob_start();
147
-        if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
147
+        if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) {
148 148
             // admin has chosen "full description"
149 149
             // for the "Event Espresso - Events > Templates > Display Description" option
150 150
             the_content();
151
-        } elseif (( is_archive() && espresso_display_excerpt_in_event_list() )) {
151
+        } elseif ((is_archive() && espresso_display_excerpt_in_event_list())) {
152 152
             if (has_excerpt($post->ID)) {
153 153
                 // admin has chosen "excerpt (short desc)"
154 154
                 // for the "Event Espresso - Events > Templates > Display Description" option
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
                 // admin has chosen "excerpt (short desc)"
159 159
                 // for the "Event Espresso - Events > Templates > Display Description" option
160 160
                 // but NO excerpt actually exists, so we need to create one
161
-                if (! empty($num_words)) {
161
+                if ( ! empty($num_words)) {
162 162
                     if (empty($more)) {
163 163
                         $more_link_text = __('(more&hellip;)', 'event_espresso');
164
-                        $more = ' <a href="' . get_permalink() . '"';
164
+                        $more = ' <a href="'.get_permalink().'"';
165 165
                         $more .= ' class="more-link"';
166 166
                         $more .= \EED_Events_Archive::link_target();
167
-                        $more .= '>' . $more_link_text . '</a>';
167
+                        $more .= '>'.$more_link_text.'</a>';
168 168
                         $more = apply_filters('the_content_more_link', $more, $more_link_text);
169 169
                     }
170 170
                     $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
171 171
 
172
-                    $content =  wp_trim_words($content, $num_words, ' ') . $more;
172
+                    $content = wp_trim_words($content, $num_words, ' ').$more;
173 173
                 } else {
174
-                    $content =  get_the_content();
174
+                    $content = get_the_content();
175 175
                 }
176 176
                 global $allowedtags;
177 177
                 // make sure links are allowed
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
                 // loop thru terms and create links
241 241
                 foreach ($event_categories as $term) {
242 242
                     $url = get_term_link($term, 'espresso_venue_categories');
243
-                    if (! is_wp_error($url) && (( $hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized )) {
244
-                        $category_links[] = '<a href="' . esc_url($url)
243
+                    if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
244
+                        $category_links[] = '<a href="'.esc_url($url)
245 245
                                             . '" rel="tag"'
246 246
                                             . \EED_Events_Archive::link_target()
247 247
                                             .'>'
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
     public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
269 269
     {
270 270
         $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
271
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
272
-        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) :  '';
271
+        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
272
+        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
273 273
     }
274 274
 
275 275
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
287 287
     {
288 288
         $datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
289
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
289
+        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
290 290
         return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
291 291
     }
292 292
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
     public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
305 305
     {
306 306
         $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
307
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
308
-        return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
307
+        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
308
+        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
309 309
     }
310 310
 
311 311
 
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
     public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0)
323 323
     {
324 324
         $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID);
325
-        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
326
-        return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
325
+        $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
326
+        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
327 327
     }
328 328
 
329 329
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
         if ($datetime instanceof EE_Datetime) {
342 342
     ?>
343 343
         <div class="event-date-calendar-page-dv">
344
-            <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M');?></div>
345
-            <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d');?></div>
344
+            <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div>
345
+            <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div>
346 346
         </div>
347 347
     <?php
348 348
         }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                 'Datetime',
366 366
                 array(
367 367
                     'limit' => 1,
368
-                    'order_by' => array( 'DTT_order' => 'ASC' )
368
+                    'order_by' => array('DTT_order' => 'ASC')
369 369
                 )
370 370
             );
371 371
             return reset($datetimes);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
                 'Datetime',
392 392
                 array(
393 393
                     'limit' => 1,
394
-                    'order_by' => array( 'DTT_order' => 'DESC' )
394
+                    'order_by' => array('DTT_order' => 'DESC')
395 395
                 )
396 396
             );
397 397
             return end($datetimes);
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
                 'Datetime',
418 418
                 array(
419 419
                     'limit' => 1,
420
-                    'order_by' => array( 'DTT_EVT_start' => 'ASC' )
420
+                    'order_by' => array('DTT_EVT_start' => 'ASC')
421 421
                 )
422 422
             );
423 423
             return reset($datetimes);
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                 'Datetime',
444 444
                 array(
445 445
                     'limit' => 1,
446
-                    'order_by' => array( 'DTT_EVT_start' => 'DESC' )
446
+                    'order_by' => array('DTT_EVT_start' => 'DESC')
447 447
                 )
448 448
             );
449 449
             return end($datetimes);
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         $event = EEH_Event_View::get_event($EVT_ID);
516 516
         if ($event instanceof EE_Event) {
517 517
             $url = $event->external_url() !== null && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID());
518
-            return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://' . $url;
518
+            return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url;
519 519
         }
520 520
         return null;
521 521
     }
@@ -561,16 +561,16 @@  discard block
 block discarded – undo
561 561
                 // generate nonce
562 562
                 $nonce = wp_create_nonce('edit_nonce');
563 563
                 // generate url to event editor for this event
564
-                $url = add_query_arg(array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url());
564
+                $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url());
565 565
                 // get edit CPT text
566 566
                 $post_type_obj = get_post_type_object('espresso_events');
567 567
                 // build final link html
568
-                $link = '<a class="post-edit-link" href="' . $url . '" ';
569
-                $link .= ' title="' . esc_attr($post_type_obj->labels->edit_item) . '"';
568
+                $link = '<a class="post-edit-link" href="'.$url.'" ';
569
+                $link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"';
570 570
                 $link .= \EED_Events_Archive::link_target();
571
-                $link .='>' . $link_text . '</a>';
571
+                $link .= '>'.$link_text.'</a>';
572 572
                 // put it all together
573
-                return $before . apply_filters('edit_post_link', $link, $event->ID()) . $after;
573
+                return $before.apply_filters('edit_post_link', $link, $event->ID()).$after;
574 574
             }
575 575
         }
576 576
         return '';
Please login to merge, or discard this patch.