@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @since 3.1.3 |
| 64 | 64 | * @since 3.1.5 Added the $vDefault parameter. |
| 65 | 65 | */ |
| 66 | - static public function getTransient( $sTransientKey, $vDefault=null ) { |
|
| 66 | + static public function getTransient( $sTransientKey, $vDefault = null ) { |
|
| 67 | 67 | |
| 68 | 68 | // temporarily disable $_wp_using_ext_object_cache |
| 69 | 69 | global $_wp_using_ext_object_cache; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @since 3.1.3 |
| 104 | 104 | * @return boolean True if set; otherwise, false. |
| 105 | 105 | */ |
| 106 | - static public function setTransient( $sTransientKey, $vValue, $iExpiration=0 ) { |
|
| 106 | + static public function setTransient( $sTransientKey, $vValue, $iExpiration = 0 ) { |
|
| 107 | 107 | |
| 108 | 108 | // temporarily disable $_wp_using_ext_object_cache |
| 109 | 109 | global $_wp_using_ext_object_cache; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * The method will replace last ending 33 characters if the given string in the first parameter exceeds the limit. So this number must be greater than 33. |
| 142 | 142 | * @return string |
| 143 | 143 | */ |
| 144 | - static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength=45 ) { |
|
| 144 | + static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength = 45 ) { |
|
| 145 | 145 | |
| 146 | 146 | // Check if the given string eceees the length limit. |
| 147 | 147 | if ( strlen( $sSubject ) <= $iAllowedCharacterLength ) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | 0, // start position |
| 156 | 156 | $_iPrefixLengthToKeep - 1 // how many characters to extract |
| 157 | 157 | ); |
| 158 | - return $_sPrefixToKeep . '_' . md5( $sSubject ); |
|
| 158 | + return $_sPrefixToKeep.'_'.md5( $sSubject ); |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
| 170 | 170 | * @param array $aAdditionalOptions an additional options array to merge with the options array. |
| 171 | 171 | */ |
| 172 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
| 172 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
| 173 | 173 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions ); |
| 174 | 174 | } |
| 175 | 175 | /** |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @remark Used in the network admin area. |
| 185 | 185 | * @return mixed |
| 186 | 186 | */ |
| 187 | - static public function getSiteOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
| 187 | + static public function getSiteOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
| 188 | 188 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions, 'get_site_option' ); |
| 189 | 189 | } |
| 190 | 190 | /** |
@@ -193,16 +193,16 @@ discard block |
||
| 193 | 193 | * @since 3.5.3 |
| 194 | 194 | * @return mixed |
| 195 | 195 | */ |
| 196 | - static private function _getOptionByFunctionName( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array(), $sFunctionName='get_option' ) { |
|
| 196 | + static private function _getOptionByFunctionName( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array(), $sFunctionName = 'get_option' ) { |
|
| 197 | 197 | |
| 198 | 198 | // Entire options |
| 199 | - if ( ! isset( $asKey ) ) { |
|
| 199 | + if ( !isset( $asKey ) ) { |
|
| 200 | 200 | $_aOptions = $sFunctionName( |
| 201 | 201 | $sOptionKey, |
| 202 | 202 | isset( $vDefault ) |
| 203 | 203 | ? $vDefault |
| 204 | 204 | : array() |
| 205 | - );; |
|
| 205 | + ); ; |
|
| 206 | 206 | return empty( $aAdditionalOptions ) |
| 207 | 207 | ? $_aOptions |
| 208 | 208 | : self::uniteArrays( |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | * @since 3.5.3 |
| 53 | 53 | * @return string The site language. |
| 54 | 54 | */ |
| 55 | - static public function getSiteLanguage( $sDefault='en_US' ) { |
|
| 55 | + static public function getSiteLanguage( $sDefault = 'en_US' ) { |
|
| 56 | 56 | return defined( 'WPLANG' ) && WPLANG ? WPLANG : $sDefault; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | : @mysql_get_server_info(), |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - foreach( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
| 45 | + foreach ( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
| 46 | 46 | |
| 47 | 47 | $_aItem = array_values( $_aItem ); |
| 48 | 48 | $_sKey = array_shift( $_aItem ); |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | static public function getMySQLErrorLogPath() { |
| 64 | 64 | |
| 65 | 65 | $_aMySQLInfo = self::getMySQLInfo(); |
| 66 | - return isset( $_aMySQLInfo['log_error'] ) |
|
| 67 | - ? $_aMySQLInfo['log_error'] |
|
| 66 | + return isset( $_aMySQLInfo[ 'log_error' ] ) |
|
| 67 | + ? $_aMySQLInfo[ 'log_error' ] |
|
| 68 | 68 | : ''; |
| 69 | 69 | |
| 70 | 70 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * Returns a PHP error log. |
| 74 | 74 | * @since 3.4.6 |
| 75 | 75 | */ |
| 76 | - static public function getMySQLErrorLog( $iLines=1 ) { |
|
| 76 | + static public function getMySQLErrorLog( $iLines = 1 ) { |
|
| 77 | 77 | |
| 78 | 78 | $_sLog = self::getFileTailContents( self::getMySQLErrorLogPath(), $iLines ); |
| 79 | 79 | |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | static public function getCurrentAdminURL() { |
| 27 | 27 | |
| 28 | - $sRequestURI = $GLOBALS['is_IIS'] ? $_SERVER['PATH_INFO'] : $_SERVER["REQUEST_URI"]; |
|
| 29 | - $sPageURL = 'on' == @$_SERVER["HTTPS"] ? "https://" : "http://"; |
|
| 28 | + $sRequestURI = $GLOBALS[ 'is_IIS' ] ? $_SERVER[ 'PATH_INFO' ] : $_SERVER[ "REQUEST_URI" ]; |
|
| 29 | + $sPageURL = 'on' == @$_SERVER[ "HTTPS" ] ? "https://" : "http://"; |
|
| 30 | 30 | |
| 31 | - if ( "80" != $_SERVER["SERVER_PORT"] ) { |
|
| 32 | - $sPageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $sRequestURI; |
|
| 31 | + if ( "80" != $_SERVER[ "SERVER_PORT" ] ) { |
|
| 32 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].":".$_SERVER[ "SERVER_PORT" ].$sRequestURI; |
|
| 33 | 33 | } else { |
| 34 | - $sPageURL .= $_SERVER["SERVER_NAME"] . $sRequestURI; |
|
| 34 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].$sRequestURI; |
|
| 35 | 35 | } |
| 36 | 36 | return $sPageURL; |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $sSubjectURL ( optional ) The subject url to modify |
| 49 | 49 | * @return string The modified url. |
| 50 | 50 | */ |
| 51 | - static public function getQueryAdminURL( $aAddingQueries=array(), $aRemovingQueryKeys=array(), $sSubjectURL='' ) { |
|
| 51 | + static public function getQueryAdminURL( $aAddingQueries = array(), $aRemovingQueryKeys = array(), $sSubjectURL = '' ) { |
|
| 52 | 52 | |
| 53 | 53 | $_sAdminURL = is_network_admin() |
| 54 | 54 | ? 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( ABSPATH, $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 esc_url( $sHref ); |
| 103 | 103 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | * @since 3.6.0 Changed the name from `resolveSRC()`. |
| 114 | 114 | * @return string|null |
| 115 | 115 | */ |
| 116 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 116 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
| 117 | 117 | |
| 118 | - if ( ! self::isResourcePath( $sSRC ) ) { |
|
| 118 | + if ( !self::isResourcePath( $sSRC ) ) { |
|
| 119 | 119 | return $bReturnNullIfNotExist |
| 120 | 120 | ? null |
| 121 | 121 | : $sSRC; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | // If the file exists, it means it is an absolute path. If so, calculate the URL from the path. |
| 130 | 130 | if ( file_exists( realpath( $sSRC ) ) ) { |
| 131 | - return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
| 131 | + return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if ( $bReturnNullIfNotExist ) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | /** |
| 143 | 143 | * @deprecated 3.6.0 Use `getResolvedSRC()` instead. |
| 144 | 144 | */ |
| 145 | - static public function resolveSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 145 | + static public function resolveSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
| 146 | 146 | return self::getResolvedSRC( $sSRC, $bReturnNullIfNotExist ); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | * @since 3.6.0 Changed the name from `resolveSRC()`. |
| 114 | 114 | * @return string|null |
| 115 | 115 | */ |
| 116 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 116 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 117 | 117 | |
| 118 | 118 | if ( ! self::isResourcePath( $sSRC ) ) { |
| 119 | 119 | return $bReturnNullIfNotExist |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | * @since 3.3.0 |
| 71 | 71 | * @since 3.3.1 Moved from `AdminPageFramework_Setting_Base`. |
| 72 | 72 | */ |
| 73 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
| 73 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
| 74 | 74 | |
| 75 | 75 | parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain ); |
| 76 | 76 | |
| 77 | 77 | if ( $this->oProp->bIsAdminAjax ) { |
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | - if ( ! $this->oProp->bIsAdmin ) { |
|
| 80 | + if ( !$this->oProp->bIsAdmin ) { |
|
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | 'section_title' => null, |
| 128 | 128 | 'section_id' => null, |
| 129 | 129 | ); |
| 130 | - if ( ! $aFieldset[ 'help' ] ) { |
|
| 130 | + if ( !$aFieldset[ 'help' ] ) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | 'help_tab_id' => $_sRootSectionID, |
| 146 | 146 | 'help_tab_content' => "<span class='contextual-help-tab-title'>" |
| 147 | 147 | . $aFieldset[ 'title' ] |
| 148 | - . "</span> - " . PHP_EOL |
|
| 148 | + . "</span> - ".PHP_EOL |
|
| 149 | 149 | . $aFieldset[ 'help' ], |
| 150 | 150 | 'help_tab_sidebar_content' => $aFieldset[ 'help_aside' ] |
| 151 | 151 | ? $aFieldset[ 'help_aside' ] |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | public function _registerHelpPaneItemsOfFormSections( $aSectionsets ) { |
| 180 | 180 | // @todo Test if help pane item gets displayed |
| 181 | 181 | |
| 182 | - foreach( $aSectionsets as $_aSectionset ) { |
|
| 182 | + foreach ( $aSectionsets as $_aSectionset ) { |
|
| 183 | 183 | // @todo check capability and conditions |
| 184 | 184 | $_aSectionset = $_aSectionset + array( |
| 185 | 185 | 'help' => null, |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function _replyToDetermineSectionsetVisibility( $bVisible, $aSectionset ) { |
| 215 | 215 | |
| 216 | - if ( ! current_user_can( $aSectionset[ 'capability' ] ) ) { |
|
| 216 | + if ( !current_user_can( $aSectionset[ 'capability' ] ) ) { |
|
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | - if ( ! $aSectionset[ 'if' ] ) { |
|
| 219 | + if ( !$aSectionset[ 'if' ] ) { |
|
| 220 | 220 | return false; |
| 221 | 221 | } |
| 222 | - if ( ! $this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 222 | + if ( !$this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | 225 | return $bVisible; |
@@ -237,15 +237,15 @@ discard block |
||
| 237 | 237 | private function _isSectionOfCurrentPage( array $aSectionset ) { |
| 238 | 238 | |
| 239 | 239 | // Make sure the value type is string so that when the page_slug is not set, it won't match. |
| 240 | - $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
|
| 240 | + $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
|
| 241 | 241 | |
| 242 | 242 | // Make sure if it's in the loading page. |
| 243 | - if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 243 | + if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // If no tag is specified, the user wants to display the section regardless of the tab. |
| 248 | - if ( ! $aSectionset[ 'tab_slug' ] ) { |
|
| 248 | + if ( !$aSectionset[ 'tab_slug' ] ) { |
|
| 249 | 249 | return true; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function _replyToDetermineFieldsetVisibility( $bVisible, $aFieldset ) { |
| 263 | 263 | |
| 264 | - $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
|
| 264 | + $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
|
| 265 | 265 | |
| 266 | 266 | // If the specified field does not exist, do nothing. |
| 267 | 267 | if ( $aFieldset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | array( $_sSectionPath, 'page_slug' ), |
| 292 | 292 | null |
| 293 | 293 | ); |
| 294 | - $aFieldset[ 'tab_slug' ] = $this->oUtil->getElement( |
|
| 294 | + $aFieldset[ 'tab_slug' ] = $this->oUtil->getElement( |
|
| 295 | 295 | $aSectionsets, |
| 296 | 296 | array( $_sSectionPath, 'tab_slug' ), |
| 297 | 297 | null |
@@ -302,11 +302,11 @@ discard block |
||
| 302 | 302 | $aSectionsets, |
| 303 | 303 | $_sSectionPath |
| 304 | 304 | ); |
| 305 | - $aFieldset[ 'section_title' ] = $this->oUtil->getElement( |
|
| 305 | + $aFieldset[ 'section_title' ] = $this->oUtil->getElement( |
|
| 306 | 306 | $_aSectionset, |
| 307 | 307 | 'title' |
| 308 | 308 | ); |
| 309 | - $aFieldset[ 'capability' ] = $aFieldset[ 'capability' ] |
|
| 309 | + $aFieldset[ 'capability' ] = $aFieldset[ 'capability' ] |
|
| 310 | 310 | ? $aFieldset[ 'capability' ] |
| 311 | 311 | : $this->_replyToGetCapabilityForForm( |
| 312 | 312 | $this->oUtil->getElement( $_aSectionset, 'capability' ), |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | // Find the capability of the parent section if nested. |
| 357 | 357 | if ( 0 < $aSectionset[ '_nested_depth' ] ) { |
| 358 | - $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
|
| 358 | + $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
|
| 359 | 359 | array_pop( $_aSectionPath ); // remove the last element |
| 360 | 360 | $_sParentCapability = $this->oUtil->getElement( |
| 361 | 361 | $this->oForm->aSectionsets, |
| 362 | 362 | array_merge( $_aSectionPath, array( 'capability' ) ) |
| 363 | 363 | ); |
| 364 | - if( $_sParentCapability ) { |
|
| 364 | + if ( $_sParentCapability ) { |
|
| 365 | 365 | return $_sParentCapability; |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @return void |
| 177 | 177 | * @since DEVVER |
| 178 | 178 | */ |
| 179 | - public function _registerHelpPaneItemsOfFormSections( $aSectionsets ) { |
|
| 179 | + public function _registerHelpPaneItemsOfFormSections( $aSectionsets ) { |
|
| 180 | 180 | // @todo Test if help pane item gets displayed |
| 181 | 181 | |
| 182 | 182 | foreach( $aSectionsets as $_aSectionset ) { |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | if ( ! current_user_can( $aSectionset[ 'capability' ] ) ) { |
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | - if ( ! $aSectionset[ 'if' ] ) { |
|
| 219 | + if ( ! $aSectionset[ 'if' ] ) { |
|
| 220 | 220 | return false; |
| 221 | 221 | } |
| 222 | - if ( ! $this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 222 | + if ( ! $this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | 225 | return $bVisible; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
| 241 | 241 | |
| 242 | 242 | // Make sure if it's in the loading page. |
| 243 | - if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 243 | + if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
| 265 | 265 | |
| 266 | 266 | // If the specified field does not exist, do nothing. |
| 267 | - if ( $aFieldset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 267 | + if ( $aFieldset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 268 | 268 | return false; |
| 269 | 269 | } |
| 270 | 270 | return parent::_replyToDetermineFieldsetVisibility( $bVisible, $aFieldset ); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function _replyToFormatFieldsetDefinition( $aFieldset, $aSectionsets ) { |
| 279 | 279 | |
| 280 | - if ( empty( $aFieldset ) ) { |
|
| 280 | + if ( empty( $aFieldset ) ) { |
|
| 281 | 281 | return $aFieldset; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function _replyToFinalizeInPageTabs() { |
| 39 | 39 | |
| 40 | - if ( ! $this->oProp->isPageAdded() ) { |
|
| 40 | + if ( !$this->oProp->isPageAdded() ) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
| 44 | + foreach ( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
| 45 | 45 | |
| 46 | - if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 46 | + if ( !isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @since 3.6.0 |
| 81 | 81 | */ |
| 82 | 82 | private function _getDefaultInPageTab( $sPageSlug, $aInPageTabs ) { |
| 83 | - foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | - if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 83 | + foreach ( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | + if ( !isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | // Regardless of whether it's a hidden tab, it is stored as the default in-page tab. |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function _replyToFinalizeInPageTabs() { |
| 39 | 39 | |
| 40 | - if ( ! $this->oProp->isPageAdded() ) { |
|
| 40 | + if ( ! $this->oProp->isPageAdded() ) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
| 45 | 45 | |
| 46 | - if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 46 | + if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @since 3.6.0 |
| 81 | 81 | */ |
| 82 | 82 | private function _getDefaultInPageTab( $sPageSlug, $aInPageTabs ) { |
| 83 | - foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | - if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 83 | + foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | + if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | // Regardless of whether it's a hidden tab, it is stored as the default in-page tab. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @since 3.3.0 |
| 29 | 29 | */ |
| 30 | - function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
| 30 | + function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
| 31 | 31 | |
| 32 | 32 | // Objects |
| 33 | 33 | $this->oProp = isset( $this->oProp ) |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
| 67 | 67 | * @internal |
| 68 | 68 | */ |
| 69 | - public function __call( $sMethodName, $aArgs=null ) { |
|
| 69 | + public function __call( $sMethodName, $aArgs = null ) { |
|
| 70 | 70 | |
| 71 | 71 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
| 72 | 72 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -77,22 +77,22 @@ discard block |
||
| 77 | 77 | 'load_pre_', |
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | - switch( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
| 80 | + switch ( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
| 81 | 81 | case 'setup_pre': |
| 82 | 82 | $this->_doSetUp(); |
| 83 | 83 | return; |
| 84 | 84 | |
| 85 | 85 | // A callback of the call_page_{page slug} action hook |
| 86 | - case $this->oProp->sClassHash . '_page_' . $_sPageSlug: |
|
| 87 | - return $this->_renderPage( $_sPageSlug, $_sTabSlug ); // defined in AdminPageFramework_Page. |
|
| 86 | + case $this->oProp->sClassHash.'_page_'.$_sPageSlug: |
|
| 87 | + return $this->_renderPage( $_sPageSlug, $_sTabSlug ); // defined in AdminPageFramework_Page. |
|
| 88 | 88 | |
| 89 | 89 | // add_settings_section() callback |
| 90 | 90 | case 'section_pre_': |
| 91 | - return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
| 91 | + return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
| 92 | 92 | |
| 93 | 93 | // add_settings_field() callback - |
| 94 | 94 | case 'field_pre_': |
| 95 | - return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
| 95 | + return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
| 96 | 96 | |
| 97 | 97 | // load-{page} callback |
| 98 | 98 | case 'load_pre_': |
@@ -109,20 +109,20 @@ discard block |
||
| 109 | 109 | * @since 3.5.3 |
| 110 | 110 | * @return string The found callback method name or the prefix of a known callback method name. An empty string if not found. |
| 111 | 111 | */ |
| 112 | - private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes=array() ) { |
|
| 112 | + private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes = array() ) { |
|
| 113 | 113 | |
| 114 | 114 | if ( in_array( |
| 115 | 115 | $sMethodName, |
| 116 | 116 | array( |
| 117 | 117 | 'setup_pre', |
| 118 | - $this->oProp->sClassHash . '_page_' . $sPageSlug |
|
| 118 | + $this->oProp->sClassHash.'_page_'.$sPageSlug |
|
| 119 | 119 | ) |
| 120 | 120 | ) |
| 121 | 121 | ) { |
| 122 | 122 | return $sMethodName; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - foreach( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
| 125 | + foreach ( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
| 126 | 126 | if ( $this->oUtil->hasPrefix( $_sMethodPrefix, $sMethodName ) ) { |
| 127 | 127 | return $_sMethodPrefix; |
| 128 | 128 | } |
@@ -165,13 +165,13 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | protected function _doPageLoadCall( $sMethodName, $sPageSlug, $sTabSlug, $oScreen ) { |
| 167 | 167 | |
| 168 | - if ( ! $this->isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
| 168 | + if ( !$this->isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
| 169 | 169 | return; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // [3.4.6+] Set the page and tab slugs to the default form section so that added form fields without a section will appear in different pages and tabs. |
| 173 | - $this->oForm->aSections[ '_default' ]['page_slug'] = $sPageSlug ? $sPageSlug : null; |
|
| 174 | - $this->oForm->aSections[ '_default' ]['tab_slug'] = $sTabSlug ? $sTabSlug : null; |
|
| 173 | + $this->oForm->aSections[ '_default' ][ 'page_slug' ] = $sPageSlug ? $sPageSlug : null; |
|
| 174 | + $this->oForm->aSections[ '_default' ][ 'tab_slug' ] = $sTabSlug ? $sTabSlug : null; |
|
| 175 | 175 | |
| 176 | 176 | // Do actions, class -> page -> in-page tab |
| 177 | 177 | $this->oUtil->addAndDoActions( |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | $this->oUtil->addAndDoActions( |
| 189 | 189 | $this, // the caller object |
| 190 | - array( "load_{$sPageSlug}_" . $this->oProp->getCurrentTabSlug( $sPageSlug ) ), |
|
| 190 | + array( "load_{$sPageSlug}_".$this->oProp->getCurrentTabSlug( $sPageSlug ) ), |
|
| 191 | 191 | $this // the admin page object - this lets third-party scripts use the framework methods. |
| 192 | 192 | ); |
| 193 | 193 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | if ( substr( $sMethodName, strlen( 'load_pre_' ) ) !== $sPageSlug ) { |
| 216 | 216 | return false; |
| 217 | 217 | } |
| 218 | - if ( ! isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
| 218 | + if ( !isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
| 219 | 219 | return false; |
| 220 | 220 | } |
| 221 | 221 | if ( $sScreenID !== $this->oProp->aPageHooks[ $sPageSlug ] ) { |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | protected function _isInstantiatable() { |
| 237 | 237 | |
| 238 | 238 | // Disable in admin-ajax.php |
| 239 | - if ( isset( $GLOBALS['pagenow'] ) && 'admin-ajax.php' === $GLOBALS['pagenow'] ) { |
|
| 239 | + if ( isset( $GLOBALS[ 'pagenow' ] ) && 'admin-ajax.php' === $GLOBALS[ 'pagenow' ] ) { |
|
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Nothing to do in the network admin area. |
| 244 | - return ! is_network_admin(); |
|
| 244 | + return !is_network_admin(); |
|
| 245 | 245 | |
| 246 | 246 | } |
| 247 | 247 | |
@@ -253,19 +253,19 @@ discard block |
||
| 253 | 253 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
| 254 | 254 | * @internal |
| 255 | 255 | */ |
| 256 | - public function _isInThePage( $aPageSlugs=array() ) { |
|
| 256 | + public function _isInThePage( $aPageSlugs = array() ) { |
|
| 257 | 257 | |
| 258 | 258 | // Maybe called too early |
| 259 | - if ( ! isset( $this->oProp ) ) { |
|
| 259 | + if ( !isset( $this->oProp ) ) { |
|
| 260 | 260 | return true; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // If the setUp method is not loaded yet, |
| 264 | - if ( ! did_action( 'set_up_' . $this->oProp->sClassName ) ) { |
|
| 264 | + if ( !did_action( 'set_up_'.$this->oProp->sClassName ) ) { |
|
| 265 | 265 | return true; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if ( ! isset( $_GET['page'] ) ) { |
|
| 268 | + if ( !isset( $_GET[ 'page' ] ) ) { |
|
| 269 | 269 | return false; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | return $this->oProp->isPageAdded(); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - return in_array( $_GET['page'], $aPageSlugs ); |
|
| 281 | + return in_array( $_GET[ 'page' ], $aPageSlugs ); |
|
| 282 | 282 | |
| 283 | 283 | } |
| 284 | 284 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
| 67 | 67 | * @internal |
| 68 | 68 | */ |
| 69 | - public function __call( $sMethodName, $aArgs=null ) { |
|
| 69 | + public function __call( $sMethodName, $aArgs=null ) { |
|
| 70 | 70 | |
| 71 | 71 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
| 72 | 72 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | return true; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if ( ! isset( $_GET['page'] ) ) { |
|
| 268 | + if ( ! isset( $_GET['page'] ) ) { |
|
| 269 | 269 | return false; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -28,19 +28,19 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function _replyToGetSectionName( /* $sAttribute, $aSectionset */ ) { |
| 30 | 30 | |
| 31 | - $_aParams = func_get_args() + array( null, null, ); |
|
| 31 | + $_aParams = func_get_args() + array( null, null,); |
|
| 32 | 32 | $sNameAttribute = $_aParams[ 0 ]; |
| 33 | 33 | $aSectionset = $_aParams[ 1 ]; |
| 34 | 34 | |
| 35 | 35 | $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
| 36 | 36 | |
| 37 | 37 | $_aDimensionalKeys = array( $this->oProp->sOptionKey ); |
| 38 | - foreach( $_aSectionPath as $_sDimension ) { |
|
| 39 | - $_aDimensionalKeys[] = '[' . $_sDimension . ']'; |
|
| 38 | + foreach ( $_aSectionPath as $_sDimension ) { |
|
| 39 | + $_aDimensionalKeys[ ] = '['.$_sDimension.']'; |
|
| 40 | 40 | } |
| 41 | 41 | // $_aDimensionalKeys[] = '[' . $aSectionset[ 'section_id' ] . ']'; |
| 42 | 42 | if ( isset( $aSectionset[ '_index' ] ) ) { |
| 43 | - $_aDimensionalKeys[] = '[' . $aSectionset[ '_index' ] . ']'; |
|
| 43 | + $_aDimensionalKeys[ ] = '['.$aSectionset[ '_index' ].']'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return implode( '', $_aDimensionalKeys ); |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function _replyToGetFieldNameAttribute( /* $sAttribute, $aFieldset */ ) { |
| 55 | 55 | |
| 56 | - $_aParams = func_get_args() + array( null, null, ); |
|
| 56 | + $_aParams = func_get_args() + array( null, null,); |
|
| 57 | 57 | $sNameAttribute = $_aParams[ 0 ]; |
| 58 | 58 | $aFieldset = $_aParams[ 1 ]; |
| 59 | 59 | |
| 60 | 60 | $_aDimensionalKeys = array( $aFieldset[ 'option_key' ] ); |
| 61 | 61 | if ( $this->isSectionSet( $aFieldset ) ) { |
| 62 | - $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
| 63 | - foreach( $_aSectionPath as $_sDimension ) { |
|
| 64 | - $_aDimensionalKeys[] = '[' . $_sDimension . ']'; |
|
| 62 | + $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
| 63 | + foreach ( $_aSectionPath as $_sDimension ) { |
|
| 64 | + $_aDimensionalKeys[ ] = '['.$_sDimension.']'; |
|
| 65 | 65 | } |
| 66 | 66 | // $_aDimensionalKeys[] = '[' . $aFieldset[ 'section_id' ] . ']'; |
| 67 | 67 | if ( isset( $aFieldset[ '_section_index' ] ) ) { |
| 68 | - $_aDimensionalKeys[] = '[' . $aFieldset[ '_section_index' ] . ']'; |
|
| 68 | + $_aDimensionalKeys[ ] = '['.$aFieldset[ '_section_index' ].']'; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $_aDimensionalKeys[] = '[' . $aFieldset[ 'field_id' ] . ']'; |
|
| 72 | + $_aDimensionalKeys[ ] = '['.$aFieldset[ 'field_id' ].']'; |
|
| 73 | 73 | |
| 74 | 74 | return implode( '', $_aDimensionalKeys ); |
| 75 | 75 | |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function _replyToGetFlatFieldName( /* $sAttribute, $aFieldset */ ) { |
| 83 | 83 | |
| 84 | - $_aParams = func_get_args() + array( null, null, ); |
|
| 84 | + $_aParams = func_get_args() + array( null, null,); |
|
| 85 | 85 | $sNameAttribute = $_aParams[ 0 ]; |
| 86 | 86 | $aFieldset = $_aParams[ 1 ]; |
| 87 | 87 | |
| 88 | 88 | $_aDimensionalKeys = array( $aFieldset[ 'option_key' ] ); |
| 89 | 89 | if ( $this->isSectionSet( $aFieldset ) ) { |
| 90 | - foreach( $aFieldset[ '_section_path_array' ] as $_sDimension ) { |
|
| 91 | - $_aDimensionalKeys[] = $_sDimension; // $aFieldset[ 'section_id' ]; |
|
| 90 | + foreach ( $aFieldset[ '_section_path_array' ] as $_sDimension ) { |
|
| 91 | + $_aDimensionalKeys[ ] = $_sDimension; // $aFieldset[ 'section_id' ]; |
|
| 92 | 92 | } |
| 93 | 93 | if ( isset( $aFieldset[ '_section_index' ] ) ) { |
| 94 | - $_aDimensionalKeys[] = $aFieldset[ '_section_index' ]; |
|
| 94 | + $_aDimensionalKeys[ ] = $aFieldset[ '_section_index' ]; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | - $_aDimensionalKeys[] = $aFieldset[ 'field_id' ]; |
|
| 97 | + $_aDimensionalKeys[ ] = $aFieldset[ 'field_id' ]; |
|
| 98 | 98 | return implode( '|', $_aDimensionalKeys ); |
| 99 | 99 | |
| 100 | 100 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | "[{$sKey}]" |
| 118 | 118 | ); |
| 119 | 119 | |
| 120 | - return $this->_replyToGetFieldNameAttribute( '', $aField ) . $sKey; |
|
| 120 | + return $this->_replyToGetFieldNameAttribute( '', $aField ).$sKey; |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | /** |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | $_sKey = $this->oUtil->getAOrB( |
| 136 | 136 | '0' !== $_sKey && empty( $_sKey ), |
| 137 | 137 | '', |
| 138 | - "|" . $_sKey |
|
| 138 | + "|".$_sKey |
|
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | - return $this->_replyToGetFlatFieldName( '', $aField ) . $_sKey; |
|
| 141 | + return $this->_replyToGetFlatFieldName( '', $aField ).$_sKey; |
|
| 142 | 142 | |
| 143 | 143 | } |
| 144 | 144 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @since unknown |
| 27 | 27 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View_MetaBox`. |
| 28 | 28 | */ |
| 29 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
| 29 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
| 30 | 30 | |
| 31 | 31 | parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain ); |
| 32 | 32 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return void |
| 62 | 62 | * @internal |
| 63 | 63 | */ |
| 64 | - protected function _renderPage( $sPageSlug, $sTabSlug=null ) { |
|
| 64 | + protected function _renderPage( $sPageSlug, $sTabSlug = null ) { |
|
| 65 | 65 | |
| 66 | 66 | $_oPageRenderer = new AdminPageFramework_View__PageRenderer( $this, $sPageSlug, $sTabSlug ); |
| 67 | 67 | $_oPageRenderer->render(); |