@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class AdminPageFramework_Form_View___Attribute_SectionTableBody extends AdminPageFramework_Form_View___Attribute_Base { |
19 | 19 | |
20 | - public $sContext = 'section_table_content'; |
|
20 | + public $sContext = 'section_table_content'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Returns an attribute array. |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | return array( |
30 | 30 | 'class' => $this->getAOrB( |
31 | 31 | $this->aArguments[ '_is_collapsible' ], |
32 | - 'admin-page-framework-collapsible-section-content' . ' ' |
|
33 | - . 'admin-page-framework-collapsible-content' . ' ' |
|
32 | + 'admin-page-framework-collapsible-section-content'.' ' |
|
33 | + . 'admin-page-framework-collapsible-content'.' ' |
|
34 | 34 | . 'accordion-section-content', |
35 | 35 | null |
36 | 36 | ), |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @since 3.6.0 |
26 | 26 | * @return array |
27 | 27 | */ |
28 | - protected function _getAttributes() { |
|
28 | + protected function _getAttributes() { |
|
29 | 29 | return array( |
30 | 30 | 'class' => $this->getAOrB( |
31 | 31 | $this->aArguments[ '_is_collapsible' ], |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | */ |
28 | 28 | protected function _getAttributes() { |
29 | 29 | |
30 | - $_aSectionAttributes = $this->uniteArrays( |
|
31 | - $this->dropElementsByType( $this->aArguments[ 'attributes' ] ), // remove elements of an array. |
|
30 | + $_aSectionAttributes = $this->uniteArrays( |
|
31 | + $this->dropElementsByType( $this->aArguments[ 'attributes' ] ), // remove elements of an array. |
|
32 | 32 | array( |
33 | 33 | 'id' => $this->aArguments[ '_tag_id' ], // section-{section id}__{index} |
34 | 34 | 'class' => $this->getClassAttribute( |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | |
52 | - $_aSectionAttributes[ 'class' ] = $this->getClassAttribute( |
|
52 | + $_aSectionAttributes[ 'class' ] = $this->getClassAttribute( |
|
53 | 53 | $_aSectionAttributes[ 'class' ], |
54 | 54 | $this->dropElementsByType( $this->aArguments[ 'class' ] ) |
55 | - ); // 3.3.1+ |
|
55 | + ); // 3.3.1+ |
|
56 | 56 | |
57 | - $_aSectionAttributes[ 'style' ] = $this->getStyleAttribute( |
|
57 | + $_aSectionAttributes[ 'style' ] = $this->getStyleAttribute( |
|
58 | 58 | $_aSectionAttributes[ 'style' ], |
59 | 59 | $this->getAOrB( |
60 | 60 | $this->aArguments[ 'hidden' ], |
61 | 61 | 'display:none', |
62 | 62 | null |
63 | 63 | ) |
64 | - ); // 3.3.1+ |
|
64 | + ); // 3.3.1+ |
|
65 | 65 | |
66 | 66 | return $_aSectionAttributes; |
67 | 67 |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | 'class' => $this->getClassAttribute( |
62 | 62 | 'admin-page-framework-sections', |
63 | 63 | $this->getAOrB( |
64 | - ! $this->sSectionTabSlug || '_default' === $this->sSectionTabSlug, |
|
64 | + !$this->sSectionTabSlug || '_default' === $this->sSectionTabSlug, |
|
65 | 65 | null, |
66 | 66 | 'admin-page-framework-section-tabs-contents' |
67 | 67 | ), |
68 | 68 | $this->getAOrB( |
69 | 69 | empty( $this->aCollapsible ), |
70 | 70 | null, |
71 | - 'admin-page-framework-collapsible-sections-content' . ' ' |
|
72 | - . 'admin-page-framework-collapsible-content' . ' ' |
|
71 | + 'admin-page-framework-collapsible-sections-content'.' ' |
|
72 | + . 'admin-page-framework-collapsible-content'.' ' |
|
73 | 73 | . 'accordion-section-content' |
74 | 74 | |
75 | 75 | ), |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // 3.6.0+ - dimensional section address without the option key, used by the 'save' argument and when sorting dynamic elements. |
86 | 86 | 'data-section_address' => $this->aSectionset[ 'section_id' ], |
87 | - 'data-section_address_model' => $this->aSectionset[ 'section_id' ] . '|' . '___i___', |
|
87 | + 'data-section_address_model' => $this->aSectionset[ 'section_id' ].'|'.'___i___', |
|
88 | 88 | |
89 | 89 | ) |
90 | 90 | + $this->_getDynamicElementArguments( $this->aSectionset ); |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | return array( |
124 | 124 | // 3.6.0+ Stores the total number of dynamic elements, used to generate the input id and name of repeated sections which contain an incremented index number. |
125 | 125 | 'data-largest_index' => max( |
126 | - ( int ) $this->iSubSectionCount - 1, // zero-base index |
|
126 | + ( int ) $this->iSubSectionCount - 1, // zero-base index |
|
127 | 127 | 0 |
128 | 128 | ), // convert negative numbers to zero. |
129 | 129 | |
130 | - 'data-section_id_model' => $aSectionset[ 'section_id' ] . '__' . '___i___', |
|
131 | - 'data-flat_section_name_model' => $aSectionset[ 'section_id' ] . '|___i___', |
|
130 | + 'data-section_id_model' => $aSectionset[ 'section_id' ].'__'.'___i___', |
|
131 | + 'data-flat_section_name_model' => $aSectionset[ 'section_id' ].'|___i___', |
|
132 | 132 | // @todo apply a callback |
133 | 133 | // 'data-section_name_model' => $aSectionset[ 'section_id' ] . '[___i___]', |
134 | 134 | 'data-section_name_model' => $_oSectionNameGenerator->getModel(), |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides methods to handle importing options. |
@@ -71,7 +71,7 @@ |
||
71 | 71 | * </code> |
72 | 72 | * @access public This must be public as accessed from outside. |
73 | 73 | */ |
74 | - public $aFieldTypeSlugs = array( 'default', ); |
|
74 | + public $aFieldTypeSlugs = array( 'default',); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Defines the default key-values of this field type. |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * @since 3.5.0 |
39 | 39 | * @callback fieldtype hfDoOnRegistration |
40 | 40 | */ |
41 | - public function _replyToDoOnFieldRegistration( array $aField ) { |
|
41 | + public function _replyToDoOnFieldRegistration( array $aField ) { |
|
42 | 42 | return $this->doOnFieldRegistration( $aField ); |
43 | 43 | } |
44 | 44 |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | * @param object $oMsg The framework message object. |
99 | 99 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
100 | 100 | */ |
101 | - function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
101 | + function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
102 | 102 | |
103 | 103 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) ? $this->aFieldTypeSlugs : ( array ) $asFieldTypeSlug; |
104 | 104 | $this->oMsg = $oMsg ? $oMsg : AdminPageFramework_Message::getInstance(); |
105 | 105 | |
106 | 106 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
107 | 107 | if ( $bAutoRegister ) { |
108 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
108 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
109 | 109 | add_filter( "field_types_{$_sClassName}", array( $this, '_replyToRegisterInputFieldType' ) ); |
110 | 110 | } |
111 | 111 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return boolean |
132 | 132 | */ |
133 | 133 | protected function isTinyMCESupported() { |
134 | - return version_compare( $GLOBALS['wp_version'], '3.3', '>=' ) |
|
134 | + return version_compare( $GLOBALS[ 'wp_version' ], '3.3', '>=' ) |
|
135 | 135 | && function_exists( 'wp_editor' ) |
136 | 136 | ; |
137 | 137 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | protected function getElementByLabel( $asElement, $sKey, $bIsLabelArray ) { |
147 | 147 | return $bIsLabelArray |
148 | 148 | ? $this->getElement( |
149 | - $asElement, // subject |
|
150 | - array( $sKey ), // keys |
|
149 | + $asElement, // subject |
|
150 | + array( $sKey ), // keys |
|
151 | 151 | $asElement // default |
152 | 152 | ) |
153 | 153 | : $asElement; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | protected function geFieldOutput( array $aFieldset ) { |
164 | 164 | |
165 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
165 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
166 | 166 | return ''; |
167 | 167 | } |
168 | 168 | $aFieldset[ '_nested_depth' ]++; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | $_oCaller = $aFieldset[ '_caller_object' ]; |
171 | 171 | $_aOptions = $_oCaller->getSavedOptions(); |
172 | 172 | $_oFieldset = new AdminPageFramework_FormFieldset( |
173 | - $aFieldset, // the field definition array |
|
174 | - $_aOptions, // the stored form data |
|
175 | - $_oCaller->getFieldErrors(), // the field error array. |
|
176 | - $_oCaller->oProp->aFieldTypeDefinitions, // the field type definition array. |
|
177 | - $_oCaller->oMsg, // the system message object |
|
173 | + $aFieldset, // the field definition array |
|
174 | + $_aOptions, // the stored form data |
|
175 | + $_oCaller->getFieldErrors(), // the field error array. |
|
176 | + $_oCaller->oProp->aFieldTypeDefinitions, // the field type definition array. |
|
177 | + $_oCaller->oMsg, // the system message object |
|
178 | 178 | $_oCaller->oProp->aFieldCallbacks // field output element callables. |
179 | 179 | ); |
180 | 180 | return $_oFieldset->get(); |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | * @since 3.0.3 Tweaked it to have better execution speed. |
207 | 207 | * @internal |
208 | 208 | */ |
209 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
209 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
210 | 210 | |
211 | 211 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
212 | 212 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
213 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
214 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
215 | - : self::$_aDefaultKeys['attributes']; |
|
213 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
214 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
215 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
216 | 216 | |
217 | 217 | return array( |
218 | 218 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @since 3.0.0 |
251 | 251 | * @internal |
252 | 252 | */ |
253 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
253 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
254 | 254 | $this->_sFieldSetType = $sFieldSetType; |
255 | 255 | } |
256 | 256 | |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | wp_enqueue_script( 'media-upload' ); |
305 | 305 | } |
306 | 306 | |
307 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
308 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
307 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
308 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
321 | 321 | |
322 | 322 | // Replace the button label in the media thick box. |
323 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
323 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
324 | 324 | return $sTranslated; |
325 | 325 | } |
326 | 326 | if ( $sText !== 'Insert into Post' ) { |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | return $sTranslated; |
331 | 331 | } |
332 | 332 | |
333 | - if ( isset( $_GET['button_label'] ) ) { |
|
334 | - return $_GET['button_label']; |
|
333 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
334 | + return $_GET[ 'button_label' ]; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | return $this->oProp->sThickBoxButtonUseThis |
@@ -350,12 +350,12 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
352 | 352 | |
353 | - if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
353 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
354 | 354 | return $aTabs; |
355 | 355 | } |
356 | 356 | |
357 | - if ( ! $_REQUEST['enable_external_source'] ) { |
|
358 | - unset( $aTabs['type_url'] ); // removes the 'From URL' tab in the thick box. |
|
357 | + if ( !$_REQUEST[ 'enable_external_source' ] ) { |
|
358 | + unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
|
359 | 359 | } |
360 | 360 | return $aTabs; |
361 | 361 |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | wp_enqueue_script( 'thickbox' ); |
316 | 316 | wp_enqueue_style( 'thickbox' ); |
317 | 317 | |
318 | - if ( function_exists( 'wp_enqueue_media' ) ) { |
|
318 | + if ( function_exists( 'wp_enqueue_media' ) ) { |
|
319 | 319 | // If the WordPress version is 3.5 or above, |
320 | 320 | new AdminPageFramework_Form_View___Script_MediaUploader( $this->oMsg ); |
321 | 321 | } else { |
322 | 322 | wp_enqueue_script( 'media-upload' ); |
323 | 323 | } |
324 | 324 | |
325 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
325 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
326 | 326 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
327 | 327 | } |
328 | 328 | |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
339 | 339 | |
340 | 340 | // Replace the button label in the media thick box. |
341 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
341 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
342 | 342 | return $sTranslated; |
343 | 343 | } |
344 | - if ( $sText !== 'Insert into Post' ) { |
|
344 | + if ( $sText !== 'Insert into Post' ) { |
|
345 | 345 | return $sTranslated; |
346 | 346 | } |
347 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
347 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
348 | 348 | return $sTranslated; |
349 | 349 | } |
350 | 350 | |
351 | - if ( isset( $_GET['button_label'] ) ) { |
|
351 | + if ( isset( $_GET['button_label'] ) ) { |
|
352 | 352 | return $_GET['button_label']; |
353 | 353 | } |
354 | 354 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
370 | 370 | |
371 | - if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
371 | + if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
372 | 372 | return $aTabs; |
373 | 373 | } |
374 | 374 |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * Defines the default key-values of this field type. |
28 | 28 | */ |
29 | 29 | protected $aDefaultKeys = array( |
30 | - 'select_all_button' => false, // 3.3.0+ to change the label, set the label here |
|
31 | - 'select_none_button' => false, // 3.3.0+ to change the label, set the label here |
|
30 | + 'select_all_button' => false, // 3.3.0+ to change the label, set the label here |
|
31 | + 'select_none_button' => false, // 3.3.0+ to change the label, set the label here |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function getScripts() { |
41 | 41 | new AdminPageFramework_Script_CheckboxSelector; |
42 | - $_sClassSelectorSelectAll = $this->_getSelectButtonClassSelectors( |
|
42 | + $_sClassSelectorSelectAll = $this->_getSelectButtonClassSelectors( |
|
43 | 43 | $this->aFieldTypeSlugs, |
44 | 44 | 'select_all_button' // data attribute |
45 | 45 | ); |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @since 3.5.12 |
66 | 66 | * @return string |
67 | 67 | */ |
68 | - private function _getSelectButtonClassSelectors( array $aFieldTypeSlugs, $sDataAttribute='select_all_button' ) { |
|
68 | + private function _getSelectButtonClassSelectors( array $aFieldTypeSlugs, $sDataAttribute = 'select_all_button' ) { |
|
69 | 69 | |
70 | 70 | $_aClassSelectors = array(); |
71 | 71 | foreach ( $aFieldTypeSlugs as $_sSlug ) { |
72 | - if ( ! is_scalar( $_sSlug ) ) { |
|
72 | + if ( !is_scalar( $_sSlug ) ) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | - $_aClassSelectors[] = '.admin-page-framework-checkbox-container-' . $_sSlug . "[data-{$sDataAttribute}]"; |
|
75 | + $_aClassSelectors[ ] = '.admin-page-framework-checkbox-container-'.$_sSlug."[data-{$sDataAttribute}]"; |
|
76 | 76 | } |
77 | 77 | return implode( ',', $_aClassSelectors ); |
78 | 78 | |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | protected function getField( $aField ) { |
128 | 128 | |
129 | 129 | $_aOutput = array(); |
130 | - $_bIsMultiple = is_array( $aField['label'] ); |
|
131 | - foreach( $this->getAsArray( $aField['label'], true ) as $_sKey => $_sLabel ) { |
|
132 | - $_aOutput[] = $this->_getEachCheckboxOutput( |
|
130 | + $_bIsMultiple = is_array( $aField[ 'label' ] ); |
|
131 | + foreach ( $this->getAsArray( $aField[ 'label' ], true ) as $_sKey => $_sLabel ) { |
|
132 | + $_aOutput[ ] = $this->_getEachCheckboxOutput( |
|
133 | 133 | $aField, |
134 | 134 | $_bIsMultiple |
135 | 135 | ? $_sKey |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $_sLabel |
138 | 138 | ); |
139 | 139 | } |
140 | - return "<div " . $this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ) . ">" |
|
140 | + return "<div ".$this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ).">" |
|
141 | 141 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
142 | 142 | . implode( PHP_EOL, $_aOutput ) |
143 | 143 | . "</div>"; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function _getCheckboxContainerAttributes( array $aField ) { |
154 | 154 | return array( |
155 | - 'class' => 'admin-page-framework-checkbox-container-' . $aField[ 'type' ], |
|
156 | - 'data-select_all_button' => $aField['select_all_button'] |
|
157 | - ? ( ! is_string( $aField['select_all_button'] ) ? $this->oMsg->get( 'select_all' ) : $aField['select_all_button'] ) |
|
155 | + 'class' => 'admin-page-framework-checkbox-container-'.$aField[ 'type' ], |
|
156 | + 'data-select_all_button' => $aField[ 'select_all_button' ] |
|
157 | + ? ( !is_string( $aField[ 'select_all_button' ] ) ? $this->oMsg->get( 'select_all' ) : $aField[ 'select_all_button' ] ) |
|
158 | 158 | : null, |
159 | - 'data-select_none_button' => $aField['select_none_button'] |
|
160 | - ? ( ! is_string( $aField['select_none_button'] ) ? $this->oMsg->get( 'select_none' ) : $aField['select_none_button'] ) |
|
159 | + 'data-select_none_button' => $aField[ 'select_none_button' ] |
|
160 | + ? ( !is_string( $aField[ 'select_none_button' ] ) ? $this->oMsg->get( 'select_none' ) : $aField[ 'select_none_button' ] ) |
|
161 | 161 | : null, |
162 | 162 | ); |
163 | 163 | } |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | */ |
171 | 171 | private function _getEachCheckboxOutput( array $aField, $sKey, $sLabel ) { |
172 | 172 | |
173 | - $_oCheckbox = new AdminPageFramework_Input_checkbox( $aField['attributes'] ); |
|
173 | + $_oCheckbox = new AdminPageFramework_Input_checkbox( $aField[ 'attributes' ] ); |
|
174 | 174 | $_oCheckbox->setAttributesByKey( $sKey ); |
175 | 175 | $_oCheckbox->addClass( $this->_sCheckboxClassSelector ); |
176 | 176 | return $this->getElement( $aField, array( 'before_label', $sKey ) ) |
177 | - . "<div class='admin-page-framework-input-label-container admin-page-framework-checkbox-label' style='min-width: " . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
178 | - . "<label " . $this->getAttributes( |
|
177 | + . "<div class='admin-page-framework-input-label-container admin-page-framework-checkbox-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
178 | + . "<label ".$this->getAttributes( |
|
179 | 179 | array( |
180 | 180 | 'for' => $_oCheckbox->getAttribute( 'id' ), |
181 | 181 | 'class' => $_oCheckbox->getAttribute( 'disabled' ) |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | protected function setUp() { |
47 | 47 | |
48 | 48 | // If the WordPress version is greater than or equal to 3.5, then load the new WordPress color picker. |
49 | - if ( version_compare( $GLOBALS['wp_version'], '3.5', '>=' ) ) { |
|
49 | + if ( version_compare( $GLOBALS[ 'wp_version' ], '3.5', '>=' ) ) { |
|
50 | 50 | //Both the necessary css and javascript have been registered already by WordPress, so all we have to do is load them with their handle. |
51 | 51 | wp_enqueue_style( 'wp-color-picker' ); |
52 | 52 | wp_enqueue_script( 'wp-color-picker' ); |
@@ -209,29 +209,29 @@ discard block |
||
209 | 209 | protected function getField( $aField ) { |
210 | 210 | |
211 | 211 | // If the value is not set, apply the default value, 'transparent'. |
212 | - $aField['value'] = is_null( $aField['value'] ) |
|
212 | + $aField[ 'value' ] = is_null( $aField[ 'value' ] ) |
|
213 | 213 | ? 'transparent' |
214 | - : $aField['value']; |
|
214 | + : $aField[ 'value' ]; |
|
215 | 215 | |
216 | 216 | $aField[ 'attributes' ] = $this->_getInputAttributes( $aField ); |
217 | 217 | |
218 | 218 | return |
219 | - $aField['before_label'] |
|
219 | + $aField[ 'before_label' ] |
|
220 | 220 | . "<div class='admin-page-framework-input-label-container'>" |
221 | - . "<label for='{$aField['input_id']}'>" |
|
221 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
222 | 222 | . $aField[ 'before_input' ] |
223 | - . ( $aField['label'] && ! $aField['repeatable'] |
|
224 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>" |
|
223 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
224 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>" |
|
225 | 225 | : "" |
226 | 226 | ) |
227 | - . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
|
227 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
228 | 228 | . $aField[ 'after_input' ] |
229 | 229 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
230 | 230 | . "</label>" |
231 | - . "<div class='colorpicker' id='color_{$aField['input_id']}'></div>" // this div element with this class selector becomes a farbtastic color picker. ( below 3.4.x ) // rel='{$aField['input_id']}' |
|
232 | - . $this->_getColorPickerEnablerScript( "{$aField['input_id']}" ) |
|
231 | + . "<div class='colorpicker' id='color_{$aField[ 'input_id' ]}'></div>" // this div element with this class selector becomes a farbtastic color picker. ( below 3.4.x ) // rel='{$aField['input_id']}' |
|
232 | + . $this->_getColorPickerEnablerScript( "{$aField[ 'input_id' ]}" ) |
|
233 | 233 | . "</div>" |
234 | - . $aField['after_label']; |
|
234 | + . $aField[ 'after_label' ]; |
|
235 | 235 | |
236 | 236 | } |
237 | 237 | /** |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | private function _getInputAttributes( array $aField ) { |
243 | 243 | |
244 | 244 | return array( |
245 | - 'color' => $aField['value'], |
|
246 | - 'value' => $aField['value'], |
|
245 | + 'color' => $aField[ 'value' ], |
|
246 | + 'value' => $aField[ 'value' ], |
|
247 | 247 | 'data-default' => isset( $aField[ 'default' ] ) |
248 | 248 | ? $aField[ 'default' ] |
249 | 249 | : 'transparent', // used by the repeatable script |
250 | 250 | 'type' => 'text', // it must be text |
251 | - 'class' => trim( 'input_color ' . $aField['attributes']['class'] ), |
|
251 | + 'class' => trim( 'input_color '.$aField[ 'attributes' ][ 'class' ] ), |
|
252 | 252 | ) + $aField[ 'attributes' ]; |
253 | 253 | |
254 | 254 | } |
@@ -37,19 +37,19 @@ |
||
37 | 37 | */ |
38 | 38 | public function _replyToGetField( $aField ) { |
39 | 39 | return |
40 | - $aField['before_label'] |
|
40 | + $aField[ 'before_label' ] |
|
41 | 41 | . "<div class='admin-page-framework-input-label-container'>" |
42 | - . "<label for='{$aField['input_id']}'>" |
|
43 | - . $aField['before_input'] |
|
44 | - . ( $aField['label'] && ! $aField['repeatable'] |
|
45 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>" |
|
42 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
43 | + . $aField[ 'before_input' ] |
|
44 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
45 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>" |
|
46 | 46 | : "" |
47 | 47 | ) |
48 | - . $aField['value'] |
|
49 | - . $aField['after_input'] |
|
48 | + . $aField[ 'value' ] |
|
49 | + . $aField[ 'after_input' ] |
|
50 | 50 | . "</label>" |
51 | 51 | . "</div>" |
52 | - . $aField['after_label'] |
|
52 | + . $aField[ 'after_label' ] |
|
53 | 53 | ; |
54 | 54 | } |
55 | 55 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Defines the field type slugs used for this field type. |
22 | 22 | */ |
23 | - public $aFieldTypeSlugs = array( 'export', ); |
|
23 | + public $aFieldTypeSlugs = array( 'export',); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines the default key-values of this field type. |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
29 | 29 | */ |
30 | 30 | protected $aDefaultKeys = array( |
31 | - 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
32 | - 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
33 | - 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
31 | + 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
32 | + 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
33 | + 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
34 | 34 | 'attributes' => array( |
35 | 35 | 'class' => 'button button-primary', |
36 | 36 | ), |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | protected function getField( $aField ) { |
72 | 72 | |
73 | 73 | /* Set the transient data to export - If the value is not an array and the export data is set. */ |
74 | - if ( isset( $aField['data'] ) ) { |
|
75 | - $this->setTransient( md5( "{$aField['class_name']}_{$aField['input_id']}" ), $aField['data'], 60*2 ); // 2 minutes. |
|
74 | + if ( isset( $aField[ 'data' ] ) ) { |
|
75 | + $this->setTransient( md5( "{$aField[ 'class_name' ]}_{$aField[ 'input_id' ]}" ), $aField[ 'data' ], 60 * 2 ); // 2 minutes. |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /* Set some required values */ |
79 | - $aField['attributes']['name'] = "__export[submit][{$aField['input_id']}]"; |
|
80 | - $aField['file_name'] = $aField['file_name'] ? $aField['file_name'] : $this->_generateExportFileName( $aField['option_key'] ? $aField['option_key'] : $aField['class_name'], $aField['format'] ); |
|
81 | - $aField['label'] = $aField['label'] ? $aField['label'] : $this->oMsg->get( 'export' ); |
|
79 | + $aField[ 'attributes' ][ 'name' ] = "__export[submit][{$aField[ 'input_id' ]}]"; |
|
80 | + $aField[ 'file_name' ] = $aField[ 'file_name' ] ? $aField[ 'file_name' ] : $this->_generateExportFileName( $aField[ 'option_key' ] ? $aField[ 'option_key' ] : $aField[ 'class_name' ], $aField[ 'format' ] ); |
|
81 | + $aField[ 'label' ] = $aField[ 'label' ] ? $aField[ 'label' ] : $this->oMsg->get( 'export' ); |
|
82 | 82 | |
83 | 83 | return parent::getField( $aField ); |
84 | 84 | |
@@ -93,42 +93,42 @@ discard block |
||
93 | 93 | |
94 | 94 | $_aAttributes = array( 'type' => 'hidden' ); |
95 | 95 | return |
96 | - "<input " . $this->getAttributes( |
|
96 | + "<input ".$this->getAttributes( |
|
97 | 97 | array( |
98 | - 'name' => "__export[{$aField['input_id']}][input_id]", |
|
99 | - 'value' => $aField['input_id'], |
|
98 | + 'name' => "__export[{$aField[ 'input_id' ]}][input_id]", |
|
99 | + 'value' => $aField[ 'input_id' ], |
|
100 | 100 | ) + $_aAttributes |
101 | - ) . "/>" |
|
102 | - . "<input " . $this->getAttributes( |
|
101 | + )."/>" |
|
102 | + . "<input ".$this->getAttributes( |
|
103 | 103 | array( |
104 | - 'name' => "__export[{$aField['input_id']}][field_id]", |
|
105 | - 'value' => $aField['field_id'], |
|
104 | + 'name' => "__export[{$aField[ 'input_id' ]}][field_id]", |
|
105 | + 'value' => $aField[ 'field_id' ], |
|
106 | 106 | ) + $_aAttributes |
107 | - ) . "/>" |
|
108 | - . "<input " . $this->getAttributes( |
|
107 | + )."/>" |
|
108 | + . "<input ".$this->getAttributes( |
|
109 | 109 | array( |
110 | - 'name' => "__export[{$aField['input_id']}][section_id]", |
|
111 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
110 | + 'name' => "__export[{$aField[ 'input_id' ]}][section_id]", |
|
111 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
112 | 112 | ) + $_aAttributes |
113 | - ) . "/>" |
|
114 | - . "<input " . $this->getAttributes( |
|
113 | + )."/>" |
|
114 | + . "<input ".$this->getAttributes( |
|
115 | 115 | array( |
116 | - 'name' => "__export[{$aField['input_id']}][file_name]", |
|
117 | - 'value' => $aField['file_name'], |
|
116 | + 'name' => "__export[{$aField[ 'input_id' ]}][file_name]", |
|
117 | + 'value' => $aField[ 'file_name' ], |
|
118 | 118 | ) + $_aAttributes |
119 | - ) . "/>" |
|
120 | - . "<input " . $this->getAttributes( |
|
119 | + )."/>" |
|
120 | + . "<input ".$this->getAttributes( |
|
121 | 121 | array( |
122 | - 'name' => "__export[{$aField['input_id']}][format]", |
|
123 | - 'value' => $aField['format'], |
|
122 | + 'name' => "__export[{$aField[ 'input_id' ]}][format]", |
|
123 | + 'value' => $aField[ 'format' ], |
|
124 | 124 | ) + $_aAttributes |
125 | - ) . "/>" |
|
126 | - . "<input " . $this->getAttributes( |
|
125 | + )."/>" |
|
126 | + . "<input ".$this->getAttributes( |
|
127 | 127 | array( |
128 | - 'name' => "__export[{$aField['input_id']}][transient]", |
|
129 | - 'value' => isset( $aField['data'] ), |
|
128 | + 'name' => "__export[{$aField[ 'input_id' ]}][transient]", |
|
129 | + 'value' => isset( $aField[ 'data' ] ), |
|
130 | 130 | ) + $_aAttributes |
131 | - ) . "/>" |
|
131 | + )."/>" |
|
132 | 132 | ; |
133 | 133 | } |
134 | 134 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @since 2.0.0 |
142 | 142 | * @since 2.1.5 Moved from the AdminPageFramework_FormField class. |
143 | 143 | */ |
144 | - private function _generateExportFileName( $sOptionKey, $sExportFormat='json' ) { |
|
144 | + private function _generateExportFileName( $sOptionKey, $sExportFormat = 'json' ) { |
|
145 | 145 | |
146 | 146 | switch ( trim( strtolower( $sExportFormat ) ) ) { |
147 | 147 | case 'text': // for plain text. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | break; |
157 | 157 | } |
158 | 158 | |
159 | - return $sOptionKey . '_' . date("Ymd") . '.' . $sExt; |
|
159 | + return $sOptionKey.'_'.date( "Ymd" ).'.'.$sExt; |
|
160 | 160 | |
161 | 161 | } |
162 | 162 |