@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * Defines the field type slugs used for this field type. |
60 | 60 | */ |
61 | - public $aFieldTypeSlugs = array( 'image', ); |
|
61 | + public $aFieldTypeSlugs = array( 'image',); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Defines the default key-values of this field type. |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | */ |
68 | 68 | protected $aDefaultKeys = array( |
69 | 69 | 'attributes_to_store' => array(), // ( array ) This is for the image and media field type. The attributes to save besides URL. e.g. ( for the image field type ) array( 'title', 'alt', 'width', 'height', 'caption', 'id', 'align', 'link' ). |
70 | - 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
71 | - 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
70 | + 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
71 | + 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
72 | 72 | 'attributes' => array( |
73 | 73 | 'input' => array( |
74 | 74 | 'size' => 40, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return array( |
99 | 99 | array( |
100 | 100 | 'handle_id' => 'admin-page-framework-field-type-image', |
101 | - 'src' => dirname( __FILE__ ) . '/js/image.bundle.js', |
|
101 | + 'src' => dirname( __FILE__ ).'/js/image.bundle.js', |
|
102 | 102 | 'in_footer' => true, |
103 | 103 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
104 | 104 | 'translation_var' => 'AdminPageFrameworkImageFieldType', |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | . "<label for='{$aField[ 'input_id' ]}'>" |
145 | 145 | . $aField[ 'before_input' ] |
146 | 146 | . $this->getAOrB( |
147 | - $aField[ 'label' ] && ! $aField[ 'repeatable' ], |
|
148 | - "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
147 | + $aField[ 'label' ] && !$aField[ 'repeatable' ], |
|
148 | + "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
149 | 149 | . $aField[ 'label' ] |
150 | 150 | . "</span>", |
151 | 151 | '' |
152 | 152 | ) |
153 | - . "<input " . $this->getAttributes( $this->___getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) ) . " />" |
|
154 | - . $this->_getUploaderButtonHTML( $aField[ 'input_id' ], $_aUploadButtonAttributes, ! empty( $aField[ 'repeatable' ] ), $aField[ 'allow_external_source' ] ) |
|
153 | + . "<input ".$this->getAttributes( $this->___getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) )." />" |
|
154 | + . $this->_getUploaderButtonHTML( $aField[ 'input_id' ], $_aUploadButtonAttributes, !empty( $aField[ 'repeatable' ] ), $aField[ 'allow_external_source' ] ) |
|
155 | 155 | . $this->_getRemoveButtonHTMLByType( $aField[ 'input_id' ], $_aRemoveButtonAttributes, strtolower( $this->getFirstElement( $this->aFieldTypeSlugs ) ) ) |
156 | 156 | . $aField[ 'after_input' ] |
157 | 157 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | private function ___getBaseAttributes( array $aField ) { |
178 | 178 | |
179 | - $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
179 | + $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
180 | 180 | unset( |
181 | 181 | $_aBaseAttributes[ 'input' ], |
182 | 182 | $_aBaseAttributes[ 'button' ], |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | protected function getExtraInputFields( array $aField ) { |
246 | 246 | |
247 | 247 | $_aOutputs = array(); |
248 | - foreach( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
249 | - $_aOutputs[] = "<input " . $this->getAttributes( |
|
248 | + foreach ( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
249 | + $_aOutputs[ ] = "<input ".$this->getAttributes( |
|
250 | 250 | array( |
251 | 251 | 'id' => "{$aField[ 'input_id' ]}_{$sAttribute}", |
252 | 252 | 'type' => 'hidden', |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | '' |
263 | 263 | ), |
264 | 264 | ) |
265 | - ) . "/>"; |
|
265 | + )."/>"; |
|
266 | 266 | } |
267 | 267 | return implode( PHP_EOL, $_aOutputs ); |
268 | 268 | |
@@ -275,17 +275,17 @@ discard block |
||
275 | 275 | */ |
276 | 276 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
277 | 277 | |
278 | - if ( ! $aField[ 'show_preview' ] ) { |
|
278 | + if ( !$aField[ 'show_preview' ] ) { |
|
279 | 279 | return ''; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $sImageURL = esc_url( $this->getResolvedSRC( $sImageURL, true ) ); |
283 | 283 | return |
284 | - "<div " . $this->getAttributes( |
|
284 | + "<div ".$this->getAttributes( |
|
285 | 285 | array( |
286 | 286 | 'id' => "image_preview_container_{$aField[ 'input_id' ]}", |
287 | - 'class' => 'image_preview ' . $this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
288 | - 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
287 | + 'class' => 'image_preview '.$this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
288 | + 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
289 | 289 | . $this->getElement( $aPreviewAtrributes, 'style', '' ), |
290 | 290 | ) + $aPreviewAtrributes |
291 | 291 | ) |
@@ -309,12 +309,12 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected function _getUploaderButtonScript( $sInputID, $abRepeatable, $bExternalSource, array $aButtonAttributes ) { |
311 | 311 | |
312 | - $_bRepeatable = ! empty( $abRepeatable ); |
|
312 | + $_bRepeatable = !empty( $abRepeatable ); |
|
313 | 313 | |
314 | 314 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
315 | 315 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
316 | 316 | // which causes the PHP syntax error. |
317 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ) . '"'; |
|
317 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ).'"'; |
|
318 | 318 | $_sRepeatable = $this->getAOrB( $_bRepeatable, 'true', 'false' ); |
319 | 319 | $_bExternalSource = $this->getAOrB( $bExternalSource, 'true', 'false' ); |
320 | 320 | $_sScript = <<<JAVASCRIPTS |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | . '/* <![CDATA[ */' |
331 | 331 | . $_sScript |
332 | 332 | . '/* ]]> */' |
333 | - . "</script>". PHP_EOL; |
|
333 | + . "</script>".PHP_EOL; |
|
334 | 334 | |
335 | 335 | } |
336 | 336 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $bRepeatable, |
350 | 350 | $bExternalSource |
351 | 351 | ); |
352 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
352 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
353 | 353 | . ( $_bIsLabelSet |
354 | 354 | ? $_aAttributes[ 'data-label' ] |
355 | 355 | : ( strrpos( $_aAttributes[ 'class' ], 'dashicons' ) |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * @return array The formatted upload button attributes array. |
368 | 368 | */ |
369 | 369 | protected function _getFormattedUploadButtonAttributes( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bRepeatable, $bExternalSource ) { |
370 | - $_aAttributes = array( |
|
370 | + $_aAttributes = array( |
|
371 | 371 | 'id' => "select_image_{$sInputID}", |
372 | 372 | 'href' => '#', |
373 | 373 | 'data-input_id' => $sInputID, |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | : $this->oMsg->get( 'select_image' ), |
383 | 383 | 'data-label' => null, |
384 | 384 | ); |
385 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
385 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
386 | 386 | 'select_image button button-small ', |
387 | 387 | $this->getAOrB( |
388 | 388 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -410,16 +410,16 @@ discard block |
||
410 | 410 | * @internal |
411 | 411 | * @deprecatead 3.9.0 Currently, not used but Kept for backward compatibility. |
412 | 412 | */ |
413 | - protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
413 | + protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
414 | 414 | |
415 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
415 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
416 | 416 | return ''; |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
420 | 420 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
421 | 421 | // which causes the PHP syntax error. |
422 | - $_sButtonHTML = '"' . $this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ) . '"'; |
|
422 | + $_sButtonHTML = '"'.$this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ).'"'; |
|
423 | 423 | $_sScript = <<<JAVASCRIPTS |
424 | 424 | if ( 0 === jQuery( 'a#remove_{$sType}_{$sInputID}' ).length ) { |
425 | 425 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | . '/* <![CDATA[ */' |
431 | 431 | . $_sScript |
432 | 432 | . '/* ]]> */' |
433 | - . "</script>". PHP_EOL; |
|
433 | + . "</script>".PHP_EOL; |
|
434 | 434 | |
435 | 435 | } |
436 | 436 | |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | * @return string The generated HTML remove button output. |
441 | 441 | * @internal |
442 | 442 | */ |
443 | - protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
443 | + protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
444 | 444 | |
445 | 445 | $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
446 | 446 | $_aAttributes = $this->_getFormattedRemoveButtonAttributesByType( $sInputID, $aButtonAttributes, $_bIsLabelSet, $sType ); |
447 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
447 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
448 | 448 | . ( $_bIsLabelSet |
449 | 449 | ? $_aAttributes[ 'data-label' ] |
450 | 450 | : $this->getAOrB( |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | * @return array The formatted remove button attributes array. |
464 | 464 | * @internal |
465 | 465 | */ |
466 | - protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType='image' ) { |
|
466 | + protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType = 'image' ) { |
|
467 | 467 | |
468 | 468 | // $_sOnClickFunctionName = 'removeInputValuesFor' . ucfirst( $sType ); |
469 | - $_aAttributes = array( |
|
469 | + $_aAttributes = array( |
|
470 | 470 | 'id' => "remove_{$sType}_{$sInputID}", |
471 | 471 | 'href' => '#', |
472 | 472 | 'data-input_id' => $sInputID, |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | ? $aButtonAttributes[ 'data-label' ] |
481 | 481 | : $this->oMsg->get( 'remove_value' ), |
482 | 482 | ); |
483 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
483 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
484 | 484 | "remove_value remove_{$sType} button button-small", |
485 | 485 | $this->getAOrB( |
486 | 486 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -66,7 +66,7 @@ |
||
66 | 66 | . ( $aField[ 'label' ] |
67 | 67 | ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
68 | 68 | . $aField[ 'label' ] |
69 | - . "</span>" |
|
69 | + . "</span>" |
|
70 | 70 | : "" |
71 | 71 | ) |
72 | 72 | . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
@@ -65,12 +65,12 @@ |
||
65 | 65 | . "<label for='{$aField[ 'input_id' ]}'>" |
66 | 66 | . $aField[ 'before_input' ] |
67 | 67 | . ( $aField[ 'label' ] |
68 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
68 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
69 | 69 | . $aField[ 'label' ] |
70 | 70 | . "</span>" |
71 | 71 | : "" |
72 | 72 | ) |
73 | - . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
|
73 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
74 | 74 | . $aField[ 'after_input' ] |
75 | 75 | . "</label>" |
76 | 76 | . "</div>" |
@@ -36,21 +36,21 @@ |
||
36 | 36 | */ |
37 | 37 | public function _replyToGetField( $aField ) { |
38 | 38 | return |
39 | - $aField['before_label'] |
|
39 | + $aField[ 'before_label' ] |
|
40 | 40 | . "<div class='admin-page-framework-input-label-container'>" |
41 | - . "<label for='{$aField['input_id']}'>" |
|
42 | - . $aField['before_input'] |
|
43 | - . ( $aField['label'] && ! $aField['repeatable'] |
|
44 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
41 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
42 | + . $aField[ 'before_input' ] |
|
43 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
44 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
45 | 45 | . $aField[ 'label' ] |
46 | 46 | . "</span>" |
47 | 47 | : "" |
48 | 48 | ) |
49 | - . $aField['value'] |
|
50 | - . $aField['after_input'] |
|
49 | + . $aField[ 'value' ] |
|
50 | + . $aField[ 'after_input' ] |
|
51 | 51 | . "</label>" |
52 | 52 | . "</div>" |
53 | - . $aField['after_label'] |
|
53 | + . $aField[ 'after_label' ] |
|
54 | 54 | ; |
55 | 55 | } |
56 | 56 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * Defines the field type slugs used for this field type. |
53 | 53 | */ |
54 | - public $aFieldTypeSlugs = array( 'export', ); |
|
54 | + public $aFieldTypeSlugs = array( 'export',); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Defines the default key-values of this field type. |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
60 | 60 | */ |
61 | 61 | protected $aDefaultKeys = array( |
62 | - 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
63 | - 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
64 | - 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
62 | + 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
63 | + 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
64 | + 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
65 | 65 | 'attributes' => array( |
66 | 66 | 'class' => 'button button-primary', |
67 | 67 | ), |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | protected function getField( $aField ) { |
79 | 79 | |
80 | 80 | /* Set the transient data to export - If the value is not an array and the export data is set. */ |
81 | - if ( isset( $aField['data'] ) ) { |
|
82 | - $this->setTransient( md5( "{$aField['class_name']}_{$aField['input_id']}" ), $aField['data'], 60*2 ); // 2 minutes. |
|
81 | + if ( isset( $aField[ 'data' ] ) ) { |
|
82 | + $this->setTransient( md5( "{$aField[ 'class_name' ]}_{$aField[ 'input_id' ]}" ), $aField[ 'data' ], 60 * 2 ); // 2 minutes. |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /* Set some required values */ |
86 | - $aField['attributes']['name'] = "__export[submit][{$aField['input_id']}]"; |
|
87 | - $aField['file_name'] = $aField['file_name'] ? $aField['file_name'] : $this->___generateExportFileName( $aField['option_key'] ? $aField['option_key'] : $aField['class_name'], $aField['format'] ); |
|
88 | - $aField['label'] = $aField['label'] ? $aField['label'] : $this->oMsg->get( 'export' ); |
|
86 | + $aField[ 'attributes' ][ 'name' ] = "__export[submit][{$aField[ 'input_id' ]}]"; |
|
87 | + $aField[ 'file_name' ] = $aField[ 'file_name' ] ? $aField[ 'file_name' ] : $this->___generateExportFileName( $aField[ 'option_key' ] ? $aField[ 'option_key' ] : $aField[ 'class_name' ], $aField[ 'format' ] ); |
|
88 | + $aField[ 'label' ] = $aField[ 'label' ] ? $aField[ 'label' ] : $this->oMsg->get( 'export' ); |
|
89 | 89 | |
90 | 90 | return parent::getField( $aField ); |
91 | 91 | |
@@ -101,42 +101,42 @@ discard block |
||
101 | 101 | |
102 | 102 | $_aAttributes = array( 'type' => 'hidden' ); |
103 | 103 | return |
104 | - "<input " . $this->getAttributes( |
|
104 | + "<input ".$this->getAttributes( |
|
105 | 105 | array( |
106 | - 'name' => "__export[{$aField['input_id']}][input_id]", |
|
107 | - 'value' => $aField['input_id'], |
|
106 | + 'name' => "__export[{$aField[ 'input_id' ]}][input_id]", |
|
107 | + 'value' => $aField[ 'input_id' ], |
|
108 | 108 | ) + $_aAttributes |
109 | - ) . "/>" |
|
110 | - . "<input " . $this->getAttributes( |
|
109 | + )."/>" |
|
110 | + . "<input ".$this->getAttributes( |
|
111 | 111 | array( |
112 | - 'name' => "__export[{$aField['input_id']}][field_id]", |
|
113 | - 'value' => $aField['field_id'], |
|
112 | + 'name' => "__export[{$aField[ 'input_id' ]}][field_id]", |
|
113 | + 'value' => $aField[ 'field_id' ], |
|
114 | 114 | ) + $_aAttributes |
115 | - ) . "/>" |
|
116 | - . "<input " . $this->getAttributes( |
|
115 | + )."/>" |
|
116 | + . "<input ".$this->getAttributes( |
|
117 | 117 | array( |
118 | - 'name' => "__export[{$aField['input_id']}][section_id]", |
|
119 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
118 | + 'name' => "__export[{$aField[ 'input_id' ]}][section_id]", |
|
119 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
120 | 120 | ) + $_aAttributes |
121 | - ) . "/>" |
|
122 | - . "<input " . $this->getAttributes( |
|
121 | + )."/>" |
|
122 | + . "<input ".$this->getAttributes( |
|
123 | 123 | array( |
124 | - 'name' => "__export[{$aField['input_id']}][file_name]", |
|
125 | - 'value' => $aField['file_name'], |
|
124 | + 'name' => "__export[{$aField[ 'input_id' ]}][file_name]", |
|
125 | + 'value' => $aField[ 'file_name' ], |
|
126 | 126 | ) + $_aAttributes |
127 | - ) . "/>" |
|
128 | - . "<input " . $this->getAttributes( |
|
127 | + )."/>" |
|
128 | + . "<input ".$this->getAttributes( |
|
129 | 129 | array( |
130 | - 'name' => "__export[{$aField['input_id']}][format]", |
|
131 | - 'value' => $aField['format'], |
|
130 | + 'name' => "__export[{$aField[ 'input_id' ]}][format]", |
|
131 | + 'value' => $aField[ 'format' ], |
|
132 | 132 | ) + $_aAttributes |
133 | - ) . "/>" |
|
134 | - . "<input " . $this->getAttributes( |
|
133 | + )."/>" |
|
134 | + . "<input ".$this->getAttributes( |
|
135 | 135 | array( |
136 | - 'name' => "__export[{$aField['input_id']}][transient]", |
|
137 | - 'value' => isset( $aField['data'] ), |
|
136 | + 'name' => "__export[{$aField[ 'input_id' ]}][transient]", |
|
137 | + 'value' => isset( $aField[ 'data' ] ), |
|
138 | 138 | ) + $_aAttributes |
139 | - ) . "/>" |
|
139 | + )."/>" |
|
140 | 140 | ; |
141 | 141 | } |
142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @since 2.1.5 Moved from the AdminPageFramework_FormField class. |
151 | 151 | * @internal |
152 | 152 | */ |
153 | - private function ___generateExportFileName( $sOptionKey, $sExportFormat='json' ) { |
|
153 | + private function ___generateExportFileName( $sOptionKey, $sExportFormat = 'json' ) { |
|
154 | 154 | |
155 | 155 | switch ( trim( strtolower( $sExportFormat ) ) ) { |
156 | 156 | case 'text': // for plain text. |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | break; |
166 | 166 | } |
167 | 167 | |
168 | - return $sOptionKey . '_' . date("Ymd") . '.' . $sExt; |
|
168 | + return $sOptionKey.'_'.date( "Ymd" ).'.'.$sExt; |
|
169 | 169 | |
170 | 170 | } |
171 | 171 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public $sNotice = ''; |
46 | 46 | public $aAttributes = array(); |
47 | 47 | public $aCallbacks = array( |
48 | - 'should_show' => null, // determines whether the admin notice should be displayed. |
|
48 | + 'should_show' => null, // determines whether the admin notice should be displayed. |
|
49 | 49 | ); |
50 | 50 | /**#@-*/ |
51 | 51 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * </ul> |
62 | 62 | * @since 3.5.0 |
63 | 63 | */ |
64 | - public function __construct( $sNotice, array $aAttributes=array( 'class' => 'error' ), array $aCallbacks=array() ) { |
|
64 | + public function __construct( $sNotice, array $aAttributes = array( 'class' => 'error' ), array $aCallbacks = array() ) { |
|
65 | 65 | |
66 | 66 | $this->aAttributes = $aAttributes + array( |
67 | 67 | 'class' => 'error', // 'updated' etc. |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
70 | 70 | $this->aAttributes[ 'class' ], |
71 | 71 | 'admin-page-framework-settings-notice-message', |
72 | - 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
72 | + 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
73 | 73 | 'notice', |
74 | 74 | 'is-dismissible' // 3.5.12+ |
75 | 75 | ); |
76 | - $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
76 | + $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
77 | 77 | |
78 | 78 | // Load resources. |
79 | 79 | new AdminPageFramework_AdminNotice___Script; |
80 | 80 | |
81 | 81 | // An empty value may be set in order only to load the fade-in script. |
82 | - if ( ! $sNotice ) { |
|
82 | + if ( !$sNotice ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function _replyToDisplayAdminNotice() { |
101 | 101 | |
102 | - if ( ! $this->___shouldProceed() ) { |
|
102 | + if ( !$this->___shouldProceed() ) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | 'display: none' |
111 | 111 | ); |
112 | 112 | |
113 | - echo "<div " . $this->getAttributes( $_aAttributes ) . ">" |
|
113 | + echo "<div ".$this->getAttributes( $_aAttributes ).">" |
|
114 | 114 | . "<p>" |
115 | 115 | . self::$___aNotices[ $this->sNotice ] |
116 | 116 | . "</p>" |
117 | 117 | . "</div>" |
118 | 118 | // Insert the same message except it is not hidden. |
119 | 119 | . "<noscript>" |
120 | - . "<div " . $this->getAttributes( $this->aAttributes ) . ">" |
|
120 | + . "<div ".$this->getAttributes( $this->aAttributes ).">" |
|
121 | 121 | . "<p>" |
122 | 122 | . self::$___aNotices[ $this->sNotice ] |
123 | 123 | . "</p>" |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @internal |
135 | 135 | */ |
136 | 136 | private function ___shouldProceed() { |
137 | - if ( ! is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
137 | + if ( !is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
138 | 138 | return true; |
139 | 139 | } |
140 | - return call_user_func_array( $this->aCallbacks[ 'should_show' ], array( true, ) ); |
|
140 | + return call_user_func_array( $this->aCallbacks[ 'should_show' ], array( true,) ); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | } |
144 | 144 | \ No newline at end of file |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">"; |
330 | 330 | $_sOutput .= "<td " . self::getAttributes( $_aTDAttrFirst ) . ">" |
331 | 331 | . "<p " . self::getAttributes( $_aPAttr ) . ">" . self::___getHTMLEscaped( $_sColumnName, $bEscape ) . "</p>" |
332 | - . "</td>"; |
|
332 | + . "</td>"; |
|
333 | 333 | $_sOutput .= self::___getColumnValue( $_asValue, $aAllAttributes, $bEscape, 1 ); |
334 | 334 | $_sOutput .= "</tr>"; |
335 | 335 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | if ( is_scalar( $mValue ) ) { |
397 | 397 | return "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
398 | 398 | . "<p " . self::getAttributes( $_aPAttr ) . ">" . self::___getHTMLEscaped( $mValue, $bEscape ) . "</p>" |
399 | - . "</td>"; |
|
399 | + . "</td>"; |
|
400 | 400 | } |
401 | 401 | if ( is_array( $mValue ) ) { |
402 | 402 | return self::isAssociativeArray( $mValue ) || self::isMultiDimensional( $mValue ) |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | static public function getReadableListOfArray( array $aArray ) { |
28 | 28 | |
29 | - $_aOutput = array(); |
|
30 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
31 | - $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
|
29 | + $_aOutput = array(); |
|
30 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
31 | + $_aOutput[ ] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ).PHP_EOL; |
|
32 | 32 | } |
33 | 33 | return implode( PHP_EOL, $_aOutput ); |
34 | 34 | |
@@ -40,37 +40,37 @@ discard block |
||
40 | 40 | * @since 3.9.0 Moved from `AdminPageFramework_Utility_Array.php`. |
41 | 41 | * @return string The generated human-readable array contents. |
42 | 42 | */ |
43 | - static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths=16, $iOffset=0 ) { |
|
43 | + static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths = 16, $iOffset = 0 ) { |
|
44 | 44 | |
45 | 45 | $_aOutput = array(); |
46 | - $_aOutput[] = ( $iOffset |
|
47 | - ? str_pad( ' ', $iOffset ) |
|
46 | + $_aOutput[ ] = ( $iOffset |
|
47 | + ? str_pad( ' ', $iOffset ) |
|
48 | 48 | : '' |
49 | 49 | ) |
50 | 50 | . ( $sKey |
51 | - ? '[' . $sKey . ']' |
|
51 | + ? '['.$sKey.']' |
|
52 | 52 | : '' |
53 | 53 | ); |
54 | 54 | |
55 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
56 | - $_aOutput[] = $vValue; |
|
55 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
56 | + $_aOutput[ ] = $vValue; |
|
57 | 57 | return implode( PHP_EOL, $_aOutput ); |
58 | 58 | } |
59 | 59 | |
60 | 60 | foreach ( $vValue as $_sTitle => $_asDescription ) { |
61 | - if ( ! in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
62 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
61 | + if ( !in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
62 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
63 | 63 | . $_sTitle |
64 | 64 | . str_pad( ':', $sLabelCharLengths - self::getStringLength( $_sTitle ) ) |
65 | 65 | . $_asDescription; |
66 | 66 | continue; |
67 | 67 | } |
68 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
68 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
69 | 69 | . $_sTitle |
70 | 70 | . ": {" |
71 | 71 | . self::getReadableArrayContents( '', $_asDescription, 16, $iOffset + 4 ) |
72 | 72 | . PHP_EOL |
73 | - . str_pad( ' ', $iOffset ) . "}"; |
|
73 | + . str_pad( ' ', $iOffset )."}"; |
|
74 | 74 | } |
75 | 75 | return implode( PHP_EOL, $_aOutput ); |
76 | 76 | |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | * @return string The HTML list generated from the given array. |
84 | 84 | */ |
85 | 85 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
86 | - $_aOutput = array(); |
|
87 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
88 | - $_aOutput[] = "<ul class='array-contents'>" |
|
86 | + $_aOutput = array(); |
|
87 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
88 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
89 | 89 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
90 | - . "</ul>" . PHP_EOL; |
|
90 | + . "</ul>".PHP_EOL; |
|
91 | 91 | } |
92 | 92 | return implode( PHP_EOL, $_aOutput ); |
93 | 93 | } |
@@ -105,25 +105,25 @@ discard block |
||
105 | 105 | $_aOutput = array(); |
106 | 106 | |
107 | 107 | // Title - array key |
108 | - $_aOutput[] = $sKey |
|
109 | - ? "<h3 class='array-key'>" . $sKey . "</h3>" |
|
108 | + $_aOutput[ ] = $sKey |
|
109 | + ? "<h3 class='array-key'>".$sKey."</h3>" |
|
110 | 110 | : ""; |
111 | 111 | |
112 | 112 | // If it does not have a nested array or object, |
113 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ), true ) ) { |
|
114 | - $_aOutput[] = "<div class='array-value'>" |
|
113 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ), true ) ) { |
|
114 | + $_aOutput[ ] = "<div class='array-value'>" |
|
115 | 115 | . html_entity_decode( nl2br( $vValue ), ENT_QUOTES ) |
116 | 116 | . "</div>"; |
117 | - return "<li>" . implode( PHP_EOL, $_aOutput ) . "</li>"; |
|
117 | + return "<li>".implode( PHP_EOL, $_aOutput )."</li>"; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Now it is a nested item. |
121 | 121 | foreach ( $vValue as $_sKey => $_vValue ) { |
122 | - $_aOutput[] = "<ul class='array-contents'>" |
|
122 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
123 | 123 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
124 | 124 | . "</ul>"; |
125 | 125 | } |
126 | - return implode( PHP_EOL, $_aOutput ) ; |
|
126 | + return implode( PHP_EOL, $_aOutput ); |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return string |
143 | 143 | * @since 3.9.0 |
144 | 144 | */ |
145 | - static public function getTableOfKeyValues( array $aArray, array $aAllAttributes=array(), array $aHeader=array(), array $aFooter=array(), $bEscape=true, $sCaption='' ) { |
|
145 | + static public function getTableOfKeyValues( array $aArray, array $aAllAttributes = array(), array $aHeader = array(), array $aFooter = array(), $bEscape = true, $sCaption = '' ) { |
|
146 | 146 | $_aAllAttributes = $aAllAttributes + array( |
147 | 147 | 'table' => array(), |
148 | 148 | 'caption' => array(), |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | 'li' => array(), |
158 | 158 | 'p' => array(), |
159 | 159 | ); |
160 | - return "<table " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ) . ">" |
|
160 | + return "<table ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ).">" |
|
161 | 161 | . self::___getTableCaption( $sCaption, $_aAllAttributes, $bEscape ) |
162 | 162 | . self::___getTableHeaderOfKeyValuePair( $aHeader, $aAllAttributes, $bEscape ) |
163 | - . "<tbody " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ) . ">" |
|
163 | + . "<tbody ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ).">" |
|
164 | 164 | . self::___getRowsOfKeyValuePair( $aArray, $aAllAttributes, $bEscape ) |
165 | 165 | . "</tbody>" |
166 | 166 | . self::___getTableFooterOfKeyValuePair( $aFooter, $aAllAttributes, $bEscape ) |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @return string |
181 | 181 | * @since 3.9.0 |
182 | 182 | */ |
183 | - static public function getTableOfArray( array $aArray, array $aAllAttributes=array(), array $aHeader=array(), array $aFooter=array(), $bEscape=true, $sCaption='' ) { |
|
183 | + static public function getTableOfArray( array $aArray, array $aAllAttributes = array(), array $aHeader = array(), array $aFooter = array(), $bEscape = true, $sCaption = '' ) { |
|
184 | 184 | |
185 | 185 | $_aAllAttributes = $aAllAttributes + array( |
186 | 186 | 'table' => array(), |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | 'li' => array(), |
197 | 197 | 'p' => array(), |
198 | 198 | ); |
199 | - return "<table " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ) . ">" |
|
199 | + return "<table ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ).">" |
|
200 | 200 | . self::___getTableCaption( $sCaption, $_aAllAttributes, $bEscape ) |
201 | 201 | . self::___getTableHeader( $aHeader, $_aAllAttributes, $bEscape ) |
202 | - . "<tbody " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ) . ">" |
|
202 | + . "<tbody ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ).">" |
|
203 | 203 | . self::___getTableRows( $aArray, $_aAllAttributes, $bEscape ) |
204 | 204 | . "</tbody>" |
205 | 205 | . self::___getTableFooter( $aFooter, $_aAllAttributes, $bEscape ) |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | } |
208 | 208 | static private function ___getTableCaption( $sCaption, $aAllAttributes, $bEscape ) { |
209 | 209 | $sCaption = ( string ) $sCaption; |
210 | - if ( ! strlen( $sCaption ) ) { |
|
210 | + if ( !strlen( $sCaption ) ) { |
|
211 | 211 | return ''; |
212 | 212 | } |
213 | 213 | $_aCapAttr = self::getElementAsArray( $aAllAttributes, 'caption' ); |
214 | 214 | $_sCaption = $bEscape |
215 | 215 | ? htmlspecialchars( $sCaption ) |
216 | 216 | : $sCaption; |
217 | - return "<caption " . self::getAttributes( $_aCapAttr ) . ">" |
|
217 | + return "<caption ".self::getAttributes( $_aCapAttr ).">" |
|
218 | 218 | . $_sCaption |
219 | 219 | . "</caption>"; |
220 | 220 | } |
@@ -237,24 +237,24 @@ discard block |
||
237 | 237 | $_aTHAttr1 = self::getElementAsArray( $aAllAttributes, array( 'th', 0 ) ) + $_aTHAttr; |
238 | 238 | $_aTHAttr2 = self::getElementAsArray( $aAllAttributes, array( 'th', 1 ) ) + $_aTHAttr; |
239 | 239 | $_sOutput = ''; |
240 | - foreach( $aHeader as $_sKey => $_sValue ) { |
|
241 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
242 | - . "<th " . self::getAttributes( $_aTHAttr1 ) . ">" . self::___getHTMLEscaped( $_sKey, $bEscape ) . "</th>" |
|
243 | - . "<th " . self::getAttributes( $_aTHAttr2 ) . ">" . self::___getHTMLEscaped( $_sValue, $bEscape ) . "</th>" |
|
240 | + foreach ( $aHeader as $_sKey => $_sValue ) { |
|
241 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
242 | + . "<th ".self::getAttributes( $_aTHAttr1 ).">".self::___getHTMLEscaped( $_sKey, $bEscape )."</th>" |
|
243 | + . "<th ".self::getAttributes( $_aTHAttr2 ).">".self::___getHTMLEscaped( $_sValue, $bEscape )."</th>" |
|
244 | 244 | . "</tr>"; |
245 | 245 | } |
246 | - return "<thead>" . $_sOutput . "</thead>"; |
|
246 | + return "<thead>".$_sOutput."</thead>"; |
|
247 | 247 | } |
248 | 248 | static private function ___getTableHeaderOfMultiColumns( array $aHeader, array $aAllAttributes, $bEscape ) { |
249 | 249 | $_aTRAttr = self::getElementAsArray( $aAllAttributes, 'tr' ); |
250 | 250 | $_aTHAttr = self::getElementAsArray( $aAllAttributes, 'th' ); |
251 | - $_sOutput = "<tr " . self::getAttributes( $_aTRAttr ) . ">"; |
|
252 | - foreach( array_values( $aHeader ) as $_iIndex => $_sColumnName ) { |
|
251 | + $_sOutput = "<tr ".self::getAttributes( $_aTRAttr ).">"; |
|
252 | + foreach ( array_values( $aHeader ) as $_iIndex => $_sColumnName ) { |
|
253 | 253 | $_aTHAttrNth = self::getElementAsArray( $aAllAttributes, array( 'th', $_iIndex ) ) + $_aTHAttr; |
254 | - $_sOutput .= "<th " . self::getAttributes( $_aTHAttrNth ) . ">" . self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape ) . "</th>"; |
|
254 | + $_sOutput .= "<th ".self::getAttributes( $_aTHAttrNth ).">".self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape )."</th>"; |
|
255 | 255 | } |
256 | 256 | $_sOutput .= "</tr>"; |
257 | - return "<thead>" . $_sOutput . "</thead>"; |
|
257 | + return "<thead>".$_sOutput."</thead>"; |
|
258 | 258 | } |
259 | 259 | static private function ___getTableFooter( array $aFooter, array $aAllAttributes, $bEscape ) { |
260 | 260 | if ( empty( $aFooter ) ) { |
@@ -271,24 +271,24 @@ discard block |
||
271 | 271 | $_aTDAttr1 = self::getElementAsArray( $aAllAttributes, array( 'td', 0 ) ) + $_aTDAttr; |
272 | 272 | $_aTDAttr2 = self::getElementAsArray( $aAllAttributes, array( 'td', 1 ) ) + $_aTDAttr; |
273 | 273 | $_sOutput = ''; |
274 | - foreach( $aFooter as $_sKey => $_sValue ) { |
|
275 | - $_sOutput = "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
276 | - . "<td " . self::getAttributes( $_aTDAttr1 ) . ">" . self::___getHTMLEscaped( $_sKey, $bEscape ) . "</td>" |
|
277 | - . "<td " . self::getAttributes( $_aTDAttr2 ) . ">" . self::___getHTMLEscaped( $_sValue, $bEscape ) . "</td>" |
|
274 | + foreach ( $aFooter as $_sKey => $_sValue ) { |
|
275 | + $_sOutput = "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
276 | + . "<td ".self::getAttributes( $_aTDAttr1 ).">".self::___getHTMLEscaped( $_sKey, $bEscape )."</td>" |
|
277 | + . "<td ".self::getAttributes( $_aTDAttr2 ).">".self::___getHTMLEscaped( $_sValue, $bEscape )."</td>" |
|
278 | 278 | . "</tr>"; |
279 | 279 | } |
280 | - return "<tfoot>" . $_sOutput . "</tfoot>"; |
|
280 | + return "<tfoot>".$_sOutput."</tfoot>"; |
|
281 | 281 | } |
282 | 282 | static private function ___getTableFooterOfMultiColumns( array $aFooter, array $aAllAttributes, $bEscape ) { |
283 | 283 | $_aTRAttr = self::getElementAsArray( $aAllAttributes, 'tr' ); |
284 | 284 | $_aTDAttr = self::getElementAsArray( $aAllAttributes, 'td' ); |
285 | - $_sOutput = "<tr " . self::getAttributes( $_aTRAttr ) . ">"; |
|
286 | - foreach( array_values( $aFooter ) as $_iIndex => $_sColumnName ) { |
|
285 | + $_sOutput = "<tr ".self::getAttributes( $_aTRAttr ).">"; |
|
286 | + foreach ( array_values( $aFooter ) as $_iIndex => $_sColumnName ) { |
|
287 | 287 | $_aTDAttrNth = self::getElementAsArray( $aAllAttributes, array( 'td', $_iIndex ) ) + $_aTDAttr; |
288 | - $_sOutput .= "<td " . self::getAttributes( $_aTDAttrNth ) . ">" . self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape ) . "</td>"; |
|
288 | + $_sOutput .= "<td ".self::getAttributes( $_aTDAttrNth ).">".self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape )."</td>"; |
|
289 | 289 | } |
290 | 290 | $_sOutput .= "</tr>"; |
291 | - return "<tfoot>" . $_sOutput . "</tfoot>"; |
|
291 | + return "<tfoot>".$_sOutput."</tfoot>"; |
|
292 | 292 | } |
293 | 293 | static private function ___getTableRows( array $aArray, array $aAllAttributes, $bEscape ) { |
294 | 294 | if ( empty( $aArray ) ) { |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | $_aTDAttrFirst = self::getElementAsArray( $aAllAttributes, array( 'td', 0 ) ) + $_aTDAttr; |
326 | 326 | $_aTDAttrFirst[ 'class' ] = self::___addClass( 'column-key', self::getElement( $_aTDAttrFirst, array( 'class' ), '' ) ); |
327 | 327 | $_sOutput = ''; |
328 | - foreach( $aItem as $_sColumnName => $_asValue ) { |
|
329 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">"; |
|
330 | - $_sOutput .= "<td " . self::getAttributes( $_aTDAttrFirst ) . ">" |
|
331 | - . "<p " . self::getAttributes( $_aPAttr ) . ">" . self::___getHTMLEscaped( $_sColumnName, $bEscape ) . "</p>" |
|
328 | + foreach ( $aItem as $_sColumnName => $_asValue ) { |
|
329 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">"; |
|
330 | + $_sOutput .= "<td ".self::getAttributes( $_aTDAttrFirst ).">" |
|
331 | + . "<p ".self::getAttributes( $_aPAttr ).">".self::___getHTMLEscaped( $_sColumnName, $bEscape )."</p>" |
|
332 | 332 | . "</td>"; |
333 | 333 | $_sOutput .= self::___getColumnValue( $_asValue, $aAllAttributes, $bEscape, 1 ); |
334 | 334 | $_sOutput .= "</tr>"; |
@@ -342,15 +342,15 @@ discard block |
||
342 | 342 | static private function ___getRowsOfMultiColumns( array $aArray, array $aAllAttributes, $bEscape ) { |
343 | 343 | $_aTRAttr = self::getElementAsArray( $aAllAttributes, 'tr' ); |
344 | 344 | $_sOutput = ''; |
345 | - foreach( $aArray as $_iRowIndex => $_asValue ) { |
|
345 | + foreach ( $aArray as $_iRowIndex => $_asValue ) { |
|
346 | 346 | if ( is_scalar( $_asValue ) ) { |
347 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
347 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
348 | 348 | . self::___getColumnValue( $_asValue, $aAllAttributes, $bEscape, 0 ) |
349 | 349 | . "</tr>"; |
350 | 350 | continue; |
351 | 351 | } |
352 | 352 | $_aColumns = self::getAsArray( $_asValue ); |
353 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
353 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
354 | 354 | . self::___getColumns( $_aColumns, $aAllAttributes, $bEscape ) |
355 | 355 | . "</tr>"; |
356 | 356 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | } |
359 | 359 | static private function ___getColumns( array $aColumns, $aAllAttributes, $bEscape ) { |
360 | 360 | $_sOutput = ''; |
361 | - foreach( array_values( $aColumns ) as $_iIndex => $_asValue ) { |
|
361 | + foreach ( array_values( $aColumns ) as $_iIndex => $_asValue ) { |
|
362 | 362 | $_sOutput .= self::___getColumnValue( $_asValue, $aAllAttributes, $bEscape, $_iIndex ); |
363 | 363 | } |
364 | 364 | return $_sOutput; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | static private function ___addClass( $sClassToAdd, $sClasses ) { |
374 | 374 | $_aClasses = explode( ' ', $sClasses ); |
375 | - $_aClasses[] = $sClassToAdd; |
|
375 | + $_aClasses[ ] = $sClassToAdd; |
|
376 | 376 | return trim( implode( ' ', array_unique( $_aClasses ) ) ); |
377 | 377 | } |
378 | 378 | |
@@ -392,24 +392,24 @@ discard block |
||
392 | 392 | if ( is_null( $mValue ) ) { |
393 | 393 | $mValue = '(null)'; |
394 | 394 | } |
395 | - $_aPAttr = self::getElementAsArray( $aAllAttributes, 'p' ); |
|
395 | + $_aPAttr = self::getElementAsArray( $aAllAttributes, 'p' ); |
|
396 | 396 | if ( is_scalar( $mValue ) ) { |
397 | - return "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
398 | - . "<p " . self::getAttributes( $_aPAttr ) . ">" . self::___getHTMLEscaped( $mValue, $bEscape ) . "</p>" |
|
397 | + return "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
398 | + . "<p ".self::getAttributes( $_aPAttr ).">".self::___getHTMLEscaped( $mValue, $bEscape )."</p>" |
|
399 | 399 | . "</td>"; |
400 | 400 | } |
401 | 401 | if ( is_array( $mValue ) ) { |
402 | 402 | return self::isAssociativeArray( $mValue ) || self::isMultiDimensional( $mValue ) |
403 | - ? "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
403 | + ? "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
404 | 404 | . self::getTableOfKeyValues( $mValue, $aAllAttributes ) |
405 | 405 | . "</td>" |
406 | - : "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
406 | + : "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
407 | 407 | // @todo may ought to be numeric-rows table |
408 | 408 | . self::___getList( $mValue, $aAllAttributes, $bEscape ) |
409 | 409 | . "</td>"; |
410 | 410 | } |
411 | - return "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
412 | - . '(' . gettype( $mValue ) . ')' . ( is_object( $mValue ) ? get_class( $mValue ) : '' ) |
|
411 | + return "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
412 | + . '('.gettype( $mValue ).')'.( is_object( $mValue ) ? get_class( $mValue ) : '' ) |
|
413 | 413 | . "</td>"; |
414 | 414 | } |
415 | 415 | /** |
@@ -426,16 +426,16 @@ discard block |
||
426 | 426 | if ( empty( $aArray ) ) { |
427 | 427 | return ''; |
428 | 428 | } |
429 | - $_sList = "<ul " . self::getAttributes( $_aULAttr ) . ">"; |
|
430 | - foreach( $aArray as $_asValue ) { |
|
429 | + $_sList = "<ul ".self::getAttributes( $_aULAttr ).">"; |
|
430 | + foreach ( $aArray as $_asValue ) { |
|
431 | 431 | $_sItem = is_array( $_asValue ) |
432 | 432 | ? self::___getList( $_asValue, $aAllAttributes, $bEscape ) |
433 | 433 | : self::___getHTMLEscaped( $_asValue, $bEscape ); |
434 | - $_sList .= "<li " . self::getAttributes( $_aLIAttr ) . ">" |
|
434 | + $_sList .= "<li ".self::getAttributes( $_aLIAttr ).">" |
|
435 | 435 | . $_sItem |
436 | 436 | . "</li>"; |
437 | 437 | } |
438 | - $_sList .= "</ul>"; |
|
438 | + $_sList .= "</ul>"; |
|
439 | 439 | return $_sList; |
440 | 440 | } |
441 | 441 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @deprecated 3.8.0 Use `getLengthSanitized()` instead. |
31 | 31 | * @since 3.8.8 Moved from `AdminPageFramework_Utility_String`. |
32 | 32 | */ |
33 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
33 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
34 | 34 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getLengthSanitized()' ); |
35 | 35 | return AdminPageFramework_Utility_String::getLengthSanitized( $sLength, $sUnit ); |
36 | 36 | } |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
50 | 50 | * @deprecated 3.5.3 Use `getElement()`. |
51 | 51 | */ |
52 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
52 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault = '', $bBlankToDefault = false ) { |
|
53 | 53 | |
54 | 54 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
55 | 55 | |
56 | 56 | // If $vSubject is null, |
57 | - if ( ! isset( $vSubject ) ) { |
|
57 | + if ( !isset( $vSubject ) ) { |
|
58 | 58 | return $sDefault; |
59 | 59 | } |
60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // If $vSubject is not an array, |
67 | - if ( ! is_array( $vSubject ) ) { |
|
67 | + if ( !is_array( $vSubject ) ) { |
|
68 | 68 | return ( string ) $vSubject; |
69 | 69 | } // consider it as string. |
70 | 70 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | * @since 3.5.3 Moved from `AdminPageFramework_FieldType_Base`. |
105 | 105 | * @deprecated 3.5.3 Use the `getElement()` method. |
106 | 106 | */ |
107 | - protected function getFieldElementByKey( $asElement, $sKey, $asDefault='' ) { |
|
107 | + protected function getFieldElementByKey( $asElement, $sKey, $asDefault = '' ) { |
|
108 | 108 | |
109 | 109 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
110 | 110 | |
111 | - if ( ! is_array( $asElement ) || ! isset( $sKey ) ) { |
|
111 | + if ( !is_array( $asElement ) || !isset( $sKey ) ) { |
|
112 | 112 | return $asElement; |
113 | 113 | } |
114 | 114 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__ ); |
133 | 133 | |
134 | - foreach( $aArray as &$vElem ) { |
|
134 | + foreach ( $aArray as &$vElem ) { |
|
135 | 135 | |
136 | 136 | if ( $vElem ) { break; } |
137 | 137 | unset( $vElem ); |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | */ |
40 | 40 | static public function getAttributes( array $aAttributes ) { |
41 | 41 | |
42 | - $_sQuoteCharactor ="'"; |
|
42 | + $_sQuoteCharactor = "'"; |
|
43 | 43 | $_aOutput = array(); |
44 | - foreach( $aAttributes as $sAttribute => $sProperty ) { |
|
45 | - if ( ! is_scalar( $sProperty ) ) { |
|
44 | + foreach ( $aAttributes as $sAttribute => $sProperty ) { |
|
45 | + if ( !is_scalar( $sProperty ) ) { |
|
46 | 46 | continue; |
47 | 47 | } |
48 | - $_aOutput[] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
48 | + $_aOutput[ ] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
49 | 49 | } |
50 | 50 | return implode( ' ', $_aOutput ); |
51 | 51 | |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | */ |
72 | 72 | static public function getInlineCSS( array $aCSSRules ) { |
73 | 73 | $_aOutput = array(); |
74 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
74 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
75 | 75 | if ( is_null( $_sValue ) ) { |
76 | 76 | continue; |
77 | 77 | } |
78 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
78 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
79 | 79 | } |
80 | 80 | return implode( '; ', $_aOutput ); |
81 | 81 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | static public function getStyleAttribute( $asInlineCSSes ) { |
107 | 107 | |
108 | 108 | $_aCSSRules = array(); |
109 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
109 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
110 | 110 | |
111 | 111 | // For array, store in the container. |
112 | 112 | if ( is_array( $_asCSSRules ) ) { |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | |
117 | 117 | // At this point, it is a string. Break them down to array elements. |
118 | 118 | $__aCSSRules = explode( ';', $_asCSSRules ); |
119 | - foreach( $__aCSSRules as $_sPair ) { |
|
119 | + foreach ( $__aCSSRules as $_sPair ) { |
|
120 | 120 | $_aCSSPair = explode( ':', $_sPair ); |
121 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
121 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
122 | 122 | continue; |
123 | 123 | } |
124 | 124 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | */ |
156 | 156 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
157 | 157 | |
158 | - $_aClasses = array(); |
|
159 | - foreach( func_get_args() as $_asClasses ) { |
|
160 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
158 | + $_aClasses = array(); |
|
159 | + foreach ( func_get_args() as $_asClasses ) { |
|
160 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
161 | 161 | continue; |
162 | 162 | } |
163 | 163 | $_aClasses = array_merge( |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | : explode( ' ', $_asClasses ) |
168 | 168 | ); |
169 | 169 | } |
170 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
170 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
171 | 171 | |
172 | 172 | // @todo examine if it is okay to remove the trim() function below. |
173 | 173 | return trim( implode( ' ', $_aClasses ) ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
184 | 184 | $_aParams = func_get_args(); |
185 | 185 | return call_user_func_array( |
186 | - array( __CLASS__ , 'getClassAttribute' ), |
|
186 | + array( __CLASS__, 'getClassAttribute' ), |
|
187 | 187 | $_aParams |
188 | 188 | ); |
189 | 189 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | static public function getDataAttributeArray( array $aArray ) { |
201 | 201 | |
202 | 202 | $_aNewArray = array(); |
203 | - foreach( $aArray as $sKey => $v ) { |
|
203 | + foreach ( $aArray as $sKey => $v ) { |
|
204 | 204 | |
205 | 205 | if ( in_array( gettype( $v ), array( 'object', 'NULL' ) ) ) { |
206 | 206 | continue; |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @since 3.8.9 |
29 | 29 | * @since 3.8.32 Moved from `AdminPageFramework_Debug_Base` and renamed from `___getArrayMappedRecursive()` and made public as a part of the utility class. |
30 | 30 | */ |
31 | - static public function getArrayMappedRecursive( $cCallback, $aArray, array $aArguments=array() ) { |
|
31 | + static public function getArrayMappedRecursive( $cCallback, $aArray, array $aArguments = array() ) { |
|
32 | 32 | $_aOutput = array(); |
33 | - foreach( $aArray as $_isKey => $_vValue ) { |
|
33 | + foreach ( $aArray as $_isKey => $_vValue ) { |
|
34 | 34 | if ( is_array( $_vValue ) ) { |
35 | 35 | $_aOutput[ $_isKey ] = self::getArrayMappedRecursive( $cCallback, $_vValue, $aArguments ); |
36 | 36 | continue; |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | * @return numeric |
48 | 48 | * @since 3.7.4 |
49 | 49 | */ |
50 | - static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset=1 ) { |
|
50 | + static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset = 1 ) { |
|
51 | 51 | |
52 | 52 | // Check if the order value is not used. |
53 | - if ( ! isset( $aArray[ $nIndex ] ) ) { |
|
53 | + if ( !isset( $aArray[ $nIndex ] ) ) { |
|
54 | 54 | return $nIndex; |
55 | 55 | } |
56 | 56 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | 67 | static public function isAssociative( array $aArray ) { |
68 | - return array_keys ( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
68 | + return array_keys( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |