Completed
Branch FET-Wait-List (ad2a06)
by
unknown
97:18 queued 85:39
created
core/CPTs/EE_CPT_Attendee_Strategy.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @param 	array 	$arguments
40 40
 	 * @return \EE_CPT_Attendee_Strategy
41 41
 	 */
42
-	public function __construct( $arguments = array() ) {
43
-		$this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL;
44
-		$WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL;
42
+	public function __construct($arguments = array()) {
43
+		$this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL;
44
+		$WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL;
45 45
 //		add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
46 46
 	}
47 47
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param WP_Query $wp_query
56 56
 	 * @return    void
57 57
 	 */
58
-	public function the_posts( $posts, WP_Query $wp_query) {
58
+	public function the_posts($posts, WP_Query $wp_query) {
59 59
 		//$EVT = EE_Registry::instance()->load_model( 'Event' );
60 60
 //		EEH_Debug_Tools::printr( $EVT, '$EVT  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
61 61
 //		$EVT_IDs = array();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/EE_Base_Class_Repository.core.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Class EE_Base_Class_Repository
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 * @param array $arguments	arrays of arguments that will be passed to the object's save method
40 40
 	 * @return bool | int
41 41
 	 */
42
-	public function save( $arguments = array() ) {
43
-		return $this->persist( 'save', $arguments );
42
+	public function save($arguments = array()) {
43
+		return $this->persist('save', $arguments);
44 44
 	}
45 45
 
46 46
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @return bool | int
55 55
 	 */
56 56
 	public function save_all() {
57
-		return $this->persist_all( 'save' );
57
+		return $this->persist_all('save');
58 58
 	}
59 59
 
60 60
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @return bool
69 69
 	 */
70 70
 	public function delete() {
71
-		$success = $this->_call_user_func_array_on_current( 'delete' );
72
-		$this->remove( $this->current() );
71
+		$success = $this->_call_user_func_array_on_current('delete');
72
+		$this->remove($this->current());
73 73
 		return $success;
74 74
 	}
75 75
 
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 	public function delete_all() {
87 87
 		$success = true;
88 88
 		$this->rewind();
89
-		while ( $this->valid() ) {
89
+		while ($this->valid()) {
90 90
 			// any db error will result in false being returned
91
-			$success = $this->_call_user_func_array_on_current( 'delete' ) !== false ? $success : false;
91
+			$success = $this->_call_user_func_array_on_current('delete') !== false ? $success : false;
92 92
 			// can't remove current object because valid() requires it
93 93
 			// so just capture current object temporarily
94 94
 			$object = $this->current();
95 95
 			// advance the pointer
96 96
 			$this->next();
97 97
 			// THEN remove the object from the repository
98
-			$this->remove( $object );
98
+			$this->remove($object);
99 99
 		}
100 100
 		return $success;
101 101
 	}
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * @param string $previous_value
114 114
 	 * @return bool | int
115 115
 	 */
116
-	public function update_extra_meta( $meta_key, $meta_value, $previous_value = null ) {
117
-		return $this->_call_user_func_array_on_current( 'update_extra_meta', array( $meta_key, $meta_value, $previous_value ) );
116
+	public function update_extra_meta($meta_key, $meta_value, $previous_value = null) {
117
+		return $this->_call_user_func_array_on_current('update_extra_meta', array($meta_key, $meta_value, $previous_value));
118 118
 	}
119 119
 
120 120
 
Please login to merge, or discard this patch.
core/EE_Data_Mapper.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */	
55 55
 	public  function &instance() {
56 56
 		// check if class object is instantiated
57
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Data_Mapper )) {
57
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Data_Mapper)) {
58 58
 			self::$_instance = new self();
59 59
 		}
60 60
 		return self::$_instance;
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 	 *		@ return void
72 72
 	 */
73 73
 	final function __destruct() {}
74
-	final function __call($a,$b) {}
75
-	public static function __callStatic($a,$b) {}
74
+	final function __call($a, $b) {}
75
+	public static function __callStatic($a, $b) {}
76 76
 	final function __get($a) {}
77
-	final function __set($a,$b) {}
77
+	final function __set($a, $b) {}
78 78
 	final function __isset($a) {}
79 79
 	final function __unset($a) {}
80 80
 	final function __sleep() {
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
 
30 30
    /**
31
-     * instance of the EE_Data_Mapper Object
32
-     * @private _instance
33
-     */
31
+    * instance of the EE_Data_Mapper Object
32
+    * @private _instance
33
+    */
34 34
 	private static $_instance = NULL;
35 35
 
36 36
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 	final function __wakeup() {}
84 84
 	final function __toString() {
85
-	    return '';
86
-    }
85
+		return '';
86
+	}
87 87
 	final function __invoke() {}
88 88
 	final static function __set_state() {}
89 89
 	final function __clone() {}
Please login to merge, or discard this patch.
core/EE_Load_Textdomain.core.php 2 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -60,12 +62,14 @@  discard block
 block discarded – undo
60 62
 	 */
61 63
 	private static function _maybe_get_langfile() {
62 64
 		self::$_lang = get_locale();
63
-		if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) )
64
-			return;
65
+		if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) ) {
66
+					return;
67
+		}
65 68
 
66 69
 		//if lang is en_US or empty then lets just get out.  (Event Espresso core is en_US)
67
-		if ( empty( self::$_lang ) || self::$_lang == 'en_US' )
68
-			return;
70
+		if ( empty( self::$_lang ) || self::$_lang == 'en_US' ) {
71
+					return;
72
+		}
69 73
 
70 74
 		//made it here so let's get the file from the github repo
71 75
 		$sideloader_args = array(
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	public static function load_textdomain() {
40 40
 		self::_maybe_get_langfile();
41 41
 		//now load the textdomain
42
-		if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event_espresso-' . self::$_lang . '.mo' ) ) {
42
+		if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event_espresso-'.self::$_lang.'.mo')) {
43 43
 			load_plugin_textdomain('event_espresso', FALSE, EE_LANGUAGES_SAFE_LOC);
44
-		} else if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo' ) ) {
45
-			load_textdomain( 'event_espresso', EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo'  );
44
+		} else if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo')) {
45
+			load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo');
46 46
 		} else {
47
-			load_plugin_textdomain( 'event_espresso', FALSE, dirname( EE_PLUGIN_BASENAME ) . '/languages/');
47
+			load_plugin_textdomain('event_espresso', FALSE, dirname(EE_PLUGIN_BASENAME).'/languages/');
48 48
 		}
49 49
 	}
50 50
 
@@ -59,24 +59,24 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	private static function _maybe_get_langfile() {
61 61
 		self::$_lang = get_locale();
62
-		if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) )
62
+		if ($has_check = get_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION) || empty(self::$_lang))
63 63
 			return;
64 64
 
65 65
 		//if lang is en_US or empty then lets just get out.  (Event Espresso core is en_US)
66
-		if ( empty( self::$_lang ) || self::$_lang == 'en_US' )
66
+		if (empty(self::$_lang) || self::$_lang == 'en_US')
67 67
 			return;
68 68
 
69 69
 		//made it here so let's get the file from the github repo
