@@ -391,6 +391,7 @@ |
||
391 | 391 | * This is used for element that `label_min_width` is applied. |
392 | 392 | * |
393 | 393 | * @since 3.8.0 |
394 | + * @param string $asClassAttributes |
|
394 | 395 | * @return string |
395 | 396 | */ |
396 | 397 | protected function getLabelContainerAttributes( array $aField, $asClassAttributes, array $aAttributes=array() ) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'after_label' => null, |
60 | 60 | 'before_field' => null, |
61 | 61 | 'after_field' => null, |
62 | - 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
62 | + 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
63 | 63 | 'before_fieldset' => null, // 3.1.1+ |
64 | 64 | 'after_fieldset' => null, // 3.1.1+ |
65 | 65 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param object $oMsg The framework message object. |
100 | 100 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
101 | 101 | */ |
102 | - public function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
102 | + public function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
103 | 103 | |
104 | 104 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) |
105 | 105 | ? $this->aFieldTypeSlugs |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
112 | 112 | if ( $bAutoRegister ) { |
113 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
113 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
114 | 114 | add_filter( |
115 | - 'field_types_' . $_sClassName, |
|
115 | + 'field_types_'.$_sClassName, |
|
116 | 116 | array( $this, '_replyToRegisterInputFieldType' ) |
117 | 117 | ); |
118 | 118 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | } |
159 | 159 | return is_array( $asLabel ) // if the user sets multiple items |
160 | 160 | ? $this->getElement( |
161 | - $asElement, // subject |
|
162 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
161 | + $asElement, // subject |
|
162 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
163 | 163 | '' // default - if the element is not found, return an empty |
164 | 164 | ) |
165 | 165 | : $asElement; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | protected function getFieldOutput( array $aFieldset ) { |
176 | 176 | |
177 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
177 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
178 | 178 | return ''; |
179 | 179 | } |
180 | 180 | |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
183 | 183 | |
184 | 184 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
185 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
185 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
186 | 186 | |
187 | 187 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
188 | - $aFieldset, // the field definition array |
|
189 | - $_oCallerForm->aSavedData, // the stored form data |
|
190 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | - $_oCallerForm->oMsg, // the system message object |
|
188 | + $aFieldset, // the field definition array |
|
189 | + $_oCallerForm->aSavedData, // the stored form data |
|
190 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | + $_oCallerForm->oMsg, // the system message object |
|
193 | 193 | $_oCallerForm->aCallbacks // field output element callables. |
194 | 194 | ); |
195 | 195 | return $_oFieldset->get(); |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | * @since 3.0.3 Tweaked it to have better execution speed. |
230 | 230 | * @internal |
231 | 231 | */ |
232 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
232 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
233 | 233 | |
234 | 234 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
235 | 235 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
236 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
237 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
238 | - : self::$_aDefaultKeys['attributes']; |
|
236 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
237 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
238 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
239 | 239 | |
240 | 240 | return array( |
241 | 241 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @since 3.0.0 |
274 | 274 | * @internal |
275 | 275 | */ |
276 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
276 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
277 | 277 | $this->_sFieldSetType = $sFieldSetType; |
278 | 278 | } |
279 | 279 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | wp_enqueue_script( 'media-upload' ); |
328 | 328 | } |
329 | 329 | |
330 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
331 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
330 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
331 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
344 | 344 | |
345 | 345 | // Replace the button label in the media thick box. |
346 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
346 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
347 | 347 | return $sTranslated; |
348 | 348 | } |
349 | 349 | if ( $sText !== 'Insert into Post' ) { |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | return $sTranslated; |
354 | 354 | } |
355 | 355 | |
356 | - if ( isset( $_GET['button_label'] ) ) { |
|
357 | - return $_GET['button_label']; |
|
356 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
357 | + return $_GET[ 'button_label' ]; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | return $this->oProp->sThickBoxButtonUseThis |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
375 | 375 | |
376 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
376 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
377 | 377 | return $aTabs; |
378 | 378 | } |
379 | 379 | |
380 | - if ( ! $_REQUEST[ 'enable_external_source' ] ) { |
|
380 | + if ( !$_REQUEST[ 'enable_external_source' ] ) { |
|
381 | 381 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
382 | 382 | } |
383 | 383 | return $aTabs; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * @since 3.8.0 |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes=array() ) { |
|
395 | + protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes = array() ) { |
|
396 | 396 | |
397 | 397 | $aAttributes[ 'class' ] = $this->getClassAttribute( $asClassAttributes, $this->getElement( $aAttributes, 'class' ) ); |
398 | 398 | $aAttributes[ 'style' ] = $this->getStyleAttribute( |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | wp_enqueue_script( 'thickbox' ); |
321 | 321 | wp_enqueue_style( 'thickbox' ); |
322 | 322 | |
323 | - if ( function_exists( 'wp_enqueue_media' ) ) { |
|
323 | + if ( function_exists( 'wp_enqueue_media' ) ) { |
|
324 | 324 | // If the WordPress version is 3.5 or above, |
325 | 325 | new AdminPageFramework_Form_View___Script_MediaUploader( $this->oMsg ); |
326 | 326 | } else { |
327 | 327 | wp_enqueue_script( 'media-upload' ); |
328 | 328 | } |
329 | 329 | |
330 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
330 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
331 | 331 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
332 | 332 | } |
333 | 333 | |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
344 | 344 | |
345 | 345 | // Replace the button label in the media thick box. |
346 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
346 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
347 | 347 | return $sTranslated; |
348 | 348 | } |
349 | - if ( $sText !== 'Insert into Post' ) { |
|
349 | + if ( $sText !== 'Insert into Post' ) { |
|
350 | 350 | return $sTranslated; |
351 | 351 | } |
352 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
352 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
353 | 353 | return $sTranslated; |
354 | 354 | } |
355 | 355 | |
356 | - if ( isset( $_GET['button_label'] ) ) { |
|
356 | + if ( isset( $_GET['button_label'] ) ) { |
|
357 | 357 | return $_GET['button_label']; |
358 | 358 | } |
359 | 359 |
@@ -183,6 +183,8 @@ |
||
183 | 183 | } |
184 | 184 | /** |
185 | 185 | * Trims a traling sub-string if exists. |
186 | + * @param string $sString |
|
187 | + * @param string $sSuffix |
|
186 | 188 | * @return string |
187 | 189 | * @since 3.7.2 |
188 | 190 | */ |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @since 3.8.4 When non-true value is passed, `0px` will be returned. |
37 | 37 | * @return string |
38 | 38 | */ |
39 | - static public function getLengthSanitized( $sLength, $sUnit='px' ) { |
|
39 | + static public function getLengthSanitized( $sLength, $sUnit='px' ) { |
|
40 | 40 | $sLength = $sLength ? $sLength : 0; |
41 | 41 | return is_numeric( $sLength ) |
42 | 42 | ? $sLength . $sUnit |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
92 | 92 | |
93 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
93 | + if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
94 | 94 | return $nDefault; |
95 | 95 | } |
96 | - if ( $nMin !== '' && $nToFix < $nMin ) { |
|
96 | + if ( $nMin !== '' && $nToFix < $nMin ) { |
|
97 | 97 | return $nMin; |
98 | 98 | } |
99 | - if ( $nMax !== '' && $nToFix > $nMax ) { |
|
99 | + if ( $nMax !== '' && $nToFix > $nMax ) { |
|
100 | 100 | return $nMax; |
101 | 101 | } |
102 | 102 | return $nToFix; |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * @since 3.8.4 When non-true value is passed, `0px` will be returned. |
37 | 37 | * @return string |
38 | 38 | */ |
39 | - static public function getLengthSanitized( $sLength, $sUnit='px' ) { |
|
39 | + static public function getLengthSanitized( $sLength, $sUnit = 'px' ) { |
|
40 | 40 | $sLength = $sLength ? $sLength : 0; |
41 | 41 | return is_numeric( $sLength ) |
42 | - ? $sLength . $sUnit |
|
42 | + ? $sLength.$sUnit |
|
43 | 43 | : $sLength; |
44 | 44 | } |
45 | 45 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * @since 3.8.11 Renamed from `fixNumber()`. |
82 | 82 | * @return string|integer A numeric value will be returned. |
83 | 83 | */ |
84 | - static public function getNumberFixed( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
84 | + static public function getNumberFixed( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
85 | 85 | |
86 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
86 | + if ( !is_numeric( trim( $nToFix ) ) ) { |
|
87 | 87 | return $nDefault; |
88 | 88 | } |
89 | 89 | if ( $nMin !== '' && $nToFix < $nMin ) { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return string|integer A numeric value will be returned. |
102 | 102 | * @deprecated 3.8.11 |
103 | 103 | */ |
104 | - static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
104 | + static public function fixNumber( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
105 | 105 | return self::getNumberFixed( $nToFix, $nDefault, $nMin, $nMax ); |
106 | 106 | } |
107 | 107 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | static public function getCSSMinified( $sCSSRules ) { |
116 | 116 | return str_replace( |
117 | - array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' '), // remove line breaks, tab, and white sspaces. |
|
117 | + array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), // remove line breaks, tab, and white sspaces. |
|
118 | 118 | '', |
119 | 119 | preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $sCSSRules ) // remove comments |
120 | 120 | ); |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | */ |
152 | 152 | static public function getNumberOfReadableSize( $nSize ) { |
153 | 153 | |
154 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
155 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
154 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
155 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
156 | 156 | case 'P': |
157 | 157 | $_nReturn *= 1024; |
158 | 158 | case 'T': |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $_nLog = log( $nBytes, 1024 ); |
179 | 179 | $_iPower = ( int ) $_nLog; |
180 | 180 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
181 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
181 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -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 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | static public function getDataAttributeArray( array $aArray ) { |
163 | 163 | |
164 | 164 | $_aNewArray = array(); |
165 | - foreach( $aArray as $sKey => $v ) { |
|
165 | + foreach ( $aArray as $sKey => $v ) { |
|
166 | 166 | if ( in_array( gettype( $v ), array( 'array', 'object' ) ) ) { |
167 | 167 | continue; |
168 | 168 | } |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function get() { |
61 | 61 | |
62 | - $this->aResources[ 'internal_scripts' ] = $this->_getUpdatedInternalItemsByCallback( |
|
62 | + $this->aResources[ 'internal_scripts' ] = $this->_getUpdatedInternalItemsByCallback( |
|
63 | 63 | $this->aResources[ 'internal_scripts' ], |
64 | 64 | 'hfGetScripts' |
65 | 65 | ); |
66 | - $this->aResources[ 'internal_styles' ] = $this->_getUpdatedInternalItemsByCallback( |
|
66 | + $this->aResources[ 'internal_styles' ] = $this->_getUpdatedInternalItemsByCallback( |
|
67 | 67 | $this->aResources[ 'internal_styles' ], |
68 | 68 | 'hfGetStyles' |
69 | 69 | ); |
70 | - $this->aResources[ 'internal_styles_ie' ] = $this->_getUpdatedInternalItemsByCallback( |
|
70 | + $this->aResources[ 'internal_styles_ie' ] = $this->_getUpdatedInternalItemsByCallback( |
|
71 | 71 | $this->aResources[ 'internal_styles_ie' ], |
72 | 72 | 'hfGetIEStyles' |
73 | 73 | ); |
74 | - $this->aResources[ 'src_styles' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
74 | + $this->aResources[ 'src_styles' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
75 | 75 | $this->aResources[ 'src_styles' ], |
76 | 76 | 'aEnqueueStyles' |
77 | 77 | ); |
78 | - $this->aResources[ 'src_scripts' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
78 | + $this->aResources[ 'src_scripts' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
79 | 79 | $this->aResources[ 'src_scripts' ], |
80 | 80 | 'aEnqueueScripts' |
81 | 81 | ); |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function _getUpdatedInternalItemsByCallback( array $aSubject, $sKey ) { |
91 | 91 | $_oCallable = $this->getElement( $this->aFieldTypeDefinition, $sKey ); |
92 | - if ( ! is_callable( $_oCallable ) ) { |
|
92 | + if ( !is_callable( $_oCallable ) ) { |
|
93 | 93 | return $aSubject; |
94 | 94 | } |
95 | - $aSubject[] = call_user_func_array( |
|
95 | + $aSubject[ ] = call_user_func_array( |
|
96 | 96 | $_oCallable, |
97 | 97 | array() |
98 | 98 | ); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | . ( $aField[ 'label' ] |
68 | 68 | ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
69 | 69 | . $aField[ 'label' ] |
70 | - . "</span>" |
|
70 | + . "</span>" |
|
71 | 71 | : "" |
72 | 72 | ) |
73 | 73 | . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
@@ -60,21 +60,21 @@ |
||
60 | 60 | protected function getField( $aField ) { |
61 | 61 | |
62 | 62 | return |
63 | - $aField['before_label'] |
|
63 | + $aField[ 'before_label' ] |
|
64 | 64 | . "<div class='admin-page-framework-input-label-container'>" |
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' ] ) . " />" |
|
74 | - . $aField['after_input'] |
|
73 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
74 | + . $aField[ 'after_input' ] |
|
75 | 75 | . "</label>" |
76 | 76 | . "</div>" |
77 | - . $aField['after_label']; |
|
77 | + . $aField[ 'after_label' ]; |
|
78 | 78 | |
79 | 79 | } |
80 | 80 |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | protected function getField( $aField ) { |
555 | 555 | |
556 | 556 | $_aOutput = array(); |
557 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
558 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
557 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
558 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
559 | 559 | $_sKey, |
560 | 560 | $_sLabel, |
561 | 561 | $aField |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | |
565 | 565 | // the repeatable field buttons will be replaced with this element. |
566 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
566 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
567 | 567 | return implode( '', $_aOutput ); |
568 | 568 | |
569 | 569 | } |
@@ -584,27 +584,27 @@ discard block |
||
584 | 584 | $aField[ 'rich' ] = $this->getElementByLabel( $aField[ 'rich' ], $sKey, $aField[ 'label' ] ); |
585 | 585 | $aField[ 'attributes' ] = $_bIsArray |
586 | 586 | ? array( |
587 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
588 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
587 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
588 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
589 | 589 | 'value' => $aField[ 'value' ], |
590 | 590 | ) |
591 | 591 | + $aField[ 'attributes' ] |
592 | 592 | : $aField[ 'attributes' ]; |
593 | - $_aOutput = array( |
|
594 | - $this->getElementByLabel( $aField['before_label'], $sKey, $aField[ 'label' ] ), |
|
593 | + $_aOutput = array( |
|
594 | + $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
|
595 | 595 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
596 | - "<label for='" . $aField[ 'attributes' ][ 'id' ] . "'>", |
|
597 | - $this->getElementByLabel( $aField['before_input'], $sKey, $aField[ 'label' ] ), |
|
596 | + "<label for='".$aField[ 'attributes' ][ 'id' ]."'>", |
|
597 | + $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
|
598 | 598 | $_sLabel |
599 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
599 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
600 | 600 | . $_sLabel |
601 | 601 | . "</span>" |
602 | 602 | : '', |
603 | 603 | $this->_getEditor( $aField ), |
604 | - $this->getElementByLabel( $aField['after_input'], $sKey, $aField[ 'label' ] ), |
|
604 | + $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
|
605 | 605 | "</label>", |
606 | 606 | "</div>", |
607 | - $this->getElementByLabel( $aField['after_label'], $sKey, $aField[ 'label' ] ), |
|
607 | + $this->getElementByLabel( $aField[ 'after_label' ], $sKey, $aField[ 'label' ] ), |
|
608 | 608 | ); |
609 | 609 | return implode( '', $_aOutput ); |
610 | 610 | |
@@ -619,31 +619,31 @@ discard block |
||
619 | 619 | */ |
620 | 620 | private function _getEditor( $aField ) { |
621 | 621 | |
622 | - unset( $aField['attributes']['value'] ); |
|
622 | + unset( $aField[ 'attributes' ][ 'value' ] ); |
|
623 | 623 | |
624 | 624 | // For no TinyMCE |
625 | - if ( empty( $aField['rich'] ) || ! $this->isTinyMCESupported() ) { |
|
626 | - return "<textarea " . $this->getAttributes( $aField['attributes'] ) . " >" // this method is defined in the base class |
|
627 | - . esc_textarea( $aField['value'] ) |
|
625 | + if ( empty( $aField[ 'rich' ] ) || !$this->isTinyMCESupported() ) { |
|
626 | + return "<textarea ".$this->getAttributes( $aField[ 'attributes' ] )." >" // this method is defined in the base class |
|
627 | + . esc_textarea( $aField[ 'value' ] ) |
|
628 | 628 | . "</textarea>"; |
629 | 629 | } |
630 | 630 | |
631 | 631 | // Rich editor |
632 | 632 | ob_start(); |
633 | 633 | wp_editor( |
634 | - $aField['value'], |
|
635 | - $aField['attributes']['id'], |
|
634 | + $aField[ 'value' ], |
|
635 | + $aField[ 'attributes' ][ 'id' ], |
|
636 | 636 | $this->uniteArrays( |
637 | - ( array ) $aField['rich'], |
|
637 | + ( array ) $aField[ 'rich' ], |
|
638 | 638 | array( |
639 | 639 | 'wpautop' => true, // use wpautop? |
640 | 640 | 'media_buttons' => true, // show insert/upload button(s) |
641 | - 'textarea_name' => $aField['attributes']['name'], |
|
642 | - 'textarea_rows' => $aField['attributes']['rows'], |
|
641 | + 'textarea_name' => $aField[ 'attributes' ][ 'name' ], |
|
642 | + 'textarea_rows' => $aField[ 'attributes' ][ 'rows' ], |
|
643 | 643 | 'tabindex' => '', |
644 | 644 | 'tabfocus_elements' => ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE |
645 | 645 | 'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped". |
646 | - 'editor_class' => $aField['attributes']['class'], // add extra class(es) to the editor textarea |
|
646 | + 'editor_class' => $aField[ 'attributes' ][ 'class' ], // add extra class(es) to the editor textarea |
|
647 | 647 | 'teeny' => false, // output the minimal editor config used in Press This |
648 | 648 | 'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css) |
649 | 649 | 'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array() |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | ob_end_clean(); |
656 | 656 | |
657 | 657 | return $_sContent |
658 | - . $this->_getScriptForRichEditor( $aField['attributes']['id'] ); |
|
658 | + . $this->_getScriptForRichEditor( $aField[ 'attributes' ][ 'id' ] ); |
|
659 | 659 | |
660 | 660 | } |
661 | 661 |
@@ -37,21 +37,21 @@ |
||
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 " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
42 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
43 | + . $aField[ 'before_input' ] |
|
44 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
45 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
46 | 46 | . $aField[ 'label' ] |
47 | 47 | . "</span>" |
48 | 48 | : "" |
49 | 49 | ) |
50 | - . $aField['value'] |
|
51 | - . $aField['after_input'] |
|
50 | + . $aField[ 'value' ] |
|
51 | + . $aField[ 'after_input' ] |
|
52 | 52 | . "</label>" |
53 | 53 | . "</div>" |
54 | - . $aField['after_label'] |
|
54 | + . $aField[ 'after_label' ] |
|
55 | 55 | ; |
56 | 56 | } |
57 | 57 |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function _appendInternalAssets( $sInternal, &$aContainer ) { |
70 | 70 | $_aInternals = array_unique( $aContainer ); |
71 | - $sInternal = PHP_EOL . $sInternal; |
|
72 | - foreach( $_aInternals as $_iIndex => $_sInternal ) { |
|
73 | - $sInternal .= $_sInternal . PHP_EOL; |
|
71 | + $sInternal = PHP_EOL.$sInternal; |
|
72 | + foreach ( $_aInternals as $_iIndex => $_sInternal ) { |
|
73 | + $sInternal .= $_sInternal.PHP_EOL; |
|
74 | 74 | unset( $_aInternals[ $_iIndex ] ); |
75 | 75 | } |
76 | 76 | $aContainer = $_aInternals; // update the container array. |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | private function _parseAssets( $oFactory ) { |
85 | 85 | |
86 | 86 | // page |
87 | - $_aPageStyles = $this->getElementAsArray( |
|
87 | + $_aPageStyles = $this->getElementAsArray( |
|
88 | 88 | $oFactory->oProp->aPages, |
89 | 89 | array( $this->sCurrentPageSlug, 'style' ) |
90 | 90 | ); |
91 | 91 | $this->_enqueuePageAssets( $_aPageStyles, 'style' ); |
92 | 92 | |
93 | - $_aPageScripts = $this->getElementAsArray( |
|
93 | + $_aPageScripts = $this->getElementAsArray( |
|
94 | 94 | $oFactory->oProp->aPages, |
95 | 95 | array( $this->sCurrentPageSlug, 'script' ) |
96 | 96 | ); |
97 | 97 | $this->_enqueuePageAssets( $_aPageScripts, 'script' ); |
98 | 98 | |
99 | 99 | // In-page tabs |
100 | - if ( ! $this->sCurrentTabSlug ) { |
|
100 | + if ( !$this->sCurrentTabSlug ) { |
|
101 | 101 | return; |
102 | 102 | } |
103 | - $_aInPageTabStyles = $this->getElementAsArray( |
|
103 | + $_aInPageTabStyles = $this->getElementAsArray( |
|
104 | 104 | $oFactory->oProp->aInPageTabs, |
105 | 105 | array( $this->sCurrentPageSlug, $this->sCurrentTabSlug, 'style' ) |
106 | 106 | ); |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @since 3.6.3 |
118 | 118 | * @return void |
119 | 119 | */ |
120 | - private function _enqueuePageAssets( array $aPageAssets, $sType='style' ) { |
|
121 | - $_sMathodName = "_enqueueAsset_" . $sType; |
|
122 | - foreach( $aPageAssets as $_asPageAsset ) { |
|
123 | - $this->{$_sMathodName}( $_asPageAsset); |
|
120 | + private function _enqueuePageAssets( array $aPageAssets, $sType = 'style' ) { |
|
121 | + $_sMathodName = "_enqueueAsset_".$sType; |
|
122 | + foreach ( $aPageAssets as $_asPageAsset ) { |
|
123 | + $this->{$_sMathodName}( $_asPageAsset ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | // Insert the CSS rule in the head tag. |
148 | - $this->aCSSRules[] = $_sSRC; |
|
148 | + $this->aCSSRules[ ] = $_sSRC; |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | // Insert the scripts in the head tag. |
173 | - $this->aScripts[] = $_sSRC; |
|
173 | + $this->aScripts[ ] = $_sSRC; |
|
174 | 174 | |
175 | 175 | } |
176 | 176 |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | static public function getRelativePath( $from, $to ) { |
30 | 30 | |
31 | 31 | // some compatibility fixes for Windows paths |
32 | - $from = is_dir( $from ) ? rtrim( $from, '\/') . '/' : $from; |
|
33 | - $to = is_dir( $to ) ? rtrim( $to, '\/') . '/' : $to; |
|
32 | + $from = is_dir( $from ) ? rtrim( $from, '\/' ).'/' : $from; |
|
33 | + $to = is_dir( $to ) ? rtrim( $to, '\/' ).'/' : $to; |
|
34 | 34 | $from = str_replace( '\\', '/', $from ); |
35 | 35 | $to = str_replace( '\\', '/', $to ); |
36 | 36 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | $to = explode( '/', $to ); |
39 | 39 | $relPath = $to; |
40 | 40 | |
41 | - foreach( $from as $depth => $dir ) { |
|
41 | + foreach ( $from as $depth => $dir ) { |
|
42 | 42 | // find first non-matching dir |
43 | - if( $dir === $to[ $depth ] ) { |
|
43 | + if ( $dir === $to[ $depth ] ) { |
|
44 | 44 | // ignore this directory |
45 | 45 | array_shift( $relPath ); |
46 | 46 | } else { |
47 | 47 | // get number of remaining dirs to $from |
48 | 48 | $remaining = count( $from ) - $depth; |
49 | - if( $remaining > 1 ) { |
|
49 | + if ( $remaining > 1 ) { |
|
50 | 50 | // add traversals up to first matching dir |
51 | 51 | $padLength = ( count( $relPath ) + $remaining - 1 ) * -1; |
52 | 52 | $relPath = array_pad( $relPath, $padLength, '..' ); |
53 | 53 | break; |
54 | 54 | } else { |
55 | - $relPath[ 0 ] = './' . $relPath[ 0 ]; |
|
55 | + $relPath[ 0 ] = './'.$relPath[ 0 ]; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 6, // the second parameter: limit |
82 | 82 | ) |
83 | 83 | ); |
84 | - foreach( $_aBackTrace as $_aDebugInfo ) { |
|
84 | + foreach ( $_aBackTrace as $_aDebugInfo ) { |
|
85 | 85 | $_sCallerFilePath = $_aDebugInfo[ 'file' ]; |
86 | 86 | if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
87 | 87 | continue; |
@@ -81,9 +81,9 @@ |
||
81 | 81 | 6, // the second parameter: limit |
82 | 82 | ) |
83 | 83 | ); |
84 | - foreach( $_aBackTrace as $_aDebugInfo ) { |
|
84 | + foreach( $_aBackTrace as $_aDebugInfo ) { |
|
85 | 85 | $_sCallerFilePath = $_aDebugInfo[ 'file' ]; |
86 | - if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
|
86 | + if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | break; // catch the first found item. |