@@ -63,7 +63,7 @@ |
||
63 | 63 | * @return void |
64 | 64 | * @internal |
65 | 65 | */ |
66 | - protected function _renderPage( $sPageSlug, $sTabSlug=null ) { |
|
66 | + protected function _renderPage( $sPageSlug, $sTabSlug = null ) { |
|
67 | 67 | $_oPageRenderer = new AdminPageFramework_View__PageRenderer( $this, $sPageSlug, $sTabSlug ); |
68 | 68 | $_oPageRenderer->render(); |
69 | 69 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @since 3.3.0 |
59 | 59 | * @since 3.3.1 Moved from `AdminPageFramework_Setting_Base`. |
60 | 60 | */ |
61 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
61 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
62 | 62 | |
63 | 63 | parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain ); |
64 | 64 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // if ( $this->oProp->bIsAdminAjax ) { |
67 | 67 | // return; |
68 | 68 | // } |
69 | - if ( ! $this->oProp->bIsAdmin ) { |
|
69 | + if ( !$this->oProp->bIsAdmin ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'section_title' => null, |
117 | 117 | 'section_id' => null, |
118 | 118 | ); |
119 | - if ( ! $aFieldset[ 'help' ] ) { |
|
119 | + if ( !$aFieldset[ 'help' ] ) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'help_tab_id' => $_sRootSectionID, |
135 | 135 | 'help_tab_content' => "<span class='contextual-help-tab-title'>" |
136 | 136 | . $aFieldset[ 'title' ] |
137 | - . "</span> - " . PHP_EOL |
|
137 | + . "</span> - ".PHP_EOL |
|
138 | 138 | . $aFieldset[ 'help' ], |
139 | 139 | 'help_tab_sidebar_content' => $aFieldset[ 'help_aside' ] |
140 | 140 | ? $aFieldset[ 'help_aside' ] |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | public function _registerHelpPaneItemsOfFormSections( $aSectionsets ) { |
169 | 169 | // @todo Test if help pane item gets displayed |
170 | 170 | |
171 | - foreach( $aSectionsets as $_aSectionset ) { |
|
171 | + foreach ( $aSectionsets as $_aSectionset ) { |
|
172 | 172 | // @todo check capability and conditions |
173 | 173 | $_aSectionset = $_aSectionset + array( |
174 | 174 | 'help' => null, |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function _replyToDetermineSectionsetVisibility( $bVisible, $aSectionset ) { |
204 | 204 | |
205 | - if ( ! current_user_can( $aSectionset[ 'capability' ] ) ) { |
|
205 | + if ( !current_user_can( $aSectionset[ 'capability' ] ) ) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | - if ( ! $aSectionset[ 'if' ] ) { |
|
208 | + if ( !$aSectionset[ 'if' ] ) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | - if ( ! $this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
211 | + if ( !$this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
212 | 212 | return false; |
213 | 213 | } |
214 | 214 | return $bVisible; |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | private function _isSectionOfCurrentPage( array $aSectionset ) { |
227 | 227 | |
228 | 228 | // Make sure the value type is string so that when the page_slug is not set, it won't match. |
229 | - $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
|
229 | + $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
|
230 | 230 | |
231 | 231 | // Make sure if it's in the loading page. |
232 | - if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
232 | + if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // If no tag is specified, the user wants to display the section regardless of the tab. |
237 | - if ( ! $aSectionset[ 'tab_slug' ] ) { |
|
237 | + if ( !$aSectionset[ 'tab_slug' ] ) { |
|
238 | 238 | return true; |
239 | 239 | } |
240 | 240 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function _replyToDetermineFieldsetVisibility( $bVisible, $aFieldset ) { |
252 | 252 | |
253 | - $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
|
253 | + $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
|
254 | 254 | |
255 | 255 | // If the specified field does not exist, do nothing. |
256 | 256 | if ( $aFieldset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | array( $_sSectionPath, 'page_slug' ), |
281 | 281 | $this->oProp->getCurrentPageSlugIfAdded() |
282 | 282 | ); |
283 | - $aFieldset[ 'tab_slug' ] = $this->oUtil->getElement( |
|
283 | + $aFieldset[ 'tab_slug' ] = $this->oUtil->getElement( |
|
284 | 284 | $aSectionsets, |
285 | 285 | array( $_sSectionPath, 'tab_slug' ), |
286 | 286 | $this->oProp->getCurrentInPageTabSlugIfAdded() |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $aSectionsets, |
292 | 292 | $_sSectionPath |
293 | 293 | ); |
294 | - $aFieldset[ 'section_title' ] = $this->oUtil->getElement( |
|
294 | + $aFieldset[ 'section_title' ] = $this->oUtil->getElement( |
|
295 | 295 | $_aSectionset, |
296 | 296 | 'title' |
297 | 297 | ); |
298 | - $aFieldset[ 'capability' ] = $aFieldset[ 'capability' ] |
|
298 | + $aFieldset[ 'capability' ] = $aFieldset[ 'capability' ] |
|
299 | 299 | ? $aFieldset[ 'capability' ] |
300 | 300 | : $this->_replyToGetCapabilityForForm( |
301 | 301 | $this->oUtil->getElement( $_aSectionset, 'capability' ), |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | |
346 | 346 | // Find the capability of the parent section if nested. |
347 | 347 | if ( 0 < $aSectionset[ '_nested_depth' ] ) { |
348 | - $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
|
348 | + $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
|
349 | 349 | array_pop( $_aSectionPath ); // remove the last element |
350 | 350 | $_sParentCapability = $this->oUtil->getElement( |
351 | 351 | $this->oForm->aSectionsets, |
352 | 352 | array_merge( $_aSectionPath, array( 'capability' ) ) |
353 | 353 | ); |
354 | - if( $_sParentCapability ) { |
|
354 | + if ( $_sParentCapability ) { |
|
355 | 355 | return $_sParentCapability; |
356 | 356 | } |
357 | 357 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @internal |
26 | 26 | */ |
27 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
27 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
28 | 28 | |
29 | 29 | parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain ); |
30 | 30 |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function _appendInternalAssets( $sInternal, &$aContainer ) { |
69 | 69 | $_aInternals = array_unique( $aContainer ); |
70 | - $sInternal = PHP_EOL . $sInternal; |
|
71 | - foreach( $_aInternals as $_iIndex => $_sInternal ) { |
|
72 | - $sInternal .= $_sInternal . PHP_EOL; |
|
70 | + $sInternal = PHP_EOL.$sInternal; |
|
71 | + foreach ( $_aInternals as $_iIndex => $_sInternal ) { |
|
72 | + $sInternal .= $_sInternal.PHP_EOL; |
|
73 | 73 | unset( $_aInternals[ $_iIndex ] ); |
74 | 74 | } |
75 | 75 | $aContainer = $_aInternals; // update the container array. |
@@ -83,23 +83,23 @@ discard block |
||
83 | 83 | private function _parseAssets( $oFactory ) { |
84 | 84 | |
85 | 85 | // page |
86 | - $_aPageStyles = $this->getElementAsArray( |
|
86 | + $_aPageStyles = $this->getElementAsArray( |
|
87 | 87 | $oFactory->oProp->aPages, |
88 | 88 | array( $this->sCurrentPageSlug, 'style' ) |
89 | 89 | ); |
90 | 90 | $this->_enqueuePageAssets( $_aPageStyles, 'style' ); |
91 | 91 | |
92 | - $_aPageScripts = $this->getElementAsArray( |
|
92 | + $_aPageScripts = $this->getElementAsArray( |
|
93 | 93 | $oFactory->oProp->aPages, |
94 | 94 | array( $this->sCurrentPageSlug, 'script' ) |
95 | 95 | ); |
96 | 96 | $this->_enqueuePageAssets( $_aPageScripts, 'script' ); |
97 | 97 | |
98 | 98 | // In-page tabs |
99 | - if ( ! $this->sCurrentTabSlug ) { |
|
99 | + if ( !$this->sCurrentTabSlug ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | - $_aInPageTabStyles = $this->getElementAsArray( |
|
102 | + $_aInPageTabStyles = $this->getElementAsArray( |
|
103 | 103 | $oFactory->oProp->aInPageTabs, |
104 | 104 | array( $this->sCurrentPageSlug, $this->sCurrentTabSlug, 'style' ) |
105 | 105 | ); |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * @since 3.6.3 |
117 | 117 | * @return void |
118 | 118 | */ |
119 | - private function _enqueuePageAssets( array $aPageAssets, $sType='style' ) { |
|
120 | - $_sMathodName = "_enqueueAsset_" . $sType; |
|
121 | - foreach( $aPageAssets as $_asPageAsset ) { |
|
122 | - $this->{$_sMathodName}( $_asPageAsset); |
|
119 | + private function _enqueuePageAssets( array $aPageAssets, $sType = 'style' ) { |
|
120 | + $_sMathodName = "_enqueueAsset_".$sType; |
|
121 | + foreach ( $aPageAssets as $_asPageAsset ) { |
|
122 | + $this->{$_sMathodName}( $_asPageAsset ); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | // Insert the CSS rule in the head tag. |
147 | - $this->aCSSRules[] = $_sSRC; |
|
147 | + $this->aCSSRules[ ] = $_sSRC; |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | // Insert the scripts in the head tag. |
172 | - $this->aScripts[] = $_sSRC; |
|
172 | + $this->aScripts[ ] = $_sSRC; |
|
173 | 173 | |
174 | 174 | } |
175 | 175 |
@@ -149,7 +149,7 @@ |
||
149 | 149 | * @since 3.5.3 |
150 | 150 | * @return string The found page slug. An empty string if not found. |
151 | 151 | * @remark Do not return `null` when not found as some framework methods check the retuened value with `isset()` and if null is given, `isset()` yields `false` while it does `true` for an emtpy string (''). |
152 | - */ |
|
152 | + */ |
|
153 | 153 | public function getCurrentPageSlug() { |
154 | 154 | return isset( $_GET[ 'page' ] ) |
155 | 155 | ? $_GET[ 'page' ] |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Sets up hooks and properties. |
58 | 58 | */ |
59 | - public function __construct( $oCaller, $sClassName, $sCapability='manage_options', $sTextDomain='admin-page-framework', $sStructureType='page_meta_box' ) { |
|
59 | + public function __construct( $oCaller, $sClassName, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework', $sStructureType = 'page_meta_box' ) { |
|
60 | 60 | |
61 | 61 | // Let them overload. |
62 | 62 | unset( |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | public function _getScreenIDOfPage( $sPageSlug ) { |
106 | 106 | $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ); |
107 | 107 | return $_oAdminPage |
108 | - ? $_oAdminPage->oProp->aPages[ $sPageSlug ][ '_page_hook' ] . ( is_network_admin() ? '-network' : '' ) |
|
108 | + ? $_oAdminPage->oProp->aPages[ $sPageSlug ][ '_page_hook' ].( is_network_admin() ? '-network' : '' ) |
|
109 | 109 | : ''; |
110 | 110 | } |
111 | 111 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @since 3.0.0 |
116 | 116 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
117 | 117 | */ |
118 | - public function isPageAdded( $sPageSlug='' ) { |
|
118 | + public function isPageAdded( $sPageSlug = '' ) { |
|
119 | 119 | $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ); |
120 | 120 | return $_oAdminPage |
121 | 121 | ? $_oAdminPage->oProp->isPageAdded( $sPageSlug ) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | public function isCurrentTab( $sTabSlug ) { |
133 | 133 | |
134 | 134 | $_sCurrentPageSlug = $this->getElement( $_GET, 'page' ); |
135 | - if ( ! $_sCurrentPageSlug ) { |
|
135 | + if ( !$_sCurrentPageSlug ) { |
|
136 | 136 | return false; |
137 | 137 | } |
138 | 138 | $_sCurrentTabSlug = $this->getElement( |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getDefaultInPageTab( $sPageSlug ) { |
187 | 187 | |
188 | - if ( ! $sPageSlug ) { |
|
188 | + if ( !$sPageSlug ) { |
|
189 | 189 | return ''; |
190 | 190 | } |
191 | 191 | return ( $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ) ) |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getOptionKey( $sPageSlug ) { |
202 | 202 | |
203 | - if ( ! $sPageSlug ) { |
|
203 | + if ( !$sPageSlug ) { |
|
204 | 204 | return ''; |
205 | 205 | } |
206 | 206 | return ( $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ) ) |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $GLOBALS, |
228 | 228 | array( 'aAdminPageFramework', 'aPageClasses' ) |
229 | 229 | ); |
230 | - foreach( $_aPageClasses as $_oAdminPage ) { |
|
230 | + foreach ( $_aPageClasses as $_oAdminPage ) { |
|
231 | 231 | if ( $_oAdminPage->oProp->isPageAdded( $sPageSlug ) ) { |
232 | 232 | return $_oAdminPage; |
233 | 233 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function construct() { |
30 | 30 | |
31 | 31 | add_filter( |
32 | - 'options_' . $this->aArguments[ 'caller_id' ], |
|
32 | + 'options_'.$this->aArguments[ 'caller_id' ], |
|
33 | 33 | array( $this, '_replyToSanitizeSavedFormData' ), |
34 | 34 | 5 // high priority as it must be done earlier |
35 | 35 | ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | // Extract the meta box field form data (options) from the page form data (options). |
55 | 55 | return $this->castArrayContents( |
56 | - $this->getDataStructureFromAddedFieldsets(), // form data structure generate from fieldsets |
|
56 | + $this->getDataStructureFromAddedFieldsets(), // form data structure generate from fieldsets |
|
57 | 57 | $aSavedFormData |
58 | 58 | ); |
59 | 59 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @since 3.0.0 |
23 | 23 | */ |
24 | - public function enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
24 | + public function enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
25 | 25 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
26 | 26 | return $this->oResource->_enqueueStyles( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
27 | 27 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param array (optional) The argument array for more advanced parameters. |
38 | 38 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
39 | 39 | */ |
40 | - public function enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
40 | + public function enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
41 | 41 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
42 | 42 | return $this->oResource->_enqueueStyle( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
43 | 43 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 2.1.5 |
49 | 49 | */ |
50 | - public function enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
50 | + public function enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
51 | 51 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
52 | 52 | return $this->oResource->_enqueueScripts( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
53 | 53 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param array (optional) The argument array for more advanced parameters. |
64 | 64 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
65 | 65 | */ |
66 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
66 | + public function enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
67 | 67 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
68 | 68 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
69 | 69 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function _isInThePage() { |
46 | 46 | |
47 | - if ( ! $this->oProp->bIsAdmin ) { |
|
47 | + if ( !$this->oProp->bIsAdmin ) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Foe admin-ajax.php, aQuery holds the referer's GET URL parameters so the check covers the cases of ajax calls. |
52 | 52 | $_sPageSlug = $this->oUtil->getElement( $this->oProp->aQuery, array( 'page' ), '' ); |
53 | - if ( ! $this->___isAddedPage( $_sPageSlug ) ) { |
|
53 | + if ( !$this->___isAddedPage( $_sPageSlug ) ) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 | return true; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | private function ___isAddedPage( $sPageSlug ) { |
64 | 64 | |
65 | 65 | // for cases that page slugs are stored with numeric index |
66 | - if ( ! $this->oUtil->isAssociative( $this->oProp->aPageSlugs ) |
|
67 | - && ! in_array( $sPageSlug, $this->oProp->aPageSlugs ) |
|
66 | + if ( !$this->oUtil->isAssociative( $this->oProp->aPageSlugs ) |
|
67 | + && !in_array( $sPageSlug, $this->oProp->aPageSlugs ) |
|
68 | 68 | ) { |
69 | 69 | return false; |
70 | 70 | } |
@@ -23,12 +23,12 @@ |
||
23 | 23 | * @since 3.0.0 |
24 | 24 | * @deprecated 3.7.0 Use `AdminPageFramework_PageMetaBox` instead. |
25 | 25 | */ |
26 | - public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs=array(), $sContext='normal', $sPriority='default', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
26 | + public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs = array(), $sContext = 'normal', $sPriority = 'default', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
27 | 27 | |
28 | 28 | parent::__construct( $sMetaBoxID, $sTitle, $asPageSlugs, $sContext, $sPriority, $sCapability, $sTextDomain ); |
29 | 29 | |
30 | 30 | $this->oUtil->showDeprecationNotice( |
31 | - 'The class, ' . __CLASS__ . ',', // deprecated item |
|
31 | + 'The class, '.__CLASS__.',', // deprecated item |
|
32 | 32 | 'AdminPageFramework_PageMetaBox' // alternative |
33 | 33 | ); |
34 | 34 |