70 70
 		$sideloader_args = array(
71
-			'_upload_to' => EE_PLUGIN_DIR_PATH . 'languages/',
72
-			'_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.mo?raw=true',
73
-			'_new_file_name' => 'event_espresso-' . self::$_lang . '.mo'
71
+			'_upload_to' => EE_PLUGIN_DIR_PATH.'languages/',
72
+			'_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-'.self::$_lang.'.mo?raw=true',
73
+			'_new_file_name' => 'event_espresso-'.self::$_lang.'.mo'
74 74
 			);
75 75
 
76 76
 
77
-		$sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE );
77
+		$sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE);
78 78
 
79 79
 		$sideloader->sideload();
80
-		update_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION, 1 );
80
+		update_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION, 1);
81 81
 	}
82 82
 } //end EE_Load_Textdomain
Please login to merge, or discard this patch.
core/EE_Log.core.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  *
4 6
  * Class EE_Log
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Class EE_Log
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return EE_Log
63 63
 	 */
64 64
 	public static function instance() {
65
-		if ( ! self::$_instance instanceof EE_Log ) {
65
+		if ( ! self::$_instance instanceof EE_Log) {
66 66
 			self::$_instance = new self();
67 67
 		}
68 68
 		return self::$_instance;
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	private function __construct() {
76 76
 
77
-		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) {
77
+		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) {
78 78
 			return;
79 79
 		}
80 80
 
81
-		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS;
81
+		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS;
82 82
 		$this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name();
83 83
 		$this->_log = '';
84 84
 		$this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name();
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 		$this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
87 87
 		$this->_remote_log = '';
88 88
 
89
-		add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 );
90
-		add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 );
91
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
92
-			add_action( 'shutdown', array( $this, 'write_log' ), 9999 );
89
+		add_action('admin_init', array($this, 'verify_filesystem'), -10);
90
+		add_action('AHEE_log', array($this, 'log'), 10, 4);
91
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
92
+			add_action('shutdown', array($this, 'write_log'), 9999);
93 93
 			// if WP_DEBUG
94
-			add_action( 'shutdown', array( $this, 'write_debug' ), 9999 );
94
+			add_action('shutdown', array($this, 'write_debug'), 9999);
95 95
 		}
96
-		if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) {
97
-			add_action( 'shutdown', array( $this, 'send_log' ), 9999 );
96
+		if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
97
+			add_action('shutdown', array($this, 'send_log'), 9999);
98 98
 		}
99 99
 
100 100
 	}
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function verify_filesystem() {
110 110
 		try {
111
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file );
112
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file );
113
-			EEH_File::add_htaccess_deny_from_all( $this->_logs_folder );
114
-		} catch( EE_Error $e ){
115
-			EE_Error::add_error( sprintf( __(  'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
111
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file);
112
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file);
113
+			EEH_File::add_htaccess_deny_from_all($this->_logs_folder);
114
+		} catch (EE_Error $e) {
115
+			EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
116 116
 			return;
117 117
 		}
118 118
 	}
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param string $type
130 130
 	 * @return string
131 131
 	 */
