@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * Defines the field type slugs used for this field type. |
120 | 120 | * @var array |
121 | 121 | */ |
122 | - public $aFieldTypeSlugs = array( 'taxonomy', ); |
|
122 | + public $aFieldTypeSlugs = array( 'taxonomy',); |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Defines the default key-values of this field type. |
@@ -128,41 +128,41 @@ discard block |
||
128 | 128 | * @var array |
129 | 129 | */ |
130 | 130 | protected $aDefaultKeys = array( |
131 | - 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
132 | - 'height' => '250px', // the tab box height |
|
133 | - 'width' => null, // 3.5.7.2+ the tab box width |
|
134 | - 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
135 | - 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
131 | + 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
132 | + 'height' => '250px', // the tab box height |
|
133 | + 'width' => null, // 3.5.7.2+ the tab box width |
|
134 | + 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
135 | + 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
136 | 136 | 'attributes' => array(), |
137 | - 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
138 | - 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
139 | - 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
140 | - 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
137 | + 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
138 | + 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
139 | + 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
140 | + 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
141 | 141 | 'query' => array( // (array) 3.3.2+ Defines the default query argument. |
142 | 142 | // see the arguments of the get_category() function: http://codex.wordpress.org/Function_Reference/get_categories |
143 | 143 | // see the argument of the get_terms() function: http://codex.wordpress.org/Function_Reference/get_terms |
144 | 144 | 'child_of' => 0, |
145 | 145 | 'parent' => '', |
146 | - 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
147 | - 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
148 | - 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
149 | - 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
150 | - 'number' => '', // (integer) The maximum number of the terms to show. |
|
151 | - 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
152 | - 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
146 | + 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
147 | + 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
148 | + 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
149 | + 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
150 | + 'number' => '', // (integer) The maximum number of the terms to show. |
|
151 | + 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
152 | + 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
153 | 153 | 'exclude_tree' => array(), |
154 | - 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
154 | + 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
155 | 155 | 'fields' => 'all', |
156 | 156 | 'slug' => '', |
157 | 157 | 'get' => '', |
158 | 158 | 'name__like' => '', |
159 | 159 | 'description__like' => '', |
160 | 160 | 'offset' => '', |
161 | - 'search' => '', // (string) The search keyword to get the term with. |
|
161 | + 'search' => '', // (string) The search keyword to get the term with. |
|
162 | 162 | 'cache_domain' => 'core', |
163 | 163 | ), |
164 | - 'queries' => array(), // (optional, array) 3.3.2+ Sets a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
165 | - 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
164 | + 'queries' => array(), // (optional, array) 3.3.2+ Sets a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
165 | + 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
166 | 166 | ); |
167 | 167 | |
168 | 168 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $_aJSArray = json_encode( $this->aFieldTypeSlugs ); |
194 | 194 | |
195 | - return parent::getScripts() . |
|
195 | + return parent::getScripts(). |
|
196 | 196 | // return |
197 | 197 | <<<JAVASCRIPTS |
198 | 198 | /* For tabs */ |
@@ -413,22 +413,22 @@ discard block |
||
413 | 413 | // Parse |
414 | 414 | $_aTabs = array(); |
415 | 415 | $_aCheckboxes = array(); |
416 | - foreach( $this->getAsArray( $aField[ 'taxonomy_slugs' ] ) as $_isKey => $_sTaxonomySlug ) { |
|
416 | + foreach ( $this->getAsArray( $aField[ 'taxonomy_slugs' ] ) as $_isKey => $_sTaxonomySlug ) { |
|
417 | 417 | $_aAssociatedDataAttributes = $this->_getDataAttributesOfAssociatedPostTypes( |
418 | 418 | $_sTaxonomySlug, |
419 | 419 | $this->_getPostTypesByTaxonomySlug( $_sTaxonomySlug ) |
420 | 420 | ); |
421 | - $_aTabs[] = $this->_getTaxonomyTab( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
422 | - $_aCheckboxes[] = $this->_getTaxonomyCheckboxes( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
421 | + $_aTabs[ ] = $this->_getTaxonomyTab( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
422 | + $_aCheckboxes[ ] = $this->_getTaxonomyCheckboxes( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | // Output |
426 | - return "<div id='tabbox-{$aField['field_id']}' class='tab-box-container categorydiv' style='max-width:{$aField['max_width']};'>" |
|
426 | + return "<div id='tabbox-{$aField[ 'field_id' ]}' class='tab-box-container categorydiv' style='max-width:{$aField[ 'max_width' ]};'>" |
|
427 | 427 | . "<ul class='tab-box-tabs category-tabs'>" |
428 | 428 | . implode( PHP_EOL, $_aTabs ) |
429 | 429 | . "</ul>" |
430 | 430 | . "<div class='tab-box-contents-container'>" |
431 | - . "<div class='tab-box-contents' style='height: {$aField['height']};'>" |
|
431 | + . "<div class='tab-box-contents' style='height: {$aField[ 'height' ]};'>" |
|
432 | 432 | . implode( PHP_EOL, $_aCheckboxes ) |
433 | 433 | . "</div>" |
434 | 434 | . "</div>" |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | private function _getDataAttributesOfAssociatedPostTypes( $sTaxonomySlusg, $aPostTypes ) { |
455 | 455 | return array( |
456 | 456 | 'data-associated-with' => $sTaxonomySlusg, |
457 | - 'data-associated-post-types' => implode( ',', $aPostTypes ) . ',', // must add a trailing comma for jQuery to detect the item. |
|
457 | + 'data-associated-post-types' => implode( ',', $aPostTypes ).',', // must add a trailing comma for jQuery to detect the item. |
|
458 | 458 | ); |
459 | 459 | } |
460 | 460 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | private function _getTaxonomyCheckboxes( array $aField, $sKey, $sTaxonomySlug, $aAttributes ) { |
470 | 470 | |
471 | 471 | $_aTabBoxContainerArguments = array( |
472 | - 'id' => "tab_{$aField['input_id']}_{$sKey}", |
|
472 | + 'id' => "tab_{$aField[ 'input_id' ]}_{$sKey}", |
|
473 | 473 | 'class' => 'tab-box-content', |
474 | 474 | 'style' => $this->generateInlineCSS( |
475 | 475 | array( |
@@ -478,9 +478,9 @@ discard block |
||
478 | 478 | ) |
479 | 479 | ), |
480 | 480 | ) + $aAttributes; |
481 | - return "<div " . $this->getAttributes( $_aTabBoxContainerArguments ) . ">" |
|
481 | + return "<div ".$this->getAttributes( $_aTabBoxContainerArguments ).">" |
|
482 | 482 | . $this->getElement( $aField, array( 'before_label', $sKey ) ) |
483 | - . "<div " . $this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ) . ">" |
|
483 | + . "<div ".$this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ).">" |
|
484 | 484 | . "</div>" |
485 | 485 | . "<ul class='list:category taxonomychecklist form-no-clear'>" |
486 | 486 | . $this->_getTaxonomyChecklist( $aField, $sKey, $sTaxonomySlug ) |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | 'taxonomy' => $sTaxonomySlug, |
506 | 506 | '_name_prefix' => is_array( $aField[ 'taxonomy_slugs' ] ) |
507 | 507 | ? "{$aField[ '_input_name' ]}[{$sTaxonomySlug}]" |
508 | - : $aField[ '_input_name' ], // name prefix of the input |
|
508 | + : $aField[ '_input_name' ], // name prefix of the input |
|
509 | 509 | '_input_id_prefix' => $aField[ 'input_id' ], |
510 | 510 | '_attributes' => $this->getElementAsArray( |
511 | 511 | $aField, |
@@ -513,12 +513,12 @@ discard block |
||
513 | 513 | ) + $aField[ 'attributes' ], |
514 | 514 | |
515 | 515 | // checked items ( term IDs ) e.g. array( 6, 10, 7, 15 ), |
516 | - '_selected_items' => $this->_getSelectedKeyArray( $aField['value'], $sTaxonomySlug ), |
|
516 | + '_selected_items' => $this->_getSelectedKeyArray( $aField[ 'value' ], $sTaxonomySlug ), |
|
517 | 517 | |
518 | - 'echo' => false, // returns the output |
|
519 | - 'show_post_count' => $aField[ 'show_post_count' ], // 3.2.0+ |
|
520 | - 'show_option_none' => $aField[ 'label_no_term_found' ], // 3.3.2+ |
|
521 | - 'title_li' => $aField[ 'label_list_title' ], // 3.3.2+ |
|
518 | + 'echo' => false, // returns the output |
|
519 | + 'show_post_count' => $aField[ 'show_post_count' ], // 3.2.0+ |
|
520 | + 'show_option_none' => $aField[ 'label_no_term_found' ], // 3.3.2+ |
|
521 | + 'title_li' => $aField[ 'label_list_title' ], // 3.3.2+ |
|
522 | 522 | |
523 | 523 | '_save_unchecked' => $aField[ 'save_unchecked' ], // 3.8.8+ Whether to insert hidden input element for unchecked. |
524 | 524 | ) |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | $_aLiAttribues = array( |
566 | 566 | 'class' => 'tab-box-tab', |
567 | 567 | ) + $aAttributes; |
568 | - return "<li " . $this->getAttributes( $_aLiAttribues ) . ">" |
|
569 | - . "<a href='#tab_{$aField['input_id']}_{$sKey}'>" |
|
568 | + return "<li ".$this->getAttributes( $_aLiAttribues ).">" |
|
569 | + . "<a href='#tab_{$aField[ 'input_id' ]}_{$sKey}'>" |
|
570 | 570 | . "<span class='tab-box-tab-text'>" |
571 | 571 | . $this->_getLabelFromTaxonomySlug( $sTaxonomySlug ) |
572 | 572 | . "</span>" |
@@ -441,7 +441,7 @@ |
||
441 | 441 | * @since 3.8.8 |
442 | 442 | * @return array Post type slugs associated with the given taxonomy. |
443 | 443 | */ |
444 | - private function _getPostTypesByTaxonomySlug( $sTaxonomySlug ) { |
|
444 | + private function _getPostTypesByTaxonomySlug( $sTaxonomySlug ) { |
|
445 | 445 | $_oTaxonomy = get_taxonomy( $sTaxonomySlug ); |
446 | 446 | return $_oTaxonomy->object_type; |
447 | 447 | } |
@@ -74,6 +74,8 @@ discard block |
||
74 | 74 | * <li>a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with 'data:image/svg+xml;base64,'.</li> |
75 | 75 | * </ul> |
76 | 76 | * @param string (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function. |
77 | + * @param string $sIcon16x16 |
|
78 | + * @param integer $iMenuPosition |
|
77 | 79 | * @return void |
78 | 80 | */ |
79 | 81 | public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) { |
@@ -96,6 +98,7 @@ discard block |
||
96 | 98 | * |
97 | 99 | * @since 2.0.0 |
98 | 100 | * @internal |
101 | + * @param string $sMenuLabel |
|
99 | 102 | * @return void|string Returns the associated slug string, if true. |
100 | 103 | */ |
101 | 104 | private function _isBuiltInMenuItem( $sMenuLabel ) { |
@@ -160,9 +163,6 @@ discard block |
||
160 | 163 | * @since 3.0.0 Changed the scope to public. |
161 | 164 | * @remark The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug. |
162 | 165 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
163 | - * @param array $aSubMenuItem1 a first sub-menu array. A sub-menu array can be a link or a page. For the specifications of the array structures and its arguments, refer to the parameter section of the `addSubMenuItem()` method. |
|
164 | - * @param array $aSubMenuItem2 (optional) a second sub-menu array. |
|
165 | - * @param array $_and_more (optional) a third and add items as many as necessary with next parameters. |
|
166 | 166 | * @access public |
167 | 167 | * @return void |
168 | 168 | */ |
@@ -250,20 +250,20 @@ |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | - * Adds the given link into the menu on the left sidebar of the administration panel. |
|
254 | - * |
|
255 | - * @since 2.0.0 |
|
256 | - * @since 3.0.0 Changed the scope to public from protected. |
|
257 | - * @since 3.5.0 Changed the scope to public as it was still protected. |
|
258 | - * @param string the menu title. |
|
259 | - * @param string the URL linked to the menu. |
|
260 | - * @param string (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>. |
|
261 | - * @param string (optional) the order number. The larger it is, the lower the position it gets. |
|
262 | - * @param string (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page. |
|
263 | - * @access public |
|
264 | - * @return void |
|
265 | - * @internal |
|
266 | - */ |
|
253 | + * Adds the given link into the menu on the left sidebar of the administration panel. |
|
254 | + * |
|
255 | + * @since 2.0.0 |
|
256 | + * @since 3.0.0 Changed the scope to public from protected. |
|
257 | + * @since 3.5.0 Changed the scope to public as it was still protected. |
|
258 | + * @param string the menu title. |
|
259 | + * @param string the URL linked to the menu. |
|
260 | + * @param string (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>. |
|
261 | + * @param string (optional) the order number. The larger it is, the lower the position it gets. |
|
262 | + * @param string (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page. |
|
263 | + * @access public |
|
264 | + * @return void |
|
265 | + * @internal |
|
266 | + */ |
|
267 | 267 | public function addSubMenuLink( array $aSubMenuLink ) { |
268 | 268 | |
269 | 269 | // If required keys are not set, return. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function. |
77 | 77 | * @return void |
78 | 78 | */ |
79 | - public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) { |
|
79 | + public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16 = null, $iMenuPosition = null ) { |
|
80 | 80 | |
81 | 81 | $sRootMenuLabel = trim( $sRootMenuLabel ); |
82 | 82 | $_sSlug = $this->_isBuiltInMenuItem( $sRootMenuLabel ); // if true, this method returns the slug |
@@ -267,16 +267,16 @@ discard block |
||
267 | 267 | public function addSubMenuLink( array $aSubMenuLink ) { |
268 | 268 | |
269 | 269 | // If required keys are not set, return. |
270 | - if ( ! isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
270 | + if ( !isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // If the set URL is not valid, return. |
275 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
275 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
276 | 276 | return; |
277 | 277 | } |
278 | 278 | |
279 | - $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
279 | + $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
280 | 280 | $aSubMenuLink, |
281 | 281 | $this, |
282 | 282 | count( $this->oProp->aPages ) + 1 |
@@ -334,11 +334,11 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function addSubMenuPage( array $aSubMenuPage ) { |
336 | 336 | |
337 | - if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
337 | + if ( !isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
338 | 338 | return; |
339 | 339 | } |
340 | 340 | |
341 | - $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
341 | + $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
342 | 342 | $aSubMenuPage, |
343 | 343 | $this, |
344 | 344 | count( $this->oProp->aPages ) + 1 |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | public function addSubMenuLink( array $aSubMenuLink ) { |
268 | 268 | |
269 | 269 | // If required keys are not set, return. |
270 | - if ( ! isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
270 | + if ( ! isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // If the set URL is not valid, return. |
275 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
275 | + if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
276 | 276 | return; |
277 | 277 | } |
278 | 278 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function addSubMenuPage( array $aSubMenuPage ) { |
336 | 336 | |
337 | - if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
337 | + if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
338 | 338 | return; |
339 | 339 | } |
340 | 340 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package AdminPageFramework |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! class_exists( 'AdminPageFramework_Registry', false ) ) : |
|
13 | +if ( !class_exists( 'AdminPageFramework_Registry', false ) ) : |
|
14 | 14 | /** |
15 | 15 | * Facilitates WordPress plugin and theme development. |
16 | 16 | * |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | final class AdminPageFramework_Registry extends AdminPageFramework_Registry_Base { |
62 | 62 | |
63 | 63 | const TEXT_DOMAIN = 'admin-page-framework'; |
64 | - const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
64 | + const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Indicates whether the framework is loaded from the minified version or not. |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * Sets up static properties. |
104 | 104 | * @return void |
105 | 105 | */ |
106 | - static public function setUp( $sFilePath=__FILE__ ) { |
|
106 | + static public function setUp( $sFilePath = __FILE__ ) { |
|
107 | 107 | |
108 | 108 | self::$sFilePath = $sFilePath; |
109 | 109 | self::$sDirPath = dirname( self::$sFilePath ); |
110 | - self::$sIncludeClassListPath = self::$sDirPath . '/admin-page-framework-include-class-list.php'; |
|
110 | + self::$sIncludeClassListPath = self::$sDirPath.'/admin-page-framework-include-class-list.php'; |
|
111 | 111 | self::$aClassFiles = self::_getClassFilePathList( self::$sIncludeClassListPath ); |
112 | 112 | self::$sAutoLoaderPath = isset( self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] ) |
113 | 113 | ? self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return array |
123 | 123 | */ |
124 | 124 | static private function _getClassFilePathList( $sInclusionClassListPath ) { |
125 | - $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
125 | + $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
126 | 126 | include( $sInclusionClassListPath ); |
127 | 127 | return $aClassFiles; |
128 | 128 | } |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | */ |
136 | 136 | static public function getVersion() { |
137 | 137 | |
138 | - if ( ! isset( self::$sAutoLoaderPath ) ) { |
|
139 | - trigger_error( self::NAME . ': ' . ' : ' . sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
138 | + if ( !isset( self::$sAutoLoaderPath ) ) { |
|
139 | + trigger_error( self::NAME.': '.' : '.sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
140 | 140 | return self::VERSION; |
141 | 141 | } |
142 | - $_aMinifiedVesionSuffix = array( |
|
142 | + $_aMinifiedVesionSuffix = array( |
|
143 | 143 | 0 => '', |
144 | 144 | 1 => '.min', |
145 | 145 | ); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | endif; |
170 | 170 | |
171 | -if ( ! class_exists( 'AdminPageFramework_Bootstrap', false ) ) : |
|
171 | +if ( !class_exists( 'AdminPageFramework_Bootstrap', false ) ) : |
|
172 | 172 | /** |
173 | 173 | * Loads the Admin Page Framework library. |
174 | 174 | * |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function __construct( $sLibraryPath ) { |
191 | 191 | |
192 | - if ( ! $this->_isLoadable() ) { |
|
192 | + if ( !$this->_isLoadable() ) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 |
@@ -29,38 +29,38 @@ discard block |
||
29 | 29 | static public $aStructure = array( |
30 | 30 | |
31 | 31 | // Required Keys |
32 | - 'field_id' => null, // (string) |
|
33 | - 'section_id' => null, // (string) |
|
32 | + 'field_id' => null, // (string) |
|
33 | + 'section_id' => null, // (string) |
|
34 | 34 | |
35 | 35 | // Optional Keys |
36 | - 'type' => null, // (string) (3.8.0+ Became okay to omit.) |
|
37 | - 'section_title' => null, // This will be assigned automatically in the formatting method. |
|
38 | - 'page_slug' => null, // This will be assigned automatically in the formatting method. |
|
39 | - 'tab_slug' => null, // This will be assigned automatically in the formatting method. |
|
40 | - 'option_key' => null, // This will be assigned automatically in the formatting method. |
|
41 | - 'class_name' => null, // Stores the instantiated class name. Used by the export field type. Also a third party custom field type uses it. |
|
36 | + 'type' => null, // (string) (3.8.0+ Became okay to omit.) |
|
37 | + 'section_title' => null, // This will be assigned automatically in the formatting method. |
|
38 | + 'page_slug' => null, // This will be assigned automatically in the formatting method. |
|
39 | + 'tab_slug' => null, // This will be assigned automatically in the formatting method. |
|
40 | + 'option_key' => null, // This will be assigned automatically in the formatting method. |
|
41 | + 'class_name' => null, // Stores the instantiated class name. Used by the export field type. Also a third party custom field type uses it. |
|
42 | 42 | 'capability' => null, |
43 | 43 | 'title' => null, |
44 | 44 | 'tip' => null, |
45 | 45 | 'description' => null, |
46 | - 'error_message' => null, // error message for the field |
|
46 | + 'error_message' => null, // error message for the field |
|
47 | 47 | 'before_label' => null, |
48 | 48 | 'after_label' => null, |
49 | 49 | 'if' => true, |
50 | - 'order' => null, // do not set the default number here for this key. |
|
50 | + 'order' => null, // do not set the default number here for this key. |
|
51 | 51 | 'default' => null, |
52 | 52 | 'value' => null, |
53 | - 'help' => null, // 2.1.0 |
|
54 | - 'help_aside' => null, // 2.1.0 |
|
55 | - 'repeatable' => null, // 2.1.3 |
|
56 | - 'sortable' => null, // 2.1.3 |
|
57 | - 'show_title_column' => true, // 3.0.0 |
|
58 | - 'hidden' => null, // 3.0.0 |
|
53 | + 'help' => null, // 2.1.0 |
|
54 | + 'help_aside' => null, // 2.1.0 |
|
55 | + 'repeatable' => null, // 2.1.3 |
|
56 | + 'sortable' => null, // 2.1.3 |
|
57 | + 'show_title_column' => true, // 3.0.0 |
|
58 | + 'hidden' => null, // 3.0.0 |
|
59 | 59 | |
60 | - 'placement' => 'normal', // 3.8.0 (string) accepts either 'section_title', 'field_title', or 'normal' |
|
60 | + 'placement' => 'normal', // 3.8.0 (string) accepts either 'section_title', 'field_title', or 'normal' |
|
61 | 61 | |
62 | 62 | // @todo Examine why an array is not set but null here for the attributes argument. |
63 | - 'attributes' => null, // 3.0.0 - the array represents the attributes of input tag |
|
63 | + 'attributes' => null, // 3.0.0 - the array represents the attributes of input tag |
|
64 | 64 | 'class' => array( // 3.3.1 |
65 | 65 | 'fieldrow' => array(), |
66 | 66 | 'fieldset' => array(), |
@@ -68,29 +68,29 @@ discard block |
||
68 | 68 | 'field' => array(), |
69 | 69 | ), |
70 | 70 | |
71 | - 'save' => true, // 3.6.0 |
|
72 | - 'content' => null, // 3.6.1 - (string) An overriding field-set output. |
|
71 | + 'save' => true, // 3.6.0 |
|
72 | + 'content' => null, // 3.6.1 - (string) An overriding field-set output. |
|
73 | 73 | |
74 | - 'show_debug_info' => null, // 3.8.8+ (boolean) whether to show debug information such as field definition tool-tips. This value is inherited from the section definition argument of the same name. Not setting a value here as it is determined with another calculated value. |
|
74 | + 'show_debug_info' => null, // 3.8.8+ (boolean) whether to show debug information such as field definition tool-tips. This value is inherited from the section definition argument of the same name. Not setting a value here as it is determined with another calculated value. |
|
75 | 75 | |
76 | 76 | // Internal Keys |
77 | - '_fields_type' => null, // @deprecated 3.7.0, 3.0.0 - an internal key that indicates the fields type such as page, meta box for pages, meta box for posts, or taxonomy. |
|
78 | - '_structure_type' => null, // 3.7.0 |
|
79 | - '_caller_object' => null, // 3.4.0 (object) stores the object of the caller class. The object is referenced when creating nested fields. |
|
77 | + '_fields_type' => null, // @deprecated 3.7.0, 3.0.0 - an internal key that indicates the fields type such as page, meta box for pages, meta box for posts, or taxonomy. |
|
78 | + '_structure_type' => null, // 3.7.0 |
|
79 | + '_caller_object' => null, // 3.4.0 (object) stores the object of the caller class. The object is referenced when creating nested fields. |
|
80 | 80 | |
81 | - '_section_path' => '', // 3.7.0 (string) Stores the section path that indicates the structural address of the nested section. e.g. my_section|nested_one |
|
82 | - '_section_path_array' => '', // 3.7.0 (array) An array version of the above section path. |
|
83 | - '_nested_depth' => 0, // 3.4.0 (integer) stores the level of the nesting depth. This is mostly used for debugging by checking if the field is a nested field or not. |
|
84 | - '_subsection_index' => null, // 3.7.0 Passed to the `field_definition_{...}` filter hook callbacks. |
|
85 | - '_section_repeatable' => false, // @deprecated |
|
86 | - '_is_section_repeatable' => false, // 3.8.0 (boolean) Whether the belonging section is repeatable or not. |
|
81 | + '_section_path' => '', // 3.7.0 (string) Stores the section path that indicates the structural address of the nested section. e.g. my_section|nested_one |
|
82 | + '_section_path_array' => '', // 3.7.0 (array) An array version of the above section path. |
|
83 | + '_nested_depth' => 0, // 3.4.0 (integer) stores the level of the nesting depth. This is mostly used for debugging by checking if the field is a nested field or not. |
|
84 | + '_subsection_index' => null, // 3.7.0 Passed to the `field_definition_{...}` filter hook callbacks. |
|
85 | + '_section_repeatable' => false, // @deprecated |
|
86 | + '_is_section_repeatable' => false, // 3.8.0 (boolean) Whether the belonging section is repeatable or not. |
|
87 | 87 | |
88 | - '_field_path' => '', // 3.7.0 (string) Stores the field path that indicates the structural location of the field. This is relative to the belonging section. |
|
88 | + '_field_path' => '', // 3.7.0 (string) Stores the field path that indicates the structural location of the field. This is relative to the belonging section. |
|
89 | 89 | '_field_path_array' => array(), // 3.7.0 (array) An array version of the above field path. |
90 | - '_parent_field_path' => '', // 3.8.0 (string) |
|
90 | + '_parent_field_path' => '', // 3.8.0 (string) |
|
91 | 91 | '_parent_field_path_array' => array(), // 3.8.0 (array) |
92 | 92 | |
93 | - '_is_title_embedded' => false, // 3.8.0 (boolean) whether the field title is in the fieldset element, not in the table th element. This becomes `true` for `section_title` fields and fields with the `placement` argument with the value of `section_title` or `field_title`. |
|
93 | + '_is_title_embedded' => false, // 3.8.0 (boolean) whether the field title is in the fieldset element, not in the table th element. This becomes `true` for `section_title` fields and fields with the `placement` argument with the value of `section_title` or `field_title`. |
|
94 | 94 | |
95 | 95 | ); |
96 | 96 | |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | array( |
168 | 168 | '_fields_type' => $this->sStructureType, // @deprecated 3.7.0 backward-compatibility |
169 | 169 | '_structure_type' => $this->sStructureType, |
170 | - '_caller_object' => $this->oCallerObject, // 3.4.1+ Stores the caller form object. |
|
171 | - '_subsection_index' => $this->iSubSectionIndex, // 3.7.0+ |
|
170 | + '_caller_object' => $this->oCallerObject, // 3.4.1+ Stores the caller form object. |
|
171 | + '_subsection_index' => $this->iSubSectionIndex, // 3.7.0+ |
|
172 | 172 | ) |
173 | 173 | + $this->aFieldset, |
174 | 174 | array( |
175 | 175 | 'capability' => $this->sCapability, |
176 | 176 | 'section_id' => '_default', |
177 | - '_section_repeatable' => $this->bIsSectionRepeatable, // @deprecated 3.8.0 This was not used. |
|
177 | + '_section_repeatable' => $this->bIsSectionRepeatable, // @deprecated 3.8.0 This was not used. |
|
178 | 178 | '_is_section_repeatable' => $this->bIsSectionRepeatable, |
179 | 179 | ) |
180 | 180 | + self::$aStructure |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | |
296 | 296 | ); |
297 | 297 | |
298 | - foreach( $aNestedFieldsets as $_isIndex => &$_aNestedFieldset ) { |
|
298 | + foreach ( $aNestedFieldsets as $_isIndex => &$_aNestedFieldset ) { |
|
299 | 299 | |
300 | 300 | // The inline-mixed type has a string element. |
301 | 301 | if ( is_scalar( $_aNestedFieldset ) ) { |
302 | 302 | $_aNestedFieldset = array( |
303 | - 'field_id' => $aParentFieldset[ 'field_id' ] . '_' . uniqid(), |
|
303 | + 'field_id' => $aParentFieldset[ 'field_id' ].'_'.uniqid(), |
|
304 | 304 | 'content' => $_aNestedFieldset, |
305 | 305 | ); |
306 | 306 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $_aFieldset[ 'class' ] = $this->getAsArray( $_aFieldset[ 'class' ] ); |
196 | 196 | |
197 | 197 | // 3.8.0+ Support nested fields and inline_mized field type. |
198 | - if ( $this->hasFieldDefinitionsInContent( $_aFieldset ) ) { |
|
198 | + if ( $this->hasFieldDefinitionsInContent( $_aFieldset ) ) { |
|
199 | 199 | $_aFieldset[ 'content' ] = $this->_getChildFieldsetsFormatted( $_aFieldset[ 'content' ], $_aFieldset ); |
200 | 200 | } |
201 | 201 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @since 3.8.8 |
223 | 223 | * @return boolean |
224 | 224 | */ |
225 | - private function _getShowDebugInfo( $aFieldset ) { |
|
225 | + private function _getShowDebugInfo( $aFieldset ) { |
|
226 | 226 | |
227 | 227 | // If the user sets a value. use it. |
228 | 228 | if ( isset( $aFieldset[ 'show_debug_info' ] ) ) { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | foreach( $aNestedFieldsets as $_isIndex => &$_aNestedFieldset ) { |
299 | 299 | |
300 | 300 | // The inline-mixed type has a string element. |
301 | - if ( is_scalar( $_aNestedFieldset ) ) { |
|
301 | + if ( is_scalar( $_aNestedFieldset ) ) { |
|
302 | 302 | $_aNestedFieldset = array( |
303 | 303 | 'field_id' => $aParentFieldset[ 'field_id' ] . '_' . uniqid(), |
304 | 304 | 'content' => $_aNestedFieldset, |
@@ -35,47 +35,47 @@ discard block |
||
35 | 35 | // Optional |
36 | 36 | 'page_slug' => null, |
37 | 37 | 'tab_slug' => null, |
38 | - 'section_tab_slug' => null, // 3.0.0+ |
|
38 | + 'section_tab_slug' => null, // 3.0.0+ |
|
39 | 39 | 'title' => null, |
40 | 40 | 'description' => null, |
41 | 41 | 'capability' => null, |
42 | 42 | 'if' => true, |
43 | - 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
43 | + 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
44 | 44 | 'help' => null, |
45 | 45 | 'help_aside' => null, |
46 | - 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
47 | - 'sortable' => false, // (boolean|array) 3.6.0+ |
|
46 | + 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
47 | + 'sortable' => false, // (boolean|array) 3.6.0+ |
|
48 | 48 | 'attributes' => array( // 3.3.1+ |
49 | - 'class' => null, // set null to avoid undefined index warnings. |
|
50 | - 'style' => null, // set null to avoid undefined index warnings. |
|
49 | + 'class' => null, // set null to avoid undefined index warnings. |
|
50 | + 'style' => null, // set null to avoid undefined index warnings. |
|
51 | 51 | 'tab' => array(), |
52 | 52 | ), |
53 | 53 | 'class' => array( // 3.3.1+ |
54 | 54 | 'tab' => array(), |
55 | 55 | ), |
56 | - 'hidden' => false, // 3.3.1+ |
|
57 | - 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
58 | - 'save' => true, // 3.6.0+ |
|
56 | + 'hidden' => false, // 3.3.1+ |
|
57 | + 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
58 | + 'save' => true, // 3.6.0+ |
|
59 | 59 | |
60 | - 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
60 | + 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
61 | 61 | |
62 | - 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
62 | + 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
63 | 63 | |
64 | 64 | // Internal |
65 | - '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
66 | - '_structure_type' => null, // 3.7.0+ |
|
67 | - '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
68 | - '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
65 | + '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
66 | + '_structure_type' => null, // 3.7.0+ |
|
67 | + '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
68 | + '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
69 | 69 | |
70 | - '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
71 | - '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
72 | - '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
70 | + '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
71 | + '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
72 | + '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
73 | 73 | |
74 | 74 | // 3.6.0+ - (object) the caller framework factory object. This allows the framework to access the factory property when rendering the section. |
75 | 75 | // 3.7.0+ It no longer stores a factory object but a form object. |
76 | 76 | '_caller_object' => null, |
77 | 77 | |
78 | - 'show_debug_info' => null, // 3.8.8+ (boolean) Whether to display debug information. Inherits the page/in-page-tab setting (actually the factory property value of `$bShowDebugInfo` which gets updated by the page/tab setting). |
|
78 | + 'show_debug_info' => null, // 3.8.8+ (boolean) Whether to display debug information. Inherits the page/in-page-tab setting (actually the factory property value of `$bShowDebugInfo` which gets updated by the page/tab setting). |
|
79 | 79 | |
80 | 80 | ); |
81 | 81 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public $oCaller = null; |
96 | 96 | |
97 | - public $bShowDebugInfo = true; // 3.8.8+ |
|
97 | + public $bShowDebugInfo = true; // 3.8.8+ |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Sets up properties. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->sCapability, |
109 | 109 | $this->iCountOfElements, |
110 | 110 | $this->oCaller, |
111 | - $this->bShowDebugInfo, // 3.8.8+ |
|
111 | + $this->bShowDebugInfo, // 3.8.8+ |
|
112 | 112 | ); |
113 | 113 | $this->aSectionset = $_aParameters[ 0 ]; |
114 | 114 | $this->sSectionPath = $_aParameters[ 1 ]; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->sCapability = $_aParameters[ 3 ]; |
117 | 117 | $this->iCountOfElements = $_aParameters[ 4 ]; |
118 | 118 | $this->oCaller = $_aParameters[ 5 ]; |
119 | - $this->bShowDebugInfo = $_aParameters[ 6 ]; // 3.8.8+ |
|
119 | + $this->bShowDebugInfo = $_aParameters[ 6 ]; // 3.8.8+ |
|
120 | 120 | |
121 | 121 | } |
122 | 122 | |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | $_aSectionPath = explode( '|', $this->sSectionPath ); |
132 | 132 | $_aSectionset = $this->uniteArrays( |
133 | 133 | array( |
134 | - '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
135 | - '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
136 | - '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
134 | + '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
135 | + '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
136 | + '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
137 | 137 | '_section_path_array' => $_aSectionPath, |
138 | - '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
138 | + '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
139 | 139 | ) |
140 | 140 | + $this->aSectionset |
141 | 141 | + array( |
142 | 142 | 'capability' => $this->sCapability, |
143 | - 'show_debug_info' => $this->bShowDebugInfo, // 3.8.8+ |
|
143 | + 'show_debug_info' => $this->bShowDebugInfo, // 3.8.8+ |
|
144 | 144 | ), |
145 | 145 | self::$aStructure |
146 | 146 | ); |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | * @since 3.8.8 |
30 | 30 | */ |
31 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='Admin Page Framework' ) { |
|
31 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = 'Admin Page Framework' ) { |
|
32 | 32 | trigger_error( |
33 | - $sProgramName . ': ' . sprintf( |
|
33 | + $sProgramName.': '.sprintf( |
|
34 | 34 | $sAlternative |
35 | 35 | ? '<code>%1$s</code> has been deprecated. Use <code>%2$s</code> instead.' |
36 | 36 | : '<code>%1$s</code> has been deprecated.', |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param callable $oCallable |
53 | 53 | * @param string|array $asParameters Parameters to pass to the callback function. |
54 | 54 | */ |
55 | - public function callBack( $oCallable, $asParameters=array() ) { |
|
56 | - $_aParameters = self::getAsArray( |
|
55 | + public function callBack( $oCallable, $asParameters = array() ) { |
|
56 | + $_aParameters = self::getAsArray( |
|
57 | 57 | $asParameters, |
58 | 58 | true // preserve empty |
59 | 59 | ); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @since 3.6.3 |
90 | 90 | * @return string The captured output buffer. |
91 | 91 | */ |
92 | - static public function getOutputBuffer( $oCallable, array $aParameters=array() ) { |
|
92 | + static public function getOutputBuffer( $oCallable, array $aParameters = array() ) { |
|
93 | 93 | |
94 | 94 | ob_start(); |
95 | 95 | echo call_user_func_array( $oCallable, $aParameters ); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $_iCount = count( get_object_vars( $oInstance ) ); |
112 | 112 | $_sClassName = get_class( $oInstance ); |
113 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
113 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields false. |
128 | 128 | * @return mixed |
129 | 129 | */ |
130 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
130 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
131 | 131 | return $mValue ? $mTrue : $mFalse; |
132 | 132 | } |
133 | 133 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @deprecated 3.8.0 Use `getLengthSanitized()` instead. |
32 | 32 | * @since 3.8.8 Moved from `AdminPageFramework_Utility_String`. |
33 | 33 | */ |
34 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
34 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
35 | 35 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getLengthSanitized()' ); |
36 | 36 | return AdminPageFramework_Utility_String::getLengthSanitized( $sLength, $sUnit ); |
37 | 37 | } |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
51 | 51 | * @deprecated 3.5.3 Use `getElement()`. |
52 | 52 | */ |
53 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
53 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault = '', $bBlankToDefault = false ) { |
|
54 | 54 | |
55 | 55 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
56 | 56 | |
57 | 57 | // If $vSubject is null, |
58 | - if ( ! isset( $vSubject ) ) { |
|
58 | + if ( !isset( $vSubject ) ) { |
|
59 | 59 | return $sDefault; |
60 | 60 | } |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | // If $vSubject is not an array, |
68 | - if ( ! is_array( $vSubject ) ) { |
|
68 | + if ( !is_array( $vSubject ) ) { |
|
69 | 69 | return ( string ) $vSubject; |
70 | 70 | } // consider it as string. |
71 | 71 | |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * @since 3.5.3 Moved from `AdminPageFramework_FieldType_Base`. |
117 | 117 | * @deprecated 3.5.3 Use the `getElement()` method. |
118 | 118 | */ |
119 | - protected function getFieldElementByKey( $asElement, $sKey, $asDefault='' ) { |
|
119 | + protected function getFieldElementByKey( $asElement, $sKey, $asDefault = '' ) { |
|
120 | 120 | |
121 | 121 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
122 | 122 | |
123 | - if ( ! is_array( $asElement ) || ! isset( $sKey ) ) { |
|
123 | + if ( !is_array( $asElement ) || !isset( $sKey ) ) { |
|
124 | 124 | return $asElement; |
125 | 125 | } |
126 | 126 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__ ); |
145 | 145 | |
146 | - foreach( $aArray as &$vElem ) { |
|
146 | + foreach ( $aArray as &$vElem ) { |
|
147 | 147 | |
148 | 148 | if ( $vElem ) { break; } |
149 | 149 | unset( $vElem ); |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | |
178 | 178 | AdminPageFramework_Utility::showDeprecationNotice( __METHOD__, 'AdminPageFramework_WPUtility::getAttributes()' ); |
179 | 179 | |
180 | - $_sQuoteCharactor ="'"; |
|
180 | + $_sQuoteCharactor = "'"; |
|
181 | 181 | $_aOutput = array(); |
182 | - foreach( $aAttributes as $sAttribute => $sProperty ) { |
|
182 | + foreach ( $aAttributes as $sAttribute => $sProperty ) { |
|
183 | 183 | |
184 | 184 | // Must be resolved as a string. |
185 | 185 | if ( in_array( gettype( $sProperty ), array( 'array', 'object' ) ) ) { |
186 | 186 | continue; |
187 | 187 | } |
188 | - $_aOutput[] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
188 | + $_aOutput[ ] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | return implode( ' ', $_aOutput ); |
@@ -50,27 +50,27 @@ |
||
50 | 50 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
51 | 51 | * @deprecated 3.5.3 Use `getElement()`. |
52 | 52 | */ |
53 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
53 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
54 | 54 | |
55 | 55 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
56 | 56 | |
57 | 57 | // If $vSubject is null, |
58 | - if ( ! isset( $vSubject ) ) { |
|
58 | + if ( ! isset( $vSubject ) ) { |
|
59 | 59 | return $sDefault; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // If the $bBlankToDefault flag is set and the subject value is a blank string, return the default value. |
63 | - if ( $bBlankToDefault && $vSubject == '' ) { |
|
63 | + if ( $bBlankToDefault && $vSubject == '' ) { |
|
64 | 64 | return $sDefault; |
65 | 65 | } |
66 | 66 | |
67 | 67 | // If $vSubject is not an array, |
68 | - if ( ! is_array( $vSubject ) ) { |
|
68 | + if ( ! is_array( $vSubject ) ) { |
|
69 | 69 | return ( string ) $vSubject; |
70 | 70 | } // consider it as string. |
71 | 71 | |
72 | 72 | // Consider $vSubject as array. |
73 | - if ( isset( $vSubject[ $sKey ] ) ) { |
|
73 | + if ( isset( $vSubject[ $sKey ] ) ) { |
|
74 | 74 | return $vSubject[ $sKey ]; |
75 | 75 | } |
76 | 76 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @since 3.8.8 |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='' ) { |
|
26 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = '' ) { |
|
27 | 27 | $sProgramName = $sProgramName ? $sProgramName : self::getFrameworkName(); |
28 | 28 | parent::showDeprecationNotice( $sDeprecated, $sAlternative, $sProgramName ); |
29 | 29 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - foreach( ( array ) $GLOBALS[ '_apf_sub_menus_to_sort' ] as $_sIndex => $_sMenuSlug ) { |
|
46 | - if ( ! isset( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ) ) { |
|
45 | + foreach ( ( array ) $GLOBALS[ '_apf_sub_menus_to_sort' ] as $_sIndex => $_sMenuSlug ) { |
|
46 | + if ( !isset( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ) ) { |
|
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | ksort( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param boolean $bTrimDevVer Whether the `.dev` suffix should be removed or not. |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - static public function getFrameworkVersion( $bTrimDevVer=false ) { |
|
71 | + static public function getFrameworkVersion( $bTrimDevVer = false ) { |
|
72 | 72 | $_sVersion = AdminPageFramework_Registry::getVersion(); |
73 | 73 | return $bTrimDevVer |
74 | 74 | ? self::getSuffixRemoved( $_sVersion, '.dev' ) |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return string |
97 | 97 | */ |
98 | 98 | static public function getFrameworkNameVersion() { |
99 | - return self::getFrameworkName() . ' ' . self::getFrameworkVersion(); |
|
99 | + return self::getFrameworkName().' '.self::getFrameworkVersion(); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | } |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @since 3.3.0 |
29 | 29 | */ |
30 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
30 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
31 | 31 | |
32 | 32 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
33 | 33 | ? $this->aSubClassNames[ 'oProp' ] |
34 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
34 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
35 | 35 | |
36 | 36 | $this->oProp = new $_sProprtyClassName( |
37 | 37 | $this, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ( $this->oProp->bIsAdminAjax ) { |
48 | 48 | return; |
49 | 49 | } |
50 | - if ( ! $this->oProp->bIsAdmin ) { |
|
50 | + if ( !$this->oProp->bIsAdmin ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
94 | 94 | * @internal |
95 | 95 | */ |
96 | - public function __call( $sMethodName, $aArgs=null ) { |
|
96 | + public function __call( $sMethodName, $aArgs = null ) { |
|
97 | 97 | |
98 | 98 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
99 | 99 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | 'load_pre_', |
105 | 105 | ); |
106 | 106 | |
107 | - switch( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
107 | + switch ( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
108 | 108 | |
109 | 109 | // add_settings_section() callback |
110 | 110 | case 'section_pre_': |
111 | - return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
111 | + return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
112 | 112 | |
113 | 113 | // add_settings_field() callback |
114 | 114 | case 'field_pre_': |
115 | - return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
115 | + return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
116 | 116 | |
117 | 117 | // load-{page} callback |
118 | 118 | case 'load_pre_': |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @return string The found callback method name or the prefix of a known callback method name. An empty string if not found. |
131 | 131 | * @internal |
132 | 132 | */ |
133 | - private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes=array() ) { |
|
133 | + private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes = array() ) { |
|
134 | 134 | |
135 | - foreach( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
135 | + foreach ( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
136 | 136 | if ( $this->oUtil->hasPrefix( $_sMethodPrefix, $sMethodName ) ) { |
137 | 137 | return $_sMethodPrefix; |
138 | 138 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function _doPageLoadCall( $sMethodName, $sPageSlug, $sTabSlug, $oScreen ) { |
158 | 158 | |
159 | - if ( ! $this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
159 | + if ( !$this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $this->_setShowDebugInfoProperty( $sPageSlug ); // 3.8.8+ |
167 | 167 | |
168 | 168 | // Do actions in this order, class -> page -> in-page tab. This order is important as some methods rely on it. |
169 | - $this->load(); // 3.7.12+ |
|
169 | + $this->load(); // 3.7.12+ |
|
170 | 170 | $this->oUtil->addAndDoActions( |
171 | 171 | $this, // the caller object |
172 | 172 | array( |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | $sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
184 | 184 | |
185 | 185 | if ( strlen( $sTabSlug ) ) { |
186 | - $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
186 | + $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
187 | 187 | $this->oUtil->addAndDoActions( |
188 | 188 | $this, // the caller object |
189 | - array( "load_{$sPageSlug}_" . $sTabSlug ), |
|
189 | + array( "load_{$sPageSlug}_".$sTabSlug ), |
|
190 | 190 | $this // the admin page object - this lets third-party scripts use the framework methods. |
191 | 191 | ); |
192 | 192 | } |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | * @since 3.8.8 |
212 | 212 | * @return void |
213 | 213 | */ |
214 | - private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug='' ) { |
|
214 | + private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug = '' ) { |
|
215 | 215 | |
216 | 216 | // For the page, |
217 | - if ( ! strlen( $sTabSlug ) ) { |
|
217 | + if ( !strlen( $sTabSlug ) ) { |
|
218 | 218 | $this->oProp->bShowDebugInfo = $this->oUtil->getElement( |
219 | 219 | $this->oProp->aPages, |
220 | 220 | array( $sPageSlug, 'show_debug_info' ), |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | if ( substr( $sMethodName, strlen( 'load_pre_' ) ) !== $sPageSlug ) { |
260 | 260 | return false; |
261 | 261 | } |
262 | - if ( ! isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
262 | + if ( !isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | if ( $sScreenID !== $this->oProp->aPageHooks[ $sPageSlug ] ) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | // Nothing to do in the network admin area. |
289 | - return ! is_network_admin(); |
|
289 | + return !is_network_admin(); |
|
290 | 290 | |
291 | 291 | } |
292 | 292 | |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | public function _isInThePage() { |
302 | 302 | |
303 | 303 | // If the setUp method is not loaded yet, |
304 | - if ( ! did_action( 'set_up_' . $this->oProp->sClassName ) ) { |
|
304 | + if ( !did_action( 'set_up_'.$this->oProp->sClassName ) ) { |
|
305 | 305 | return true; |
306 | 306 | } |
307 | 307 | |
308 | - if ( ! isset( $_GET[ 'page' ] ) ) { |
|
308 | + if ( !isset( $_GET[ 'page' ] ) ) { |
|
309 | 309 | return false; |
310 | 310 | } |
311 | 311 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
94 | 94 | * @internal |
95 | 95 | */ |
96 | - public function __call( $sMethodName, $aArgs=null ) { |
|
96 | + public function __call( $sMethodName, $aArgs=null ) { |
|
97 | 97 | |
98 | 98 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
99 | 99 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // Note that the if the tab is the first item, and the user arrives the page by clicking on the sidebar menu, the tab slug will be empty unless an in-page tab is added. |
183 | 183 | $sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
184 | 184 | |
185 | - if ( strlen( $sTabSlug ) ) { |
|
185 | + if ( strlen( $sTabSlug ) ) { |
|
186 | 186 | $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
187 | 187 | $this->oUtil->addAndDoActions( |
188 | 188 | $this, // the caller object |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | return true; |
306 | 306 | } |
307 | 307 | |
308 | - if ( ! isset( $_GET[ 'page' ] ) ) { |
|
308 | + if ( ! isset( $_GET[ 'page' ] ) ) { |
|
309 | 309 | return false; |
310 | 310 | } |
311 | 311 |