@@ -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 |
@@ -69,6 +69,8 @@ |
||
69 | 69 | * @since 3.4.0 Moved from `AdminPageFramework_FormPart_Table`. |
70 | 70 | * @since 3.6.0 Added the `$iSectionIndex` and `$aFieldTypeDefinitions` parameters. |
71 | 71 | * @since 3.6.0 Moved from `AdminPageFramework_FormTable_Base`. Changed the name from `_getSectionTitle()`. |
72 | + * @param string $sTitle |
|
73 | + * @param string $sTag |
|
72 | 74 | * @return string The section title output. |
73 | 75 | */ |
74 | 76 | protected function _getSectionTitle( $sTitle, $sTag, $aFields, $hfFieldCallback, $iSectionIndex=null, $aFieldTypeDefinitions=array() ) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @since 3.6.0 Moved from `AdminPageFramework_FormTable_Base`. Changed the name from `_getSectionTitle()`. |
72 | 72 | * @return string The section title output. |
73 | 73 | */ |
74 | - protected function _getSectionTitle( $sTitle, $sTag, $aFields, $hfFieldCallback, $iSectionIndex=null, $aFieldTypeDefinitions=array() ) { |
|
74 | + protected function _getSectionTitle( $sTitle, $sTag, $aFields, $hfFieldCallback, $iSectionIndex = null, $aFieldTypeDefinitions = array() ) { |
|
75 | 75 | |
76 | 76 | $_aSectionTitleField = $this->_getSectionTitleField( $aFields, $iSectionIndex, $aFieldTypeDefinitions ); |
77 | 77 | return $_aSectionTitleField |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @since 3.6.0 Added the `$iSectionIndex` parameter. Added the `$aFieldTypeDefinitions` parameter. |
90 | 90 | */ |
91 | 91 | private function _getSectionTitleField( array $aFieldsets, $iSectionIndex, $aFieldTypeDefinitions ) { |
92 | - foreach( $aFieldsets as $_aFieldset ) { |
|
92 | + foreach ( $aFieldsets as $_aFieldset ) { |
|
93 | 93 | // Return the first found one. |
94 | 94 | if ( 'section_title' === $_aFieldset[ 'type' ] ) { |
95 | 95 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @since 3.6.0 |
16 | 16 | * @internal |
17 | 17 | */ |
18 | -class AdminPageFramework_FormPart_SectionTitle extends AdminPageFramework_FormPart_Base { |
|
18 | +class AdminPageFramework_FormPart_SectionTitle extends AdminPageFramework_FormPart_Base { |
|
19 | 19 | |
20 | 20 | public $sTitle = ''; |
21 | 21 | public $sTag = ''; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @since 3.4.0 Moved from `AdminPageFramework_FormPart_Table`. |
89 | 89 | * @since 3.6.0 Added the `$iSectionIndex` parameter. Added the `$aFieldTypeDefinitions` parameter. |
90 | 90 | */ |
91 | - private function _getSectionTitleField( array $aFieldsets, $iSectionIndex, $aFieldTypeDefinitions ) { |
|
91 | + private function _getSectionTitleField( array $aFieldsets, $iSectionIndex, $aFieldTypeDefinitions ) { |
|
92 | 92 | foreach( $aFieldsets as $_aFieldset ) { |
93 | 93 | // Return the first found one. |
94 | 94 | if ( 'section_title' === $_aFieldset[ 'type' ] ) { |
@@ -323,6 +323,9 @@ discard block |
||
323 | 323 | * Returns an updated sections table output array. |
324 | 324 | * @since 3.5.3 |
325 | 325 | * @since 3.6.0 Removed the `$_sSectionID` parameter. |
326 | + * @param string $_sSectionsID |
|
327 | + * @param callable $hfSectionCallback |
|
328 | + * @param callable $hfFieldCallback |
|
326 | 329 | * @return array The updated sections table output array. |
327 | 330 | */ |
328 | 331 | private function _getSectionsTable( $_aOutputs, $_sSectionsID, array $_aSection, array $aFieldsInSections, $hfSectionCallback, $hfFieldCallback ) { |
@@ -513,6 +516,7 @@ discard block |
||
513 | 516 | * @internal |
514 | 517 | * @since 3.5.3 |
515 | 518 | * @since 3.6.0 Removed the `$sSectionID` parameter. Added the `$aSectionset` parameter. |
519 | + * @param string $sSectionsID |
|
516 | 520 | * @return string The formatted sections table HTML output. |
517 | 521 | */ |
518 | 522 | private function _getFormattedSectionsTablesOutput( array $aOutputs, $aSectionset, $sSectionsID, array $aCollapsible, $sSectionTabSlug ) { |
@@ -611,9 +615,8 @@ discard block |
||
611 | 615 | * @since 3.3.1 Now the first parameter is for the section ID not the tag ID. |
612 | 616 | * @since 3.4.0 Changed the name from `getFormTable()`. |
613 | 617 | * @since 3.6.0 Removed the `$sSectionID` and `$iSectionIndex` parameters. |
614 | - * @param integer $iSectionIndex The section index. Zero based. |
|
615 | 618 | * @param array $aSection The section definition array, |
616 | - * @param array $sFields The array holding field definition arrays. |
|
619 | + * @param array $aFields The array holding field definition arrays. |
|
617 | 620 | * @param callable $hfSectionCallback The callback for the section header output. |
618 | 621 | * @param callable $hfFieldCallback The callback for the field output. |
619 | 622 | * @return string |
@@ -670,6 +673,7 @@ discard block |
||
670 | 673 | * @since 3.0.0 |
671 | 674 | * @since 3.6.0 Added the `$iSectionIndex` parameter. Changed the name from `getFIeldRows`. |
672 | 675 | * @since 3.6.0 Moved from `AdminPageFramework_FormTable_Row`. |
676 | + * @param callable $hfCallback |
|
673 | 677 | * @return string |
674 | 678 | */ |
675 | 679 | public function getFieldsetRows( array $aFieldsets, $hfCallback, $iSectionIndex=null ) { |
@@ -531,7 +531,7 @@ |
||
531 | 531 | * @return string The generated section tab list as HTML. |
532 | 532 | */ |
533 | 533 | private function _getSectionTabList( $sSectionTabSlug, array $aSectionTabList ) { |
534 | - return $sSectionTabSlug |
|
534 | + return $sSectionTabSlug |
|
535 | 535 | ? "<ul class='admin-page-framework-section-tabs nav-tab-wrapper'>" |
536 | 536 | . implode( PHP_EOL, $aSectionTabList ) |
537 | 537 | . "</ul>" |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @since 3.0.0 |
25 | 25 | * @since 3.0.4 The `$aFieldErrors` parameter was added. |
26 | 26 | */ |
27 | - public function __construct( $aFieldTypeDefinitions, array $aFieldErrors, $oMsg=null ) { |
|
27 | + public function __construct( $aFieldTypeDefinitions, array $aFieldErrors, $oMsg = null ) { |
|
28 | 28 | |
29 | 29 | $this->aFieldTypeDefinitions = $aFieldTypeDefinitions; // used to merge the field definition array with the default field type definition. |
30 | 30 | $this->aFieldErrors = $aFieldErrors; |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | // Update the array structure by tab slug (passed by reference). |
101 | 101 | $this->_divideElementsBySectionTabs( $aSections, $aFieldsInSections ); |
102 | 102 | |
103 | - $_aOutput = array(); |
|
104 | - foreach( $aSections as $_sSectionTabSlug => $_aSectionsBySectionTab ) { |
|
105 | - $_aOutput[] = $this->_getFormTable( |
|
103 | + $_aOutput = array(); |
|
104 | + foreach ( $aSections as $_sSectionTabSlug => $_aSectionsBySectionTab ) { |
|
105 | + $_aOutput[ ] = $this->_getFormTable( |
|
106 | 106 | $aFieldsInSections, |
107 | 107 | $_sSectionTabSlug, |
108 | 108 | $_aSectionsBySectionTab, |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @return string |
127 | 127 | * @remark The first iteration item of the given array will be returned, |
128 | 128 | */ |
129 | - private function _getSectionsFieldsType( array $aSections=array() ) { |
|
130 | - foreach( $aSections as $_aSection ) { |
|
129 | + private function _getSectionsFieldsType( array $aSections = array() ) { |
|
130 | + foreach ( $aSections as $_aSection ) { |
|
131 | 131 | return $_aSection[ '_fields_type' ]; |
132 | 132 | } |
133 | 133 | } |
@@ -139,18 +139,18 @@ discard block |
||
139 | 139 | private function _getFormTable( array $aFieldsInSections, $sSectionTabSlug, array $aSectionsBySectionTab, $hfSectionCallback, $hfFieldCallback ) { |
140 | 140 | |
141 | 141 | $_sSectionSet = $this->_getSectionsTables( |
142 | - $aSectionsBySectionTab, // sectionset definition |
|
142 | + $aSectionsBySectionTab, // sectionset definition |
|
143 | 143 | $aFieldsInSections[ $sSectionTabSlug ], // fieldset definitions |
144 | 144 | $hfSectionCallback, |
145 | 145 | $hfFieldCallback |
146 | 146 | ); |
147 | 147 | return $_sSectionSet |
148 | - ? "<div " . $this->getAttributes( |
|
148 | + ? "<div ".$this->getAttributes( |
|
149 | 149 | array( |
150 | 150 | 'class' => 'admin-page-framework-sectionset', |
151 | - 'id' => "sectionset-{$sSectionTabSlug}_" . md5( serialize( $aSectionsBySectionTab ) ), |
|
151 | + 'id' => "sectionset-{$sSectionTabSlug}_".md5( serialize( $aSectionsBySectionTab ) ), |
|
152 | 152 | ) |
153 | - ) . ">" |
|
153 | + ).">" |
|
154 | 154 | . $_sSectionSet |
155 | 155 | . "</div>" |
156 | 156 | : ''; |
@@ -192,18 +192,18 @@ discard block |
||
192 | 192 | $_aFieldsBySectionTab = array(); |
193 | 193 | $_iIndex = 0; |
194 | 194 | |
195 | - foreach( $aSections as $_sSectionID => $_aSection ) { |
|
195 | + foreach ( $aSections as $_sSectionID => $_aSection ) { |
|
196 | 196 | |
197 | 197 | // If no fields for the section, no need to add the section |
198 | 198 | // unless the cusedom sectionset output is defined. |
199 | - if ( ! isset( $aFields[ $_sSectionID ] ) && ! $this->_isCustomContentSet( $_aSection ) ) { |
|
199 | + if ( !isset( $aFields[ $_sSectionID ] ) && !$this->_isCustomContentSet( $_aSection ) ) { |
|
200 | 200 | continue; |
201 | 201 | } |
202 | 202 | |
203 | 203 | $_sSectionTaqbSlug = $this->getAOrB( |
204 | 204 | $_aSection[ 'section_tab_slug' ], |
205 | 205 | $_aSection[ 'section_tab_slug' ], |
206 | - '_default_' . ( ++$_iIndex ) |
|
206 | + '_default_'.( ++$_iIndex ) |
|
207 | 207 | ); |
208 | 208 | $_aSectionsBySectionTab[ $_sSectionTaqbSlug ][ $_sSectionID ] = $_aSection; |
209 | 209 | $_aFieldsBySectionTab[ $_sSectionTaqbSlug ][ $_sSectionID ] = $this->getElement( |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | * @since 3.6.1 |
223 | 223 | * @return boolean True if a custom content value is set. |
224 | 224 | */ |
225 | - private function _isCustomContentSet( array $aSection, array $aKeys=array( 'content' ) ) { |
|
226 | - foreach( $aKeys as $_sKey ) { |
|
227 | - if ( ! isset( $aSection[ $_sKey ] ) ) { |
|
225 | + private function _isCustomContentSet( array $aSection, array $aKeys = array( 'content' ) ) { |
|
226 | + foreach ( $aKeys as $_sKey ) { |
|
227 | + if ( !isset( $aSection[ $_sKey ] ) ) { |
|
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | if ( is_scalar( $aSection[ $_sKey ] ) ) { |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | return ''; |
254 | 254 | } |
255 | 255 | |
256 | - $_aFirstSectionset = $this->getFirstElement( $aSections ); |
|
256 | + $_aFirstSectionset = $this->getFirstElement( $aSections ); |
|
257 | 257 | |
258 | - if ( ! count( $aFieldsInSections ) ) { |
|
258 | + if ( !count( $aFieldsInSections ) ) { |
|
259 | 259 | return ''; |
260 | 260 | } |
261 | 261 | |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | ); |
268 | 268 | |
269 | 269 | $_sThisSectionID = $_aFirstSectionset[ 'section_id' ]; |
270 | - $_sSectionsID = 'sections-' . $_sThisSectionID; |
|
270 | + $_sSectionsID = 'sections-'.$_sThisSectionID; |
|
271 | 271 | |
272 | 272 | $_aCollapsible = $this->_getCollapsibleArgumentForSections( $_aFirstSectionset ); |
273 | 273 | |
274 | - foreach( $aSections as $_aSection ) { |
|
274 | + foreach ( $aSections as $_aSection ) { |
|
275 | 275 | |
276 | 276 | // Need to be referred outside the loop. |
277 | 277 | $_sSectionID = $_aSection[ 'section_id' ]; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @since 3.6.0 Changed the first parameter to `$aSection` from `$aSections`. |
307 | 307 | * @return array |
308 | 308 | */ |
309 | - protected function _getCollapsibleArgumentForSections( array $aSection=array() ) { |
|
309 | + protected function _getCollapsibleArgumentForSections( array $aSection = array() ) { |
|
310 | 310 | // $_aCollapsible = $this->_getCollapsibleArgument( $aSections ); |
311 | 311 | $_oArgumentFormater = new AdminPageFramework_Format_CollapsibleSection( |
312 | 312 | $aSection[ 'collapsible' ], |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $aSection |
315 | 315 | ); |
316 | 316 | $_aCollapsible = $this->getAsArray( $_oArgumentFormater->get() ); |
317 | - return isset( $_aCollapsible['container'] ) && 'sections' === $_aCollapsible['container'] |
|
317 | + return isset( $_aCollapsible[ 'container' ] ) && 'sections' === $_aCollapsible[ 'container' ] |
|
318 | 318 | ? $_aCollapsible |
319 | 319 | : array(); |
320 | 320 | } |
@@ -325,47 +325,47 @@ discard block |
||
325 | 325 | * @since 3.6.0 Removed the `$_sSectionID` parameter. |
326 | 326 | * @return array The updated sections table output array. |
327 | 327 | */ |
328 | - private function _getSectionsTable( $_aOutputs, $_sSectionsID, array $_aSection, array $aFieldsInSections, $hfSectionCallback, $hfFieldCallback ) { |
|
328 | + private function _getSectionsTable( $_aOutputs, $_sSectionsID, array $_aSection, array $aFieldsInSections, $hfSectionCallback, $hfFieldCallback ) { |
|
329 | 329 | |
330 | 330 | // For repeatable sections - note that sub-sections are divided field definition arrays by sub-section index, not section definition arrays. |
331 | - $_aSubSections = $this->getIntegerKeyElements( |
|
331 | + $_aSubSections = $this->getIntegerKeyElements( |
|
332 | 332 | $this->getElementAsArray( |
333 | 333 | $aFieldsInSections, // subject |
334 | - $_aSection[ 'section_id' ], // dimensional key |
|
334 | + $_aSection[ 'section_id' ], // dimensional key |
|
335 | 335 | array() // default |
336 | 336 | ) |
337 | 337 | ); |
338 | 338 | |
339 | 339 | // If the 'save' argument is false, insert a flag that disables saving the section inputs. |
340 | - $_aOutputs[ 'section_contents' ][] = $this->_getUnsetFlagSectionInputTag( $_aSection ); |
|
340 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getUnsetFlagSectionInputTag( $_aSection ); |
|
341 | 341 | |
342 | 342 | // Check sub-sections. |
343 | 343 | $_aOutputs[ 'count_subsections' ] = count( $_aSubSections ); |
344 | 344 | if ( $_aOutputs[ 'count_subsections' ] ) { |
345 | 345 | |
346 | 346 | // Add the repeatable sections enabler script. |
347 | - if ( ! empty( $_aSection[ 'repeatable' ] ) ) { |
|
348 | - $_aOutputs[ 'section_contents' ][] = AdminPageFramework_Script_RepeatableSection::getEnabler( |
|
347 | + if ( !empty( $_aSection[ 'repeatable' ] ) ) { |
|
348 | + $_aOutputs[ 'section_contents' ][ ] = AdminPageFramework_Script_RepeatableSection::getEnabler( |
|
349 | 349 | $_sSectionsID, |
350 | 350 | $_aOutputs[ 'count_subsections' ], |
351 | 351 | $_aSection[ 'repeatable' ], |
352 | 352 | $this->oMsg |
353 | 353 | ); |
354 | - $_aOutputs[ 'section_contents' ][] = $this->_getRepeatableSectionFlagTag( $_aSection ); |
|
354 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getRepeatableSectionFlagTag( $_aSection ); |
|
355 | 355 | } |
356 | 356 | // Add the sortable sections enabler script. 3.6.0+ |
357 | - if ( ! empty( $_aSection[ 'sortable' ] ) ) { |
|
358 | - $_aOutputs[ 'section_contents' ][] = AdminPageFramework_Script_SortableSection::getEnabler( |
|
357 | + if ( !empty( $_aSection[ 'sortable' ] ) ) { |
|
358 | + $_aOutputs[ 'section_contents' ][ ] = AdminPageFramework_Script_SortableSection::getEnabler( |
|
359 | 359 | $_sSectionsID, |
360 | 360 | $_aSection[ 'sortable' ], |
361 | 361 | $this->oMsg |
362 | 362 | ); |
363 | - $_aOutputs[ 'section_contents' ][] = $this->_getSortableSectionFlagTag( $_aSection ); |
|
363 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getSortableSectionFlagTag( $_aSection ); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // Get the section tables. |
367 | 367 | $_aSubSections = $this->numerizeElements( $_aSubSections ); // will include the main section as well. |
368 | - foreach( $_aSubSections as $_iIndex => $_aFields ) { |
|
368 | + foreach ( $_aSubSections as $_iIndex => $_aFields ) { |
|
369 | 369 | |
370 | 370 | $_oEachSectionArguments = new AdminPageFramework_Format_EachSection( |
371 | 371 | $_aSection, |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | array( |
434 | 434 | 'class' => 'element-address', |
435 | 435 | 'type' => 'hidden', |
436 | - 'name' => '__repeatable_elements_' . $aSection[ '_fields_type' ] |
|
437 | - . '[' . $aSection[ 'section_id' ] . ']', |
|
436 | + 'name' => '__repeatable_elements_'.$aSection[ '_fields_type' ] |
|
437 | + . '['.$aSection[ 'section_id' ].']', |
|
438 | 438 | // @todo examine whether this value should include a section index. |
439 | 439 | 'value' => $aSection[ 'section_id' ], |
440 | 440 | ) |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | array( |
452 | 452 | 'class' => 'element-address', |
453 | 453 | 'type' => 'hidden', |
454 | - 'name' => '__sortable_elements_' . $aSection[ '_fields_type' ] |
|
455 | - . '[' . $aSection[ 'section_id' ] . ']', |
|
454 | + 'name' => '__sortable_elements_'.$aSection[ '_fields_type' ] |
|
455 | + . '['.$aSection[ 'section_id' ].']', |
|
456 | 456 | // @todo examine whether this value should include a section index. |
457 | 457 | 'value' => $aSection[ 'section_id' ], |
458 | 458 | ) |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | 'input', |
474 | 474 | array( |
475 | 475 | 'type' => 'hidden', |
476 | - 'name' => '__unset_' . $aSection[ '_fields_type' ] . '[' . $aSection[ 'section_id' ] . ']', |
|
477 | - 'value' => "__dummy_option_key|" . $aSection[ 'section_id' ], |
|
476 | + 'name' => '__unset_'.$aSection[ '_fields_type' ].'['.$aSection[ 'section_id' ].']', |
|
477 | + 'value' => "__dummy_option_key|".$aSection[ 'section_id' ], |
|
478 | 478 | 'class' => 'unset-element-names element-address', |
479 | 479 | ) |
480 | 480 | ); |
@@ -489,14 +489,14 @@ discard block |
||
489 | 489 | private function _getSectionTableWithTabList( array $_aOutputs, array $_aSection, $_aFields, $hfSectionCallback, $hfFieldCallback ) { |
490 | 490 | |
491 | 491 | // Tab list |
492 | - $_aOutputs[ 'section_tab_list' ][] = $this->_getTabList( |
|
492 | + $_aOutputs[ 'section_tab_list' ][ ] = $this->_getTabList( |
|
493 | 493 | $_aSection, |
494 | 494 | $_aFields, |
495 | 495 | $hfFieldCallback |
496 | 496 | ); |
497 | 497 | |
498 | 498 | // Section container |
499 | - $_aOutputs[ 'section_contents' ][] = $this->_getSectionTable( |
|
499 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getSectionTable( |
|
500 | 500 | $_aSection, |
501 | 501 | $_aFields, |
502 | 502 | $hfSectionCallback, |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | ? $aCollapsible[ 'title' ] |
527 | 527 | : '', |
528 | 528 | 'h3', |
529 | - array(), // fields |
|
530 | - null, // field callback |
|
531 | - null, // section index |
|
529 | + array(), // fields |
|
530 | + null, // field callback |
|
531 | + null, // section index |
|
532 | 532 | $this->aFieldTypeDefinitions, |
533 | 533 | $aCollapsible, |
534 | 534 | 'sections', |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $aOutputs[ 'count_subsections' ] |
544 | 544 | ); |
545 | 545 | return $_oCollapsibleSectionTitle->get() |
546 | - . "<div " . $_oSectionsTablesContainerAttributes->get() . ">" |
|
546 | + . "<div ".$_oSectionsTablesContainerAttributes->get().">" |
|
547 | 547 | . $this->_getSectionTabList( $sSectionTabSlug, $aOutputs[ 'section_tab_list' ] ) |
548 | 548 | . implode( PHP_EOL, $aOutputs[ 'section_contents' ] ) |
549 | 549 | . "</div>"; |
@@ -571,21 +571,21 @@ discard block |
||
571 | 571 | */ |
572 | 572 | private function _getTabList( array $aSection, array $aFields, $hfFieldCallback ) { |
573 | 573 | |
574 | - if ( ! $aSection['section_tab_slug'] ) { |
|
574 | + if ( !$aSection[ 'section_tab_slug' ] ) { |
|
575 | 575 | return ''; |
576 | 576 | } |
577 | 577 | |
578 | 578 | $iSectionIndex = $aSection[ '_index' ]; |
579 | 579 | |
580 | - $_sSectionTagID = 'section-' . $aSection[ 'section_id' ] . '__' . $iSectionIndex; |
|
581 | - $_aTabAttributes = $aSection['attributes']['tab'] |
|
580 | + $_sSectionTagID = 'section-'.$aSection[ 'section_id' ].'__'.$iSectionIndex; |
|
581 | + $_aTabAttributes = $aSection[ 'attributes' ][ 'tab' ] |
|
582 | 582 | + array( |
583 | 583 | 'class' => 'admin-page-framework-section-tab nav-tab', |
584 | 584 | 'id' => "section_tab-{$_sSectionTagID}", |
585 | 585 | 'style' => null |
586 | 586 | ); |
587 | - $_aTabAttributes['class'] = $this->getClassAttribute( $_aTabAttributes['class'], $aSection['class']['tab'] ); // 3.3.1+ |
|
588 | - $_aTabAttributes['style'] = $this->getStyleAttribute( $_aTabAttributes['style'], $aSection['hidden'] ? 'display:none' : null ); // 3.3.1+ |
|
587 | + $_aTabAttributes[ 'class' ] = $this->getClassAttribute( $_aTabAttributes[ 'class' ], $aSection[ 'class' ][ 'tab' ] ); // 3.3.1+ |
|
588 | + $_aTabAttributes[ 'style' ] = $this->getStyleAttribute( $_aTabAttributes[ 'style' ], $aSection[ 'hidden' ] ? 'display:none' : null ); // 3.3.1+ |
|
589 | 589 | |
590 | 590 | $_oSectionTitle = new AdminPageFramework_FormPart_SectionTitle( |
591 | 591 | $aSection[ 'title' ], |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $this->aFieldTypeDefinitions |
597 | 597 | ); |
598 | 598 | |
599 | - return "<li " . $this->getAttributes( $_aTabAttributes ) . ">" |
|
599 | + return "<li ".$this->getAttributes( $_aTabAttributes ).">" |
|
600 | 600 | . "<a href='#{$_sSectionTagID}'>" |
601 | 601 | . $_oSectionTitle->get() |
602 | 602 | ."</a>" |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | $_oSectionTableBodyAttributes = new AdminPageFramework_Attribute_SectionTableBody( $aSection ); |
643 | 643 | |
644 | 644 | $_aOutput = array(); |
645 | - $_aOutput[] = "<table " . $_oSectionTableAttributes->get() . ">" |
|
645 | + $_aOutput[ ] = "<table ".$_oSectionTableAttributes->get().">" |
|
646 | 646 | . $_oTableCaption->get() |
647 | - . "<tbody " . $_oSectionTableBodyAttributes->get() . ">" |
|
647 | + . "<tbody ".$_oSectionTableBodyAttributes->get().">" |
|
648 | 648 | . ( |
649 | 649 | $aSection[ 'content' ] |
650 | 650 | ? "<tr>" |
@@ -657,8 +657,8 @@ discard block |
||
657 | 657 | . "</tbody>" |
658 | 658 | . "</table>"; |
659 | 659 | |
660 | - $_oSectionTableContainerAttributes = new AdminPageFramework_Attribute_SectionTableContainer( $aSection ); |
|
661 | - return "<div " . $_oSectionTableContainerAttributes->get() . ">" |
|
660 | + $_oSectionTableContainerAttributes = new AdminPageFramework_Attribute_SectionTableContainer( $aSection ); |
|
661 | + return "<div ".$_oSectionTableContainerAttributes->get().">" |
|
662 | 662 | . implode( PHP_EOL, $_aOutput ) |
663 | 663 | . "</div>"; |
664 | 664 | |
@@ -672,14 +672,14 @@ discard block |
||
672 | 672 | * @since 3.6.0 Moved from `AdminPageFramework_FormTable_Row`. |
673 | 673 | * @return string |
674 | 674 | */ |
675 | - public function getFieldsetRows( array $aFieldsets, $hfCallback, $iSectionIndex=null ) { |
|
675 | + public function getFieldsetRows( array $aFieldsets, $hfCallback, $iSectionIndex = null ) { |
|
676 | 676 | |
677 | - if ( ! is_callable( $hfCallback ) ) { |
|
677 | + if ( !is_callable( $hfCallback ) ) { |
|
678 | 678 | return ''; |
679 | 679 | } |
680 | 680 | |
681 | 681 | $_aOutput = array(); |
682 | - foreach( $aFieldsets as $_aFieldset ) { |
|
682 | + foreach ( $aFieldsets as $_aFieldset ) { |
|
683 | 683 | |
684 | 684 | $_oFieldsetOutputFormatter = new AdminPageFramework_Format_FieldsetOutput( |
685 | 685 | $_aFieldset, |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | $_oFieldsetOutputFormatter->get(), |
691 | 691 | $hfCallback |
692 | 692 | ); |
693 | - $_aOutput[] = $_oFieldsetRow->get(); |
|
693 | + $_aOutput[ ] = $_oFieldsetRow->get(); |
|
694 | 694 | |
695 | 695 | } |
696 | 696 | return implode( PHP_EOL, $_aOutput ); |
@@ -708,12 +708,12 @@ discard block |
||
708 | 708 | */ |
709 | 709 | public function getFieldsets( array $aFieldsets, $hfCallback ) { |
710 | 710 | |
711 | - if ( ! is_callable( $hfCallback ) ) { |
|
711 | + if ( !is_callable( $hfCallback ) ) { |
|
712 | 712 | return ''; |
713 | 713 | } |
714 | 714 | |
715 | 715 | $_aOutput = array(); |
716 | - foreach( $aFieldsets as $_aFieldset ) { |
|
716 | + foreach ( $aFieldsets as $_aFieldset ) { |
|
717 | 717 | $_oFieldsetOutputFormatter = new AdminPageFramework_Format_FieldsetOutput( |
718 | 718 | $_aFieldset, |
719 | 719 | null, // section index |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $_oFieldsetOutputFormatter->get(), |
724 | 724 | $hfCallback |
725 | 725 | ); |
726 | - $_aOutput[] = $_oFieldsetRow->get(); |
|
726 | + $_aOutput[ ] = $_oFieldsetRow->get(); |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | return implode( PHP_EOL, $_aOutput ); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->_divideElementsBySectionTabs( $aSections, $aFieldsInSections ); |
102 | 102 | |
103 | 103 | $_aOutput = array(); |
104 | - foreach( $aSections as $_sSectionTabSlug => $_aSectionsBySectionTab ) { |
|
104 | + foreach( $aSections as $_sSectionTabSlug => $_aSectionsBySectionTab ) { |
|
105 | 105 | $_aOutput[] = $this->_getFormTable( |
106 | 106 | $aFieldsInSections, |
107 | 107 | $_sSectionTabSlug, |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | private function _getSectionsTables( $aSections, $aFieldsInSections, $hfSectionCallback, $hfFieldCallback ) { |
251 | 251 | |
252 | - if ( empty( $aSections ) ) { |
|
252 | + if ( empty( $aSections ) ) { |
|
253 | 253 | return ''; |
254 | 254 | } |
255 | 255 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @since 3.6.0 Changed the first parameter to `$aSection` from `$aSections`. |
307 | 307 | * @return array |
308 | 308 | */ |
309 | - protected function _getCollapsibleArgumentForSections( array $aSection=array() ) { |
|
309 | + protected function _getCollapsibleArgumentForSections( array $aSection=array() ) { |
|
310 | 310 | // $_aCollapsible = $this->_getCollapsibleArgument( $aSections ); |
311 | 311 | $_oArgumentFormater = new AdminPageFramework_Format_CollapsibleSection( |
312 | 312 | $aSection[ 'collapsible' ], |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | |
366 | 366 | // Get the section tables. |
367 | 367 | $_aSubSections = $this->numerizeElements( $_aSubSections ); // will include the main section as well. |
368 | - foreach( $_aSubSections as $_iIndex => $_aFields ) { |
|
368 | + foreach( $_aSubSections as $_iIndex => $_aFields ) { |
|
369 | 369 | |
370 | 370 | $_oEachSectionArguments = new AdminPageFramework_Format_EachSection( |
371 | 371 | $_aSection, |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | */ |
467 | 467 | private function _getUnsetFlagSectionInputTag( array $aSection ) { |
468 | 468 | |
469 | - if ( false !== $aSection[ 'save' ] ) { |
|
469 | + if ( false !== $aSection[ 'save' ] ) { |
|
470 | 470 | return ''; |
471 | 471 | } |
472 | 472 | return $this->getHTMLTag( |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function getFieldsetRows( array $aFieldsets, $hfCallback, $iSectionIndex=null ) { |
676 | 676 | |
677 | - if ( ! is_callable( $hfCallback ) ) { |
|
677 | + if ( ! is_callable( $hfCallback ) ) { |
|
678 | 678 | return ''; |
679 | 679 | } |
680 | 680 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | */ |
709 | 709 | public function getFieldsets( array $aFieldsets, $hfCallback ) { |
710 | 710 | |
711 | - if ( ! is_callable( $hfCallback ) ) { |
|
711 | + if ( ! is_callable( $hfCallback ) ) { |
|
712 | 712 | return ''; |
713 | 713 | } |
714 | 714 |
@@ -176,6 +176,7 @@ discard block |
||
176 | 176 | * Returns the repeatable fields script. |
177 | 177 | * |
178 | 178 | * @since 2.1.3 |
179 | + * @param string $sFieldsContainerID |
|
179 | 180 | */ |
180 | 181 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
181 | 182 | |
@@ -222,6 +223,7 @@ discard block |
||
222 | 223 | * Returns the sortable fields script. |
223 | 224 | * |
224 | 225 | * @since 3.0.0 |
226 | + * @param string $sFieldsContainerID |
|
225 | 227 | */ |
226 | 228 | protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
227 | 229 |
@@ -189,7 +189,7 @@ |
||
189 | 189 | $_sButtons = |
190 | 190 | "<div class='admin-page-framework-repeatable-field-buttons' {$_sSettingsAttributes} >" |
191 | 191 | . "<a class='repeatable-field-remove-button button-secondary repeatable-field-button button button-small {$_sDashiconMinus}' href='#' title='{$_sRemove}' {$_sVisibility} data-id='{$sFieldsContainerID}'>" |
192 | - . ( $_bDashiconSupported ? '' : '-' ) |
|
192 | + . ( $_bDashiconSupported ? '' : '-' ) |
|
193 | 193 | . "</a>" |
194 | 194 | . "<a class='repeatable-field-add-button button-secondary repeatable-field-button button button-small {$_sDashiconPlus}' href='#' title='{$_sAdd}' data-id='{$sFieldsContainerID}'>" |
195 | 195 | . ( $_bDashiconSupported ? '' : '+' ) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param object $oMsg An object storing the system messages. |
69 | 69 | * @param array $aCallbacks An array storing the form-field specific callbacks. |
70 | 70 | */ |
71 | - public function __construct( &$aField, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks=array() ) { |
|
71 | + public function __construct( &$aField, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks = array() ) { |
|
72 | 72 | |
73 | 73 | // @todo Investigate why the first parameter is passed by reference. |
74 | 74 | |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | $this->aErrors = $this->getAsArray( $aErrors ); |
80 | 80 | $this->oMsg = $oMsg; |
81 | 81 | $this->aCallbacks = $aCallbacks + array( |
82 | - 'hfID' => null, // the input id attribute |
|
83 | - 'hfTagID' => null, // the fieldset/field row container id attribute |
|
84 | - 'hfName' => null, // the input name attribute |
|
85 | - 'hfNameFlat' => null, // the flat input name attribute |
|
82 | + 'hfID' => null, // the input id attribute |
|
83 | + 'hfTagID' => null, // the fieldset/field row container id attribute |
|
84 | + 'hfName' => null, // the input name attribute |
|
85 | + 'hfNameFlat' => null, // the flat input name attribute |
|
86 | 86 | 'hfInputName' => null, |
87 | 87 | 'hfInputNameFlat' => null, |
88 | - 'hfClass' => null, // the class attribute |
|
88 | + 'hfClass' => null, // the class attribute |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | // 2. Load necessary JavaScript scripts. |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @since 3.2.0 Added the $sFieldsType parameter. |
153 | 153 | * @internal |
154 | 154 | */ |
155 | - private function _loadScripts( $sFieldsType='' ) { |
|
155 | + private function _loadScripts( $sFieldsType = '' ) { |
|
156 | 156 | |
157 | - if ( 'widget' === $sFieldsType && ! self::$_bIsLoadedSScripts_Widget ) { |
|
157 | + if ( 'widget' === $sFieldsType && !self::$_bIsLoadedSScripts_Widget ) { |
|
158 | 158 | new AdminPageFramework_Script_Widget; |
159 | 159 | self::$_bIsLoadedSScripts_Widget = true; |
160 | 160 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $_sRemove = $this->oMsg->get( 'remove' ); |
185 | 185 | $_sVisibility = $iFieldCount <= 1 ? " style='visibility: hidden;'" : ""; |
186 | 186 | $_sSettingsAttributes = $this->generateDataAttributes( ( array ) $aSettings ); |
187 | - $_bDashiconSupported = false; // version_compare( $GLOBALS['wp_version'], '3.8', '>=' ); |
|
187 | + $_bDashiconSupported = false; // version_compare( $GLOBALS['wp_version'], '3.8', '>=' ); |
|
188 | 188 | $_sDashiconPlus = $_bDashiconSupported ? 'dashicons dashicons-plus' : ''; |
189 | 189 | $_sDashiconMinus = $_bDashiconSupported ? 'dashicons dashicons-minus' : ''; |
190 | 190 | $_sButtons = |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | . "</a>" |
198 | 198 | . "</div>"; |
199 | 199 | $_aJSArray = json_encode( $aSettings ); |
200 | - $_sButtonsHTML = '"' . $_sButtons . '"'; |
|
200 | + $_sButtonsHTML = '"'.$_sButtons.'"'; |
|
201 | 201 | $_sScript = <<<JAVASCRIPTS |
202 | 202 | jQuery( document ).ready( function() { |
203 | 203 | var _nodePositionIndicators = jQuery( '#{$sFieldsContainerID} .admin-page-framework-field .repeatable-field-buttons' ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | jQuery( '#{$sFieldsContainerID}' ).updateAdminPageFrameworkRepeatableFields( $_aJSArray ); // Update the fields |
216 | 216 | }); |
217 | 217 | JAVASCRIPTS; |
218 | - return "<script type='text/javascript'>" . $_sScript . "</script>"; |
|
218 | + return "<script type='text/javascript'>".$_sScript."</script>"; |
|
219 | 219 | |
220 | 220 | } |
221 | 221 |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | self::$_bIsLoadedSScripts_Widget = true; |
160 | 160 | } |
161 | 161 | |
162 | - if ( self::$_bIsLoadedSScripts ) { |
|
162 | + if ( self::$_bIsLoadedSScripts ) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | self::$_bIsLoadedSScripts = true; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @since 3.0.0 |
225 | 225 | */ |
226 | - protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
226 | + protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
227 | 227 | |
228 | 228 | $_sScript = <<<JAVASCRIPTS |
229 | 229 | jQuery( document ).ready( function() { |
@@ -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,7 +63,7 @@ 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 | 68 | $this->aAttributes = $this->getElementAsArray( $aAttributes, 'attributes', $aAttributes ); |
69 | 69 | $this->aOptions = $aOptions + $this->aStructureOptions; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | * @return string The set class selector(s). |
123 | 123 | */ |
124 | 124 | public function addClass( /* $asSelectors1, $asSelectors2 */ ) { |
125 | - foreach( func_get_args() as $_asSelectors ) { |
|
126 | - $this->aAttributes['class'] = $this->getClassAttribute( |
|
127 | - $this->aAttributes['class'], |
|
125 | + foreach ( func_get_args() as $_asSelectors ) { |
|
126 | + $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
|
127 | + $this->aAttributes[ 'class' ], |
|
128 | 128 | $_asSelectors |
129 | 129 | ); |
130 | 130 | } |
131 | - return $this->aAttributes['class']; |
|
131 | + return $this->aAttributes[ 'class' ]; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | // $this->aAttributes[ $_aParams[ 0 ] ] = $_aParams[ 1 ]; |
154 | 154 | $this->setMultiDimensionalArray( |
155 | 155 | $this->aAttributes, |
156 | - $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
156 | + $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
157 | 157 | $_aParams[ 1 ] // $mValue |
158 | 158 | ); |
159 | 159 | } |
@@ -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 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | // Output |
38 | 38 | return |
39 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
39 | + "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
40 | 40 | // the unchecked value must be set prior to the checkbox input field. |
41 | 41 | . "<input " . $this->getAttributes( |
42 | 42 | array( |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | // Parameters |
30 | 30 | $_aParams = func_get_args() + array( 0 => '', 1 => array() ); |
31 | - $_sLabel = $_aParams[ 0 ]; // first parameter |
|
31 | + $_sLabel = $_aParams[ 0 ]; // first parameter |
|
32 | 32 | $_aAttributes = $this->uniteArrays( // second parameter |
33 | 33 | $this->getElementAsArray( $_aParams, 1, array() ), |
34 | 34 | $this->aAttributes |
@@ -36,22 +36,22 @@ discard block |
||
36 | 36 | |
37 | 37 | // Output |
38 | 38 | return |
39 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
39 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
40 | 40 | // the unchecked value must be set prior to the checkbox input field. |
41 | - . "<input " . $this->getAttributes( |
|
41 | + . "<input ".$this->getAttributes( |
|
42 | 42 | array( |
43 | 43 | 'type' => 'hidden', |
44 | - 'class' => $_aAttributes['class'], |
|
45 | - 'name' => $_aAttributes['name'], |
|
44 | + 'class' => $_aAttributes[ 'class' ], |
|
45 | + 'name' => $_aAttributes[ 'name' ], |
|
46 | 46 | 'value' => '0', |
47 | 47 | ) |
48 | 48 | ) |
49 | 49 | . " />" |
50 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
51 | - . "</{$this->aOptions['input_container_tag']}>" |
|
52 | - . "<{$this->aOptions['label_container_tag']} " . $this->getAttributes( $this->aOptions['label_container_attributes'] ) . ">" |
|
50 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
51 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
52 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
53 | 53 | . $_sLabel |
54 | - . "</{$this->aOptions['label_container_tag']}>" |
|
54 | + . "</{$this->aOptions[ 'label_container_tag' ]}>" |
|
55 | 55 | ; |
56 | 56 | |
57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function getAttributesByKey( /* $sKey */ ) { |
66 | 66 | |
67 | 67 | // Parameters |
68 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
68 | + $_aParams = func_get_args() + array( 0 => '',); |
|
69 | 69 | $_sKey = $_aParams[ 0 ]; |
70 | 70 | $_bIsMultiple = '' !== $_sKey; |
71 | 71 | |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | // 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. |
78 | 78 | + array( |
79 | 79 | 'type' => 'checkbox', |
80 | - 'id' => $this->aAttributes['id'] . '_' . $_sKey, |
|
80 | + 'id' => $this->aAttributes[ 'id' ].'_'.$_sKey, |
|
81 | 81 | 'checked' => $this->getElement( $this->aAttributes, array( 'value', $_sKey ), null ) |
82 | 82 | ? 'checked' |
83 | - : null, // to not to set, pass null. An empty value '' will still set the attribute. |
|
84 | - '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. |
|
83 | + : null, // to not to set, pass null. An empty value '' will still set the attribute. |
|
84 | + '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. |
|
85 | 85 | 'name' => $_bIsMultiple |
86 | - ? "{$this->aAttributes['name']}[{$_sKey}]" |
|
87 | - : $this->aAttributes['name'], |
|
88 | - 'data-id' => $this->aAttributes['id'], // referenced by the JavaScript scripts such as the revealer script. |
|
86 | + ? "{$this->aAttributes[ 'name' ]}[{$_sKey}]" |
|
87 | + : $this->aAttributes[ 'name' ], |
|
88 | + 'data-id' => $this->aAttributes[ 'id' ], // referenced by the JavaScript scripts such as the revealer script. |
|
89 | 89 | ) |
90 | 90 | + $this->aAttributes |
91 | 91 | ; |
@@ -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 | } |