@@ -51,6 +51,7 @@ |
||
51 | 51 | /** |
52 | 52 | * Applies the subject string to the set callback filter function. |
53 | 53 | * @since 3.6.0 |
54 | + * @param string $sSubject |
|
54 | 55 | */ |
55 | 56 | protected function _getFiltered( $sSubject ) { |
56 | 57 | return is_callable( $this->hfCallback ) |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->hfCallback, |
36 | 36 | ); |
37 | 37 | $this->aArguments = $_aParameters[ 0 ]; |
38 | - $this->hfCallback = $_aParameters[ 1 ]; |
|
38 | + $this->hfCallback = $_aParameters[ 1 ]; |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | // Extract the first part as it does not have braces |
85 | 85 | $_sName = array_shift( $aParts ); |
86 | - foreach( $aParts as $_sPart ) { |
|
87 | - $_sName .= '[' . $_sPart . ']'; |
|
86 | + foreach ( $aParts as $_sPart ) { |
|
87 | + $_sName .= '['.$_sPart.']'; |
|
88 | 88 | } |
89 | 89 | return $_sName; |
90 | 90 |
@@ -121,6 +121,8 @@ |
||
121 | 121 | } |
122 | 122 | /** |
123 | 123 | * @since DEVVER |
124 | + * @param string $sKey |
|
125 | + * @param string $sValue |
|
124 | 126 | * @return void |
125 | 127 | */ |
126 | 128 | public function addResource( $sKey, $sValue ) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
27 | 27 | * @return boolean True if a setting notice is set; otherwise, false. |
28 | 28 | */ |
29 | - public function hasSubmitNotice( $sType='' ) { |
|
29 | + public function hasSubmitNotice( $sType = '' ) { |
|
30 | 30 | return $this->oSubmitNotice->hasNotice( $sType ); |
31 | 31 | } |
32 | 32 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function setSubmitNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
55 | + public function setSubmitNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
56 | 56 | $this->oSubmitNotice->set( |
57 | 57 | $sMessage, |
58 | 58 | $sType, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $this->aSectionsets[ $aSectionset[ 'section_id' ] ] = $aSectionset; |
81 | 81 | $this->aFieldsets[ $aSectionset[ 'section_id' ] ] = $this->getElement( |
82 | - $this->aFieldsets, // subject array |
|
82 | + $this->aFieldsets, // subject array |
|
83 | 83 | $aSectionset[ 'section_id' ], // key |
84 | 84 | array() // default |
85 | 85 | ); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function removeSection( $sSectionID ) { |
96 | 96 | |
97 | - if ( '_default' === $sSectionID ){ |
|
97 | + if ( '_default' === $sSectionID ) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | unset( |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @return void |
125 | 125 | */ |
126 | 126 | public function addResource( $sKey, $sValue ) { |
127 | - self::$_aResources[ $sKey ][] = $sValue; |
|
127 | + self::$_aResources[ $sKey ][ ] = $sValue; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public function addField( $asFieldset ) { |
148 | 148 | |
149 | 149 | // If it is a target section, update the property and return. |
150 | - if ( ! $this->_isFieldsetDefinition( $asFieldset ) ) { |
|
150 | + if ( !$this->_isFieldsetDefinition( $asFieldset ) ) { |
|
151 | 151 | $this->_asTargetSectionID = $this->_getTargetSectionID( $asFieldset ); |
152 | 152 | return $this->_asTargetSectionID; |
153 | 153 | } |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | |
157 | 157 | // Set the target section ID |
158 | 158 | $this->_asTargetSectionID = $this->getElement( |
159 | - $_aFieldset, // subject array |
|
159 | + $_aFieldset, // subject array |
|
160 | 160 | 'section_id', // key |
161 | 161 | $this->_asTargetSectionID // default |
162 | 162 | ); |
163 | 163 | |
164 | 164 | // Required Keys |
165 | - if ( ! isset( $_aFieldset[ 'field_id' ], $_aFieldset[ 'type' ] ) ) { |
|
165 | + if ( !isset( $_aFieldset[ 'field_id' ], $_aFieldset[ 'type' ] ) ) { |
|
166 | 166 | return null; |
167 | 167 | } |
168 | 168 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function removeField( $sFieldID ) { |
267 | 267 | |
268 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
268 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
269 | 269 | |
270 | 270 | if ( array_key_exists( $sFieldID, $_aSubSectionsOrFields ) ) { |
271 | 271 | unset( $this->aFieldsets[ $_sSectionID ][ $sFieldID ] ); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function removeSection( $sSectionID ) { |
96 | 96 | |
97 | - if ( '_default' === $sSectionID ){ |
|
97 | + if ( '_default' === $sSectionID ) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | unset( |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ); |
163 | 163 | |
164 | 164 | // Required Keys |
165 | - if ( ! isset( $_aFieldset[ 'field_id' ], $_aFieldset[ 'type' ] ) ) { |
|
165 | + if ( ! isset( $_aFieldset[ 'field_id' ], $_aFieldset[ 'type' ] ) ) { |
|
166 | 166 | return null; |
167 | 167 | } |
168 | 168 |
@@ -231,6 +231,7 @@ discard block |
||
231 | 231 | /** |
232 | 232 | * Returns the system information by section. |
233 | 233 | * @since 3.5.3 |
234 | + * @param integer $iPrintType |
|
234 | 235 | * @return string The system information by section. |
235 | 236 | */ |
236 | 237 | private function _getSystemInfoBySection( $sSectionName, $aData, $iPrintType ) { |
@@ -350,6 +351,8 @@ discard block |
||
350 | 351 | /** |
351 | 352 | * |
352 | 353 | * @since 3.5.12 |
354 | + * @param string $asCategories |
|
355 | + * @param string $asRemovingCategories |
|
353 | 356 | * @return stirng|array |
354 | 357 | */ |
355 | 358 | private function _getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * ) |
31 | 31 | * ); |
32 | 32 | */ |
33 | - public $aFieldTypeSlugs = array( 'system', ); |
|
33 | + public $aFieldTypeSlugs = array( 'system',); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Defines the default key-values of this field type. |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
48 | 48 | */ |
49 | 49 | protected $aDefaultKeys = array( |
50 | - 'data' => array(), // [3.2.0+] Stores the data to be displayed |
|
51 | - 'print_type' => 1, // [3.4.6+] 1: readable representation of array. 2: print_r() |
|
50 | + 'data' => array(), // [3.2.0+] Stores the data to be displayed |
|
51 | + 'print_type' => 1, // [3.4.6+] 1: readable representation of array. 2: print_r() |
|
52 | 52 | 'attributes' => array( |
53 | 53 | 'rows' => 60, |
54 | 54 | 'autofocus' => null, |
@@ -161,25 +161,25 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function getField( $aField ) { |
163 | 163 | |
164 | - $_aInputAttributes = $aField['attributes']; |
|
165 | - $_aInputAttributes['class'] .= ' system'; |
|
166 | - unset( $_aInputAttributes['value'] ); |
|
164 | + $_aInputAttributes = $aField[ 'attributes' ]; |
|
165 | + $_aInputAttributes[ 'class' ] .= ' system'; |
|
166 | + unset( $_aInputAttributes[ 'value' ] ); |
|
167 | 167 | return |
168 | - $aField['before_label'] |
|
168 | + $aField[ 'before_label' ] |
|
169 | 169 | . "<div class='admin-page-framework-input-label-container'>" |
170 | - . "<label for='{$aField['input_id']}'>" |
|
171 | - . $aField['before_input'] |
|
172 | - . ( $aField['label'] && ! $aField['repeatable'] |
|
173 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>" |
|
170 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
171 | + . $aField[ 'before_input' ] |
|
172 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
173 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>" |
|
174 | 174 | : "" |
175 | 175 | ) |
176 | - . "<textarea " . $this->getAttributes( $_aInputAttributes ) . " >" |
|
177 | - . esc_textarea( $this->_getSystemInfomation( $aField['value'], $aField['data'], $aField['print_type'] ) ) |
|
176 | + . "<textarea ".$this->getAttributes( $_aInputAttributes )." >" |
|
177 | + . esc_textarea( $this->_getSystemInfomation( $aField[ 'value' ], $aField[ 'data' ], $aField[ 'print_type' ] ) ) |
|
178 | 178 | . "</textarea>" |
179 | - . $aField['after_input'] |
|
179 | + . $aField[ 'after_input' ] |
|
180 | 180 | . "</label>" |
181 | 181 | . "</div>" |
182 | - . $aField['after_label']; |
|
182 | + . $aField[ 'after_label' ]; |
|
183 | 183 | |
184 | 184 | } |
185 | 185 | /** |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return string The human readable system information. |
189 | 189 | */ |
190 | - private function _getSystemInfomation( $asValue=null, $asCustomData=null, $iPrintType=1 ) { |
|
190 | + private function _getSystemInfomation( $asValue = null, $asCustomData = null, $iPrintType = 1 ) { |
|
191 | 191 | |
192 | 192 | if ( isset( $asValue ) ) { |
193 | 193 | return $asValue; |
194 | 194 | } |
195 | 195 | |
196 | - $_aOutput = array(); |
|
197 | - foreach( $this->_getFormattedSystemInformation( $asCustomData ) as $_sSection => $_aInfo ) { |
|
198 | - $_aOutput[] = $this->_getSystemInfoBySection( $_sSection, $_aInfo, $iPrintType ); |
|
196 | + $_aOutput = array(); |
|
197 | + foreach ( $this->_getFormattedSystemInformation( $asCustomData ) as $_sSection => $_aInfo ) { |
|
198 | + $_aOutput[ ] = $this->_getSystemInfoBySection( $_sSection, $_aInfo, $iPrintType ); |
|
199 | 199 | } |
200 | 200 | return implode( PHP_EOL, $_aOutput ); |
201 | 201 | |
@@ -210,18 +210,18 @@ discard block |
||
210 | 210 | |
211 | 211 | $_aData = $this->getAsArray( $asCustomData ); |
212 | 212 | $_aData = $_aData + array( |
213 | - 'Admin Page Framework' => isset( $_aData['Admin Page Framework'] ) |
|
213 | + 'Admin Page Framework' => isset( $_aData[ 'Admin Page Framework' ] ) |
|
214 | 214 | ? null |
215 | 215 | : AdminPageFramework_Registry::getInfo(), |
216 | - 'WordPress' => $this->_getSiteInfoWithCache( ! isset( $_aData['WordPress'] ) ), |
|
217 | - 'PHP' => $this->_getPHPInfo( ! isset( $_aData['PHP'] ) ), |
|
218 | - 'PHP Error Log' => $this->_getErrorLogByType( 'php', ! isset( $_aData['PHP Error Log'] ) ), |
|
219 | - 'MySQL' => isset( $_aData['MySQL'] ) |
|
216 | + 'WordPress' => $this->_getSiteInfoWithCache( !isset( $_aData[ 'WordPress' ] ) ), |
|
217 | + 'PHP' => $this->_getPHPInfo( !isset( $_aData[ 'PHP' ] ) ), |
|
218 | + 'PHP Error Log' => $this->_getErrorLogByType( 'php', !isset( $_aData[ 'PHP Error Log' ] ) ), |
|
219 | + 'MySQL' => isset( $_aData[ 'MySQL' ] ) |
|
220 | 220 | ? null |
221 | - : $this->getMySQLInfo(), // defined in the utility class. |
|
222 | - 'MySQL Error Log' => $this->_getErrorLogByType( 'mysql', ! isset( $_aData['MySQL Error Log'] ) ), |
|
223 | - 'Server' => $this->_getWebServerInfo( ! isset( $_aData['Server'] ) ), |
|
224 | - 'Browser' => $this->_getClientInfo( ! isset( $_aData['Browser'] ) ), |
|
221 | + : $this->getMySQLInfo(), // defined in the utility class. |
|
222 | + 'MySQL Error Log' => $this->_getErrorLogByType( 'mysql', !isset( $_aData[ 'MySQL Error Log' ] ) ), |
|
223 | + 'Server' => $this->_getWebServerInfo( !isset( $_aData[ 'Server' ] ) ), |
|
224 | + 'Browser' => $this->_getClientInfo( !isset( $_aData[ 'Browser' ] ) ), |
|
225 | 225 | ); |
226 | 226 | |
227 | 227 | // Dropping empty elements allows the user to remove a section by setting an empty section. |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | switch ( $iPrintType ) { |
238 | 238 | default: |
239 | 239 | case 1: // use the framework readable representation of arrays. |
240 | - return $this->getReadableArrayContents( $sSectionName, $aData, 32 ) . PHP_EOL; |
|
240 | + return $this->getReadableArrayContents( $sSectionName, $aData, 32 ).PHP_EOL; |
|
241 | 241 | case 2: // use print_r() |
242 | - return "[{$sSectionName}]" . PHP_EOL |
|
243 | - . print_r( $aData, true ) . PHP_EOL; |
|
242 | + return "[{$sSectionName}]".PHP_EOL |
|
243 | + . print_r( $aData, true ).PHP_EOL; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | /** |
@@ -249,17 +249,17 @@ discard block |
||
249 | 249 | * @since 3.4.6 |
250 | 250 | * @since 3.5.3 Added the $bGenerateInfo paramter. This is to reduce conditional statment in the caller method. |
251 | 251 | */ |
252 | - private function _getClientInfo( $bGenerateInfo=true ) { |
|
252 | + private function _getClientInfo( $bGenerateInfo = true ) { |
|
253 | 253 | |
254 | - if ( ! $bGenerateInfo ) { |
|
254 | + if ( !$bGenerateInfo ) { |
|
255 | 255 | return ''; |
256 | 256 | } |
257 | 257 | |
258 | 258 | // Check the browscap value in the ini file first to prevent warnings from being populated |
259 | 259 | $_aBrowser = @ini_get( 'browscap' ) |
260 | - ? get_browser( $_SERVER['HTTP_USER_AGENT'], true ) |
|
260 | + ? get_browser( $_SERVER[ 'HTTP_USER_AGENT' ], true ) |
|
261 | 261 | : array(); |
262 | - unset( $_aBrowser['browser_name_regex'] ); // this element causes output to be blank |
|
262 | + unset( $_aBrowser[ 'browser_name_regex' ] ); // this element causes output to be blank |
|
263 | 263 | return empty( $_aBrowser ) |
264 | 264 | ? __( 'No browser information found.', 'admin-page-framework' ) |
265 | 265 | : $_aBrowser; |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @param string $sType The error log type. Either 'php' or 'mysql' is accepted. |
275 | 275 | * @param boolean $bGenerateInfo Whether to generate a log. This is for the caller method to reduce a conditinal statement. |
276 | 276 | */ |
277 | - private function _getErrorLogByType( $sType, $bGenerateInfo=true ) { |
|
277 | + private function _getErrorLogByType( $sType, $bGenerateInfo = true ) { |
|
278 | 278 | |
279 | - if ( ! $bGenerateInfo ) { |
|
279 | + if ( !$bGenerateInfo ) { |
|
280 | 280 | return ''; |
281 | 281 | } |
282 | 282 | switch ( $sType ) { |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | * @since 3.5.3 Added the $bGenerateInfo paramter. This is to reduce conditional statment in the caller method. |
308 | 308 | * @return array The generated site information array. |
309 | 309 | */ |
310 | - private function _getSiteInfoWithCache( $bGenerateInfo=true ) { |
|
310 | + private function _getSiteInfoWithCache( $bGenerateInfo = true ) { |
|
311 | 311 | |
312 | - if ( ! $bGenerateInfo || isset( self::$_aSiteInfo ) ) { |
|
312 | + if ( !$bGenerateInfo || isset( self::$_aSiteInfo ) ) { |
|
313 | 313 | return self::$_aSiteInfo; |
314 | 314 | } |
315 | 315 | self::$_aSiteInfo = self::_getSiteInfo(); |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | 'wp_remote_get()' => $this->_getWPRemoteGetStatus(), |
343 | 343 | __( 'Multibite String Extension', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'mb_detect_encoding' ), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ), |
344 | 344 | __( 'WP_CONTENT_DIR Writeable', 'admin-page-framework' ) => $this->getAOrB( is_writable( WP_CONTENT_DIR ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
345 | - __( 'Active Plugins', 'admin-page-framework' ) => PHP_EOL . $this->_getActivePlugins(), |
|
346 | - __( 'Network Active Plugins', 'admin-page-framework' ) => PHP_EOL . $this->_getNetworkActivePlugins(), |
|
345 | + __( 'Active Plugins', 'admin-page-framework' ) => PHP_EOL.$this->_getActivePlugins(), |
|
346 | + __( 'Network Active Plugins', 'admin-page-framework' ) => PHP_EOL.$this->_getNetworkActivePlugins(), |
|
347 | 347 | __( 'Constants', 'admin-page-framework' ) => $this->_getDefinedConstants( 'user' ), |
348 | 348 | ); |
349 | 349 | } |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | * @since 3.5.12 |
353 | 353 | * @return stirng|array |
354 | 354 | */ |
355 | - private function _getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) { |
|
355 | + private function _getDefinedConstants( $asCategories = null, $asRemovingCategories = null ) { |
|
356 | 356 | $_asConstants = $this->getDefinedConstants( $asCategories, $asRemovingCategories ); |
357 | - if ( ! is_array( $_asConstants ) ) { |
|
357 | + if ( !is_array( $_asConstants ) ) { |
|
358 | 358 | return $_asConstants; |
359 | 359 | } |
360 | 360 | if ( isset( $_asConstants[ 'user' ] ) ) { |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | private function _getActiveThemeName() { |
389 | 389 | |
390 | 390 | // If the WordPress version is less than 3.4, |
391 | - if ( version_compare( $GLOBALS['wp_version'], '3.4', '<' ) ) { |
|
392 | - $_aThemeData = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
393 | - return $_aThemeData['Name'] . ' ' . $_aThemeData['Version']; |
|
391 | + if ( version_compare( $GLOBALS[ 'wp_version' ], '3.4', '<' ) ) { |
|
392 | + $_aThemeData = get_theme_data( get_stylesheet_directory().'/style.css' ); |
|
393 | + return $_aThemeData[ 'Name' ].' '.$_aThemeData[ 'Version' ]; |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | $_oThemeData = wp_get_theme(); |
397 | - return $_oThemeData->Name . ' ' . $_oThemeData->Version; |
|
397 | + return $_oThemeData->Name.' '.$_oThemeData->Version; |
|
398 | 398 | |
399 | 399 | } |
400 | 400 | /** |
@@ -407,10 +407,10 @@ discard block |
||
407 | 407 | $_aPluginList = array(); |
408 | 408 | $_aActivePlugins = get_option( 'active_plugins', array() ); |
409 | 409 | foreach ( get_plugins() as $_sPluginPath => $_aPlugin ) { |
410 | - if ( ! in_array( $_sPluginPath, $_aActivePlugins ) ) { |
|
410 | + if ( !in_array( $_sPluginPath, $_aActivePlugins ) ) { |
|
411 | 411 | continue; |
412 | 412 | } |
413 | - $_aPluginList[] = ' ' . $_aPlugin['Name'] . ': ' . $_aPlugin['Version']; |
|
413 | + $_aPluginList[ ] = ' '.$_aPlugin[ 'Name' ].': '.$_aPlugin[ 'Version' ]; |
|
414 | 414 | } |
415 | 415 | return implode( PHP_EOL, $_aPluginList ); |
416 | 416 | |
@@ -421,17 +421,17 @@ discard block |
||
421 | 421 | */ |
422 | 422 | private function _getNetworkActivePlugins() { |
423 | 423 | |
424 | - if ( ! is_multisite() ) { |
|
424 | + if ( !is_multisite() ) { |
|
425 | 425 | return ''; |
426 | 426 | } |
427 | 427 | $_aPluginList = array(); |
428 | 428 | $_aActivePlugins = get_site_option( 'active_sitewide_plugins', array() ); |
429 | 429 | foreach ( wp_get_active_network_plugins() as $_sPluginPath ) { |
430 | - if ( ! array_key_exists( plugin_basename( $_sPluginPath ), $_aActivePlugins ) ) { |
|
430 | + if ( !array_key_exists( plugin_basename( $_sPluginPath ), $_aActivePlugins ) ) { |
|
431 | 431 | continue; |
432 | 432 | } |
433 | 433 | $_aPlugin = get_plugin_data( $_sPluginPath ); |
434 | - $_aPluginList[] = ' ' . $_aPlugin['Name'] . ' :' . $_aPlugin['Version']; |
|
434 | + $_aPluginList[ ] = ' '.$_aPlugin[ 'Name' ].' :'.$_aPlugin[ 'Version' ]; |
|
435 | 435 | } |
436 | 436 | return implode( PHP_EOL, $_aPluginList ); |
437 | 437 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $_vResponse = false === $_vResponse |
449 | 449 | ? wp_remote_post( |
450 | 450 | // 'https://www.paypal.com/cgi-bin/webscr', |
451 | - add_query_arg( $_GET, admin_url( $GLOBALS['pagenow'] ) ), |
|
451 | + add_query_arg( $_GET, admin_url( $GLOBALS[ 'pagenow' ] ) ), |
|
452 | 452 | array( |
453 | 453 | 'sslverify' => false, |
454 | 454 | 'timeout' => 60, |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $_vResponse = $this->getTransient( 'apf_rg_check' ); |
471 | 471 | $_vResponse = false === $_vResponse |
472 | 472 | ? wp_remote_get( |
473 | - add_query_arg( $_GET + array( 'apf_remote_request_test' => '_testing' ), admin_url( $GLOBALS['pagenow'] ) ), |
|
473 | + add_query_arg( $_GET + array( 'apf_remote_request_test' => '_testing' ), admin_url( $GLOBALS[ 'pagenow' ] ) ), |
|
474 | 474 | array( |
475 | 475 | 'sslverify' => false, |
476 | 476 | 'timeout' => 60, |
@@ -494,10 +494,10 @@ discard block |
||
494 | 494 | if ( is_wp_error( $mResponse ) ) { |
495 | 495 | return true; |
496 | 496 | } |
497 | - if ( $mResponse['response']['code'] < 200 ) { |
|
497 | + if ( $mResponse[ 'response' ][ 'code' ] < 200 ) { |
|
498 | 498 | return true; |
499 | 499 | } |
500 | - if ( $mResponse['response']['code'] >= 300 ) { |
|
500 | + if ( $mResponse[ 'response' ][ 'code' ] >= 300 ) { |
|
501 | 501 | return true; |
502 | 502 | } |
503 | 503 | return false; |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | * @since 3.4.6 |
515 | 515 | * @since 3.5.3 Added the $bGenerateInfo paramter. This is to reduce conditional statment in the caller method. |
516 | 516 | */ |
517 | - private function _getPHPInfo( $bGenerateInfo=true ) { |
|
517 | + private function _getPHPInfo( $bGenerateInfo = true ) { |
|
518 | 518 | |
519 | - if ( ! $bGenerateInfo || isset( self::$_aPHPInfo ) ) { |
|
519 | + if ( !$bGenerateInfo || isset( self::$_aPHPInfo ) ) { |
|
520 | 520 | return self::$_aPHPInfo; |
521 | 521 | } |
522 | 522 | |
523 | - $_oErrorReporting = new AdminPageFramework_ErrorReporting; |
|
523 | + $_oErrorReporting = new AdminPageFramework_ErrorReporting; |
|
524 | 524 | self::$_aPHPInfo = array( |
525 | 525 | __( 'Version', 'admin-page-framework' ) => phpversion(), |
526 | 526 | __( 'Safe Mode', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'safe_mode' ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
@@ -531,16 +531,16 @@ discard block |
||
531 | 531 | __( 'Max Execution Time', 'admin-page-framework' ) => @ini_get( 'max_execution_time' ), |
532 | 532 | __( 'Max Input Vars', 'admin-page-framework' ) => @ini_get( 'max_input_vars' ), |
533 | 533 | __( 'Argument Separator', 'admin-page-framework' ) => @ini_get( 'arg_separator.output' ), |
534 | - __( 'Allow URL File Open', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'allow_url_fopen' ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
|
535 | - __( 'Display Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'display_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
536 | - __( 'Log Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'log_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
534 | + __( 'Allow URL File Open', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'allow_url_fopen' ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
|
535 | + __( 'Display Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'display_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
536 | + __( 'Log Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'log_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
537 | 537 | __( 'Error log location', 'admin-page-framework' ) => @ini_get( 'error_log' ), |
538 | 538 | __( 'Error Reporting Level', 'admin-page-framework' ) => $_oErrorReporting->getErrorLevel(), |
539 | - __( 'FSOCKOPEN', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'fsockopen' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
540 | - __( 'cURL', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'curl_init' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
541 | - __( 'SOAP', 'admin-page-framework' ) => $this->getAOrB( class_exists( 'SoapClient' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
542 | - __( 'SUHOSIN', 'admin-page-framework' ) => $this->getAOrB( extension_loaded( 'suhosin' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
543 | - 'ini_set()' => $this->getAOrB( function_exists( 'ini_set' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
539 | + __( 'FSOCKOPEN', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'fsockopen' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
540 | + __( 'cURL', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'curl_init' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
541 | + __( 'SOAP', 'admin-page-framework' ) => $this->getAOrB( class_exists( 'SoapClient' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
542 | + __( 'SUHOSIN', 'admin-page-framework' ) => $this->getAOrB( extension_loaded( 'suhosin' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
543 | + 'ini_set()' => $this->getAOrB( function_exists( 'ini_set' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
544 | 544 | ) |
545 | 545 | + $this->getPHPInfo() |
546 | 546 | + array( |
@@ -557,11 +557,11 @@ discard block |
||
557 | 557 | * @since 3.4.6 |
558 | 558 | * @since 3.5.3 Added the $bGenerateInfo paramter. This is to reduce conditional statment in the caller method. |
559 | 559 | */ |
560 | - private function _getWebServerInfo( $bGenerateInfo=true ) { |
|
560 | + private function _getWebServerInfo( $bGenerateInfo = true ) { |
|
561 | 561 | |
562 | 562 | return $bGenerateInfo |
563 | 563 | ? array( |
564 | - __( 'Web Server', 'admin-page-framework' ) => $_SERVER['SERVER_SOFTWARE'], |
|
564 | + __( 'Web Server', 'admin-page-framework' ) => $_SERVER[ 'SERVER_SOFTWARE' ], |
|
565 | 565 | 'SSL' => $this->getAOrB( is_ssl(), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
566 | 566 | __( 'Session', 'admin-page-framework' ) => $this->getAOrB( isset( $_SESSION ), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ), |
567 | 567 | __( 'Session Name', 'admin-page-framework' ) => esc_html( @ini_get( 'session.name' ) ), |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * <li>**attributes** - (optional, array) [3.3.0+] attribute argument array. `array( 'async' => '', 'data-id' => '...' )`</li> |
95 | 95 | * </ul> |
96 | 96 | */ |
97 | - protected function getEnqueuingScripts() { |
|
97 | + protected function getEnqueuingScripts() { |
|
98 | 98 | return array(); |
99 | 99 | } |
100 | 100 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * <li><strong>media</strong> - ( optional, string ) the description of the field which is inserted into the after the input field tag.</li> |
111 | 111 | * </ul> |
112 | 112 | */ |
113 | - protected function getEnqueuingStyles() { |
|
113 | + protected function getEnqueuingStyles() { |
|
114 | 114 | return array(); |
115 | 115 | } |
116 | 116 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * Returns the field type specific JavaScript script. |
120 | 120 | */ |
121 | - protected function getScripts() { |
|
121 | + protected function getScripts() { |
|
122 | 122 | return ''; |
123 | 123 | } |
124 | 124 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * Returns the output of the field type. |
161 | 161 | */ |
162 | - protected function getField( $aField ) { |
|
162 | + protected function getField( $aField ) { |
|
163 | 163 | |
164 | 164 | $_aInputAttributes = $aField['attributes']; |
165 | 165 | $_aInputAttributes['class'] .= ' system'; |
@@ -426,7 +426,7 @@ |
||
426 | 426 | * |
427 | 427 | * @since 2.0.0 |
428 | 428 | * @param array $vValue This can be either an one-dimensional array ( for single field ) or a two-dimensional array ( for multiple fields ). |
429 | - * @param string $sKey |
|
429 | + * @param string $sTaxonomySlug |
|
430 | 430 | * @return array Returns an numerically indexed array holding the keys that yield true as the value. |
431 | 431 | */ |
432 | 432 | private function _getSelectedKeyArray( $vValue, $sTaxonomySlug ) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'taxonomy', ); |
|
24 | + public $aFieldTypeSlugs = array( 'taxonomy',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -29,40 +29,40 @@ discard block |
||
29 | 29 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
30 | 30 | */ |
31 | 31 | protected $aDefaultKeys = array( |
32 | - 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
33 | - 'height' => '250px', // the tab box height |
|
34 | - 'width' => null, // 3.5.7.2+ the tab box width |
|
35 | - 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
36 | - 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
32 | + 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
33 | + 'height' => '250px', // the tab box height |
|
34 | + 'width' => null, // 3.5.7.2+ the tab box width |
|
35 | + 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
36 | + 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
37 | 37 | 'attributes' => array(), |
38 | - 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
39 | - 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
40 | - 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
41 | - 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
38 | + 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
39 | + 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
40 | + 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
41 | + 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
42 | 42 | 'query' => array( // (array) 3.3.2+ Defines the default query argument. |
43 | 43 | // see the arguments of the get_category() function: http://codex.wordpress.org/Function_Reference/get_categories |
44 | 44 | // see the argument of the get_terms() function: http://codex.wordpress.org/Function_Reference/get_terms |
45 | 45 | 'child_of' => 0, |
46 | 46 | 'parent' => '', |
47 | - 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
48 | - 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
49 | - 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
50 | - 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
51 | - 'number' => '', // (integer) The maximum number of the terms to show. |
|
52 | - 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
53 | - 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
47 | + 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
48 | + 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
49 | + 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
50 | + 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
51 | + 'number' => '', // (integer) The maximum number of the terms to show. |
|
52 | + 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
53 | + 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
54 | 54 | 'exclude_tree' => array(), |
55 | - 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
55 | + 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
56 | 56 | 'fields' => 'all', |
57 | 57 | 'slug' => '', |
58 | 58 | 'get' => '', |
59 | 59 | 'name__like' => '', |
60 | 60 | 'description__like' => '', |
61 | 61 | 'offset' => '', |
62 | - 'search' => '', // (string) The search keyword to get the term with. |
|
62 | + 'search' => '', // (string) The search keyword to get the term with. |
|
63 | 63 | 'cache_domain' => 'core', |
64 | 64 | ), |
65 | - 'queries' => array(), // (optional, array) 3.3.2+ Allows to set a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
65 | + 'queries' => array(), // (optional, array) 3.3.2+ Allows to set a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $_aJSArray = json_encode( $this->aFieldTypeSlugs ); |
90 | 90 | |
91 | - return parent::getScripts() . |
|
91 | + return parent::getScripts(). |
|
92 | 92 | // return |
93 | 93 | <<<JAVASCRIPTS |
94 | 94 | /* For tabs */ |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | protected function getField( $aField ) { |
322 | 322 | |
323 | 323 | // Format |
324 | - $aField['label_no_term_found'] = $this->getElement( |
|
324 | + $aField[ 'label_no_term_found' ] = $this->getElement( |
|
325 | 325 | $aField, |
326 | 326 | 'label_no_term_found', |
327 | 327 | $this->oMsg->get( 'no_term_found' ) |
@@ -330,18 +330,18 @@ discard block |
||
330 | 330 | // Parse |
331 | 331 | $_aTabs = array(); |
332 | 332 | $_aCheckboxes = array(); |
333 | - foreach( $this->getAsArray( $aField['taxonomy_slugs'] ) as $sKey => $sTaxonomySlug ) { |
|
334 | - $_aTabs[] = $this->_getTaxonomyTab( $aField, $sKey, $sTaxonomySlug ); |
|
335 | - $_aCheckboxes[] = $this->_getTaxonomyCheckboxes( $aField, $sKey, $sTaxonomySlug ); |
|
333 | + foreach ( $this->getAsArray( $aField[ 'taxonomy_slugs' ] ) as $sKey => $sTaxonomySlug ) { |
|
334 | + $_aTabs[ ] = $this->_getTaxonomyTab( $aField, $sKey, $sTaxonomySlug ); |
|
335 | + $_aCheckboxes[ ] = $this->_getTaxonomyCheckboxes( $aField, $sKey, $sTaxonomySlug ); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // Output |
339 | - return "<div id='tabbox-{$aField['field_id']}' class='tab-box-container categorydiv' style='max-width:{$aField['max_width']};'>" |
|
339 | + return "<div id='tabbox-{$aField[ 'field_id' ]}' class='tab-box-container categorydiv' style='max-width:{$aField[ 'max_width' ]};'>" |
|
340 | 340 | . "<ul class='tab-box-tabs category-tabs'>" |
341 | 341 | . implode( PHP_EOL, $_aTabs ) |
342 | 342 | . "</ul>" |
343 | 343 | . "<div class='tab-box-contents-container'>" |
344 | - . "<div class='tab-box-contents' style='height: {$aField['height']};'>" |
|
344 | + . "<div class='tab-box-contents' style='height: {$aField[ 'height' ]};'>" |
|
345 | 345 | . implode( PHP_EOL, $_aCheckboxes ) |
346 | 346 | . "</div>" |
347 | 347 | . "</div>" |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | private function _getTaxonomyCheckboxes( array $aField, $sKey, $sTaxonomySlug ) { |
359 | 359 | |
360 | 360 | $_aTabBoxContainerArguments = array( |
361 | - 'id' => "tab_{$aField['input_id']}_{$sKey}", |
|
361 | + 'id' => "tab_{$aField[ 'input_id' ]}_{$sKey}", |
|
362 | 362 | 'class' => 'tab-box-content', |
363 | 363 | 'style' => $this->generateInlineCSS( |
364 | 364 | array( |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | ) |
368 | 368 | ), |
369 | 369 | ); |
370 | - return "<div " . $this->getAttributes( $_aTabBoxContainerArguments ) . ">" |
|
370 | + return "<div ".$this->getAttributes( $_aTabBoxContainerArguments ).">" |
|
371 | 371 | . $this->getElement( $aField, array( 'before_label', $sKey ) ) |
372 | - . "<div " . $this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ) . "></div>" |
|
372 | + . "<div ".$this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) )."></div>" |
|
373 | 373 | . "<ul class='list:category taxonomychecklist form-no-clear'>" |
374 | 374 | . $this->_getTaxonomyChecklist( $aField, $sKey, $sTaxonomySlug ) |
375 | 375 | . "</ul>" |
@@ -389,23 +389,23 @@ discard block |
||
389 | 389 | array( |
390 | 390 | 'walker' => new AdminPageFramework_WalkerTaxonomyChecklist, // the walker class instance |
391 | 391 | 'taxonomy' => $sTaxonomySlug, |
392 | - '_name_prefix' => is_array( $aField['taxonomy_slugs'] ) |
|
393 | - ? "{$aField['_input_name']}[{$sTaxonomySlug}]" |
|
394 | - : $aField['_input_name'], // name prefix of the input |
|
395 | - '_input_id_prefix' => $aField['input_id'], |
|
392 | + '_name_prefix' => is_array( $aField[ 'taxonomy_slugs' ] ) |
|
393 | + ? "{$aField[ '_input_name' ]}[{$sTaxonomySlug}]" |
|
394 | + : $aField[ '_input_name' ], // name prefix of the input |
|
395 | + '_input_id_prefix' => $aField[ 'input_id' ], |
|
396 | 396 | '_attributes' => $this->getElement( |
397 | 397 | $aField, |
398 | 398 | array( 'attributes', $sKey ), |
399 | 399 | array() |
400 | - ) + $aField['attributes'], |
|
400 | + ) + $aField[ 'attributes' ], |
|
401 | 401 | |
402 | 402 | // checked items ( term IDs ) e.g. array( 6, 10, 7, 15 ), |
403 | - '_selected_items' => $this->_getSelectedKeyArray( $aField['value'], $sTaxonomySlug ), |
|
403 | + '_selected_items' => $this->_getSelectedKeyArray( $aField[ 'value' ], $sTaxonomySlug ), |
|
404 | 404 | |
405 | - 'echo' => false, // returns the output |
|
406 | - 'show_post_count' => $aField['show_post_count'], // 3.2.0+ |
|
407 | - 'show_option_none' => $aField['label_no_term_found'], // 3.3.2+ |
|
408 | - 'title_li' => $aField['label_list_title'], // 3.3.2+ |
|
405 | + 'echo' => false, // returns the output |
|
406 | + 'show_post_count' => $aField[ 'show_post_count' ], // 3.2.0+ |
|
407 | + 'show_option_none' => $aField[ 'label_no_term_found' ], // 3.3.2+ |
|
408 | + 'title_li' => $aField[ 'label_list_title' ], // 3.3.2+ |
|
409 | 409 | ) |
410 | 410 | + $this->getAsArray( |
411 | 411 | $this->getElement( |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | ), |
416 | 416 | true |
417 | 417 | ) |
418 | - + $aField['query'] |
|
418 | + + $aField[ 'query' ] |
|
419 | 419 | ); |
420 | 420 | } |
421 | 421 | |
@@ -433,10 +433,10 @@ discard block |
||
433 | 433 | |
434 | 434 | $vValue = ( array ) $vValue; // cast array because the initial value (null) may not be an array. |
435 | 435 | |
436 | - if ( ! isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
436 | + if ( !isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
437 | 437 | return array(); |
438 | 438 | } |
439 | - if ( ! is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
439 | + if ( !is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
440 | 440 | return array(); |
441 | 441 | } |
442 | 442 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | private function _getTaxonomyTab( array $aField, $sKey, $sTaxonomySlug ) { |
454 | 454 | return "<li class='tab-box-tab'>" |
455 | - . "<a href='#tab_{$aField['input_id']}_{$sKey}'>" |
|
455 | + . "<a href='#tab_{$aField[ 'input_id' ]}_{$sKey}'>" |
|
456 | 456 | . "<span class='tab-box-tab-text'>" |
457 | 457 | . $this->_getLabelFromTaxonomySlug( $sTaxonomySlug ) |
458 | 458 | . "</span>" |
@@ -433,10 +433,10 @@ |
||
433 | 433 | |
434 | 434 | $vValue = ( array ) $vValue; // cast array because the initial value (null) may not be an array. |
435 | 435 | |
436 | - if ( ! isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
436 | + if ( ! isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
437 | 437 | return array(); |
438 | 438 | } |
439 | - if ( ! is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
439 | + if ( ! is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
440 | 440 | return array(); |
441 | 441 | } |
442 | 442 |
@@ -105,10 +105,8 @@ |
||
105 | 105 | * If a parameter is not passed, it returns the entire attribute array. |
106 | 106 | * |
107 | 107 | * @since 3.5.3 |
108 | - * @return string|array|null The specified attribute value or the entire attribute array if not specified. |
|
108 | + * @return string The specified attribute value or the entire attribute array if not specified. |
|
109 | 109 | * If not set, null will be returned as the `getAttributes()` method will not list an attribute with the null value. |
110 | - * @param string $sName The attribute name. |
|
111 | - * @param string $sDefault The defaqult value if the value is not set. |
|
112 | 110 | */ |
113 | 111 | public function getAttribute( /* $sName=null, $sDefault=null */ ) { |
114 | 112 | $_aParams = func_get_args() + array( |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param array $aAttributes The attribute array. A field definition array is deprecated. |
64 | 64 | * @param array $aOptions options that allows to set custom container tags and class selctors. |
65 | 65 | */ |
66 | - public function __construct( array $aAttributes, array $aOptions=array() ) { |
|
66 | + public function __construct( array $aAttributes, array $aOptions = array() ) { |
|
67 | 67 | |
68 | - $this->aAttributes = $this->getElementAsArray( |
|
68 | + $this->aAttributes = $this->getElementAsArray( |
|
69 | 69 | $aAttributes, |
70 | 70 | 'attributes', |
71 | 71 | $aAttributes // if the above key is not set, this will be set |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | * @return string The set class selector(s). |
128 | 128 | */ |
129 | 129 | public function addClass( /* $asSelectors1, $asSelectors2 */ ) { |
130 | - foreach( func_get_args() as $_asSelectors ) { |
|
131 | - $this->aAttributes['class'] = $this->getClassAttribute( |
|
132 | - $this->aAttributes['class'], |
|
130 | + foreach ( func_get_args() as $_asSelectors ) { |
|
131 | + $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
|
132 | + $this->aAttributes[ 'class' ], |
|
133 | 133 | $_asSelectors |
134 | 134 | ); |
135 | 135 | } |
136 | - return $this->aAttributes['class']; |
|
136 | + return $this->aAttributes[ 'class' ]; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // $this->aAttributes[ $_aParams[ 0 ] ] = $_aParams[ 1 ]; |
159 | 159 | $this->setMultiDimensionalArray( |
160 | 160 | $this->aAttributes, |
161 | - $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
161 | + $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
162 | 162 | $_aParams[ 1 ] // $mValue |
163 | 163 | ); |
164 | 164 | } |
@@ -127,7 +127,7 @@ |
||
127 | 127 | * @return string The set class selector(s). |
128 | 128 | */ |
129 | 129 | public function addClass( /* $asSelectors1, $asSelectors2 */ ) { |
130 | - foreach( func_get_args() as $_asSelectors ) { |
|
130 | + foreach( func_get_args() as $_asSelectors ) { |
|
131 | 131 | $this->aAttributes['class'] = $this->getClassAttribute( |
132 | 132 | $this->aAttributes['class'], |
133 | 133 | $_asSelectors |
@@ -21,8 +21,6 @@ |
||
21 | 21 | * Returns the output of the input element. |
22 | 22 | * |
23 | 23 | * @since 3.4.0 |
24 | - * @param string $sLabel The label text. |
|
25 | - * @param array $aAttributes (optional) The attribute array. If set, it will be merged with the attribute set in the constructor. |
|
26 | 24 | */ |
27 | 25 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
28 | 26 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | // Output |
48 | 48 | return |
49 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
49 | + "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
50 | 50 | // the unchecked value must be set prior to the checkbox input field. |
51 | 51 | . "<input " . $this->getAttributes( |
52 | 52 | array( |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
28 | 28 | |
29 | 29 | // Parameters |
30 | - $_aParams = func_get_args() + array( |
|
31 | - 0 => '', // 1st parameter |
|
30 | + $_aParams = func_get_args() + array( |
|
31 | + 0 => '', // 1st parameter |
|
32 | 32 | 1 => array() // 2nd parameter |
33 | 33 | ); |
34 | - $_sLabel = $_aParams[ 0 ]; // first parameter |
|
34 | + $_sLabel = $_aParams[ 0 ]; // first parameter |
|
35 | 35 | |
36 | 36 | // Attributes |
37 | 37 | $_aAttributes = $this->uniteArrays( // second parameter |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | // Output |
48 | 48 | return |
49 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
49 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
50 | 50 | // the unchecked value must be set prior to the checkbox input field. |
51 | - . "<input " . $this->getAttributes( |
|
51 | + . "<input ".$this->getAttributes( |
|
52 | 52 | array( |
53 | 53 | 'type' => 'hidden', |
54 | 54 | 'class' => $_aAttributes[ 'class' ], |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | ) |
58 | 58 | ) |
59 | 59 | . " />" |
60 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
60 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
61 | 61 | . "</{$this->aOptions[ 'input_container_tag' ]}>" |
62 | - . "<{$this->aOptions[ 'label_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ) . ">" |
|
62 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
63 | 63 | . $_sLabel |
64 | 64 | . "</{$this->aOptions[ 'label_container_tag' ]}>" |
65 | 65 | ; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function getAttributesByKey( /* $sKey */ ) { |
76 | 76 | |
77 | 77 | // Parameters |
78 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
78 | + $_aParams = func_get_args() + array( 0 => '',); |
|
79 | 79 | $_sKey = $_aParams[ 0 ]; |
80 | 80 | $_bIsMultiple = '' !== $_sKey; |
81 | 81 | |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | // The type needs to be specified since the postytpe field type extends this class. If not set, the 'posttype' will be passed to the type attribute. |
88 | 88 | + array( |
89 | 89 | 'type' => 'checkbox', |
90 | - 'id' => $this->aAttributes[ 'id' ] . '_' . $_sKey, |
|
90 | + 'id' => $this->aAttributes[ 'id' ].'_'.$_sKey, |
|
91 | 91 | 'checked' => $this->_getCheckedAttributeValue( $_sKey ), |
92 | - 'value' => 1, // this must be always 1 because the key value can be zero. In that case, the value always will be false and unchecked. |
|
92 | + 'value' => 1, // this must be always 1 because the key value can be zero. In that case, the value always will be false and unchecked. |
|
93 | 93 | 'name' => $_bIsMultiple |
94 | 94 | ? "{$this->aAttributes[ 'name' ]}[{$_sKey}]" |
95 | 95 | : $this->aAttributes[ 'name' ], |
96 | - 'data-id' => $this->aAttributes[ 'id' ], // referenced by the JavaScript scripts such as the revealer script. |
|
96 | + 'data-id' => $this->aAttributes[ 'id' ], // referenced by the JavaScript scripts such as the revealer script. |
|
97 | 97 | ) |
98 | 98 | + $this->aAttributes |
99 | 99 | ; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | : array( 'value', $_sKey ); |
111 | 111 | return $this->getElement( $this->aAttributes, $_aValueDimension ) |
112 | 112 | ? 'checked' |
113 | - : null; // to not to set, pass null. An empty value '' will still set the attribute. |
|
113 | + : null; // to not to set, pass null. An empty value '' will still set the attribute. |
|
114 | 114 | |
115 | 115 | } |
116 | 116 |
@@ -21,8 +21,6 @@ discard block |
||
21 | 21 | * Returns the output of the input element. |
22 | 22 | * |
23 | 23 | * @since 3.4.0 |
24 | - * @param string $sLabel The label text. |
|
25 | - * @param array $aAttributes (optional) The attribute array. If set, it will be merged with the attribute set in the constructor. |
|
26 | 24 | */ |
27 | 25 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
28 | 26 | |
@@ -52,8 +50,6 @@ discard block |
||
52 | 50 | * |
53 | 51 | * @return array The updated attribute array. |
54 | 52 | * @since 3.5.3 |
55 | - * @param string $sKey The array element key of the radio button. |
|
56 | - * It is assumed that there is an array that holds multiple radio buttons and each of them has an array key. |
|
57 | 53 | */ |
58 | 54 | public function getAttributesByKey( /* $sKey */ ) { |
59 | 55 |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | |
37 | 37 | // Output |
38 | 38 | return |
39 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
40 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
41 | - . "</{$this->aOptions['input_container_tag']}>" |
|
42 | - . "<{$this->aOptions['label_container_tag']} " . $this->getAttributes( $this->aOptions['label_container_attributes'] ) . ">" |
|
39 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
40 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
41 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
42 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
43 | 43 | . $_sLabel |
44 | - . "</{$this->aOptions['label_container_tag']}>" |
|
44 | + . "</{$this->aOptions[ 'label_container_tag' ]}>" |
|
45 | 45 | ; |
46 | 46 | |
47 | 47 | } |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | public function getAttributesByKey( /* $sKey */ ) { |
59 | 59 | |
60 | 60 | // Parameters |
61 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
62 | - $_sKey = $_aParams[ 0 ]; |
|
61 | + $_aParams = func_get_args() + array( 0 => '',); |
|
62 | + $_sKey = $_aParams[ 0 ]; |
|
63 | 63 | |
64 | 64 | // Result |
65 | 65 | return $this->getElementAsArray( $this->aAttributes, $_sKey, array() ) |
66 | 66 | + array( |
67 | 67 | 'type' => 'radio', |
68 | - 'checked' => isset( $this->aAttributes['value'] ) && $this->aAttributes['value'] == $_sKey |
|
68 | + 'checked' => isset( $this->aAttributes[ 'value' ] ) && $this->aAttributes[ 'value' ] == $_sKey |
|
69 | 69 | ? 'checked' |
70 | 70 | : null, |
71 | 71 | 'value' => $_sKey, |
72 | 72 | // 'id' => $this->aField['input_id'] . '_' . $_sKey, |
73 | - 'id' => $this->getAttribute( 'id' ) . '_' . $_sKey, |
|
73 | + 'id' => $this->getAttribute( 'id' ).'_'.$_sKey, |
|
74 | 74 | // 'data-default' => $this->aField['default'], // refered by the repeater script |
75 | 75 | // 'data-id' => $this->aField['input_id'], // refered by the JavaScript scripts such as the revealer script. |
76 | - 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
76 | + 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
77 | 77 | ) |
78 | 78 | + $this->aAttributes; |
79 | 79 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @internal |
123 | 123 | * @param string $sInputID The input ID that will be the base of each generated option tag ID. |
124 | 124 | * @param array $aLabels The array holding labels. |
125 | - * @param array $aAttributes The attribute arrays. Accepts the following arguments. |
|
125 | + * @param array $aBaseAttributes The attribute arrays. Accepts the following arguments. |
|
126 | 126 | * - optgroup |
127 | 127 | * - option |
128 | 128 | */ |
@@ -160,6 +160,7 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * Returns an HTML output of optgroup tag. |
162 | 162 | * @since 3.5.3 |
163 | + * @param string $sInputID |
|
163 | 164 | * @return string an HTML output of optgroup tag. |
164 | 165 | */ |
165 | 166 | private function _getOptGroup( array $aBaseAttributes, $sInputID, $sKey, $asLabel ) { |
@@ -179,6 +180,7 @@ discard block |
||
179 | 180 | /** |
180 | 181 | * |
181 | 182 | * @since 3.5.3 |
183 | + * @param string $sInputID |
|
182 | 184 | */ |
183 | 185 | private function _getOptionTagAttributes( array $aBaseAttributes, $sInputID, $sKey, $aValues ) { |
184 | 186 |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | // For backward compatibility. |
45 | 45 | |
46 | 46 | // If the $aField property is set, extract certain elements from it and set them to the attribute array. |
47 | - if ( isset( $this->aField['is_multiple'] ) ) { |
|
48 | - $this->aAttributes['select']['multiple'] = $this->aField['is_multiple'] |
|
47 | + if ( isset( $this->aField[ 'is_multiple' ] ) ) { |
|
48 | + $this->aAttributes[ 'select' ][ 'multiple' ] = $this->aField[ 'is_multiple' ] |
|
49 | 49 | ? 'multiple' |
50 | 50 | : $this->getElement( $this->aAttributes, array( 'select', 'multiple' ) ); |
51 | 51 | } |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | return |
72 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
73 | - . "<select " . $this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) ) . " >" |
|
72 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
73 | + . "<select ".$this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) )." >" |
|
74 | 74 | . $this->_getDropDownList( |
75 | 75 | $this->getAttribute( 'id' ), |
76 | 76 | $this->getAsArray( |
77 | 77 | isset( $_aLabels ) |
78 | 78 | ? $_aLabels |
79 | - : $this->aField['label'], // backward compatibility |
|
79 | + : $this->aField[ 'label' ], // backward compatibility |
|
80 | 80 | true |
81 | 81 | ), |
82 | 82 | $_aAttributes |
83 | 83 | ) |
84 | 84 | . "</select>" |
85 | - . "</{$this->aOptions['input_container_tag']}>" |
|
85 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
86 | 86 | ; |
87 | 87 | |
88 | 88 | } |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | ? 'multiple' |
105 | 105 | : null, |
106 | 106 | 'name' => $_bIsMultiple |
107 | - ? $this->getAttribute( 'name' ) . '[]' |
|
107 | + ? $this->getAttribute( 'name' ).'[]' |
|
108 | 108 | : $this->getAttribute( 'name' ), |
109 | - 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
109 | + 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
110 | 110 | ) |
111 | 111 | ); |
112 | 112 | |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private function _getDropDownList( $sInputID, array $aLabels, array $aBaseAttributes ) { |
130 | 130 | |
131 | - $_aOutput = array(); |
|
132 | - foreach( $aLabels as $__sKey => $__asLabel ) { |
|
131 | + $_aOutput = array(); |
|
132 | + foreach ( $aLabels as $__sKey => $__asLabel ) { |
|
133 | 133 | |
134 | 134 | // For an optgroup tag, |
135 | 135 | if ( is_array( $__asLabel ) ) { |
136 | - $_aOutput[] = $this->_getOptGroup( |
|
136 | + $_aOutput[ ] = $this->_getOptGroup( |
|
137 | 137 | $aBaseAttributes, |
138 | 138 | $sInputID, |
139 | 139 | $__sKey, |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // A normal option tag, |
146 | - $_aOutput[] = $this->_getOptionTag( |
|
147 | - $__asLabel, // the text label the user sees to be selected |
|
146 | + $_aOutput[ ] = $this->_getOptionTag( |
|
147 | + $__asLabel, // the text label the user sees to be selected |
|
148 | 148 | $this->_getOptionTagAttributes( |
149 | 149 | $aBaseAttributes, |
150 | 150 | $sInputID, |
151 | 151 | $__sKey, |
152 | - $this->getAsArray( $aBaseAttributes['value'], true ) |
|
152 | + $this->getAsArray( $aBaseAttributes[ 'value' ], true ) |
|
153 | 153 | ) |
154 | 154 | ); |
155 | 155 | |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function _getOptGroup( array $aBaseAttributes, $sInputID, $sKey, $asLabel ) { |
166 | 166 | |
167 | - $_aOptGroupAttributes = isset( $aBaseAttributes['optgroup'][ $sKey ] ) && is_array( $aBaseAttributes['optgroup'][ $sKey ] ) |
|
168 | - ? $aBaseAttributes['optgroup'][ $sKey ] + $aBaseAttributes['optgroup'] |
|
169 | - : $aBaseAttributes['optgroup']; |
|
167 | + $_aOptGroupAttributes = isset( $aBaseAttributes[ 'optgroup' ][ $sKey ] ) && is_array( $aBaseAttributes[ 'optgroup' ][ $sKey ] ) |
|
168 | + ? $aBaseAttributes[ 'optgroup' ][ $sKey ] + $aBaseAttributes[ 'optgroup' ] |
|
169 | + : $aBaseAttributes[ 'optgroup' ]; |
|
170 | 170 | $_aOptGroupAttributes = array( |
171 | 171 | 'label' => $sKey, |
172 | 172 | ) + $_aOptGroupAttributes; |
173 | - return "<optgroup " . $this->getAttributes( $_aOptGroupAttributes ) . ">" |
|
173 | + return "<optgroup ".$this->getAttributes( $_aOptGroupAttributes ).">" |
|
174 | 174 | . $this->_getDropDownList( $sInputID, $asLabel, $aBaseAttributes ) |
175 | 175 | . "</optgroup>"; |
176 | 176 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | $aValues |
189 | 189 | ); |
190 | 190 | return array( |
191 | - 'id' => $sInputID . '_' . $sKey, |
|
191 | + 'id' => $sInputID.'_'.$sKey, |
|
192 | 192 | 'value' => $sKey, |
193 | 193 | 'selected' => in_array( ( string ) $sKey, $aValues ) |
194 | 194 | ? 'selected' |
195 | 195 | : null, |
196 | - ) + ( isset( $aBaseAttributes['option'][ $sKey ] ) && is_array( $aBaseAttributes['option'][ $sKey ] ) |
|
197 | - ? $aBaseAttributes['option'][ $sKey ] + $aBaseAttributes['option'] |
|
198 | - : $aBaseAttributes['option'] ); |
|
196 | + ) + ( isset( $aBaseAttributes[ 'option' ][ $sKey ] ) && is_array( $aBaseAttributes[ 'option' ][ $sKey ] ) |
|
197 | + ? $aBaseAttributes[ 'option' ][ $sKey ] + $aBaseAttributes[ 'option' ] |
|
198 | + : $aBaseAttributes[ 'option' ] ); |
|
199 | 199 | |
200 | 200 | } |
201 | 201 | |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @sicne 3.4.0 |
205 | 205 | * @return string The generated option tag HTML output. |
206 | 206 | */ |
207 | - private function _getOptionTag( $sLabel, array $aOptionTagAttributes=array() ) { |
|
208 | - return "<option " . $this->getAttributes( $aOptionTagAttributes ) . " >" |
|
207 | + private function _getOptionTag( $sLabel, array $aOptionTagAttributes = array() ) { |
|
208 | + return "<option ".$this->getAttributes( $aOptionTagAttributes )." >" |
|
209 | 209 | . $sLabel |
210 | 210 | . "</option>"; |
211 | 211 | } |
@@ -170,6 +170,7 @@ |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * The recursive version of the glob() function. |
173 | + * @param string $sPathPatten |
|
173 | 174 | */ |
174 | 175 | protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
175 | 176 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'is_recursive' => true, |
38 | 38 | 'exclude_dir_paths' => array(), |
39 | 39 | 'exclude_dir_names' => array( 'asset', 'assets', 'css', 'js', 'image', 'images', 'license', 'document', 'documents' ), |
40 | - 'allowed_extensions' => array( 'php', ), // 'inc' |
|
40 | + 'allowed_extensions' => array( 'php',), // 'inc' |
|
41 | 41 | 'include_function' => 'include', |
42 | 42 | 'exclude_class_names' => array( /* 'SomeClass', 'SomeOtherClass' */ ), |
43 | 43 | ); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * </code> |
66 | 66 | * @remark The directory paths set for the 'exclude_dir_paths' option should use the system directory separator. |
67 | 67 | */ |
68 | - function __construct( $asScanDirPaths, array $aOptions=array(), array $aClasses=array() ) { |
|
68 | + function __construct( $asScanDirPaths, array $aOptions = array(), array $aClasses = array() ) { |
|
69 | 69 | |
70 | 70 | $_aOptions = $aOptions + self::$_aStructure_Options; |
71 | 71 | $this->_aClasses = $aClasses + $this->_constructClassArray( $asScanDirPaths, $_aOptions ); |
72 | - $_sIncludeFunciton = in_array( $_aOptions['include_function'], array( 'require', 'require_once', 'include', 'include_once' ) ) |
|
73 | - ? $_aOptions['include_function'] |
|
74 | - : 'include'; // default |
|
72 | + $_sIncludeFunciton = in_array( $_aOptions[ 'include_function' ], array( 'require', 'require_once', 'include', 'include_once' ) ) |
|
73 | + ? $_aOptions[ 'include_function' ] |
|
74 | + : 'include'; // default |
|
75 | 75 | $this->_registerClasses( $_sIncludeFunciton ); |
76 | 76 | |
77 | 77 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | return array(); |
96 | 96 | } |
97 | 97 | $_aFilePaths = array(); |
98 | - foreach( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
98 | + foreach ( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
99 | 99 | if ( realpath( $_sClassDirPath ) ) { |
100 | 100 | $_aFilePaths = array_merge( $this->getFilePaths( $_sClassDirPath, $aSearchOptions ), $_aFilePaths ); |
101 | 101 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | // Store classes in an array. |
105 | 105 | $_aClasses = array(); |
106 | - foreach( $_aFilePaths as $_sFilePath ) { |
|
106 | + foreach ( $_aFilePaths as $_sFilePath ) { |
|
107 | 107 | |
108 | 108 | // Class name without a file extension. |
109 | 109 | $_sClassNameWOExt = pathinfo( $_sFilePath, PATHINFO_FILENAME ); |
110 | - if ( in_array( $_sClassNameWOExt, $aSearchOptions['exclude_class_names'] ) ) { |
|
110 | + if ( in_array( $_sClassNameWOExt, $aSearchOptions[ 'exclude_class_names' ] ) ) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | $_aClasses[ $_sClassNameWOExt ] = $_sFilePath; |
@@ -131,26 +131,26 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function getFilePaths( $sClassDirPath, array $aSearchOptions ) { |
133 | 133 | |
134 | - $sClassDirPath = rtrim( $sClassDirPath, '\\/' ) . DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
135 | - $_aAllowedExtensions = $aSearchOptions['allowed_extensions']; |
|
136 | - $_aExcludeDirPaths = ( array ) $aSearchOptions['exclude_dir_paths']; |
|
137 | - $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
|
134 | + $sClassDirPath = rtrim( $sClassDirPath, '\\/' ).DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
135 | + $_aAllowedExtensions = $aSearchOptions[ 'allowed_extensions' ]; |
|
136 | + $_aExcludeDirPaths = ( array ) $aSearchOptions[ 'exclude_dir_paths' ]; |
|
137 | + $_aExcludeDirNames = ( array ) $aSearchOptions[ 'exclude_dir_names' ]; |
|
138 | 138 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
139 | 139 | |
140 | 140 | if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
141 | 141 | $_aFilePaths = $_bIsRecursive |
142 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
143 | - : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
142 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
143 | + : ( array ) glob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
144 | 144 | return array_filter( $_aFilePaths ); // drop non-value elements. |
145 | 145 | } |
146 | 146 | |
147 | 147 | // For the Solaris operation system. |
148 | 148 | $_aFilePaths = array(); |
149 | - foreach( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
149 | + foreach ( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
150 | 150 | |
151 | 151 | $__aFilePaths = $_bIsRecursive |
152 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
153 | - : ( array ) glob( $sClassDirPath . '*.' . $__sAllowedExtension ); |
|
152 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
153 | + : ( array ) glob( $sClassDirPath.'*.'.$__sAllowedExtension ); |
|
154 | 154 | |
155 | 155 | $_aFilePaths = array_merge( $__aFilePaths, $_aFilePaths ); |
156 | 156 | |
@@ -162,27 +162,27 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * Constructs the file pattern of the file extension part used for the glob() function with the given file extensions. |
164 | 164 | */ |
165 | - protected function _getGlobPatternExtensionPart( array $aExtensions=array( 'php', 'inc' ) ) { |
|
165 | + protected function _getGlobPatternExtensionPart( array $aExtensions = array( 'php', 'inc' ) ) { |
|
166 | 166 | return empty( $aExtensions ) |
167 | 167 | ? '*' |
168 | - : '{' . implode( ',', $aExtensions ) . '}'; |
|
168 | + : '{'.implode( ',', $aExtensions ).'}'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | 172 | * The recursive version of the glob() function. |
173 | 173 | */ |
174 | - protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
|
174 | + protected function doRecursiveGlob( $sPathPatten, $nFlags = 0, array $aExcludeDirs = array(), array $aExcludeDirNames = array() ) { |
|
175 | 175 | |
176 | 176 | $_aFiles = glob( $sPathPatten, $nFlags ); |
177 | 177 | $_aFiles = is_array( $_aFiles ) ? $_aFiles : array(); // glob() can return false. |
178 | - $_aDirs = glob( dirname( $sPathPatten ) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR|GLOB_NOSORT ); |
|
178 | + $_aDirs = glob( dirname( $sPathPatten ).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR | GLOB_NOSORT ); |
|
179 | 179 | $_aDirs = is_array( $_aDirs ) ? $_aDirs : array(); |
180 | 180 | foreach ( $_aDirs as $_sDirPath ) { |
181 | 181 | |
182 | 182 | if ( in_array( $_sDirPath, $aExcludeDirs ) ) { continue; } |
183 | 183 | if ( in_array( pathinfo( $_sDirPath, PATHINFO_DIRNAME ), $aExcludeDirNames ) ) { continue; } |
184 | 184 | |
185 | - $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath . DIRECTORY_SEPARATOR . basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
185 | + $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath.DIRECTORY_SEPARATOR.basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | return $_aFiles; |
@@ -196,25 +196,25 @@ discard block |
||
196 | 196 | * |
197 | 197 | */ |
198 | 198 | protected function _registerClasses( $sIncludeFunction ) { |
199 | - spl_autoload_register( array( $this, '_replyToAutoLoad_' . $sIncludeFunction ) ); |
|
199 | + spl_autoload_register( array( $this, '_replyToAutoLoad_'.$sIncludeFunction ) ); |
|
200 | 200 | } |
201 | 201 | /** |
202 | 202 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
203 | 203 | */ |
204 | 204 | public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
205 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
205 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
206 | 206 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
207 | 207 | } |
208 | 208 | public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
209 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
209 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
210 | 210 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
211 | 211 | } |
212 | 212 | public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
213 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
213 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
214 | 214 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
215 | 215 | } |
216 | 216 | public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
217 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
217 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
218 | 218 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
219 | 219 | } |
220 | 220 |
@@ -137,7 +137,8 @@ discard block |
||
137 | 137 | $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
138 | 138 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
139 | 139 | |
140 | - if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
|
140 | + if ( defined( 'GLOB_BRACE' ) ) { |
|
141 | +// in some OSes this flag constant is not available. |
|
141 | 142 | $_aFilePaths = $_bIsRecursive |
142 | 143 | ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
143 | 144 | : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
@@ -201,19 +202,19 @@ discard block |
||
201 | 202 | /** |
202 | 203 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
203 | 204 | */ |
204 | - public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
205 | + public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
205 | 206 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
206 | 207 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
207 | 208 | } |
208 | - public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
209 | + public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
209 | 210 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
210 | 211 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
211 | 212 | } |
212 | - public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
213 | + public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
213 | 214 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
214 | 215 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
215 | 216 | } |
216 | - public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
217 | + public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
217 | 218 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
218 | 219 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
219 | 220 | } |