@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | return self::getAttributes( $_aAttriubtes ) . ' ' . self::getDataAttributes( $aArguments ); |
514 | 514 | } |
515 | 515 | /** |
516 | - * @return array |
|
516 | + * @return string |
|
517 | 517 | * @sicne 3.8.13 |
518 | 518 | */ |
519 | 519 | static private function ___getRemoveButtonAttributes( $sContainerTagID, $oMsg, $iSectionCount ) { |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | |
533 | 533 | /** |
534 | 534 | * @since 3.8.13 |
535 | - * @return array |
|
535 | + * @return string |
|
536 | 536 | */ |
537 | 537 | static private function ___getAddButtonAttributes( $sContainerTagID, $oMsg, $aArguments ) { |
538 | 538 | return self::getAttributes( |
@@ -520,7 +520,7 @@ |
||
520 | 520 | return self::getAttributes( |
521 | 521 | array( |
522 | 522 | 'class' => 'repeatable-section-remove-button button-secondary ' |
523 | - . 'repeatable-section-button button button-large', |
|
523 | + . 'repeatable-section-button button button-large', |
|
524 | 524 | 'title' => $oMsg->get( 'remove_section' ), |
525 | 525 | 'style' => $iSectionCount <= 1 |
526 | 526 | ? 'display:none' |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | if ( empty( $asArguments ) ) { |
441 | 441 | return ''; |
442 | 442 | } |
443 | - if ( self::hasBeenCalled( 'repeatable_section_' . $sContainerTagID ) ) { |
|
443 | + if ( self::hasBeenCalled( 'repeatable_section_'.$sContainerTagID ) ) { |
|
444 | 444 | return ''; |
445 | 445 | } |
446 | 446 | |
@@ -448,16 +448,16 @@ discard block |
||
448 | 448 | $_oFormatter = new AdminPageFramework_Form_Model___Format_RepeatableSection( $asArguments, $oMsg ); |
449 | 449 | $_aArguments = $_oFormatter->get(); |
450 | 450 | $_sButtons = "<div class='admin-page-framework-repeatable-section-buttons-outer-container'>" |
451 | - . "<div " . self::___getContainerAttributes( $_aArguments, $oMsg ) . ' >' |
|
452 | - . "<a " . self::___getRemoveButtonAttributes( $sContainerTagID, $oMsg, $iSectionCount ) . ">-</a>" |
|
453 | - . "<a " . self::___getAddButtonAttributes( $sContainerTagID, $oMsg, $_aArguments ) . ">+</a>" |
|
451 | + . "<div ".self::___getContainerAttributes( $_aArguments, $oMsg ).' >' |
|
452 | + . "<a ".self::___getRemoveButtonAttributes( $sContainerTagID, $oMsg, $iSectionCount ).">-</a>" |
|
453 | + . "<a ".self::___getAddButtonAttributes( $sContainerTagID, $oMsg, $_aArguments ).">+</a>" |
|
454 | 454 | . "</div>" |
455 | 455 | . "</div>" |
456 | 456 | . AdminPageFramework_Form_Utility::getModalForDisabledRepeatableElement( |
457 | - 'repeatable_section_disabled_' . $sContainerTagID, |
|
457 | + 'repeatable_section_disabled_'.$sContainerTagID, |
|
458 | 458 | $_aArguments[ 'disabled' ] |
459 | 459 | ); |
460 | - $_sButtonsHTML = '"' . $_sButtons . '"'; |
|
460 | + $_sButtonsHTML = '"'.$_sButtons.'"'; |
|
461 | 461 | $_aJSArray = json_encode( $_aArguments ); |
462 | 462 | $_sScript = <<<JAVASCRIPTS |
463 | 463 | jQuery( document ).ready( function() { |
@@ -504,12 +504,12 @@ discard block |
||
504 | 504 | empty( $aArguments[ 'disabled' ] ) ? '' : 'disabled' |
505 | 505 | ), |
506 | 506 | ); |
507 | - unset( $aArguments[ 'disabled' ][ 'message' ] ); // this element can contain HTML tags. |
|
507 | + unset( $aArguments[ 'disabled' ][ 'message' ] ); // this element can contain HTML tags. |
|
508 | 508 | // Needs to remove it if it is empty as its data attribute will be checked in the JavaScript script. |
509 | 509 | if ( empty( $aArguments[ 'disabled' ] ) ) { |
510 | 510 | unset( $aArguments[ 'disabled' ] ); |
511 | 511 | } |
512 | - return self::getAttributes( $_aAttriubtes ) . ' ' . self::getDataAttributes( $aArguments ); |
|
512 | + return self::getAttributes( $_aAttriubtes ).' '.self::getDataAttributes( $aArguments ); |
|
513 | 513 | } |
514 | 514 | /** |
515 | 515 | * @return array |
@@ -540,10 +540,10 @@ discard block |
||
540 | 540 | . 'repeatable-section-button button button-large', |
541 | 541 | 'title' => $oMsg->get( 'add_section' ), |
542 | 542 | 'data-id' => $sContainerTagID, |
543 | - 'href' => ! empty( $aArguments[ 'disabled' ] ) |
|
544 | - ? '#TB_inline?width=' . $aArguments[ 'disabled' ][ 'box_width' ] |
|
545 | - . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
546 | - . '&inlineId=' . 'repeatable_section_disabled_' . $sContainerTagID |
|
543 | + 'href' => !empty( $aArguments[ 'disabled' ] ) |
|
544 | + ? '#TB_inline?width='.$aArguments[ 'disabled' ][ 'box_width' ] |
|
545 | + . '&height='.$aArguments[ 'disabled' ][ 'box_height' ] |
|
546 | + . '&inlineId='.'repeatable_section_disabled_'.$sContainerTagID |
|
547 | 547 | : null, |
548 | 548 | ) |
549 | 549 | ); |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | * @since 3.8.13 |
37 | 37 | */ |
38 | 38 | static protected $_aStructure_Disabled = array( |
39 | - 'message' => 'The ability of repeating sections is disabled.', // will be reassigned |
|
40 | - 'caption' => 'Warning', // will be reassigned |
|
39 | + 'message' => 'The ability of repeating sections is disabled.', // will be reassigned |
|
40 | + 'caption' => 'Warning', // will be reassigned |
|
41 | 41 | 'box_width' => 300, |
42 | 42 | 'box_height' => 72, |
43 | 43 | ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function __construct( /* array $asArguments, $oMsg */ ) { |
56 | 56 | |
57 | - $_aParameters = func_get_args() + array( |
|
57 | + $_aParameters = func_get_args() + array( |
|
58 | 58 | $this->_aArguments, |
59 | 59 | null |
60 | 60 | ); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | public function get() { |
74 | 74 | |
75 | 75 | $_aArguments = $this->_aArguments + self::$_aStructure; |
76 | - unset( $_aArguments[ 0 ] ); // remove the 0 index element converted from `'repeatable => 'true',`. |
|
77 | - if ( ! empty( $_aArguments[ 'disabled' ] ) ) { |
|
76 | + unset( $_aArguments[ 0 ] ); // remove the 0 index element converted from `'repeatable => 'true',`. |
|
77 | + if ( !empty( $_aArguments[ 'disabled' ] ) ) { |
|
78 | 78 | $_aArguments[ 'disabled' ] = $_aArguments[ 'disabled' ] + array( |
79 | 79 | 'message' => $this->_getDefaultMessage(), |
80 | 80 | 'caption' => $this->_oMsg->get( 'warning_caption' ), |
@@ -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 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | } |
159 | 159 | return is_array( $asLabel ) // if the user sets multiple items |
160 | 160 | ? $this->getElement( |
161 | - $asElement, // subject |
|
162 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
161 | + $asElement, // subject |
|
162 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
163 | 163 | '' // default - if the element is not found, return an empty |
164 | 164 | ) |
165 | 165 | : $asElement; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | protected function getFieldOutput( array $aFieldset ) { |
176 | 176 | |
177 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
177 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
178 | 178 | return ''; |
179 | 179 | } |
180 | 180 | |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
183 | 183 | |
184 | 184 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
185 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
185 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
186 | 186 | |
187 | 187 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
188 | - $aFieldset, // the field definition array |
|
189 | - $_oCallerForm->aSavedData, // the stored form data |
|
190 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | - $_oCallerForm->oMsg, // the system message object |
|
188 | + $aFieldset, // the field definition array |
|
189 | + $_oCallerForm->aSavedData, // the stored form data |
|
190 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | + $_oCallerForm->oMsg, // the system message object |
|
193 | 193 | $_oCallerForm->aCallbacks // field output element callables. |
194 | 194 | ); |
195 | 195 | return $_oFieldset->get(); |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | * @since 3.0.3 Tweaked it to have better execution speed. |
230 | 230 | * @internal |
231 | 231 | */ |
232 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
232 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
233 | 233 | |
234 | 234 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
235 | 235 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
236 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
237 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
238 | - : self::$_aDefaultKeys['attributes']; |
|
236 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
237 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
238 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
239 | 239 | |
240 | 240 | return array( |
241 | 241 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @since 3.0.0 |
274 | 274 | * @internal |
275 | 275 | */ |
276 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
276 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
277 | 277 | $this->_sFieldSetType = $sFieldSetType; |
278 | 278 | } |
279 | 279 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | wp_enqueue_script( 'media-upload' ); |
328 | 328 | } |
329 | 329 | |
330 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
331 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
330 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
331 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
344 | 344 | |
345 | 345 | // Replace the button label in the media thick box. |
346 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
346 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
347 | 347 | return $sTranslated; |
348 | 348 | } |
349 | 349 | if ( $sText !== 'Insert into Post' ) { |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | return $sTranslated; |
354 | 354 | } |
355 | 355 | |
356 | - if ( isset( $_GET['button_label'] ) ) { |
|
357 | - return $_GET['button_label']; |
|
356 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
357 | + return $_GET[ 'button_label' ]; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | return $this->oProp->sThickBoxButtonUseThis |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
375 | 375 | |
376 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
376 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
377 | 377 | return $aTabs; |
378 | 378 | } |
379 | 379 | |
380 | - if ( ! $_REQUEST[ 'enable_external_source' ] ) { |
|
380 | + if ( !$_REQUEST[ 'enable_external_source' ] ) { |
|
381 | 381 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
382 | 382 | } |
383 | 383 | return $aTabs; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * @since 3.8.0 |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes=array() ) { |
|
395 | + protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes = array() ) { |
|
396 | 396 | |
397 | 397 | $aAttributes[ 'class' ] = $this->getClassAttribute( $asClassAttributes, $this->getElement( $aAttributes, 'class' ) ); |
398 | 398 | $aAttributes[ 'style' ] = $this->getStyleAttribute( |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | wp_enqueue_script( 'thickbox' ); |
321 | 321 | wp_enqueue_style( 'thickbox' ); |
322 | 322 | |
323 | - if ( function_exists( 'wp_enqueue_media' ) ) { |
|
323 | + if ( function_exists( 'wp_enqueue_media' ) ) { |
|
324 | 324 | // If the WordPress version is 3.5 or above, |
325 | 325 | new AdminPageFramework_Form_View___Script_MediaUploader( $this->oMsg ); |
326 | 326 | } else { |
327 | 327 | wp_enqueue_script( 'media-upload' ); |
328 | 328 | } |
329 | 329 | |
330 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
330 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
331 | 331 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
332 | 332 | } |
333 | 333 | |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
344 | 344 | |
345 | 345 | // Replace the button label in the media thick box. |
346 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
346 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
347 | 347 | return $sTranslated; |
348 | 348 | } |
349 | - if ( $sText !== 'Insert into Post' ) { |
|
349 | + if ( $sText !== 'Insert into Post' ) { |
|
350 | 350 | return $sTranslated; |
351 | 351 | } |
352 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
352 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
353 | 353 | return $sTranslated; |
354 | 354 | } |
355 | 355 | |
356 | - if ( isset( $_GET['button_label'] ) ) { |
|
356 | + if ( isset( $_GET['button_label'] ) ) { |
|
357 | 357 | return $_GET['button_label']; |
358 | 358 | } |
359 | 359 |
@@ -390,6 +390,7 @@ |
||
390 | 390 | * This is used for element that `label_min_width` is applied. |
391 | 391 | * |
392 | 392 | * @since 3.8.0 |
393 | + * @param string $asClassAttributes |
|
393 | 394 | * @return string |
394 | 395 | */ |
395 | 396 | protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes=array() ) { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | public function _replyToRegisterHelpTabText() { |
30 | 30 | |
31 | 31 | // Check if the currently loaded page is of meta box page. |
32 | - if ( ! $this->oProp->oCaller->isInThePage() ) { |
|
32 | + if ( !$this->oProp->oCaller->isInThePage() ) { |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @access public |
219 | 219 | * @remark The actual registration will be performed in the `_replyToRegisterSettings()` method with the `admin_menu` hook. |
220 | 220 | * @remark The `$oForm` property should be created in each extended class. |
221 | - * @param array|string $aSection the section array. If a string is passed, it is considered as a target page slug that will be used as a page slug element from the next call so that the element can be omitted. |
|
221 | + * @param array|string $aSectionset the section array. If a string is passed, it is considered as a target page slug that will be used as a page slug element from the next call so that the element can be omitted. |
|
222 | 222 | * <h4>Section Definition Array</h4> |
223 | 223 | * <ul> |
224 | 224 | * <li>**section_id** - (string) the section ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @since 3.0.0 The scope changed to public to indicate the users will use. |
348 | 348 | * @return void |
349 | 349 | * @remark The $oForm property should be created in each extended class. |
350 | - * @param array|string $asField A field definition array or a string of the target section id. |
|
350 | + * @param array|string $asFieldset A field definition array or a string of the target section id. |
|
351 | 351 | * <h4>Built-in Field Types</h4> |
352 | 352 | * <ul> |
353 | 353 | * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
309 | - * Adds form fields. |
|
310 | - * |
|
311 | - * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
312 | - * |
|
313 | - * @since 2.0.0 |
|
314 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
315 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
316 | - * @param array the field definition array. |
|
317 | - * @param array (optional) another field array. |
|
318 | - * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
319 | - * @return void |
|
320 | - */ |
|
309 | + * Adds form fields. |
|
310 | + * |
|
311 | + * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
312 | + * |
|
313 | + * @since 2.0.0 |
|
314 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
315 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
316 | + * @param array the field definition array. |
|
317 | + * @param array (optional) another field array. |
|
318 | + * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
319 | + * @return void |
|
320 | + */ |
|
321 | 321 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
322 | 322 | foreach( func_get_args() as $_aFieldset ) { |
323 | 323 | $this->addSettingField( $_aFieldset ); |
@@ -348,57 +348,57 @@ discard block |
||
348 | 348 | * @return void |
349 | 349 | * @remark The $oForm property should be created in each extended class. |
350 | 350 | * @param array|string $asField A field definition array or a string of the target section id. |
351 | - * <h4>Built-in Field Types</h4> |
|
352 | - * <ul> |
|
353 | - * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
354 | - * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
355 | - * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
356 | - * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
357 | - * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
358 | - * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
359 | - * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
360 | - * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
361 | - * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
362 | - * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
363 | - * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
364 | - * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
365 | - * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
366 | - * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
367 | - * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
368 | - * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
369 | - * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
370 | - * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
371 | - * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
372 | - * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
373 | - * </ul> |
|
374 | - * <h4>Field Definition Arguments</h4> |
|
375 | - * <ul> |
|
376 | - * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
377 | - * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
378 | - * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
379 | - * <li>**title** - (optional, string) the title of the section.</li> |
|
380 | - * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
381 | - * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
382 | - * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
383 | - * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
384 | - * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
385 | - * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
386 | - * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
387 | - * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
388 | - * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
389 | - * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
390 | - * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
391 | - * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
392 | - * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
393 | - * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
394 | - * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
395 | - * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
396 | - * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
397 | - * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
398 | - * <h5>Repeatable Fields Setting Array</h5> |
|
399 | - * <ul> |
|
400 | - * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
401 | - * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
351 | + * <h4>Built-in Field Types</h4> |
|
352 | + * <ul> |
|
353 | + * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
354 | + * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
355 | + * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
356 | + * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
357 | + * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
358 | + * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
359 | + * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
360 | + * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
361 | + * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
362 | + * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
363 | + * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
364 | + * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
365 | + * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
366 | + * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
367 | + * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
368 | + * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
369 | + * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
370 | + * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
371 | + * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
372 | + * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
373 | + * </ul> |
|
374 | + * <h4>Field Definition Arguments</h4> |
|
375 | + * <ul> |
|
376 | + * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
377 | + * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
378 | + * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
379 | + * <li>**title** - (optional, string) the title of the section.</li> |
|
380 | + * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
381 | + * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
382 | + * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
383 | + * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
384 | + * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
385 | + * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
386 | + * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
387 | + * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
388 | + * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
389 | + * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
390 | + * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
391 | + * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
392 | + * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
393 | + * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
394 | + * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
395 | + * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
396 | + * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
397 | + * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
398 | + * <h5>Repeatable Fields Setting Array</h5> |
|
399 | + * <ul> |
|
400 | + * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
401 | + * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
402 | 402 | * <li>**disabled** - (optional, boolean|array) [3.8.13+] |
403 | 403 | * <ul> |
404 | 404 | * <li>**message** - (optional, string) the message to show when the user clicks on the `Add` repeatable button.</li> |
@@ -407,108 +407,108 @@ discard block |
||
407 | 407 | * <li>**box_width** - (optional, integer) the height of the modal window that displays the message. Default: 100.</li> |
408 | 408 | * <ul> |
409 | 409 | * </li> |
410 | - * </ul> |
|
411 | - * </li> |
|
412 | - * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
413 | - * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
414 | - * <ul> |
|
415 | - * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
416 | - * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
417 | - * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
418 | - * <li>**field** - the `div` tag element containing each field.</li> |
|
419 | - * </ul> |
|
420 | - * </li> |
|
421 | - * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
422 | - * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
423 | - * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
424 | - * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
425 | - * <h4>Example</h4> |
|
426 | - * <pre><code> |
|
427 | - * $this->addSettingFields( |
|
428 | - * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
429 | - * array( |
|
430 | - * 'field_id' => 'Y', |
|
431 | - * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
432 | - * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
433 | - * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
434 | - * 'content' => array( |
|
435 | - * array( |
|
436 | - * 'field_id' => 'i', |
|
437 | - * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
438 | - * 'type' => 'textarea', |
|
439 | - * ), |
|
440 | - * array( |
|
441 | - * 'field_id' => 'ii', |
|
442 | - * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
443 | - * 'type' => 'color', |
|
444 | - * ), |
|
445 | - * array( |
|
446 | - * 'field_id' => 'iii', |
|
447 | - * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
448 | - * 'repeatable' => true, |
|
449 | - * 'sortable' => true, |
|
450 | - * 'content' => array( |
|
451 | - * array( |
|
452 | - * 'field_id' => 'a', |
|
453 | - * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
454 | - * 'type' => 'image', |
|
455 | - * 'attributes' => array( |
|
456 | - * 'preview' => array( |
|
457 | - * 'style' => 'max-width: 200px;', |
|
458 | - * ), |
|
459 | - * ), |
|
460 | - * ), |
|
461 | - * array( |
|
462 | - * 'field_id' => 'b', |
|
463 | - * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
464 | - * 'content' => array( |
|
465 | - * array( |
|
466 | - * 'field_id' => 'first', |
|
467 | - * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
468 | - * 'type' => 'color', |
|
469 | - * 'repeatable' => true, |
|
470 | - * 'sortable' => true, |
|
471 | - * ), |
|
472 | - * array( |
|
473 | - * 'field_id' => 'second', |
|
474 | - * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
475 | - * 'type' => 'size', |
|
476 | - * ), |
|
477 | - * array( |
|
478 | - * 'field_id' => 'third', |
|
479 | - * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
480 | - * 'type' => 'select', |
|
481 | - * 'label' => array( |
|
482 | - * 'x' => 'X', |
|
483 | - * 'y' => 'Y', |
|
484 | - * 'z' => 'Z', |
|
485 | - * ), |
|
486 | - * ), |
|
487 | - * ), |
|
488 | - * // 'description' => '', |
|
489 | - * ), |
|
490 | - * array( |
|
491 | - * 'field_id' => 'c', |
|
492 | - * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
493 | - * 'type' => 'radio', |
|
494 | - * 'label' => array( |
|
495 | - * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
496 | - * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
497 | - * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
498 | - * ), |
|
499 | - * 'default' => 'b', |
|
500 | - * ), |
|
501 | - * ) |
|
502 | - * ), |
|
503 | - * ), |
|
504 | - * ) |
|
505 | - * ); |
|
506 | - * </code></pre> |
|
507 | - * </li> |
|
508 | - * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
509 | - * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
510 | - * </ul> |
|
511 | - */ |
|
410 | + * </ul> |
|
411 | + * </li> |
|
412 | + * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
413 | + * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
414 | + * <ul> |
|
415 | + * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
416 | + * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
417 | + * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
418 | + * <li>**field** - the `div` tag element containing each field.</li> |
|
419 | + * </ul> |
|
420 | + * </li> |
|
421 | + * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
422 | + * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
423 | + * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
424 | + * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
425 | + * <h4>Example</h4> |
|
426 | + * <pre><code> |
|
427 | + * $this->addSettingFields( |
|
428 | + * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
429 | + * array( |
|
430 | + * 'field_id' => 'Y', |
|
431 | + * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
432 | + * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
433 | + * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
434 | + * 'content' => array( |
|
435 | + * array( |
|
436 | + * 'field_id' => 'i', |
|
437 | + * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
438 | + * 'type' => 'textarea', |
|
439 | + * ), |
|
440 | + * array( |
|
441 | + * 'field_id' => 'ii', |
|
442 | + * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
443 | + * 'type' => 'color', |
|
444 | + * ), |
|
445 | + * array( |
|
446 | + * 'field_id' => 'iii', |
|
447 | + * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
448 | + * 'repeatable' => true, |
|
449 | + * 'sortable' => true, |
|
450 | + * 'content' => array( |
|
451 | + * array( |
|
452 | + * 'field_id' => 'a', |
|
453 | + * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
454 | + * 'type' => 'image', |
|
455 | + * 'attributes' => array( |
|
456 | + * 'preview' => array( |
|
457 | + * 'style' => 'max-width: 200px;', |
|
458 | + * ), |
|
459 | + * ), |
|
460 | + * ), |
|
461 | + * array( |
|
462 | + * 'field_id' => 'b', |
|
463 | + * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
464 | + * 'content' => array( |
|
465 | + * array( |
|
466 | + * 'field_id' => 'first', |
|
467 | + * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
468 | + * 'type' => 'color', |
|
469 | + * 'repeatable' => true, |
|
470 | + * 'sortable' => true, |
|
471 | + * ), |
|
472 | + * array( |
|
473 | + * 'field_id' => 'second', |
|
474 | + * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
475 | + * 'type' => 'size', |
|
476 | + * ), |
|
477 | + * array( |
|
478 | + * 'field_id' => 'third', |
|
479 | + * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
480 | + * 'type' => 'select', |
|
481 | + * 'label' => array( |
|
482 | + * 'x' => 'X', |
|
483 | + * 'y' => 'Y', |
|
484 | + * 'z' => 'Z', |
|
485 | + * ), |
|
486 | + * ), |
|
487 | + * ), |
|
488 | + * // 'description' => '', |
|
489 | + * ), |
|
490 | + * array( |
|
491 | + * 'field_id' => 'c', |
|
492 | + * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
493 | + * 'type' => 'radio', |
|
494 | + * 'label' => array( |
|
495 | + * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
496 | + * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
497 | + * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
498 | + * ), |
|
499 | + * 'default' => 'b', |
|
500 | + * ), |
|
501 | + * ) |
|
502 | + * ), |
|
503 | + * ), |
|
504 | + * ) |
|
505 | + * ); |
|
506 | + * </code></pre> |
|
507 | + * </li> |
|
508 | + * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
509 | + * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
510 | + * </ul> |
|
511 | + */ |
|
512 | 512 | public function addSettingField( $asFieldset ) { |
513 | 513 | if ( method_exists( $this->oForm, 'addField' ) ) { |
514 | 514 | $this->oForm->addField( $asFieldset ); |
@@ -572,28 +572,28 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
575 | - * Sets the given message to be displayed in the next page load. |
|
576 | - * |
|
577 | - * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
578 | - * and normally used in validation callback methods. |
|
579 | - * |
|
580 | - * <h4>Example</h4> |
|
581 | - * ` |
|
582 | - * if ( ! $bVerified ) { |
|
583 | - * $this->setFieldErrors( $aErrors ); |
|
584 | - * $this->setSettingNotice( 'There was an error in your input.' ); |
|
585 | - * return $aOldPageOptions; |
|
586 | - * } |
|
587 | - * ` |
|
588 | - * |
|
589 | - * @since 3.0.4 |
|
590 | - * @access public |
|
591 | - * @param string $sMessage the text message to be displayed. |
|
592 | - * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
593 | - * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
594 | - * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
595 | - * @return void |
|
596 | - */ |
|
575 | + * Sets the given message to be displayed in the next page load. |
|
576 | + * |
|
577 | + * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
578 | + * and normally used in validation callback methods. |
|
579 | + * |
|
580 | + * <h4>Example</h4> |
|
581 | + * ` |
|
582 | + * if ( ! $bVerified ) { |
|
583 | + * $this->setFieldErrors( $aErrors ); |
|
584 | + * $this->setSettingNotice( 'There was an error in your input.' ); |
|
585 | + * return $aOldPageOptions; |
|
586 | + * } |
|
587 | + * ` |
|
588 | + * |
|
589 | + * @since 3.0.4 |
|
590 | + * @access public |
|
591 | + * @param string $sMessage the text message to be displayed. |
|
592 | + * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
593 | + * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
594 | + * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
595 | + * @return void |
|
596 | + */ |
|
597 | 597 | public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
598 | 598 | $this->oForm->setSubmitNotice( |
599 | 599 | $sMessage, |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return array|string |
54 | 54 | * @since 3.7.0 |
55 | 55 | */ |
56 | - public function getMessage( $sKey='' ) { |
|
56 | + public function getMessage( $sKey = '' ) { |
|
57 | 57 | return $this->oMsg->get( $sKey ); |
58 | 58 | } |
59 | 59 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return array The array holing the queued items. |
74 | 74 | * @internal |
75 | 75 | */ |
76 | - public function enqueueStyles( $aSRCs, $_vArg2=null ) {} |
|
76 | + public function enqueueStyles( $aSRCs, $_vArg2 = null ) {} |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Enqueues a style of the given source. |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return string The style handle ID. If the passed url is not a valid url string, an empty string will be returned. |
94 | 94 | * @internal |
95 | 95 | */ |
96 | - public function enqueueStyle( $sSRC, $_vArg2=null ) {} |
|
96 | + public function enqueueStyle( $sSRC, $_vArg2 = null ) {} |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Enqueues scripts by the given sources. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return array The array holding the queued items. |
115 | 115 | * @internal |
116 | 116 | */ |
117 | - public function enqueueScripts( $aSRCs, $_vArg2=null ) {} |
|
117 | + public function enqueueScripts( $aSRCs, $_vArg2 = null ) {} |
|
118 | 118 | /** |
119 | 119 | * Enqueues a script by the given source. |
120 | 120 | * |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
147 | 147 | * @internal |
148 | 148 | */ |
149 | - public function enqueueScript( $sSRC, $_vArg2=null ) {} |
|
149 | + public function enqueueScript( $sSRC, $_vArg2 = null ) {} |
|
150 | 150 | |
151 | 151 | /* |
152 | 152 | * Help Pane |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @since 2.1.0 |
165 | 165 | * @remark This method just adds the given text into the class property. The actual registration will be performed with the `replyToRegisterHelpTabTextForMetaBox()` method. |
166 | 166 | */ |
167 | - public function addHelpText( $sHTMLContent, $sHTMLSidebarContent="" ) { |
|
167 | + public function addHelpText( $sHTMLContent, $sHTMLSidebarContent = "" ) { |
|
168 | 168 | if ( method_exists( $this->oHelpPane, '_addHelpText' ) ) { |
169 | 169 | $this->oHelpPane->_addHelpText( $sHTMLContent, $sHTMLSidebarContent ); |
170 | 170 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
202 | 202 | |
203 | - foreach( func_get_args() as $_asSectionset ) { |
|
203 | + foreach ( func_get_args() as $_asSectionset ) { |
|
204 | 204 | $this->addSettingSection( $_asSectionset ); |
205 | 205 | } |
206 | 206 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function addSettingSection( $aSectionset ) { |
288 | 288 | |
289 | - if ( ! is_array( $aSectionset ) ) { |
|
289 | + if ( !is_array( $aSectionset ) ) { |
|
290 | 290 | return; |
291 | 291 | } |
292 | 292 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return void |
320 | 320 | */ |
321 | 321 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
322 | - foreach( func_get_args() as $_aFieldset ) { |
|
322 | + foreach ( func_get_args() as $_aFieldset ) { |
|
323 | 323 | $this->addSettingField( $_aFieldset ); |
324 | 324 | } |
325 | 325 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
595 | 595 | * @return void |
596 | 596 | */ |
597 | - public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
597 | + public function setSettingNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
598 | 598 | $this->oForm->setSubmitNotice( |
599 | 599 | $sMessage, |
600 | 600 | $sType, |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
614 | 614 | * @return boolean True if a setting notice is set; otherwise, false. |
615 | 615 | */ |
616 | - public function hasSettingNotice( $sType='' ) { |
|
616 | + public function hasSettingNotice( $sType = '' ) { |
|
617 | 617 | return $this->oForm->hasSubmitNotice( $sType ); |
618 | 618 | } |
619 | 619 |
@@ -192,6 +192,8 @@ |
||
192 | 192 | } |
193 | 193 | /** |
194 | 194 | * Trims a trailing sub-string if exists. |
195 | + * @param string $sString |
|
196 | + * @param string $sSuffix |
|
195 | 197 | * @return string |
196 | 198 | * @since 3.7.2 |
197 | 199 | */ |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | * @since 3.8.4 When non-true value is passed, `0px` will be returned. |
36 | 36 | * @return string |
37 | 37 | */ |
38 | - static public function getLengthSanitized( $sLength, $sUnit='px' ) { |
|
38 | + static public function getLengthSanitized( $sLength, $sUnit = 'px' ) { |
|
39 | 39 | $sLength = $sLength ? $sLength : 0; |
40 | 40 | return is_numeric( $sLength ) |
41 | - ? $sLength . $sUnit |
|
41 | + ? $sLength.$sUnit |
|
42 | 42 | : $sLength; |
43 | 43 | } |
44 | 44 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @since 3.8.11 Renamed from `fixNumber()`. |
81 | 81 | * @return string|integer A numeric value will be returned. |
82 | 82 | */ |
83 | - static public function getNumberFixed( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
83 | + static public function getNumberFixed( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
84 | 84 | |
85 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
85 | + if ( !is_numeric( trim( $nToFix ) ) ) { |
|
86 | 86 | return $nDefault; |
87 | 87 | } |
88 | 88 | if ( $nMin !== '' && $nToFix < $nMin ) { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return string|integer A numeric value will be returned. |
101 | 101 | * @deprecated 3.8.11 |
102 | 102 | */ |
103 | - static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
103 | + static public function fixNumber( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
104 | 104 | return self::getNumberFixed( $nToFix, $nDefault, $nMin, $nMax ); |
105 | 105 | } |
106 | 106 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | static public function getCSSMinified( $sCSSRules ) { |
115 | 115 | return str_replace( |
116 | - array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' '), // remove line breaks, tab, and white sspaces. |
|
116 | + array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), // remove line breaks, tab, and white sspaces. |
|
117 | 117 | '', |
118 | 118 | preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $sCSSRules ) // remove comments |
119 | 119 | ); |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | */ |
151 | 151 | static public function getNumberOfReadableSize( $nSize ) { |
152 | 152 | |
153 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
154 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
153 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
154 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
155 | 155 | case 'P': |
156 | 156 | $_nReturn *= 1024; |
157 | 157 | case 'T': |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $_nLog = log( $nBytes, 1024 ); |
178 | 178 | $_iPower = ( int ) $_nLog; |
179 | 179 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
180 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
180 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -458,6 +458,7 @@ |
||
458 | 458 | * @internal |
459 | 459 | * @since 3.5.3 |
460 | 460 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition_Page`. |
461 | + * @param string $sTabSlug |
|
461 | 462 | * @return boolean |
462 | 463 | */ |
463 | 464 | private function _isThisSectionSetToThisTab( $sSectionPath, $sPageSlug, $sTabSlug ) { |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | public function getPageOnlyOptions( $aOptions, $sPageSlug ) { |
52 | 52 | |
53 | 53 | $_aStoredOptionsOfThePage = array(); |
54 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
54 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
55 | 55 | |
56 | 56 | // Check the section |
57 | - if ( ! $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
57 | + if ( !$this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | |
61 | 61 | // At this point, the element belongs the given page slug as the section is of the given page slug's. |
62 | 62 | $this->_setPageOnlyOptions( |
63 | - $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
63 | + $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
64 | 64 | $aOptions, |
65 | 65 | $_aSubSectionsOrFields, |
66 | 66 | $sPageSlug, |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @internal |
81 | 81 | */ |
82 | 82 | private function _setPageOnlyOptions( array &$_aStoredOptionsOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug, $_sSectionID ) { |
83 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
83 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
84 | 84 | |
85 | 85 | // If it's a sub-section array, |
86 | 86 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | public function getOtherPageOptions( $aOptions, $sPageSlug ) { |
153 | 153 | |
154 | 154 | $_aStoredOptionsNotOfThePage = array(); |
155 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
155 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
156 | 156 | |
157 | 157 | // Check the section |
158 | 158 | if ( $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @internal |
182 | 182 | */ |
183 | 183 | private function _setOtherPageOptions( array &$_aStoredOptionsNotOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug ) { |
184 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
184 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
185 | 185 | |
186 | 186 | // It's a sub-section array. |
187 | 187 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | public function getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ) { |
245 | 245 | |
246 | 246 | $_aStoredOptionsNotOfTheTab = array(); |
247 | - foreach( $this->aFieldsets as $_sSectionPath => $_aSubSectionsOrFields ) { |
|
247 | + foreach ( $this->aFieldsets as $_sSectionPath => $_aSubSectionsOrFields ) { |
|
248 | 248 | |
249 | 249 | // If the section is of the given page and the given tab, skip. |
250 | 250 | if ( $this->_isThisSectionSetToThisTab( $_sSectionPath, $sPageSlug, $sTabSlug ) ) { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | private function _setOtherTabOptions( array &$_aStoredOptionsNotOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $sSectionPath ) { |
276 | 276 | |
277 | 277 | // At this point, the passed element belongs to the other tabs since the section of the given tab is skipped. |
278 | - foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
278 | + foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
279 | 279 | |
280 | 280 | // If it's a sub section |
281 | 281 | if ( $this->isNumericInteger( $_isSubSectionIndexOrFieldID ) ) { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition_Page`. |
334 | 334 | * @return array |
335 | 335 | */ |
336 | - public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
336 | + public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
337 | 337 | |
338 | 338 | $_aOtherTabOptions = $this->getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ); |
339 | 339 | $_aTabOptions = $this->invertCastArrayContents( $aOptions, $_aOtherTabOptions ); |
@@ -351,17 +351,17 @@ discard block |
||
351 | 351 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition_Page`. |
352 | 352 | * @return array |
353 | 353 | */ |
354 | - public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
354 | + public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
355 | 355 | |
356 | 356 | $_aStoredOptionsOfTheTab = array(); |
357 | - if ( ! $sTabSlug ) { |
|
357 | + if ( !$sTabSlug ) { |
|
358 | 358 | return $_aStoredOptionsOfTheTab; |
359 | 359 | } |
360 | 360 | |
361 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
361 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
362 | 362 | |
363 | 363 | // Check the section |
364 | - if ( ! $this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
364 | + if ( !$this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
365 | 365 | continue; |
366 | 366 | } |
367 | 367 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | private function _setTabOnlyOptions( array &$_aStoredOptionsOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $_sSectionID ) { |
389 | 389 | |
390 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
390 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
391 | 391 | |
392 | 392 | // if it's a sub-section array. |
393 | 393 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | */ |
445 | 445 | private function _isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) { |
446 | 446 | |
447 | - if ( ! isset( $this->aSectionsets[ $sSectionPath ][ 'page_slug' ] ) ) { |
|
447 | + if ( !isset( $this->aSectionsets[ $sSectionPath ][ 'page_slug' ] ) ) { |
|
448 | 448 | return false; |
449 | 449 | } |
450 | 450 | return ( |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | */ |
463 | 463 | private function _isThisSectionSetToThisTab( $sSectionPath, $sPageSlug, $sTabSlug ) { |
464 | 464 | |
465 | - if ( ! $this->_isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) ) { |
|
465 | + if ( !$this->_isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) ) { |
|
466 | 466 | return false; |
467 | 467 | } |
468 | - if ( ! isset( $this->aSectionsets[ $sSectionPath ][ 'tab_slug' ] ) ) { |
|
468 | + if ( !isset( $this->aSectionsets[ $sSectionPath ][ 'tab_slug' ] ) ) { |
|
469 | 469 | return false; |
470 | 470 | } |
471 | 471 | return ( |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | */ |
483 | 483 | private function _setOptionValue( &$aSubject, $asDimensionalPath, $aOptions ) { |
484 | 484 | $_aDimensionalPath = $this->getAsArray( $asDimensionalPath ); |
485 | - $_mValue = $this->getElement( |
|
485 | + $_mValue = $this->getElement( |
|
486 | 486 | $aOptions, |
487 | - $_aDimensionalPath, // as of 3.7.0, it can be an array or string |
|
487 | + $_aDimensionalPath, // as of 3.7.0, it can be an array or string |
|
488 | 488 | null |
489 | 489 | ); |
490 | 490 | if ( isset( $_mValue ) ) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if ( in_array( $oProp->sClassName, self::$aClassNames ) ) |
30 | 30 | return self::$_oInstance; |
31 | 31 | |
32 | - self::$aClassNames[] = $oProp->sClassName; |
|
32 | + self::$aClassNames[ ] = $oProp->sClassName; |
|
33 | 33 | self::$_oInstance = new AdminPageFramework_PageLoadInfo_post_type( $oProp, $oMsg ); |
34 | 34 | |
35 | 35 | return self::$_oInstance; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function _replyToSetPageLoadInfoInFooter() { |
44 | 44 | |
45 | 45 | // Some users sets $_GET['post_type'] element even in regular admin pages. In that case, do not load the style to avoid duplicates. |
46 | - if ( isset( $_GET['page'] ) && $_GET['page'] ) { return; } |
|
46 | + if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] ) { return; } |
|
47 | 47 | |
48 | 48 | // For post type pages |
49 | 49 | if ( |
@@ -26,8 +26,9 @@ |
||
26 | 26 | */ |
27 | 27 | public static function instantiate( $oProp, $oMsg ) { |
28 | 28 | |
29 | - if ( in_array( $oProp->sClassName, self::$aClassNames ) ) |
|
30 | - return self::$_oInstance; |
|
29 | + if ( in_array( $oProp->sClassName, self::$aClassNames ) ) { |
|
30 | + return self::$_oInstance; |
|
31 | + } |
|
31 | 32 | |
32 | 33 | self::$aClassNames[] = $oProp->sClassName; |
33 | 34 | self::$_oInstance = new AdminPageFramework_PageLoadInfo_post_type( $oProp, $oMsg ); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * Defines the field type slugs used for this field type. |
188 | 188 | */ |
189 | - public $aFieldTypeSlugs = array( 'submit', ); |
|
189 | + public $aFieldTypeSlugs = array( 'submit',); |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Defines the default key-values of this field type. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'redirect_url' => null, |
198 | 198 | 'href' => null, |
199 | 199 | 'reset' => null, |
200 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
200 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
201 | 201 | /* |
202 | 202 | array( |
203 | 203 | '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 the field ID. |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | '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 the field ID. |
208 | 208 | ) |
209 | 209 | */ |
210 | - 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
210 | + 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
211 | 211 | 'attributes' => array( |
212 | 212 | 'class' => 'button button-primary', |
213 | 213 | ), |
@@ -247,16 +247,16 @@ discard block |
||
247 | 247 | |
248 | 248 | return |
249 | 249 | $aField[ 'before_label' ] |
250 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
250 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
251 | 251 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
252 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
252 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
253 | 253 | . $aField[ 'before_input' ] |
254 | 254 | . $this->_getExtraInputFields( $aField ) |
255 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
255 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
256 | 256 | . $aField[ 'after_input' ] |
257 | 257 | . "</label>" |
258 | 258 | . "</div>" |
259 | - . $aField['after_label']; |
|
259 | + . $aField[ 'after_label' ]; |
|
260 | 260 | |
261 | 261 | } |
262 | 262 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | private function _getLabelAttributes( array $aField, array $aInputAttributes ) { |
289 | 289 | return array( |
290 | 290 | 'style' => $aField[ 'label_min_width' ] |
291 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
291 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
292 | 292 | : null, |
293 | 293 | 'for' => $aInputAttributes[ 'id' ], |
294 | 294 | 'class' => $aInputAttributes[ 'disabled' ] |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | private function _getLabelContainerAttributes( array $aField ) { |
307 | 307 | return array( |
308 | 308 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
309 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
309 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
310 | 310 | : null, |
311 | 311 | 'class' => 'admin-page-framework-input-label-container' |
312 | 312 | . ' admin-page-framework-input-button-container' |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | protected function _getExtraInputFields( &$aField ) { |
358 | 358 | |
359 | 359 | $_aOutput = array(); |
360 | - $_aOutput[] = $this->getHTMLTag( |
|
360 | + $_aOutput[ ] = $this->getHTMLTag( |
|
361 | 361 | 'input', |
362 | 362 | array( |
363 | 363 | 'type' => 'hidden', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'value' => $aField[ 'input_id' ], |
366 | 366 | ) |
367 | 367 | ); |
368 | - $_aOutput[] = $this->getHTMLTag( |
|
368 | + $_aOutput[ ] = $this->getHTMLTag( |
|
369 | 369 | 'input', |
370 | 370 | array( |
371 | 371 | 'type' => 'hidden', |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | 'value' => $aField[ 'field_id' ], |
374 | 374 | ) |
375 | 375 | ); |
376 | - $_aOutput[] = $this->getHTMLTag( |
|
376 | + $_aOutput[ ] = $this->getHTMLTag( |
|
377 | 377 | 'input', |
378 | 378 | array( |
379 | 379 | 'type' => 'hidden', |
@@ -381,11 +381,11 @@ discard block |
||
381 | 381 | 'value' => $aField[ '_input_name_flat' ], |
382 | 382 | ) |
383 | 383 | ); |
384 | - $_aOutput[] = $this->_getHiddenInput_SectionID( $aField ); |
|
385 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
386 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
387 | - $_aOutput[] = $this->_getHiddenInput_Reset( $aField ); |
|
388 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
384 | + $_aOutput[ ] = $this->_getHiddenInput_SectionID( $aField ); |
|
385 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
386 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
387 | + $_aOutput[ ] = $this->_getHiddenInput_Reset( $aField ); |
|
388 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
389 | 389 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
390 | 390 | |
391 | 391 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | 'input', |
402 | 402 | array( |
403 | 403 | 'type' => 'hidden', |
404 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
405 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
406 | - ? $aField['section_id'] |
|
404 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
405 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
406 | + ? $aField[ 'section_id' ] |
|
407 | 407 | : '', |
408 | 408 | ) |
409 | 409 | ); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | 'input', |
422 | 422 | array( |
423 | 423 | 'type' => 'hidden', |
424 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
424 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
425 | 425 | 'value' => $aField[ $sKey ], |
426 | 426 | ) |
427 | 427 | ) |
@@ -435,15 +435,15 @@ discard block |
||
435 | 435 | * @return string the HTML input tag output for the 'reset' argument. |
436 | 436 | */ |
437 | 437 | private function _getHiddenInput_Reset( array $aField ) { |
438 | - if ( ! $aField['reset'] ) { |
|
438 | + if ( !$aField[ 'reset' ] ) { |
|
439 | 439 | return ''; |
440 | 440 | } |
441 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
441 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
442 | 442 | ? $this->getHTMLTag( |
443 | 443 | 'input', |
444 | 444 | array( |
445 | 445 | 'type' => 'hidden', |
446 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
446 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
447 | 447 | 'value' => '1', |
448 | 448 | ) |
449 | 449 | ) |
@@ -451,10 +451,10 @@ discard block |
||
451 | 451 | 'input', |
452 | 452 | array( |
453 | 453 | 'type' => 'hidden', |
454 | - 'name' => "__submit[{$aField['input_id']}][reset_key]", |
|
455 | - 'value' => is_array( $aField['reset'] ) // set the option array key to delete. |
|
456 | - ? implode( '|', $aField['reset'] ) |
|
457 | - : $aField['reset'], |
|
454 | + 'name' => "__submit[{$aField[ 'input_id' ]}][reset_key]", |
|
455 | + 'value' => is_array( $aField[ 'reset' ] ) // set the option array key to delete. |
|
456 | + ? implode( '|', $aField[ 'reset' ] ) |
|
457 | + : $aField[ 'reset' ], |
|
458 | 458 | ) |
459 | 459 | ); |
460 | 460 | } |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | return ''; |
472 | 472 | } |
473 | 473 | $this->setTransient( |
474 | - 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ), |
|
474 | + 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ), |
|
475 | 475 | $aField[ 'email' ] |
476 | 476 | ); |
477 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
477 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
478 | 478 | ? $this->getHTMLTag( |
479 | 479 | 'input', |
480 | 480 | array( |
@@ -499,19 +499,19 @@ discard block |
||
499 | 499 | * @return boolean |
500 | 500 | * @internal |
501 | 501 | */ |
502 | - private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) { |
|
502 | + private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) { |
|
503 | 503 | |
504 | - switch( $sType ) { |
|
504 | + switch ( $sType ) { |
|
505 | 505 | default: |
506 | 506 | case 'reset': // admin page framework _ reset confirmation |
507 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
507 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
508 | 508 | break; |
509 | 509 | case 'email': // admin page framework _ email confirmation |
510 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
510 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
511 | 511 | break; |
512 | 512 | } |
513 | 513 | |
514 | - $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && ! $aField[ 'skip_confirmation' ] |
|
514 | + $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ] |
|
515 | 515 | ? false |
516 | 516 | : true; |
517 | 517 |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @return array The label container attribute array. |
304 | 304 | * @internal |
305 | 305 | */ |
306 | - private function _getLabelContainerAttributes( array $aField ) { |
|
306 | + private function _getLabelContainerAttributes( array $aField ) { |
|
307 | 307 | return array( |
308 | 308 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
309 | 309 | ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
@@ -539,19 +539,19 @@ discard block |
||
539 | 539 | * @since 2.1.5 Moved from `AdminPageFramwrork_InputField`. Changed the scope to protected from private. Removed the second parameter. |
540 | 540 | * @internal |
541 | 541 | */ |
542 | - protected function _getInputFieldValueFromLabel( $aField ) { |
|
542 | + protected function _getInputFieldValueFromLabel( $aField ) { |
|
543 | 543 | |
544 | 544 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
545 | - if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
545 | + if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
546 | 546 | return $aField[ 'value' ]; |
547 | 547 | } |
548 | 548 | |
549 | - if ( isset( $aField[ 'label' ] ) ) { |
|
549 | + if ( isset( $aField[ 'label' ] ) ) { |
|
550 | 550 | return $aField[ 'label' ]; |
551 | 551 | } |
552 | 552 | |
553 | 553 | // If the default value is set, |
554 | - if ( isset( $aField[ 'default' ] ) ) { |
|
554 | + if ( isset( $aField[ 'default' ] ) ) { |
|
555 | 555 | return $aField[ 'default' ]; |
556 | 556 | } |
557 | 557 |