@@ -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( preg_replace( '/[\/\\\\]+wp-content(.*)/m', '', WP_CONTENT_DIR ) . '/wp-admin/includes/plugin.php' ) ) { |
|
| 367 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
| 368 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
| 369 | + if ( !@include( preg_replace( '/[\/\\\\]+wp-content(.*)/m', '', WP_CONTENT_DIR ).'/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 | |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | static public function getCurrentAdminURL() { |
| 26 | 26 | |
| 27 | - $sRequestURI = $GLOBALS['is_IIS'] ? $_SERVER['PATH_INFO'] : $_SERVER["REQUEST_URI"]; |
|
| 28 | - $sPageURL = 'on' == @$_SERVER["HTTPS"] ? "https://" : "http://"; |
|
| 27 | + $sRequestURI = $GLOBALS[ 'is_IIS' ] ? $_SERVER[ 'PATH_INFO' ] : $_SERVER[ "REQUEST_URI" ]; |
|
| 28 | + $sPageURL = 'on' == @$_SERVER[ "HTTPS" ] ? "https://" : "http://"; |
|
| 29 | 29 | |
| 30 | - if ( "80" != $_SERVER["SERVER_PORT"] ) { |
|
| 31 | - $sPageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $sRequestURI; |
|
| 30 | + if ( "80" != $_SERVER[ "SERVER_PORT" ] ) { |
|
| 31 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].":".$_SERVER[ "SERVER_PORT" ].$sRequestURI; |
|
| 32 | 32 | } else { |
| 33 | - $sPageURL .= $_SERVER["SERVER_NAME"] . $sRequestURI; |
|
| 33 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].$sRequestURI; |
|
| 34 | 34 | } |
| 35 | 35 | return $sPageURL; |
| 36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param string $sSubjectURL ( optional ) The subject url to modify |
| 48 | 48 | * @return string The modified url. |
| 49 | 49 | */ |
| 50 | - static public function getQueryAdminURL( $aAddingQueries=array(), $aRemovingQueryKeys=array(), $sSubjectURL='' ) { |
|
| 50 | + static public function getQueryAdminURL( $aAddingQueries = array(), $aRemovingQueryKeys = array(), $sSubjectURL = '' ) { |
|
| 51 | 51 | |
| 52 | 52 | $_sAdminURL = is_network_admin() |
| 53 | 53 | ? network_admin_url( AdminPageFramework_WPUtility_Page::getPageNow() ) |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $_oWPStyles = new WP_Styles(); // It doesn't matter whether the file is a style or not. Just use the built-in WordPress class to calculate the SRC URL. |
| 98 | 98 | $_sRelativePath = AdminPageFramework_Utility::getRelativePath( preg_replace( '/[\/\\\\]+wp-content(.*)/m', '', WP_CONTENT_DIR ), $sFilePath ); |
| 99 | 99 | $_sRelativePath = preg_replace( "/^\.[\/\\\]/", '', $_sRelativePath, 1 ); // removes the heading ./ or .\ |
| 100 | - $_sHref = trailingslashit( $_oWPStyles->base_url ) . $_sRelativePath; |
|
| 100 | + $_sHref = trailingslashit( $_oWPStyles->base_url ).$_sRelativePath; |
|
| 101 | 101 | unset( $_oWPStyles ); // for PHP 5.2.x or below |
| 102 | 102 | return $_sHref; |
| 103 | 103 | |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | * @since 3.7.9 Changed not to escape characters. |
| 115 | 115 | * @return string|null |
| 116 | 116 | */ |
| 117 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 117 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
| 118 | 118 | |
| 119 | - if ( ! self::isResourcePath( $sSRC ) ) { |
|
| 119 | + if ( !self::isResourcePath( $sSRC ) ) { |
|
| 120 | 120 | return $bReturnNullIfNotExist |
| 121 | 121 | ? null |
| 122 | 122 | : $sSRC; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | // If the file exists, it means it is an absolute path. If so, calculate the URL from the path. |
| 131 | 131 | if ( file_exists( realpath( $sSRC ) ) ) { |
| 132 | - return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
| 132 | + return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ( $bReturnNullIfNotExist ) { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * @deprecated 3.6.0 Use `getResolvedSRC()` instead. |
| 145 | 145 | */ |
| 146 | - static public function resolveSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 146 | + static public function resolveSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
| 147 | 147 | return self::getResolvedSRC( $sSRC, $bReturnNullIfNotExist ); |
| 148 | 148 | } |
| 149 | 149 | |