@@ -56,13 +56,13 @@ |
||
| 56 | 56 | public function getFieldsetOutput( $aFieldset ) { |
| 57 | 57 | |
| 58 | 58 | // Check if the field is visible |
| 59 | - if ( ! $this->isFieldsetVisible( $aFieldset ) ) { |
|
| 59 | + if ( !$this->isFieldsetVisible( $aFieldset ) ) { |
|
| 60 | 60 | return ''; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
| 64 | 64 | $aFieldset, |
| 65 | - $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
| 65 | + $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
| 66 | 66 | $this->aFieldErrors, |
| 67 | 67 | $this->aFieldTypeDefinitions, |
| 68 | 68 | $this->oMsg, |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | // Output |
| 38 | 38 | return |
| 39 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
| 40 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
| 41 | - . "</{$this->aOptions['input_container_tag']}>" |
|
| 42 | - . "<{$this->aOptions['label_container_tag']} " . $this->getAttributes( $this->aOptions['label_container_attributes'] ) . ">" |
|
| 39 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
| 40 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
| 41 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
| 42 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
| 43 | 43 | . $_sLabel |
| 44 | - . "</{$this->aOptions['label_container_tag']}>" |
|
| 44 | + . "</{$this->aOptions[ 'label_container_tag' ]}>" |
|
| 45 | 45 | ; |
| 46 | 46 | |
| 47 | 47 | } |
@@ -58,22 +58,22 @@ discard block |
||
| 58 | 58 | public function getAttributesByKey( /* $sKey */ ) { |
| 59 | 59 | |
| 60 | 60 | // Parameters |
| 61 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
| 62 | - $_sKey = $_aParams[ 0 ]; |
|
| 61 | + $_aParams = func_get_args() + array( 0 => '',); |
|
| 62 | + $_sKey = $_aParams[ 0 ]; |
|
| 63 | 63 | |
| 64 | 64 | // Result |
| 65 | 65 | return $this->getElementAsArray( $this->aAttributes, $_sKey, array() ) |
| 66 | 66 | + array( |
| 67 | 67 | 'type' => 'radio', |
| 68 | - 'checked' => isset( $this->aAttributes['value'] ) && $this->aAttributes['value'] == $_sKey |
|
| 68 | + 'checked' => isset( $this->aAttributes[ 'value' ] ) && $this->aAttributes[ 'value' ] == $_sKey |
|
| 69 | 69 | ? 'checked' |
| 70 | 70 | : null, |
| 71 | 71 | 'value' => $_sKey, |
| 72 | 72 | // 'id' => $this->aField['input_id'] . '_' . $_sKey, |
| 73 | - 'id' => $this->getAttribute( 'id' ) . '_' . $_sKey, |
|
| 73 | + 'id' => $this->getAttribute( 'id' ).'_'.$_sKey, |
|
| 74 | 74 | // 'data-default' => $this->aField['default'], // refered by the repeater script |
| 75 | 75 | // 'data-id' => $this->aField['input_id'], // refered by the JavaScript scripts such as the revealer script. |
| 76 | - 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
| 76 | + 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
| 77 | 77 | ) |
| 78 | 78 | + $this->aAttributes; |
| 79 | 79 | |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function _replyToFinalizeInPageTabs() { |
| 39 | 39 | |
| 40 | - if ( ! $this->oProp->isPageAdded() ) { |
|
| 40 | + if ( !$this->oProp->isPageAdded() ) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
| 44 | + foreach ( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
| 45 | 45 | |
| 46 | - if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 46 | + if ( !isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @since 3.6.0 |
| 81 | 81 | */ |
| 82 | 82 | private function _getDefaultInPageTab( $sPageSlug, $aInPageTabs ) { |
| 83 | - foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | - if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 83 | + foreach ( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | + if ( !isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | // Regardless of whether it's a hidden tab, it is stored as the default in-page tab. |
@@ -400,7 +400,7 @@ |
||
| 400 | 400 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
| 401 | 401 | * @return array removed menu item. |
| 402 | 402 | */ |
| 403 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
| 403 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
| 404 | 404 | |
| 405 | 405 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
| 406 | 406 | $nSubMenuPageIndex, |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @internal |
| 29 | 29 | */ |
| 30 | - public function __construct( $oFactory, $sActionHook='admin_menu' ) { |
|
| 30 | + public function __construct( $oFactory, $sActionHook = 'admin_menu' ) { |
|
| 31 | 31 | |
| 32 | 32 | $this->oFactory = $oFactory; |
| 33 | 33 | add_action( |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public function _replyToRegisterRootMenu() { |
| 75 | 75 | |
| 76 | 76 | // If the root menu label is not set but the slug is set, |
| 77 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 77 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | $this->_registerRootMenuPage(); |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $this->oFactory->oProp->aRootMenu[ '_page_hook' ] = add_menu_page( |
| 99 | - $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 100 | - $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 101 | - $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 102 | - $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 103 | - '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 104 | - $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 99 | + $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 100 | + $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 101 | + $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 102 | + $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 103 | + '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 104 | + $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 105 | 105 | $this->getElement( |
| 106 | 106 | $this->oFactory->oProp->aRootMenu, |
| 107 | 107 | 'iPosition', |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // Let external scripts add sub-menu pages. |
| 125 | 125 | $_aPages = $this->addAndApplyFilter( |
| 126 | - $this->oFactory, // caller object |
|
| 127 | - "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 126 | + $this->oFactory, // caller object |
|
| 127 | + "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 128 | 128 | $this->oFactory->oProp->aPages // arguments |
| 129 | 129 | ); |
| 130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | // Format the `$aPages` property and register the pages. |
| 135 | 135 | $_iParsedIndex = 0; |
| 136 | 136 | $_aFormattedPages = array(); |
| 137 | - foreach( $_aPages as $_aSubMenuItem ) { |
|
| 137 | + foreach ( $_aPages as $_aSubMenuItem ) { |
|
| 138 | 138 | |
| 139 | 139 | // needs to be sanitized because there are hook filters applied to this array. |
| 140 | 140 | $_oFormatter = new AdminPageFramework_Format_SubMenuItem( |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | private function _getDefaultPageSlug( array $aPages ) { |
| 171 | 171 | |
| 172 | - foreach( $aPages as $_aPage ) { |
|
| 173 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 172 | + foreach ( $aPages as $_aPage ) { |
|
| 173 | + if ( !isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | return $_aPage[ 'page_slug' ]; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | private function _registerSubMenuItem( array $aArgs ) { |
| 194 | 194 | |
| 195 | - if ( ! current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 195 | + if ( !current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 196 | 196 | return ''; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) { |
| 258 | 258 | |
| 259 | - if ( ! $sPageSlug ) { |
|
| 259 | + if ( !$sPageSlug ) { |
|
| 260 | 260 | return ''; |
| 261 | 261 | } |
| 262 | 262 | $_sPageHook = $this->___addSubMenuPage( |
| 263 | - $sRootPageSlug, // the root (parent) page slug |
|
| 264 | - $sPageTitle, // page title |
|
| 265 | - $sMenuTitle, // menu title |
|
| 266 | - $sCapability, // capability |
|
| 263 | + $sRootPageSlug, // the root (parent) page slug |
|
| 264 | + $sPageTitle, // page title |
|
| 265 | + $sMenuTitle, // menu title |
|
| 266 | + $sCapability, // capability |
|
| 267 | 267 | $sPageSlug // menu slug |
| 268 | 268 | ); |
| 269 | 269 | |
@@ -291,14 +291,14 @@ discard block |
||
| 291 | 291 | $_aRemovedMenuItem = $this->_removePageSubmenuItem( $_nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ); |
| 292 | 292 | |
| 293 | 293 | // If the visibility option is `false`, remove the one just added from the sub-menu global array |
| 294 | - if ( ! $bShowInMenu && ! $this->_isCurrentPage( $sPageSlug ) ) { |
|
| 294 | + if ( !$bShowInMenu && !$this->_isCurrentPage( $sPageSlug ) ) { |
|
| 295 | 295 | return $_sPageHook; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // Set the order index in the element of the `submenu` global array. |
| 299 | 299 | $this->_setSubMenuPageByIndex( |
| 300 | - $nOrder, // user-set order |
|
| 301 | - $_aRemovedMenuItem, // will be reassign with a new index |
|
| 300 | + $nOrder, // user-set order |
|
| 301 | + $_aRemovedMenuItem, // will be reassign with a new index |
|
| 302 | 302 | $sMenuSlug |
| 303 | 303 | ); |
| 304 | 304 | |
@@ -319,21 +319,21 @@ discard block |
||
| 319 | 319 | * @uses add_submenu_page |
| 320 | 320 | */ |
| 321 | 321 | private function ___addSubMenuPage( |
| 322 | - $sRootPageSlug, // the root (parent) page slug |
|
| 323 | - $sPageTitle, // page title |
|
| 324 | - $sMenuTitle, // menu title |
|
| 325 | - $sCapability, // capability |
|
| 322 | + $sRootPageSlug, // the root (parent) page slug |
|
| 323 | + $sPageTitle, // page title |
|
| 324 | + $sMenuTitle, // menu title |
|
| 325 | + $sCapability, // capability |
|
| 326 | 326 | $sPageSlug // menu slug |
| 327 | 327 | ) { |
| 328 | 328 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
| 329 | 329 | return $sPageSlug; |
| 330 | 330 | } |
| 331 | 331 | return add_submenu_page( |
| 332 | - $sRootPageSlug, // the root (parent) page slug |
|
| 333 | - $sPageTitle, // page title |
|
| 334 | - $sMenuTitle, // menu title |
|
| 335 | - $sCapability, // capability |
|
| 336 | - $sPageSlug, // menu slug |
|
| 332 | + $sRootPageSlug, // the root (parent) page slug |
|
| 333 | + $sPageTitle, // page title |
|
| 334 | + $sMenuTitle, // menu title |
|
| 335 | + $sCapability, // capability |
|
| 336 | + $sPageSlug, // menu slug |
|
| 337 | 337 | array( $this->oFactory, '_replyToRenderPage' ) // callback 3.7.10+ |
| 338 | 338 | ); |
| 339 | 339 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | add_action( |
| 369 | 369 | 'current_screen', |
| 370 | - array( $this->oFactory, "load_pre_" . $sPageSlug ), |
|
| 370 | + array( $this->oFactory, "load_pre_".$sPageSlug ), |
|
| 371 | 371 | 20 |
| 372 | 372 | ); |
| 373 | 373 | /** |
@@ -382,15 +382,15 @@ discard block |
||
| 382 | 382 | * Set a low priority because the user may add in-page tabs in their callback method of this action hook. |
| 383 | 383 | * @since 3.6.3 |
| 384 | 384 | */ |
| 385 | - add_action( "load_" . $sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 385 | + add_action( "load_".$sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 386 | 386 | |
| 387 | 387 | // 3.6.3+ |
| 388 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 389 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 388 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 389 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 390 | 390 | |
| 391 | 391 | $this->oFactory->oProp->aPageHooks[ $sPageSlug ] = $this->getAOrB( |
| 392 | 392 | is_network_admin(), |
| 393 | - $sPageHook . '-network', |
|
| 393 | + $sPageHook.'-network', |
|
| 394 | 394 | $sPageHook |
| 395 | 395 | ); |
| 396 | 396 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $_nNewIndex = $this->getUnusedNumericIndex( |
| 409 | 409 | $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ), // subject array to parser |
| 410 | - $nOrder, // a desired menu position |
|
| 410 | + $nOrder, // a desired menu position |
|
| 411 | 411 | 5 // offset |
| 412 | 412 | ); |
| 413 | 413 | |
@@ -421,9 +421,9 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | private function _getSubMenuPageIndex( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) { |
| 423 | 423 | |
| 424 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 424 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 425 | 425 | |
| 426 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
| 426 | + if ( !isset( $_aSubMenu[ 3 ] ) ) { |
|
| 427 | 427 | continue; |
| 428 | 428 | } |
| 429 | 429 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
| 456 | 456 | * @return array removed menu item. |
| 457 | 457 | */ |
| 458 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
| 458 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
| 459 | 459 | |
| 460 | 460 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
| 461 | 461 | $nSubMenuPageIndex, |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | */ |
| 529 | 529 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
| 530 | 530 | |
| 531 | - if ( ! $bShowInMenu ) { |
|
| 531 | + if ( !$bShowInMenu ) { |
|
| 532 | 532 | return; |
| 533 | 533 | } |
| 534 | 534 | |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | 5 // offset |
| 544 | 544 | ); |
| 545 | 545 | $_aSubMenuItems[ $_nIndex ] = array( |
| 546 | - $sTitle, // 0 |
|
| 547 | - $sCapability, // 1 |
|
| 548 | - $sHref, // 2 |
|
| 546 | + $sTitle, // 0 |
|
| 547 | + $sCapability, // 1 |
|
| 548 | + $sHref, // 2 |
|
| 549 | 549 | ); |
| 550 | 550 | $GLOBALS[ 'submenu' ][ $sMenuSlug ] = $_aSubMenuItems; |
| 551 | 551 | |
@@ -562,17 +562,17 @@ discard block |
||
| 562 | 562 | */ |
| 563 | 563 | public function _replyToLoadPageForAjax() { |
| 564 | 564 | $_sCurrentPageSlug = $this->oFactory->oProp->getCurrentPageSlugIfAdded(); |
| 565 | - if ( ! $_sCurrentPageSlug ) { |
|
| 565 | + if ( !$_sCurrentPageSlug ) { |
|
| 566 | 566 | return; |
| 567 | 567 | } |
| 568 | - $_sCurrentTabSlug = $this->oFactory->oProp->getCurrentInPageTabSlugIfAdded( $_sCurrentPageSlug ); |
|
| 568 | + $_sCurrentTabSlug = $this->oFactory->oProp->getCurrentInPageTabSlugIfAdded( $_sCurrentPageSlug ); |
|
| 569 | 569 | if ( |
| 570 | - ! empty( $this->oFactory->oProp->aInPageTabs ) // it means at least one in-page tab is added |
|
| 571 | - && ! $_sCurrentTabSlug // the current tab could not be retrieved |
|
| 570 | + !empty( $this->oFactory->oProp->aInPageTabs ) // it means at least one in-page tab is added |
|
| 571 | + && !$_sCurrentTabSlug // the current tab could not be retrieved |
|
| 572 | 572 | ) { |
| 573 | 573 | return; |
| 574 | 574 | } |
| 575 | - call_user_func_array( array( $this->oFactory, "load_pre_" . $_sCurrentPageSlug ), array() ); |
|
| 575 | + call_user_func_array( array( $this->oFactory, "load_pre_".$_sCurrentPageSlug ), array() ); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | /** |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | public function _replyToRemoveRootMenuPage() { |
| 586 | 586 | |
| 587 | 587 | // After adding the sub menus, if the root menu is created, remove the page that is automatically created when registering the root menu. |
| 588 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 588 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 589 | 589 | return; |
| 590 | 590 | } |
| 591 | 591 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * Namespace slugs have backslashes but the registered slugs backslashes are all converted to forward-slashes. |
| 597 | 597 | * @since 3.5.16 |
| 598 | 598 | */ |
| 599 | - $_sMenuSlug = str_replace( |
|
| 599 | + $_sMenuSlug = str_replace( |
|
| 600 | 600 | '\\', |
| 601 | 601 | '/', |
| 602 | 602 | $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ] |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | protected function _getFormattedSubMenuLinkArray( array $aSubMenuLink ) { |
| 93 | 93 | |
| 94 | 94 | // If the set URL is not valid, return. |
| 95 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 95 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 96 | 96 | return array(); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | */ |
| 82 | 82 | public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
| 83 | 83 | foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
| 84 | - if ( is_string( $_asPage ) ) { |
|
| 84 | + if ( is_string( $_asPage ) ) { |
|
| 85 | 85 | $this->_registerMetaBox( $_asPage ); |
| 86 | 86 | continue; |
| 87 | 87 | } |
@@ -256,7 +256,7 @@ |
||
| 256 | 256 | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - /** |
|
| 259 | + /** |
|
| 260 | 260 | * Extracts meta box form fields options array from the given options array of an admin page. |
| 261 | 261 | * |
| 262 | 262 | * @since 3.5.6 |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | public function _replyToSetUpValidationHooks( $oScreen ) { |
| 46 | 46 | |
| 47 | 47 | // Validation hooks |
| 48 | - foreach( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 48 | + foreach ( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 49 | 49 | |
| 50 | 50 | if ( is_scalar( $_asTabArrayOrPageSlug ) ) { |
| 51 | 51 | $_sPageSlug = $_asTabArrayOrPageSlug; |
| 52 | - add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 52 | + add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 53 | 53 | add_filter( "validation_{$_sPageSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 54 | 54 | add_filter( "options_update_status_{$_sPageSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
| 55 | 55 | continue; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | // At this point, the array key is the page slug. It means the user specified the tab(s). |
| 59 | 59 | $_sPageSlug = $_sIndexOrPageSlug; |
| 60 | 60 | $_aTabs = $_asTabArrayOrPageSlug; |
| 61 | - foreach( $_aTabs as $_sTabSlug ) { |
|
| 61 | + foreach ( $_aTabs as $_sTabSlug ) { |
|
| 62 | 62 | add_filter( "validation_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 63 | 63 | add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
| 64 | 64 | add_filter( "options_update_status_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @return void |
| 79 | 79 | * @callback action add_meta_boxes |
| 80 | 80 | */ |
| 81 | - public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
|
| 82 | - foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 83 | - if ( is_string( $_asPage ) ) { |
|
| 81 | + public function _replyToRegisterMetaBoxes( $sPageHook = '' ) { |
|
| 82 | + foreach ( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 83 | + if ( is_string( $_asPage ) ) { |
|
| 84 | 84 | $this->_registerMetaBox( $_asPage ); |
| 85 | 85 | continue; |
| 86 | 86 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @return void |
| 97 | 97 | */ |
| 98 | 98 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
| 99 | - foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 100 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 99 | + foreach ( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 100 | + if ( !$this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 101 | 101 | continue; |
| 102 | 102 | } |
| 103 | 103 | $this->_registerMetaBox( $sPageSlug ); |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | private function _registerMetaBox( $sPageSlug ) { |
| 116 | 116 | add_meta_box( |
| 117 | - $this->oProp->sMetaBoxID, // id |
|
| 118 | - $this->oProp->sTitle, // title |
|
| 117 | + $this->oProp->sMetaBoxID, // id |
|
| 118 | + $this->oProp->sTitle, // title |
|
| 119 | 119 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
| 120 | 120 | $this->oProp->_getScreenIDOfPage( $sPageSlug ), // screen ID |
| 121 | - $this->oProp->sContext, // context |
|
| 122 | - $this->oProp->sPriority, // priority |
|
| 121 | + $this->oProp->sContext, // context |
|
| 122 | + $this->oProp->sPriority, // priority |
|
| 123 | 123 | null // argument (deprecated) |
| 124 | 124 | ); |
| 125 | 125 | } |
@@ -165,19 +165,19 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function _replyToValidateOptions( $aNewPageOptions, $aOldPageOptions, $oAdminPage, $aSubmitInfo ) { |
| 167 | 167 | |
| 168 | - $_aNewMetaBoxInputs = $this->oForm->getSubmittedData( $this->oForm->getHTTPRequestSanitized( $_POST ) ); // sanitization done |
|
| 168 | + $_aNewMetaBoxInputs = $this->oForm->getSubmittedData( $this->oForm->getHTTPRequestSanitized( $_POST ) ); // sanitization done |
|
| 169 | 169 | $_aOldMetaBoxInputs = $this->oUtil->castArrayContents( |
| 170 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 170 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 171 | 171 | $aOldPageOptions // data source |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | 174 | // Apply filters - third party scripts will have access to the input. |
| 175 | 175 | $_aNewMetaBoxInputsRaw = $_aNewMetaBoxInputs; // copy one for validation errors. |
| 176 | 176 | $_aNewMetaBoxInputs = call_user_func_array( |
| 177 | - array( $this, 'validate' ), // triggers __call() |
|
| 177 | + array( $this, 'validate' ), // triggers __call() |
|
| 178 | 178 | array( $_aNewMetaBoxInputs, $_aOldMetaBoxInputs, $this, $aSubmitInfo ) |
| 179 | 179 | ); // 3.5.3+ |
| 180 | - $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 180 | + $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 181 | 181 | $this, |
| 182 | 182 | "validation_{$this->oProp->sClassName}", |
| 183 | 183 | $_aNewMetaBoxInputs, |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function _replyToModifyOptionsUpdateStatus( $aStatus ) { |
| 217 | 217 | |
| 218 | - if ( ! $this->hasFieldError() ) { |
|
| 218 | + if ( !$this->hasFieldError() ) { |
|
| 219 | 219 | return $aStatus; |
| 220 | 220 | } |
| 221 | 221 | return array( |
@@ -245,12 +245,12 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $_aPageOptions = $this->oUtil->addAndApplyFilter( |
| 247 | 247 | $this, // the caller factory object |
| 248 | - 'options_' . $this->oProp->sClassName, |
|
| 248 | + 'options_'.$this->oProp->sClassName, |
|
| 249 | 249 | $_aPageOptions |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | 252 | return $this->oUtil->castArrayContents( |
| 253 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 253 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 254 | 254 | $_aPageOptions // data source |
| 255 | 255 | ); |
| 256 | 256 | |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | private function _getPageMetaBoxOptionsFromPageOptions( array $aPageOptions, array $aFieldsets ) { |
| 268 | 268 | |
| 269 | 269 | $_aOptions = array(); |
| 270 | - foreach( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 271 | - if ( '_default' === $_sSectionID ) { |
|
| 272 | - foreach( $_aFieldsets as $_aField ) { |
|
| 270 | + foreach ( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 271 | + if ( '_default' === $_sSectionID ) { |
|
| 272 | + foreach ( $_aFieldsets as $_aField ) { |
|
| 273 | 273 | if ( array_key_exists( $_aField[ 'field_id' ], $aPageOptions ) ) { |
| 274 | 274 | $_aOptions[ $_aField[ 'field_id' ] ] = $aPageOptions[ $_aField[ 'field_id' ] ]; |
| 275 | 275 | } |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | */ |
| 136 | 136 | public function _replyToModifyActionLinks( $aActionLinks, $oPost ) { |
| 137 | 137 | |
| 138 | - if ( $oPost->post_type !== $this->oProp->sPostType ){ |
|
| 138 | + if ( $oPost->post_type !== $this->oProp->sPostType ) { |
|
| 139 | 139 | return $aActionLinks; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | if ( $this->oProp->bIsAdmin ) { |
| 33 | 33 | |
| 34 | - add_action( 'load_' . $this->oProp->sPostType, array( $this, '_replyToSetUpHooksForView' ) ); |
|
| 34 | + add_action( 'load_'.$this->oProp->sPostType, array( $this, '_replyToSetUpHooksForView' ) ); |
|
| 35 | 35 | |
| 36 | 36 | // 3.5.10+ |
| 37 | 37 | add_action( 'admin_menu', array( $this, '_replyToRemoveAddNewSidebarMenu' ) ); |
@@ -105,19 +105,19 @@ discard block |
||
| 105 | 105 | private function _removeAddNewSidebarSubMenu( $sMenuKey, $sPostTypeSlug ) { |
| 106 | 106 | |
| 107 | 107 | // Remove the default post type menu item. |
| 108 | - if ( ! isset( $GLOBALS[ 'submenu' ][ $sMenuKey ] ) ) { |
|
| 108 | + if ( !isset( $GLOBALS[ 'submenu' ][ $sMenuKey ] ) ) { |
|
| 109 | 109 | // logged-in users of an insufficient access level don't have the menu to be registered. |
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | foreach ( $GLOBALS[ 'submenu' ][ $sMenuKey ] as $_iIndex => $_aSubMenu ) { |
| 114 | 114 | |
| 115 | - if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
| 115 | + if ( !isset( $_aSubMenu[ 2 ] ) ) { |
|
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // Remove the default Add New entry. |
| 120 | - if ( 'post-new.php?post_type=' . $sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
| 120 | + if ( 'post-new.php?post_type='.$sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
| 121 | 121 | unset( $GLOBALS[ 'submenu' ][ $sMenuKey ][ $_iIndex ] ); |
| 122 | 122 | break; |
| 123 | 123 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function _replyToModifyActionLinks( $aActionLinks, $oPost ) { |
| 136 | 136 | |
| 137 | - if ( $oPost->post_type !== $this->oProp->sPostType ){ |
|
| 137 | + if ( $oPost->post_type !== $this->oProp->sPostType ) { |
|
| 138 | 138 | return $aActionLinks; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function _replyToAddAuthorTableFilter() { |
| 158 | 158 | |
| 159 | - if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
| 159 | + if ( !$this->oProp->bEnableAuthorTableFileter ) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if ( |
| 164 | - ! ( isset( $_GET[ 'post_type' ] ) && post_type_exists( $_GET[ 'post_type' ] ) // sanitization unnecessary |
|
| 164 | + !( isset( $_GET[ 'post_type' ] ) && post_type_exists( $_GET[ 'post_type' ] ) // sanitization unnecessary |
|
| 165 | 165 | && strtolower( $_GET[ 'post_type' ] ) == $this->oProp->sPostType ) // sanitization unnecessary |
| 166 | 166 | ) { |
| 167 | 167 | return; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $_sTaxonomySulg ) { |
| 201 | 201 | |
| 202 | - if ( ! in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 202 | + if ( !in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 203 | 203 | continue; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | // Echo the drop down list based on the passed array argument. |
| 214 | 214 | wp_dropdown_categories( |
| 215 | 215 | array( |
| 216 | - 'show_option_all' => $this->oMsg->get( 'show_all' ) . ' ' . $_oTaxonomy->label, |
|
| 216 | + 'show_option_all' => $this->oMsg->get( 'show_all' ).' '.$_oTaxonomy->label, |
|
| 217 | 217 | 'taxonomy' => $_sTaxonomySulg, |
| 218 | 218 | 'name' => $_oTaxonomy->name, |
| 219 | 219 | 'orderby' => 'name', |
@@ -233,24 +233,24 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @internal |
| 235 | 235 | */ |
| 236 | - public function _replyToGetTableFilterQueryForTaxonomies( $oQuery=null ) { |
|
| 236 | + public function _replyToGetTableFilterQueryForTaxonomies( $oQuery = null ) { |
|
| 237 | 237 | |
| 238 | 238 | if ( 'edit.php' != $this->oProp->sPageNow ) { |
| 239 | 239 | return $oQuery; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if ( ! isset( $GLOBALS[ 'typenow' ] ) ) { |
|
| 242 | + if ( !isset( $GLOBALS[ 'typenow' ] ) ) { |
|
| 243 | 243 | return $oQuery; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $sTaxonomySlug ) { |
| 247 | 247 | |
| 248 | - if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 248 | + if ( !in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 249 | 249 | continue; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | $sVar = &$oQuery->query_vars[ $sTaxonomySlug ]; |
| 253 | - if ( ! isset( $sVar ) ) { |
|
| 253 | + if ( !isset( $sVar ) ) { |
|
| 254 | 254 | continue; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $_sStyle = trim( $_sStyle ); |
| 290 | 290 | |
| 291 | 291 | // Print out the filtered styles. |
| 292 | - if ( ! empty( $_sStyle ) ) { |
|
| 292 | + if ( !empty( $_sStyle ) ) { |
|
| 293 | 293 | echo "<style type='text/css' id='admin-page-framework-style-post-type'>" |
| 294 | 294 | . $this->oProp->sStyle |
| 295 | 295 | . "</style>"; |
@@ -345,10 +345,10 @@ discard block |
||
| 345 | 345 | */ |
| 346 | 346 | public function _replyToFilterPostTypeContent( $sContent ) { |
| 347 | 347 | |
| 348 | - if ( ! is_singular() ) { |
|
| 348 | + if ( !is_singular() ) { |
|
| 349 | 349 | return $sContent; |
| 350 | 350 | } |
| 351 | - if ( ! is_main_query() ) { |
|
| 351 | + if ( !is_main_query() ) { |
|
| 352 | 352 | return $sContent; |
| 353 | 353 | } |
| 354 | 354 | global $post; |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | /** |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - private function getReadMeContents() { |
|
| 55 | + private function getReadMeContents() { |
|
| 56 | 56 | return $this->_getReadmeContents( |
| 57 | 57 | AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/examples.txt', |
| 58 | 58 | '', |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $_aItems = $this->getContentsByHeader( $this->getReadmeContents(), 3 ); |
| 25 | 25 | $_iLastIndex = count( $_aItems ) - 1; |
| 26 | - foreach( $_aItems as $_iIndex => $_aContent ) { |
|
| 26 | + foreach ( $_aItems as $_iIndex => $_aContent ) { |
|
| 27 | 27 | |
| 28 | 28 | $_oParser = new AdminPageFramework_WPReadmeParser; |
| 29 | 29 | $_oParser->setText( $_aContent[ 1 ] ); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $oAdminPage->addSettingSections( |
| 32 | 32 | $this->sPageSlug, // the target page slug |
| 33 | 33 | array( |
| 34 | - 'section_id' => 'examples_' . $_iIndex, |
|
| 34 | + 'section_id' => 'examples_'.$_iIndex, |
|
| 35 | 35 | 'title' => $_aContent[ 0 ], |
| 36 | 36 | 'collapsible' => array( |
| 37 | 37 | 'toggle_all_button' => $_iLastIndex === $_iIndex |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - private function getReadMeContents() { |
|
| 55 | + private function getReadMeContents() { |
|
| 56 | 56 | return $this->_getReadmeContents( |
| 57 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/examples.txt', |
|
| 57 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/text/examples.txt', |
|
| 58 | 58 | '', |
| 59 | 59 | array( 'Examples' ) |
| 60 | 60 | ); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | /** |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - private function getReadMeContents() { |
|
| 56 | + private function getReadMeContents() { |
|
| 57 | 57 | return $this->_getReadmeContents( |
| 58 | 58 | AdminPageFrameworkLoader_Registry::$sDirPath . '/readme.txt', // source path |
| 59 | 59 | '', // TOC title |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $_aItems = $this->getContentsByHeader( $this->getReadmeContents(), 4 ); |
| 27 | 27 | $_iLastIndex = count( $_aItems ) - 1; |
| 28 | - foreach( $_aItems as $_iIndex => $_aContent ) { |
|
| 28 | + foreach ( $_aItems as $_iIndex => $_aContent ) { |
|
| 29 | 29 | |
| 30 | 30 | $_oParser = new AdminPageFramework_WPReadmeParser( $_aContent[ 1 ] ); |
| 31 | 31 | $_sContent = $_oParser->get(); |
| 32 | 32 | $oAdminPage->addSettingSections( |
| 33 | 33 | $this->sPageSlug, // the target page slug |
| 34 | 34 | array( |
| 35 | - 'section_id' => 'tips_' . $_iIndex, |
|
| 35 | + 'section_id' => 'tips_'.$_iIndex, |
|
| 36 | 36 | 'title' => $_aContent[ 0 ], |
| 37 | 37 | 'collapsible' => array( |
| 38 | 38 | 'toggle_all_button' => $_iLastIndex === $_iIndex |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - private function getReadMeContents() { |
|
| 56 | + private function getReadMeContents() { |
|
| 57 | 57 | return $this->_getReadmeContents( |
| 58 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/readme.txt', // source path |
|
| 58 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/readme.txt', // source path |
|
| 59 | 59 | '', // TOC title |
| 60 | 60 | array( 'Other Notes' ) // sections |
| 61 | 61 | ); |