@@ -21,6 +21,6 @@ |
||
21 | 21 | * @extends AdminPageFramework_Form |
22 | 22 | * @internal |
23 | 23 | */ |
24 | -class AdminPageFramework_Form_post_type extends AdminPageFramework_Form { |
|
24 | +class AdminPageFramework_Form_post_type extends AdminPageFramework_Form { |
|
25 | 25 | public $sStructureType = 'post_type'; |
26 | 26 | } |
@@ -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 | } |
@@ -278,7 +278,7 @@ |
||
278 | 278 | ? "<strong>" . $this->_sScriptName . "</strong>: " |
279 | 279 | : ''; |
280 | 280 | return $_sScripTitle |
281 | - . implode( '<br />', $_aWarnings ); |
|
281 | + . implode( '<br />', $_aWarnings ); |
|
282 | 282 | |
283 | 283 | } |
284 | 284 |
@@ -100,7 +100,7 @@ |
||
100 | 100 | * @since 3.4.6 |
101 | 101 | * @return integer The number of warnings. |
102 | 102 | */ |
103 | - public function check() { |
|
103 | + public function check() { |
|
104 | 104 | |
105 | 105 | $_aWarnings = array(); |
106 | 106 |
@@ -195,6 +195,7 @@ discard block |
||
195 | 195 | * Returns a php warning if present. |
196 | 196 | * @since 3.5.3 |
197 | 197 | * @internal |
198 | + * @param string $sType |
|
198 | 199 | * @return string The warning. |
199 | 200 | */ |
200 | 201 | private function _getWarningByType( $sType ) { |
@@ -294,6 +295,7 @@ discard block |
||
294 | 295 | * if it returns non true (false), it stores the subject warning and returns the array holding the warnings. |
295 | 296 | * |
296 | 297 | * @since 3.4.6 |
298 | + * @param string $sFuncName |
|
297 | 299 | * @return array The warning array. |
298 | 300 | * @internal |
299 | 301 | */ |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | * </ul> |
136 | 136 | * @param string $sScriptName The script name. |
137 | 137 | */ |
138 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
138 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
139 | 139 | |
140 | 140 | // Avoid undefined index warnings. |
141 | 141 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
142 | 142 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
143 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
143 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
144 | 144 | if ( isset( $aRequirements[ $_sName ] ) ) { |
145 | 145 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
146 | 146 | } |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $_aWarnings = array(); |
166 | 166 | |
167 | 167 | // PHP, WordPress, MySQL |
168 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
169 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
170 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
168 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
169 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
170 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
171 | 171 | |
172 | 172 | // Ensure necessary array elements. |
173 | 173 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | // Check the rest. |
181 | 181 | $_aWarnings = array_merge( |
182 | 182 | $_aWarnings, |
183 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
184 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
185 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
186 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
183 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
184 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
185 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
186 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return string The warning. |
198 | 198 | */ |
199 | 199 | private function _getWarningByType( $sType ) { |
200 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
200 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
201 | 201 | return ''; |
202 | 202 | } |
203 | 203 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @internal |
227 | 227 | */ |
228 | 228 | private function _checkWordPressVersion( $sWordPressVersion ) { |
229 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
229 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | */ |
299 | 299 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
300 | 300 | $_aWarnings = array(); |
301 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
302 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
303 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
301 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
302 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
303 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | return $_aWarnings; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function _replyToPrintAdminNotices() { |
324 | 324 | |
325 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
325 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
326 | 326 | if ( empty( $_aWarnings ) ) { |
327 | 327 | return; |
328 | 328 | } |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | */ |
342 | 342 | private function _getWarnings() { |
343 | 343 | |
344 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
344 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
345 | 345 | if ( empty( $_aWarnings ) ) { |
346 | 346 | return ''; |
347 | 347 | } |
348 | - $_sScripTitle = $this->_sScriptName |
|
349 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
348 | + $_sScripTitle = $this->_sScriptName |
|
349 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
350 | 350 | : ''; |
351 | 351 | return $_sScripTitle |
352 | 352 | . implode( '<br />', $_aWarnings ); |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | * @param boolean $bIsOnActivation Whether it is called upon plugin activation hook. |
362 | 362 | * @return void |
363 | 363 | */ |
364 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
364 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
365 | 365 | |
366 | 366 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
367 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
368 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
369 | - if ( ! @include( ABSPATH . '/wp-admin/includes/plugin.php' ) ) { |
|
367 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
368 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
369 | + if ( !@include( ABSPATH.'/wp-admin/includes/plugin.php' ) ) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | // Before that, we can display messages to the user. |
377 | 377 | if ( $bIsOnActivation ) { |
378 | 378 | |
379 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
380 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
379 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
380 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
381 | 381 | |
382 | 382 | } |
383 | 383 |
@@ -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 | } |
@@ -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, |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @since 3.6.0 |
57 | 57 | */ |
58 | - public $aOptions = array( |
|
59 | - 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
58 | + public $aOptions = array( |
|
59 | + 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
60 | 60 | 'additional_source_directories' => array(), |
61 | 61 | // 'ignoring_file_extensions' => array(), // not implemented yet. |
62 | 62 | ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array|boolean $abOptions |
71 | 71 | * @param callable $aCallbacks |
72 | 72 | */ |
73 | - public function __construct( $sSource, $sDestination, $abOptions=false, array $aCallbacks=array() ) { |
|
73 | + public function __construct( $sSource, $sDestination, $abOptions = false, array $aCallbacks = array() ) { |
|
74 | 74 | |
75 | 75 | $this->sSource = $sSource; |
76 | 76 | $this->sDestination = $sDestination; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function compress() { |
104 | 104 | |
105 | 105 | // Check whether it is possible to perform the task. |
106 | - if ( ! $this->isFeasible( $this->sSource ) ) { |
|
106 | + if ( !$this->isFeasible( $this->sSource ) ) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | $_oZip = new ZipArchive(); |
116 | - if ( ! $_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
116 | + if ( !$_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
117 | 117 | return false; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->sSource = $this->_getSanitizedSourcePath( $this->sSource ); |
121 | 121 | // $this->sSource = str_replace( '\\', '/', realpath( $this->sSource ) ); |
122 | 122 | |
123 | - $_aMethods = array( |
|
123 | + $_aMethods = array( |
|
124 | 124 | 'unknown' => '_replyToReturnFalse', |
125 | 125 | 'directory' => '_replyToCompressDirectory', |
126 | 126 | 'file' => '_replyToCompressFile', |
127 | 127 | ); |
128 | - $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
128 | + $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
129 | 129 | return call_user_func_array( |
130 | 130 | array( $this, $_sMethodName ), |
131 | 131 | array( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return boolean True on success, false otherwise. |
154 | 154 | * @internal |
155 | 155 | */ |
156 | - public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks=array(), $bIncludeDir=false, array $aAdditionalSourceDirs=array() ) { |
|
156 | + public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks = array(), $bIncludeDir = false, array $aAdditionalSourceDirs = array() ) { |
|
157 | 157 | |
158 | 158 | $_sArchiveRootDirName = ''; |
159 | 159 | |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @return void |
185 | 185 | * @internal |
186 | 186 | */ |
187 | - private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName='' ) { |
|
187 | + private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName = '' ) { |
|
188 | 188 | |
189 | - $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ) . '/' : ''; |
|
189 | + $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ).'/' : ''; |
|
190 | 190 | |
191 | - foreach( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
191 | + foreach ( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
192 | 192 | |
193 | 193 | $_sSourceDirPath = $this->_getSanitizedSourcePath( $_sSourceDirPath ); |
194 | 194 | $_sInsideDirPrefix = is_integer( $_isIndexOrRelativeDirPath ) |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | : $_isIndexOrRelativeDirPath; |
197 | 197 | |
198 | 198 | // Add a directory inside the compressing directory. |
199 | - if( $_sInsideDirPrefix ) { |
|
199 | + if ( $_sInsideDirPrefix ) { |
|
200 | 200 | $this->_addRelativeDir( |
201 | 201 | $oZip, |
202 | 202 | $_sInsideDirPrefix, |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $_sSourceDirPath, |
215 | 215 | $_sIterationItem, |
216 | 216 | $aCallbacks, |
217 | - $sRootDirName . $_sInsideDirPrefix |
|
217 | + $sRootDirName.$_sInsideDirPrefix |
|
218 | 218 | ); |
219 | 219 | } |
220 | 220 | } |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | $sRelativeDirPath = str_replace( '\\', '/', $sRelativeDirPath ); |
230 | 230 | $_aPathPartsParse = array_filter( explode( '/', $sRelativeDirPath ) ); |
231 | 231 | $_aDirPath = array(); |
232 | - foreach( $_aPathPartsParse as $_sDirName ) { |
|
233 | - $_aDirPath[] = $_sDirName; |
|
232 | + foreach ( $_aPathPartsParse as $_sDirName ) { |
|
233 | + $_aDirPath[ ] = $_sDirName; |
|
234 | 234 | $this->_addEmptyDir( |
235 | 235 | $oZip, |
236 | 236 | implode( '/', $_aDirPath ), |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * @return void |
251 | 251 | * @internal |
252 | 252 | */ |
253 | - private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix='' ) { |
|
253 | + private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix = '' ) { |
|
254 | 254 | |
255 | 255 | $_sIterationItem = str_replace( '\\', '/', $_sIterationItem ); |
256 | - $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ) . '/'; // add a trailing slash |
|
256 | + $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ).'/'; // add a trailing slash |
|
257 | 257 | |
258 | 258 | // Ignore "." and ".." folders |
259 | 259 | if ( |
@@ -271,18 +271,18 @@ discard block |
||
271 | 271 | if ( true === is_dir( $_sIterationItem ) ) { |
272 | 272 | $this->_addEmptyDir( |
273 | 273 | $oZip, |
274 | - $sInsidePathPrefix . str_replace( |
|
275 | - $sSource . '/', |
|
274 | + $sInsidePathPrefix.str_replace( |
|
275 | + $sSource.'/', |
|
276 | 276 | '', |
277 | - $_sIterationItem . '/' |
|
277 | + $_sIterationItem.'/' |
|
278 | 278 | ), |
279 | 279 | $aCallbacks[ 'directory_name' ] |
280 | 280 | ); |
281 | 281 | } else if ( true === is_file( $_sIterationItem ) ) { |
282 | 282 | $this->_addFromString( |
283 | 283 | $oZip, |
284 | - $sInsidePathPrefix . str_replace( |
|
285 | - $sSource . '/', |
|
284 | + $sInsidePathPrefix.str_replace( |
|
285 | + $sSource.'/', |
|
286 | 286 | '', |
287 | 287 | $_sIterationItem |
288 | 288 | ), |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return boolean True on success, false otherwise. |
313 | 313 | * @internal |
314 | 314 | */ |
315 | - public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks=null ) { |
|
315 | + public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks = null ) { |
|
316 | 316 | $this->_addFromString( |
317 | 317 | $oZip, |
318 | 318 | basename( $sSourceFilePath ), |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @internal |
346 | 346 | */ |
347 | 347 | private function isFeasible( $sSource ) { |
348 | - if ( ! extension_loaded( 'zip' ) ) { |
|
348 | + if ( !extension_loaded( 'zip' ) ) { |
|
349 | 349 | return false; |
350 | 350 | } |
351 | 351 | return file_exists( $sSource ); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | private function _addEmptyDir( ZipArchive $oZip, $sInsidePath, $oCallable ) { |
373 | 373 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $oCallable ); |
374 | - if ( ! strlen( $sInsidePath ) ) { |
|
374 | + if ( !strlen( $sInsidePath ) ) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | 377 | $oZip->addEmptyDir( ltrim( $sInsidePath, '/' ) ); |
@@ -384,10 +384,10 @@ discard block |
||
384 | 384 | * @return void |
385 | 385 | * @internal |
386 | 386 | */ |
387 | - private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents='', array $aCallbacks=array() ) { |
|
387 | + private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents = '', array $aCallbacks = array() ) { |
|
388 | 388 | |
389 | 389 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $aCallbacks[ 'file_name' ] ); |
390 | - if ( ! strlen( $sInsidePath ) ) { |
|
390 | + if ( !strlen( $sInsidePath ) ) { |
|
391 | 391 | return; |
392 | 392 | } |
393 | 393 | $oZip->addFromString( |
@@ -77,21 +77,21 @@ |
||
77 | 77 | * @param string $sPriority The priority, either `high`, `core`, `default` or `low`. |
78 | 78 | * @param string $sCapability The capability. See <a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Roles and Capabilities</a>. |
79 | 79 | */ |
80 | - public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs=array(), $sContext='normal', $sPriority='default', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
80 | + public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs = array(), $sContext = 'normal', $sPriority = 'default', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
81 | 81 | |
82 | 82 | if ( empty( $asPageSlugs ) ) { |
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - if ( ! $this->_isInstantiatable() ) { |
|
86 | + if ( !$this->_isInstantiatable() ) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // The property object needs to be done first before the parent constructor. |
91 | 91 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
92 | 92 | ? $this->aSubClassNames[ 'oProp' ] |
93 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
94 | - $this->oProp = new $_sProprtyClassName( |
|
93 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
94 | + $this->oProp = new $_sProprtyClassName( |
|
95 | 95 | $this, |
96 | 96 | get_class( $this ), |
97 | 97 | $sCapability, |
@@ -78,11 +78,11 @@ |
||
78 | 78 | */ |
79 | 79 | public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs=array(), $sContext='normal', $sPriority='default', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
80 | 80 | |
81 | - if ( empty( $asPageSlugs ) ) { |
|
81 | + if ( empty( $asPageSlugs ) ) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - if ( ! $this->_isInstantiatable() ) { |
|
85 | + if ( ! $this->_isInstantiatable() ) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string The text domain. Default: `admin-page-framework`. |
47 | 47 | * @return void |
48 | 48 | */ |
49 | - function __construct( $asTaxonomySlug, $sOptionKey='', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
49 | + function __construct( $asTaxonomySlug, $sOptionKey = '', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
50 | 50 | |
51 | 51 | if ( empty( $asTaxonomySlug ) ) { |
52 | 52 | return; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // Properties |
56 | 56 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
57 | 57 | ? $this->aSubClassNames[ 'oProp' ] |
58 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
58 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
59 | 59 | $this->oProp = new $_sProprtyClassName( |
60 | 60 | $this, |
61 | 61 | get_class( $this ), |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | function __construct( $asTaxonomySlug, $sOptionKey='', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
49 | 49 | |
50 | - if ( empty( $asTaxonomySlug ) ) { |
|
50 | + if ( empty( $asTaxonomySlug ) ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 |
@@ -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 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - public function __construct( $sWidgetTitle, $aWidgetArguments=array(), $sCapability='edit_theme_options', $sTextDomain='admin-page-framework' ) { |
|
45 | + public function __construct( $sWidgetTitle, $aWidgetArguments = array(), $sCapability = 'edit_theme_options', $sTextDomain = 'admin-page-framework' ) { |
|
46 | 46 | |
47 | 47 | if ( empty( $sWidgetTitle ) ) { |
48 | 48 | return; |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | // Properties |
52 | 52 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
53 | 53 | ? $this->aSubClassNames[ 'oProp' ] |
54 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
54 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
55 | 55 | $this->oProp = new $_sProprtyClassName( |
56 | - $this, // caller object |
|
57 | - null, // the caller script path |
|
58 | - get_class( $this ), // class name |
|
59 | - $sCapability, // capability |
|
60 | - $sTextDomain, // text domain |
|
56 | + $this, // caller object |
|
57 | + null, // the caller script path |
|
58 | + get_class( $this ), // class name |
|
59 | + $sCapability, // capability |
|
60 | + $sTextDomain, // text domain |
|
61 | 61 | $this->_sStructureType // fields type |
62 | 62 | ); |
63 | 63 |
@@ -28,19 +28,19 @@ |
||
28 | 28 | protected $_sStructureType = 'widget'; |
29 | 29 | |
30 | 30 | /** |
31 | - * The constructor of the class object. |
|
32 | - * |
|
33 | - * Registers necessary hooks and sets up internal properties. |
|
34 | - * |
|
35 | - * <h4>Example</h4> |
|
36 | - * <code> |
|
37 | - * new APF_Widget( __( 'Admin Page Framework', 'admin-page-framework-demo' ) ); // the widget title |
|
38 | - * new APF_Widget_CustomFieldTypes( __( 'APF - Advanced', 'admin-page-framework-demo' ) ); |
|
39 | - * new APF_Widget_Example( __( 'APF - GitHub Button', 'admin-page-framework-demo' ) ); |
|
40 | - * </code> |
|
41 | - * |
|
42 | - * @return void |
|
43 | - */ |
|
31 | + * The constructor of the class object. |
|
32 | + * |
|
33 | + * Registers necessary hooks and sets up internal properties. |
|
34 | + * |
|
35 | + * <h4>Example</h4> |
|
36 | + * <code> |
|
37 | + * new APF_Widget( __( 'Admin Page Framework', 'admin-page-framework-demo' ) ); // the widget title |
|
38 | + * new APF_Widget_CustomFieldTypes( __( 'APF - Advanced', 'admin-page-framework-demo' ) ); |
|
39 | + * new APF_Widget_Example( __( 'APF - GitHub Button', 'admin-page-framework-demo' ) ); |
|
40 | + * </code> |
|
41 | + * |
|
42 | + * @return void |
|
43 | + */ |
|
44 | 44 | public function __construct( $sWidgetTitle, $aWidgetArguments=array(), $sCapability='edit_theme_options', $sTextDomain='admin-page-framework' ) { |
45 | 45 | |
46 | 46 | if ( empty( $sWidgetTitle ) ) { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @since 3.2.0 |
15 | 15 | * @package AdminPageFramework/Factory/Widget |
16 | 16 | */ |
17 | -abstract class AdminPageFramework_Widget extends AdminPageFramework_Widget_Controller { |
|
17 | +abstract class AdminPageFramework_Widget extends AdminPageFramework_Widget_Controller { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Defines the class object structure type. |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct( $sWidgetTitle, $aWidgetArguments=array(), $sCapability='edit_theme_options', $sTextDomain='admin-page-framework' ) { |
45 | 45 | |
46 | - if ( empty( $sWidgetTitle ) ) { |
|
46 | + if ( empty( $sWidgetTitle ) ) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 |
@@ -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 | ) |