@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | * Defines the default key-values of this field type. |
77 | 77 | */ |
78 | 78 | protected $aDefaultKeys = array( |
79 | - 'select_all_button' => false, // 3.3.0+ to change the label, set the label here |
|
80 | - 'select_none_button' => false, // 3.3.0+ to change the label, set the label here |
|
81 | - 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
79 | + 'select_all_button' => false, // 3.3.0+ to change the label, set the label here |
|
80 | + 'select_none_button' => false, // 3.3.0+ to change the label, set the label here |
|
81 | + 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return array( |
90 | 90 | array( |
91 | 91 | 'handle_id' => 'admin-page-framework-field-type-checkbox', |
92 | - 'src' => dirname( __FILE__ ) . '/js/checkbox.bundle.js', |
|
92 | + 'src' => dirname( __FILE__ ).'/js/checkbox.bundle.js', |
|
93 | 93 | 'in_footer' => true, |
94 | 94 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
95 | 95 | 'translation_var' => 'AdminPageFrameworkFieldTypeCheckbox', |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | * @return string |
110 | 110 | * @internal |
111 | 111 | */ |
112 | - private function ___getSelectButtonClassSelectors( array $aFieldTypeSlugs, $sDataAttribute='select_all_button' ) { |
|
112 | + private function ___getSelectButtonClassSelectors( array $aFieldTypeSlugs, $sDataAttribute = 'select_all_button' ) { |
|
113 | 113 | $_aClassSelectors = array(); |
114 | 114 | foreach ( $aFieldTypeSlugs as $_sSlug ) { |
115 | - if ( ! is_scalar( $_sSlug ) ) { |
|
115 | + if ( !is_scalar( $_sSlug ) ) { |
|
116 | 116 | continue; |
117 | 117 | } |
118 | - $_aClassSelectors[] = '.admin-page-framework-checkbox-container-' . $_sSlug . "[data-{$sDataAttribute}]"; |
|
118 | + $_aClassSelectors[ ] = '.admin-page-framework-checkbox-container-'.$_sSlug."[data-{$sDataAttribute}]"; |
|
119 | 119 | } |
120 | 120 | return implode( ',', $_aClassSelectors ); |
121 | 121 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | |
143 | 143 | $_aOutput = array(); |
144 | 144 | $_bIsMultiple = is_array( $aField[ 'label' ] ); |
145 | - foreach( $this->getAsArray( $aField[ 'label' ], true ) as $_sKey => $_sLabel ) { |
|
146 | - $_aOutput[] = $this->_getEachCheckboxOutput( |
|
145 | + foreach ( $this->getAsArray( $aField[ 'label' ], true ) as $_sKey => $_sLabel ) { |
|
146 | + $_aOutput[ ] = $this->_getEachCheckboxOutput( |
|
147 | 147 | $aField, |
148 | 148 | $_bIsMultiple |
149 | 149 | ? $_sKey |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $_sLabel |
152 | 152 | ); |
153 | 153 | } |
154 | - return "<div " . $this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ) . ">" |
|
154 | + return "<div ".$this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ).">" |
|
155 | 155 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
156 | 156 | . implode( PHP_EOL, $_aOutput ) |
157 | 157 | . "</div>"; |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | */ |
167 | 167 | protected function _getCheckboxContainerAttributes( array $aField ) { |
168 | 168 | return array( |
169 | - 'class' => 'admin-page-framework-checkbox-container-' . $aField[ 'type' ], |
|
169 | + 'class' => 'admin-page-framework-checkbox-container-'.$aField[ 'type' ], |
|
170 | 170 | 'data-select_all_button' => $aField[ 'select_all_button' ] |
171 | - ? ( ! is_string( $aField[ 'select_all_button' ] ) ? $this->oMsg->get( 'select_all' ) : $aField[ 'select_all_button' ] ) |
|
171 | + ? ( !is_string( $aField[ 'select_all_button' ] ) ? $this->oMsg->get( 'select_all' ) : $aField[ 'select_all_button' ] ) |
|
172 | 172 | : null, |
173 | 173 | 'data-select_none_button' => $aField[ 'select_none_button' ] |
174 | - ? ( ! is_string( $aField[ 'select_none_button' ] ) ? $this->oMsg->get( 'select_none' ) : $aField[ 'select_none_button' ] ) |
|
174 | + ? ( !is_string( $aField[ 'select_none_button' ] ) ? $this->oMsg->get( 'select_none' ) : $aField[ 'select_none_button' ] ) |
|
175 | 175 | : null, |
176 | 176 | ); |
177 | 177 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | private function _getEachCheckboxOutput( array $aField, $sKey, $sLabel ) { |
187 | 187 | |
188 | 188 | $_aInputAttributes = array( |
189 | - 'data-key' => $sKey, // 3.8.8+ For the `post_type_taxonomy` field type. |
|
189 | + 'data-key' => $sKey, // 3.8.8+ For the `post_type_taxonomy` field type. |
|
190 | 190 | ) + $aField[ 'attributes' ]; |
191 | 191 | $_oCheckbox = new AdminPageFramework_Input_checkbox( |
192 | 192 | $_aInputAttributes, |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | $_oCheckbox->setAttributesByKey( $sKey ); |
198 | 198 | $_oCheckbox->addClass( $this->_sCheckboxClassSelector ); |
199 | 199 | return $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ) |
200 | - . "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-checkbox-label' ) . ">" |
|
201 | - . "<label " . $this->getAttributes( |
|
200 | + . "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-checkbox-label' ).">" |
|
201 | + . "<label ".$this->getAttributes( |
|
202 | 202 | array( |
203 | 203 | 'for' => $_oCheckbox->getAttribute( 'id' ), |
204 | 204 | 'class' => $_oCheckbox->getAttribute( 'disabled' ) |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * </code> |
73 | 73 | * @var array |
74 | 74 | */ |
75 | - public $aFieldTypeSlugs = array( 'system', ); |
|
75 | + public $aFieldTypeSlugs = array( 'system',); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Defines the default key-values of this field type. |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | * @remark `$_aDefaultKeys` holds shared default key-values defined in the base class. |
93 | 93 | */ |
94 | 94 | protected $aDefaultKeys = array( |
95 | - 'data' => array(), // [3.2.0+] Stores the data to be displayed |
|
96 | - 'print_type' => 1, // [3.4.6+] 1: readable representation of array. 2: print_r() |
|
95 | + 'data' => array(), // [3.2.0+] Stores the data to be displayed |
|
96 | + 'print_type' => 1, // [3.4.6+] 1: readable representation of array. 2: print_r() |
|
97 | 97 | 'attributes' => array( |
98 | 98 | 'rows' => 60, |
99 | 99 | 'autofocus' => null, |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | . "<div class='admin-page-framework-input-label-container'>" |
234 | 234 | . "<label for='{$aField[ 'input_id' ]}'>" |
235 | 235 | . $aField[ 'before_input' ] |
236 | - . ( $aField[ 'label' ] && ! $aField[ 'repeatable' ] |
|
237 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
236 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
237 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
238 | 238 | . $aField[ 'label' ] |
239 | 239 | . "</span>" |
240 | 240 | : "" |
241 | 241 | ) |
242 | - . "<textarea " . $this->getAttributes( $_aInputAttributes ) . " >" |
|
242 | + . "<textarea ".$this->getAttributes( $_aInputAttributes )." >" |
|
243 | 243 | . esc_textarea( $this->___getSystemInformation( $aField[ 'value' ], $aField[ 'data' ], $aField[ 'print_type' ] ) ) |
244 | 244 | . "</textarea>" |
245 | 245 | . $aField[ 'after_input' ] |
@@ -257,15 +257,15 @@ discard block |
||
257 | 257 | * @param integer $iPrintType |
258 | 258 | * @internal |
259 | 259 | */ |
260 | - private function ___getSystemInformation( $asValue=null, $asCustomData=null, $iPrintType=1 ) { |
|
260 | + private function ___getSystemInformation( $asValue = null, $asCustomData = null, $iPrintType = 1 ) { |
|
261 | 261 | |
262 | 262 | if ( isset( $asValue ) ) { |
263 | 263 | return $asValue; |
264 | 264 | } |
265 | 265 | |
266 | - $_aOutput = array(); |
|
267 | - foreach( $this->___getFormattedSystemInformation( $asCustomData ) as $_sSection => $_aInfo ) { |
|
268 | - $_aOutput[] = $this->_____getSystemInfoBySection( $_sSection, $_aInfo, $iPrintType ); |
|
266 | + $_aOutput = array(); |
|
267 | + foreach ( $this->___getFormattedSystemInformation( $asCustomData ) as $_sSection => $_aInfo ) { |
|
268 | + $_aOutput[ ] = $this->_____getSystemInfoBySection( $_sSection, $_aInfo, $iPrintType ); |
|
269 | 269 | } |
270 | 270 | return implode( PHP_EOL, $_aOutput ); |
271 | 271 | |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | |
282 | 282 | $_aData = $this->getAsArray( $asCustomData ); |
283 | 283 | $_aData = $_aData + array( |
284 | - 'WordPress' => $this->___getSiteInfoWithCache( ! isset( $_aData[ 'WordPress' ] ) ), |
|
285 | - 'PHP' => $this->_getPHPInfo( ! isset( $_aData[ 'PHP' ] ) ), |
|
286 | - 'PHP Error Log' => $this->___getErrorLogByType( 'php', ! isset( $_aData[ 'PHP Error Log' ] ) ), |
|
284 | + 'WordPress' => $this->___getSiteInfoWithCache( !isset( $_aData[ 'WordPress' ] ) ), |
|
285 | + 'PHP' => $this->_getPHPInfo( !isset( $_aData[ 'PHP' ] ) ), |
|
286 | + 'PHP Error Log' => $this->___getErrorLogByType( 'php', !isset( $_aData[ 'PHP Error Log' ] ) ), |
|
287 | 287 | 'MySQL' => isset( $_aData[ 'MySQL' ] ) |
288 | 288 | ? null |
289 | - : $this->getMySQLInfo(), // defined in the utility class. |
|
290 | - 'MySQL Error Log' => $this->___getErrorLogByType( 'mysql', ! isset( $_aData[ 'MySQL Error Log' ] ) ), |
|
291 | - 'Server' => $this->___getWebServerInfo( ! isset( $_aData[ 'Server' ] ) ), |
|
292 | - 'Browser' => $this->___getClientInfo( ! isset( $_aData[ 'Browser' ] ) ), |
|
289 | + : $this->getMySQLInfo(), // defined in the utility class. |
|
290 | + 'MySQL Error Log' => $this->___getErrorLogByType( 'mysql', !isset( $_aData[ 'MySQL Error Log' ] ) ), |
|
291 | + 'Server' => $this->___getWebServerInfo( !isset( $_aData[ 'Server' ] ) ), |
|
292 | + 'Browser' => $this->___getClientInfo( !isset( $_aData[ 'Browser' ] ) ), |
|
293 | 293 | 'Admin Page Framework' => isset( $_aData[ 'Admin Page Framework' ] ) |
294 | 294 | ? null |
295 | 295 | : AdminPageFramework_Registry::getInfo(), |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | switch ( $iPrintType ) { |
313 | 313 | default: |
314 | 314 | case 1: // use the framework readable representation of arrays. |
315 | - return $this->getReadableArrayContents( $sSectionName, $aData, 32 ) . PHP_EOL; |
|
315 | + return $this->getReadableArrayContents( $sSectionName, $aData, 32 ).PHP_EOL; |
|
316 | 316 | case 2: // use print_r() |
317 | - return "[{$sSectionName}]" . PHP_EOL |
|
318 | - . print_r( $aData, true ) . PHP_EOL; |
|
317 | + return "[{$sSectionName}]".PHP_EOL |
|
318 | + . print_r( $aData, true ).PHP_EOL; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | /** |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | * @param boolean $bGenerateInfo |
328 | 328 | * @return string |
329 | 329 | */ |
330 | - private function ___getClientInfo( $bGenerateInfo=true ) { |
|
330 | + private function ___getClientInfo( $bGenerateInfo = true ) { |
|
331 | 331 | |
332 | - if ( ! $bGenerateInfo ) { |
|
332 | + if ( !$bGenerateInfo ) { |
|
333 | 333 | return ''; |
334 | 334 | } |
335 | 335 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $_aBrowser = @ini_get( 'browscap' ) |
338 | 338 | ? get_browser( $_SERVER[ 'HTTP_USER_AGENT' ], true ) |
339 | 339 | : array(); |
340 | - unset( $_aBrowser[ 'browser_name_regex' ] ); // this element causes output to be blank |
|
340 | + unset( $_aBrowser[ 'browser_name_regex' ] ); // this element causes output to be blank |
|
341 | 341 | return empty( $_aBrowser ) |
342 | 342 | ? __( 'No browser information found.', 'admin-page-framework' ) |
343 | 343 | : $_aBrowser; |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | * @param string $sType The error log type. Either 'php' or 'mysql' is accepted. |
354 | 354 | * @param boolean $bGenerateInfo Whether to generate a log. This is for the caller method to reduce a conditinal statement. |
355 | 355 | */ |
356 | - private function ___getErrorLogByType( $sType, $bGenerateInfo=true ) { |
|
356 | + private function ___getErrorLogByType( $sType, $bGenerateInfo = true ) { |
|
357 | 357 | |
358 | - if ( ! $bGenerateInfo ) { |
|
358 | + if ( !$bGenerateInfo ) { |
|
359 | 359 | return ''; |
360 | 360 | } |
361 | 361 | switch ( $sType ) { |
@@ -388,9 +388,9 @@ discard block |
||
388 | 388 | * @param boolean $bGenerateInfo |
389 | 389 | * @return array The generated site information array. |
390 | 390 | */ |
391 | - private function ___getSiteInfoWithCache( $bGenerateInfo=true ) { |
|
391 | + private function ___getSiteInfoWithCache( $bGenerateInfo = true ) { |
|
392 | 392 | |
393 | - if ( ! $bGenerateInfo || isset( self::$_aSiteInfo ) ) { |
|
393 | + if ( !$bGenerateInfo || isset( self::$_aSiteInfo ) ) { |
|
394 | 394 | return self::$_aSiteInfo; |
395 | 395 | } |
396 | 396 | self::$_aSiteInfo = self::___getSiteInfo(); |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | 'wp_remote_get()' => $this->___getWPRemoteGetStatus(), |
425 | 425 | __( 'Multibite String Extension', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'mb_detect_encoding' ), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ), |
426 | 426 | __( 'WP_CONTENT_DIR Writeable', 'admin-page-framework' ) => $this->getAOrB( is_writable( WP_CONTENT_DIR ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
427 | - __( 'Active Plugins', 'admin-page-framework' ) => PHP_EOL . $this->___getActivePlugins(), |
|
428 | - __( 'Network Active Plugins', 'admin-page-framework' ) => PHP_EOL . $this->___getNetworkActivePlugins(), |
|
427 | + __( 'Active Plugins', 'admin-page-framework' ) => PHP_EOL.$this->___getActivePlugins(), |
|
428 | + __( 'Network Active Plugins', 'admin-page-framework' ) => PHP_EOL.$this->___getNetworkActivePlugins(), |
|
429 | 429 | __( 'Constants', 'admin-page-framework' ) => $this->___getDefinedConstants( 'user' ), |
430 | 430 | ); |
431 | 431 | } |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | * @return string|array |
438 | 438 | * @internal |
439 | 439 | */ |
440 | - private function ___getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) { |
|
440 | + private function ___getDefinedConstants( $asCategories = null, $asRemovingCategories = null ) { |
|
441 | 441 | $_asConstants = $this->getDefinedConstants( $asCategories, $asRemovingCategories ); |
442 | - if ( ! is_array( $_asConstants ) ) { |
|
442 | + if ( !is_array( $_asConstants ) ) { |
|
443 | 443 | return $_asConstants; |
444 | 444 | } |
445 | 445 | if ( isset( $_asConstants[ 'user' ] ) ) { |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | |
477 | 477 | // If the WordPress version is less than 3.4, |
478 | 478 | if ( version_compare( $GLOBALS[ 'wp_version' ], '3.4', '<' ) ) { |
479 | - $_aThemeData = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
480 | - return $_aThemeData[ 'Name' ] . ' ' . $_aThemeData[ 'Version' ]; |
|
479 | + $_aThemeData = get_theme_data( get_stylesheet_directory().'/style.css' ); |
|
480 | + return $_aThemeData[ 'Name' ].' '.$_aThemeData[ 'Version' ]; |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | $_oThemeData = wp_get_theme(); |
484 | - return $_oThemeData->Name . ' ' . $_oThemeData->Version; |
|
484 | + return $_oThemeData->Name.' '.$_oThemeData->Version; |
|
485 | 485 | |
486 | 486 | } |
487 | 487 | /** |
@@ -495,10 +495,10 @@ discard block |
||
495 | 495 | $_aPluginList = array(); |
496 | 496 | $_aActivePlugins = get_option( 'active_plugins', array() ); |
497 | 497 | foreach ( get_plugins() as $_sPluginPath => $_aPlugin ) { |
498 | - if ( ! in_array( $_sPluginPath, $_aActivePlugins ) ) { |
|
498 | + if ( !in_array( $_sPluginPath, $_aActivePlugins ) ) { |
|
499 | 499 | continue; |
500 | 500 | } |
501 | - $_aPluginList[] = ' ' . $_aPlugin[ 'Name' ] . ': ' . $_aPlugin[ 'Version' ]; |
|
501 | + $_aPluginList[ ] = ' '.$_aPlugin[ 'Name' ].': '.$_aPlugin[ 'Version' ]; |
|
502 | 502 | } |
503 | 503 | return implode( PHP_EOL, $_aPluginList ); |
504 | 504 | |
@@ -510,17 +510,17 @@ discard block |
||
510 | 510 | */ |
511 | 511 | private function ___getNetworkActivePlugins() { |
512 | 512 | |
513 | - if ( ! is_multisite() ) { |
|
513 | + if ( !is_multisite() ) { |
|
514 | 514 | return ''; |
515 | 515 | } |
516 | 516 | $_aPluginList = array(); |
517 | 517 | $_aActivePlugins = get_site_option( 'active_sitewide_plugins', array() ); |
518 | 518 | foreach ( wp_get_active_network_plugins() as $_sPluginPath ) { |
519 | - if ( ! array_key_exists( plugin_basename( $_sPluginPath ), $_aActivePlugins ) ) { |
|
519 | + if ( !array_key_exists( plugin_basename( $_sPluginPath ), $_aActivePlugins ) ) { |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | $_aPlugin = get_plugin_data( $_sPluginPath ); |
523 | - $_aPluginList[] = ' ' . $_aPlugin[ 'Name' ] . ' :' . $_aPlugin[ 'Version' ]; |
|
523 | + $_aPluginList[ ] = ' '.$_aPlugin[ 'Name' ].' :'.$_aPlugin[ 'Version' ]; |
|
524 | 524 | } |
525 | 525 | return implode( PHP_EOL, $_aPluginList ); |
526 | 526 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | if ( is_wp_error( $aoResponse ) ) { |
585 | 585 | return true; |
586 | 586 | } |
587 | - if ( $aoResponse[ 'response'][ 'code' ] < 200 ) { |
|
587 | + if ( $aoResponse[ 'response' ][ 'code' ] < 200 ) { |
|
588 | 588 | return true; |
589 | 589 | } |
590 | 590 | if ( $aoResponse[ 'response' ][ 'code' ] >= 300 ) { |
@@ -610,13 +610,13 @@ discard block |
||
610 | 610 | * @param boolean $bGenerateInfo |
611 | 611 | * @return array |
612 | 612 | */ |
613 | - private function _getPHPInfo( $bGenerateInfo=true ) { |
|
613 | + private function _getPHPInfo( $bGenerateInfo = true ) { |
|
614 | 614 | |
615 | - if ( ! $bGenerateInfo || isset( self::$_aPHPInfo ) ) { |
|
615 | + if ( !$bGenerateInfo || isset( self::$_aPHPInfo ) ) { |
|
616 | 616 | return self::$_aPHPInfo; |
617 | 617 | } |
618 | 618 | |
619 | - $_oErrorReporting = new AdminPageFramework_ErrorReporting; |
|
619 | + $_oErrorReporting = new AdminPageFramework_ErrorReporting; |
|
620 | 620 | self::$_aPHPInfo = array( |
621 | 621 | __( 'Version', 'admin-page-framework' ) => phpversion(), |
622 | 622 | __( 'Safe Mode', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'safe_mode' ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
@@ -627,16 +627,16 @@ discard block |
||
627 | 627 | __( 'Max Execution Time', 'admin-page-framework' ) => @ini_get( 'max_execution_time' ), |
628 | 628 | __( 'Max Input Vars', 'admin-page-framework' ) => @ini_get( 'max_input_vars' ), |
629 | 629 | __( 'Argument Separator', 'admin-page-framework' ) => @ini_get( 'arg_separator.output' ), |
630 | - __( 'Allow URL File Open', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'allow_url_fopen' ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
|
631 | - __( 'Display Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'display_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
632 | - __( 'Log Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'log_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
630 | + __( 'Allow URL File Open', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'allow_url_fopen' ), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
|
631 | + __( 'Display Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'display_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
632 | + __( 'Log Errors', 'admin-page-framework' ) => $this->getAOrB( @ini_get( 'log_errors' ), $this->oMsg->get( 'on' ), $this->oMsg->get( 'off' ) ), |
|
633 | 633 | __( 'Error log location', 'admin-page-framework' ) => @ini_get( 'error_log' ), |
634 | 634 | __( 'Error Reporting Level', 'admin-page-framework' ) => $_oErrorReporting->getErrorLevel(), |
635 | - __( 'FSOCKOPEN', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'fsockopen' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
636 | - __( 'cURL', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'curl_init' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
637 | - __( 'SOAP', 'admin-page-framework' ) => $this->getAOrB( class_exists( 'SoapClient' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
638 | - __( 'SUHOSIN', 'admin-page-framework' ) => $this->getAOrB( extension_loaded( 'suhosin' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
639 | - 'ini_set()' => $this->getAOrB( function_exists( 'ini_set' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
635 | + __( 'FSOCKOPEN', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'fsockopen' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
636 | + __( 'cURL', 'admin-page-framework' ) => $this->getAOrB( function_exists( 'curl_init' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
637 | + __( 'SOAP', 'admin-page-framework' ) => $this->getAOrB( class_exists( 'SoapClient' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
638 | + __( 'SUHOSIN', 'admin-page-framework' ) => $this->getAOrB( extension_loaded( 'suhosin' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
639 | + 'ini_set()' => $this->getAOrB( function_exists( 'ini_set' ), $this->oMsg->get( 'supported' ), $this->oMsg->get( 'not_supported' ) ), |
|
640 | 640 | ) |
641 | 641 | + $this->getPHPInfo() |
642 | 642 | + array( |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param boolean $bGenerateInfo |
657 | 657 | * @return array|string |
658 | 658 | */ |
659 | - private function ___getWebServerInfo( $bGenerateInfo=true ) { |
|
659 | + private function ___getWebServerInfo( $bGenerateInfo = true ) { |
|
660 | 660 | return $bGenerateInfo |
661 | 661 | ? array( |
662 | - __( 'Web Server', 'admin-page-framework' ) => $_SERVER['SERVER_SOFTWARE'], |
|
662 | + __( 'Web Server', 'admin-page-framework' ) => $_SERVER[ 'SERVER_SOFTWARE' ], |
|
663 | 663 | 'SSL' => $this->getAOrB( is_ssl(), $this->oMsg->get( 'yes' ), $this->oMsg->get( 'no' ) ), |
664 | 664 | __( 'Session', 'admin-page-framework' ) => $this->getAOrB( isset( $_SESSION ), $this->oMsg->get( 'enabled' ), $this->oMsg->get( 'disabled' ) ), |
665 | 665 | __( 'Session Name', 'admin-page-framework' ) => esc_html( @ini_get( 'session.name' ) ), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * Defines the field type slugs used for this field type. |
82 | 82 | */ |
83 | - public $aFieldTypeSlugs = array( 'posttype', ); |
|
83 | + public $aFieldTypeSlugs = array( 'posttype',); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Defines the default key-values of this field type. |
@@ -88,20 +88,20 @@ discard block |
||
88 | 88 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
89 | 89 | */ |
90 | 90 | protected $aDefaultKeys = array( |
91 | - 'slugs_to_remove' => null, // the default array will be assigned in the rendering method. |
|
91 | + 'slugs_to_remove' => null, // the default array will be assigned in the rendering method. |
|
92 | 92 | /** |
93 | 93 | * Accepts query arguments. For the argument specification, see the arg parameter of get_post_types() function. |
94 | 94 | * See: http://codex.wordpress.org/Function_Reference/get_post_types#Parameters |
95 | 95 | */ |
96 | - 'query' => array(), // 3.2.1+ |
|
97 | - 'operator' => 'and', // 3.2.1+ either 'and' or 'or' |
|
96 | + 'query' => array(), // 3.2.1+ |
|
97 | + 'operator' => 'and', // 3.2.1+ either 'and' or 'or' |
|
98 | 98 | 'attributes' => array( |
99 | 99 | 'size' => 30, |
100 | 100 | 'maxlength' => 400, |
101 | 101 | ), |
102 | - 'select_all_button' => true, // 3.3.0+ to change the label, set the label here |
|
103 | - 'select_none_button' => true, // 3.3.0+ to change the label, set the label here |
|
104 | - 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
102 | + 'select_all_button' => true, // 3.3.0+ to change the label, set the label here |
|
103 | + 'select_none_button' => true, // 3.3.0+ to change the label, set the label here |
|
104 | + 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
105 | 105 | ); |
106 | 106 | protected $aDefaultRemovingPostTypeSlugs = array( |
107 | 107 | 'revision', |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | * @return string |
124 | 124 | */ |
125 | 125 | protected function getField( $aField ) { |
126 | - $this->_sCheckboxClassSelector = ''; // disable the checkbox class selector. |
|
126 | + $this->_sCheckboxClassSelector = ''; // disable the checkbox class selector. |
|
127 | 127 | $aField[ 'label' ] = $this->_getPostTypeArrayForChecklist( |
128 | 128 | isset( $aField[ 'slugs_to_remove' ] ) |
129 | 129 | ? $this->getAsArray( $aField[ 'slugs_to_remove' ] ) |
130 | - : $this->aDefaultRemovingPostTypeSlugs, // slugs to remove |
|
130 | + : $this->aDefaultRemovingPostTypeSlugs, // slugs to remove |
|
131 | 131 | $aField[ 'query' ], |
132 | 132 | $aField[ 'operator' ] |
133 | 133 | ); |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @return array The array holding the elements of installed post types' labels and their slugs except the specified expluding post types. |
148 | 148 | * @internal |
149 | 149 | */ |
150 | - private function _getPostTypeArrayForChecklist( $aSlugsToRemove, $asQueryArgs=array(), $sOperator='and' ) { |
|
150 | + private function _getPostTypeArrayForChecklist( $aSlugsToRemove, $asQueryArgs = array(), $sOperator = 'and' ) { |
|
151 | 151 | $_aPostTypes = array(); |
152 | - foreach( get_post_types( $asQueryArgs, 'objects' ) as $_oPostType ) { |
|
153 | - if ( isset( $_oPostType->name, $_oPostType->label ) ) { |
|
152 | + foreach ( get_post_types( $asQueryArgs, 'objects' ) as $_oPostType ) { |
|
153 | + if ( isset( $_oPostType->name, $_oPostType->label ) ) { |
|
154 | 154 | $_aPostTypes[ $_oPostType->name ] = $_oPostType->label; |
155 | 155 | } |
156 | 156 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | /** |
155 | 155 | * Defines the field type slugs used for this field type. |
156 | 156 | */ |
157 | - public $aFieldTypeSlugs = array( 'contact', ); |
|
157 | + public $aFieldTypeSlugs = array( 'contact',); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * @var string |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | protected function construct() { |
169 | 169 | $this->aDefaultKeys = array( |
170 | 170 | 'email' => array( |
171 | - 'to' => null, // string|array The email address to send to or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
172 | - 'subject' => null, // string|array The email title or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
173 | - 'message' => null, // string|array The email body or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
174 | - 'headers' => null, // string|array The email header or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
175 | - 'attachments' => null, // string|array The file path(s) or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
176 | - 'is_html' => true, // boolean Whether the mail should be sent as an html text |
|
177 | - 'from' => null, // the sender email or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
178 | - 'name' => null, // the sender name or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
171 | + 'to' => null, // string|array The email address to send to or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
172 | + 'subject' => null, // string|array The email title or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
173 | + 'message' => null, // string|array The email body or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
174 | + 'headers' => null, // string|array The email header or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
175 | + 'attachments' => null, // string|array The file path(s) or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
176 | + 'is_html' => true, // boolean Whether the mail should be sent as an html text |
|
177 | + 'from' => null, // the sender email or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
178 | + 'name' => null, // the sender name or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
|
179 | 179 | 'data' => array(), // array extra data appended to the message |
180 | 180 | ), |
181 | 181 | 'system_message' => array( |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // This is a dummy callback. Adding a dummy callback because WordPress does not proceed in admin-ajax.php |
189 | 189 | // and the `admin_init` action is not triggered if no `wp_ajax_{...}` action is registered. |
190 | 190 | // for guests: `wp_ajax_nopriv_{...}` might be needed. Not tested for front-end uses. |
191 | - add_action( "wp_ajax_{$this->___sAction}" , '__return_empty_string' ); |
|
191 | + add_action( "wp_ajax_{$this->___sAction}", '__return_empty_string' ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | return array( |
212 | 212 | array( |
213 | 213 | 'handle_id' => 'admin-page-framework-field-type-contact', |
214 | - 'src' => dirname( __FILE__ ) . '/js/contact.bundle.js', |
|
214 | + 'src' => dirname( __FILE__ ).'/js/contact.bundle.js', |
|
215 | 215 | 'in_footer' => true, |
216 | 216 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
217 | 217 | 'translation_var' => 'AdminPageFrameworkContactFieldType', |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | return array(); |
249 | 249 | } |
250 | 250 | return array( |
251 | - 'email' => true, // for the JavaScript script to detect |
|
252 | - 'input_flat' => $aField[ '_input_name_flat' ], // this is a part of the email transient key. This is passed to the Ajax response event so that it can receive the transient set for this field |
|
251 | + 'email' => true, // for the JavaScript script to detect |
|
252 | + 'input_flat' => $aField[ '_input_name_flat' ], // this is a part of the email transient key. This is passed to the Ajax response event so that it can receive the transient set for this field |
|
253 | 253 | 'section_id' => $aField[ 'section_id' ], |
254 | 254 | ); |
255 | 255 | } |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | */ |
261 | 261 | protected function _getHiddenInput_Email( array $aField ) { |
262 | 262 | |
263 | - $_sTransientKey = 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ); |
|
263 | + $_sTransientKey = 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ); |
|
264 | 264 | $this->setTransient( |
265 | 265 | $_sTransientKey, |
266 | 266 | array( |
267 | - 'nonce' => $this->getNonceCreated( 'apf_email_nonce_' . md5( ( string ) site_url() ), 86400 ), // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set. |
|
267 | + 'nonce' => $this->getNonceCreated( 'apf_email_nonce_'.md5( ( string ) site_url() ), 86400 ), // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set. |
|
268 | 268 | 'system_message' => $this->getElementAsArray( $aField, 'system_message' ), |
269 | 269 | ) + $this->getAsArray( $aField[ 'email' ] ) |
270 | 270 | ); |
271 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
271 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
272 | 272 | ? $this->getHTMLTag( |
273 | 273 | 'input', |
274 | 274 | array( |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | private function ___doAjaxResponse() { |
307 | 307 | |
308 | - if ( false === wp_verify_nonce( $this->getElement( $_REQUEST, 'nonce' ), get_class( $this ) ) ) { |
|
308 | + if ( false === wp_verify_nonce( $this->getElement( $_REQUEST, 'nonce' ), get_class( $this ) ) ) { |
|
309 | 309 | wp_send_json( array( |
310 | 310 | 'result' => false, |
311 | 311 | 'message' => $this->oMsg->get( 'nonce_verification_failed' ) |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $_sRootDimension = reset( $_aInputPath ); |
320 | 320 | $_aForm = $this->___getFormDataParsed( $this->getElementAsArray( $_aRequest, array( 'form' ) ) ); |
321 | 321 | $_aInputs = $this->getElementAsArray( $_aForm, array( $_sRootDimension ) ); |
322 | - $_sTransientKey = 'apf_em_' . md5( $_sInputFlat . get_current_user_id() ); |
|
322 | + $_sTransientKey = 'apf_em_'.md5( $_sInputFlat.get_current_user_id() ); |
|
323 | 323 | $_aEmailOptions = $this->getTransient( $_sTransientKey ); |
324 | 324 | $_aEmailOptions = $this->getAsArray( $_aEmailOptions ) + array( |
325 | 325 | 'nonce' => '', |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | 'from' => '', |
333 | 333 | 'name' => '', |
334 | 334 | ); |
335 | - $_aMessages = $this->getElementAsArray( $_aEmailOptions, array( 'system_message' ) ); |
|
336 | - if ( false === wp_verify_nonce( $_aEmailOptions[ 'nonce' ], 'apf_email_nonce_' . md5( ( string ) site_url() ) ) ) { |
|
335 | + $_aMessages = $this->getElementAsArray( $_aEmailOptions, array( 'system_message' ) ); |
|
336 | + if ( false === wp_verify_nonce( $_aEmailOptions[ 'nonce' ], 'apf_email_nonce_'.md5( ( string ) site_url() ) ) ) { |
|
337 | 337 | wp_send_json( array( |
338 | 338 | 'result' => false, |
339 | 339 | 'message' => $this->getElement( $_aMessages, 'error', $this->oMsg->get( 'nonce_verification_failed' ) ) |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | */ |
372 | 372 | private function ___getFormDataParsed( array $aForm ) { |
373 | 373 | $_aForm = array(); |
374 | - $aForm = array_reverse( $aForm ); // to preserver checkbox checked values as checkbox inputs have a preceding hidden input with the same name. |
|
375 | - foreach( $aForm as $_iIndex => $_aNameValue ) { |
|
376 | - parse_str( $_aNameValue[ 'name' ] . '=' . $_aNameValue[ 'value' ], $_a ); |
|
374 | + $aForm = array_reverse( $aForm ); // to preserver checkbox checked values as checkbox inputs have a preceding hidden input with the same name. |
|
375 | + foreach ( $aForm as $_iIndex => $_aNameValue ) { |
|
376 | + parse_str( $_aNameValue[ 'name' ].'='.$_aNameValue[ 'value' ], $_a ); |
|
377 | 377 | $_aForm = $this->uniteArrays( $_aForm, $_a ); |
378 | 378 | } |
379 | - return array_reverse( $_aForm ); // @note inner nested elements are still in the reversed order |
|
379 | + return array_reverse( $_aForm ); // @note inner nested elements are still in the reversed order |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | } |
383 | 383 | \ No newline at end of file |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Defines the field type slugs used for this field type. |
66 | 66 | */ |
67 | - public $aFieldTypeSlugs = array( 'size', ); |
|
67 | + public $aFieldTypeSlugs = array( 'size',); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Defines the default key-values of this field type. |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected $aDefaultKeys = array( |
75 | 75 | 'is_multiple' => false, // indicates whether the select tag alloes multiple selections. |
76 | - 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
76 | + 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
77 | 77 | 'attributes' => array( |
78 | 78 | 'size' => array( |
79 | 79 | 'min' => null, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected $aDefaultUnits = array( |
103 | 103 | 'px' => 'px', // pixel |
104 | - '%' => '%', // percentage |
|
104 | + '%' => '%', // percentage |
|
105 | 105 | 'em' => 'em', // font size |
106 | 106 | 'ex' => 'ex', // font height |
107 | 107 | 'in' => 'in', // inch |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | ); |
162 | 162 | |
163 | 163 | $_aOutput = array(); |
164 | - foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
165 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
164 | + foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
165 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
166 | 166 | $_isKey, |
167 | 167 | $_sLabel, |
168 | 168 | $aField |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | |
186 | 186 | $_aBaseAttributes = $_bMultiLabels |
187 | 187 | ? array( |
188 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]", |
|
189 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}", |
|
188 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]", |
|
189 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$isKey}", |
|
190 | 190 | 'value' => $aField[ 'value' ], |
191 | 191 | ) |
192 | 192 | + $aField[ 'attributes' ] |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | |
199 | 199 | $_aOutput = array( |
200 | 200 | $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ), |
201 | - "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ) . ">", |
|
202 | - $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
203 | - $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
201 | + "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ).">", |
|
202 | + $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
203 | + $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
204 | 204 | "</div>", |
205 | 205 | $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] ) |
206 | 206 | ); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
218 | 218 | |
219 | 219 | // Size and Size Label |
220 | - $_aSizeAttributes = $this->_getSizeAttributes( |
|
220 | + $_aSizeAttributes = $this->_getSizeAttributes( |
|
221 | 221 | $aField, |
222 | 222 | $aBaseAttributes, |
223 | 223 | $bMultiLabels |
@@ -225,32 +225,32 @@ discard block |
||
225 | 225 | : '' |
226 | 226 | ); |
227 | 227 | |
228 | - $_aSizeLabelAttributes = array( |
|
228 | + $_aSizeLabelAttributes = array( |
|
229 | 229 | 'for' => $_aSizeAttributes[ 'id' ], |
230 | 230 | 'class' => $_aSizeAttributes[ 'disabled' ] |
231 | 231 | ? 'disabled' |
232 | 232 | : null, |
233 | 233 | ); |
234 | 234 | |
235 | - $_sLabel = $this->getElementByLabel( |
|
235 | + $_sLabel = $this->getElementByLabel( |
|
236 | 236 | $aField[ 'label' ], |
237 | 237 | $isKey, |
238 | 238 | $aField[ 'label' ] |
239 | 239 | ); |
240 | - return "<label " . $this->getAttributes( $_aSizeLabelAttributes ) . ">" |
|
240 | + return "<label ".$this->getAttributes( $_aSizeLabelAttributes ).">" |
|
241 | 241 | . $this->getElement( |
242 | 242 | $aField, |
243 | 243 | $bMultiLabels |
244 | 244 | ? array( 'before_label', $isKey, 'size' ) |
245 | 245 | : array( 'before_label', 'size' ) |
246 | 246 | ) |
247 | - . ( $aField[ 'label' ] && ! $aField[ 'repeatable' ] |
|
248 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
247 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
248 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
249 | 249 | . $_sLabel |
250 | 250 | . "</span>" |
251 | 251 | : "" |
252 | 252 | ) |
253 | - . "<input " . $this->getAttributes( $_aSizeAttributes ) . " />" |
|
253 | + . "<input ".$this->getAttributes( $_aSizeAttributes )." />" |
|
254 | 254 | . $this->getElement( |
255 | 255 | $aField, |
256 | 256 | $bMultiLabels |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | ) |
294 | 294 | : $aField[ 'units' ]; |
295 | 295 | |
296 | - return "<label " . $this->getAttributes( |
|
296 | + return "<label ".$this->getAttributes( |
|
297 | 297 | array( |
298 | 298 | 'for' => $_aUnitAttributes[ 'id' ], |
299 | 299 | 'class' => $_aUnitAttributes[ 'disabled' ] |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | * @return array an unit attribute array |
326 | 326 | * @internal |
327 | 327 | */ |
328 | - private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey='' ) { |
|
328 | + private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey = '' ) { |
|
329 | 329 | |
330 | - $_bIsMultiple = $aField[ 'is_multiple' ] |
|
330 | + $_bIsMultiple = $aField[ 'is_multiple' ] |
|
331 | 331 | ? true |
332 | 332 | : $this->getElement( |
333 | 333 | $aField, |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | |
340 | 340 | $_aSelectAttributes = array( |
341 | 341 | 'type' => 'select', |
342 | - 'id' => $aField[ 'input_id' ] . ( '' === $isLabelKey ? '' : '_' . $isLabelKey ) . '_' . 'unit', |
|
342 | + 'id' => $aField[ 'input_id' ].( '' === $isLabelKey ? '' : '_'.$isLabelKey ).'_'.'unit', |
|
343 | 343 | 'multiple' => $_bIsMultiple |
344 | 344 | ? 'multiple' |
345 | 345 | : null, |
346 | 346 | 'name' => $_bIsMultiple |
347 | - ? "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit][]" |
|
348 | - : "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit]", |
|
347 | + ? "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit][]" |
|
348 | + : "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit]", |
|
349 | 349 | 'value' => $this->getElement( |
350 | 350 | $aField, |
351 | 351 | array( 'value', 'unit' ), |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | '' === $isLabelKey |
358 | 358 | ? array( 'attributes', 'unit' ) |
359 | 359 | : array( 'attributes', $isLabelKey, 'unit' ), |
360 | - $this->aDefaultKeys['attributes']['unit'] |
|
360 | + $this->aDefaultKeys[ 'attributes' ][ 'unit' ] |
|
361 | 361 | ) |
362 | 362 | + $aBaseAttributes; |
363 | 363 | return $_aSelectAttributes; |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | * @return array an size attribute array |
372 | 372 | * @internal |
373 | 373 | */ |
374 | - private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey='' ) { |
|
374 | + private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey = '' ) { |
|
375 | 375 | |
376 | 376 | return array( |
377 | 377 | 'type' => 'number', |
378 | - 'id' => $aField['input_id'] . '_' . ( '' !== $sLabelKey ? $sLabelKey . '_' : '' ) . 'size', |
|
379 | - 'name' => $aField[ '_input_name' ] . ( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ) . '[size]', |
|
378 | + 'id' => $aField[ 'input_id' ].'_'.( '' !== $sLabelKey ? $sLabelKey.'_' : '' ).'size', |
|
379 | + 'name' => $aField[ '_input_name' ].( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ).'[size]', |
|
380 | 380 | 'value' => $this->getElement( |
381 | - $aField, // subject |
|
382 | - array( 'value', 'size' ), // dimensional keys |
|
381 | + $aField, // subject |
|
382 | + array( 'value', 'size' ), // dimensional keys |
|
383 | 383 | '' // default |
384 | 384 | ), |
385 | 385 | ) |
@@ -337,8 +337,8 @@ |
||
337 | 337 | ) + $_aAttributes |
338 | 338 | ); |
339 | 339 | return "<p class='submit-confirm-container'><label>" |
340 | - . $_sInput |
|
341 | - . "<span>{$_aConfirm[ 'label' ]}</span>" |
|
340 | + . $_sInput |
|
341 | + . "<span>{$_aConfirm[ 'label' ]}</span>" |
|
342 | 342 | . "</label></p>"; |
343 | 343 | } |
344 | 344 |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * Defines the field type slugs used for this field type. |
127 | 127 | */ |
128 | - public $aFieldTypeSlugs = array( 'submit', ); |
|
128 | + public $aFieldTypeSlugs = array( 'submit',); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Defines the default key-values of this field type. |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'redirect_url' => null, |
137 | 137 | 'href' => null, |
138 | 138 | 'reset' => null, |
139 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
139 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
140 | 140 | /* |
141 | 141 | array( |
142 | 142 | 'to' => null, // string|array The email address to send to or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | ) |
151 | 151 | */ |
152 | 152 | 'confirm' => '', |
153 | - 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
153 | + 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
154 | 154 | 'attributes' => array( |
155 | 155 | 'class' => 'button button-primary', |
156 | 156 | ), |
157 | - 'save' => false, // 3.9.0+ |
|
157 | + 'save' => false, // 3.9.0+ |
|
158 | 158 | ); |
159 | 159 | |
160 | 160 | /** |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | return array( |
166 | 166 | array( |
167 | 167 | 'handle_id' => 'admin-page-framework-submit-field-type', |
168 | - 'src' => dirname( __FILE__ ) . '/js/submit.bundle.js', |
|
168 | + 'src' => dirname( __FILE__ ).'/js/submit.bundle.js', |
|
169 | 169 | 'in_footer' => true, |
170 | - 'dependencies' => array( 'jquery', ), |
|
170 | + 'dependencies' => array( 'jquery',), |
|
171 | 171 | ), |
172 | 172 | ); |
173 | 173 | } |
@@ -190,17 +190,17 @@ discard block |
||
190 | 190 | |
191 | 191 | return |
192 | 192 | $aField[ 'before_label' ] |
193 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
193 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
194 | 194 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
195 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
195 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
196 | 196 | . $aField[ 'before_input' ] |
197 | 197 | . $this->_getExtraInputFields( $aField ) |
198 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
198 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
199 | 199 | . $aField[ 'after_input' ] |
200 | 200 | . "</label>" |
201 | 201 | . $this->___getConfirmationCheckbox( $aField ) |
202 | 202 | . "</div>" |
203 | - . $aField['after_label']; |
|
203 | + . $aField[ 'after_label' ]; |
|
204 | 204 | |
205 | 205 | } |
206 | 206 | /** |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | if ( empty( $aField[ 'confirm' ] ) ) { |
213 | 213 | return ''; |
214 | 214 | } |
215 | - $_aConfirm = is_string( $aField[ 'confirm' ] ) |
|
215 | + $_aConfirm = is_string( $aField[ 'confirm' ] ) |
|
216 | 216 | ? array( |
217 | 217 | 'label' => $aField[ 'confirm' ] |
218 | 218 | ) |
219 | 219 | : $this->getAsArray( $aField[ 'confirm' ] ); |
220 | - $_aConfirm = $_aConfirm + array( |
|
220 | + $_aConfirm = $_aConfirm + array( |
|
221 | 221 | 'label' => $this->oMsg->get( 'submit_confirmation_label' ), |
222 | 222 | 'error' => $this->oMsg->get( 'submit_confirmation_error' ), |
223 | 223 | ); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | private function ___getLabelAttributes( array $aField, array $aInputAttributes ) { |
269 | 269 | return array( |
270 | 270 | 'style' => $aField[ 'label_min_width' ] |
271 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
271 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
272 | 272 | : null, |
273 | 273 | 'for' => $aInputAttributes[ 'id' ], |
274 | 274 | 'class' => $aInputAttributes[ 'disabled' ] |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | private function ___getLabelContainerAttributes( array $aField ) { |
288 | 288 | return array( |
289 | 289 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
290 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
290 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
291 | 291 | : null, |
292 | 292 | 'class' => 'admin-page-framework-input-label-container' |
293 | 293 | . ' admin-page-framework-input-button-container' |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | protected function _getExtraInputFields( &$aField ) { |
343 | 343 | |
344 | 344 | $_aOutput = array(); |
345 | - $_aOutput[] = $this->getHTMLTag( |
|
345 | + $_aOutput[ ] = $this->getHTMLTag( |
|
346 | 346 | 'input', |
347 | 347 | array( |
348 | 348 | 'type' => 'hidden', |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | 'value' => $aField[ 'input_id' ], |
351 | 351 | ) |
352 | 352 | ); |
353 | - $_aOutput[] = $this->getHTMLTag( |
|
353 | + $_aOutput[ ] = $this->getHTMLTag( |
|
354 | 354 | 'input', |
355 | 355 | array( |
356 | 356 | 'type' => 'hidden', |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | 'value' => $aField[ 'field_id' ], |
359 | 359 | ) |
360 | 360 | ); |
361 | - $_aOutput[] = $this->getHTMLTag( |
|
361 | + $_aOutput[ ] = $this->getHTMLTag( |
|
362 | 362 | 'input', |
363 | 363 | array( |
364 | 364 | 'type' => 'hidden', |
@@ -366,11 +366,11 @@ discard block |
||
366 | 366 | 'value' => $aField[ '_input_name_flat' ], |
367 | 367 | ) |
368 | 368 | ); |
369 | - $_aOutput[] = $this->___getHiddenInput_SectionID( $aField ); |
|
370 | - $_aOutput[] = $this->___getHiddenInputByKey( $aField, 'redirect_url' ); |
|
371 | - $_aOutput[] = $this->___getHiddenInputByKey( $aField, 'href' ); |
|
372 | - $_aOutput[] = $this->___getHiddenInput_Reset( $aField ); |
|
373 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
369 | + $_aOutput[ ] = $this->___getHiddenInput_SectionID( $aField ); |
|
370 | + $_aOutput[ ] = $this->___getHiddenInputByKey( $aField, 'redirect_url' ); |
|
371 | + $_aOutput[ ] = $this->___getHiddenInputByKey( $aField, 'href' ); |
|
372 | + $_aOutput[ ] = $this->___getHiddenInput_Reset( $aField ); |
|
373 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
374 | 374 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
375 | 375 | |
376 | 376 | } |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | 'input', |
388 | 388 | array( |
389 | 389 | 'type' => 'hidden', |
390 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
391 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
392 | - ? $aField['section_id'] |
|
390 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
391 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
392 | + ? $aField[ 'section_id' ] |
|
393 | 393 | : '', |
394 | 394 | ) |
395 | 395 | ); |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | 'input', |
410 | 410 | array( |
411 | 411 | 'type' => 'hidden', |
412 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
412 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
413 | 413 | 'value' => $aField[ $sKey ], |
414 | 414 | ) |
415 | 415 | ) |
@@ -424,15 +424,15 @@ discard block |
||
424 | 424 | * @return string the HTML input tag output for the 'reset' argument. |
425 | 425 | */ |
426 | 426 | private function ___getHiddenInput_Reset( array $aField ) { |
427 | - if ( ! $aField[ 'reset' ] ) { |
|
427 | + if ( !$aField[ 'reset' ] ) { |
|
428 | 428 | return ''; |
429 | 429 | } |
430 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
430 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
431 | 431 | ? $this->getHTMLTag( |
432 | 432 | 'input', |
433 | 433 | array( |
434 | 434 | 'type' => 'hidden', |
435 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
435 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
436 | 436 | 'value' => '1', |
437 | 437 | ) |
438 | 438 | ) |
@@ -466,14 +466,14 @@ discard block |
||
466 | 466 | $this->showDeprecationNotice( 'The <code>email</code> argument has been deprecated.', 'the <code>contact</code> field type' ); |
467 | 467 | } |
468 | 468 | |
469 | - $_sTransientKey = 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ); |
|
469 | + $_sTransientKey = 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ); |
|
470 | 470 | $this->setTransient( |
471 | 471 | $_sTransientKey, |
472 | 472 | array( |
473 | - 'nonce' => $this->getNonceCreated( 'apf_email_nonce_' . md5( ( string ) site_url() ), 86400 ), // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set. |
|
473 | + 'nonce' => $this->getNonceCreated( 'apf_email_nonce_'.md5( ( string ) site_url() ), 86400 ), // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set. |
|
474 | 474 | ) + $this->getAsArray( $aField[ 'email' ] ) |
475 | 475 | ); |
476 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
476 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
477 | 477 | ? $this->getHTMLTag( |
478 | 478 | 'input', |
479 | 479 | array( |
@@ -501,18 +501,18 @@ discard block |
||
501 | 501 | * @return boolean |
502 | 502 | * @internal |
503 | 503 | */ |
504 | - protected function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) { |
|
504 | + protected function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) { |
|
505 | 505 | |
506 | - switch( $sType ) { |
|
506 | + switch ( $sType ) { |
|
507 | 507 | default: |
508 | 508 | case 'reset': // admin page framework _ reset confirmation |
509 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
509 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
510 | 510 | break; |
511 | 511 | case 'email': // admin page framework _ email confirmation |
512 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
512 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
513 | 513 | break; |
514 | 514 | } |
515 | - $_bConfirmed = ! ( false === $this->getTransient( $_sTransientKey ) && ! $aField['skip_confirmation'] ); |
|
515 | + $_bConfirmed = !( false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ] ); |
|
516 | 516 | if ( $_bConfirmed ) { |
517 | 517 | $this->deleteTransient( $_sTransientKey ); |
518 | 518 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @return array The label container attribute array. |
285 | 285 | * @internal |
286 | 286 | */ |
287 | - private function ___getLabelContainerAttributes( array $aField ) { |
|
287 | + private function ___getLabelContainerAttributes( array $aField ) { |
|
288 | 288 | return array( |
289 | 289 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
290 | 290 | ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
@@ -537,19 +537,19 @@ discard block |
||
537 | 537 | * @internal |
538 | 538 | * @param array $aField |
539 | 539 | */ |
540 | - protected function _getInputFieldValueFromLabel( $aField ) { |
|
540 | + protected function _getInputFieldValueFromLabel( $aField ) { |
|
541 | 541 | |
542 | 542 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
543 | - if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
543 | + if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
544 | 544 | return $aField[ 'value' ]; |
545 | 545 | } |
546 | 546 | |
547 | - if ( isset( $aField[ 'label' ] ) ) { |
|
547 | + if ( isset( $aField[ 'label' ] ) ) { |
|
548 | 548 | return $aField[ 'label' ]; |
549 | 549 | } |
550 | 550 | |
551 | 551 | // If the default value is set, |
552 | - if ( isset( $aField[ 'default' ] ) ) { |
|
552 | + if ( isset( $aField[ 'default' ] ) ) { |
|
553 | 553 | return $aField[ 'default' ]; |
554 | 554 | } |
555 | 555 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Defines the field type slugs used for this field type. |
40 | 40 | */ |
41 | - public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week', ); |
|
41 | + public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week',); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Defines the default key-values of this field type. |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function getField( $aField ) { |
59 | 59 | $_aOutput = array(); |
60 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
61 | - $_aOutput[] = $this->___getFieldOutputByLabel( |
|
60 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
61 | + $_aOutput[ ] = $this->___getFieldOutputByLabel( |
|
62 | 62 | $_sKey, |
63 | 63 | $_sLabel, |
64 | 64 | $aField |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | // the repeatable field buttons will be replaced with this element. |
68 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
68 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
69 | 69 | return implode( '', $_aOutput ); |
70 | 70 | } |
71 | 71 | /** |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $aField[ 'value' ] = $this->getElementByLabel( $aField[ 'value' ], $sKey, $aField[ 'label' ] ); |
82 | 82 | $_aInputAttributes = $_bIsArray |
83 | 83 | ? array( |
84 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
85 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
84 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
85 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
86 | 86 | 'value' => $aField[ 'value' ], |
87 | 87 | ) |
88 | 88 | + $this->getAsArray( |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | ) // 3.8.6+ Allows the user to set individual attributes by label. |
91 | 91 | + $aField[ 'attributes' ] |
92 | 92 | : $aField[ 'attributes' ]; |
93 | - $_aOutput = array( |
|
93 | + $_aOutput = array( |
|
94 | 94 | $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
95 | 95 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
96 | - "<label for='" . $_aInputAttributes[ 'id' ] . "'>", |
|
96 | + "<label for='".$_aInputAttributes[ 'id' ]."'>", |
|
97 | 97 | $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
98 | 98 | $_sLabel |
99 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
99 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
100 | 100 | . $_sLabel |
101 | 101 | . "</span>" |
102 | 102 | : '', |
103 | - "<input " . $this->getAttributes( $_aInputAttributes ) . " />", |
|
103 | + "<input ".$this->getAttributes( $_aInputAttributes )." />", |
|
104 | 104 | $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
105 | 105 | "</label>", |
106 | 106 | "</div>", |
@@ -219,7 +219,7 @@ |
||
219 | 219 | * </code> |
220 | 220 | * @access public This must be public as accessed from outside. |
221 | 221 | */ |
222 | - public $aFieldTypeSlugs = array( 'default', ); |
|
222 | + public $aFieldTypeSlugs = array( 'default',); |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Defines the default key-values of this field type. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'after_label' => null, |
60 | 60 | 'before_field' => null, |
61 | 61 | 'after_field' => null, |
62 | - 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
62 | + 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
63 | 63 | 'before_fieldset' => null, // 3.1.1+ |
64 | 64 | 'after_fieldset' => null, // 3.1.1+ |
65 | 65 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param object $oMsg The framework message object. |
100 | 100 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
101 | 101 | */ |
102 | - public function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
102 | + public function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
103 | 103 | |
104 | 104 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) |
105 | 105 | ? $this->aFieldTypeSlugs |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
112 | 112 | if ( $bAutoRegister ) { |
113 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
113 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
114 | 114 | add_filter( |
115 | - 'field_types_' . $_sClassName, |
|
115 | + 'field_types_'.$_sClassName, |
|
116 | 116 | array( $this, '_replyToRegisterInputFieldType' ) |
117 | 117 | ); |
118 | 118 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | } |
162 | 162 | return is_array( $asLabel ) // if the user sets multiple items |
163 | 163 | ? $this->getElement( |
164 | - $asElement, // subject |
|
165 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
164 | + $asElement, // subject |
|
165 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
166 | 166 | '' // default - if the element is not found, return an empty |
167 | 167 | ) |
168 | 168 | : $asElement; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | protected function getFieldOutput( array $aFieldset ) { |
180 | 180 | |
181 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
181 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
182 | 182 | return ''; |
183 | 183 | } |
184 | 184 | |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
187 | 187 | |
188 | 188 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
189 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
189 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
190 | 190 | |
191 | 191 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
192 | - $aFieldset, // the field definition array |
|
193 | - $_oCallerForm->aSavedData, // the stored form data |
|
194 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | - $_oCallerForm->oMsg, // the system message object |
|
192 | + $aFieldset, // the field definition array |
|
193 | + $_oCallerForm->aSavedData, // the stored form data |
|
194 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | + $_oCallerForm->oMsg, // the system message object |
|
197 | 197 | $_oCallerForm->aCallbacks // field output element callables. |
198 | 198 | ); |
199 | 199 | return $_oFieldset->get(); |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | * @return array |
238 | 238 | * @internal |
239 | 239 | */ |
240 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
240 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
241 | 241 | |
242 | 242 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
243 | 243 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
244 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
245 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
246 | - : self::$_aDefaultKeys['attributes']; |
|
244 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
245 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
246 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
247 | 247 | |
248 | 248 | return array( |
249 | 249 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param string $sFieldSetType |
290 | 290 | * @internal |
291 | 291 | */ |
292 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
292 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
293 | 293 | $this->_sFieldSetType = $sFieldSetType; |
294 | 294 | } |
295 | 295 | |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | wp_enqueue_script( 'media-upload' ); |
345 | 345 | } |
346 | 346 | |
347 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
348 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
347 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
348 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
364 | 364 | |
365 | 365 | // Replace the button label in the media thick box. |
366 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
366 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
367 | 367 | return $sTranslated; |
368 | 368 | } |
369 | 369 | if ( $sText !== 'Insert into Post' ) { |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
398 | 398 | |
399 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
399 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
400 | 400 | return $aTabs; |
401 | 401 | } |
402 | - if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
402 | + if ( !( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
403 | 403 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
404 | 404 | } |
405 | 405 | return $aTabs; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @return string |
418 | 418 | * @since 3.8.0 |
419 | 419 | */ |
420 | - protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes=array() ) { |
|
420 | + protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes = array() ) { |
|
421 | 421 | |
422 | 422 | $aAttributes[ 'class' ] = $this->getClassAttribute( $asClassAttributes, $this->getElement( $aAttributes, 'class' ) ); |
423 | 423 | $aAttributes[ 'style' ] = $this->getStyleAttribute( |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | wp_enqueue_script( 'media-upload' ); |
345 | 345 | } |
346 | 346 | |
347 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
347 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
348 | 348 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
349 | 349 | } |
350 | 350 | |
@@ -374,17 +374,18 @@ discard block |
||
374 | 374 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
375 | 375 | |
376 | 376 | // Replace the button label in the media thick box. |
377 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
377 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
378 | 378 | return $sTranslated; |
379 | 379 | } |
380 | - if ( $sText !== 'Insert into Post' ) { |
|
380 | + if ( $sText !== 'Insert into Post' ) { |
|
381 | 381 | return $sTranslated; |
382 | 382 | } |
383 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
383 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
384 | 384 | return $sTranslated; |
385 | 385 | } |
386 | 386 | |
387 | - if ( isset( $_GET[ 'button_label' ] ) ) { // sanitization unnecessary |
|
387 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
388 | +// sanitization unnecessary |
|
388 | 389 | return $this->getHTTPQueryGET( 'button_label', '' ); |
389 | 390 | } |
390 | 391 | |
@@ -407,10 +408,12 @@ discard block |
||
407 | 408 | */ |
408 | 409 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
409 | 410 | |
410 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
411 | + if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
412 | +// sanitization unnecessary |
|
411 | 413 | return $aTabs; |
412 | 414 | } |
413 | - if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
415 | + if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { |
|
416 | +// sanitization unnecessary |
|
414 | 417 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
415 | 418 | } |
416 | 419 | return $aTabs; |