@@ -248,7 +248,7 @@ |
||
248 | 248 | in_array( |
249 | 249 | substr( $_sIterationItem, strrpos( $_sIterationItem, '/' ) + 1 ), |
250 | 250 | array( '.', '..' ) |
251 | - ) |
|
251 | + ) |
|
252 | 252 | ) { |
253 | 253 | return; |
254 | 254 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 3.6.0 |
52 | 52 | */ |
53 | - public $aOptions = array( |
|
54 | - 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
53 | + public $aOptions = array( |
|
54 | + 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
55 | 55 | 'additional_source_directories' => array(), |
56 | 56 | // 'ignoring_file_extensions' => array(), // not implemented yet. |
57 | 57 | ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array|boolean $abOptions |
65 | 65 | * @param callable $aCallbacks |
66 | 66 | */ |
67 | - public function __construct( $sSource, $sDestination, $abOptions=false, array $aCallbacks=array() ) { |
|
67 | + public function __construct( $sSource, $sDestination, $abOptions = false, array $aCallbacks = array() ) { |
|
68 | 68 | |
69 | 69 | $this->sSource = $sSource; |
70 | 70 | $this->sDestination = $sDestination; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function compress() { |
97 | 97 | |
98 | 98 | // Check whether it is possible to perform the task. |
99 | - if ( ! $this->isFeasible( $this->sSource ) ) { |
|
99 | + if ( !$this->isFeasible( $this->sSource ) ) { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | $_oZip = new ZipArchive(); |
109 | - if ( ! $_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
109 | + if ( !$_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | 113 | $this->sSource = $this->_getSanitizedSourcePath( $this->sSource ); |
114 | 114 | // $this->sSource = str_replace( '\\', '/', realpath( $this->sSource ) ); |
115 | 115 | |
116 | - $_aMethods = array( |
|
116 | + $_aMethods = array( |
|
117 | 117 | 'unknown' => '_replyToReturnFalse', |
118 | 118 | 'directory' => '_replyToCompressDirectory', |
119 | 119 | 'file' => '_replyToCompressFile', |
120 | 120 | ); |
121 | - $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
121 | + $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
122 | 122 | return call_user_func_array( |
123 | 123 | array( $this, $_sMethodName ), |
124 | 124 | array( |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @since 3.6.0 Changed the name from `_compressDirectory`. Changed the scope to public to allow overriding the method in an extended class. |
145 | 145 | * @return boolean True on success, false otherwise. |
146 | 146 | */ |
147 | - public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks=array(), $bIncludeDir=false, array $aAdditionalSourceDirs=array() ) { |
|
147 | + public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks = array(), $bIncludeDir = false, array $aAdditionalSourceDirs = array() ) { |
|
148 | 148 | |
149 | 149 | $_sArchiveRootDirName = ''; |
150 | 150 | |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | * @since 3.6.0 |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName='' ) { |
|
177 | + private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName = '' ) { |
|
178 | 178 | |
179 | - $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ) . '/' : ''; |
|
179 | + $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ).'/' : ''; |
|
180 | 180 | |
181 | - foreach( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
181 | + foreach ( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
182 | 182 | |
183 | 183 | $_sSourceDirPath = $this->_getSanitizedSourcePath( $_sSourceDirPath ); |
184 | 184 | $_sInsideDirPrefix = is_integer( $_isIndexOrRelativeDirPath ) |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | : $_isIndexOrRelativeDirPath; |
187 | 187 | |
188 | 188 | // Add a directory inside the compressing directory. |
189 | - if( $_sInsideDirPrefix ) { |
|
189 | + if ( $_sInsideDirPrefix ) { |
|
190 | 190 | $this->_addRelativeDir( |
191 | 191 | $oZip, |
192 | 192 | $_sInsideDirPrefix, |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $_sSourceDirPath, |
205 | 205 | $_sIterationItem, |
206 | 206 | $aCallbacks, |
207 | - $sRootDirName . $_sInsideDirPrefix |
|
207 | + $sRootDirName.$_sInsideDirPrefix |
|
208 | 208 | ); |
209 | 209 | } |
210 | 210 | } |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | $sRelativeDirPath = str_replace( '\\', '/', $sRelativeDirPath ); |
219 | 219 | $_aPathPartsParse = array_filter( explode( '/', $sRelativeDirPath ) ); |
220 | 220 | $_aDirPath = array(); |
221 | - foreach( $_aPathPartsParse as $_sDirName ) { |
|
222 | - $_aDirPath[] = $_sDirName; |
|
221 | + foreach ( $_aPathPartsParse as $_sDirName ) { |
|
222 | + $_aDirPath[ ] = $_sDirName; |
|
223 | 223 | $this->_addEmptyDir( |
224 | 224 | $oZip, |
225 | 225 | implode( '/', $_aDirPath ), |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | * @param string $sInsidePathPrefix The prefix to add to the inside archive directory structure. |
239 | 239 | * @return void |
240 | 240 | */ |
241 | - private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix='' ) { |
|
241 | + private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix = '' ) { |
|
242 | 242 | |
243 | 243 | $_sIterationItem = str_replace( '\\', '/', $_sIterationItem ); |
244 | - $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ) . '/'; // add a trailing slash |
|
244 | + $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ).'/'; // add a trailing slash |
|
245 | 245 | |
246 | 246 | // Ignore "." and ".." folders |
247 | 247 | if ( |
@@ -259,18 +259,18 @@ discard block |
||
259 | 259 | if ( true === is_dir( $_sIterationItem ) ) { |
260 | 260 | $this->_addEmptyDir( |
261 | 261 | $oZip, |
262 | - $sInsidePathPrefix . str_replace( |
|
263 | - $sSource . '/', |
|
262 | + $sInsidePathPrefix.str_replace( |
|
263 | + $sSource.'/', |
|
264 | 264 | '', |
265 | - $_sIterationItem . '/' |
|
265 | + $_sIterationItem.'/' |
|
266 | 266 | ), |
267 | 267 | $aCallbacks[ 'directory_name' ] |
268 | 268 | ); |
269 | 269 | } else if ( true === is_file( $_sIterationItem ) ) { |
270 | 270 | $this->_addFromString( |
271 | 271 | $oZip, |
272 | - $sInsidePathPrefix . str_replace( |
|
273 | - $sSource . '/', |
|
272 | + $sInsidePathPrefix.str_replace( |
|
273 | + $sSource.'/', |
|
274 | 274 | '', |
275 | 275 | $_sIterationItem |
276 | 276 | ), |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * @since 3.6.0 Changed the name from `_compressFile`. Changed the scope from `private` to allow overriding in an extended class. |
299 | 299 | * @return boolean True on success, false otherwise. |
300 | 300 | */ |
301 | - public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks=null ) { |
|
301 | + public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks = null ) { |
|
302 | 302 | $this->_addFromString( |
303 | 303 | $oZip, |
304 | 304 | basename( $sSourceFilePath ), |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return boolean |
330 | 330 | */ |
331 | 331 | private function isFeasible( $sSource ) { |
332 | - if ( ! extension_loaded( 'zip' ) ) { |
|
332 | + if ( !extension_loaded( 'zip' ) ) { |
|
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | return file_exists( $sSource ); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | private function _addEmptyDir( ZipArchive $oZip, $sInsidePath, $oCallable ) { |
355 | 355 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $oCallable ); |
356 | - if ( ! strlen( $sInsidePath ) ) { |
|
356 | + if ( !strlen( $sInsidePath ) ) { |
|
357 | 357 | return; |
358 | 358 | } |
359 | 359 | $oZip->addEmptyDir( $sInsidePath ); |
@@ -365,10 +365,10 @@ discard block |
||
365 | 365 | * @remark If the path is empty, it will not process. |
366 | 366 | * @return void |
367 | 367 | */ |
368 | - private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents='', array $aCallbacks=array() ) { |
|
368 | + private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents = '', array $aCallbacks = array() ) { |
|
369 | 369 | |
370 | 370 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $aCallbacks[ 'file_name' ] ); |
371 | - if ( ! strlen( $sInsidePath ) ) { |
|
371 | + if ( !strlen( $sInsidePath ) ) { |
|
372 | 372 | return; |
373 | 373 | } |
374 | 374 | $oZip->addFromString( |
@@ -148,7 +148,7 @@ |
||
148 | 148 | |
149 | 149 | $_sArchiveRootDirName = ''; |
150 | 150 | |
151 | - if ( $bIncludeDir ) { |
|
151 | + if ( $bIncludeDir ) { |
|
152 | 152 | $_sArchiveRootDirName = $this->_getMainDirectoryName( $sSourceDirPath ); |
153 | 153 | $this->_addEmptyDir( |
154 | 154 | $oZip, |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Creates an object instance with dynamic parameters. |
44 | 44 | */ |
45 | - static public function getInstance( $sClassName, array $aParameters=array() ) { |
|
45 | + static public function getInstance( $sClassName, array $aParameters = array() ) { |
|
46 | 46 | |
47 | 47 | $_oReflection = new ReflectionClass( $sClassName ); |
48 | 48 | return $_oReflection->newInstanceArgs( $aParameters ); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // For PHP 5.2.x or below |
59 | 59 | if ( version_compare( phpversion(), '<', '5.3.0' ) ) { |
60 | 60 | trigger_error( |
61 | - 'Program Name' . ': ' |
|
61 | + 'Program Name'.': ' |
|
62 | 62 | . sprintf( |
63 | 63 | 'The method cannot run with your PHP version: %1$s', |
64 | 64 | phpversion() |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * Creates an object instance with dynamic parameters. |
46 | 46 | * |
47 | 47 | * @since 3.7.10 |
48 | - * @param string $sCalssName The class name for testing. |
|
48 | + * @param string $sClassName The class name for testing. |
|
49 | 49 | * @param array $aParameters The parameters to pass to the constructor of the class set in the first parameter. |
50 | 50 | * @return object An object instance of the class specified in the first parameter. |
51 | 51 | */ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @since 3.7.10 |
63 | 63 | * @param object $oClass The subject class object. |
64 | - * @param string $sMathodName The subject method name. |
|
64 | + * @param string $sMethodName The subject method name. |
|
65 | 65 | * @param array $aParameters The parameters to pass to the method set in the second parameter. |
66 | 66 | * @remark This supports private methods to be executed. |
67 | 67 | */ |
@@ -87,6 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | /** |
89 | 89 | * @since 3.7.10 |
90 | + * @param string $sClassName |
|
90 | 91 | * @return object |
91 | 92 | * @internal |
92 | 93 | */ |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
35 | 35 | |
36 | - if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
36 | + if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ); |
47 | 47 | |
48 | 48 | // Go to the catch clause. |
49 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
49 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
50 | 50 | $_oException->aReturn = $this->_confirmSubmitButtonAction( |
51 | 51 | $this->getElement( $aSubmitInformation, 'input_name' ), |
52 | 52 | $this->getElement( $aSubmitInformation, 'section_id' ), |
@@ -165,6 +165,7 @@ discard block |
||
165 | 165 | * Returns the HTML output of the number input part. |
166 | 166 | * |
167 | 167 | * @since 3.5.3 |
168 | + * @param boolean $bMultiLabels |
|
168 | 169 | * @return string The number input output. |
169 | 170 | */ |
170 | 171 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
@@ -217,6 +218,7 @@ discard block |
||
217 | 218 | * Returns the HTML output of the unit select input part. |
218 | 219 | * |
219 | 220 | * @since 3.5.3 |
221 | + * @param boolean $bMultiLabels |
|
220 | 222 | * @return string The unit select input output. |
221 | 223 | */ |
222 | 224 | private function _getUnitSelectInput( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * Defines the field type slugs used for this field type. |
67 | 67 | */ |
68 | - public $aFieldTypeSlugs = array( 'size', ); |
|
68 | + public $aFieldTypeSlugs = array( 'size',); |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Defines the default key-values of this field type. |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected $aDefaultKeys = array( |
76 | 76 | 'is_multiple' => false, // indicates whether the select tag alloes multiple selections. |
77 | - 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
77 | + 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
78 | 78 | 'attributes' => array( |
79 | 79 | 'size' => array( |
80 | 80 | 'min' => null, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected $aDefaultUnits = array( |
104 | 104 | 'px' => 'px', // pixel |
105 | - '%' => '%', // percentage |
|
105 | + '%' => '%', // percentage |
|
106 | 106 | 'em' => 'em', // font size |
107 | 107 | 'ex' => 'ex', // font height |
108 | 108 | 'in' => 'in', // inch |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | ); |
163 | 163 | |
164 | 164 | $_aOutput = array(); |
165 | - foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
166 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
165 | + foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
166 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
167 | 167 | $_isKey, |
168 | 168 | $_sLabel, |
169 | 169 | $aField |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | |
187 | 187 | $_aBaseAttributes = $_bMultiLabels |
188 | 188 | ? array( |
189 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]", |
|
190 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}", |
|
189 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]", |
|
190 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$isKey}", |
|
191 | 191 | 'value' => $aField[ 'value' ], |
192 | 192 | ) |
193 | 193 | + $aField[ 'attributes' ] |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | |
200 | 200 | $_aOutput = array( |
201 | 201 | $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ), |
202 | - "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ) . ">", |
|
203 | - $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
204 | - $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
202 | + "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ).">", |
|
203 | + $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
204 | + $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
205 | 205 | "</div>", |
206 | 206 | $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] ) |
207 | 207 | ); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
219 | 219 | |
220 | 220 | // Size and Size Label |
221 | - $_aSizeAttributes = $this->_getSizeAttributes( |
|
221 | + $_aSizeAttributes = $this->_getSizeAttributes( |
|
222 | 222 | $aField, |
223 | 223 | $aBaseAttributes, |
224 | 224 | $bMultiLabels |
@@ -226,32 +226,32 @@ discard block |
||
226 | 226 | : '' |
227 | 227 | ); |
228 | 228 | |
229 | - $_aSizeLabelAttributes = array( |
|
229 | + $_aSizeLabelAttributes = array( |
|
230 | 230 | 'for' => $_aSizeAttributes[ 'id' ], |
231 | 231 | 'class' => $_aSizeAttributes[ 'disabled' ] |
232 | 232 | ? 'disabled' |
233 | 233 | : null, |
234 | 234 | ); |
235 | 235 | |
236 | - $_sLabel = $this->getElementByLabel( |
|
236 | + $_sLabel = $this->getElementByLabel( |
|
237 | 237 | $aField[ 'label' ], |
238 | 238 | $isKey, |
239 | 239 | $aField[ 'label' ] |
240 | 240 | ); |
241 | - return "<label " . $this->getAttributes( $_aSizeLabelAttributes ) . ">" |
|
241 | + return "<label ".$this->getAttributes( $_aSizeLabelAttributes ).">" |
|
242 | 242 | . $this->getElement( |
243 | 243 | $aField, |
244 | 244 | $bMultiLabels |
245 | 245 | ? array( 'before_label', $isKey, 'size' ) |
246 | 246 | : array( 'before_label', 'size' ) |
247 | 247 | ) |
248 | - . ( $aField[ 'label' ] && ! $aField[ 'repeatable' ] |
|
249 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
248 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
249 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
250 | 250 | . $_sLabel |
251 | 251 | . "</span>" |
252 | 252 | : "" |
253 | 253 | ) |
254 | - . "<input " . $this->getAttributes( $_aSizeAttributes ) . " />" |
|
254 | + . "<input ".$this->getAttributes( $_aSizeAttributes )." />" |
|
255 | 255 | . $this->getElement( |
256 | 256 | $aField, |
257 | 257 | $bMultiLabels |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ) |
295 | 295 | : $aField[ 'units' ]; |
296 | 296 | |
297 | - return "<label " . $this->getAttributes( |
|
297 | + return "<label ".$this->getAttributes( |
|
298 | 298 | array( |
299 | 299 | 'for' => $_aUnitAttributes[ 'id' ], |
300 | 300 | 'class' => $_aUnitAttributes[ 'disabled' ] |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | * @return array an unit attribute array |
327 | 327 | * @internal |
328 | 328 | */ |
329 | - private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey='' ) { |
|
329 | + private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey = '' ) { |
|
330 | 330 | |
331 | - $_bIsMultiple = $aField[ 'is_multiple' ] |
|
331 | + $_bIsMultiple = $aField[ 'is_multiple' ] |
|
332 | 332 | ? true |
333 | 333 | : $this->getElement( |
334 | 334 | $aField, |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | |
341 | 341 | $_aSelectAttributes = array( |
342 | 342 | 'type' => 'select', |
343 | - 'id' => $aField[ 'input_id' ] . ( '' === $isLabelKey ? '' : '_' . $isLabelKey ) . '_' . 'unit', |
|
343 | + 'id' => $aField[ 'input_id' ].( '' === $isLabelKey ? '' : '_'.$isLabelKey ).'_'.'unit', |
|
344 | 344 | 'multiple' => $_bIsMultiple |
345 | 345 | ? 'multiple' |
346 | 346 | : null, |
347 | 347 | 'name' => $_bIsMultiple |
348 | - ? "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit][]" |
|
349 | - : "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit]", |
|
348 | + ? "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit][]" |
|
349 | + : "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit]", |
|
350 | 350 | 'value' => $this->getElement( |
351 | 351 | $aField, |
352 | 352 | array( 'value', 'unit' ), |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | '' === $isLabelKey |
359 | 359 | ? array( 'attributes', 'unit' ) |
360 | 360 | : array( 'attributes', $isLabelKey, 'unit' ), |
361 | - $this->aDefaultKeys['attributes']['unit'] |
|
361 | + $this->aDefaultKeys[ 'attributes' ][ 'unit' ] |
|
362 | 362 | ) |
363 | 363 | + $aBaseAttributes; |
364 | 364 | return $_aSelectAttributes; |
@@ -372,15 +372,15 @@ discard block |
||
372 | 372 | * @return array an size attribute array |
373 | 373 | * @internal |
374 | 374 | */ |
375 | - private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey='' ) { |
|
375 | + private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey = '' ) { |
|
376 | 376 | |
377 | 377 | return array( |
378 | 378 | 'type' => 'number', |
379 | - 'id' => $aField['input_id'] . '_' . ( '' !== $sLabelKey ? $sLabelKey . '_' : '' ) . 'size', |
|
380 | - 'name' => $aField[ '_input_name' ] . ( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ) . '[size]', |
|
379 | + 'id' => $aField[ 'input_id' ].'_'.( '' !== $sLabelKey ? $sLabelKey.'_' : '' ).'size', |
|
380 | + 'name' => $aField[ '_input_name' ].( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ).'[size]', |
|
381 | 381 | 'value' => $this->getElement( |
382 | - $aField, // subject |
|
383 | - array( 'value', 'size' ), // dimensional keys |
|
382 | + $aField, // subject |
|
383 | + array( 'value', 'size' ), // dimensional keys |
|
384 | 384 | '' // default |
385 | 385 | ), |
386 | 386 | ) |
@@ -124,7 +124,7 @@ |
||
124 | 124 | foreach( $this->aFieldsets as $_sSecitonID => $_aFieldsets ) { |
125 | 125 | |
126 | 126 | $_bIsSubSectionLoaded = false; |
127 | - foreach( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
127 | + foreach( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
128 | 128 | // @todo Examine if this structure is correct or not. |
129 | 129 | // It may not be necessary to check the sub-section dimensions as this is not the saved options array. |
130 | 130 | // if it's a sub-section |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | 'AdminPageFramework_Form_View___CSS_FieldError', |
91 | 91 | 'AdminPageFramework_Form_View___CSS_ToolTip', |
92 | 92 | ); |
93 | - foreach( $_aClassNames as $_sClassName ) { |
|
93 | + foreach ( $_aClassNames as $_sClassName ) { |
|
94 | 94 | $_oCSS = new $_sClassName; |
95 | - $this->aResources[ 'internal_styles' ][] = $_oCSS->get(); |
|
95 | + $this->aResources[ 'internal_styles' ][ ] = $_oCSS->get(); |
|
96 | 96 | } |
97 | 97 | $_aClassNamesForIE = array( |
98 | 98 | 'AdminPageFramework_Form_View___CSS_CollapsibleSectionIE', |
99 | 99 | ); |
100 | - foreach( $_aClassNames as $_sClassName ) { |
|
100 | + foreach ( $_aClassNames as $_sClassName ) { |
|
101 | 101 | $_oCSS = new $_sClassName; |
102 | - $this->aResources[ 'internal_styles_ie' ][] = $_oCSS->get(); |
|
102 | + $this->aResources[ 'internal_styles_ie' ][ ] = $_oCSS->get(); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return void |
118 | 118 | */ |
119 | 119 | private function ___set( $aAllFieldsets ) { |
120 | - foreach( $aAllFieldsets as $_sSecitonID => $_aFieldsets ) { |
|
120 | + foreach ( $aAllFieldsets as $_sSecitonID => $_aFieldsets ) { |
|
121 | 121 | $this->___setFieldResourcesBySection( $_aFieldsets ); |
122 | 122 | } |
123 | 123 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | private function ___setFieldResourcesBySection( $_aFieldsets ) { |
130 | 130 | |
131 | 131 | $_bIsSubSectionLoaded = false; |
132 | - foreach( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
132 | + foreach ( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
133 | 133 | // @todo Examine if this structure is correct or not. |
134 | 134 | // It may not be necessary to check the sub-section dimensions as this is not the saved options array. |
135 | 135 | // if it's a sub-section |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | continue; |
141 | 141 | } |
142 | 142 | $_bIsSubSectionLoaded = true; |
143 | - foreach( $_aSubSectionOrField as $_aField ) { |
|
143 | + foreach ( $_aSubSectionOrField as $_aField ) { |
|
144 | 144 | $this->___setFieldResources( $_aField ); |
145 | 145 | } |
146 | 146 | continue; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | private function ___setFieldResources( $aFieldset ) { |
166 | 166 | |
167 | 167 | // Check the field conditions. |
168 | - if ( ! $this->___isFieldsetAllowed( $aFieldset ) ) { |
|
168 | + if ( !$this->___isFieldsetAllowed( $aFieldset ) ) { |
|
169 | 169 | return; |
170 | 170 | } |
171 | 171 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | return $this->callBack( |
197 | 197 | $this->aCallbacks[ 'is_fieldset_registration_allowed' ], |
198 | 198 | array( |
199 | - true, // 1st parameter |
|
199 | + true, // 1st parameter |
|
200 | 200 | $aFieldset, // 2nd parameter |
201 | 201 | ) |
202 | 202 | ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | private function ___setResourcesOfNestedFields( $aFieldset ) { |
210 | 210 | |
211 | - if ( ! $this->hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
211 | + if ( !$this->hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | foreach ( $aFieldset[ 'content' ] as $_asNestedFieldset ) { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $this->callBack( |
249 | 249 | $this->aCallbacks[ 'load_fieldset_resource' ], |
250 | 250 | array( |
251 | - $aFieldset, // 1st parameter |
|
251 | + $aFieldset, // 1st parameter |
|
252 | 252 | ) |
253 | 253 | ); |
254 | 254 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // Be careful not to add duplicate items as currently the sub-field items are parsed. |
257 | 257 | |
258 | 258 | // Is already registered? |
259 | - if ( $this->hasBeenCalled( 'registered_' . $_sFieldtype . '_' . $this->aArguments[ 'structure_type' ] ) ) { |
|
259 | + if ( $this->hasBeenCalled( 'registered_'.$_sFieldtype.'_'.$this->aArguments[ 'structure_type' ] ) ) { |
|
260 | 260 | return; |
261 | 261 | } |
262 | 262 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $_aFieldTypeDefinition, |
272 | 272 | $this->aResources |
273 | 273 | ); |
274 | - $this->aResources = $_oFieldTypeResources->get(); |
|
274 | + $this->aResources = $_oFieldTypeResources->get(); |
|
275 | 275 | |
276 | 276 | } |
277 | 277 |
@@ -39,16 +39,16 @@ |
||
39 | 39 | * @since 3.7.4 Changed the default capability value to `read`. |
40 | 40 | * @todo Examine the appropriate default capability level. |
41 | 41 | */ |
42 | - public function __construct( $sCapability='read', $sTextDomain='admin-page-framework' ) { |
|
42 | + public function __construct( $sCapability = 'read', $sTextDomain = 'admin-page-framework' ) { |
|
43 | 43 | |
44 | 44 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
45 | 45 | ? $this->aSubClassNames[ 'oProp' ] |
46 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
46 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
47 | 47 | $this->oProp = new $_sProprtyClassName( |
48 | - $this, // the caller object |
|
49 | - get_class( $this ), // the caller class name |
|
50 | - $sCapability, // the capability level |
|
51 | - $sTextDomain, // the text domain |
|
48 | + $this, // the caller object |
|
49 | + get_class( $this ), // the caller class name |
|
50 | + $sCapability, // the capability level |
|
51 | + $sTextDomain, // the text domain |
|
52 | 52 | $this->_sStructureType // the structure type |
53 | 53 | ); |
54 | 54 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'media', ); |
|
24 | + public $aFieldTypeSlugs = array( 'media',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return |
54 | 54 | $this->_getScript_MediaUploader( |
55 | 55 | "admin_page_framework" |
56 | - ) . PHP_EOL |
|
56 | + ).PHP_EOL |
|
57 | 57 | . $this->_getScript_RegisterCallbacks(); |
58 | 58 | } |
59 | 59 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
149 | 149 | |
150 | 150 | // If the WordPress version is 3.4.x or below |
151 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
151 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
152 | 152 | return <<<JAVASCRIPTS |
153 | 153 | /** |
154 | 154 | * Bind/rebinds the thickbox script the given selector element. |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
389 | 389 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
390 | 390 | // which causes the PHP syntax error. |
391 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ) . '"'; |
|
392 | - $_sRpeatable = $this->getAOrB( ! empty( $abRepeatable ), 'true', 'false' ); |
|
391 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ).'"'; |
|
392 | + $_sRpeatable = $this->getAOrB( !empty( $abRepeatable ), 'true', 'false' ); |
|
393 | 393 | $_sExternalSource = $this->getAOrB( $bExternalSource, 'true', 'false' ); |
394 | - $_sScript = <<<JAVASCRIPTS |
|
394 | + $_sScript = <<<JAVASCRIPTS |
|
395 | 395 | if ( jQuery( 'a#select_media_{$sInputID}' ).length == 0 ) { |
396 | 396 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
397 | 397 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | . '/* <![CDATA[ */' |
405 | 405 | . $_sScript |
406 | 406 | . '/* ]]> */' |
407 | - . "</script>". PHP_EOL; |
|
407 | + . "</script>".PHP_EOL; |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | /** |
@@ -414,19 +414,19 @@ discard block |
||
414 | 414 | */ |
415 | 415 | private function _getUploaderButtonHTML_Media( $sInputID, array $aButtonAttributes, $bExternalSource ) { |
416 | 416 | |
417 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
417 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
418 | 418 | $_aAttributes = $this->_getFormattedUploadButtonAttributes_Media( |
419 | 419 | $sInputID, |
420 | 420 | $aButtonAttributes, |
421 | 421 | $_bIsLabelSet, |
422 | 422 | $bExternalSource |
423 | 423 | ); |
424 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
424 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
425 | 425 | . $this->getAOrB( |
426 | 426 | $_bIsLabelSet, |
427 | - $_aAttributes['data-label'], |
|
427 | + $_aAttributes[ 'data-label' ], |
|
428 | 428 | $this->getAOrB( |
429 | - strrpos( $_aAttributes['class'], 'dashicons' ), |
|
429 | + strrpos( $_aAttributes[ 'class' ], 'dashicons' ), |
|
430 | 430 | '', |
431 | 431 | $this->oMsg->get( 'select_file' ) |
432 | 432 | ) |
@@ -441,26 +441,26 @@ discard block |
||
441 | 441 | */ |
442 | 442 | private function _getFormattedUploadButtonAttributes_Media( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bExternalSource ) { |
443 | 443 | |
444 | - $_aAttributes = array( |
|
444 | + $_aAttributes = array( |
|
445 | 445 | 'id' => "select_media_{$sInputID}", |
446 | 446 | 'href' => '#', |
447 | - 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
448 | - 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
447 | + 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
448 | + 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
449 | 449 | ) |
450 | 450 | + $aButtonAttributes |
451 | 451 | + array( |
452 | 452 | 'title' => $_bIsLabelSet |
453 | - ? $aButtonAttributes['data-label'] |
|
453 | + ? $aButtonAttributes[ 'data-label' ] |
|
454 | 454 | : $this->oMsg->get( 'select_file' ), |
455 | 455 | 'data-label' => null, |
456 | 456 | ); |
457 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
457 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
458 | 458 | 'select_media button button-small ', |
459 | 459 | $this->getAOrB( |
460 | - trim( $aButtonAttributes['class'] ), |
|
461 | - $aButtonAttributes['class'], |
|
460 | + trim( $aButtonAttributes[ 'class' ] ), |
|
461 | + $aButtonAttributes[ 'class' ], |
|
462 | 462 | $this->getAOrB( |
463 | - ! $_bIsLabelSet && version_compare( $GLOBALS['wp_version'], '3.8', '>=' ), |
|
463 | + !$_bIsLabelSet && version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ), |
|
464 | 464 | 'dashicons dashicons-portfolio', |
465 | 465 | '' |
466 | 466 | ) |