@@ -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 ); |
@@ -281,6 +281,8 @@ discard block |
||
281 | 281 | * @remark Used by the setInPageTabsVisibility() method. |
282 | 282 | * @since 2.0.0 |
283 | 283 | * @since 2.1.5 The $oCaller parameter was added. |
284 | + * @param AdminPageFramework_Router $oCaller |
|
285 | + * @param string $sClassName |
|
284 | 286 | */ |
285 | 287 | public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
286 | 288 | |
@@ -419,6 +421,7 @@ discard block |
||
419 | 421 | * |
420 | 422 | * This is to support transient form data which disappears with the set timeout. |
421 | 423 | * |
424 | + * @param string $sOptionType |
|
422 | 425 | * @return array The retrieved options array. |
423 | 426 | */ |
424 | 427 | private function _getOptionsByType( $sOptionType ) { |
@@ -486,6 +489,7 @@ discard block |
||
486 | 489 | /** |
487 | 490 | * |
488 | 491 | * @since 3.5.9 |
492 | + * @param string $sOptionType |
|
489 | 493 | * @return boolean True if saved; otherwise, false. |
490 | 494 | */ |
491 | 495 | private function _updateOptionsByType( $aOptions, $sOptionType ) { |
@@ -581,6 +585,7 @@ discard block |
||
581 | 585 | * @since 2.1.5 Made it public and moved from the AdminPageFramework_Page class since this method is used by the AdminPageFramework_HeadTab class as well. |
582 | 586 | * @internal |
583 | 587 | * @remark Used in the __call() method in the main class. |
588 | + * @param string $sPageSlug |
|
584 | 589 | * @return string The default in-page tab slug if found; otherwise, an empty string. |
585 | 590 | */ |
586 | 591 | public function getDefaultInPageTab( $sPageSlug ) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public $aDisallowedQueryKeys = array( |
220 | 220 | 'settings-updated', |
221 | - 'confirmation', // 3.3.0+ |
|
221 | + 'confirmation', // 3.3.0+ |
|
222 | 222 | 'field_errors' // 3.4.1+ |
223 | 223 | ); |
224 | 224 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * Stores the cache lifetime of the transient used for the form options when the user passes an integer to the option key parameter. |
265 | 265 | * @since 3.5.9 |
266 | 266 | */ |
267 | - public $iOptionTransientDuration = 0; |
|
267 | + public $iOptionTransientDuration = 0; |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * Constructs the instance of AdminPageFramework_Property_admin_page class object. |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * @since 2.0.0 |
274 | 274 | * @since 2.1.5 The $oCaller parameter was added. |
275 | 275 | */ |
276 | - public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
276 | + public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
277 | 277 | |
278 | 278 | // 3.7.0+ This must be set before the parent constructor. As the form arguments array uses this value. |
279 | - $this->_sFormRegistrationHook = 'load_after_' . $sClassName; |
|
279 | + $this->_sFormRegistrationHook = 'load_after_'.$sClassName; |
|
280 | 280 | |
281 | 281 | parent::__construct( |
282 | 282 | $oCaller, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | // The user want to save options in a transient. |
354 | 354 | if ( in_array( $_sType, array( 'integer' ) ) ) { |
355 | - return 'apf_' . $sClassName . '_' . get_current_user_id(); |
|
355 | + return 'apf_'.$sClassName.'_'.get_current_user_id(); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | // Unknown type - maybe the user is trying to do something advanced. |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | protected function _isAdminPage() { |
381 | 381 | |
382 | - if ( ! is_admin() ) { |
|
382 | + if ( !is_admin() ) { |
|
383 | 383 | return false; |
384 | 384 | } |
385 | 385 | return isset( $_GET[ 'page' ] ); |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | case 'transient': |
420 | 420 | return $this->getAsArray( |
421 | 421 | $this->getTransient( |
422 | - $this->sOptionKey, // transient key |
|
422 | + $this->sOptionKey, // transient key |
|
423 | 423 | array() // default |
424 | 424 | ) |
425 | 425 | ); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @since 3.1.1 Made it return a value. |
434 | 434 | * @return boolean True if saved; otherwise, false. |
435 | 435 | */ |
436 | - public function updateOption( $aOptions=null ) { |
|
436 | + public function updateOption( $aOptions = null ) { |
|
437 | 437 | |
438 | 438 | if ( $this->_bDisableSavingOptions ) { |
439 | 439 | return false; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | ); |
462 | 462 | case 'transient': |
463 | 463 | return $this->setTransient( |
464 | - $this->sOptionKey, // transient key |
|
464 | + $this->sOptionKey, // transient key |
|
465 | 465 | $aOptions, |
466 | 466 | $this->iOptionTransientDuration |
467 | 467 | ); |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @since 2.1.0 Set the default value to the parameter and if the parameter value is empty, it applies the current $_GET[ 'page' ] value. |
477 | 477 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
478 | 478 | */ |
479 | - public function isPageAdded( $sPageSlug='' ) { |
|
479 | + public function isPageAdded( $sPageSlug = '' ) { |
|
480 | 480 | |
481 | 481 | $sPageSlug = trim( $sPageSlug ); |
482 | 482 | $sPageSlug = $sPageSlug |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | public function getCurrentPageSlug() { |
497 | 497 | return $this->getElement( |
498 | - $_GET, // subject array |
|
498 | + $_GET, // subject array |
|
499 | 499 | 'page', // key |
500 | 500 | '' // default |
501 | 501 | ); |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @return string The found tab slug. An empty string if not found. |
514 | 514 | * @remark Do not return `null` when not found as some framework methods check the returned value with `isset()` and if null is given, `isset()` yields `false` while it does `true` for an empty string (''). |
515 | 515 | */ |
516 | - public function getCurrentTabSlug( $sCurrentPageSlug='' ) { |
|
516 | + public function getCurrentTabSlug( $sCurrentPageSlug = '' ) { |
|
517 | 517 | |
518 | 518 | // It is possible that the tab slug is not set if it is the default tab. |
519 | 519 | $_sTabSlug = $this->getElement( $_GET, 'tab' ); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | * |
534 | 534 | * @deprecated 3.5.3 |
535 | 535 | */ |
536 | - public function getCurrentTab( $sCurrentPageSlug='' ) { |
|
536 | + public function getCurrentTab( $sCurrentPageSlug = '' ) { |
|
537 | 537 | return $this->getCurrentTabSlug( $sCurrentPageSlug ); |
538 | 538 | } |
539 | 539 | |
@@ -548,11 +548,11 @@ discard block |
||
548 | 548 | */ |
549 | 549 | public function getDefaultInPageTab( $sPageSlug ) { |
550 | 550 | |
551 | - if ( ! $sPageSlug ) { |
|
551 | + if ( !$sPageSlug ) { |
|
552 | 552 | return ''; |
553 | 553 | } |
554 | 554 | return $this->getElement( |
555 | - $this->aDefaultInPageTabs, // subject array |
|
555 | + $this->aDefaultInPageTabs, // subject array |
|
556 | 556 | $sPageSlug, // key |
557 | 557 | '' // default |
558 | 558 | ); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @since 3.5.9 |
323 | 323 | * @return void |
324 | 324 | */ |
325 | - private function _setOptionsProperties( $aisOptionKey, $sClassName ) { |
|
325 | + private function _setOptionsProperties( $aisOptionKey, $sClassName ) { |
|
326 | 326 | |
327 | 327 | $_aArguments = is_array( $aisOptionKey ) |
328 | 328 | ? $aisOptionKey |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @since 2.1.0 Set the default value to the parameter and if the parameter value is empty, it applies the current $_GET[ 'page' ] value. |
514 | 514 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
515 | 515 | */ |
516 | - public function isPageAdded( $sPageSlug='' ) { |
|
516 | + public function isPageAdded( $sPageSlug='' ) { |
|
517 | 517 | |
518 | 518 | $sPageSlug = trim( $sPageSlug ); |
519 | 519 | $sPageSlug = $sPageSlug |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | // It is possible that the tab slug is not set if it is the default tab. |
556 | 556 | $_sTabSlug = $this->getElement( $_GET, 'tab' ); |
557 | - if ( $_sTabSlug ) { |
|
557 | + if ( $_sTabSlug ) { |
|
558 | 558 | return $_sTabSlug; |
559 | 559 | } |
560 | 560 | $sCurrentPageSlug = $sCurrentPageSlug |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function getDefaultInPageTab( $sPageSlug ) { |
587 | 587 | |
588 | - if ( ! $sPageSlug ) { |
|
588 | + if ( ! $sPageSlug ) { |
|
589 | 589 | return ''; |
590 | 590 | } |
591 | 591 | return $this->getElement( |
@@ -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, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @since 3.7.10 |
60 | 60 | * @internal |
61 | - * @return null|object |
|
61 | + * @return AdminPageFramework_Link_admin_page |
|
62 | 62 | */ |
63 | 63 | protected function _getLinkObject() { |
64 | 64 | return new AdminPageFramework_Link_admin_page( $this->oProp, $this->oMsg ); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 3.7.10 |
71 | 71 | * @internal |
72 | - * @return null|object |
|
72 | + * @return AdminPageFramework_PageLoadInfo_admin_page |
|
73 | 73 | */ |
74 | 74 | protected function _getPageLoadObject() { |
75 | 75 | return new AdminPageFramework_PageLoadInfo_admin_page( $this->oProp, $this->oMsg ); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @since 3.3.0 |
29 | 29 | */ |
30 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
30 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
31 | 31 | |
32 | 32 | $this->oProp = isset( $this->oProp ) |
33 | 33 | ? $this->oProp // for the AdminPageFramework_NetworkAdmin class |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if ( $this->oProp->bIsAdminAjax ) { |
46 | 46 | return; |
47 | 47 | } |
48 | - if ( ! $this->oProp->bIsAdmin ) { |
|
48 | + if ( !$this->oProp->bIsAdmin ) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
90 | 90 | * @internal |
91 | 91 | */ |
92 | - public function __call( $sMethodName, $aArgs=null ) { |
|
92 | + public function __call( $sMethodName, $aArgs = null ) { |
|
93 | 93 | |
94 | 94 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
95 | 95 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'load_pre_', |
101 | 101 | ); |
102 | 102 | |
103 | - switch( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
103 | + switch ( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
104 | 104 | |
105 | 105 | // A callback of the call_page_{page slug} action hook |
106 | 106 | // @deprecated 3.7.10 |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | // add_settings_section() callback |
111 | 111 | case 'section_pre_': |
112 | - return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
112 | + return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
113 | 113 | |
114 | 114 | // add_settings_field() callback - |
115 | 115 | case 'field_pre_': |
116 | - return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
116 | + return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
117 | 117 | |
118 | 118 | // load-{page} callback |
119 | 119 | case 'load_pre_': |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @since 3.5.3 |
131 | 131 | * @return string The found callback method name or the prefix of a known callback method name. An empty string if not found. |
132 | 132 | */ |
133 | - private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes=array() ) { |
|
133 | + private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes = array() ) { |
|
134 | 134 | |
135 | 135 | // @deprecated 3.7.10 |
136 | 136 | // if ( in_array( |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | // return $sMethodName; |
144 | 144 | // } |
145 | 145 | |
146 | - foreach( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
146 | + foreach ( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
147 | 147 | if ( $this->oUtil->hasPrefix( $_sMethodPrefix, $sMethodName ) ) { |
148 | 148 | return $_sMethodPrefix; |
149 | 149 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function _doPageLoadCall( $sMethodName, $sPageSlug, $sTabSlug, $oScreen ) { |
169 | 169 | |
170 | - if ( ! $this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
170 | + if ( !$this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
171 | 171 | return; |
172 | 172 | } |
173 | 173 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $this->oUtil->addAndDoActions( |
191 | 191 | $this, // the caller object |
192 | - array( "load_{$sPageSlug}_" . $this->oProp->getCurrentTabSlug( $sPageSlug ) ), |
|
192 | + array( "load_{$sPageSlug}_".$this->oProp->getCurrentTabSlug( $sPageSlug ) ), |
|
193 | 193 | $this // the admin page object - this lets third-party scripts use the framework methods. |
194 | 194 | ); |
195 | 195 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | if ( substr( $sMethodName, strlen( 'load_pre_' ) ) !== $sPageSlug ) { |
218 | 218 | return false; |
219 | 219 | } |
220 | - if ( ! isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
220 | + if ( !isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
221 | 221 | return false; |
222 | 222 | } |
223 | 223 | if ( $sScreenID !== $this->oProp->aPageHooks[ $sPageSlug ] ) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | // Nothing to do in the network admin area. |
247 | - return ! is_network_admin(); |
|
247 | + return !is_network_admin(); |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | public function _isInThePage() { |
260 | 260 | |
261 | 261 | // If the setUp method is not loaded yet, |
262 | - if ( ! did_action( 'set_up_' . $this->oProp->sClassName ) ) { |
|
262 | + if ( !did_action( 'set_up_'.$this->oProp->sClassName ) ) { |
|
263 | 263 | return true; |
264 | 264 | } |
265 | 265 | |
266 | - if ( ! isset( $_GET[ 'page' ] ) ) { |
|
266 | + if ( !isset( $_GET[ 'page' ] ) ) { |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
90 | 90 | * @internal |
91 | 91 | */ |
92 | - public function __call( $sMethodName, $aArgs=null ) { |
|
92 | + public function __call( $sMethodName, $aArgs=null ) { |
|
93 | 93 | |
94 | 94 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
95 | 95 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | return true; |
264 | 264 | } |
265 | 265 | |
266 | - if ( ! isset( $_GET[ 'page' ] ) ) { |
|
266 | + if ( ! isset( $_GET[ 'page' ] ) ) { |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 |
@@ -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 ) { |
@@ -23,6 +23,7 @@ |
||
23 | 23 | * Sets up hooks. |
24 | 24 | * |
25 | 25 | * @since 3.5.0 |
26 | + * @param AdminPageFramework_Property_taxonomy_field $oProp |
|
26 | 27 | */ |
27 | 28 | public function __construct( $oProp ) { |
28 | 29 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | parent::__construct( $oProp ); |
30 | 30 | |
31 | - if ( ! $this->oProp->bIsAdmin ) { |
|
31 | + if ( !$this->oProp->bIsAdmin ) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ); |
40 | 40 | |
41 | 41 | add_action( |
42 | - 'set_up_' . $this->oProp->sClassName, |
|
42 | + 'set_up_'.$this->oProp->sClassName, |
|
43 | 43 | array( $this, '_replyToSetUpHooks' ) |
44 | 44 | ); |
45 | 45 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | - if ( isset( $_GET['taxonomy'] ) && ! in_array( $_GET['taxonomy'], $this->oProp->aTaxonomySlugs ) ) { |
|
66 | + if ( isset( $_GET[ 'taxonomy' ] ) && !in_array( $_GET[ 'taxonomy' ], $this->oProp->aTaxonomySlugs ) ) { |
|
67 | 67 | return false; |
68 | 68 | } |
69 | 69 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function _replyToSetUpHooks( $oFactory ) { |
82 | 82 | |
83 | - foreach( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
83 | + foreach ( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
84 | 84 | |
85 | 85 | // Validation callbacks need to be set regardless of whether the current page is edit-tags.php or not. |
86 | 86 | add_action( "created_{$_sTaxonomySlug}", array( $this, '_replyToValidateOptions' ), 10, 2 ); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | return true; |
60 | 60 | } |
61 | 61 | |
62 | - if ( 'edit-tags.php' != $this->oProp->sPageNow ) { |
|
62 | + if ( 'edit-tags.php' != $this->oProp->sPageNow ) { |
|
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function _replyToSetUpHooks( $oFactory ) { |
82 | 82 | |
83 | - foreach( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
83 | + foreach( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
84 | 84 | |
85 | 85 | // Validation callbacks need to be set regardless of whether the current page is edit-tags.php or not. |
86 | 86 | add_action( "created_{$_sTaxonomySlug}", array( $this, '_replyToValidateOptions' ), 10, 2 ); |
@@ -22,6 +22,7 @@ |
||
22 | 22 | * Sets up hooks. |
23 | 23 | * |
24 | 24 | * @since 3.5.0 |
25 | + * @param AdminPageFramework_Property_user_meta $oProp |
|
25 | 26 | */ |
26 | 27 | public function __construct( $oProp ) { |
27 | 28 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | parent::__construct( $oProp ); |
29 | 29 | |
30 | - if ( ! $this->oProp->bIsAdmin ) { |
|
30 | + if ( !$this->oProp->bIsAdmin ) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ); |
38 | 38 | |
39 | 39 | // 3.7.10+ |
40 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
40 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function _isInThePage() { |
52 | 52 | |
53 | - if ( ! $this->oProp->bIsAdmin ) { |
|
53 | + if ( !$this->oProp->bIsAdmin ) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 | |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | public function _replyToSetUpHooks( $oFactory ) { |
72 | 72 | |
73 | 73 | // Hooks to display fields. |
74 | - add_action( 'show_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
75 | - add_action( 'edit_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
76 | - add_action( 'user_new_form', array( $this, '_replyToPrintFields' ) ); // user-new.php |
|
74 | + add_action( 'show_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
75 | + add_action( 'edit_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
76 | + add_action( 'user_new_form', array( $this, '_replyToPrintFields' ) ); // user-new.php |
|
77 | 77 | |
78 | 78 | // Hooks to save field values. |
79 | 79 | add_action( 'personal_options_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
80 | - add_action( 'edit_user_profile_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
81 | - add_action('user_register', array( $this, '_replyToSaveFieldValues' ) ); // user-new.php |
|
80 | + add_action( 'edit_user_profile_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
81 | + add_action( 'user_register', array( $this, '_replyToSaveFieldValues' ) ); // user-new.php |
|
82 | 82 | |
83 | 83 | } |
84 | 84 |
@@ -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; |