@@ -426,7 +426,7 @@ |
||
426 | 426 | * |
427 | 427 | * @since 2.0.0 |
428 | 428 | * @param array $vValue This can be either an one-dimensional array ( for single field ) or a two-dimensional array ( for multiple fields ). |
429 | - * @param string $sKey |
|
429 | + * @param string $sTaxonomySlug |
|
430 | 430 | * @return array Returns an numerically indexed array holding the keys that yield true as the value. |
431 | 431 | */ |
432 | 432 | private function _getSelectedKeyArray( $vValue, $sTaxonomySlug ) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'taxonomy', ); |
|
24 | + public $aFieldTypeSlugs = array( 'taxonomy',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -29,40 +29,40 @@ discard block |
||
29 | 29 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
30 | 30 | */ |
31 | 31 | protected $aDefaultKeys = array( |
32 | - 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
33 | - 'height' => '250px', // the tab box height |
|
34 | - 'width' => null, // 3.5.7.2+ the tab box width |
|
35 | - 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
36 | - 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
32 | + 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
33 | + 'height' => '250px', // the tab box height |
|
34 | + 'width' => null, // 3.5.7.2+ the tab box width |
|
35 | + 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
36 | + 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
37 | 37 | 'attributes' => array(), |
38 | - 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
39 | - 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
40 | - 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
41 | - 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
38 | + 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
39 | + 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
40 | + 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
41 | + 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
42 | 42 | 'query' => array( // (array) 3.3.2+ Defines the default query argument. |
43 | 43 | // see the arguments of the get_category() function: http://codex.wordpress.org/Function_Reference/get_categories |
44 | 44 | // see the argument of the get_terms() function: http://codex.wordpress.org/Function_Reference/get_terms |
45 | 45 | 'child_of' => 0, |
46 | 46 | 'parent' => '', |
47 | - 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
48 | - 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
49 | - 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
50 | - 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
51 | - 'number' => '', // (integer) The maximum number of the terms to show. |
|
52 | - 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
53 | - 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
47 | + 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
48 | + 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
49 | + 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
50 | + 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
51 | + 'number' => '', // (integer) The maximum number of the terms to show. |
|
52 | + 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
53 | + 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
54 | 54 | 'exclude_tree' => array(), |
55 | - 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
55 | + 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
56 | 56 | 'fields' => 'all', |
57 | 57 | 'slug' => '', |
58 | 58 | 'get' => '', |
59 | 59 | 'name__like' => '', |
60 | 60 | 'description__like' => '', |
61 | 61 | 'offset' => '', |
62 | - 'search' => '', // (string) The search keyword to get the term with. |
|
62 | + 'search' => '', // (string) The search keyword to get the term with. |
|
63 | 63 | 'cache_domain' => 'core', |
64 | 64 | ), |
65 | - 'queries' => array(), // (optional, array) 3.3.2+ Allows to set a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
65 | + 'queries' => array(), // (optional, array) 3.3.2+ Allows to set a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $_aJSArray = json_encode( $this->aFieldTypeSlugs ); |
90 | 90 | |
91 | - return parent::getScripts() . |
|
91 | + return parent::getScripts(). |
|
92 | 92 | // return |
93 | 93 | <<<JAVASCRIPTS |
94 | 94 | /* For tabs */ |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | protected function getField( $aField ) { |
322 | 322 | |
323 | 323 | // Format |
324 | - $aField['label_no_term_found'] = $this->getElement( |
|
324 | + $aField[ 'label_no_term_found' ] = $this->getElement( |
|
325 | 325 | $aField, |
326 | 326 | 'label_no_term_found', |
327 | 327 | $this->oMsg->get( 'no_term_found' ) |
@@ -330,18 +330,18 @@ discard block |
||
330 | 330 | // Parse |
331 | 331 | $_aTabs = array(); |
332 | 332 | $_aCheckboxes = array(); |
333 | - foreach( $this->getAsArray( $aField['taxonomy_slugs'] ) as $sKey => $sTaxonomySlug ) { |
|
334 | - $_aTabs[] = $this->_getTaxonomyTab( $aField, $sKey, $sTaxonomySlug ); |
|
335 | - $_aCheckboxes[] = $this->_getTaxonomyCheckboxes( $aField, $sKey, $sTaxonomySlug ); |
|
333 | + foreach ( $this->getAsArray( $aField[ 'taxonomy_slugs' ] ) as $sKey => $sTaxonomySlug ) { |
|
334 | + $_aTabs[ ] = $this->_getTaxonomyTab( $aField, $sKey, $sTaxonomySlug ); |
|
335 | + $_aCheckboxes[ ] = $this->_getTaxonomyCheckboxes( $aField, $sKey, $sTaxonomySlug ); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // Output |
339 | - return "<div id='tabbox-{$aField['field_id']}' class='tab-box-container categorydiv' style='max-width:{$aField['max_width']};'>" |
|
339 | + return "<div id='tabbox-{$aField[ 'field_id' ]}' class='tab-box-container categorydiv' style='max-width:{$aField[ 'max_width' ]};'>" |
|
340 | 340 | . "<ul class='tab-box-tabs category-tabs'>" |
341 | 341 | . implode( PHP_EOL, $_aTabs ) |
342 | 342 | . "</ul>" |
343 | 343 | . "<div class='tab-box-contents-container'>" |
344 | - . "<div class='tab-box-contents' style='height: {$aField['height']};'>" |
|
344 | + . "<div class='tab-box-contents' style='height: {$aField[ 'height' ]};'>" |
|
345 | 345 | . implode( PHP_EOL, $_aCheckboxes ) |
346 | 346 | . "</div>" |
347 | 347 | . "</div>" |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | private function _getTaxonomyCheckboxes( array $aField, $sKey, $sTaxonomySlug ) { |
359 | 359 | |
360 | 360 | $_aTabBoxContainerArguments = array( |
361 | - 'id' => "tab_{$aField['input_id']}_{$sKey}", |
|
361 | + 'id' => "tab_{$aField[ 'input_id' ]}_{$sKey}", |
|
362 | 362 | 'class' => 'tab-box-content', |
363 | 363 | 'style' => $this->generateInlineCSS( |
364 | 364 | array( |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | ) |
368 | 368 | ), |
369 | 369 | ); |
370 | - return "<div " . $this->getAttributes( $_aTabBoxContainerArguments ) . ">" |
|
370 | + return "<div ".$this->getAttributes( $_aTabBoxContainerArguments ).">" |
|
371 | 371 | . $this->getElement( $aField, array( 'before_label', $sKey ) ) |
372 | - . "<div " . $this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ) . "></div>" |
|
372 | + . "<div ".$this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) )."></div>" |
|
373 | 373 | . "<ul class='list:category taxonomychecklist form-no-clear'>" |
374 | 374 | . $this->_getTaxonomyChecklist( $aField, $sKey, $sTaxonomySlug ) |
375 | 375 | . "</ul>" |
@@ -389,23 +389,23 @@ discard block |
||
389 | 389 | array( |
390 | 390 | 'walker' => new AdminPageFramework_WalkerTaxonomyChecklist, // the walker class instance |
391 | 391 | 'taxonomy' => $sTaxonomySlug, |
392 | - '_name_prefix' => is_array( $aField['taxonomy_slugs'] ) |
|
393 | - ? "{$aField['_input_name']}[{$sTaxonomySlug}]" |
|
394 | - : $aField['_input_name'], // name prefix of the input |
|
395 | - '_input_id_prefix' => $aField['input_id'], |
|
392 | + '_name_prefix' => is_array( $aField[ 'taxonomy_slugs' ] ) |
|
393 | + ? "{$aField[ '_input_name' ]}[{$sTaxonomySlug}]" |
|
394 | + : $aField[ '_input_name' ], // name prefix of the input |
|
395 | + '_input_id_prefix' => $aField[ 'input_id' ], |
|
396 | 396 | '_attributes' => $this->getElement( |
397 | 397 | $aField, |
398 | 398 | array( 'attributes', $sKey ), |
399 | 399 | array() |
400 | - ) + $aField['attributes'], |
|
400 | + ) + $aField[ 'attributes' ], |
|
401 | 401 | |
402 | 402 | // checked items ( term IDs ) e.g. array( 6, 10, 7, 15 ), |
403 | - '_selected_items' => $this->_getSelectedKeyArray( $aField['value'], $sTaxonomySlug ), |
|
403 | + '_selected_items' => $this->_getSelectedKeyArray( $aField[ 'value' ], $sTaxonomySlug ), |
|
404 | 404 | |
405 | - 'echo' => false, // returns the output |
|
406 | - 'show_post_count' => $aField['show_post_count'], // 3.2.0+ |
|
407 | - 'show_option_none' => $aField['label_no_term_found'], // 3.3.2+ |
|
408 | - 'title_li' => $aField['label_list_title'], // 3.3.2+ |
|
405 | + 'echo' => false, // returns the output |
|
406 | + 'show_post_count' => $aField[ 'show_post_count' ], // 3.2.0+ |
|
407 | + 'show_option_none' => $aField[ 'label_no_term_found' ], // 3.3.2+ |
|
408 | + 'title_li' => $aField[ 'label_list_title' ], // 3.3.2+ |
|
409 | 409 | ) |
410 | 410 | + $this->getAsArray( |
411 | 411 | $this->getElement( |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | ), |
416 | 416 | true |
417 | 417 | ) |
418 | - + $aField['query'] |
|
418 | + + $aField[ 'query' ] |
|
419 | 419 | ); |
420 | 420 | } |
421 | 421 | |
@@ -433,10 +433,10 @@ discard block |
||
433 | 433 | |
434 | 434 | $vValue = ( array ) $vValue; // cast array because the initial value (null) may not be an array. |
435 | 435 | |
436 | - if ( ! isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
436 | + if ( !isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
437 | 437 | return array(); |
438 | 438 | } |
439 | - if ( ! is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
439 | + if ( !is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
440 | 440 | return array(); |
441 | 441 | } |
442 | 442 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | private function _getTaxonomyTab( array $aField, $sKey, $sTaxonomySlug ) { |
454 | 454 | return "<li class='tab-box-tab'>" |
455 | - . "<a href='#tab_{$aField['input_id']}_{$sKey}'>" |
|
455 | + . "<a href='#tab_{$aField[ 'input_id' ]}_{$sKey}'>" |
|
456 | 456 | . "<span class='tab-box-tab-text'>" |
457 | 457 | . $this->_getLabelFromTaxonomySlug( $sTaxonomySlug ) |
458 | 458 | . "</span>" |
@@ -433,10 +433,10 @@ |
||
433 | 433 | |
434 | 434 | $vValue = ( array ) $vValue; // cast array because the initial value (null) may not be an array. |
435 | 435 | |
436 | - if ( ! isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
436 | + if ( ! isset( $vValue[ $sTaxonomySlug ] ) ) { |
|
437 | 437 | return array(); |
438 | 438 | } |
439 | - if ( ! is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
439 | + if ( ! is_array( $vValue[ $sTaxonomySlug ] ) ) { |
|
440 | 440 | return array(); |
441 | 441 | } |
442 | 442 |
@@ -105,10 +105,8 @@ |
||
105 | 105 | * If a parameter is not passed, it returns the entire attribute array. |
106 | 106 | * |
107 | 107 | * @since 3.5.3 |
108 | - * @return string|array|null The specified attribute value or the entire attribute array if not specified. |
|
108 | + * @return string The specified attribute value or the entire attribute array if not specified. |
|
109 | 109 | * If not set, null will be returned as the `getAttributes()` method will not list an attribute with the null value. |
110 | - * @param string $sName The attribute name. |
|
111 | - * @param string $sDefault The defaqult value if the value is not set. |
|
112 | 110 | */ |
113 | 111 | public function getAttribute( /* $sName=null, $sDefault=null */ ) { |
114 | 112 | $_aParams = func_get_args() + array( |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param array $aAttributes The attribute array. A field definition array is deprecated. |
64 | 64 | * @param array $aOptions options that allows to set custom container tags and class selctors. |
65 | 65 | */ |
66 | - public function __construct( array $aAttributes, array $aOptions=array() ) { |
|
66 | + public function __construct( array $aAttributes, array $aOptions = array() ) { |
|
67 | 67 | |
68 | - $this->aAttributes = $this->getElementAsArray( |
|
68 | + $this->aAttributes = $this->getElementAsArray( |
|
69 | 69 | $aAttributes, |
70 | 70 | 'attributes', |
71 | 71 | $aAttributes // if the above key is not set, this will be set |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | * @return string The set class selector(s). |
128 | 128 | */ |
129 | 129 | public function addClass( /* $asSelectors1, $asSelectors2 */ ) { |
130 | - foreach( func_get_args() as $_asSelectors ) { |
|
131 | - $this->aAttributes['class'] = $this->getClassAttribute( |
|
132 | - $this->aAttributes['class'], |
|
130 | + foreach ( func_get_args() as $_asSelectors ) { |
|
131 | + $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
|
132 | + $this->aAttributes[ 'class' ], |
|
133 | 133 | $_asSelectors |
134 | 134 | ); |
135 | 135 | } |
136 | - return $this->aAttributes['class']; |
|
136 | + return $this->aAttributes[ 'class' ]; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // $this->aAttributes[ $_aParams[ 0 ] ] = $_aParams[ 1 ]; |
159 | 159 | $this->setMultiDimensionalArray( |
160 | 160 | $this->aAttributes, |
161 | - $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
161 | + $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
162 | 162 | $_aParams[ 1 ] // $mValue |
163 | 163 | ); |
164 | 164 | } |
@@ -127,7 +127,7 @@ |
||
127 | 127 | * @return string The set class selector(s). |
128 | 128 | */ |
129 | 129 | public function addClass( /* $asSelectors1, $asSelectors2 */ ) { |
130 | - foreach( func_get_args() as $_asSelectors ) { |
|
130 | + foreach( func_get_args() as $_asSelectors ) { |
|
131 | 131 | $this->aAttributes['class'] = $this->getClassAttribute( |
132 | 132 | $this->aAttributes['class'], |
133 | 133 | $_asSelectors |
@@ -21,8 +21,6 @@ |
||
21 | 21 | * Returns the output of the input element. |
22 | 22 | * |
23 | 23 | * @since 3.4.0 |
24 | - * @param string $sLabel The label text. |
|
25 | - * @param array $aAttributes (optional) The attribute array. If set, it will be merged with the attribute set in the constructor. |
|
26 | 24 | */ |
27 | 25 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
28 | 26 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | // Output |
48 | 48 | return |
49 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
49 | + "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
50 | 50 | // the unchecked value must be set prior to the checkbox input field. |
51 | 51 | . "<input " . $this->getAttributes( |
52 | 52 | array( |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
28 | 28 | |
29 | 29 | // Parameters |
30 | - $_aParams = func_get_args() + array( |
|
31 | - 0 => '', // 1st parameter |
|
30 | + $_aParams = func_get_args() + array( |
|
31 | + 0 => '', // 1st parameter |
|
32 | 32 | 1 => array() // 2nd parameter |
33 | 33 | ); |
34 | - $_sLabel = $_aParams[ 0 ]; // first parameter |
|
34 | + $_sLabel = $_aParams[ 0 ]; // first parameter |
|
35 | 35 | |
36 | 36 | // Attributes |
37 | 37 | $_aAttributes = $this->uniteArrays( // second parameter |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | // Output |
48 | 48 | return |
49 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
49 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
50 | 50 | // the unchecked value must be set prior to the checkbox input field. |
51 | - . "<input " . $this->getAttributes( |
|
51 | + . "<input ".$this->getAttributes( |
|
52 | 52 | array( |
53 | 53 | 'type' => 'hidden', |
54 | 54 | 'class' => $_aAttributes[ 'class' ], |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | ) |
58 | 58 | ) |
59 | 59 | . " />" |
60 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
60 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
61 | 61 | . "</{$this->aOptions[ 'input_container_tag' ]}>" |
62 | - . "<{$this->aOptions[ 'label_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ) . ">" |
|
62 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
63 | 63 | . $_sLabel |
64 | 64 | . "</{$this->aOptions[ 'label_container_tag' ]}>" |
65 | 65 | ; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function getAttributesByKey( /* $sKey */ ) { |
76 | 76 | |
77 | 77 | // Parameters |
78 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
78 | + $_aParams = func_get_args() + array( 0 => '',); |
|
79 | 79 | $_sKey = $_aParams[ 0 ]; |
80 | 80 | $_bIsMultiple = '' !== $_sKey; |
81 | 81 | |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | // The type needs to be specified since the postytpe field type extends this class. If not set, the 'posttype' will be passed to the type attribute. |
88 | 88 | + array( |
89 | 89 | 'type' => 'checkbox', |
90 | - 'id' => $this->aAttributes[ 'id' ] . '_' . $_sKey, |
|
90 | + 'id' => $this->aAttributes[ 'id' ].'_'.$_sKey, |
|
91 | 91 | 'checked' => $this->_getCheckedAttributeValue( $_sKey ), |
92 | - 'value' => 1, // this must be always 1 because the key value can be zero. In that case, the value always will be false and unchecked. |
|
92 | + 'value' => 1, // this must be always 1 because the key value can be zero. In that case, the value always will be false and unchecked. |
|
93 | 93 | 'name' => $_bIsMultiple |
94 | 94 | ? "{$this->aAttributes[ 'name' ]}[{$_sKey}]" |
95 | 95 | : $this->aAttributes[ 'name' ], |
96 | - 'data-id' => $this->aAttributes[ 'id' ], // referenced by the JavaScript scripts such as the revealer script. |
|
96 | + 'data-id' => $this->aAttributes[ 'id' ], // referenced by the JavaScript scripts such as the revealer script. |
|
97 | 97 | ) |
98 | 98 | + $this->aAttributes |
99 | 99 | ; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | : array( 'value', $_sKey ); |
111 | 111 | return $this->getElement( $this->aAttributes, $_aValueDimension ) |
112 | 112 | ? 'checked' |
113 | - : null; // to not to set, pass null. An empty value '' will still set the attribute. |
|
113 | + : null; // to not to set, pass null. An empty value '' will still set the attribute. |
|
114 | 114 | |
115 | 115 | } |
116 | 116 |
@@ -21,8 +21,6 @@ discard block |
||
21 | 21 | * Returns the output of the input element. |
22 | 22 | * |
23 | 23 | * @since 3.4.0 |
24 | - * @param string $sLabel The label text. |
|
25 | - * @param array $aAttributes (optional) The attribute array. If set, it will be merged with the attribute set in the constructor. |
|
26 | 24 | */ |
27 | 25 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
28 | 26 | |
@@ -52,8 +50,6 @@ discard block |
||
52 | 50 | * |
53 | 51 | * @return array The updated attribute array. |
54 | 52 | * @since 3.5.3 |
55 | - * @param string $sKey The array element key of the radio button. |
|
56 | - * It is assumed that there is an array that holds multiple radio buttons and each of them has an array key. |
|
57 | 53 | */ |
58 | 54 | public function getAttributesByKey( /* $sKey */ ) { |
59 | 55 |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | |
37 | 37 | // Output |
38 | 38 | return |
39 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
40 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
41 | - . "</{$this->aOptions['input_container_tag']}>" |
|
42 | - . "<{$this->aOptions['label_container_tag']} " . $this->getAttributes( $this->aOptions['label_container_attributes'] ) . ">" |
|
39 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
40 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
41 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
42 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
43 | 43 | . $_sLabel |
44 | - . "</{$this->aOptions['label_container_tag']}>" |
|
44 | + . "</{$this->aOptions[ 'label_container_tag' ]}>" |
|
45 | 45 | ; |
46 | 46 | |
47 | 47 | } |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | public function getAttributesByKey( /* $sKey */ ) { |
59 | 59 | |
60 | 60 | // Parameters |
61 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
62 | - $_sKey = $_aParams[ 0 ]; |
|
61 | + $_aParams = func_get_args() + array( 0 => '',); |
|
62 | + $_sKey = $_aParams[ 0 ]; |
|
63 | 63 | |
64 | 64 | // Result |
65 | 65 | return $this->getElementAsArray( $this->aAttributes, $_sKey, array() ) |
66 | 66 | + array( |
67 | 67 | 'type' => 'radio', |
68 | - 'checked' => isset( $this->aAttributes['value'] ) && $this->aAttributes['value'] == $_sKey |
|
68 | + 'checked' => isset( $this->aAttributes[ 'value' ] ) && $this->aAttributes[ 'value' ] == $_sKey |
|
69 | 69 | ? 'checked' |
70 | 70 | : null, |
71 | 71 | 'value' => $_sKey, |
72 | 72 | // 'id' => $this->aField['input_id'] . '_' . $_sKey, |
73 | - 'id' => $this->getAttribute( 'id' ) . '_' . $_sKey, |
|
73 | + 'id' => $this->getAttribute( 'id' ).'_'.$_sKey, |
|
74 | 74 | // 'data-default' => $this->aField['default'], // refered by the repeater script |
75 | 75 | // 'data-id' => $this->aField['input_id'], // refered by the JavaScript scripts such as the revealer script. |
76 | - 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
76 | + 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
77 | 77 | ) |
78 | 78 | + $this->aAttributes; |
79 | 79 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @internal |
123 | 123 | * @param string $sInputID The input ID that will be the base of each generated option tag ID. |
124 | 124 | * @param array $aLabels The array holding labels. |
125 | - * @param array $aAttributes The attribute arrays. Accepts the following arguments. |
|
125 | + * @param array $aBaseAttributes The attribute arrays. Accepts the following arguments. |
|
126 | 126 | * - optgroup |
127 | 127 | * - option |
128 | 128 | */ |
@@ -160,6 +160,7 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * Returns an HTML output of optgroup tag. |
162 | 162 | * @since 3.5.3 |
163 | + * @param string $sInputID |
|
163 | 164 | * @return string an HTML output of optgroup tag. |
164 | 165 | */ |
165 | 166 | private function _getOptGroup( array $aBaseAttributes, $sInputID, $sKey, $asLabel ) { |
@@ -179,6 +180,7 @@ discard block |
||
179 | 180 | /** |
180 | 181 | * |
181 | 182 | * @since 3.5.3 |
183 | + * @param string $sInputID |
|
182 | 184 | */ |
183 | 185 | private function _getOptionTagAttributes( array $aBaseAttributes, $sInputID, $sKey, $aValues ) { |
184 | 186 |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | return |
72 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
73 | - . "<select " . $this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) ) . " >" |
|
72 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
73 | + . "<select ".$this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) )." >" |
|
74 | 74 | . $this->_getDropDownList( |
75 | 75 | $this->getAttribute( 'id' ), |
76 | 76 | $this->getAsArray( |
77 | 77 | isset( $_aLabels ) |
78 | 78 | ? $_aLabels |
79 | - : $this->aField[ 'label' ], // backward compatibility |
|
79 | + : $this->aField[ 'label' ], // backward compatibility |
|
80 | 80 | true |
81 | 81 | ), |
82 | 82 | $_aAttributes |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | ? 'multiple' |
105 | 105 | : null, |
106 | 106 | 'name' => $_bIsMultiple |
107 | - ? $this->getAttribute( 'name' ) . '[]' |
|
107 | + ? $this->getAttribute( 'name' ).'[]' |
|
108 | 108 | : $this->getAttribute( 'name' ), |
109 | - 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
109 | + 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
110 | 110 | ) |
111 | 111 | ); |
112 | 112 | |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private function _getDropDownList( $sInputID, array $aLabels, array $aBaseAttributes ) { |
130 | 130 | |
131 | - $_aOutput = array(); |
|
132 | - foreach( $aLabels as $__sKey => $__asLabel ) { |
|
131 | + $_aOutput = array(); |
|
132 | + foreach ( $aLabels as $__sKey => $__asLabel ) { |
|
133 | 133 | |
134 | 134 | // For an optgroup tag, |
135 | 135 | if ( is_array( $__asLabel ) ) { |
136 | - $_aOutput[] = $this->_getOptGroup( |
|
136 | + $_aOutput[ ] = $this->_getOptGroup( |
|
137 | 137 | $aBaseAttributes, |
138 | 138 | $sInputID, |
139 | 139 | $__sKey, |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // A normal option tag, |
146 | - $_aOutput[] = $this->_getOptionTag( |
|
147 | - $__asLabel, // the text label the user sees to be selected |
|
146 | + $_aOutput[ ] = $this->_getOptionTag( |
|
147 | + $__asLabel, // the text label the user sees to be selected |
|
148 | 148 | $this->_getOptionTagAttributes( |
149 | 149 | $aBaseAttributes, |
150 | 150 | $sInputID, |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $_aOptGroupAttributes = array( |
171 | 171 | 'label' => $sKey, |
172 | 172 | ) + $_aOptGroupAttributes; |
173 | - return "<optgroup " . $this->getAttributes( $_aOptGroupAttributes ) . ">" |
|
173 | + return "<optgroup ".$this->getAttributes( $_aOptGroupAttributes ).">" |
|
174 | 174 | . $this->_getDropDownList( $sInputID, $asLabel, $aBaseAttributes ) |
175 | 175 | . "</optgroup>"; |
176 | 176 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $aValues |
189 | 189 | ); |
190 | 190 | return array( |
191 | - 'id' => $sInputID . '_' . $sKey, |
|
191 | + 'id' => $sInputID.'_'.$sKey, |
|
192 | 192 | 'value' => $sKey, |
193 | 193 | 'selected' => in_array( ( string ) $sKey, $aValues ) |
194 | 194 | ? 'selected' |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @sicne 3.4.0 |
205 | 205 | * @return string The generated option tag HTML output. |
206 | 206 | */ |
207 | - private function _getOptionTag( $sLabel, array $aOptionTagAttributes=array() ) { |
|
208 | - return "<option " . $this->getAttributes( $aOptionTagAttributes ) . " >" |
|
207 | + private function _getOptionTag( $sLabel, array $aOptionTagAttributes = array() ) { |
|
208 | + return "<option ".$this->getAttributes( $aOptionTagAttributes )." >" |
|
209 | 209 | . $sLabel |
210 | 210 | . "</option>"; |
211 | 211 | } |
@@ -170,6 +170,7 @@ |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * The recursive version of the glob() function. |
173 | + * @param string $sPathPatten |
|
173 | 174 | */ |
174 | 175 | protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
175 | 176 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'is_recursive' => true, |
38 | 38 | 'exclude_dir_paths' => array(), |
39 | 39 | 'exclude_dir_names' => array( 'asset', 'assets', 'css', 'js', 'image', 'images', 'license', 'document', 'documents' ), |
40 | - 'allowed_extensions' => array( 'php', ), // 'inc' |
|
40 | + 'allowed_extensions' => array( 'php',), // 'inc' |
|
41 | 41 | 'include_function' => 'include', |
42 | 42 | 'exclude_class_names' => array( /* 'SomeClass', 'SomeOtherClass' */ ), |
43 | 43 | ); |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | * </code> |
66 | 66 | * @remark The directory paths set for the 'exclude_dir_paths' option should use the system directory separator. |
67 | 67 | */ |
68 | - function __construct( $asScanDirPaths, array $aOptions=array(), array $aClasses=array() ) { |
|
68 | + function __construct( $asScanDirPaths, array $aOptions = array(), array $aClasses = array() ) { |
|
69 | 69 | |
70 | 70 | $_aOptions = $aOptions + self::$_aStructure_Options; |
71 | - $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
71 | + $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
72 | 72 | $this->_registerClasses( $_aOptions[ 'include_function' ] ); |
73 | 73 | |
74 | 74 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return array(); |
94 | 94 | } |
95 | 95 | $_aFilePaths = array(); |
96 | - foreach( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
96 | + foreach ( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
97 | 97 | if ( realpath( $_sClassDirPath ) ) { |
98 | 98 | $_aFilePaths = array_merge( $this->getFilePaths( $_sClassDirPath, $aSearchOptions ), $_aFilePaths ); |
99 | 99 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | |
102 | 102 | // Store classes in an array. |
103 | 103 | $_aClasses = array(); |
104 | - foreach( $_aFilePaths as $_sFilePath ) { |
|
104 | + foreach ( $_aFilePaths as $_sFilePath ) { |
|
105 | 105 | |
106 | 106 | // Class name without a file extension. |
107 | 107 | $_sClassNameWOExt = pathinfo( $_sFilePath, PATHINFO_FILENAME ); |
108 | - if ( in_array( $_sClassNameWOExt, $aSearchOptions['exclude_class_names'] ) ) { |
|
108 | + if ( in_array( $_sClassNameWOExt, $aSearchOptions[ 'exclude_class_names' ] ) ) { |
|
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | $_aClasses[ $_sClassNameWOExt ] = $_sFilePath; |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getFilePaths( $sClassDirPath, array $aSearchOptions ) { |
136 | 136 | |
137 | - $sClassDirPath = rtrim( $sClassDirPath, '\\/' ) . DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
138 | - $_aAllowedExtensions = $aSearchOptions['allowed_extensions']; |
|
139 | - $_aExcludeDirPaths = ( array ) $aSearchOptions['exclude_dir_paths']; |
|
140 | - $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
|
137 | + $sClassDirPath = rtrim( $sClassDirPath, '\\/' ).DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
138 | + $_aAllowedExtensions = $aSearchOptions[ 'allowed_extensions' ]; |
|
139 | + $_aExcludeDirPaths = ( array ) $aSearchOptions[ 'exclude_dir_paths' ]; |
|
140 | + $_aExcludeDirNames = ( array ) $aSearchOptions[ 'exclude_dir_names' ]; |
|
141 | 141 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
142 | 142 | |
143 | 143 | if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
144 | 144 | $_aFilePaths = $_bIsRecursive |
145 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
146 | - : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
145 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
146 | + : ( array ) glob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
147 | 147 | return array_filter( $_aFilePaths ); // drop non-value elements. |
148 | 148 | } |
149 | 149 | |
150 | 150 | // For the Solaris operation system. |
151 | 151 | $_aFilePaths = array(); |
152 | - foreach( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
152 | + foreach ( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
153 | 153 | |
154 | 154 | $__aFilePaths = $_bIsRecursive |
155 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
156 | - : ( array ) glob( $sClassDirPath . '*.' . $__sAllowedExtension ); |
|
155 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
156 | + : ( array ) glob( $sClassDirPath.'*.'.$__sAllowedExtension ); |
|
157 | 157 | |
158 | 158 | $_aFilePaths = array_merge( $__aFilePaths, $_aFilePaths ); |
159 | 159 | |
@@ -165,27 +165,27 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * Constructs the file pattern of the file extension part used for the glob() function with the given file extensions. |
167 | 167 | */ |
168 | - protected function _getGlobPatternExtensionPart( array $aExtensions=array( 'php', 'inc' ) ) { |
|
168 | + protected function _getGlobPatternExtensionPart( array $aExtensions = array( 'php', 'inc' ) ) { |
|
169 | 169 | return empty( $aExtensions ) |
170 | 170 | ? '*' |
171 | - : '{' . implode( ',', $aExtensions ) . '}'; |
|
171 | + : '{'.implode( ',', $aExtensions ).'}'; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
175 | 175 | * The recursive version of the glob() function. |
176 | 176 | */ |
177 | - protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
|
177 | + protected function doRecursiveGlob( $sPathPatten, $nFlags = 0, array $aExcludeDirs = array(), array $aExcludeDirNames = array() ) { |
|
178 | 178 | |
179 | 179 | $_aFiles = glob( $sPathPatten, $nFlags ); |
180 | 180 | $_aFiles = is_array( $_aFiles ) ? $_aFiles : array(); // glob() can return false. |
181 | - $_aDirs = glob( dirname( $sPathPatten ) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR|GLOB_NOSORT ); |
|
181 | + $_aDirs = glob( dirname( $sPathPatten ).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR | GLOB_NOSORT ); |
|
182 | 182 | $_aDirs = is_array( $_aDirs ) ? $_aDirs : array(); |
183 | 183 | foreach ( $_aDirs as $_sDirPath ) { |
184 | 184 | |
185 | 185 | if ( in_array( $_sDirPath, $aExcludeDirs ) ) { continue; } |
186 | 186 | if ( in_array( pathinfo( $_sDirPath, PATHINFO_DIRNAME ), $aExcludeDirNames ) ) { continue; } |
187 | 187 | |
188 | - $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath . DIRECTORY_SEPARATOR . basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
188 | + $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath.DIRECTORY_SEPARATOR.basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | return $_aFiles; |
@@ -199,31 +199,31 @@ discard block |
||
199 | 199 | * |
200 | 200 | */ |
201 | 201 | protected function _registerClasses( $sIncludeFunction ) { |
202 | - spl_autoload_register( array( $this, '_replyToAutoLoad_' . $sIncludeFunction ) ); |
|
202 | + spl_autoload_register( array( $this, '_replyToAutoLoad_'.$sIncludeFunction ) ); |
|
203 | 203 | } |
204 | 204 | /** |
205 | 205 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
206 | 206 | */ |
207 | 207 | public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
208 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
208 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
212 | 212 | } |
213 | 213 | public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
214 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
214 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
218 | 218 | } |
219 | 219 | public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
220 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
220 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
221 | 221 | return; |
222 | 222 | } |
223 | 223 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
224 | 224 | } |
225 | 225 | public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
226 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
226 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
@@ -140,7 +140,8 @@ discard block |
||
140 | 140 | $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
141 | 141 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
142 | 142 | |
143 | - if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
|
143 | + if ( defined( 'GLOB_BRACE' ) ) { |
|
144 | +// in some OSes this flag constant is not available. |
|
144 | 145 | $_aFilePaths = $_bIsRecursive |
145 | 146 | ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
146 | 147 | : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
@@ -204,26 +205,26 @@ discard block |
||
204 | 205 | /** |
205 | 206 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
206 | 207 | */ |
207 | - public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
208 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
208 | + public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
209 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
209 | 210 | return; |
210 | 211 | } |
211 | 212 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
212 | 213 | } |
213 | - public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
214 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
214 | + public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
215 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
215 | 216 | return; |
216 | 217 | } |
217 | 218 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
218 | 219 | } |
219 | - public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
220 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
220 | + public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
221 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
221 | 222 | return; |
222 | 223 | } |
223 | 224 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
224 | 225 | } |
225 | - public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
226 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
226 | + public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
227 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
227 | 228 | return; |
228 | 229 | } |
229 | 230 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Converts non-alphabetic characters to underscore. |
37 | 37 | * |
38 | 38 | * @since 2.0.0 |
39 | - * @return string|null The sanitized string. |
|
39 | + * @return string The sanitized string. |
|
40 | 40 | * @todo Change the method name as it does not tell for what it will sanitized. |
41 | 41 | * @todo Examine why null needs to be returned. |
42 | 42 | */ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * Returns the given string length. |
121 | 121 | * @since 3.3.0 |
122 | - * @return integer|null Null if an array is given. |
|
122 | + * @return integer Null if an array is given. |
|
123 | 123 | */ |
124 | 124 | static public function getStringLength( $sString ) { |
125 | 125 | return function_exists( 'mb_strlen' ) |
@@ -176,6 +176,8 @@ discard block |
||
176 | 176 | } |
177 | 177 | /** |
178 | 178 | * Trims a traling sub-string if exists. |
179 | + * @param string $sString |
|
180 | + * @param string $sSuffix |
|
179 | 181 | * @return string |
180 | 182 | * @since 3.7.2 |
181 | 183 | */ |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * @since 3.1.1 |
27 | 27 | * @return string |
28 | 28 | */ |
29 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
29 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
30 | 30 | return is_numeric( $sLength ) |
31 | - ? $sLength . $sUnit |
|
31 | + ? $sLength.$sUnit |
|
32 | 32 | : $sLength; |
33 | 33 | } |
34 | 34 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | * @since 2.0.0 |
72 | 72 | * @return string|integer A numeric value will be returned. |
73 | 73 | */ |
74 | - static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
74 | + static public function fixNumber( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
75 | 75 | |
76 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
76 | + if ( !is_numeric( trim( $nToFix ) ) ) { |
|
77 | 77 | return $nDefault; |
78 | 78 | } |
79 | 79 | if ( $nMin !== '' && $nToFix < $nMin ) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | static public function getCSSMinified( $sCSSRules ) { |
97 | 97 | return str_replace( |
98 | - array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' '), // remove line breaks, tab, and white sspaces. |
|
98 | + array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), // remove line breaks, tab, and white sspaces. |
|
99 | 99 | '', |
100 | 100 | preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $sCSSRules ) // remove comments |
101 | 101 | ); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | static public function minifyCSS( $sCSSRules ) { |
107 | 107 | trigger_error( |
108 | - AdminPageFramework_Registry::NAME . ': ' . sprintf( |
|
108 | + AdminPageFramework_Registry::NAME.': '.sprintf( |
|
109 | 109 | 'The method, %1$s, is deprecated. Use %2$s instead.', |
110 | 110 | 'minifyCSS()', |
111 | 111 | 'getCSSMinified()' |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | */ |
135 | 135 | static public function getNumberOfReadableSize( $nSize ) { |
136 | 136 | |
137 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
138 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
137 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
138 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
139 | 139 | case 'P': |
140 | 140 | $_nReturn *= 1024; |
141 | 141 | case 'T': |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $_nLog = log( $nBytes, 1024 ); |
162 | 162 | $_iPower = ( int ) $_nLog; |
163 | 163 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
164 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
164 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -58,13 +58,13 @@ |
||
58 | 58 | */ |
59 | 59 | static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
60 | 60 | |
61 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
61 | + if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
62 | 62 | return $nDefault; |
63 | 63 | } |
64 | - if ( $nMin !== '' && $nToFix < $nMin ) { |
|
64 | + if ( $nMin !== '' && $nToFix < $nMin ) { |
|
65 | 65 | return $nMin; |
66 | 66 | } |
67 | - if ( $nMax !== '' && $nToFix > $nMax ) { |
|
67 | + if ( $nMax !== '' && $nToFix > $nMax ) { |
|
68 | 68 | return $nMax; |
69 | 69 | } |
70 | 70 | return $nToFix; |
@@ -95,7 +95,7 @@ |
||
95 | 95 | * Returns an array of constants. |
96 | 96 | * |
97 | 97 | * @since 3.4.6 |
98 | - * @param array|string $asCategory The category key names of the returning array. |
|
98 | + * @param array|string $asCategories The category key names of the returning array. |
|
99 | 99 | */ |
100 | 100 | static public function getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) { |
101 | 101 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $_sOutput = preg_replace( |
42 | 42 | array( |
43 | 43 | '#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', |
44 | - '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
44 | + '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
45 | 45 | "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', |
46 | 46 | '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>' |
47 | 47 | .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#', |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | '#</tr>#' |
53 | 53 | ), |
54 | 54 | array( |
55 | - '$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', |
|
55 | + '$1', '', '', '', '</$1>'."\n", '<', ' ', ' ', ' ', '', ' ', |
|
56 | 56 | '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'. |
57 | 57 | "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>', |
58 | 58 | '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', |
59 | - '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . '<tr><td>Zend Egg</td><td>$1</td></tr>', |
|
59 | + '<tr><td>Zend Engine</td><td>$2</td></tr>'."\n".'<tr><td>Zend Egg</td><td>$1</td></tr>', |
|
60 | 60 | ' ', |
61 | 61 | '%S%', |
62 | 62 | '%E%' |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | unset( $_aSections[ 0 ] ); |
69 | 69 | |
70 | 70 | $_aOutput = array(); |
71 | - foreach( $_aSections as $_sSection ) { |
|
71 | + foreach ( $_aSections as $_sSection ) { |
|
72 | 72 | $_iIndex = substr( $_sSection, 0, strpos( $_sSection, '</h2>' ) ); |
73 | 73 | preg_match_all( |
74 | 74 | '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | $_aAskApache, |
77 | 77 | PREG_SET_ORDER |
78 | 78 | ); |
79 | - foreach( $_aAskApache as $_aMatches ) { |
|
80 | - if ( ! isset( $_aMatches[ 1 ], $_aMatches[ 2 ] ) ) { |
|
79 | + foreach ( $_aAskApache as $_aMatches ) { |
|
80 | + if ( !isset( $_aMatches[ 1 ], $_aMatches[ 2 ] ) ) { |
|
81 | 81 | array_slice( $_aMatches, 2 ); |
82 | 82 | continue; |
83 | 83 | } |
84 | - $_aOutput[ $_iIndex ][ $_aMatches[ 1 ] ] = ! isset( $_aMatches[ 3 ] ) || $_aMatches[ 2 ] == $_aMatches[ 3 ] |
|
84 | + $_aOutput[ $_iIndex ][ $_aMatches[ 1 ] ] = !isset( $_aMatches[ 3 ] ) || $_aMatches[ 2 ] == $_aMatches[ 3 ] |
|
85 | 85 | ? $_aMatches[ 2 ] |
86 | 86 | : array_slice( $_aMatches, 2 ); |
87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @since 3.4.6 |
98 | 98 | * @param array|string $asCategory The category key names of the returning array. |
99 | 99 | */ |
100 | - static public function getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) { |
|
100 | + static public function getDefinedConstants( $asCategories = null, $asRemovingCategories = null ) { |
|
101 | 101 | |
102 | 102 | $_aCategories = is_array( $asCategories ) ? $asCategories : array( $asCategories ); |
103 | 103 | $_aCategories = array_filter( $_aCategories ); |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | static public function getPHPErrorLogPath() { |
125 | 125 | |
126 | 126 | $_aPHPInfo = self::getPHPInfo(); |
127 | - return isset( $_aPHPInfo['PHP Core']['error_log'] ) |
|
128 | - ? $_aPHPInfo['PHP Core']['error_log'] |
|
127 | + return isset( $_aPHPInfo[ 'PHP Core' ][ 'error_log' ] ) |
|
128 | + ? $_aPHPInfo[ 'PHP Core' ][ 'error_log' ] |
|
129 | 129 | : ''; |
130 | 130 | |
131 | 131 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * Returns a PHP error log. |
135 | 135 | * @since 3.4.6 |
136 | 136 | */ |
137 | - static public function getPHPErrorLog( $iLines=1 ) { |
|
137 | + static public function getPHPErrorLog( $iLines = 1 ) { |
|
138 | 138 | |
139 | 139 | $_sLog = self::getFileTailContents( self::getPHPErrorLogPath(), $iLines ); |
140 | 140 |
@@ -23,6 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @since 2.0.0 |
25 | 25 | * @since 3.5.7 Moved from `AdminPageFramework_Utility`. |
26 | + * @param string $sQueryKey |
|
26 | 27 | * @return string|null |
27 | 28 | */ |
28 | 29 | static public function getQueryValueInURLByKey( $sURL, $sQueryKey ) { |
@@ -72,6 +73,7 @@ discard block |
||
72 | 73 | /** |
73 | 74 | * Returns the port suffix in the currently loading url. |
74 | 75 | * @since 3.5.7 |
76 | + * @param boolean $_bSSL |
|
75 | 77 | * @return string |
76 | 78 | */ |
77 | 79 | static private function _getURLPortSuffix( $_bSSL ) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 0 => '', |
53 | 53 | 1 => 's', |
54 | 54 | ); |
55 | - $_sProtocol = substr( $_sServerProtocol, 0, strpos( $_sServerProtocol, '/' ) ) |
|
55 | + $_sProtocol = substr( $_sServerProtocol, 0, strpos( $_sServerProtocol, '/' ) ) |
|
56 | 56 | . $_aProrocolSuffix[ ( int ) $_bSSL ]; |
57 | 57 | |
58 | 58 | // Port: e.g. :80 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | : $_SERVER[ 'SERVER_NAME' ] |
67 | 67 | ); |
68 | 68 | |
69 | - return $_sProtocol . '://' . $_sHost . $_sPort . $_SERVER[ 'REQUEST_URI' ]; |
|
69 | + return $_sProtocol.'://'.$_sHost.$_sPort.$_SERVER[ 'REQUEST_URI' ]; |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | /** |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | ? ( string ) $_SERVER[ 'SERVER_PORT' ] |
80 | 80 | : ''; |
81 | 81 | $_aPort = array( |
82 | - 0 => ':' . $_sPort, |
|
82 | + 0 => ':'.$_sPort, |
|
83 | 83 | 1 => '', |
84 | 84 | ); |
85 | - $_bPortSet = ( ! $_bSSL && '80' === $_sPort ) || ( $_bSSL && '443' === $_sPort ); |
|
85 | + $_bPortSet = ( !$_bSSL && '80' === $_sPort ) || ( $_bSSL && '443' === $_sPort ); |
|
86 | 86 | return $_aPort[ ( int ) $_bPortSet ]; |
87 | 87 | } |
88 | 88 |