@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | */ |
37 | 37 | static public function getInlineCSS( array $aCSSRules ) { |
38 | 38 | $_aOutput = array(); |
39 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
39 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
40 | 40 | if ( is_null( $_sValue ) ) { |
41 | 41 | continue; |
42 | 42 | } |
43 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
43 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
44 | 44 | } |
45 | 45 | return implode( '; ', $_aOutput ); |
46 | 46 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | static public function getStyleAttribute( $asInlineCSSes ) { |
72 | 72 | |
73 | 73 | $_aCSSRules = array(); |
74 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
74 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
75 | 75 | |
76 | 76 | // For array, store in the container. |
77 | 77 | if ( is_array( $_asCSSRules ) ) { |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | // At this point, it is a string. Break them down to array elements. |
83 | 83 | $__aCSSRules = explode( ';', $_asCSSRules ); |
84 | - foreach( $__aCSSRules as $_sPair ) { |
|
84 | + foreach ( $__aCSSRules as $_sPair ) { |
|
85 | 85 | $_aCSSPair = explode( ':', $_sPair ); |
86 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
86 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | */ |
121 | 121 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
122 | 122 | |
123 | - $_aClasses = array(); |
|
124 | - foreach( func_get_args() as $_asClasses ) { |
|
125 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
123 | + $_aClasses = array(); |
|
124 | + foreach ( func_get_args() as $_asClasses ) { |
|
125 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
126 | 126 | continue; |
127 | 127 | } |
128 | 128 | $_aClasses = array_merge( |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | : explode( ' ', $_asClasses ) |
133 | 133 | ); |
134 | 134 | } |
135 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
135 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
136 | 136 | |
137 | 137 | // @todo examine if it is okay to remove the trim() function below. |
138 | 138 | return trim( implode( ' ', $_aClasses ) ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
149 | 149 | $_aParams = func_get_args(); |
150 | 150 | return call_user_func_array( |
151 | - array( __CLASS__ , 'getClassAttribute' ), |
|
151 | + array( __CLASS__, 'getClassAttribute' ), |
|
152 | 152 | $_aParams |
153 | 153 | ); |
154 | 154 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | static public function getDataAttributeArray( array $aArray ) { |
166 | 166 | |
167 | 167 | $_aNewArray = array(); |
168 | - foreach( $aArray as $sKey => $v ) { |
|
168 | + foreach ( $aArray as $sKey => $v ) { |
|
169 | 169 | |
170 | 170 | if ( in_array( gettype( $v ), array( 'object', 'NULL' ) ) ) { |
171 | 171 | continue; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @since 3.1.3 |
65 | 65 | * @since 3.1.5 Added the $vDefault parameter. |
66 | 66 | */ |
67 | - static public function getTransient( $sTransientKey, $vDefault=null ) { |
|
67 | + static public function getTransient( $sTransientKey, $vDefault = null ) { |
|
68 | 68 | |
69 | 69 | // Temporarily disable $_wp_using_ext_object_cache |
70 | 70 | global $_wp_using_ext_object_cache; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @since 3.1.3 |
107 | 107 | * @return boolean True if set; otherwise, false. |
108 | 108 | */ |
109 | - static public function setTransient( $sTransientKey, $vValue, $iExpiration=0 ) { |
|
109 | + static public function setTransient( $sTransientKey, $vValue, $iExpiration = 0 ) { |
|
110 | 110 | |
111 | 111 | // Temporarily disable `$_wp_using_ext_object_cache`. |
112 | 112 | global $_wp_using_ext_object_cache; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * The method will replace last ending 33 characters if the given string in the first parameter exceeds the limit. So this number must be greater than 33. |
147 | 147 | * @return string |
148 | 148 | */ |
149 | - static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength=45 ) { |
|
149 | + static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength = 45 ) { |
|
150 | 150 | |
151 | 151 | // Check if the given string eceees the length limit. |
152 | 152 | if ( strlen( $sSubject ) <= $iAllowedCharacterLength ) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 0, // start position |
161 | 161 | $_iPrefixLengthToKeep - 1 // how many characters to extract |
162 | 162 | ); |
163 | - return $_sPrefixToKeep . '_' . md5( $sSubject ); |
|
163 | + return $_sPrefixToKeep.'_'.md5( $sSubject ); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
175 | 175 | * @param array $aAdditionalOptions an additional options array to merge with the options array. |
176 | 176 | */ |
177 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
177 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
178 | 178 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions ); |
179 | 179 | } |
180 | 180 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @remark Used in the network admin area. |
190 | 190 | * @return mixed |
191 | 191 | */ |
192 | - static public function getSiteOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
192 | + static public function getSiteOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
193 | 193 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions, 'get_site_option' ); |
194 | 194 | } |
195 | 195 | /** |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | * @since 3.5.3 |
199 | 199 | * @return mixed |
200 | 200 | */ |
201 | - static private function _getOptionByFunctionName( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array(), $sFunctionName='get_option' ) { |
|
201 | + static private function _getOptionByFunctionName( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array(), $sFunctionName = 'get_option' ) { |
|
202 | 202 | |
203 | 203 | // Entire options |
204 | - if ( ! isset( $asKey ) ) { |
|
204 | + if ( !isset( $asKey ) ) { |
|
205 | 205 | $_aOptions = $sFunctionName( |
206 | 206 | $sOptionKey, |
207 | 207 | isset( $vDefault ) |
208 | 208 | ? $vDefault |
209 | 209 | : array() |
210 | - );; |
|
210 | + ); ; |
|
211 | 211 | return empty( $aAdditionalOptions ) |
212 | 212 | ? $_aOptions |
213 | 213 | : self::uniteArrays( |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Defines the field type slugs used for this field type. |
42 | 42 | */ |
43 | - public $aFieldTypeSlugs = array( 'import', ); |
|
43 | + public $aFieldTypeSlugs = array( 'import',); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Defines the default key-values of this field type. |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | protected function getField( $aField ) { |
117 | 117 | |
118 | 118 | /* Set some required values */ |
119 | - $aField['attributes']['name'] = "__import[submit][{$aField['input_id']}]"; |
|
120 | - $aField['label'] = $aField['label'] |
|
121 | - ? $aField['label'] |
|
119 | + $aField[ 'attributes' ][ 'name' ] = "__import[submit][{$aField[ 'input_id' ]}]"; |
|
120 | + $aField[ 'label' ] = $aField[ 'label' ] |
|
121 | + ? $aField[ 'label' ] |
|
122 | 122 | : $this->oMsg->get( 'import' ); |
123 | 123 | return parent::getField( $aField ); |
124 | 124 | } |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @return string |
134 | 134 | */ |
135 | 135 | protected function _getExtraFieldsBeforeLabel( &$aField ) { |
136 | - return "<input " . $this->getAttributes( |
|
136 | + return "<input ".$this->getAttributes( |
|
137 | 137 | array( |
138 | - 'id' => "{$aField['input_id']}_file", |
|
138 | + 'id' => "{$aField[ 'input_id' ]}_file", |
|
139 | 139 | 'type' => 'file', |
140 | - 'name' => "__import[{$aField['input_id']}]", |
|
141 | - ) + $aField['attributes']['file'] |
|
142 | - ) . " />"; |
|
140 | + 'name' => "__import[{$aField[ 'input_id' ]}]", |
|
141 | + ) + $aField[ 'attributes' ][ 'file' ] |
|
142 | + )." />"; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -150,44 +150,44 @@ discard block |
||
150 | 150 | */ |
151 | 151 | protected function _getExtraInputFields( &$aField ) { |
152 | 152 | |
153 | - $aHiddenAttributes = array( 'type' => 'hidden', ); |
|
153 | + $aHiddenAttributes = array( 'type' => 'hidden',); |
|
154 | 154 | return |
155 | - "<input " . $this->getAttributes( |
|
155 | + "<input ".$this->getAttributes( |
|
156 | 156 | array( |
157 | - 'name' => "__import[{$aField['input_id']}][input_id]", |
|
158 | - 'value' => $aField['input_id'], |
|
157 | + 'name' => "__import[{$aField[ 'input_id' ]}][input_id]", |
|
158 | + 'value' => $aField[ 'input_id' ], |
|
159 | 159 | ) + $aHiddenAttributes |
160 | - ) . "/>" |
|
161 | - . "<input " . $this->getAttributes( |
|
160 | + )."/>" |
|
161 | + . "<input ".$this->getAttributes( |
|
162 | 162 | array( |
163 | - 'name' => "__import[{$aField['input_id']}][field_id]", |
|
164 | - 'value' => $aField['field_id'], |
|
163 | + 'name' => "__import[{$aField[ 'input_id' ]}][field_id]", |
|
164 | + 'value' => $aField[ 'field_id' ], |
|
165 | 165 | ) + $aHiddenAttributes |
166 | - ) . "/>" |
|
167 | - . "<input " . $this->getAttributes( |
|
166 | + )."/>" |
|
167 | + . "<input ".$this->getAttributes( |
|
168 | 168 | array( |
169 | - 'name' => "__import[{$aField['input_id']}][section_id]", |
|
170 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
169 | + 'name' => "__import[{$aField[ 'input_id' ]}][section_id]", |
|
170 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
171 | 171 | ) + $aHiddenAttributes |
172 | - ) . "/>" |
|
173 | - . "<input " . $this->getAttributes( |
|
172 | + )."/>" |
|
173 | + . "<input ".$this->getAttributes( |
|
174 | 174 | array( |
175 | - 'name' => "__import[{$aField['input_id']}][is_merge]", |
|
176 | - 'value' => $aField['is_merge'], |
|
175 | + 'name' => "__import[{$aField[ 'input_id' ]}][is_merge]", |
|
176 | + 'value' => $aField[ 'is_merge' ], |
|
177 | 177 | ) + $aHiddenAttributes |
178 | - ) . "/>" |
|
179 | - . "<input " . $this->getAttributes( |
|
178 | + )."/>" |
|
179 | + . "<input ".$this->getAttributes( |
|
180 | 180 | array( |
181 | - 'name' => "__import[{$aField['input_id']}][option_key]", |
|
182 | - 'value' => $aField['option_key'], |
|
181 | + 'name' => "__import[{$aField[ 'input_id' ]}][option_key]", |
|
182 | + 'value' => $aField[ 'option_key' ], |
|
183 | 183 | ) + $aHiddenAttributes |
184 | - ) . "/>" |
|
185 | - . "<input " . $this->getAttributes( |
|
184 | + )."/>" |
|
185 | + . "<input ".$this->getAttributes( |
|
186 | 186 | array( |
187 | - 'name' => "__import[{$aField['input_id']}][format]", |
|
188 | - 'value' => $aField['format'], |
|
187 | + 'name' => "__import[{$aField[ 'input_id' ]}][format]", |
|
188 | + 'value' => $aField[ 'format' ], |
|
189 | 189 | ) + $aHiddenAttributes |
190 | - ) . "/>" |
|
190 | + )."/>" |
|
191 | 191 | ; |
192 | 192 | } |
193 | 193 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | * @since 3.3.1 Changed from `_replyToGetStyles()`. |
93 | 93 | * @internal |
94 | 94 | */ |
95 | - protected function getStyles() { |
|
95 | + protected function getStyles() { |
|
96 | 96 | return <<<CSSRULES |
97 | 97 | /* Import Field */ |
98 | 98 | .admin-page-framework-field-import input { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * Defines the field type slugs used for this field type. |
188 | 188 | */ |
189 | - public $aFieldTypeSlugs = array( 'submit', ); |
|
189 | + public $aFieldTypeSlugs = array( 'submit',); |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Defines the default key-values of this field type. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'redirect_url' => null, |
198 | 198 | 'href' => null, |
199 | 199 | 'reset' => null, |
200 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
200 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
201 | 201 | /* |
202 | 202 | array( |
203 | 203 | 'to' => null, // string|array The email address to send to or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the the field ID. |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'attachments' => null, // string|array The file path(s) or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the the field ID. |
208 | 208 | ) |
209 | 209 | */ |
210 | - 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
210 | + 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
211 | 211 | 'attributes' => array( |
212 | 212 | 'class' => 'button button-primary', |
213 | 213 | ), |
@@ -247,16 +247,16 @@ discard block |
||
247 | 247 | |
248 | 248 | return |
249 | 249 | $aField[ 'before_label' ] |
250 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
250 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
251 | 251 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
252 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
252 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
253 | 253 | . $aField[ 'before_input' ] |
254 | 254 | . $this->_getExtraInputFields( $aField ) |
255 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
255 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
256 | 256 | . $aField[ 'after_input' ] |
257 | 257 | . "</label>" |
258 | 258 | . "</div>" |
259 | - . $aField['after_label']; |
|
259 | + . $aField[ 'after_label' ]; |
|
260 | 260 | |
261 | 261 | } |
262 | 262 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | private function _getLabelAttributes( array $aField, array $aInputAttributes ) { |
289 | 289 | return array( |
290 | 290 | 'style' => $aField[ 'label_min_width' ] |
291 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
291 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
292 | 292 | : null, |
293 | 293 | 'for' => $aInputAttributes[ 'id' ], |
294 | 294 | 'class' => $aInputAttributes[ 'disabled' ] |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | private function _getLabelContainerAttributes( array $aField ) { |
307 | 307 | return array( |
308 | 308 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
309 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
309 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
310 | 310 | : null, |
311 | 311 | 'class' => 'admin-page-framework-input-label-container' |
312 | 312 | . ' admin-page-framework-input-button-container' |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | protected function _getExtraInputFields( &$aField ) { |
358 | 358 | |
359 | 359 | $_aOutput = array(); |
360 | - $_aOutput[] = $this->getHTMLTag( |
|
360 | + $_aOutput[ ] = $this->getHTMLTag( |
|
361 | 361 | 'input', |
362 | 362 | array( |
363 | 363 | 'type' => 'hidden', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'value' => $aField[ 'input_id' ], |
366 | 366 | ) |
367 | 367 | ); |
368 | - $_aOutput[] = $this->getHTMLTag( |
|
368 | + $_aOutput[ ] = $this->getHTMLTag( |
|
369 | 369 | 'input', |
370 | 370 | array( |
371 | 371 | 'type' => 'hidden', |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | 'value' => $aField[ 'field_id' ], |
374 | 374 | ) |
375 | 375 | ); |
376 | - $_aOutput[] = $this->getHTMLTag( |
|
376 | + $_aOutput[ ] = $this->getHTMLTag( |
|
377 | 377 | 'input', |
378 | 378 | array( |
379 | 379 | 'type' => 'hidden', |
@@ -381,11 +381,11 @@ discard block |
||
381 | 381 | 'value' => $aField[ '_input_name_flat' ], |
382 | 382 | ) |
383 | 383 | ); |
384 | - $_aOutput[] = $this->_getHiddenInput_SectionID( $aField ); |
|
385 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
386 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
387 | - $_aOutput[] = $this->_getHiddenInput_Reset( $aField ); |
|
388 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
384 | + $_aOutput[ ] = $this->_getHiddenInput_SectionID( $aField ); |
|
385 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
386 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
387 | + $_aOutput[ ] = $this->_getHiddenInput_Reset( $aField ); |
|
388 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
389 | 389 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
390 | 390 | |
391 | 391 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | 'input', |
402 | 402 | array( |
403 | 403 | 'type' => 'hidden', |
404 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
405 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
406 | - ? $aField['section_id'] |
|
404 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
405 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
406 | + ? $aField[ 'section_id' ] |
|
407 | 407 | : '', |
408 | 408 | ) |
409 | 409 | ); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | 'input', |
422 | 422 | array( |
423 | 423 | 'type' => 'hidden', |
424 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
424 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
425 | 425 | 'value' => $aField[ $sKey ], |
426 | 426 | ) |
427 | 427 | ) |
@@ -435,15 +435,15 @@ discard block |
||
435 | 435 | * @return string the HTML input tag output for the 'reset' argument. |
436 | 436 | */ |
437 | 437 | private function _getHiddenInput_Reset( array $aField ) { |
438 | - if ( ! $aField['reset'] ) { |
|
438 | + if ( !$aField[ 'reset' ] ) { |
|
439 | 439 | return ''; |
440 | 440 | } |
441 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
441 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
442 | 442 | ? $this->getHTMLTag( |
443 | 443 | 'input', |
444 | 444 | array( |
445 | 445 | 'type' => 'hidden', |
446 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
446 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
447 | 447 | 'value' => '1', |
448 | 448 | ) |
449 | 449 | ) |
@@ -451,10 +451,10 @@ discard block |
||
451 | 451 | 'input', |
452 | 452 | array( |
453 | 453 | 'type' => 'hidden', |
454 | - 'name' => "__submit[{$aField['input_id']}][reset_key]", |
|
455 | - 'value' => is_array( $aField['reset'] ) // set the option array key to delete. |
|
456 | - ? implode( '|', $aField['reset'] ) |
|
457 | - : $aField['reset'], |
|
454 | + 'name' => "__submit[{$aField[ 'input_id' ]}][reset_key]", |
|
455 | + 'value' => is_array( $aField[ 'reset' ] ) // set the option array key to delete. |
|
456 | + ? implode( '|', $aField[ 'reset' ] ) |
|
457 | + : $aField[ 'reset' ], |
|
458 | 458 | ) |
459 | 459 | ); |
460 | 460 | } |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | return ''; |
472 | 472 | } |
473 | 473 | $this->setTransient( |
474 | - 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ), |
|
474 | + 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ), |
|
475 | 475 | $aField[ 'email' ] |
476 | 476 | ); |
477 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
477 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
478 | 478 | ? $this->getHTMLTag( |
479 | 479 | 'input', |
480 | 480 | array( |
@@ -499,19 +499,19 @@ discard block |
||
499 | 499 | * @return boolean |
500 | 500 | * @internal |
501 | 501 | */ |
502 | - private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) { |
|
502 | + private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) { |
|
503 | 503 | |
504 | - switch( $sType ) { |
|
504 | + switch ( $sType ) { |
|
505 | 505 | default: |
506 | 506 | case 'reset': // admin page framework _ reset confirmation |
507 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
507 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
508 | 508 | break; |
509 | 509 | case 'email': // admin page framework _ email confirmation |
510 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
510 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
511 | 511 | break; |
512 | 512 | } |
513 | 513 | |
514 | - $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && ! $aField[ 'skip_confirmation' ] |
|
514 | + $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ] |
|
515 | 515 | ? false |
516 | 516 | : true; |
517 | 517 |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @return array The label container attribute array. |
304 | 304 | * @internal |
305 | 305 | */ |
306 | - private function _getLabelContainerAttributes( array $aField ) { |
|
306 | + private function _getLabelContainerAttributes( array $aField ) { |
|
307 | 307 | return array( |
308 | 308 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
309 | 309 | ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
@@ -539,19 +539,19 @@ discard block |
||
539 | 539 | * @since 2.1.5 Moved from `AdminPageFramwrork_InputField`. Changed the scope to protected from private. Removed the second parameter. |
540 | 540 | * @internal |
541 | 541 | */ |
542 | - protected function _getInputFieldValueFromLabel( $aField ) { |
|
542 | + protected function _getInputFieldValueFromLabel( $aField ) { |
|
543 | 543 | |
544 | 544 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
545 | - if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
545 | + if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
546 | 546 | return $aField[ 'value' ]; |
547 | 547 | } |
548 | 548 | |
549 | - if ( isset( $aField[ 'label' ] ) ) { |
|
549 | + if ( isset( $aField[ 'label' ] ) ) { |
|
550 | 550 | return $aField[ 'label' ]; |
551 | 551 | } |
552 | 552 | |
553 | 553 | // If the default value is set, |
554 | - if ( isset( $aField[ 'default' ] ) ) { |
|
554 | + if ( isset( $aField[ 'default' ] ) ) { |
|
555 | 555 | return $aField[ 'default' ]; |
556 | 556 | } |
557 | 557 |
@@ -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 | ), |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | protected function getField( $aField ) { |
107 | 107 | |
108 | 108 | /* Set the transient data to export - If the value is not an array and the export data is set. */ |
109 | - if ( isset( $aField['data'] ) ) { |
|
110 | - $this->setTransient( md5( "{$aField['class_name']}_{$aField['input_id']}" ), $aField['data'], 60*2 ); // 2 minutes. |
|
109 | + if ( isset( $aField[ 'data' ] ) ) { |
|
110 | + $this->setTransient( md5( "{$aField[ 'class_name' ]}_{$aField[ 'input_id' ]}" ), $aField[ 'data' ], 60 * 2 ); // 2 minutes. |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /* Set some required values */ |
114 | - $aField['attributes']['name'] = "__export[submit][{$aField['input_id']}]"; |
|
115 | - $aField['file_name'] = $aField['file_name'] ? $aField['file_name'] : $this->_generateExportFileName( $aField['option_key'] ? $aField['option_key'] : $aField['class_name'], $aField['format'] ); |
|
116 | - $aField['label'] = $aField['label'] ? $aField['label'] : $this->oMsg->get( 'export' ); |
|
114 | + $aField[ 'attributes' ][ 'name' ] = "__export[submit][{$aField[ 'input_id' ]}]"; |
|
115 | + $aField[ 'file_name' ] = $aField[ 'file_name' ] ? $aField[ 'file_name' ] : $this->_generateExportFileName( $aField[ 'option_key' ] ? $aField[ 'option_key' ] : $aField[ 'class_name' ], $aField[ 'format' ] ); |
|
116 | + $aField[ 'label' ] = $aField[ 'label' ] ? $aField[ 'label' ] : $this->oMsg->get( 'export' ); |
|
117 | 117 | |
118 | 118 | return parent::getField( $aField ); |
119 | 119 | |
@@ -129,42 +129,42 @@ discard block |
||
129 | 129 | |
130 | 130 | $_aAttributes = array( 'type' => 'hidden' ); |
131 | 131 | return |
132 | - "<input " . $this->getAttributes( |
|
132 | + "<input ".$this->getAttributes( |
|
133 | 133 | array( |
134 | - 'name' => "__export[{$aField['input_id']}][input_id]", |
|
135 | - 'value' => $aField['input_id'], |
|
134 | + 'name' => "__export[{$aField[ 'input_id' ]}][input_id]", |
|
135 | + 'value' => $aField[ 'input_id' ], |
|
136 | 136 | ) + $_aAttributes |
137 | - ) . "/>" |
|
138 | - . "<input " . $this->getAttributes( |
|
137 | + )."/>" |
|
138 | + . "<input ".$this->getAttributes( |
|
139 | 139 | array( |
140 | - 'name' => "__export[{$aField['input_id']}][field_id]", |
|
141 | - 'value' => $aField['field_id'], |
|
140 | + 'name' => "__export[{$aField[ 'input_id' ]}][field_id]", |
|
141 | + 'value' => $aField[ 'field_id' ], |
|
142 | 142 | ) + $_aAttributes |
143 | - ) . "/>" |
|
144 | - . "<input " . $this->getAttributes( |
|
143 | + )."/>" |
|
144 | + . "<input ".$this->getAttributes( |
|
145 | 145 | array( |
146 | - 'name' => "__export[{$aField['input_id']}][section_id]", |
|
147 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
146 | + 'name' => "__export[{$aField[ 'input_id' ]}][section_id]", |
|
147 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
148 | 148 | ) + $_aAttributes |
149 | - ) . "/>" |
|
150 | - . "<input " . $this->getAttributes( |
|
149 | + )."/>" |
|
150 | + . "<input ".$this->getAttributes( |
|
151 | 151 | array( |
152 | - 'name' => "__export[{$aField['input_id']}][file_name]", |
|
153 | - 'value' => $aField['file_name'], |
|
152 | + 'name' => "__export[{$aField[ 'input_id' ]}][file_name]", |
|
153 | + 'value' => $aField[ 'file_name' ], |
|
154 | 154 | ) + $_aAttributes |
155 | - ) . "/>" |
|
156 | - . "<input " . $this->getAttributes( |
|
155 | + )."/>" |
|
156 | + . "<input ".$this->getAttributes( |
|
157 | 157 | array( |
158 | - 'name' => "__export[{$aField['input_id']}][format]", |
|
159 | - 'value' => $aField['format'], |
|
158 | + 'name' => "__export[{$aField[ 'input_id' ]}][format]", |
|
159 | + 'value' => $aField[ 'format' ], |
|
160 | 160 | ) + $_aAttributes |
161 | - ) . "/>" |
|
162 | - . "<input " . $this->getAttributes( |
|
161 | + )."/>" |
|
162 | + . "<input ".$this->getAttributes( |
|
163 | 163 | array( |
164 | - 'name' => "__export[{$aField['input_id']}][transient]", |
|
165 | - 'value' => isset( $aField['data'] ), |
|
164 | + 'name' => "__export[{$aField[ 'input_id' ]}][transient]", |
|
165 | + 'value' => isset( $aField[ 'data' ] ), |
|
166 | 166 | ) + $_aAttributes |
167 | - ) . "/>" |
|
167 | + )."/>" |
|
168 | 168 | ; |
169 | 169 | } |
170 | 170 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @since 2.1.5 Moved from the AdminPageFramework_FormField class. |
179 | 179 | * @internal |
180 | 180 | */ |
181 | - private function _generateExportFileName( $sOptionKey, $sExportFormat='json' ) { |
|
181 | + private function _generateExportFileName( $sOptionKey, $sExportFormat = 'json' ) { |
|
182 | 182 | |
183 | 183 | switch ( trim( strtolower( $sExportFormat ) ) ) { |
184 | 184 | case 'text': // for plain text. |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | break; |
194 | 194 | } |
195 | 195 | |
196 | - return $sOptionKey . '_' . date("Ymd") . '.' . $sExt; |
|
196 | + return $sOptionKey.'_'.date( "Ymd" ).'.'.$sExt; |
|
197 | 197 | |
198 | 198 | } |
199 | 199 |
@@ -23,13 +23,13 @@ |
||
23 | 23 | protected function _get() { |
24 | 24 | return $this->_getFormSectionRules(); |
25 | 25 | } |
26 | - /** |
|
27 | - * Returns the CSS rules for form fields. |
|
28 | - * |
|
29 | - * @since 3.4.0 |
|
30 | - * @since 3.7.0 Moved from `AdminPageFramework_CSS`. |
|
31 | - * @internal |
|
32 | - */ |
|
26 | + /** |
|
27 | + * Returns the CSS rules for form fields. |
|
28 | + * |
|
29 | + * @since 3.4.0 |
|
30 | + * @since 3.7.0 Moved from `AdminPageFramework_CSS`. |
|
31 | + * @internal |
|
32 | + */ |
|
33 | 33 | private function _getFormSectionRules() { |
34 | 34 | $_sCSSRules = <<<CSSRULES |
35 | 35 | /* Section Table */ |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @since 3.7.0 |
22 | 22 | * @return string |
23 | 23 | */ |
24 | - protected function _get() { |
|
24 | + protected function _get() { |
|
25 | 25 | return $this->_getFieldErrorRules(); |
26 | 26 | } |
27 | 27 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @since 3.7.0 |
31 | 31 | */ |
32 | 32 | public function add( $sCSSRules ) { |
33 | - $this->aAdded[] = $sCSSRules; |
|
33 | + $this->aAdded[ ] = $sCSSRules; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function get() { |
41 | 41 | |
42 | - $_sCSSRules = $this->_get() . PHP_EOL; |
|
42 | + $_sCSSRules = $this->_get().PHP_EOL; |
|
43 | 43 | $_sCSSRules .= $this->_getVersionSpecific(); |
44 | 44 | $_sCSSRules .= implode( PHP_EOL, $this->aAdded ); |
45 | 45 | return $_sCSSRules; |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | protected function _get() { |
24 | 24 | |
25 | - $_sSpinnerURL = esc_url( admin_url( '/images/wpspin_light-2x.gif' ) ); |
|
25 | + $_sSpinnerURL = esc_url( admin_url( '/images/wpspin_light-2x.gif' ) ); |
|
26 | 26 | return <<<CSSRULES |
27 | 27 | .admin-page-framework-form-warning { |
28 | 28 | font-size: 1em; |