@@ -89,11 +89,6 @@ discard block |
||
| 89 | 89 | * @access public |
| 90 | 90 | * @since 2.0.0 |
| 91 | 91 | * @remark Accepts variadic parameters. |
| 92 | - * @param object $oCallerObject the object that holds the callback method that matches the action hook name. |
|
| 93 | - * @param array $aActionHooks a numerically index array consisting of action hook names that serve as the callback method names. |
|
| 94 | - * @param mixed $vArgs1 the argument to pass to the hook callback functions. |
|
| 95 | - * @param mixed $vArgs2 another argument to pass to the hook callback functions. |
|
| 96 | - * @param mixed $_and_more add as many arguments as necessary to the next parameters. |
|
| 97 | 92 | * @return void |
| 98 | 93 | */ |
| 99 | 94 | static public function addAndDoActions( /* $oCallerObject, $aActionHooks, $vArgs1=null, $vArgs2=null, $_and_more=null */ ) { |
@@ -192,10 +187,6 @@ discard block |
||
| 192 | 187 | * ` |
| 193 | 188 | * |
| 194 | 189 | * @since 2.0.0 |
| 195 | - * @param object $oCallerObject |
|
| 196 | - * @param string $sFilter The filter hook name. |
|
| 197 | - * @param mixed $vData The filtering data |
|
| 198 | - * @param mixed $vArgs The arguments. |
|
| 199 | 190 | */ |
| 200 | 191 | static public function addAndApplyFilter( /* $oCallerObject, $sFilter, $vData, $vArgs... */ ) { |
| 201 | 192 | |
@@ -233,6 +224,7 @@ discard block |
||
| 233 | 224 | * |
| 234 | 225 | * @since 2.0.0 |
| 235 | 226 | * @access public |
| 227 | + * @param string $sPrefix |
|
| 236 | 228 | * @return array Returns an array consisting of the filters. |
| 237 | 229 | */ |
| 238 | 230 | static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse=false ) { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @since 3.4.2 |
| 27 | 27 | * @todo Create a similar function for filters. |
| 28 | 28 | */ |
| 29 | - static public function registerAction( $sActionHook, $oCallable, $iPriority=10 ) { |
|
| 29 | + static public function registerAction( $sActionHook, $oCallable, $iPriority = 10 ) { |
|
| 30 | 30 | |
| 31 | 31 | if ( did_action( $sActionHook ) ) { |
| 32 | 32 | return call_user_func_array( $oCallable, array() ); |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | * @param mixed $_and_more add as many arguments as necessary to the next parameters. |
| 64 | 64 | * @return void does not return a value. |
| 65 | 65 | */ |
| 66 | - static public function doActions( $aActionHooks, $vArgs1=null, $vArgs2=null, $_and_more=null ) { |
|
| 66 | + static public function doActions( $aActionHooks, $vArgs1 = null, $vArgs2 = null, $_and_more = null ) { |
|
| 67 | 67 | |
| 68 | 68 | $aArgs = func_get_args(); |
| 69 | 69 | $aActionHooks = $aArgs[ 0 ]; |
| 70 | - foreach( ( array ) $aActionHooks as $sActionHook ) { |
|
| 70 | + foreach ( ( array ) $aActionHooks as $sActionHook ) { |
|
| 71 | 71 | $aArgs[ 0 ] = $sActionHook; |
| 72 | - call_user_func_array( 'do_action' , $aArgs ); |
|
| 72 | + call_user_func_array( 'do_action', $aArgs ); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | } |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | $aArgs = func_get_args(); |
| 102 | 102 | $oCallerObject = $aArgs[ 0 ]; |
| 103 | 103 | $aActionHooks = $aArgs[ 1 ]; |
| 104 | - foreach( ( array ) $aActionHooks as $sActionHook ) { |
|
| 105 | - if ( ! $sActionHook ) { |
|
| 104 | + foreach ( ( array ) $aActionHooks as $sActionHook ) { |
|
| 105 | + if ( !$sActionHook ) { |
|
| 106 | 106 | continue; |
| 107 | 107 | } |
| 108 | 108 | $aArgs[ 1 ] = $sActionHook; |
| 109 | - call_user_func_array( array( get_class(), 'addAndDoAction' ) , $aArgs ); |
|
| 109 | + call_user_func_array( array( get_class(), 'addAndDoAction' ), $aArgs ); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $_aArgs = func_get_args(); |
| 126 | 126 | $_oCallerObject = $_aArgs[ 0 ]; |
| 127 | 127 | $_sActionHook = $_aArgs[ 1 ]; |
| 128 | - if ( ! $_sActionHook ) { |
|
| 128 | + if ( !$_sActionHook ) { |
|
| 129 | 129 | return; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | // Remove the first element, the caller object. |
| 139 | 139 | array_shift( $_aArgs ); |
| 140 | - call_user_func_array( 'do_action' , $_aArgs ); |
|
| 140 | + call_user_func_array( 'do_action', $_aArgs ); |
|
| 141 | 141 | |
| 142 | 142 | } |
| 143 | 143 | |
@@ -165,12 +165,12 @@ discard block |
||
| 165 | 165 | $_aFilters = $_aArgs[ 1 ]; |
| 166 | 166 | $_vInput = $_aArgs[ 2 ]; |
| 167 | 167 | |
| 168 | - foreach( ( array ) $_aFilters as $_sFilter ) { |
|
| 169 | - if ( ! $_sFilter ) { |
|
| 168 | + foreach ( ( array ) $_aFilters as $_sFilter ) { |
|
| 169 | + if ( !$_sFilter ) { |
|
| 170 | 170 | continue; |
| 171 | 171 | } |
| 172 | 172 | $_aArgs[ 1 ] = $_sFilter; |
| 173 | - $_aArgs[ 2 ] = $_vInput; // assigns the updated value as it is filtered in previous iterations |
|
| 173 | + $_aArgs[ 2 ] = $_vInput; // assigns the updated value as it is filtered in previous iterations |
|
| 174 | 174 | $_vInput = call_user_func_array( |
| 175 | 175 | array( get_class(), 'addAndApplyFilter' ), |
| 176 | 176 | $_aArgs |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $_aArgs = func_get_args(); |
| 205 | 205 | $_oCallerObject = $_aArgs[ 0 ]; |
| 206 | 206 | $_sFilter = $_aArgs[ 1 ]; |
| 207 | - if ( ! $_sFilter ) { |
|
| 207 | + if ( !$_sFilter ) { |
|
| 208 | 208 | return $_aArgs[ 2 ]; |
| 209 | 209 | } |
| 210 | 210 | |
@@ -235,17 +235,17 @@ discard block |
||
| 235 | 235 | * @access public |
| 236 | 236 | * @return array Returns an array consisting of the filters. |
| 237 | 237 | */ |
| 238 | - static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse=false ) { |
|
| 238 | + static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse = false ) { |
|
| 239 | 239 | |
| 240 | 240 | $_aFilters = array(); |
| 241 | 241 | if ( $sTabSlug && $sPageSlug ) { |
| 242 | - $_aFilters[] = "{$sPrefix}{$sPageSlug}_{$sTabSlug}"; |
|
| 242 | + $_aFilters[ ] = "{$sPrefix}{$sPageSlug}_{$sTabSlug}"; |
|
| 243 | 243 | } |
| 244 | 244 | if ( $sPageSlug ) { |
| 245 | - $_aFilters[] = "{$sPrefix}{$sPageSlug}"; |
|
| 245 | + $_aFilters[ ] = "{$sPrefix}{$sPageSlug}"; |
|
| 246 | 246 | } |
| 247 | 247 | if ( $sClassName ) { |
| 248 | - $_aFilters[] = "{$sPrefix}{$sClassName}"; |
|
| 248 | + $_aFilters[ ] = "{$sPrefix}{$sClassName}"; |
|
| 249 | 249 | } |
| 250 | 250 | return $bReverse |
| 251 | 251 | ? array_reverse( $_aFilters ) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $oCallerObject = $aArgs[ 0 ]; |
| 103 | 103 | $aActionHooks = $aArgs[ 1 ]; |
| 104 | 104 | foreach( ( array ) $aActionHooks as $sActionHook ) { |
| 105 | - if ( ! $sActionHook ) { |
|
| 105 | + if ( ! $sActionHook ) { |
|
| 106 | 106 | continue; |
| 107 | 107 | } |
| 108 | 108 | $aArgs[ 1 ] = $sActionHook; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $_aArgs = func_get_args(); |
| 126 | 126 | $_oCallerObject = $_aArgs[ 0 ]; |
| 127 | 127 | $_sActionHook = $_aArgs[ 1 ]; |
| 128 | - if ( ! $_sActionHook ) { |
|
| 128 | + if ( ! $_sActionHook ) { |
|
| 129 | 129 | return; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @since 2.0.0 |
| 160 | 160 | */ |
| 161 | - static public function addAndApplyFilters( /* $oCallerObject, $aFilters, $vInput, $vArgs... */ ) { |
|
| 161 | + static public function addAndApplyFilters( /* $oCallerObject, $aFilters, $vInput, $vArgs... */ ) { |
|
| 162 | 162 | |
| 163 | 163 | $_aArgs = func_get_args(); |
| 164 | 164 | // $oCallerObject = $_aArgs[ 0 ]; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $_vInput = $_aArgs[ 2 ]; |
| 167 | 167 | |
| 168 | 168 | foreach( ( array ) $_aFilters as $_sFilter ) { |
| 169 | - if ( ! $_sFilter ) { |
|
| 169 | + if ( ! $_sFilter ) { |
|
| 170 | 170 | continue; |
| 171 | 171 | } |
| 172 | 172 | $_aArgs[ 1 ] = $_sFilter; |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | * @param mixed $vData The filtering data |
| 198 | 198 | * @param mixed $vArgs The arguments. |
| 199 | 199 | */ |
| 200 | - static public function addAndApplyFilter( /* $oCallerObject, $sFilter, $vData, $vArgs... */ ) { |
|
| 200 | + static public function addAndApplyFilter( /* $oCallerObject, $sFilter, $vData, $vArgs... */ ) { |
|
| 201 | 201 | |
| 202 | 202 | // Parameters |
| 203 | 203 | $_iArgs = func_num_args(); |
| 204 | 204 | $_aArgs = func_get_args(); |
| 205 | 205 | $_oCallerObject = $_aArgs[ 0 ]; |
| 206 | 206 | $_sFilter = $_aArgs[ 1 ]; |
| 207 | - if ( ! $_sFilter ) { |
|
| 207 | + if ( ! $_sFilter ) { |
|
| 208 | 208 | return $_aArgs[ 2 ]; |
| 209 | 209 | } |
| 210 | 210 | |
@@ -284,6 +284,7 @@ |
||
| 284 | 284 | * Checkes whether the passed base url name is of the admin index page. |
| 285 | 285 | * @since 3.5.3 |
| 286 | 286 | * return boolean Whether the passed base url name is of the admin index page. |
| 287 | + * @param string $sPageNow |
|
| 287 | 288 | */ |
| 288 | 289 | static private function _isInAdminIndex( $sPageNow ) { |
| 289 | 290 | return in_array( |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | 'getPostTypeByTypeNow', |
| 58 | 58 | 'getPostTypeByScreenObject', |
| 59 | 59 | 'getPostTypeByREQUEST', |
| 60 | - 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
| 60 | + 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
| 61 | 61 | ); |
| 62 | 62 | foreach ( $_aMethodsToTry as $_sMethodName ) { |
| 63 | 63 | $_sPostType = call_user_func( array( __CLASS__, $_sMethodName ) ); |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * @param array|string The post type slug(s) to check. If this is empty, the method just checks the current page is a taxonomy page. |
| 122 | 122 | * @return boolean |
| 123 | 123 | */ |
| 124 | - static public function isCustomTaxonomyPage( $asPostTypes=array() ) { |
|
| 124 | + static public function isCustomTaxonomyPage( $asPostTypes = array() ) { |
|
| 125 | 125 | |
| 126 | - if ( ! in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', ) ) ) { |
|
| 126 | + if ( !in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php',) ) ) { |
|
| 127 | 127 | return false; |
| 128 | 128 | } |
| 129 | 129 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | * Otherwise, it will check if the page belongs to the given post type(s). |
| 139 | 139 | * @return boolean |
| 140 | 140 | */ |
| 141 | - static public function isPostDefinitionPage( $asPostTypes=array() ) { |
|
| 141 | + static public function isPostDefinitionPage( $asPostTypes = array() ) { |
|
| 142 | 142 | |
| 143 | 143 | // If it's not the post definition page, |
| 144 | - if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
| 144 | + if ( !in_array( self::getPageNow(), array( 'post.php', 'post-new.php',) ) ) { |
|
| 145 | 145 | return false; |
| 146 | 146 | } |
| 147 | 147 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @since 3.0.0 |
| 176 | 176 | */ |
| 177 | - static public function isPostListingPage( $asPostTypes=array() ) { |
|
| 177 | + static public function isPostListingPage( $asPostTypes = array() ) { |
|
| 178 | 178 | |
| 179 | 179 | if ( 'edit.php' != self::getPageNow() ) { |
| 180 | 180 | return false; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
| 184 | 184 | |
| 185 | - if ( ! isset( $_GET[ 'post_type' ] ) ) { |
|
| 185 | + if ( !isset( $_GET[ 'post_type' ] ) ) { |
|
| 186 | 186 | return in_array( 'post', $_aPostTypes ); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | 0 => '_getPageNow_FrontEnd', |
| 221 | 221 | 1 => '_getPageNow_BackEnd', |
| 222 | 222 | ); |
| 223 | - $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
| 223 | + $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
| 224 | 224 | self::$_sPageNow = self::$_sMethodName(); |
| 225 | 225 | return self::$_sPageNow; |
| 226 | 226 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | if ( isset( $GLBOALS[ 'page_hook' ] ) ) { |
| 317 | 317 | return is_network_admin() |
| 318 | - ? $GLBOALS[ 'page_hook' ] . '-network' |
|
| 318 | + ? $GLBOALS[ 'page_hook' ].'-network' |
|
| 319 | 319 | : $GLBOALS[ 'page_hook' ]; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -329,11 +329,11 @@ discard block |
||
| 329 | 329 | * @since 3.7.0 |
| 330 | 330 | * @return boolean |
| 331 | 331 | */ |
| 332 | - static public function doesMetaBoxExist( $sContext='' ) { |
|
| 332 | + static public function doesMetaBoxExist( $sContext = '' ) { |
|
| 333 | 333 | |
| 334 | 334 | $_aDimensions = array( 'wp_meta_boxes', $GLOBALS[ 'page_hook' ] ); |
| 335 | 335 | if ( $sContext ) { |
| 336 | - $_aDimensions[] = $sContext; |
|
| 336 | + $_aDimensions[ ] = $sContext; |
|
| 337 | 337 | } |
| 338 | 338 | $_aSideMetaBoxes = self::getElementAsArray( |
| 339 | 339 | $GLOBALS, |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | static public function getCurrentPostType() { |
| 31 | 31 | |
| 32 | - if ( isset( self::$_sCurrentPostType ) ) { |
|
| 32 | + if ( isset( self::$_sCurrentPostType ) ) { |
|
| 33 | 33 | return self::$_sCurrentPostType; |
| 34 | 34 | } |
| 35 | 35 | self::$_sCurrentPostType = self::_getCurrentPostType(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | static public function isPostDefinitionPage( $asPostTypes=array() ) { |
| 142 | 142 | |
| 143 | 143 | // If it's not the post definition page, |
| 144 | - if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
| 144 | + if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
| 145 | 145 | return false; |
| 146 | 146 | } |
| 147 | 147 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
| 161 | 161 | |
| 162 | 162 | // If the parameter is empty, |
| 163 | - if ( empty( $_aPostTypes ) ) { |
|
| 163 | + if ( empty( $_aPostTypes ) ) { |
|
| 164 | 164 | return true; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -176,13 +176,13 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | static public function isPostListingPage( $asPostTypes=array() ) { |
| 178 | 178 | |
| 179 | - if ( 'edit.php' != self::getPageNow() ) { |
|
| 179 | + if ( 'edit.php' != self::getPageNow() ) { |
|
| 180 | 180 | return false; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
| 184 | 184 | |
| 185 | - if ( ! isset( $_GET[ 'post_type' ] ) ) { |
|
| 185 | + if ( ! isset( $_GET[ 'post_type' ] ) ) { |
|
| 186 | 186 | return in_array( 'post', $_aPostTypes ); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -273,11 +273,9 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | if ( is_network_admin() ) { |
| 275 | 275 | $_sNeedle = '#/wp-admin/network/?(.*?)$#i'; |
| 276 | - } |
|
| 277 | - else if ( is_user_admin() ) { |
|
| 276 | + } else if ( is_user_admin() ) { |
|
| 278 | 277 | $_sNeedle = '#/wp-admin/user/?(.*?)$#i'; |
| 279 | - } |
|
| 280 | - else { |
|
| 278 | + } else { |
|
| 281 | 279 | $_sNeedle = '#/wp-admin/?(.*?)$#i'; |
| 282 | 280 | } |
| 283 | 281 | preg_match( $_sNeedle, $_SERVER[ 'PHP_SELF' ], $_aMatches ); |
@@ -27,6 +27,7 @@ discard block |
||
| 27 | 27 | * Sets up hooks |
| 28 | 28 | * |
| 29 | 29 | * @internal |
| 30 | + * @param AdminPageFramework_Model_Menu $oFactory |
|
| 30 | 31 | */ |
| 31 | 32 | public function __construct( $oFactory, $sActionHook='admin_menu' ) { |
| 32 | 33 | |
@@ -228,6 +229,7 @@ discard block |
||
| 228 | 229 | * @since 3.3.0 |
| 229 | 230 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
| 230 | 231 | * @since 3.7.4 Added the `$nOrder` parameter. |
| 232 | + * @param string $sMenuSlug |
|
| 231 | 233 | * @return string The page hook of the added page. |
| 232 | 234 | * @uses add_submenu_page |
| 233 | 235 | */ |
@@ -340,7 +342,7 @@ discard block |
||
| 340 | 342 | /** |
| 341 | 343 | * @since 3.7.4 |
| 342 | 344 | * @return void |
| 343 | - * @param numeric $$nOrder A user set order (menu position, index). |
|
| 345 | + * @param numeric $nOrder A user set order (menu position, index). |
|
| 344 | 346 | * @param array $aSubMenuItem The sub menu item array set in the global `$submenu` array. |
| 345 | 347 | */ |
| 346 | 348 | private function _setSubMenuPageByIndex( $nOrder, $aSubMenuItem, $sMenuSlug ) { |
@@ -464,6 +466,7 @@ discard block |
||
| 464 | 466 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
| 465 | 467 | * @since 3.5.3 Added the `$bShowInMenu` parameter. |
| 466 | 468 | * @since 3.7.4 Added the `$nOrder` parameter. |
| 469 | + * @param string $sMenuSlug |
|
| 467 | 470 | * @return void |
| 468 | 471 | */ |
| 469 | 472 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @internal |
| 30 | 30 | */ |
| 31 | - public function __construct( $oFactory, $sActionHook='admin_menu' ) { |
|
| 31 | + public function __construct( $oFactory, $sActionHook = 'admin_menu' ) { |
|
| 32 | 32 | |
| 33 | 33 | $this->oFactory = $oFactory; |
| 34 | 34 | |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // Apply filters to let other scripts add sub menu pages. |
| 73 | 73 | $this->oFactory->oProp->aPages = $this->addAndApplyFilter( |
| 74 | - $this->oFactory, // caller object |
|
| 75 | - "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 74 | + $this->oFactory, // caller object |
|
| 75 | + "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 76 | 76 | $this->oFactory->oProp->aPages // arguments |
| 77 | 77 | ); |
| 78 | 78 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | foreach ( $this->oFactory->oProp->aPages as $_aPage ) { |
| 122 | 122 | |
| 123 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 123 | + if ( !isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | $this->oFactory->oProp->sDefaultPageSlug = $_aPage[ 'page_slug' ]; |
@@ -140,12 +140,12 @@ discard block |
||
| 140 | 140 | private function _registerRootMenuPage() { |
| 141 | 141 | |
| 142 | 142 | $this->oFactory->oProp->aRootMenu[ '_page_hook' ] = add_menu_page( |
| 143 | - $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 144 | - $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 145 | - $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 146 | - $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 147 | - '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 148 | - $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 143 | + $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 144 | + $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 145 | + $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 146 | + $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 147 | + '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 148 | + $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 149 | 149 | $this->getElement( |
| 150 | 150 | $this->oFactory->oProp->aRootMenu, |
| 151 | 151 | 'iPosition', |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | private function _registerSubMenuItem( array $aArgs ) { |
| 170 | 170 | |
| 171 | - if ( ! current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 171 | + if ( !current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 172 | 172 | return ''; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -233,16 +233,16 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) { |
| 235 | 235 | |
| 236 | - if ( ! $sPageSlug ) { |
|
| 236 | + if ( !$sPageSlug ) { |
|
| 237 | 237 | return ''; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $_sPageHook = add_submenu_page( |
| 241 | - $sRootPageSlug, // the root (parent) page slug |
|
| 242 | - $sPageTitle, // page title |
|
| 243 | - $sMenuTitle, // menu title |
|
| 244 | - $sCapability, // capability |
|
| 245 | - $sPageSlug, // menu slug |
|
| 241 | + $sRootPageSlug, // the root (parent) page slug |
|
| 242 | + $sPageTitle, // page title |
|
| 243 | + $sMenuTitle, // menu title |
|
| 244 | + $sCapability, // capability |
|
| 245 | + $sPageSlug, // menu slug |
|
| 246 | 246 | /** |
| 247 | 247 | * In admin.php ( line 149 of WordPress v3.6.1 ), do_action($page_hook) ( where $page_hook is $_sPageHook ) |
| 248 | 248 | * will be executed and it triggers the __call() magic method with the method name of "md5 class hash + _page_ + this page slug". |
@@ -267,14 +267,14 @@ discard block |
||
| 267 | 267 | $_aRemovedMenuItem = $this->_removePageSubmenuItem( $_nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ); |
| 268 | 268 | |
| 269 | 269 | // If the visibility option is `false`, remove the one just added from the sub-menu global array |
| 270 | - if ( ! $bShowInMenu && ! $this->_isCurrentPage( $sPageSlug ) ) { |
|
| 270 | + if ( !$bShowInMenu && !$this->_isCurrentPage( $sPageSlug ) ) { |
|
| 271 | 271 | return $_sPageHook; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Set the order index in the element of the `submenu` global array. |
| 275 | 275 | $this->_setSubMenuPageByIndex( |
| 276 | - $nOrder, // user-set order |
|
| 277 | - $_aRemovedMenuItem, // will be reassign with a new index |
|
| 276 | + $nOrder, // user-set order |
|
| 277 | + $_aRemovedMenuItem, // will be reassign with a new index |
|
| 278 | 278 | $sMenuSlug |
| 279 | 279 | ); |
| 280 | 280 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | add_action( |
| 315 | 315 | 'current_screen', |
| 316 | - array( $this->oFactory, "load_pre_" . $sPageSlug ), |
|
| 316 | + array( $this->oFactory, "load_pre_".$sPageSlug ), |
|
| 317 | 317 | 20 |
| 318 | 318 | ); |
| 319 | 319 | |
@@ -322,15 +322,15 @@ discard block |
||
| 322 | 322 | * Set a low priority because the user may add in-page tabs in their callback method of this action hook. |
| 323 | 323 | * @since 3.6.3 |
| 324 | 324 | */ |
| 325 | - add_action( "load_" . $sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 325 | + add_action( "load_".$sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 326 | 326 | |
| 327 | 327 | // 3.6.3+ |
| 328 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 329 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 328 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 329 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 330 | 330 | |
| 331 | 331 | $this->oFactory->oProp->aPageHooks[ $sPageSlug ] = $this->getAOrB( |
| 332 | 332 | is_network_admin(), |
| 333 | - $sPageHook . '-network', |
|
| 333 | + $sPageHook.'-network', |
|
| 334 | 334 | $sPageHook |
| 335 | 335 | ); |
| 336 | 336 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | $_nNewIndex = $this->getUnusedNumericIndex( |
| 349 | 349 | $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ), // subject array to parser |
| 350 | - $nOrder, // a desired menu position |
|
| 350 | + $nOrder, // a desired menu position |
|
| 351 | 351 | 5 // offset |
| 352 | 352 | ); |
| 353 | 353 | |
@@ -361,9 +361,9 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | private function _getSubMenuPageIndex( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) { |
| 363 | 363 | |
| 364 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 364 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 365 | 365 | |
| 366 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
| 366 | + if ( !isset( $_aSubMenu[ 3 ] ) ) { |
|
| 367 | 367 | continue; |
| 368 | 368 | } |
| 369 | 369 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
| 396 | 396 | * @return array removed menu item. |
| 397 | 397 | */ |
| 398 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
| 398 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
| 399 | 399 | |
| 400 | 400 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
| 401 | 401 | $nSubMenuPageIndex, |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
| 470 | 470 | |
| 471 | - if ( ! $bShowInMenu ) { |
|
| 471 | + if ( !$bShowInMenu ) { |
|
| 472 | 472 | return; |
| 473 | 473 | } |
| 474 | 474 | |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | 5 // offset |
| 484 | 484 | ); |
| 485 | 485 | $_aSubMenuItems[ $_nIndex ] = array( |
| 486 | - $sTitle, // 0 |
|
| 487 | - $sCapability, // 1 |
|
| 488 | - $sHref, // 2 |
|
| 486 | + $sTitle, // 0 |
|
| 487 | + $sCapability, // 1 |
|
| 488 | + $sHref, // 2 |
|
| 489 | 489 | ); |
| 490 | 490 | $GLOBALS[ 'submenu' ][ $sMenuSlug ] = $_aSubMenuItems; |
| 491 | 491 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | foreach ( $this->oFactory->oProp->aPages as $_aPage ) { |
| 122 | 122 | |
| 123 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 123 | + if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | $this->oFactory->oProp->sDefaultPageSlug = $_aPage[ 'page_slug' ]; |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
| 365 | 365 | |
| 366 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
| 366 | + if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
| 367 | 367 | continue; |
| 368 | 368 | } |
| 369 | 369 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $sPageTitle, |
| 379 | 379 | $sPageSlug, |
| 380 | 380 | ); |
| 381 | - if ( $_aA !== $_aB ) { |
|
| 381 | + if ( $_aA !== $_aB ) { |
|
| 382 | 382 | continue; |
| 383 | 383 | } |
| 384 | 384 | return $_iIndex; |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
| 396 | 396 | * @return array removed menu item. |
| 397 | 397 | */ |
| 398 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
| 398 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
| 399 | 399 | |
| 400 | 400 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
| 401 | 401 | $nSubMenuPageIndex, |
@@ -26,6 +26,7 @@ |
||
| 26 | 26 | * Sets up hooks and properties. |
| 27 | 27 | * |
| 28 | 28 | * @internal |
| 29 | + * @param AdminPageFramework_PostType_Model $oFactory |
|
| 29 | 30 | */ |
| 30 | 31 | public function __construct( $oFactory ) { |
| 31 | 32 | |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | ); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - /** |
|
| 280 | + /** |
|
| 281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
| 282 | 282 | * |
| 283 | 283 | * @since 3.5.6 |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function __construct( $oFactory ) { |
| 31 | 31 | |
| 32 | - if ( ! $this->_shouldProceed( $oFactory ) ) { |
|
| 32 | + if ( !$this->_shouldProceed( $oFactory ) ) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | private function _shouldProceed( $oFactory ) { |
| 56 | 56 | |
| 57 | - if ( ! $oFactory->oProp->bIsAdmin ) { |
|
| 57 | + if ( !$oFactory->oProp->bIsAdmin ) { |
|
| 58 | 58 | return false; |
| 59 | 59 | } |
| 60 | - if ( ! $oFactory->oProp->sCallerPath ) { |
|
| 60 | + if ( !$oFactory->oProp->sCallerPath ) { |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | return 'plugin' === $oFactory->oProp->sScriptType; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // If the execution flow in the plugin activation hook, schedule flushing rewrite rules. |
| 90 | - if ( did_action( 'activate_' . plugin_basename( $this->oFactory->oProp->sCallerPath ) ) ) { |
|
| 90 | + if ( did_action( 'activate_'.plugin_basename( $this->oFactory->oProp->sCallerPath ) ) ) { |
|
| 91 | 91 | add_action( 'shutdown', array( $this, '_replyToFlushRewriteRules' ) ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | * @callback action activate_{plugin base name} |
| 73 | 73 | * @since 3.7.6 |
| 74 | 74 | */ |
| 75 | - public function _replyToSetUpPostType() { |
|
| 75 | + public function _replyToSetUpPostType() { |
|
| 76 | 76 | do_action( "set_up_{$this->oFactory->oProp->sClassName}", $this ); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -26,6 +26,7 @@ discard block |
||
| 26 | 26 | * Sets up hooks and properties. |
| 27 | 27 | * |
| 28 | 28 | * @internal |
| 29 | + * @param AdminPageFramework_PostType_Model $oFactory |
|
| 29 | 30 | */ |
| 30 | 31 | public function __construct( $oFactory ) { |
| 31 | 32 | |
@@ -82,6 +83,7 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | /** |
| 84 | 85 | * @since 3.7.4 |
| 86 | + * @param string $sSubMenuSlug |
|
| 85 | 87 | */ |
| 86 | 88 | private function _setSubMenuSlugForSorting( $sSubMenuSlug ) { |
| 87 | 89 | |
@@ -94,6 +96,7 @@ discard block |
||
| 94 | 96 | |
| 95 | 97 | /** |
| 96 | 98 | * @since 3.7.4 |
| 99 | + * @param string $sSubMenuSlug |
|
| 97 | 100 | */ |
| 98 | 101 | private function _setSubMenuItemIndex( $sSubMenuSlug ) { |
| 99 | 102 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $this->oFactory = $oFactory; |
| 33 | 33 | |
| 34 | - if ( ! $oFactory->oProp->bIsAdmin ) { |
|
| 34 | + if ( !$oFactory->oProp->bIsAdmin ) { |
|
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | add_action( |
| 49 | 49 | 'admin_menu', |
| 50 | - array( $this, 'sortAdminSubMenu' ), // defined in the framework utility class. |
|
| 50 | + array( $this, 'sortAdminSubMenu' ), // defined in the framework utility class. |
|
| 51 | 51 | 9999 |
| 52 | 52 | ); |
| 53 | 53 | |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // Check the post type `show_ui` and other related UI arguments. |
| 64 | 64 | $_bsShowInMeenu = $this->getShowInMenuPostTypeArgument( $this->oFactory->oProp->aPostTypeArgs ); |
| 65 | - if ( ! $_bsShowInMeenu ) { |
|
| 65 | + if ( !$_bsShowInMeenu ) { |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // If the user sets a menu slug to the 'show_in_menu' argument, use that. |
| 70 | 70 | // It is used to set a custom post type sub-menu belong to another menu. |
| 71 | - $_sSubMenuSlug = is_string( $_bsShowInMeenu ) |
|
| 71 | + $_sSubMenuSlug = is_string( $_bsShowInMeenu ) |
|
| 72 | 72 | ? $_bsShowInMeenu |
| 73 | - : 'edit.php?post_type=' . $this->oFactory->oProp->sPostType; |
|
| 73 | + : 'edit.php?post_type='.$this->oFactory->oProp->sPostType; |
|
| 74 | 74 | |
| 75 | 75 | // Set the index to the framework specific global array for sorting. |
| 76 | 76 | $this->_setSubMenuSlugForSorting( $_sSubMenuSlug ); |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | // @remark This is the partial link url set in the third element ( index of 2 ) in the third dimension of submenu global array element. |
| 133 | 133 | // This is not the submenu slug. |
| 134 | - $_sLinkSlugManage = 'edit.php?post_type=' . $this->oFactory->oProp->sPostType; |
|
| 134 | + $_sLinkSlugManage = 'edit.php?post_type='.$this->oFactory->oProp->sPostType; |
|
| 135 | 135 | |
| 136 | 136 | $_aLinkSlugs = array( |
| 137 | 137 | $_sLinkSlugManage => $_nSubMenuOrderManage, |
| 138 | - 'post-new.php?post_type=' . $this->oFactory->oProp->sPostType => $_nSubMenuOrderAddNew, |
|
| 138 | + 'post-new.php?post_type='.$this->oFactory->oProp->sPostType => $_nSubMenuOrderAddNew, |
|
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | // If the user does not set a custom value, unset it |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // If the user does not want to show the Add New sub menu, no need to change the order. |
| 147 | - if ( ! $_bShowAddNew || 10 == $_nSubMenuOrderAddNew ) { |
|
| 148 | - unset( $_aLinkSlugs[ 'post-new.php?post_type=' . $this->oFactory->oProp->sPostType ] ); |
|
| 147 | + if ( !$_bShowAddNew || 10 == $_nSubMenuOrderAddNew ) { |
|
| 148 | + unset( $_aLinkSlugs[ 'post-new.php?post_type='.$this->oFactory->oProp->sPostType ] ); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | return $_aLinkSlugs; |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | private function _setSubMenuIndexByLinksSlugs( $sSubMenuSlug, array $aLinkSlugs ) { |
| 167 | 167 | |
| 168 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sSubMenuSlug ) ) as $_nIndex => $_aSubMenuItem ) { |
|
| 168 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sSubMenuSlug ) ) as $_nIndex => $_aSubMenuItem ) { |
|
| 169 | 169 | |
| 170 | - foreach( $aLinkSlugs as $_sLinkSlug => $_nOrder ) { |
|
| 170 | + foreach ( $aLinkSlugs as $_sLinkSlug => $_nOrder ) { |
|
| 171 | 171 | |
| 172 | 172 | $_bIsSet = $this->_setSubMenuIndexByLinksSlug( $sSubMenuSlug, $_nIndex, $_aSubMenuItem, $_sLinkSlug, $_nOrder ); |
| 173 | 173 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | private function _setSubMenuIndexByLinksSlug( $sSubMenuSlug, $nIndex, $aSubMenuItem, $sLinkSlug, $nOrder ) { |
| 194 | 194 | |
| 195 | 195 | // The third item is the link slug. |
| 196 | - if ( ! isset( $aSubMenuItem[ 2 ] ) ) { |
|
| 196 | + if ( !isset( $aSubMenuItem[ 2 ] ) ) { |
|
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | if ( $aSubMenuItem[ 2 ] !== $sLinkSlug ) { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @subpackage PostType |
| 16 | 16 | * @internal |
| 17 | 17 | */ |
| 18 | -class AdminPageFramework_PostType_Model__SubMenuOrder extends AdminPageFramework_FrameworkUtility { |
|
| 18 | +class AdminPageFramework_PostType_Model__SubMenuOrder extends AdminPageFramework_FrameworkUtility { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Stores a post type factory object. |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * @since 3.7.4 |
| 97 | 97 | */ |
| 98 | - private function _setSubMenuItemIndex( $sSubMenuSlug ) { |
|
| 98 | + private function _setSubMenuItemIndex( $sSubMenuSlug ) { |
|
| 99 | 99 | |
| 100 | 100 | // Only if custom values are set, set them. |
| 101 | 101 | $this->_setSubMenuIndexByLinksSlugs( |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | private function _setSubMenuIndexByLinksSlug( $sSubMenuSlug, $nIndex, $aSubMenuItem, $sLinkSlug, $nOrder ) { |
| 194 | 194 | |
| 195 | 195 | // The third item is the link slug. |
| 196 | - if ( ! isset( $aSubMenuItem[ 2 ] ) ) { |
|
| 196 | + if ( ! isset( $aSubMenuItem[ 2 ] ) ) { |
|
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | if ( $aSubMenuItem[ 2 ] !== $sLinkSlug ) { |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * @param string $sPluginFilePath The plugin file path. |
| 39 | 39 | * @param string $sPluginHookPrefix The plugin hook slug without underscore. This will be used to construct hook names. |
| 40 | 40 | * @param string $sSetUpHook The action hook name for the setUp callback. Default 'plugins_loaded'. |
| 41 | - * @param string $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
|
| 41 | + * @param integer $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
|
| 42 | 42 | */ |
| 43 | 43 | public function __construct( $sPluginFilePath, $sPluginHookPrefix='', $sSetUpHook='plugins_loaded', $iPriority=10 ) { |
| 44 | 44 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param string $sSetUpHook The action hook name for the setUp callback. Default 'plugins_loaded'. |
| 41 | 41 | * @param string $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
| 42 | 42 | */ |
| 43 | - public function __construct( $sPluginFilePath, $sPluginHookPrefix='', $sSetUpHook='plugins_loaded', $iPriority=10 ) { |
|
| 43 | + public function __construct( $sPluginFilePath, $sPluginHookPrefix = '', $sSetUpHook = 'plugins_loaded', $iPriority = 10 ) { |
|
| 44 | 44 | |
| 45 | 45 | // Check if it has been loaded. |
| 46 | 46 | if ( $this->_hasLoaded() ) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | register_deactivation_hook( $this->sFilePath, array( $this, 'replyToPluginDeactivation' ) ); |
| 77 | 77 | |
| 78 | 78 | // 8. Schedule to load plugin specific components. |
| 79 | - if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 79 | + if ( !$this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 80 | 80 | $this->_replyToLoadPluginComponents(); |
| 81 | 81 | } else { |
| 82 | 82 | add_action( $this->sSetUpHook, array( $this, '_replyToLoadPluginComponents' ), $this->iPriority ); |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | protected function _registerClasses() { |
| 117 | 117 | |
| 118 | 118 | // This class should be used in the framework bootstrap so disabling the auto-load option for performance. |
| 119 | - if ( ! class_exists( 'AdminPageFramework_RegisterClasses', false ) ) { |
|
| 119 | + if ( !class_exists( 'AdminPageFramework_RegisterClasses', false ) ) { |
|
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Register classes |
| 124 | 124 | new AdminPageFramework_RegisterClasses( |
| 125 | - $this->getScanningDirs(), // scanning directory paths |
|
| 126 | - array(), // autoloader options |
|
| 125 | + $this->getScanningDirs(), // scanning directory paths |
|
| 126 | + array(), // autoloader options |
|
| 127 | 127 | $this->getClasses() // pre-generated class list |
| 128 | 128 | ); |
| 129 | 129 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | register_deactivation_hook( $this->sFilePath, array( $this, 'replyToPluginDeactivation' ) ); |
| 77 | 77 | |
| 78 | 78 | // 8. Schedule to load plugin specific components. |
| 79 | - if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 79 | + if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 80 | 80 | $this->_replyToLoadPluginComponents(); |
| 81 | 81 | } else { |
| 82 | 82 | add_action( $this->sSetUpHook, array( $this, '_replyToLoadPluginComponents' ), $this->iPriority ); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | protected function _hasLoaded() { |
| 101 | 101 | |
| 102 | 102 | static $_bLoaded = false; |
| 103 | - if ( $_bLoaded ) { |
|
| 103 | + if ( $_bLoaded ) { |
|
| 104 | 104 | return true; |
| 105 | 105 | } |
| 106 | 106 | $_bLoaded = true; |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | * |
| 67 | 67 | * @since DEVVER |
| 68 | 68 | * @see https://codex.wordpress.org/Plugin_API/Admin_Screen_Reference |
| 69 | - * @param array|strin $asScreenIDs Screen IDs or page slug. |
|
| 69 | + * @param string[] $asScreenIDs Screen IDs or page slug. |
|
| 70 | 70 | * @param string $sPointerID A unique pointer ID. |
| 71 | 71 | * @Param array $aPointerData The pointer data. |
| 72 | 72 | */ |
@@ -173,7 +173,7 @@ |
||
| 173 | 173 | get_current_user_id(), |
| 174 | 174 | 'dismissed_wp_pointers', |
| 175 | 175 | true |
| 176 | - ) |
|
| 176 | + ) |
|
| 177 | 177 | ); |
| 178 | 178 | $_aValidPointers = array( |
| 179 | 179 | 'pointers' => array(), |
@@ -91,18 +91,18 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private function _setHooks( $aScreenIDs ) { |
| 93 | 93 | |
| 94 | - foreach( $aScreenIDs as $_sScreenID ) { |
|
| 95 | - if ( ! $_sScreenID ) { |
|
| 94 | + foreach ( $aScreenIDs as $_sScreenID ) { |
|
| 95 | + if ( !$_sScreenID ) { |
|
| 96 | 96 | continue; |
| 97 | 97 | } |
| 98 | 98 | add_filter( |
| 99 | - get_class( $this ) . '-' . $_sScreenID, |
|
| 99 | + get_class( $this ).'-'.$_sScreenID, |
|
| 100 | 100 | array( $this, '_replyToSetPointer' ) |
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( ! $this->_hasBeenCalled() ) { |
|
| 105 | + if ( !$this->_hasBeenCalled() ) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $_aPointers = $this->_getValidPointers( $this->_getPointers() ); |
| 148 | 148 | |
| 149 | - if ( empty( $_aPointers ) || ! is_array( $_aPointers ) ) { |
|
| 149 | + if ( empty( $_aPointers ) || !is_array( $_aPointers ) ) { |
|
| 150 | 150 | return; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | $_oScreen = get_current_screen(); |
| 166 | 166 | $_sScreenID = $_oScreen->id; |
| 167 | 167 | if ( in_array( $_sScreenID, $this->aScreenIDs ) ) { |
| 168 | - return apply_filters( get_class( $this ) . '-' . $_sScreenID, array() ); |
|
| 168 | + return apply_filters( get_class( $this ).'-'.$_sScreenID, array() ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if ( isset( $_GET[ 'page' ] ) ) { |
| 172 | - return apply_filters( get_class( $this ) . '-' . $_GET[ 'page' ], array() ); |
|
| 172 | + return apply_filters( get_class( $this ).'-'.$_GET[ 'page' ], array() ); |
|
| 173 | 173 | } |
| 174 | 174 | return array(); |
| 175 | 175 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | private function _getValidPointers( $_aPointers ) { |
| 183 | 183 | |
| 184 | 184 | // Get dismissed pointers |
| 185 | - $_aDismissed = explode( |
|
| 185 | + $_aDismissed = explode( |
|
| 186 | 186 | ',', |
| 187 | 187 | ( string ) get_user_meta( |
| 188 | 188 | get_current_user_id(), |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $_aPointer[ 'pointer_id' ] = $_iPointerID; |
| 210 | 210 | |
| 211 | 211 | // Add the pointer to $_aValidPointers array |
| 212 | - $_aValidPointers[] = $_aPointer; |
|
| 212 | + $_aValidPointers[ ] = $_aPointer; |
|
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | return $_aValidPointers; |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | * @since DEVVER |
| 280 | 280 | * @return string |
| 281 | 281 | */ |
| 282 | - public function _getInlineScript( $aPointers=array() ) { |
|
| 282 | + public function _getInlineScript( $aPointers = array() ) { |
|
| 283 | 283 | |
| 284 | - $_aJSArray = json_encode( $aPointers ); |
|
| 284 | + $_aJSArray = json_encode( $aPointers ); |
|
| 285 | 285 | |
| 286 | 286 | /** |
| 287 | 287 | * Checks checkboxes in siblings. |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public function __construct( $asScreenIDs, $sPointerID, array $aPointerData ) { |
| 63 | 63 | |
| 64 | 64 | // Bail if the WordPress version is less than 3.3, |
| 65 | - if ( version_compare( $GLOBALS[ 'wp_version' ], '3.3', '<' ) ) { |
|
| 65 | + if ( version_compare( $GLOBALS[ 'wp_version' ], '3.3', '<' ) ) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | */ |
| 95 | 95 | private function _setHooks( $aScreenIDs ) { |
| 96 | - foreach( $aScreenIDs as $_sScreenID ) { |
|
| 96 | + foreach( $aScreenIDs as $_sScreenID ) { |
|
| 97 | 97 | if ( ! $_sScreenID ) { |
| 98 | 98 | continue; |
| 99 | 99 | } |
@@ -134,6 +134,7 @@ discard block |
||
| 134 | 134 | * Returns a php warning if present. |
| 135 | 135 | * @since 3.5.3 |
| 136 | 136 | * @internal |
| 137 | + * @param string $sType |
|
| 137 | 138 | * @return string The warning. |
| 138 | 139 | */ |
| 139 | 140 | private function _getWarningByType( $sType ) { |
@@ -226,6 +227,7 @@ discard block |
||
| 226 | 227 | * if it returns non true (false), it stores the subject warning and returns the array holding the warnings. |
| 227 | 228 | * |
| 228 | 229 | * @since 3.4.6 |
| 230 | + * @param string $sFuncName |
|
| 229 | 231 | * @return array The warning array. |
| 230 | 232 | */ |
| 231 | 233 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
@@ -285,6 +287,7 @@ discard block |
||
| 285 | 287 | /** |
| 286 | 288 | * Deactivates the plugin. |
| 287 | 289 | * @since 3.4.6 |
| 290 | + * @param string $sPluginFilePath |
|
| 288 | 291 | */ |
| 289 | 292 | public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
| 290 | 293 | |
@@ -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 | |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @since 3.4.6 |
| 78 | 78 | */ |
| 79 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
| 79 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
| 80 | 80 | |
| 81 | 81 | // Avoid undefined index warnings. |
| 82 | 82 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
| 83 | 83 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
| 84 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
| 84 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
| 85 | 85 | if ( isset( $aRequirements[ $_sName ] ) ) { |
| 86 | 86 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
| 87 | 87 | } |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | $_aWarnings = array(); |
| 106 | 106 | |
| 107 | 107 | // PHP, WordPress, MySQL |
| 108 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
| 109 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
| 110 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
| 108 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
| 109 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
| 110 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
| 111 | 111 | |
| 112 | 112 | // Ensure necessary array elements. |
| 113 | 113 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | // Check the rest. |
| 121 | 121 | $_aWarnings = array_merge( |
| 122 | 122 | $_aWarnings, |
| 123 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
| 124 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
| 125 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
| 126 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
| 123 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
| 124 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
| 125 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
| 126 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @return string The warning. |
| 138 | 138 | */ |
| 139 | 139 | private function _getWarningByType( $sType ) { |
| 140 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
| 140 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
| 141 | 141 | return ''; |
| 142 | 142 | } |
| 143 | 143 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @since 3.4.6 |
| 165 | 165 | */ |
| 166 | 166 | private function _checkWordPressVersion( $sWordPressVersion ) { |
| 167 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
| 167 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
| 232 | 232 | $_aWarnings = array(); |
| 233 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
| 234 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
| 235 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
| 233 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
| 234 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
| 235 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | return $_aWarnings; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function _replyToPrintAdminNotices() { |
| 254 | 254 | |
| 255 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
| 255 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
| 256 | 256 | if ( empty( $_aWarnings ) ) { |
| 257 | 257 | return; |
| 258 | 258 | } |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | private function _getWarnings() { |
| 272 | 272 | |
| 273 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
| 273 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
| 274 | 274 | if ( empty( $_aWarnings ) ) { |
| 275 | 275 | return ''; |
| 276 | 276 | } |
| 277 | - $_sScripTitle = $this->_sScriptName |
|
| 278 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
| 277 | + $_sScripTitle = $this->_sScriptName |
|
| 278 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
| 279 | 279 | : ''; |
| 280 | 280 | return $_sScripTitle |
| 281 | 281 | . implode( '<br />', $_aWarnings ); |
@@ -286,12 +286,12 @@ discard block |
||
| 286 | 286 | * Deactivates the plugin. |
| 287 | 287 | * @since 3.4.6 |
| 288 | 288 | */ |
| 289 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
| 289 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
| 290 | 290 | |
| 291 | 291 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
| 292 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
| 293 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
| 294 | - if ( ! @include( ABSPATH . '/wp-admin/includes/plugin.php' ) ) { |
|
| 292 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
| 293 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
| 294 | + if ( !@include( ABSPATH.'/wp-admin/includes/plugin.php' ) ) { |
|
| 295 | 295 | return; |
| 296 | 296 | } |
| 297 | 297 | } |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | // Before that, we can display messages to the user. |
| 302 | 302 | if ( $bIsOnActivation ) { |
| 303 | 303 | |
| 304 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
| 305 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
| 304 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
| 305 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
| 306 | 306 | |
| 307 | 307 | } |
| 308 | 308 | |
@@ -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 | |
@@ -25,6 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Sets up hooks and properties. |
| 28 | + * @param AdminPageFrameworkLoader_AdminPage $oFactory |
|
| 28 | 29 | */ |
| 29 | 30 | public function __construct( $oFactory, array $aPageArguments ) { |
| 30 | 31 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function __construct( $oFactory, array $aPageArguments ) { |
| 30 | 30 | |
| 31 | 31 | $this->oFactory = $oFactory; |
| 32 | - $this->sPageSlug = $aPageArguments['page_slug']; |
|
| 32 | + $this->sPageSlug = $aPageArguments[ 'page_slug' ]; |
|
| 33 | 33 | $this->_addPage( $aPageArguments ); |
| 34 | 34 | $this->construct( $oFactory ); |
| 35 | 35 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function replyToLoadResources( $oFactory ) { |
| 60 | 60 | |
| 61 | - $_sCSSPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/' . $this->sPageSlug . '.css'; |
|
| 62 | - if ( ! file_exists( $_sCSSPath ) ) { |
|
| 61 | + $_sCSSPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/'.$this->sPageSlug.'.css'; |
|
| 62 | + if ( !file_exists( $_sCSSPath ) ) { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | 65 | $this->oFactory->enqueueStyle( |