132
-	private function _format_message( $file = '', $function = '', $message = '', $type = '' ) {
133
-		$msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
134
-		$msg .= '[' . current_time( 'mysql' ) . '] ';
135
-		$msg .= ! empty( $file ) ? basename( $file ) : '';
136
-		$msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : '';
137
-		$msg .= ! empty( $function ) ? $function . '()' : '';
132
+	private function _format_message($file = '', $function = '', $message = '', $type = '') {
133
+		$msg = '----------------------------------------------------------------------------------------'.PHP_EOL;
134
+		$msg .= '['.current_time('mysql').'] ';
135
+		$msg .= ! empty($file) ? basename($file) : '';
136
+		$msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
137
+		$msg .= ! empty($function) ? $function.'()' : '';
138 138
 		$msg .= PHP_EOL;
139
-		$type = ! empty( $type ) ? $type : 'log message';
140
-		$msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
139
+		$type = ! empty($type) ? $type : 'log message';
140
+		$msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : '';
141 141
 		return $msg;
142 142
 	}
143 143
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param string $message
153 153
 	 * @param string $type
154 154
 	 */
155
-	public function log( $file = '', $function = '', $message = '', $type = '' ) {
156
-		$this->_log .= $this->_format_message( $file, $function, $message, $type );
155
+	public function log($file = '', $function = '', $message = '', $type = '') {
156
+		$this->_log .= $this->_format_message($file, $function, $message, $type);
157 157
 	}
158 158
 
159 159
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	public function write_log() {
166 166
 		try {
167 167
 			//get existing log file and append new log info
168
-			$this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log;
169
-			EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' );
170
-		} catch( EE_Error $e ){
171
-			EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
168
+			$this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log;
169
+			EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log');
170
+		} catch (EE_Error $e) {
171
+			EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
172 172
 			return;
173 173
 		}
174 174
 	}
@@ -181,31 +181,31 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function send_log() {
183 183
 
184
-		if ( empty( $this->_remote_logging_url )) {
184
+		if (empty($this->_remote_logging_url)) {
185 185
 			return;
186 186
 		}
187 187
 
188
-		$data = 'domain=' . $_SERVER['HTTP_HOST'];
189
-		$data .= '&ip=' . $_SERVER['SERVER_ADDR'];
190
-		$data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE'];
191
-		$data .= '&time=' . time();
192
-		$data .= '&remote_log=' . $this->_log;
193
-		$data .= '&request_array=' . json_encode( $_REQUEST );
188
+		$data = 'domain='.$_SERVER['HTTP_HOST'];
189
+		$data .= '&ip='.$_SERVER['SERVER_ADDR'];
190
+		$data .= '&server_type='.$_SERVER['SERVER_SOFTWARE'];
191
+		$data .= '&time='.time();
192
+		$data .= '&remote_log='.$this->_log;
193
+		$data .= '&request_array='.json_encode($_REQUEST);
194 194
 		$data .= '&action=save';
195 195
 
196
-		if ( defined( 'EELOGGING_PASS' )) {
197
-			$data .= '&pass=' . EELOGGING_PASS;
196
+		if (defined('EELOGGING_PASS')) {
197
+			$data .= '&pass='.EELOGGING_PASS;
198 198
 		}
199
-		if ( defined( 'EELOGGING_KEY' )) {
200
-			$data .= '&key=' . EELOGGING_KEY;
199
+		if (defined('EELOGGING_KEY')) {
200
+			$data .= '&key='.EELOGGING_KEY;
201 201
 		}
202 202
 
203
-		$c = curl_init( $this->_remote_logging_url );
204
-		curl_setopt( $c, CURLOPT_POST, TRUE );
205
-		curl_setopt( $c, CURLOPT_POSTFIELDS, $data );
206
-		curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE );
207
-		curl_exec( $c );
208
-		curl_close( $c );
203
+		$c = curl_init($this->_remote_logging_url);
204
+		curl_setopt($c, CURLOPT_POST, TRUE);
205
+		curl_setopt($c, CURLOPT_POSTFIELDS, $data);
206
+		curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
207
+		curl_exec($c);
208
+		curl_close($c);
209 209
 	}
210 210
 
211 211
 
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
 	 * previous entries are overwritten
217 217
 	 */
218 218
 	public function write_debug() {
219
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
219
+		if (defined('WP_DEBUG') && WP_DEBUG) {
220 220
 			$this->_debug_log = '';
221
-			foreach ( $_GET as $key => $value ) {
222
-				$this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
221
+			foreach ($_GET as $key => $value) {
222
+				$this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
223 223
 			}
224
-			foreach ( $_POST as $key => $value ) {
225
-				$this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
224
+			foreach ($_POST as $key => $value) {
225
+				$this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
226 226
 			}
227 227
 			try {
228
-				EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' );
229
-			} catch( EE_Error $e ){
230
-				EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
228
+				EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log');
229
+			} catch (EE_Error $e) {
230
+				EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
231 231
 				return;
232 232
 			}
233 233
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * __clone
240 240
 	 */
241 241
 	public function __clone() {
242
-		trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR );
242
+		trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
243 243
 	}
244 244
 
245 245
 
Please login to merge, or discard this patch.
core/EE_Object_Repository.core.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Class EE_Object_Repository
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 * @param array $arguments	arrays of arguments that will be passed to the object's callback method
39 39
 	 * @return bool | int
40 40
 	 */
41
-	protected function _call_user_func_array_on_current( $callback = '', $arguments = array() ) {
42
-		if ( $callback !== '' && method_exists( $this->current(), $callback ) ) {
43
-			return call_user_func_array( array( $this->current(), $callback ), $arguments );
41
+	protected function _call_user_func_array_on_current($callback = '', $arguments = array()) {
42
+		if ($callback !== '' && method_exists($this->current(), $callback)) {
43
+			return call_user_func_array(array($this->current(), $callback), $arguments);
44 44
 		}
45 45
 		return false;
46 46
 	}
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param string $callback  name of method found on repository objects to be called
57 57
 	 * @return bool | int
58 58
 	 */
59
-	protected function _call_user_func_on_all( $callback = '' ) {
59
+	protected function _call_user_func_on_all($callback = '') {
60 60
 		$success = true;
61
-		if ( $this->valid() ) {
61
+		if ($this->valid()) {
62 62
 			$this->rewind();
63
-			while ( $this->valid() ) {
63
+			while ($this->valid()) {
64 64
 				// any negative result will toggle success to false
65
-				$success = $this->_call_user_func_array_on_current( $callback ) ? $success : false;
65
+				$success = $this->_call_user_func_array_on_current($callback) ? $success : false;
66 66
 				$this->next();
67 67
 			}
68 68
 			$this->rewind();
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param array 	$persistence_arguments	arrays of arguments that will be passed to the object's persistence method
87 87
 	 * @return bool | int
88 88
 	 */
89
-	public function persist( $persistence_callback = '', $persistence_arguments = array() ) {
90
-		$persistence_callback = ! empty( $persistence_callback ) ? $persistence_callback : $this->persist_method;
91
-		return $this->_call_user_func_array_on_current( $persistence_callback, $persistence_arguments );
89
+	public function persist($persistence_callback = '', $persistence_arguments = array()) {
90
+		$persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
91
+		return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments);
92 92
 	}
93 93
 
94 94
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 * @param string 	$persistence_callback 		name of method found on object that can be used for persisting the object
103 103
 	 * @return bool | int
104 104
 	 */
105
-	public function persist_all( $persistence_callback = '' ) {
106
-		$persistence_callback = ! empty( $persistence_callback ) ? $persistence_callback : $this->persist_method;
107
-		return $this->_call_user_func_on_all( $persistence_callback );
105
+	public function persist_all($persistence_callback = '') {
106
+		$persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
107
+		return $this->_call_user_func_on_all($persistence_callback);
108 108
 	}
109 109
 
110 110
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	public function do_initial_loads() {
33 33
 		//we want to use the corresponding admin page object (but not route it!).  To do this we just set _routing to false.  That way this page object is being loaded on all pages to make sure we hook into admin properly.  But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;)
34 34
 		//This is important because we have hooks that help redirect custom post type saves
35
-		if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) {
35
+		if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) {
36 36
 			$this->_routing = FALSE;
37 37
 			$this->_initialize_admin_page();
38 38
 		} else {
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 			$this->_initialize_admin_page();
41 41
 			//added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality
42 42
 			remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization');
43
-			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 );
43
+			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100);
44 44
 			//end removal of autosave functionality.
45 45
 		}
46 46
 	}
47 47
 
48 48
 	public function wp_just_in_time_script_localization() {
49
-		wp_localize_script( 'autosave', 'autosaveL10n', array(
49
+		wp_localize_script('autosave', 'autosaveL10n', array(
50 50
 			'autosaveInterval' => 172800,
51 51
 			'savingText' => __('Saving Draft&#8230;'),
52 52
 			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')
53
-		) );
53
+		));
54 54
 	}
55 55
 
56 56
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Init.core.php 4 patches
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -220,7 +222,9 @@  discard block
 block discarded – undo
220 222
 	public function initialize_admin_page() {
221 223
 		//let's check user access first
222 224
 		$this->_check_user_access();
223
-		if ( !is_object( $this->_loaded_page_object) ) return;
225
+		if ( !is_object( $this->_loaded_page_object) ) {
226
+			return;
227
+		}
224 228
 		$this->_loaded_page_object->route_admin_request();
225 229
 		return;
226 230
 	}
@@ -232,7 +236,9 @@  discard block
 block discarded – undo
232 236
 
233 237
 
234 238
 	public function set_page_dependencies($wp_page_slug) {
235
-		if ( !$this->_load_page ) return;
239
+		if ( !$this->_load_page ) {
240
+			return;
241
+		}
236 242
 
237 243
 		if ( !is_object($this->_loaded_page_object) ) {
238 244
 			$msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso');
@@ -249,8 +255,9 @@  discard block
 block discarded – undo
249 255
 		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
250 256
 		$page_hook = 'load-' . $wp_page_slug;
251 257
 		//hook into page load hook so all page specific stuff get's loaded.
252
-		if ( !empty($wp_page_slug) )
253
-			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
258
+		if ( !empty($wp_page_slug) ) {
259
+					add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
260
+		}
254 261
 	}
255 262
 
256 263
 
@@ -283,7 +290,9 @@  discard block
 block discarded – undo
283 290
 			if ( isset( $values['class'] ) && $values['class'] == $class ) {
284 291
 				$file_index = $index - 1;
285 292
 				$this->_folder_name = basename(dirname($bt[$file_index]['file']) );
286
-				if ( !empty( $this->_folder_name ) ) break;
293
+				if ( !empty( $this->_folder_name ) ) {
294
+					break;
295
+				}
287 296
 			}
288 297
 		}
289 298
 
@@ -337,8 +346,9 @@  discard block
 block discarded – undo
337 346
 				$hook_paths[] = $file;
338 347
 
339 348
 				//make sure we haven't already got a hook setup for this page path
340
-				if ( in_array( $rel_admin, $this->_files_hooked ) )
341
-					continue;
349
+				if ( in_array( $rel_admin, $this->_files_hooked ) ) {
350
+									continue;
351
+				}
342 352
 
343 353
 				$this->hook_file = $hook_file;
344 354
 				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
@@ -367,8 +377,10 @@  discard block
 block discarded – undo
367 377
 	protected function _initialize_admin_page() {
368 378
 
369 379
 		//JUST CHECK WE'RE ON RIGHT PAGE.
370
-		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing )
371
-			return; //not on the right page so let's get out.
380
+		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) {
381
+					return;
382
+		}
383
+		//not on the right page so let's get out.
372 384
 		$this->_load_page = TRUE;
373 385
 
374 386
 		//let's set page specific autoloaders.  Note that this just sets autoloaders for THIS set of admin pages.
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,6 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @access  public
216 216
 	 * @uses   _initialize_admin_page()
217
-	 * @param  string $dir_name directory name for specific admin_page being loaded.
218 217
 	 * @return void
219 218
 	 */
220 219
 	public function initialize_admin_page() {
@@ -231,6 +230,9 @@  discard block
 block discarded – undo
231 230
 
232 231
 
233 232
 
233
+	/**
234
+	 * @param string $wp_page_slug
235
+	 */
234 236
 	public function set_page_dependencies($wp_page_slug) {
235 237
 		if ( !$this->_load_page ) return;
236 238
 
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -153,18 +153,18 @@
 block discarded – undo
153 153
 
154 154
 
155 155
 	/**
156
-     * This loads scripts and styles for the EE_Admin system
157
-     * that must be available on ALL WP admin pages (i.e. EE_menu items)
158
-     *
156
+	 * This loads scripts and styles for the EE_Admin system
157
+	 * that must be available on ALL WP admin pages (i.e. EE_menu items)
158
+	 *
159 159
 	 * @return void
160 160
 	 */
161 161
 	public function load_wp_global_scripts_styles() {
162 162
 		wp_register_style(
163
-		    'espresso_menu',
164
-            EE_ADMIN_URL . 'assets/admin-menu-styles.css',
165
-            array('dashicons'),
166
-            EVENT_ESPRESSO_VERSION
167
-        );
163
+			'espresso_menu',
164
+			EE_ADMIN_URL . 'assets/admin-menu-styles.css',
165
+			array('dashicons'),
166
+			EVENT_ESPRESSO_VERSION
167
+		);
168 168
 		wp_enqueue_style('espresso_menu');
169 169
 	}
170 170
 
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
 		$this->_set_init_properties();
89 89
 
90 90
 		//global styles/scripts across all wp admin pages
91
-		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5 );
91
+		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
92 92
 
93 93
 		//load initial stuff.
94 94
 		$this->_set_file_and_folder_name();
95 95
 
96 96
 		$this->_set_menu_map();
97 97
 
98
-		if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) )
98
+		if (empty($this->_menu_map) || is_array($this->_menu_map))
99 99
 			 {
100
-			 	EE_Error::doing_it_wrong( get_class( $this ) . '::$_menu_map', sprintf( __('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso' ), get_class( $this ) ), '4.4.0' );
100
+			 	EE_Error::doing_it_wrong(get_class($this).'::$_menu_map', sprintf(__('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso'), get_class($this)), '4.4.0');
101 101
 			 	return;
102 102
 			 }
103 103
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	public function load_wp_global_scripts_styles() {
162 162
 		wp_register_style(
163 163
 		    'espresso_menu',
164
-            EE_ADMIN_URL . 'assets/admin-menu-styles.css',
164
+            EE_ADMIN_URL.'assets/admin-menu-styles.css',
165 165
             array('dashicons'),
166 166
             EVENT_ESPRESSO_VERSION
167 167
         );
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 
194 194
 
195 195
 	protected function _set_capability() {
196
-		$capability = empty($this->capability) ?  $this->_menu_map->capability : $this->capability;
197
-		$this->capability = apply_filters( 'FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability );
196
+		$capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
197
+		$this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability);
198 198
 	}
199 199
 
200 200
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	public function initialize_admin_page() {
213 213
 		//let's check user access first
214 214
 		$this->_check_user_access();
215
-		if ( !is_object( $this->_loaded_page_object) ) return;
215
+		if ( ! is_object($this->_loaded_page_object)) return;
216 216
 		$this->_loaded_page_object->route_admin_request();
217 217
 		return;
218 218
 	}
@@ -224,25 +224,25 @@  discard block
 block discarded – undo
224 224
 
225 225
 
226 226
 	public function set_page_dependencies($wp_page_slug) {
227
-		if ( !$this->_load_page ) return;
227
+		if ( ! $this->_load_page) return;
228 228
 
229
-		if ( !is_object($this->_loaded_page_object) ) {
229
+		if ( ! is_object($this->_loaded_page_object)) {
230 230
 			$msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso');
231
-			$msg[] = $msg[0] . "\r\n" . sprintf(
231
+			$msg[] = $msg[0]."\r\n".sprintf(
232 232
 				__('The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', 'event_espresso'),
233 233
 				 $this->_file_name,
234 234
 				 $this->_file_name,
235
-				 $this->_folder_path . $this->_file_name,
235
+				 $this->_folder_path.$this->_file_name,
236 236
 				 $this->_menu_map->menu_slug
237 237
 			);
238
-			throw new EE_Error( implode( '||', $msg) );
238
+			throw new EE_Error(implode('||', $msg));
239 239
 		}
240 240
 
241 241
 		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
242
-		$page_hook = 'load-' . $wp_page_slug;
242
+		$page_hook = 'load-'.$wp_page_slug;
243 243
 		//hook into page load hook so all page specific stuff get's loaded.
244
-		if ( !empty($wp_page_slug) )
245
-			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
244
+		if ( ! empty($wp_page_slug))
245
+			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
246 246
 	}
247 247
 
248 248
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function do_initial_loads() {
255 255
 		//no loading or initializing if menu map is setup incorrectly.
256
-		if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) ) {
256
+		if (empty($this->_menu_map) || is_array($this->_menu_map)) {
257 257
 			return;
258 258
 		}
259 259
 		$this->_initialize_admin_page();
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
 		$bt = debug_backtrace();
271 271
 		//for more reliable determination of folder name
272 272
 		//we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this).  Why?  Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins)
273
-		$class = get_class( $this );
274
-		foreach ( $bt as $index => $values ) {
275
-			if ( isset( $values['class'] ) && $values['class'] == $class ) {
273
+		$class = get_class($this);
274
+		foreach ($bt as $index => $values) {
275
+			if (isset($values['class']) && $values['class'] == $class) {
276 276
 				$file_index = $index - 1;
277
-				$this->_folder_name = basename(dirname($bt[$file_index]['file']) );
278
-				if ( !empty( $this->_folder_name ) ) break;
277
+				$this->_folder_name = basename(dirname($bt[$file_index]['file']));
278
+				if ( ! empty($this->_folder_name)) break;
279 279
 			}
280 280
 		}
281 281
 
282
-		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS;
282
+		$this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.DS;
283 283
 
284
-		$this->_file_name = preg_replace( '/^ee/' , 'EE', $this->_folder_name );
285
-		$this->_file_name = ucwords( str_replace('_', ' ', $this->_file_name) );
284
+		$this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
285
+		$this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
286 286
 		$this->_file_name = str_replace(' ', '_', $this->_file_name);
287 287
 	}
288 288
 
@@ -294,19 +294,19 @@  discard block
 block discarded – undo
294 294
 	 * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks files/classes
295 295
 	 * @return array
296 296
 	 */
297
-	public function register_hooks( $extend = FALSE ) {
297
+	public function register_hooks($extend = FALSE) {
298 298
 
299 299
 		//get a list of files in the directory that have the "Hook" in their name an
300 300
 
301 301
 		//if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property.  Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf.
302
-		if ( $extend ) {
303
-			$hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS . '*' . $this->_file_name . '_Hooks_Extend.class.php' );
304
-			$this->_hook_paths = $this->_register_hook_files( $hook_files_glob_path, $extend );
302
+		if ($extend) {
303
+			$hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS.'*'.$this->_file_name.'_Hooks_Extend.class.php');
304
+			$this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend);
305 305
 		}
306 306
 
307 307
 		//loop through decaf folders
308
-		$hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' );
309
-		$this->_hook_paths = array_merge( $this->_register_hook_files( $hook_files_glob_path ), $this->_hook_paths );  //making sure any extended hook paths are later in the array than the core hook paths!
308
+		$hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php');
309
+		$this->_hook_paths = array_merge($this->_register_hook_files($hook_files_glob_path), $this->_hook_paths); //making sure any extended hook paths are later in the array than the core hook paths!
310 310
 
311 311
 		return $this->_hook_paths;
312 312
 
@@ -314,27 +314,27 @@  discard block
 block discarded – undo
314 314
 
315 315
 
316 316
 
317
-	protected function _register_hook_files( $hook_files_glob_path, $extend = FALSE ) {
317
+	protected function _register_hook_files($hook_files_glob_path, $extend = FALSE) {
318 318
 		$hook_paths = array();
319
-		if ( $hook_files = glob( $hook_files_glob_path ) ) {
320
-			if ( empty( $hook_files ) ) {
319
+		if ($hook_files = glob($hook_files_glob_path)) {
320
+			if (empty($hook_files)) {
321 321
 				return array();
322 322
 			}
323
-			foreach ( $hook_files as $file ) {
323
+			foreach ($hook_files as $file) {
324 324
 				//lets get the linked admin.
325
-				$hook_file = $extend ? str_replace( EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS, '', $file ) : str_replace($this->_folder_path, '', $file );
326
-				$replace = $extend ? '_' . $this->_file_name . '_Hooks_Extend.class.php' : '_' . $this->_file_name . '_Hooks.class.php';
327
-				$rel_admin = str_replace( $replace, '', $hook_file);
325
+				$hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS, '', $file) : str_replace($this->_folder_path, '', $file);
326
+				$replace = $extend ? '_'.$this->_file_name.'_Hooks_Extend.class.php' : '_'.$this->_file_name.'_Hooks.class.php';
327
+				$rel_admin = str_replace($replace, '', $hook_file);
328 328
 				$rel_admin = strtolower($rel_admin);
329 329
 				$hook_paths[] = $file;
330 330
 
331 331
 				//make sure we haven't already got a hook setup for this page path
332
-				if ( in_array( $rel_admin, $this->_files_hooked ) )
332
+				if (in_array($rel_admin, $this->_files_hooked))
333 333
 					continue;
334 334
 
335 335
 				$this->hook_file = $hook_file;
336
-				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
337
-				$filter = add_filter( $rel_admin_hook, array($this, 'load_admin_hook') );
336
+				$rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin;
337
+				$filter = add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
338 338
 				$this->_files_hooked[] = $rel_admin;
339 339
 			}
340 340
 		}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	protected function _initialize_admin_page() {
360 360
 
361 361
 		//JUST CHECK WE'RE ON RIGHT PAGE.
362
-		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing )
362
+		if (( ! isset($_REQUEST['page']) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing)
363 363
 			return; //not on the right page so let's get out.
364 364
 		$this->_load_page = TRUE;
365 365
 
@@ -367,30 +367,30 @@  discard block
 block discarded – undo
367 367
 //		spl_autoload_register(array( $this, 'set_autoloaders') );
368 368
 
369 369
 		//we don't need to do a page_request check here because it's only called via WP menu system.
370
-		$admin_page = $this->_file_name . '_Admin_Page';
371
-		$hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
370
+		$admin_page = $this->_file_name.'_Admin_Page';
371
+		$hook_suffix = $this->_menu_map->menu_slug.'_'.$admin_page;
372 372
 		$admin_page = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", $admin_page);
373 373
 
374 374
 		// define requested admin page class name then load the file and instantiate
375
-		$path_to_file = str_replace( array( '\\', '/' ), DS, $this->_folder_path . $admin_page . '.core.php' );
376
-		$path_to_file=apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",$path_to_file );//so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
375
+		$path_to_file = str_replace(array('\\', '/'), DS, $this->_folder_path.$admin_page.'.core.php');
376
+		$path_to_file = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", $path_to_file); //so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
377 377
 
378
-		if ( is_readable( $path_to_file )) {
378
+		if (is_readable($path_to_file)) {
379 379
 			// This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
380
-			do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization' );
381
-			do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug );
382
-			require_once( $path_to_file );
383
-			$a = new ReflectionClass( $admin_page );
384
-			$this->_loaded_page_object = $a->newInstance( $this->_routing );
380
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
381
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_'.$this->_menu_map->menu_slug);
382
+			require_once($path_to_file);
383
+			$a = new ReflectionClass($admin_page);
384
+			$this->_loaded_page_object = $a->newInstance($this->_routing);
385 385
 		}
386
-		do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization' );
387
-		do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug );
386
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
387
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_'.$this->_menu_map->menu_slug);
388 388
 	}
389 389
 
390 390
 
391 391
 
392 392
 	public function get_admin_page_name() {
393
-		return $this->_file_name . '_Admin_Page';
393
+		return $this->_file_name.'_Admin_Page';
394 394
 	}
395 395
 
396 396
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	 * @return bool|die true if pass (or admin) wp_die if fail
423 423
 	 */
424 424
 	private function _check_user_access() {
425
-		if ( ! EE_Registry::instance()->CAP->current_user_can( $this->_menu_map->capability, $this->_menu_map->menu_slug ) ) {
426
-			wp_die( __('You don\'t have access to this page.'), '', array( 'back_link' => true ) );
425
+		if ( ! EE_Registry::instance()->CAP->current_user_can($this->_menu_map->capability, $this->_menu_map->menu_slug)) {
426
+			wp_die(__('You don\'t have access to this page.'), '', array('back_link' => true));
427 427
 		}
428 428
 		return true;
429 429
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Loader.core.php 3 patches
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -237,8 +238,9 @@  discard block
 block discarded – undo
237 238
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238 239
 		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239 240
 		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
241
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group ) {
242
+							throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
243
+			}
242 244
 			$groups[$group->menu_slug] = $group;
243 245
 		}
244 246
 		return $groups;
@@ -494,8 +496,9 @@  discard block
 block discarded – undo
494 496
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495 497
 		foreach ( $pages_array as $group => $menu_maps ) {
496 498
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
498
-				continue;
499
+			if ( ! array_key_exists( $group, $menu_groups ) ) {
500
+							continue;
501
+			}
499 502
 
500 503
 			//sort pages.
501 504
 			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
@@ -510,8 +513,9 @@  discard block
 block discarded – undo
510 513
 
511 514
 		//now let's setup the _prepped_menu_maps property
512 515
 		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
516
+			if ( isset( $pages_array[$group] ) ) {
517
+							$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
518
+			}
515 519
 		}/**/
516 520
 
517 521
 	}
@@ -656,8 +660,9 @@  discard block
 block discarded – undo
656 660
 	 * @return int    sort order
657 661
 	 */
658 662
 	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
660
-			return 0;
663
+		if ( $a->menu_order == $b->menu_order ) {
664
+					return 0;
665
+		}
661 666
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 667
 	}
663 668
 
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -402,21 +402,21 @@
 block discarded – undo
402 402
 		$class_name = $this->_get_classname_for_admin_init_page( $page );
403 403
  		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404 404
 		if ( ! class_exists( $class_name )) {
405
-            $inner_error_msg = '<br />' . sprintf(
406
-                esc_html__(
407
-                    'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408
-                    'event_espresso'
409
-                ),
410
-                '<strong>' . $class_name . '</strong>'
411
-            );
405
+			$inner_error_msg = '<br />' . sprintf(
406
+				esc_html__(
407
+					'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408
+					'event_espresso'
409
+				),
410
+				'<strong>' . $class_name . '</strong>'
411
+			);
412 412
 			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
413 413
 			$error_msg[] = $error_msg[0]
414
-                           . "\r\n"
415
-                           . sprintf(
416
-                               esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
417
-                               $page
418
-                           )
419
-                           . $inner_error_msg;
414
+						   . "\r\n"
415
+						   . sprintf(
416
+							   esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
417
+							   $page
418
+						   )
419
+						   . $inner_error_msg;
420 420
 			throw new EE_Error( implode( '||', $error_msg ));
421 421
 		}
422 422
 		$a = new ReflectionClass($class_name);
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 		//let's do a scan and see what installed pages we have
120 120
 		$this->_get_installed_pages();
121 121
 		//set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to).
122
-		add_action('admin_menu', array( $this, 'set_menus' ));
123
-		add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) );
122
+		add_action('admin_menu', array($this, 'set_menus'));
123
+		add_action('network_admin_menu', array($this, 'set_network_menus'));
124 124
 	}
125 125
 
126 126
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	private function _define_caffeinated_constants() {
136
-		if ( ! defined( 'EE_CORE_CAF_ADMIN'  ) ) {
137
-			define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/');
138
-			define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/');
139
-			define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/');
140
-			define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/');
141
-			define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/');
142
-			define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/');
136
+		if ( ! defined('EE_CORE_CAF_ADMIN')) {
137
+			define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/');
138
+			define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/');
139
+			define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/');
140
+			define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/');
141
+			define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/');
142
+			define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/');
143 143
 		}
144 144
 	}
145 145
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 		//set array of EE_Admin_Page_Menu_Group objects
160 160
 		$groups = array(
161
-			'main' => new EE_Admin_Page_Menu_Group( array(
161
+			'main' => new EE_Admin_Page_Menu_Group(array(
162 162
 				'menu_label' => __('Main', 'event_espresso'),
163 163
 				'show_on_menu' => EE_Admin_Page_Menu_Map::NONE,
164 164
 				'menu_slug' => 'main',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				'menu_order' => 0,
167 167
 				'parent_slug' => 'espresso_events',
168 168
 				)),
169
-			'management' => new EE_Admin_Page_Menu_Group( array(
169
+			'management' => new EE_Admin_Page_Menu_Group(array(
170 170
 				'menu_label' => __('Management', 'event_espresso'),
171 171
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
172 172
 				'menu_slug' => 'management',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				'menu_order' => 10,
175 175
 				'parent_slug' => 'espresso_events'
176 176
 				)),
177
-			'settings' => new EE_Admin_Page_Menu_Group( array(
177
+			'settings' => new EE_Admin_Page_Menu_Group(array(
178 178
 				'menu_label' => __('Settings', 'event_espresso'),
179 179
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
180 180
 				'menu_slug' => 'settings',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				'menu_order' => 30,
183 183
 				'parent_slug' => 'espresso_events'
184 184
 				)),
185
-			'templates' => new EE_Admin_Page_Menu_Group( array(
185
+			'templates' => new EE_Admin_Page_Menu_Group(array(
186 186
 				'menu_label' => __('Templates', 'event_espresso'),
187 187
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
188 188
 				'menu_slug' => 'templates',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'menu_order' => 40,
191 191
 				'parent_slug' => 'espresso_events'
192 192
 				)),
193
-			'extras' => new EE_Admin_Page_Menu_Group( array(
193
+			'extras' => new EE_Admin_Page_Menu_Group(array(
194 194
 				'menu_label' => __('Extras', 'event_espresso'),
195 195
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
196 196
 				'menu_slug' => 'extras',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				'parent_slug' => 'espresso_events',
200 200
 				'maintenance_mode_parent' => 'espresso_maintenance_settings'
201 201
 				)),
202
-			'tools' => new EE_Admin_Page_Menu_Group( array(
202
+			'tools' => new EE_Admin_Page_Menu_Group(array(
203 203
 				'menu_label' => __("Tools", "event_espresso"),
204 204
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
205 205
 				'menu_slug' => 'tools',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 				'menu_order' => 60,
208 208
 				'parent_slug' => 'espresso_events'
209 209
 				)),
210
-			'addons' => new EE_Admin_Page_Menu_Group( array(
210
+			'addons' => new EE_Admin_Page_Menu_Group(array(
211 211
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
212 212
 				'menu_label' => __('Add-ons', 'event_espresso'),
213 213
 				'menu_slug' => 'addons',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				))
218 218
 			);
219 219
 
220
-		$this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups );
220
+		$this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups);
221 221
 	}
222 222
 
223 223
 
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	private function _rearrange_menu_groups() {
236 236
 		$groups = array();
237 237
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238
-		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239
-		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
238
+		usort($this->_admin_menu_groups, array($this, '_sort_menu_maps'));
239
+		foreach ($this->_admin_menu_groups as $group) {
240
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group)
241
+				throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE)));
242 242
 			$groups[$group->menu_slug] = $group;
243 243
 		}
244 244
 		return $groups;
@@ -256,48 +256,48 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private function _get_installed_pages() {
258 258
 		$installed_refs = array();
259
-		$exclude = array( 'assets', 'templates' );
259
+		$exclude = array('assets', 'templates');
260 260
 		// grab everything in the  admin core directory
261
-		$admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR );
262
-		if ( $admin_screens ) {
263
-			foreach( $admin_screens as $admin_screen ) {
261
+		$admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR);
262
+		if ($admin_screens) {
263
+			foreach ($admin_screens as $admin_screen) {
264 264
 				// files and anything in the exclude array need not apply
265
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
265
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
266 266
 					// these folders represent the different EE admin pages
267
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
267
+					$installed_refs[basename($admin_screen)] = $admin_screen;
268 268
 				}
269 269
 			}
270 270
 		}
271 271
 
272
-		if ( empty( $installed_refs ) ) {
272
+		if (empty($installed_refs)) {
273 273
 			$error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso');
274
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES );
275
-			throw new EE_Error( implode( '||', $error_msg ));
274
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES);
275
+			throw new EE_Error(implode('||', $error_msg));
276 276
 		}
277 277
 
278 278
 		//this just checks the caffeinated folder and takes care of setting up any caffeinated stuff.
279 279
 		$installed_refs = $this->_set_caffeinated($installed_refs);
280 280
 		//allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.;
281
-		$installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs );
282
-		$this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends );
281
+		$installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs);
282
+		$this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends);
283 283
 
284 284
 		//loop through admin pages and setup the $_installed_pages array.
285 285
 		$hooks_ref = array();
286
-		foreach ( $installed_refs as $page => $path ) {
286
+		foreach ($installed_refs as $page => $path) {
287 287
 			// set autoloaders for our admin page classes based on included path information
288
-			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path );
288
+			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path);
289 289
 			// build list of installed pages
290
-			$this->_installed_pages[$page] = $this->_load_admin_page( $page, $path );
290
+			$this->_installed_pages[$page] = $this->_load_admin_page($page, $path);
291 291
 			// verify returned object
292
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
293
-				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) {
292
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
293
+				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) {
294 294
 					continue;
295 295
 				}
296 296
 
297 297
 				//skip if in full maintenance mode and maintenance_mode_parent is set
298 298
 				$maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent;
299
-				if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
300
-					unset( $installed_refs[$page] );
299
+				if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
300
+					unset($installed_refs[$page]);
301 301
 					continue;
302 302
 				}
303 303
 
@@ -305,45 +305,45 @@  discard block
 block discarded – undo
305 305
 				//flag for register hooks on extended pages b/c extended pages use the default INIT.
306 306
 				$extend = FALSE;
307 307
 				//now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals.  If there are then let's hook into the init admin filter and load our extend instead.
308
-				if ( isset( $this->_caffeinated_extends[$page] ) ) {
308
+				if (isset($this->_caffeinated_extends[$page])) {
309 309
 					$this->_current_caf_extend_slug = $page;
310
-					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
311
-					$path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";';
312
-					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
313
-					$page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";';
310
+					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
311
+					$path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";';
312
+					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
313
+					$page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";';
314 314
 
315
-					$hook_function_path = create_function( '$path_to_file', $path_runtime);
316
-					$hook_function_page = create_function( '$admin_page', $page_runtime );
315
+					$hook_function_path = create_function('$path_to_file', $path_runtime);
316
+					$hook_function_page = create_function('$admin_page', $page_runtime);
317 317
 
318
-					add_filter( $path_hook, $hook_function_path );
319
-					add_filter( $page_hook, $hook_function_page );
318
+					add_filter($path_hook, $hook_function_path);
319
+					add_filter($page_hook, $hook_function_page);
320 320
 					$extend = TRUE;
321 321
 				}
322 322
 				//let's do the registered hooks
323
-				$extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend );
323
+				$extended_hooks = $this->_installed_pages[$page]->register_hooks($extend);
324 324
 				$hooks_ref = array_merge($hooks_ref, $extended_hooks);
325 325
 			}
326 326
 		}
327 327
 
328 328
 		//the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder.  So we want to make sure we load the file for the parent.
329 329
 		//first make sure we've got unique values
330
-		$hooks_ref = array_unique( $hooks_ref );
330
+		$hooks_ref = array_unique($hooks_ref);
331 331
 		//now let's loop and require!
332
-		foreach ( $hooks_ref as $path ) {
333
-			require_once( $path );
332
+		foreach ($hooks_ref as $path) {
333
+			require_once($path);
334 334
 		}
335 335
 		//make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested.
336 336
 		global $ee_menu_slugs;
337 337
 		$ee_menu_slugs = $this->_menu_slugs;
338 338
 
339 339
 		//we need to loop again to run any early code
340
-		foreach ( $installed_refs as $page => $path ) {
341
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
340
+		foreach ($installed_refs as $page => $path) {
341
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
342 342
 				$this->_installed_pages[$page]->do_initial_loads();
343 343
 			}
344 344
 		}
345 345
 
346
-		do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages );
346
+		do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages);
347 347
 
348 348
 	}
349 349
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 	 * @param string $page_slug
356 356
 	 * @return EE_Admin_Page
357 357
 	 */
358
-	public function get_admin_page_object( $page_slug = '' ) {
359
-		if ( isset( $this->_installed_pages[ $page_slug ] )) {
360
-			return $this->_installed_pages[ $page_slug ]->loaded_page_object();
358
+	public function get_admin_page_object($page_slug = '') {
359
+		if (isset($this->_installed_pages[$page_slug])) {
360
+			return $this->_installed_pages[$page_slug]->loaded_page_object();
361 361
 		}
362 362
 		return NULL;
363 363
 	}
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param $dir_name
371 371
 	 * @return string
372 372
 	 */
373
-	private function _get_classname_for_admin_page( $dir_name = '' ) {
374
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
375
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page';
373
+	private function _get_classname_for_admin_page($dir_name = '') {
374
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
375
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page';
376 376
 	}
377 377
 
378 378
 
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 	 * @param $dir_name
384 384
 	 * @return string
385 385
 	 */
386
-	private function _get_classname_for_admin_init_page( $dir_name = '' ) {
387
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
388
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init';
386
+	private function _get_classname_for_admin_init_page($dir_name = '') {
387
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
388
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init';
389 389
 	}
390 390
 
391 391
 
@@ -398,26 +398,26 @@  discard block
 block discarded – undo
398 398
 	 * @throws EE_Error
399 399
 	 * @return object|bool  return page object if valid, bool false if not.
400 400
 	 */
401
-	private function _load_admin_page( $page = '', $path = '' ) {
402
-		$class_name = $this->_get_classname_for_admin_init_page( $page );
403
- 		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404
-		if ( ! class_exists( $class_name )) {
405
-            $inner_error_msg = '<br />' . sprintf(
401
+	private function _load_admin_page($page = '', $path = '') {
402
+		$class_name = $this->_get_classname_for_admin_init_page($page);
403
+ 		EE_Registry::instance()->load_file($path, $class_name, 'core');
404
+		if ( ! class_exists($class_name)) {
405
+            $inner_error_msg = '<br />'.sprintf(
406 406
                 esc_html__(
407 407
                     'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408 408
                     'event_espresso'
409 409
                 ),
410
-                '<strong>' . $class_name . '</strong>'
410
+                '<strong>'.$class_name.'</strong>'
411 411
             );
412
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
412
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
413 413
 			$error_msg[] = $error_msg[0]
414 414
                            . "\r\n"
415 415
                            . sprintf(
416
-                               esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
416
+                               esc_html__('There is no Init class in place for the %s admin page.', 'event_espresso'),
417 417
                                $page
418 418
                            )
419 419
                            . $inner_error_msg;
420
-			throw new EE_Error( implode( '||', $error_msg ));
420
+			throw new EE_Error(implode('||', $error_msg));
421 421
 		}
422 422
 		$a = new ReflectionClass($class_name);
423 423
 		return  $a->newInstance();
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
 	public function set_menus() {
437 437
 		//prep the menu pages (sort, group.)
438 438
 		$this->_prep_pages();
439
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
440
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
441
-				$menu_map->add_menu_page( FALSE );
439
+		foreach ($this->_prepped_menu_maps as $menu_map) {
440
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
441
+				$menu_map->add_menu_page(FALSE);
442 442
 			}
443 443
 		}
444 444
 	}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @return void
453 453
 	 */
454
-	public function set_network_menus(){
454
+	public function set_network_menus() {
455 455
 		$this->_prep_pages();
456
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
457
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
458
-				$menu_map->add_menu_page( TRUE );
456
+		foreach ($this->_prepped_menu_maps as $menu_map) {
457
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
458
+				$menu_map->add_menu_page(TRUE);
459 459
 			}
460 460
 		}
461 461
 	}
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 		//rearrange _admin_menu_groups to be indexed by group slug.
477 477
 		$menu_groups = $this->_rearrange_menu_groups();
478 478
 
479
-		foreach( $this->_installed_pages as $page ) {
480
-			if ( $page instanceof EE_Admin_page_Init ) {
479
+		foreach ($this->_installed_pages as $page) {
480
+			if ($page instanceof EE_Admin_page_Init) {
481 481
 				$page_map = $page->get_menu_map();
482 482
 				//if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item.
483
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
484
-					EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) );
483
+				if (is_array($page_map) || empty($page_map)) {
484
+					EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label));
485 485
 					continue;
486 486
 				}
487 487
 
488 488
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
489
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
490
-					throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) );
489
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
490
+					throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map));
491 491
 				}
492 492
 
493 493
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
494
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
494
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
495 495
 					continue;
496 496
 				}
497 497
 
@@ -500,21 +500,21 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if ( empty( $pages_array )) {
504
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
503
+		if (empty($pages_array)) {
504
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
505 505
 		}
506 506
 
507 507
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
508
-		foreach ( $pages_array as $group => $menu_maps ) {
508
+		foreach ($pages_array as $group => $menu_maps) {
509 509
 			//valid_group?
510
-			if ( ! array_key_exists( $group, $menu_groups ) )
510
+			if ( ! array_key_exists($group, $menu_groups))
511 511
 				continue;
512 512
 
513 513
 			//sort pages.
514
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
514
+			usort($menu_maps, array($this, '_sort_menu_maps'));
515 515
 
516 516
 			//prepend header
517
-			array_unshift( $menu_maps, $menu_groups[$group] );
517
+			array_unshift($menu_maps, $menu_groups[$group]);
518 518
 
519 519
 			//reset $pages_array with prepped data
520 520
 			$pages_array[$group] = $menu_maps;
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 
523 523
 
524 524
 		//now let's setup the _prepped_menu_maps property
525
-		foreach ( $menu_groups as $group => $group_objs ) {
526
-			if ( isset( $pages_array[$group] ) )
527
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
525
+		foreach ($menu_groups as $group => $group_objs) {
526
+			if (isset($pages_array[$group]))
527
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
528 528
 		}/**/
529 529
 
530 530
 	}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
545 545
 	 * @return array
546 546
 	 */
547
-	private function _set_caffeinated( $installed_refs ) {
547
+	private function _set_caffeinated($installed_refs) {
548 548
 
549 549
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
550
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
550
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
551 551
 			return $installed_refs;
552 552
 		}
553 553
 
@@ -556,15 +556,15 @@  discard block
 block discarded – undo
556 556
 		$exclude = array('tickets');
557 557
 
558 558
 		//okay let's setup an "New" pages first (we'll return installed refs later)
559
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
560
-		if ( $new_admin_screens ) {
561
-			foreach( $new_admin_screens as $admin_screen ) {
559
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
560
+		if ($new_admin_screens) {
561
+			foreach ($new_admin_screens as $admin_screen) {
562 562
 				// files and anything in the exclude array need not apply
563
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
563
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
564 564
 					// these folders represent the different NEW EE admin pages
565
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
565
+					$installed_refs[basename($admin_screen)] = $admin_screen;
566 566
 					// set autoloaders for our admin page classes based on included path information
567
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
567
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
568 568
 //					$this->_caf_autoloader[] = array(
569 569
 //						'dir' => 'new',
570 570
 //						'folder' => basename( $admin_screen )
@@ -574,18 +574,18 @@  discard block
 block discarded – undo
574 574
 		}
575 575
 
576 576
 		//let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
577
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
578
-		if ( $extends ) {
579
-			foreach( $extends as $extend ) {
580
-				if ( is_dir( $extend ) ) {
581
-					$extend_ref = basename( $extend );
577
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
578
+		if ($extends) {
579
+			foreach ($extends as $extend) {
580
+				if (is_dir($extend)) {
581
+					$extend_ref = basename($extend);
582 582
 					//now let's make sure there is a file that matches the expected format
583
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
584
-					$filename = 'Extend_' . $filename . '_Admin_Page';
585
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
583
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
584
+					$filename = 'Extend_'.$filename.'_Admin_Page';
585
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
586 586
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
587 587
 					// set autoloaders for our admin page classes based on included path information
588
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
588
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
589 589
 //					$this->_caf_autoloader[] = array(
590 590
 //						'dir' => 'extend',
591 591
 //						'folder' => $extend_ref
@@ -596,22 +596,22 @@  discard block
 block discarded – undo
596 596
 
597 597
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
598 598
 		$ee_admin_hooks = array();
599
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
600
-		if ( $hooks ) {
601
-			foreach ( $hooks as $hook ) {
602
-				if ( is_readable( $hook ) ) {
599
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
600
+		if ($hooks) {
601
+			foreach ($hooks as $hook) {
602
+				if (is_readable($hook)) {
603 603
 					require_once $hook;
604
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
604
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
605 605
 					$classname = str_replace('.class.php', '', $classname);
606
-					if ( class_exists( $classname ) ) {
607
-						$a = new ReflectionClass( $classname );
606
+					if (class_exists($classname)) {
607
+						$a = new ReflectionClass($classname);
608 608
 						$ee_admin_hooks[] = $a->newInstance();
609 609
 					}
610 610
 				}
611 611
 			}
612 612
 		}/**/
613 613
 
614
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
614
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
615 615
 
616 616
 		return $installed_refs;
617 617
 
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
667 667
 	 * @return int    sort order
668 668
 	 */
669
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
670
-		if ( $a->menu_order == $b->menu_order )
669
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
670
+		if ($a->menu_order == $b->menu_order)
671 671
 			return 0;
672 672
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
673 673
 	}
Please login to merge, or discard this patch.