@@ -333,7 +333,8 @@ |
||
| 333 | 333 | $sTabSlug = $aEnqueueItem['sTabSlug']; |
| 334 | 334 | |
| 335 | 335 | // If the page slug is not specified and the currently loading page is one of the pages that is added by the framework, |
| 336 | - if ( ! $sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { // means script-global(among pages added by the framework) |
|
| 336 | + if ( ! $sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { |
|
| 337 | +// means script-global(among pages added by the framework) |
|
| 337 | 338 | return $this->_enqueueSRC( $aEnqueueItem ); |
| 338 | 339 | } |
| 339 | 340 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // tab |
| 46 | 46 | if ( $_sPageSlug && $_sTabSlug ) { |
| 47 | - $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 47 | + $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 48 | 48 | $_oCaller, |
| 49 | 49 | "style_{$_sPageSlug}_{$_sTabSlug}", |
| 50 | 50 | $this->oProp->sStyle |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // page |
| 55 | 55 | if ( $_sPageSlug ) { |
| 56 | - $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 56 | + $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 57 | 57 | $_oCaller, |
| 58 | 58 | "style_{$_sPageSlug}", |
| 59 | 59 | $this->oProp->sStyle |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return string The tab slug if the tab has been added. |
| 88 | 88 | */ |
| 89 | 89 | private function _getCurrentTabSlugForFilter( $sPageSlug ) { |
| 90 | - $_sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
|
| 90 | + $_sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
|
| 91 | 91 | return isset( $this->oProp->aInPageTabs[ $sPageSlug ][ $_sTabSlug ] ) |
| 92 | 92 | ? $_sTabSlug |
| 93 | 93 | : ''; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // tab |
| 117 | 117 | if ( $_sPageSlug && $_sTabSlug ) { |
| 118 | - $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 118 | + $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 119 | 119 | $_oCaller, |
| 120 | 120 | "script_{$_sPageSlug}_{$_sTabSlug}", |
| 121 | 121 | $this->oProp->sScript |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // page |
| 126 | 126 | if ( $_sPageSlug ) { |
| 127 | - $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 127 | + $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 128 | 128 | $_oCaller, |
| 129 | 129 | "script_{$_sPageSlug}", |
| 130 | 130 | $this->oProp->sScript |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | * @since 2.1.5 |
| 143 | 143 | * @internal |
| 144 | 144 | */ |
| 145 | - public function _enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 145 | + public function _enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 146 | 146 | |
| 147 | 147 | $_aHandleIDs = array(); |
| 148 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
| 149 | - $_aHandleIDs[] = $this->_enqueueStyle( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 148 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
| 149 | + $_aHandleIDs[ ] = $this->_enqueueStyle( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 150 | 150 | } |
| 151 | 151 | return $_aHandleIDs; |
| 152 | 152 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 173 | 173 | * @internal |
| 174 | 174 | */ |
| 175 | - public function _enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 175 | + public function _enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 176 | 176 | return $this->_enqueueResourceByType( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs, 'style' ); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | * |
| 182 | 182 | * @since 2.1.5 |
| 183 | 183 | */ |
| 184 | - public function _enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 184 | + public function _enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 185 | 185 | |
| 186 | 186 | $_aHandleIDs = array(); |
| 187 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
| 188 | - $_aHandleIDs[] = $this->_enqueueScript( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 187 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
| 188 | + $_aHandleIDs[ ] = $this->_enqueueScript( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 189 | 189 | } |
| 190 | 190 | return $_aHandleIDs; |
| 191 | 191 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 213 | 213 | * @internal |
| 214 | 214 | */ |
| 215 | - public function _enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 215 | + public function _enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 216 | 216 | return $this->_enqueueResourceByType( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs, 'script' ); |
| 217 | 217 | } |
| 218 | 218 | /** |
@@ -225,20 +225,20 @@ discard block |
||
| 225 | 225 | * @param array $aCustomArgs A custom argument array. |
| 226 | 226 | * @param string $sType Accepts 'style' or 'script' |
| 227 | 227 | */ |
| 228 | - private function _enqueueResourceByType( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array(), $sType='style' ) { |
|
| 228 | + private function _enqueueResourceByType( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array(), $sType = 'style' ) { |
|
| 229 | 229 | |
| 230 | - $sSRC = trim( $sSRC ); |
|
| 230 | + $sSRC = trim( $sSRC ); |
|
| 231 | 231 | if ( empty( $sSRC ) ) { |
| 232 | 232 | return ''; |
| 233 | 233 | } |
| 234 | - $sSRC = $this->getResolvedSRC( $sSRC ); |
|
| 234 | + $sSRC = $this->getResolvedSRC( $sSRC ); |
|
| 235 | 235 | |
| 236 | 236 | // Get the property name for the type |
| 237 | 237 | $_sContainerPropertyName = $this->_getContainerPropertyNameByType( $sType ); |
| 238 | 238 | $_sEnqueuedIndexPropertyName = $this->_getEnqueuedIndexPropertyNameByType( $sType ); |
| 239 | 239 | |
| 240 | 240 | // setting the key based on the url prevents duplicate items |
| 241 | - $_sSRCHash = md5( $sSRC ); |
|
| 241 | + $_sSRCHash = md5( $sSRC ); |
|
| 242 | 242 | if ( isset( $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ] ) ) { |
| 243 | 243 | return ''; |
| 244 | 244 | } |
@@ -249,13 +249,13 @@ discard block |
||
| 249 | 249 | 'sTabSlug' => $sTabSlug, |
| 250 | 250 | 'sSRC' => $sSRC, |
| 251 | 251 | 'sType' => $sType, |
| 252 | - 'handle_id' => $sType . '_' . $this->oProp->sClassName . '_' . ( ++$this->oProp->{$_sEnqueuedIndexPropertyName} ), |
|
| 252 | + 'handle_id' => $sType.'_'.$this->oProp->sClassName.'_'.( ++$this->oProp->{$_sEnqueuedIndexPropertyName} ), |
|
| 253 | 253 | ) |
| 254 | 254 | + self::$_aStructure_EnqueuingResources |
| 255 | 255 | ; |
| 256 | 256 | |
| 257 | 257 | // Store the attributes in another container by url. |
| 258 | - $this->oProp->aResourceAttributes[ $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ]['handle_id'] ] = $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ]['attributes']; |
|
| 258 | + $this->oProp->aResourceAttributes[ $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ][ 'handle_id' ] ] = $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ][ 'attributes' ]; |
|
| 259 | 259 | |
| 260 | 260 | return $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ][ 'handle_id' ]; |
| 261 | 261 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @since 3.0.0 |
| 296 | 296 | * @internal |
| 297 | 297 | */ |
| 298 | - public function _forceToEnqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
| 298 | + public function _forceToEnqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
| 299 | 299 | return $this->_enqueueStyle( $sSRC, '', '', $aCustomArgs ); |
| 300 | 300 | } |
| 301 | 301 | /** |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @since 3.0.0 |
| 306 | 306 | * @internal |
| 307 | 307 | */ |
| 308 | - public function _forceToEnqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
| 308 | + public function _forceToEnqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
| 309 | 309 | return $this->_enqueueScript( $sSRC, '', '', $aCustomArgs ); |
| 310 | 310 | } |
| 311 | 311 | |
@@ -322,11 +322,11 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
| 324 | 324 | $sCurrentTabSlug = $this->oProp->getCurrentTabSlug( $sCurrentPageSlug ); |
| 325 | - $sPageSlug = $aEnqueueItem['sPageSlug']; |
|
| 326 | - $sTabSlug = $aEnqueueItem['sTabSlug']; |
|
| 325 | + $sPageSlug = $aEnqueueItem[ 'sPageSlug' ]; |
|
| 326 | + $sTabSlug = $aEnqueueItem[ 'sTabSlug' ]; |
|
| 327 | 327 | |
| 328 | 328 | // If the page slug is not specified and the currently loading page is one of the pages that is added by the framework, |
| 329 | - if ( ! $sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { // means script-global(among pages added by the framework) |
|
| 329 | + if ( !$sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { // means script-global(among pages added by the framework) |
|
| 330 | 330 | return $this->_enqueueSRC( $aEnqueueItem ); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | // If the tab slug is not specified and the page slug is specified, |
| 342 | 342 | // and if the current loading page slug and the specified one matches, |
| 343 | 343 | if ( |
| 344 | - ( $sPageSlug && ! $sTabSlug ) |
|
| 344 | + ( $sPageSlug && !$sTabSlug ) |
|
| 345 | 345 | && ( $sCurrentPageSlug == $sPageSlug ) |
| 346 | 346 | ) { |
| 347 | 347 | return $this->_enqueueSRC( $aEnqueueItem ); |
@@ -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, |
@@ -26,6 +26,7 @@ discard block |
||
| 26 | 26 | * Sets up hooks |
| 27 | 27 | * |
| 28 | 28 | * @internal |
| 29 | + * @param AdminPageFramework_Router $oFactory |
|
| 29 | 30 | */ |
| 30 | 31 | public function __construct( $oFactory, $sActionHook='admin_menu' ) { |
| 31 | 32 | |
@@ -253,6 +254,7 @@ discard block |
||
| 253 | 254 | * @since 3.3.0 |
| 254 | 255 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
| 255 | 256 | * @since 3.7.4 Added the `$nOrder` parameter. |
| 257 | + * @param string $sMenuSlug |
|
| 256 | 258 | * @return string The page hook of the added page. |
| 257 | 259 | */ |
| 258 | 260 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) { |
@@ -354,6 +356,7 @@ discard block |
||
| 354 | 356 | /** |
| 355 | 357 | * Sets up hooks for the page. |
| 356 | 358 | * @since 3.7.4 |
| 359 | + * @param false|string $sPageHook |
|
| 357 | 360 | */ |
| 358 | 361 | private function _setPageHooks( $sPageHook, $sPageSlug ) { |
| 359 | 362 | |
@@ -405,7 +408,7 @@ discard block |
||
| 405 | 408 | /** |
| 406 | 409 | * @since 3.7.4 |
| 407 | 410 | * @return void |
| 408 | - * @param numeric $$nOrder A user set order (menu position, index). |
|
| 411 | + * @param numeric $nOrder A user set order (menu position, index). |
|
| 409 | 412 | * @param array $aSubMenuItem The sub menu item array set in the global `$submenu` array. |
| 410 | 413 | */ |
| 411 | 414 | private function _setSubMenuPageByIndex( $nOrder, $aSubMenuItem, $sMenuSlug ) { |
@@ -529,6 +532,7 @@ discard block |
||
| 529 | 532 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
| 530 | 533 | * @since 3.5.3 Added the `$bShowInMenu` parameter. |
| 531 | 534 | * @since 3.7.4 Added the `$nOrder` parameter. |
| 535 | + * @param string $sMenuSlug |
|
| 532 | 536 | * @return void |
| 533 | 537 | */ |
| 534 | 538 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
@@ -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 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function _replyToRegisterRootMenu() { |
| 76 | 76 | |
| 77 | 77 | // If the root menu label is not set but the slug is set, |
| 78 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 78 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | $this->_registerRootMenuPage(); |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $this->oFactory->oProp->aRootMenu[ '_page_hook' ] = add_menu_page( |
| 100 | - $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 101 | - $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 102 | - $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 103 | - $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 104 | - '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 105 | - $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 100 | + $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 101 | + $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 102 | + $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 103 | + $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 104 | + '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 105 | + $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 106 | 106 | $this->getElement( |
| 107 | 107 | $this->oFactory->oProp->aRootMenu, |
| 108 | 108 | 'iPosition', |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // Let external scripts add sub-menu pages. |
| 126 | 126 | $_aPages = $this->addAndApplyFilter( |
| 127 | - $this->oFactory, // caller object |
|
| 128 | - "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 127 | + $this->oFactory, // caller object |
|
| 128 | + "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 129 | 129 | $this->oFactory->oProp->aPages // arguments |
| 130 | 130 | ); |
| 131 | 131 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | // Format the `$aPages` property and register the pages. |
| 136 | 136 | $_iParsedIndex = 0; |
| 137 | 137 | $_aFormattedPages = array(); |
| 138 | - foreach( $_aPages as $_aSubMenuItem ) { |
|
| 138 | + foreach ( $_aPages as $_aSubMenuItem ) { |
|
| 139 | 139 | |
| 140 | 140 | // needs to be sanitized because there are hook filters applied to this array. |
| 141 | 141 | $_oFormatter = new AdminPageFramework_Format_SubMenuItem( |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | private function _getDefaultPageSlug( array $aPages ) { |
| 172 | 172 | |
| 173 | - foreach( $aPages as $_aPage ) { |
|
| 174 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 173 | + foreach ( $aPages as $_aPage ) { |
|
| 174 | + if ( !isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 175 | 175 | continue; |
| 176 | 176 | } |
| 177 | 177 | return $_aPage[ 'page_slug' ]; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | private function _registerSubMenuItem( array $aArgs ) { |
| 195 | 195 | |
| 196 | - if ( ! current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 196 | + if ( !current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 197 | 197 | return ''; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -257,14 +257,14 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) { |
| 259 | 259 | |
| 260 | - if ( ! $sPageSlug ) { |
|
| 260 | + if ( !$sPageSlug ) { |
|
| 261 | 261 | return ''; |
| 262 | 262 | } |
| 263 | 263 | $_sPageHook = $this->___addSubMenuPage( |
| 264 | - $sRootPageSlug, // the root (parent) page slug |
|
| 265 | - $sPageTitle, // page title |
|
| 266 | - $sMenuTitle, // menu title |
|
| 267 | - $sCapability, // capability |
|
| 264 | + $sRootPageSlug, // the root (parent) page slug |
|
| 265 | + $sPageTitle, // page title |
|
| 266 | + $sMenuTitle, // menu title |
|
| 267 | + $sCapability, // capability |
|
| 268 | 268 | $sPageSlug // menu slug |
| 269 | 269 | ); |
| 270 | 270 | |
@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | $_aRemovedMenuItem = $this->_removePageSubmenuItem( $_nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ); |
| 294 | 294 | |
| 295 | 295 | // If the visibility option is `false`, remove the one just added from the sub-menu global array |
| 296 | - if ( ! $bShowInMenu && ! $this->_isCurrentPage( $sPageSlug ) ) { |
|
| 296 | + if ( !$bShowInMenu && !$this->_isCurrentPage( $sPageSlug ) ) { |
|
| 297 | 297 | return $_sPageHook; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // Set the order index in the element of the `submenu` global array. |
| 301 | 301 | $this->_setSubMenuPageByIndex( |
| 302 | - $nOrder, // user-set order |
|
| 303 | - $_aRemovedMenuItem, // will be reassign with a new index |
|
| 302 | + $nOrder, // user-set order |
|
| 303 | + $_aRemovedMenuItem, // will be reassign with a new index |
|
| 304 | 304 | $sMenuSlug |
| 305 | 305 | ); |
| 306 | 306 | |
@@ -321,21 +321,21 @@ discard block |
||
| 321 | 321 | * @uses add_submenu_page |
| 322 | 322 | */ |
| 323 | 323 | private function ___addSubMenuPage( |
| 324 | - $sRootPageSlug, // the root (parent) page slug |
|
| 325 | - $sPageTitle, // page title |
|
| 326 | - $sMenuTitle, // menu title |
|
| 327 | - $sCapability, // capability |
|
| 324 | + $sRootPageSlug, // the root (parent) page slug |
|
| 325 | + $sPageTitle, // page title |
|
| 326 | + $sMenuTitle, // menu title |
|
| 327 | + $sCapability, // capability |
|
| 328 | 328 | $sPageSlug // menu slug |
| 329 | 329 | ) { |
| 330 | 330 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
| 331 | 331 | return $sPageSlug; |
| 332 | 332 | } |
| 333 | 333 | return add_submenu_page( |
| 334 | - $sRootPageSlug, // the root (parent) page slug |
|
| 335 | - $sPageTitle, // page title |
|
| 336 | - $sMenuTitle, // menu title |
|
| 337 | - $sCapability, // capability |
|
| 338 | - $sPageSlug, // menu slug |
|
| 334 | + $sRootPageSlug, // the root (parent) page slug |
|
| 335 | + $sPageTitle, // page title |
|
| 336 | + $sMenuTitle, // menu title |
|
| 337 | + $sCapability, // capability |
|
| 338 | + $sPageSlug, // menu slug |
|
| 339 | 339 | array( $this->oFactory, '_replyToRenderPage' ) // callback 3.7.10+ |
| 340 | 340 | ); |
| 341 | 341 | } |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | */ |
| 370 | 370 | add_action( |
| 371 | 371 | 'current_screen', |
| 372 | - array( $this->oFactory, "load_pre_" . $sPageSlug ), |
|
| 372 | + array( $this->oFactory, "load_pre_".$sPageSlug ), |
|
| 373 | 373 | 20 |
| 374 | 374 | ); |
| 375 | 375 | /** |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | */ |
| 379 | 379 | add_action( |
| 380 | 380 | 'pseudo_current_screen', |
| 381 | - array( $this->oFactory, "load_pre_" . $sPageSlug ), |
|
| 381 | + array( $this->oFactory, "load_pre_".$sPageSlug ), |
|
| 382 | 382 | 20 |
| 383 | 383 | ); |
| 384 | 384 | |
@@ -387,15 +387,15 @@ discard block |
||
| 387 | 387 | * Set a low priority because the user may add in-page tabs in their callback method of this action hook. |
| 388 | 388 | * @since 3.6.3 |
| 389 | 389 | */ |
| 390 | - add_action( "load_" . $sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 390 | + add_action( "load_".$sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 391 | 391 | |
| 392 | 392 | // 3.6.3+ |
| 393 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 394 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 393 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 394 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 395 | 395 | |
| 396 | 396 | $this->oFactory->oProp->aPageHooks[ $sPageSlug ] = $this->getAOrB( |
| 397 | 397 | is_network_admin(), |
| 398 | - $sPageHook . '-network', |
|
| 398 | + $sPageHook.'-network', |
|
| 399 | 399 | $sPageHook |
| 400 | 400 | ); |
| 401 | 401 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | $_nNewIndex = $this->getUnusedNumericIndex( |
| 414 | 414 | $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ), // subject array to parser |
| 415 | - $nOrder, // a desired menu position |
|
| 415 | + $nOrder, // a desired menu position |
|
| 416 | 416 | 5 // offset |
| 417 | 417 | ); |
| 418 | 418 | |
@@ -426,9 +426,9 @@ discard block |
||
| 426 | 426 | */ |
| 427 | 427 | private function _getSubMenuPageIndex( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) { |
| 428 | 428 | |
| 429 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 429 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 430 | 430 | |
| 431 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
| 431 | + if ( !isset( $_aSubMenu[ 3 ] ) ) { |
|
| 432 | 432 | continue; |
| 433 | 433 | } |
| 434 | 434 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
| 461 | 461 | * @return array removed menu item. |
| 462 | 462 | */ |
| 463 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
| 463 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
| 464 | 464 | |
| 465 | 465 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
| 466 | 466 | $nSubMenuPageIndex, |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | */ |
| 534 | 534 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
| 535 | 535 | |
| 536 | - if ( ! $bShowInMenu ) { |
|
| 536 | + if ( !$bShowInMenu ) { |
|
| 537 | 537 | return; |
| 538 | 538 | } |
| 539 | 539 | |
@@ -548,9 +548,9 @@ discard block |
||
| 548 | 548 | 5 // offset |
| 549 | 549 | ); |
| 550 | 550 | $_aSubMenuItems[ $_nIndex ] = array( |
| 551 | - $sTitle, // 0 |
|
| 552 | - $sCapability, // 1 |
|
| 553 | - $sHref, // 2 |
|
| 551 | + $sTitle, // 0 |
|
| 552 | + $sCapability, // 1 |
|
| 553 | + $sHref, // 2 |
|
| 554 | 554 | ); |
| 555 | 555 | $GLOBALS[ 'submenu' ][ $sMenuSlug ] = $_aSubMenuItems; |
| 556 | 556 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | public function _replyToRemoveRootMenuPage() { |
| 570 | 570 | |
| 571 | 571 | // After adding the sub menus, if the root menu is created, remove the page that is automatically created when registering the root menu. |
| 572 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 572 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 573 | 573 | return; |
| 574 | 574 | } |
| 575 | 575 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * Namespace slugs have backslashes but the registered slugs backslashes are all converted to forward-slashes. |
| 581 | 581 | * @since 3.5.16 |
| 582 | 582 | */ |
| 583 | - $_sMenuSlug = str_replace( |
|
| 583 | + $_sMenuSlug = str_replace( |
|
| 584 | 584 | '\\', |
| 585 | 585 | '/', |
| 586 | 586 | $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ] |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | class AdminPageFramework_Model__FormSubmission__Validator__ContactForm extends AdminPageFramework_Model__FormSubmission__Validator_Base { |
| 19 | 19 | |
| 20 | - public $sActionHookPrefix = 'try_validation_after_'; // 3.7.6 Changed it from `try_validation_before_` |
|
| 20 | + public $sActionHookPrefix = 'try_validation_after_'; // 3.7.6 Changed it from `try_validation_before_` |
|
| 21 | 21 | public $iHookPriority = 10; |
| 22 | 22 | public $iCallbackParameters = 5; |
| 23 | 23 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 35 | 35 | |
| 36 | 36 | // Check whether sending an email has been confirmed by the user or not. |
| 37 | - if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
| 37 | + if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | $this->getElement( $aSubmitInformation, 'section_id' ) |
| 46 | 46 | ); |
| 47 | 47 | $this->oFactory->oProp->_bDisableSavingOptions = true; |
| 48 | - $this->deleteTransient( 'apf_tfd' . md5( 'temporary_form_data_' . $this->oFactory->oProp->sClassName . get_current_user_id() ) ); |
|
| 48 | + $this->deleteTransient( 'apf_tfd'.md5( 'temporary_form_data_'.$this->oFactory->oProp->sClassName.get_current_user_id() ) ); |
|
| 49 | 49 | |
| 50 | 50 | // Schedule to remove the confirmation url query key. |
| 51 | 51 | add_action( "setting_update_url_{$this->oFactory->oProp->sClassName}", array( $this, '_replyToRemoveConfirmationQueryKey' ) ); |
| 52 | 52 | |
| 53 | 53 | // Go to the catch clause. |
| 54 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
| 54 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
| 55 | 55 | $_oException->aReturn = $aInputs; |
| 56 | 56 | throw $_oException; |
| 57 | 57 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | private function _sendEmailInBackground( $aInputs, $sPressedInputNameFlat, $sSubmitSectionID ) { |
| 88 | 88 | |
| 89 | - $_sTranskentKey = 'apf_em_' . md5( $sPressedInputNameFlat . get_current_user_id() ); |
|
| 89 | + $_sTranskentKey = 'apf_em_'.md5( $sPressedInputNameFlat.get_current_user_id() ); |
|
| 90 | 90 | $_aEmailOptions = $this->getTransient( $_sTranskentKey ); |
| 91 | 91 | $this->deleteTransient( $_sTranskentKey ); |
| 92 | 92 | |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | 'name' => '', |
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | - $_sTransientKey = 'apf_emd_' . md5( $sPressedInputNameFlat . get_current_user_id() ); |
|
| 104 | + $_sTransientKey = 'apf_emd_'.md5( $sPressedInputNameFlat.get_current_user_id() ); |
|
| 105 | 105 | $_aFormEmailData = array( |
| 106 | 106 | 'email_options' => $_aEmailOptions, |
| 107 | 107 | 'input' => $aInputs, |
| 108 | 108 | 'section_id' => $sSubmitSectionID, |
| 109 | 109 | ); |
| 110 | - $_bIsSet = $this->setTransient( $_sTransientKey, $_aFormEmailData, 100 ); |
|
| 110 | + $_bIsSet = $this->setTransient( $_sTransientKey, $_aFormEmailData, 100 ); |
|
| 111 | 111 | |
| 112 | 112 | // Send the email in the background. |
| 113 | 113 | wp_remote_get( |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | 127 | // @remark Not possible to tell whether it is sent or not at the moment because it is performed in the background. |
| 128 | - $_bSent = $_bIsSet; |
|
| 128 | + $_bSent = $_bIsSet; |
|
| 129 | 129 | $this->oFactory->setSettingNotice( |
| 130 | 130 | $this->oFactory->oMsg->get( |
| 131 | 131 | $this->getAOrB( |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @return string |
| 148 | 148 | */ |
| 149 | 149 | public function _replyToRemoveConfirmationQueryKey( $sSettingUpdateURL ) { |
| 150 | - return remove_query_arg( array( 'confirmation', ), $sSettingUpdateURL ); |
|
| 150 | + return remove_query_arg( array( 'confirmation',), $sSettingUpdateURL ); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 35 | 35 | |
| 36 | - if ( ! $this->_shouldProceed() ) { |
|
| 36 | + if ( !$this->_shouldProceed() ) { |
|
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | 39 | $this->_exportOptions( |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | protected function _exportOptions( $mData, $sPageSlug, $sTabSlug ) { |
| 68 | 68 | |
| 69 | - $_oExport = new AdminPageFramework_ExportOptions( |
|
| 69 | + $_oExport = new AdminPageFramework_ExportOptions( |
|
| 70 | 70 | $_POST[ '__export' ], |
| 71 | 71 | $this->oFactory->oProp->sClassName |
| 72 | 72 | ); |
| 73 | - $_aArguments = array( |
|
| 73 | + $_aArguments = array( |
|
| 74 | 74 | 'class_name' => $this->oFactory->oProp->sClassName, |
| 75 | 75 | 'page_slug' => $sPageSlug, |
| 76 | 76 | 'tab_slug' => $sTabSlug, |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $sExportFileName, |
| 143 | 143 | $aArguments[ 'pressed_field_id' ], |
| 144 | 144 | $aArguments[ 'pressed_input_id' ], |
| 145 | - $mData, // 3.4.6+ |
|
| 145 | + $mData, // 3.4.6+ |
|
| 146 | 146 | $this->oFactory // 3.4.6+ |
| 147 | 147 | ); |
| 148 | 148 | } |
@@ -91,6 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @since 3.5.4 |
| 93 | 93 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
| 94 | + * @param string $sFileName |
|
| 94 | 95 | * @return array |
| 95 | 96 | */ |
| 96 | 97 | private function _getExportHeaderArray( array $aArguments, $sFileName, $mData ) { |
@@ -131,6 +132,7 @@ discard block |
||
| 131 | 132 | * @since 3.5.3 |
| 132 | 133 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
| 133 | 134 | * @internal |
| 135 | + * @param string $mData |
|
| 134 | 136 | * @return string The export file name. |
| 135 | 137 | */ |
| 136 | 138 | private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
@@ -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 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function _replyToEnableMetaBox() { |
| 53 | 53 | |
| 54 | - if ( ! $this->_isMetaBoxAdded() ) { |
|
| 54 | + if ( !$this->_isMetaBoxAdded() ) { |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $_sCurrentScreenID = $this->getCurrentScreenID(); |
|
| 58 | + $_sCurrentScreenID = $this->getCurrentScreenID(); |
|
| 59 | 59 | |
| 60 | 60 | // Trigger the add_meta_boxes hooks to allow meta boxes to be added. |
| 61 | 61 | do_action( "add_meta_boxes_{$_sCurrentScreenID}", null ); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | // the network admin adds '-network' in the screen ID and the hooks with that id won't be triggered so use the 'page_hook' global variable. |
| 86 | 86 | if ( isset( $GLOBALS[ 'page_hook' ] ) ) { |
| 87 | 87 | add_action( |
| 88 | - "admin_footer-{$GLOBALS['page_hook']}", |
|
| 88 | + "admin_footer-{$GLOBALS[ 'page_hook' ]}", |
|
| 89 | 89 | array( $this, '_replyToAddMetaboxScript' ) |
| 90 | 90 | ); |
| 91 | 91 | } |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $_sPageSlug = $this->getElement( $_GET, 'page', '' ); |
| 112 | - if ( ! $_sPageSlug ) { |
|
| 112 | + if ( !$_sPageSlug ) { |
|
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - foreach( $_aPageMetaBoxClasses as $_sClassName => $_oMetaBox ) { |
|
| 116 | + foreach ( $_aPageMetaBoxClasses as $_sClassName => $_oMetaBox ) { |
|
| 117 | 117 | if ( $this->_isPageOfMetaBox( $_sPageSlug, $_oMetaBox ) ) { |
| 118 | 118 | return true; |
| 119 | 119 | } |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private function _isPageOfMetaBox( $sPageSlug, $oMetaBox ) { |
| 134 | 134 | |
| 135 | - if ( in_array( $sPageSlug , $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 135 | + if ( in_array( $sPageSlug, $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 136 | 136 | return true; // for numeric keys with a string value. |
| 137 | 137 | } |
| 138 | - if ( ! array_key_exists( $sPageSlug , $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 138 | + if ( !array_key_exists( $sPageSlug, $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 139 | 139 | return false; // for keys of page slugs, the key does not exist, it means not added. |
| 140 | 140 | } |
| 141 | 141 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | * @param string $sTextDomain (optional) The text domain applied to the displayed text messages. Default: `admin-page-framework`. |
| 55 | 55 | * @return void |
| 56 | 56 | */ |
| 57 | - public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
| 57 | + public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
| 58 | 58 | |
| 59 | - if ( ! $this->_isInstantiatable() ) { |
|
| 59 | + if ( !$this->_isInstantiatable() ) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | if ( empty( $asPostTypeOrScreenID ) ) { |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | // A property object needs to be done first. |
| 67 | 67 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
| 68 | 68 | ? $this->aSubClassNames[ 'oProp' ] |
| 69 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
| 70 | - $this->oProp = new $_sProprtyClassName( |
|
| 69 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
| 70 | + $this->oProp = new $_sProprtyClassName( |
|
| 71 | 71 | $this, |
| 72 | 72 | get_class( $this ), |
| 73 | 73 | $sCapability, |
| 74 | 74 | $sTextDomain, |
| 75 | 75 | $this->_sStructureType |
| 76 | 76 | ); |
| 77 | - $this->oProp->aPostTypes = is_string( $asPostTypeOrScreenID ) |
|
| 77 | + $this->oProp->aPostTypes = is_string( $asPostTypeOrScreenID ) |
|
| 78 | 78 | ? array( $asPostTypeOrScreenID ) |
| 79 | 79 | : $asPostTypeOrScreenID; |
| 80 | 80 | |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | * @internal |
| 147 | 147 | * @return integer The found post ID. `0` if not found. |
| 148 | 148 | */ |
| 149 | - private function _getPostID() { |
|
| 149 | + private function _getPostID() { |
|
| 150 | 150 | |
| 151 | 151 | // for an editing post page. |
| 152 | 152 | if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
@@ -20,6 +20,8 @@ |
||
| 20 | 20 | /** |
| 21 | 21 | * Sets up hooks. |
| 22 | 22 | * @since 3.7.9 |
| 23 | + * @param string $sMetaBoxID |
|
| 24 | + * @param string $sTitle |
|
| 23 | 25 | */ |
| 24 | 26 | public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
| 25 | 27 | |
@@ -167,11 +167,11 @@ |
||
| 167 | 167 | * |
| 168 | 168 | * Triggered when a post has not been created so no post id is assigned. |
| 169 | 169 | * |
| 170 | - * @internal |
|
| 170 | + * @internal |
|
| 171 | 171 | * @since 3.3.0 |
| 172 | 172 | * @callback filter wp_insert_attachment_data |
| 173 | 173 | * @callback filter wp_insert_post_data |
| 174 | - * @param array $aPostData An array of slashed post data. |
|
| 174 | + * @param array $aPostData An array of slashed post data. |
|
| 175 | 175 | * @param array $aUnmodified An array of sanitized, but otherwise unmodified post data. |
| 176 | 176 | */ |
| 177 | 177 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | * Sets up hooks. |
| 22 | 22 | * @since 3.7.9 |
| 23 | 23 | */ |
| 24 | - public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
| 24 | + public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
| 25 | 25 | |
| 26 | 26 | // This is important to set the hooks before the parent constructor |
| 27 | 27 | // as the setUp wil be called in there if the default action hook (current_screen) is already triggered. |
| 28 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
| 29 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
| 28 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
| 29 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
| 30 | 30 | |
| 31 | 31 | parent::__construct( |
| 32 | 32 | $sMetaBoxID, |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | * @callback add_meta_boxes |
| 107 | 107 | */ |
| 108 | 108 | public function _replyToRegisterMetaBoxes() { |
| 109 | - foreach( $this->oProp->aPostTypes as $_sPostType ) { |
|
| 109 | + foreach ( $this->oProp->aPostTypes as $_sPostType ) { |
|
| 110 | 110 | add_meta_box( |
| 111 | - $this->oProp->sMetaBoxID, // id |
|
| 112 | - $this->oProp->sTitle, // title |
|
| 111 | + $this->oProp->sMetaBoxID, // id |
|
| 112 | + $this->oProp->sTitle, // title |
|
| 113 | 113 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
| 114 | - $_sPostType, // post type |
|
| 115 | - $this->oProp->sContext, // context |
|
| 116 | - $this->oProp->sPriority, // priority |
|
| 114 | + $_sPostType, // post type |
|
| 115 | + $this->oProp->sContext, // context |
|
| 116 | + $this->oProp->sPriority, // priority |
|
| 117 | 117 | null // argument - deprecated $this->oForm->aFields |
| 118 | 118 | ); |
| 119 | 119 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @internal |
| 146 | 146 | * @return integer The found post ID. `0` if not found. |
| 147 | 147 | */ |
| 148 | - private function _getPostID() { |
|
| 148 | + private function _getPostID() { |
|
| 149 | 149 | |
| 150 | 150 | // for an editing post page. |
| 151 | 151 | if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
@@ -177,14 +177,14 @@ discard block |
||
| 177 | 177 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
| 178 | 178 | |
| 179 | 179 | // Perform initial checks. |
| 180 | - if ( ! $this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 180 | + if ( !$this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 181 | 181 | return $aPostData; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Retrieve the submitted data. |
| 185 | - $_aInputs = $this->oForm->getSubmittedData( |
|
| 186 | - $_POST, // subject data to be parsed |
|
| 187 | - true, // extract data with the fieldset structure |
|
| 185 | + $_aInputs = $this->oForm->getSubmittedData( |
|
| 186 | + $_POST, // subject data to be parsed |
|
| 187 | + true, // extract data with the fieldset structure |
|
| 188 | 188 | false // strip slashes |
| 189 | 189 | ); |
| 190 | 190 | $_aInputsRaw = $_aInputs; // store one for the last input array. |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $this->oForm->updateMetaDataByType( |
| 222 | - $_iPostID, // object id |
|
| 223 | - $_aInputs, // user submit form data |
|
| 222 | + $_iPostID, // object id |
|
| 223 | + $_aInputs, // user submit form data |
|
| 224 | 224 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
| 225 | 225 | $this->oForm->sStructureType // fields type |
| 226 | 226 | ); |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // If our nonce isn't there, or we can't verify it, bail |
| 280 | - if ( ! isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
| 280 | + if ( !isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
| 281 | 281 | return false; |
| 282 | 282 | } |
| 283 | - if ( ! wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
| 283 | + if ( !wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
| 284 | 284 | return false; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - if ( ! in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes ) ) { |
|
| 287 | + if ( !in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes ) ) { |
|
| 288 | 288 | return false; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -77,21 +77,21 @@ |
||
| 77 | 77 | * @param string $sPriority The priority, either `high`, `core`, `default` or `low`. |
| 78 | 78 | * @param string $sCapability The capability. See <a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Roles and Capabilities</a>. |
| 79 | 79 | */ |
| 80 | - public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs=array(), $sContext='normal', $sPriority='default', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
| 80 | + public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs = array(), $sContext = 'normal', $sPriority = 'default', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
| 81 | 81 | |
| 82 | 82 | if ( empty( $asPageSlugs ) ) { |
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if ( ! $this->_isInstantiatable() ) { |
|
| 86 | + if ( !$this->_isInstantiatable() ) { |
|
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // The property object needs to be done first before the parent constructor. |
| 91 | 91 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
| 92 | 92 | ? $this->aSubClassNames[ 'oProp' ] |
| 93 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
| 94 | - $this->oProp = new $_sProprtyClassName( |
|
| 93 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
| 94 | + $this->oProp = new $_sProprtyClassName( |
|
| 95 | 95 | $this, |
| 96 | 96 | get_class( $this ), |
| 97 | 97 | $sCapability, |