@@ -76,21 +76,21 @@ |
||
76 | 76 | * @param string $sPriority The priority, either `high`, `core`, `default` or `low`. |
77 | 77 | * @param string $sCapability The capability. See <a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Roles and Capabilities</a>. |
78 | 78 | */ |
79 | - public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs=array(), $sContext='normal', $sPriority='default', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
79 | + public function __construct( $sMetaBoxID, $sTitle, $asPageSlugs = array(), $sContext = 'normal', $sPriority = 'default', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
80 | 80 | |
81 | 81 | if ( empty( $asPageSlugs ) ) { |
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - if ( ! $this->_isInstantiatable() ) { |
|
85 | + if ( !$this->_isInstantiatable() ) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | 89 | // The property object needs to be done first before the parent constructor. |
90 | 90 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
91 | 91 | ? $this->aSubClassNames[ 'oProp' ] |
92 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
93 | - $this->oProp = new $_sPropertyClassName( |
|
92 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
93 | + $this->oProp = new $_sPropertyClassName( |
|
94 | 94 | $this, |
95 | 95 | get_class( $this ), |
96 | 96 | $sCapability, |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string The text domain. Default: `admin-page-framework`. |
46 | 46 | * @return void |
47 | 47 | */ |
48 | - function __construct( $asTaxonomySlug, $sOptionKey='', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
48 | + function __construct( $asTaxonomySlug, $sOptionKey = '', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
49 | 49 | |
50 | 50 | if ( empty( $asTaxonomySlug ) ) { |
51 | 51 | return; |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | // Properties |
55 | 55 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
56 | 56 | ? $this->aSubClassNames[ 'oProp' ] |
57 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
58 | - $this->oProp = new $_sPropertyClassName( |
|
57 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
58 | + $this->oProp = new $_sPropertyClassName( |
|
59 | 59 | $this, |
60 | 60 | get_class( $this ), |
61 | 61 | $sCapability, |
@@ -38,16 +38,16 @@ |
||
38 | 38 | * @since 3.7.4 Changed the default capability value to `read`. |
39 | 39 | * @todo Examine the appropriate default capability level. |
40 | 40 | */ |
41 | - public function __construct( $sCapability='read', $sTextDomain='admin-page-framework' ) { |
|
41 | + public function __construct( $sCapability = 'read', $sTextDomain = 'admin-page-framework' ) { |
|
42 | 42 | |
43 | 43 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
44 | 44 | ? $this->aSubClassNames[ 'oProp' ] |
45 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
45 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
46 | 46 | $this->oProp = new $_sPropertyClassName( |
47 | - $this, // the caller object |
|
48 | - get_class( $this ), // the caller class name |
|
49 | - $sCapability, // the capability level |
|
50 | - $sTextDomain, // the text domain |
|
47 | + $this, // the caller object |
|
48 | + get_class( $this ), // the caller class name |
|
49 | + $sCapability, // the capability level |
|
50 | + $sTextDomain, // the text domain |
|
51 | 51 | $this->_sStructureType // the structure type |
52 | 52 | ); |
53 | 53 |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 3.3.0 |
28 | 28 | */ |
29 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
29 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
30 | 30 | |
31 | 31 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
32 | 32 | ? $this->aSubClassNames[ 'oProp' ] |
33 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
33 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
34 | 34 | |
35 | 35 | $this->oProp = new $_sPropertyClassName( |
36 | 36 | $this, |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | // if ( $this->oProp->bIsAdminAjax ) { |
48 | 48 | // return; |
49 | 49 | // } |
50 | - if ( ! $this->oProp->bIsAdmin ) { |
|
50 | + if ( !$this->oProp->bIsAdmin ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | 54 | add_action( 'wp_loaded', array( $this, '_replyToDetermineToLoad' ) ); |
55 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToLoadComponentsForAjax' ), 100 ); |
|
55 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToLoadComponentsForAjax' ), 100 ); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | * @callback add_action set_up_{extended class name} |
65 | 65 | */ |
66 | 66 | public function _replyToLoadComponentsForAjax() { |
67 | - if ( ! $this->oProp->bIsAdminAjax ) { |
|
67 | + if ( !$this->oProp->bIsAdminAjax ) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
71 | 71 | new AdminPageFramework_Model_Menu__RegisterMenu( $this, 'pseudo_admin_menu' ); |
72 | 72 | do_action( 'pseudo_admin_menu', '' ); |
73 | - do_action( 'pseudo_current_screen' ); // @deprecated 3.8.22 Kept for backward-compatibility |
|
73 | + do_action( 'pseudo_current_screen' ); // @deprecated 3.8.22 Kept for backward-compatibility |
|
74 | 74 | |
75 | 75 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
76 | 76 | if ( $this->oProp->isPageAdded( $_sPageSlug ) ) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
118 | 118 | * @internal |
119 | 119 | */ |
120 | - public function __call( $sMethodName, $aArgs=null ) { |
|
120 | + public function __call( $sMethodName, $aArgs = null ) { |
|
121 | 121 | |
122 | 122 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
123 | 123 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | 'load_pre_', |
129 | 129 | ); |
130 | 130 | |
131 | - switch( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
131 | + switch ( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
132 | 132 | |
133 | 133 | // add_settings_section() callback |
134 | 134 | case 'section_pre_': |
135 | - return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
135 | + return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
136 | 136 | |
137 | 137 | // add_settings_field() callback |
138 | 138 | case 'field_pre_': |
139 | - return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
139 | + return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
140 | 140 | |
141 | 141 | // load-{page} callback |
142 | 142 | case 'load_pre_': |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * @return string The found callback method name or the prefix of a known callback method name. An empty string if not found. |
155 | 155 | * @internal |
156 | 156 | */ |
157 | - private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes=array() ) { |
|
157 | + private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes = array() ) { |
|
158 | 158 | |
159 | - foreach( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
159 | + foreach ( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
160 | 160 | if ( $this->oUtil->hasPrefix( $_sMethodPrefix, $sMethodName ) ) { |
161 | 161 | return $_sMethodPrefix; |
162 | 162 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function _doPageLoadCall( $sMethodName, $sPageSlug, $sTabSlug, $oScreen ) { |
182 | 182 | |
183 | - if ( ! $this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen ) ) { |
|
183 | + if ( !$this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen ) ) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | // the tab slug will be empty unless an in-page tab is added. |
205 | 205 | $sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
206 | 206 | if ( strlen( $sTabSlug ) ) { |
207 | - $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
207 | + $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
208 | 208 | $this->oUtil->addAndDoActions( |
209 | 209 | $this, // the caller object |
210 | - array( "load_{$sPageSlug}_" . $sTabSlug ), |
|
210 | + array( "load_{$sPageSlug}_".$sTabSlug ), |
|
211 | 211 | $this // the admin page object - this lets third-party scripts use the framework methods. |
212 | 212 | ); |
213 | 213 | add_filter( 'admin_title', array( $this, '_replyToSetAdminPageTitleForTab' ), 1, 2 ); |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | * @since 3.8.8 |
234 | 234 | * @return void |
235 | 235 | */ |
236 | - private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug='' ) { |
|
236 | + private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug = '' ) { |
|
237 | 237 | |
238 | 238 | // For the page, |
239 | - if ( ! strlen( $sTabSlug ) ) { |
|
239 | + if ( !strlen( $sTabSlug ) ) { |
|
240 | 240 | $this->oProp->bShowDebugInfo = $this->oUtil->getElement( |
241 | 241 | $this->oProp->aPages, |
242 | 242 | array( $sPageSlug, 'show_debug_info' ), |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | if ( substr( $sMethodName, strlen( 'load_pre_' ) ) !== $sPageSlug ) { |
282 | 282 | return false; |
283 | 283 | } |
284 | - if ( ! isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
284 | + if ( !isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
285 | 285 | return false; |
286 | 286 | } |
287 | 287 | $_sPageHook = is_object( $osScreenORPageHook ) |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | // Nothing to do in the network admin area. |
310 | - return ! is_network_admin(); |
|
310 | + return !is_network_admin(); |
|
311 | 311 | |
312 | 312 | } |
313 | 313 | |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | */ |
323 | 323 | protected function _isInThePage() { |
324 | 324 | |
325 | - if ( ! $this->oProp->bIsAdmin ) { |
|
325 | + if ( !$this->oProp->bIsAdmin ) { |
|
326 | 326 | return false; |
327 | 327 | } |
328 | 328 | |
329 | 329 | // If the `setUp()` method is not loaded yet, nothing can be checked |
330 | 330 | // as there is not page is added. |
331 | - if ( ! did_action( 'set_up_' . $this->oProp->sClassName ) ) { |
|
331 | + if ( !did_action( 'set_up_'.$this->oProp->sClassName ) ) { |
|
332 | 332 | return true; |
333 | 333 | } |
334 | 334 |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $this->oProp->aInPageTabs, |
33 | 33 | array( $this->oProp->getCurrentPageSlug(), $this->oProp->getCurrentTabSlug(), 'title' ) |
34 | 34 | ); |
35 | - if ( ! $_sTabTitle ) { |
|
35 | + if ( !$_sTabTitle ) { |
|
36 | 36 | return $sAdminTitle; |
37 | 37 | } |
38 | - return $_sTabTitle . ' ‹ ' . $sAdminTitle; |
|
38 | + return $_sTabTitle.' ‹ '.$sAdminTitle; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | * @internal |
84 | 84 | */ |
85 | - protected function _renderPage( $sPageSlug, $sTabSlug=null ) { |
|
85 | + protected function _renderPage( $sPageSlug, $sTabSlug = null ) { |
|
86 | 86 | $_oPageRenderer = new AdminPageFramework_View__PageRenderer( $this, $sPageSlug, $sTabSlug ); |
87 | 87 | $_oPageRenderer->render(); |
88 | 88 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param string $sTextDomain (optional) The text domain applied to the displayed text messages. Default: `admin-page-framework`. |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
56 | + public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
57 | 57 | |
58 | - if ( ! $this->_isInstantiatable() ) { |
|
58 | + if ( !$this->_isInstantiatable() ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | if ( empty( $asPostTypeOrScreenID ) ) { |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | // A property object needs to be done first. |
66 | 66 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
67 | 67 | ? $this->aSubClassNames[ 'oProp' ] |
68 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
69 | - $this->oProp = new $_sPropertyClassName( |
|
68 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
69 | + $this->oProp = new $_sPropertyClassName( |
|
70 | 70 | $this, |
71 | 71 | get_class( $this ), |
72 | 72 | $sCapability, |
73 | 73 | $sTextDomain, |
74 | 74 | $this->_sStructureType |
75 | 75 | ); |
76 | - $this->oProp->aPostTypes = is_string( $asPostTypeOrScreenID ) |
|
76 | + $this->oProp->aPostTypes = is_string( $asPostTypeOrScreenID ) |
|
77 | 77 | ? array( $asPostTypeOrScreenID ) |
78 | 78 | : $asPostTypeOrScreenID; |
79 | 79 |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string The text domain of the caller script. |
104 | 104 | * @return void |
105 | 105 | */ |
106 | - public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
|
106 | + public function __construct( $sPostType, $aArguments = array(), $sCallerPath = null, $sTextDomain = 'admin-page-framework' ) { |
|
107 | 107 | |
108 | 108 | if ( empty( $sPostType ) ) { |
109 | 109 | return; |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | |
112 | 112 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
113 | 113 | ? $this->aSubClassNames[ 'oProp' ] |
114 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
114 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
115 | 115 | $this->oProp = new $_sPropertyClassName( |
116 | 116 | $this, |
117 | 117 | $this->_getCallerScriptPath( $sCallerPath ), |
118 | - get_class( $this ), // class name |
|
119 | - 'publish_posts', // capability |
|
120 | - $sTextDomain, // text domain |
|
118 | + get_class( $this ), // class name |
|
119 | + 'publish_posts', // capability |
|
120 | + $sTextDomain, // text domain |
|
121 | 121 | $this->_sStructureType // structure type |
122 | 122 | ); |
123 | - $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug( $sPostType ); |
|
123 | + $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug( $sPostType ); |
|
124 | 124 | |
125 | 125 | // Post type argument array structure |
126 | 126 | // @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $sCallerPath; |
144 | 144 | } |
145 | 145 | |
146 | - if ( ! is_admin() ) { |
|
146 | + if ( !is_admin() ) { |
|
147 | 147 | return null; |
148 | 148 | } |
149 | 149 | $_sPageNow = AdminPageFramework_Utility::getElement( $GLOBALS, 'pagenow' ); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string The text domain. Default: `admin-page-framework`. |
46 | 46 | * @return void |
47 | 47 | */ |
48 | - public function __construct( $asTaxonomySlug, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
48 | + public function __construct( $asTaxonomySlug, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
49 | 49 | |
50 | 50 | if ( empty( $asTaxonomySlug ) ) { |
51 | 51 | return; |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | // Properties |
55 | 55 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
56 | 56 | ? $this->aSubClassNames[ 'oProp' ] |
57 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
58 | - $this->oProp = new $_sPropertyClassName( |
|
57 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
58 | + $this->oProp = new $_sPropertyClassName( |
|
59 | 59 | $this, |
60 | 60 | get_class( $this ), |
61 | 61 | $sCapability, |
62 | 62 | $sTextDomain, |
63 | 63 | $this->_sStructureType |
64 | 64 | ); |
65 | - $this->oProp->aTaxonomySlugs = ( array ) $asTaxonomySlug; |
|
65 | + $this->oProp->aTaxonomySlugs = ( array ) $asTaxonomySlug; |
|
66 | 66 | |
67 | 67 | parent::__construct( $this->oProp ); |
68 | 68 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 0 => '', |
53 | 53 | 1 => 's', |
54 | 54 | ); |
55 | - $_sProtocol = substr( $_sServerProtocol, 0, strpos( $_sServerProtocol, '/' ) ) |
|
55 | + $_sProtocol = substr( $_sServerProtocol, 0, strpos( $_sServerProtocol, '/' ) ) |
|
56 | 56 | . $_aProtocolSuffix[ ( int ) $_bSSL ]; |
57 | 57 | |
58 | 58 | // Port: e.g. :80 |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | ? $_SERVER[ 'HTTP_HOST' ] |
66 | 66 | : $_SERVER[ 'SERVER_NAME' ] |
67 | 67 | ); |
68 | - $_sHost = preg_replace( '/:.+/', '', $_sHost ); // remove the port part in case it is added. |
|
69 | - return $_sProtocol . '://' . $_sHost . $_sPort . $_SERVER[ 'REQUEST_URI' ]; |
|
68 | + $_sHost = preg_replace( '/:.+/', '', $_sHost ); // remove the port part in case it is added. |
|
69 | + return $_sProtocol.'://'.$_sHost.$_sPort.$_SERVER[ 'REQUEST_URI' ]; |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | /** |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | ? ( string ) $_SERVER[ 'SERVER_PORT' ] |
81 | 81 | : ''; |
82 | 82 | $_aPort = array( |
83 | - 0 => ':' . $_sPort, |
|
83 | + 0 => ':'.$_sPort, |
|
84 | 84 | 1 => '', |
85 | 85 | ); |
86 | - $_bPortSet = ( ! $bSSL && '80' === $_sPort ) || ( $bSSL && '443' === $_sPort ); |
|
86 | + $_bPortSet = ( !$bSSL && '80' === $_sPort ) || ( $bSSL && '443' === $_sPort ); |
|
87 | 87 | return $_aPort[ ( int ) $_bPortSet ]; |
88 | 88 | } |
89 | 89 |