@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
18 | 18 | |
19 | - const VERSION = '3.8.24'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
19 | + const VERSION = '3.8.24'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
20 | 20 | const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
21 | - const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
21 | + const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
22 | 22 | const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
23 | 23 | const URI = 'http://admin-page-framework.michaeluno.jp/'; |
24 | 24 | const AUTHOR = 'miunosoft (Michael Uno)'; |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @remark This is also accessed from `uninstall.php` so do not remove. |
56 | 56 | * @remark Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added. |
57 | 57 | */ |
58 | - const TRANSIENT_PREFIX = 'APFL_'; |
|
58 | + const TRANSIENT_PREFIX = 'APFL_'; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * The hook slug used for the prefix of action and filter hook names. |
62 | 62 | * |
63 | 63 | * @remark The ending underscore is not necessary. |
64 | 64 | */ |
65 | - const HOOK_SLUG = 'admin_page_framework_loader'; |
|
65 | + const HOOK_SLUG = 'admin_page_framework_loader'; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * The text domain slug and its path. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | static public $aAdminPages = array( |
118 | 118 | // key => 'page slug' |
119 | - 'about' => 'apfl_about', // the welcome page |
|
119 | + 'about' => 'apfl_about', // the welcome page |
|
120 | 120 | 'addon' => 'apfl_addons', |
121 | 121 | 'tool' => 'apfl_tools', |
122 | 122 | 'help' => 'apfl_contact', |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | * @since 3.5.0 |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public static function getPluginURL( $sRelativePath='' ) { |
|
157 | + public static function getPluginURL( $sRelativePath = '' ) { |
|
158 | 158 | if ( isset( self::$_sPluginURLCache ) ) { |
159 | - return self::$_sPluginURLCache . $sRelativePath; |
|
159 | + return self::$_sPluginURLCache.$sRelativePath; |
|
160 | 160 | } |
161 | 161 | self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) ); |
162 | - return self::$_sPluginURLCache . $sRelativePath; |
|
162 | + return self::$_sPluginURLCache.$sRelativePath; |
|
163 | 163 | } |
164 | 164 | /** |
165 | 165 | * @since 3.7.9 |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @since 3.5.0 |
190 | 190 | * @return void |
191 | 191 | */ |
192 | - static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
|
193 | - if ( ! is_admin() ) { |
|
192 | + static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) { |
|
193 | + if ( !is_admin() ) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | - self::$_aAdminNotices[] = array( |
|
196 | + self::$_aAdminNotices[ ] = array( |
|
197 | 197 | 'message' => $sMessage, |
198 | - 'class_attribute' => trim( $sClassAttribute ) . ' notice is-dismissible', |
|
198 | + 'class_attribute' => trim( $sClassAttribute ).' notice is-dismissible', |
|
199 | 199 | ); |
200 | 200 | add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) ); |
201 | 201 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | static public function _replyToSetAdminNotice() { |
208 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | - echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
|
208 | + foreach ( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | + echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>" |
|
210 | 210 | ."<p>" |
211 | 211 | . sprintf( |
212 | - '<strong>%1$s</strong>: ' . $_aAdminNotice['message'], |
|
213 | - self::NAME . ' ' . self::VERSION |
|
212 | + '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ], |
|
213 | + self::NAME.' '.self::VERSION |
|
214 | 214 | ) |
215 | 215 | . "</p>" |
216 | 216 | . "</div>"; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | AdminPageFrameworkLoader_Registry::setUp( __FILE__ ); |
223 | 223 | |
224 | 224 | // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file. |
225 | -if ( ! defined( 'ABSPATH' ) ) { |
|
225 | +if ( !defined( 'ABSPATH' ) ) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | if ( defined( 'DOING_UNINSTALL' ) && DOING_UNINSTALL ) { |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | |
235 | 235 | $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false ); |
236 | 236 | if ( |
237 | - ! $_bFrameworkLoaded |
|
238 | - || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
237 | + !$_bFrameworkLoaded |
|
238 | + || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
239 | 239 | || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' ) |
240 | 240 | ) { |
241 | 241 | AdminPageFrameworkLoader_Registry::setAdminNotice( |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' ); |
254 | 254 | |
255 | 255 | // Include the library file - the development version will be available if you cloned the GitHub repository. |
256 | -$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php'; |
|
256 | +$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php'; |
|
257 | 257 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
258 | 258 | $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath ); |
259 | 259 | include( |
260 | 260 | $_bLoadDevelopmentVersion |
261 | 261 | ? $_sDevelopmentVersionPath |
262 | - : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php' |
|
262 | + : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php' |
|
263 | 263 | ); |
264 | 264 | |
265 | 265 | // Include the framework loader plugin components. |
266 | 266 | include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] ); |
267 | -include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
267 | +include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
268 | 268 | new AdminPageFrameworkLoader_Bootstrap( |
269 | 269 | AdminPageFrameworkLoader_Registry::$sFilePath, |
270 | 270 | AdminPageFrameworkLoader_Registry::HOOK_SLUG // hook prefix |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | * @param string $sTextDomain |
29 | 29 | * @since 3.7.9 |
30 | 30 | */ |
31 | - public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
31 | + public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
32 | 32 | |
33 | 33 | // This is important to set the hooks before the parent constructor |
34 | 34 | // as the setUp wil be called in there if the default action hook (current_screen) is already triggered. |
35 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
36 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
35 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
36 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
37 | 37 | |
38 | 38 | parent::__construct( |
39 | 39 | $sMetaBoxID, |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | * @callback add_meta_boxes |
116 | 116 | */ |
117 | 117 | public function _replyToRegisterMetaBoxes() { |
118 | - foreach( $this->oProp->aPostTypes as $_sPostType ) { |
|
118 | + foreach ( $this->oProp->aPostTypes as $_sPostType ) { |
|
119 | 119 | add_meta_box( |
120 | - $this->oProp->sMetaBoxID, // id |
|
121 | - $this->oProp->sTitle, // title |
|
120 | + $this->oProp->sMetaBoxID, // id |
|
121 | + $this->oProp->sTitle, // title |
|
122 | 122 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
123 | - $_sPostType, // post type |
|
124 | - $this->oProp->sContext, // context |
|
125 | - $this->oProp->sPriority, // priority |
|
123 | + $_sPostType, // post type |
|
124 | + $this->oProp->sContext, // context |
|
125 | + $this->oProp->sPriority, // priority |
|
126 | 126 | null // argument - deprecated $this->oForm->aFields |
127 | 127 | ); |
128 | 128 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @internal |
155 | 155 | * @return integer The found post ID. `0` if not found. |
156 | 156 | */ |
157 | - private function ___getPostID() { |
|
157 | + private function ___getPostID() { |
|
158 | 158 | |
159 | 159 | // for an editing post page. |
160 | 160 | if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
187 | 187 | |
188 | 188 | // Perform initial checks. |
189 | - if ( ! $this->_shouldProceedValidation( $aUnmodified ) ) { |
|
189 | + if ( !$this->_shouldProceedValidation( $aUnmodified ) ) { |
|
190 | 190 | return $aPostData; |
191 | 191 | } |
192 | 192 | |
193 | 193 | // Retrieve the submitted data. |
194 | - $_aInputs = $this->oForm->getSubmittedData( |
|
195 | - $_POST, // subject data to be parsed. Will be sanitized in the method |
|
196 | - true, // extract data with the fieldset structure |
|
194 | + $_aInputs = $this->oForm->getSubmittedData( |
|
195 | + $_POST, // subject data to be parsed. Will be sanitized in the method |
|
196 | + true, // extract data with the fieldset structure |
|
197 | 197 | false // strip slashes |
198 | 198 | ); |
199 | 199 | $_aInputsRaw = $_aInputs; // store one for the last input array. |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | $this->oForm->updateMetaDataByType( |
231 | - $_iPostID, // object id |
|
232 | - $_aInputs, // user submit form data |
|
231 | + $_iPostID, // object id |
|
232 | + $_aInputs, // user submit form data |
|
233 | 233 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
234 | 234 | $this->oForm->sStructureType // fields type |
235 | 235 | ); |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | // If our nonce isn't there, or we can't verify it, bail |
291 | - if ( ! isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
291 | + if ( !isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
292 | 292 | return false; |
293 | 293 | } |
294 | - if ( ! wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
294 | + if ( !wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
295 | 295 | return false; |
296 | 296 | } |
297 | 297 | |
298 | - if ( ! in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes, true ) ) { |
|
298 | + if ( !in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes, true ) ) { |
|
299 | 299 | return false; |
300 | 300 | } |
301 | 301 |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | * @since 2.1.5 |
30 | 30 | * @internal |
31 | 31 | */ |
32 | - public function _enqueueStyles( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
32 | + public function _enqueueStyles( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
33 | 33 | |
34 | 34 | $_aHandleIDs = array(); |
35 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
36 | - $_aHandleIDs[] = $this->_enqueueStyle( $_sSRC, $aPostTypes, $aCustomArgs ); |
|
35 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
36 | + $_aHandleIDs[ ] = $this->_enqueueStyle( $_sSRC, $aPostTypes, $aCustomArgs ); |
|
37 | 37 | } |
38 | 38 | return $_aHandleIDs; |
39 | 39 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
58 | 58 | * @internal |
59 | 59 | */ |
60 | - public function _enqueueStyle( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
60 | + public function _enqueueStyle( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
61 | 61 | |
62 | 62 | $sSRC = trim( $sSRC ); |
63 | 63 | if ( empty( $sSRC ) ) { return ''; } |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | 'sSRC' => $sSRC, |
74 | 74 | 'aPostTypes' => empty( $aPostTypes ) ? $this->oProp->aPostTypes : $aPostTypes, |
75 | 75 | 'sType' => 'style', |
76 | - 'handle_id' => 'style_' . $this->oProp->sClassName . '_' . ( ++$this->oProp->iEnqueuedStyleIndex ), |
|
76 | + 'handle_id' => 'style_'.$this->oProp->sClassName.'_'.( ++$this->oProp->iEnqueuedStyleIndex ), |
|
77 | 77 | ), |
78 | 78 | self::$_aStructure_EnqueuingResources |
79 | 79 | ); |
80 | 80 | |
81 | 81 | // Store the attributes in another container by url. |
82 | - $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingStyles[ $_sSRCHash ]['handle_id'] ] = $this->oProp->aEnqueuingStyles[ $_sSRCHash ]['attributes']; |
|
82 | + $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingStyles[ $_sSRCHash ][ 'handle_id' ] ] = $this->oProp->aEnqueuingStyles[ $_sSRCHash ][ 'attributes' ]; |
|
83 | 83 | |
84 | 84 | return $this->oProp->aEnqueuingStyles[ $_sSRCHash ][ 'handle_id' ]; |
85 | 85 | |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | * @since 2.1.5 |
92 | 92 | * @internal |
93 | 93 | */ |
94 | - public function _enqueueScripts( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
94 | + public function _enqueueScripts( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
95 | 95 | |
96 | 96 | $_aHandleIDs = array(); |
97 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
98 | - $_aHandleIDs[] = $this->_enqueueScript( $_sSRC, $aPostTypes, $aCustomArgs ); |
|
97 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
98 | + $_aHandleIDs[ ] = $this->_enqueueScript( $_sSRC, $aPostTypes, $aCustomArgs ); |
|
99 | 99 | } |
100 | 100 | return $_aHandleIDs; |
101 | 101 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
121 | 121 | * @internal |
122 | 122 | */ |
123 | - public function _enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
123 | + public function _enqueueScript( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
124 | 124 | |
125 | - $sSRC = trim( $sSRC ); |
|
125 | + $sSRC = trim( $sSRC ); |
|
126 | 126 | if ( empty( $sSRC ) ) { |
127 | 127 | return ''; |
128 | 128 | } |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | 'sSRC' => $sSRC, |
141 | 141 | 'aPostTypes' => empty( $aPostTypes ) ? $this->oProp->aPostTypes : $aPostTypes, |
142 | 142 | 'sType' => 'script', |
143 | - 'handle_id' => 'script_' . $this->oProp->sClassName . '_' . ( ++$this->oProp->iEnqueuedScriptIndex ), |
|
143 | + 'handle_id' => 'script_'.$this->oProp->sClassName.'_'.( ++$this->oProp->iEnqueuedScriptIndex ), |
|
144 | 144 | ), |
145 | 145 | self::$_aStructure_EnqueuingResources |
146 | 146 | ); |
147 | 147 | |
148 | 148 | // Store the attributes in another container by url. |
149 | - $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingScripts[ $_sSRCHash ]['handle_id'] ] = $this->oProp->aEnqueuingScripts[ $_sSRCHash ]['attributes']; |
|
149 | + $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingScripts[ $_sSRCHash ][ 'handle_id' ] ] = $this->oProp->aEnqueuingScripts[ $_sSRCHash ][ 'attributes' ]; |
|
150 | 150 | |
151 | 151 | return $this->oProp->aEnqueuingScripts[ $_sSRCHash ][ 'handle_id' ]; |
152 | 152 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @since 3.0.0 |
159 | 159 | * @internal |
160 | 160 | */ |
161 | - public function _forceToEnqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
161 | + public function _forceToEnqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
162 | 162 | return $this->_enqueueStyle( $sSRC, array(), $aCustomArgs ); |
163 | 163 | } |
164 | 164 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @since 3.0.0 |
168 | 168 | * @internal |
169 | 169 | */ |
170 | - public function _forceToEnqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
170 | + public function _forceToEnqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
171 | 171 | return $this->_enqueueScript( $sSRC, array(), $aCustomArgs ); |
172 | 172 | } |
173 | 173 |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | * @return string |
38 | 38 | * @since 3.8.9 |
39 | 39 | */ |
40 | - static protected function _getLegibleDetails( $mValue, $iStringLengthLimit=0, $iArrayDepthLimit=0 ) { |
|
40 | + static protected function _getLegibleDetails( $mValue, $iStringLengthLimit = 0, $iArrayDepthLimit = 0 ) { |
|
41 | 41 | if ( is_array( $mValue ) ) { |
42 | - return '(array, length: ' . count( $mValue ).') ' |
|
43 | - . print_r( self::___getLegibleDetailedArray( $mValue, $iStringLengthLimit, $iArrayDepthLimit ) , true ); |
|
42 | + return '(array, length: '.count( $mValue ).') ' |
|
43 | + . print_r( self::___getLegibleDetailedArray( $mValue, $iStringLengthLimit, $iArrayDepthLimit ), true ); |
|
44 | 44 | } |
45 | 45 | return print_r( self::___getLegibleDetailedValue( $mValue, $iStringLengthLimit ), true ); |
46 | 46 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @since 3.8.9 |
56 | 56 | * @since 3.8.22 Added the `$sStringLengthLimit` and `$iArrayDepthLimit` parameters. |
57 | 57 | */ |
58 | - static protected function _getLegible( $mValue, $iStringLengthLimit=0, $iArrayDepthLimit=0 ) { |
|
58 | + static protected function _getLegible( $mValue, $iStringLengthLimit = 0, $iArrayDepthLimit = 0 ) { |
|
59 | 59 | |
60 | 60 | $iArrayDepthLimit = $iArrayDepthLimit ? $iArrayDepthLimit : self::$iLegibleArrayDepthLimit; |
61 | 61 | $mValue = is_object( $mValue ) |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | ) |
73 | 73 | : $mValue; |
74 | 74 | $mValue = is_string( $mValue ) |
75 | - ? self::___getLegibleString( $mValue, $iStringLengthLimit, false ) |
|
75 | + ? self::___getLegibleString( $mValue, $iStringLengthLimit, false ) |
|
76 | 76 | : $mValue; |
77 | 77 | return self::_getArrayRepresentationSanitized( print_r( $mValue, true ) ); |
78 | 78 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | static private function ___getObjectName( $mItem ) { |
90 | 90 | if ( is_object( $mItem ) ) { |
91 | - return '(object) ' . get_class( $mItem ); |
|
91 | + return '(object) '.get_class( $mItem ); |
|
92 | 92 | } |
93 | 93 | return $mItem; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | */ |
101 | 101 | static private function ___getLegibleDetailedCallable( $asoCallable ) { |
102 | - return '(callable) ' . self::___getCallableName( $asoCallable ); |
|
102 | + return '(callable) '.self::___getCallableName( $asoCallable ); |
|
103 | 103 | } |
104 | 104 | /** |
105 | 105 | * @since 3.8.9 |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $_sSubject = is_object( $asoCallable[ 0 ] ) |
118 | 118 | ? get_class( $asoCallable[ 0 ] ) |
119 | 119 | : ( string ) $asoCallable[ 0 ]; |
120 | - return $_sSubject . '::' . ( string ) $asoCallable[ 1 ]; |
|
120 | + return $_sSubject.'::'.( string ) $asoCallable[ 1 ]; |
|
121 | 121 | |
122 | 122 | } |
123 | 123 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | if ( method_exists( $oObject, '__toString' ) ) { |
132 | 132 | return ( string ) $oObject; |
133 | 133 | } |
134 | - return '(object) ' . get_class( $oObject ) . ' ' . count( get_object_vars( $oObject ) ) . ' properties.'; |
|
134 | + return '(object) '.get_class( $oObject ).' '.count( get_object_vars( $oObject ) ).' properties.'; |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @since 3.8.22 Changed the scope to private from public. |
148 | 148 | * @since 3.8.22 Renamed from `_getLegibleArray()`. |
149 | 149 | */ |
150 | - static private function ___getLegibleDetailedArray( array $aArray, $iStringLengthLimit=0, $iDepthLimit=0 ) { |
|
150 | + static private function ___getLegibleDetailedArray( array $aArray, $iStringLengthLimit = 0, $iDepthLimit = 0 ) { |
|
151 | 151 | $_iDepthLimit = $iDepthLimit ? $iDepthLimit : self::$iLegibleArrayDepthLimit; |
152 | 152 | return self::___getArrayMappedRecursive( |
153 | 153 | self::_getSlicedByDepth( $aArray, $_iDepthLimit ), |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | return self::___getLegibleDetailedObject( $mNonScalar ); |
188 | 188 | } |
189 | 189 | if ( is_array( $mNonScalar ) ) { |
190 | - return '(' . $_sType . ') ' . count( $mNonScalar ) . ' elements'; |
|
190 | + return '('.$_sType.') '.count( $mNonScalar ).' elements'; |
|
191 | 191 | } |
192 | - return '(' . $_sType . ') ' . ( string ) $mNonScalar; |
|
192 | + return '('.$_sType.') '.( string ) $mNonScalar; |
|
193 | 193 | |
194 | 194 | } |
195 | 195 | /** |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | */ |
202 | 202 | static private function ___getLegibleDetailedScalar( $sScalar, $iStringLengthLimit ) { |
203 | 203 | if ( is_bool( $sScalar ) ) { |
204 | - return '(boolean) ' . ( $sScalar ? 'true' : 'false' ); |
|
204 | + return '(boolean) '.( $sScalar ? 'true' : 'false' ); |
|
205 | 205 | } |
206 | 206 | return is_string( $sScalar ) |
207 | 207 | ? self::___getLegibleString( $sScalar, $iStringLengthLimit, true ) |
208 | - : '(' . gettype( $sScalar ) . ', length: ' . self::___getValueLength( $sScalar ) . ') ' . $sScalar; |
|
208 | + : '('.gettype( $sScalar ).', length: '.self::___getValueLength( $sScalar ).') '.$sScalar; |
|
209 | 209 | } |
210 | 210 | /** |
211 | 211 | * Returns a length of a value. |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param boolean $bShowDetails |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - static private function ___getLegibleString( $sString, $iLengthLimit, $bShowDetails=true ) { |
|
233 | + static private function ___getLegibleString( $sString, $iLengthLimit, $bShowDetails = true ) { |
|
234 | 234 | |
235 | 235 | static $_iMBSupport; |
236 | 236 | $_iMBSupport = isset( $_iMBSupport ) ? $_iMBSupport : ( integer ) function_exists( 'mb_strlen' ); |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | |
242 | 242 | if ( $bShowDetails ) { |
243 | 243 | return $_iCharLength <= $iCharLimit |
244 | - ? '(string, length: ' . $_iCharLength . ') ' . $sString |
|
245 | - : '(string, length: ' . $_iCharLength . ') ' . call_user_func_array( $_aSubstrMethod[ $_iMBSupport ], array( $sString, 0, $iCharLimit ) ) |
|
244 | + ? '(string, length: '.$_iCharLength.') '.$sString |
|
245 | + : '(string, length: '.$_iCharLength.') '.call_user_func_array( $_aSubstrMethod[ $_iMBSupport ], array( $sString, 0, $iCharLimit ) ) |
|
246 | 246 | . '...'; |
247 | 247 | } |
248 | 248 | return $_iCharLength <= $iCharLimit |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @return array |
284 | 284 | * @since 3.8.22 |
285 | 285 | */ |
286 | - static public function getSlicedByDepth( array $aSubject, $iDepth=0, $sMore='(array truncated) ...' ) { |
|
286 | + static public function getSlicedByDepth( array $aSubject, $iDepth = 0, $sMore = '(array truncated) ...' ) { |
|
287 | 287 | return self::_getSlicedByDepth( $aSubject, $iDepth, $sMore ); |
288 | 288 | } |
289 | 289 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @since 3.8.22 Added the `$sMore` parameter. |
304 | 304 | * @internal |
305 | 305 | */ |
306 | - static private function _getSlicedByDepth( array $aSubject, $iDepth=0, $sMore='(array truncated) ...' ) { |
|
306 | + static private function _getSlicedByDepth( array $aSubject, $iDepth = 0, $sMore = '(array truncated) ...' ) { |
|
307 | 307 | |
308 | 308 | foreach ( $aSubject as $_sKey => $_vValue ) { |
309 | 309 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @return array |
339 | 339 | * @since 3.8.9 |
340 | 340 | */ |
341 | - static private function ___getArrayMappedRecursive( array $aArray, $oCallable, array $aArguments=array() ) { |
|
341 | + static private function ___getArrayMappedRecursive( array $aArray, $oCallable, array $aArguments = array() ) { |
|
342 | 342 | |
343 | 343 | self::$___oCurrentCallableForArrayMapRecursive = $oCallable; |
344 | 344 | self::$___aArgumentsForArrayMapRecursive = $aArguments; |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | * @since 3.8.22 |
373 | 373 | * @since 3.8.23 Deprecated the `$oException` parameter. |
374 | 374 | */ |
375 | - static public function getStackTrace( $iSkip=0, $_deprecated=null ) { |
|
375 | + static public function getStackTrace( $iSkip = 0, $_deprecated = null ) { |
|
376 | 376 | |
377 | - $_iSkip = 1; // need to skip this method trace itself |
|
377 | + $_iSkip = 1; // need to skip this method trace itself |
|
378 | 378 | $_oException = new Exception(); |
379 | 379 | |
380 | 380 | // Backward compatibility. |
@@ -390,22 +390,22 @@ discard block |
||
390 | 390 | $_aFrames = array_slice( $_aFrames, $_iSkip ); |
391 | 391 | foreach ( array_reverse( $_aFrames ) as $_iIndex => $_aFrame ) { |
392 | 392 | |
393 | - $_aFrame = $_aFrame + array( |
|
393 | + $_aFrame = $_aFrame + array( |
|
394 | 394 | 'file' => null, 'line' => null, 'function' => null, |
395 | 395 | 'class' => null, 'args' => array(), |
396 | 396 | ); |
397 | 397 | $_sArguments = self::___getArgumentsOfEachStackTrace( $_aFrame[ 'args' ] ); |
398 | - $_aTraces[] = sprintf( |
|
398 | + $_aTraces[ ] = sprintf( |
|
399 | 399 | "#%s %s(%s): %s(%s)", |
400 | 400 | $_iIndex + 1, |
401 | 401 | $_aFrame[ 'file' ], |
402 | 402 | $_aFrame[ 'line' ], |
403 | - isset( $_aFrame[ 'class' ] ) ? $_aFrame[ 'class' ] . '->' . $_aFrame[ 'function' ] : $_aFrame[ 'function' ], |
|
403 | + isset( $_aFrame[ 'class' ] ) ? $_aFrame[ 'class' ].'->'.$_aFrame[ 'function' ] : $_aFrame[ 'function' ], |
|
404 | 404 | $_sArguments |
405 | 405 | ); |
406 | 406 | |
407 | 407 | } |
408 | - return implode( PHP_EOL, $_aTraces ) . PHP_EOL; |
|
408 | + return implode( PHP_EOL, $_aTraces ).PHP_EOL; |
|
409 | 409 | |
410 | 410 | } |
411 | 411 | /** |
@@ -420,16 +420,16 @@ discard block |
||
420 | 420 | foreach ( $aTraceArguments as $_mArgument ) { |
421 | 421 | $_sType = gettype( $_mArgument ); |
422 | 422 | $_sType = str_replace( |
423 | - array( 'resource (closed)', 'unknown type', 'integer', 'double', ), |
|
424 | - array( 'resource', 'unknown', 'scalar', 'scalar', ), |
|
423 | + array( 'resource (closed)', 'unknown type', 'integer', 'double',), |
|
424 | + array( 'resource', 'unknown', 'scalar', 'scalar',), |
|
425 | 425 | $_sType |
426 | 426 | ); |
427 | 427 | $_sMethodName = "___getStackTraceArgument_{$_sType}"; |
428 | - $_aArguments[] = method_exists( __CLASS__, $_sMethodName ) |
|
428 | + $_aArguments[ ] = method_exists( __CLASS__, $_sMethodName ) |
|
429 | 429 | ? self::{$_sMethodName}( $_mArgument ) |
430 | 430 | : $_sType; |
431 | 431 | } |
432 | - return join(", ", $_aArguments ); |
|
432 | + return join( ", ", $_aArguments ); |
|
433 | 433 | } |
434 | 434 | /** |
435 | 435 | * @since 3.8.22 |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | */ |
440 | 440 | static private function ___getStackTraceArgument_string( $mArgument ) { |
441 | 441 | $_sString = self::___getLegibleString( $mArgument, 200, true ); |
442 | - return "'" . $_sString . "'"; |
|
442 | + return "'".$_sString."'"; |
|
443 | 443 | } |
444 | 444 | static private function ___getStackTraceArgument_scalar( $mArgument ) { |
445 | 445 | return $mArgument; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | return 'NULL'; |
452 | 452 | } |
453 | 453 | static private function ___getStackTraceArgument_object( $mArgument ) { |
454 | - return 'Object(' . get_class( $mArgument ) . ')'; |
|
454 | + return 'Object('.get_class( $mArgument ).')'; |
|
455 | 455 | } |
456 | 456 | static private function ___getStackTraceArgument_resource( $mArgument ) { |
457 | 457 | return get_resource_type( $mArgument ); |
@@ -464,18 +464,18 @@ discard block |
||
464 | 464 | $_iMax = 10; |
465 | 465 | $_iTotal = count( $mArgument ); |
466 | 466 | $_iIndex = 0; |
467 | - foreach( $mArgument as $_sKey => $_mValue ) { |
|
467 | + foreach ( $mArgument as $_sKey => $_mValue ) { |
|
468 | 468 | $_iIndex++; |
469 | - $_mValue = is_scalar( $_mValue ) |
|
469 | + $_mValue = is_scalar( $_mValue ) |
|
470 | 470 | ? self::___getLegibleDetailedScalar( $_mValue, 100 ) |
471 | - : ucfirst( gettype( $_mValue ) ) . ( |
|
471 | + : ucfirst( gettype( $_mValue ) ).( |
|
472 | 472 | is_object( $_mValue ) |
473 | - ? ' (' . get_class( $_mValue ) . ')' |
|
473 | + ? ' ('.get_class( $_mValue ).')' |
|
474 | 474 | : '' |
475 | 475 | ); |
476 | - $_sOutput .= $_sKey . ': ' . $_mValue . ', '; |
|
476 | + $_sOutput .= $_sKey.': '.$_mValue.', '; |
|
477 | 477 | if ( $_iIndex > $_iMax && $_iTotal > $_iMax ) { |
478 | - $_sOutput = rtrim( $_sOutput, ',' ) . '...'; |
|
478 | + $_sOutput = rtrim( $_sOutput, ',' ).'...'; |
|
479 | 479 | break; |
480 | 480 | } |
481 | 481 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'getPostTypeByTypeNow', |
57 | 57 | 'getPostTypeByScreenObject', |
58 | 58 | 'getPostTypeByREQUEST', |
59 | - 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
59 | + 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
60 | 60 | ); |
61 | 61 | foreach ( $_aMethodsToTry as $_sMethodName ) { |
62 | 62 | $_sPostType = call_user_func( array( __CLASS__, $_sMethodName ) ); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * @param array|string The post type slug(s) to check. If this is empty, the method just checks the current page is a taxonomy page. |
121 | 121 | * @return boolean |
122 | 122 | */ |
123 | - static public function isCustomTaxonomyPage( $asPostTypes=array() ) { |
|
123 | + static public function isCustomTaxonomyPage( $asPostTypes = array() ) { |
|
124 | 124 | |
125 | - if ( ! in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', 'term.php' ) ) ) { |
|
125 | + if ( !in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', 'term.php' ) ) ) { |
|
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * Otherwise, it will check if the page belongs to the given post type(s). |
138 | 138 | * @return boolean |
139 | 139 | */ |
140 | - static public function isPostDefinitionPage( $asPostTypes=array() ) { |
|
140 | + static public function isPostDefinitionPage( $asPostTypes = array() ) { |
|
141 | 141 | |
142 | 142 | // If it's not the post definition page, |
143 | - if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
143 | + if ( !in_array( self::getPageNow(), array( 'post.php', 'post-new.php',) ) ) { |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @since 3.0.0 |
175 | 175 | */ |
176 | - static public function isPostListingPage( $asPostTypes=array() ) { |
|
176 | + static public function isPostListingPage( $asPostTypes = array() ) { |
|
177 | 177 | |
178 | 178 | if ( 'edit.php' != self::getPageNow() ) { |
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | 182 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
183 | - if ( ! isset( $_GET[ 'post_type' ] ) ) { |
|
183 | + if ( !isset( $_GET[ 'post_type' ] ) ) { |
|
184 | 184 | return in_array( 'post', $_aPostTypes, true ); |
185 | 185 | } |
186 | 186 | return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 0 => '_getPageNow_FrontEnd', |
218 | 218 | 1 => '_getPageNow_BackEnd', |
219 | 219 | ); |
220 | - $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
220 | + $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
221 | 221 | self::$_sPageNow = self::$_sMethodName(); |
222 | 222 | return self::$_sPageNow; |
223 | 223 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | if ( isset( $GLBOALS[ 'page_hook' ] ) ) { |
314 | 314 | return is_network_admin() |
315 | - ? $GLBOALS[ 'page_hook' ] . '-network' |
|
315 | + ? $GLBOALS[ 'page_hook' ].'-network' |
|
316 | 316 | : $GLBOALS[ 'page_hook' ]; |
317 | 317 | } |
318 | 318 | |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @since 3.7.0 |
327 | 327 | * @return boolean |
328 | 328 | */ |
329 | - static public function doesMetaBoxExist( $sContext='' ) { |
|
329 | + static public function doesMetaBoxExist( $sContext = '' ) { |
|
330 | 330 | |
331 | 331 | $_aDimensions = array( 'wp_meta_boxes', $GLOBALS[ 'page_hook' ] ); |
332 | 332 | if ( $sContext ) { |
333 | - $_aDimensions[] = $sContext; |
|
333 | + $_aDimensions[ ] = $sContext; |
|
334 | 334 | } |
335 | 335 | $_aSideMetaBoxes = self::getElementAsArray( |
336 | 336 | $GLOBALS, |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public $sNotice = ''; |
46 | 46 | public $aAttributes = array(); |
47 | 47 | public $aCallbacks = array( |
48 | - 'should_show' => null, // determines whether the admin notice should be displayed. |
|
48 | + 'should_show' => null, // determines whether the admin notice should be displayed. |
|
49 | 49 | ); |
50 | 50 | /**#@-*/ |
51 | 51 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * </ul> |
62 | 62 | * @since 3.5.0 |
63 | 63 | */ |
64 | - public function __construct( $sNotice, array $aAttributes=array( 'class' => 'error' ), array $aCallbacks=array() ) { |
|
64 | + public function __construct( $sNotice, array $aAttributes = array( 'class' => 'error' ), array $aCallbacks = array() ) { |
|
65 | 65 | |
66 | 66 | $this->aAttributes = $aAttributes + array( |
67 | 67 | 'class' => 'error', // 'updated' etc. |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
70 | 70 | $this->aAttributes[ 'class' ], |
71 | 71 | 'admin-page-framework-settings-notice-message', |
72 | - 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
72 | + 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
73 | 73 | 'notice', |
74 | 74 | 'is-dismissible' // 3.5.12+ |
75 | 75 | ); |
76 | - $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
76 | + $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
77 | 77 | |
78 | 78 | // Load resources. |
79 | 79 | new AdminPageFramework_AdminNotice___Script; |
80 | 80 | |
81 | 81 | // An empty value may be set in order only to load the fade-in script. |
82 | - if ( ! $sNotice ) { |
|
82 | + if ( !$sNotice ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function _replyToDisplayAdminNotice() { |
109 | 109 | |
110 | - if ( ! $this->_shouldProceed() ) { |
|
110 | + if ( !$this->_shouldProceed() ) { |
|
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | 'display: none' |
119 | 119 | ); |
120 | 120 | |
121 | - echo "<div " . $this->getAttributes( $_aAttributes ) . ">" |
|
121 | + echo "<div ".$this->getAttributes( $_aAttributes ).">" |
|
122 | 122 | . "<p>" |
123 | 123 | . self::$_aNotices[ $this->sNotice ] |
124 | 124 | . "</p>" |
125 | 125 | . "</div>" |
126 | 126 | // Insert the same message except it is not hidden. |
127 | 127 | . "<noscript>" |
128 | - . "<div " . $this->getAttributes( $this->aAttributes ) . ">" |
|
128 | + . "<div ".$this->getAttributes( $this->aAttributes ).">" |
|
129 | 129 | . "<p>" |
130 | 130 | . self::$_aNotices[ $this->sNotice ] |
131 | 131 | . "</p>" |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function _shouldProceed() { |
145 | 145 | |
146 | - if ( ! is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
146 | + if ( !is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
147 | 147 | return true; |
148 | 148 | } |
149 | 149 | return call_user_func_array( |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @since 3.8.24 |
26 | 26 | */ |
27 | 27 | static public function getHTTPRequestSanitized( array $aRequest, $bStripSlashes ) { |
28 | - foreach( $aRequest as $_isIndex => $_mValue ) { |
|
28 | + foreach ( $aRequest as $_isIndex => $_mValue ) { |
|
29 | 29 | if ( is_array( $_mValue ) ) { |
30 | 30 | $aRequest[ $_isIndex ] = self::getHTTPRequestSanitized( $_mValue, $bStripSlashes ); |
31 | 31 | continue; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return mixed |
69 | 69 | * @since 3.8.24 |
70 | 70 | */ |
71 | - static public function getObjectCache( $asName, $mDefault=null ) { |
|
71 | + static public function getObjectCache( $asName, $mDefault = null ) { |
|
72 | 72 | return self::getArrayValueByArrayKeys( self::$___aObjectCache, self::getAsArray( $asName ), $mDefault ); |
73 | 73 | } |
74 | 74 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param string $sProgramName |
84 | 84 | * @since 3.8.8 |
85 | 85 | */ |
86 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='Admin Page Framework' ) { |
|
86 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = 'Admin Page Framework' ) { |
|
87 | 87 | trigger_error( |
88 | - $sProgramName . ': ' . sprintf( |
|
88 | + $sProgramName.': '.sprintf( |
|
89 | 89 | $sAlternative |
90 | 90 | ? '<code>%1$s</code> has been deprecated. Use <code>%2$s</code> instead.' |
91 | 91 | : '<code>%1$s</code> has been deprecated.', |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * @param string|array $asParameters Parameters to pass to the callback function. |
109 | 109 | * @return mixed |
110 | 110 | */ |
111 | - public function callBack( $oCallable, $asParameters=array() ) { |
|
112 | - $_aParameters = self::getAsArray( |
|
111 | + public function callBack( $oCallable, $asParameters = array() ) { |
|
112 | + $_aParameters = self::getAsArray( |
|
113 | 113 | $asParameters, |
114 | 114 | true // preserve empty |
115 | 115 | ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param array $aParameters |
149 | 149 | * @return string The captured output buffer. |
150 | 150 | */ |
151 | - static public function getOutputBuffer( $cCallable, array $aParameters=array() ) { |
|
151 | + static public function getOutputBuffer( $cCallable, array $aParameters = array() ) { |
|
152 | 152 | |
153 | 153 | ob_start(); |
154 | 154 | echo call_user_func_array( $cCallable, $aParameters ); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $_iCount = count( get_object_vars( $oInstance ) ); |
172 | 172 | $_sClassName = get_class( $oInstance ); |
173 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
173 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
174 | 174 | |
175 | 175 | } |
176 | 176 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param boolean|integer|double|string|array|object|resource|NULL $mFalse The value to return when the first parameter value yields false. |
188 | 188 | * @return mixed |
189 | 189 | */ |
190 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
190 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
191 | 191 | return $mValue ? $mTrue : $mFalse; |
192 | 192 | } |
193 | 193 |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | /** |
192 | 192 | * Defines the field type slugs used for this field type. |
193 | 193 | */ |
194 | - public $aFieldTypeSlugs = array( 'submit', ); |
|
194 | + public $aFieldTypeSlugs = array( 'submit',); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Defines the default key-values of this field type. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'redirect_url' => null, |
203 | 203 | 'href' => null, |
204 | 204 | 'reset' => null, |
205 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
205 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
206 | 206 | 'confirm' => '', |
207 | 207 | /* |
208 | 208 | array( |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | 'attachments' => null, // string|array The file path(s) or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the the field ID. |
214 | 214 | ) |
215 | 215 | */ |
216 | - 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
216 | + 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
217 | 217 | 'attributes' => array( |
218 | 218 | 'class' => 'button button-primary', |
219 | 219 | ), |
@@ -294,17 +294,17 @@ discard block |
||
294 | 294 | |
295 | 295 | return |
296 | 296 | $aField[ 'before_label' ] |
297 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
297 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
298 | 298 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
299 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
299 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
300 | 300 | . $aField[ 'before_input' ] |
301 | 301 | . $this->_getExtraInputFields( $aField ) |
302 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
302 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
303 | 303 | . $aField[ 'after_input' ] |
304 | 304 | . "</label>" |
305 | 305 | . $this->___getConfirmationCheckbox( $aField ) |
306 | 306 | . "</div>" |
307 | - . $aField['after_label']; |
|
307 | + . $aField[ 'after_label' ]; |
|
308 | 308 | |
309 | 309 | } |
310 | 310 | /** |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | if ( empty( $aField[ 'confirm' ] ) ) { |
317 | 317 | return ''; |
318 | 318 | } |
319 | - $_aConfirm = is_string( $aField[ 'confirm' ] ) |
|
319 | + $_aConfirm = is_string( $aField[ 'confirm' ] ) |
|
320 | 320 | ? array( |
321 | 321 | 'label' => $aField[ 'confirm' ] |
322 | 322 | ) |
323 | 323 | : $this->getAsArray( $aField[ 'confirm' ] ); |
324 | - $_aConfirm = $_aConfirm + array( |
|
324 | + $_aConfirm = $_aConfirm + array( |
|
325 | 325 | 'label' => $this->oMsg->get( 'submit_confirmation_label' ), |
326 | 326 | 'error' => $this->oMsg->get( 'submit_confirmation_error' ), |
327 | 327 | ); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | private function _getLabelAttributes( array $aField, array $aInputAttributes ) { |
373 | 373 | return array( |
374 | 374 | 'style' => $aField[ 'label_min_width' ] |
375 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
375 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
376 | 376 | : null, |
377 | 377 | 'for' => $aInputAttributes[ 'id' ], |
378 | 378 | 'class' => $aInputAttributes[ 'disabled' ] |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | private function _getLabelContainerAttributes( array $aField ) { |
392 | 392 | return array( |
393 | 393 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
394 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
394 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
395 | 395 | : null, |
396 | 396 | 'class' => 'admin-page-framework-input-label-container' |
397 | 397 | . ' admin-page-framework-input-button-container' |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | protected function _getExtraInputFields( &$aField ) { |
446 | 446 | |
447 | 447 | $_aOutput = array(); |
448 | - $_aOutput[] = $this->getHTMLTag( |
|
448 | + $_aOutput[ ] = $this->getHTMLTag( |
|
449 | 449 | 'input', |
450 | 450 | array( |
451 | 451 | 'type' => 'hidden', |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | 'value' => $aField[ 'input_id' ], |
454 | 454 | ) |
455 | 455 | ); |
456 | - $_aOutput[] = $this->getHTMLTag( |
|
456 | + $_aOutput[ ] = $this->getHTMLTag( |
|
457 | 457 | 'input', |
458 | 458 | array( |
459 | 459 | 'type' => 'hidden', |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | 'value' => $aField[ 'field_id' ], |
462 | 462 | ) |
463 | 463 | ); |
464 | - $_aOutput[] = $this->getHTMLTag( |
|
464 | + $_aOutput[ ] = $this->getHTMLTag( |
|
465 | 465 | 'input', |
466 | 466 | array( |
467 | 467 | 'type' => 'hidden', |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | 'value' => $aField[ '_input_name_flat' ], |
470 | 470 | ) |
471 | 471 | ); |
472 | - $_aOutput[] = $this->_getHiddenInput_SectionID( $aField ); |
|
473 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
474 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
475 | - $_aOutput[] = $this->_getHiddenInput_Reset( $aField ); |
|
476 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
472 | + $_aOutput[ ] = $this->_getHiddenInput_SectionID( $aField ); |
|
473 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
474 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
475 | + $_aOutput[ ] = $this->_getHiddenInput_Reset( $aField ); |
|
476 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
477 | 477 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
478 | 478 | |
479 | 479 | } |
@@ -490,9 +490,9 @@ discard block |
||
490 | 490 | 'input', |
491 | 491 | array( |
492 | 492 | 'type' => 'hidden', |
493 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
494 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
495 | - ? $aField['section_id'] |
|
493 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
494 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
495 | + ? $aField[ 'section_id' ] |
|
496 | 496 | : '', |
497 | 497 | ) |
498 | 498 | ); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | 'input', |
513 | 513 | array( |
514 | 514 | 'type' => 'hidden', |
515 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
515 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
516 | 516 | 'value' => $aField[ $sKey ], |
517 | 517 | ) |
518 | 518 | ) |
@@ -527,15 +527,15 @@ discard block |
||
527 | 527 | * @return string the HTML input tag output for the 'reset' argument. |
528 | 528 | */ |
529 | 529 | private function _getHiddenInput_Reset( array $aField ) { |
530 | - if ( ! $aField[ 'reset' ] ) { |
|
530 | + if ( !$aField[ 'reset' ] ) { |
|
531 | 531 | return ''; |
532 | 532 | } |
533 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
533 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
534 | 534 | ? $this->getHTMLTag( |
535 | 535 | 'input', |
536 | 536 | array( |
537 | 537 | 'type' => 'hidden', |
538 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
538 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
539 | 539 | 'value' => '1', |
540 | 540 | ) |
541 | 541 | ) |
@@ -564,10 +564,10 @@ discard block |
||
564 | 564 | return ''; |
565 | 565 | } |
566 | 566 | $this->setTransient( |
567 | - 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ), |
|
567 | + 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ), |
|
568 | 568 | $aField[ 'email' ] |
569 | 569 | ); |
570 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
570 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
571 | 571 | ? $this->getHTMLTag( |
572 | 572 | 'input', |
573 | 573 | array( |
@@ -595,19 +595,19 @@ discard block |
||
595 | 595 | * @return boolean |
596 | 596 | * @internal |
597 | 597 | */ |
598 | - private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) { |
|
598 | + private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) { |
|
599 | 599 | |
600 | - switch( $sType ) { |
|
600 | + switch ( $sType ) { |
|
601 | 601 | default: |
602 | 602 | case 'reset': // admin page framework _ reset confirmation |
603 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
603 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
604 | 604 | break; |
605 | 605 | case 'email': // admin page framework _ email confirmation |
606 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
606 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
607 | 607 | break; |
608 | 608 | } |
609 | 609 | |
610 | - $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && ! $aField[ 'skip_confirmation' ] |
|
610 | + $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ] |
|
611 | 611 | ? false |
612 | 612 | : true; |
613 | 613 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'after_label' => null, |
60 | 60 | 'before_field' => null, |
61 | 61 | 'after_field' => null, |
62 | - 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
62 | + 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
63 | 63 | 'before_fieldset' => null, // 3.1.1+ |
64 | 64 | 'after_fieldset' => null, // 3.1.1+ |
65 | 65 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param object $oMsg The framework message object. |
100 | 100 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
101 | 101 | */ |
102 | - public function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
102 | + public function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
103 | 103 | |
104 | 104 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) |
105 | 105 | ? $this->aFieldTypeSlugs |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
112 | 112 | if ( $bAutoRegister ) { |
113 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
113 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
114 | 114 | add_filter( |
115 | - 'field_types_' . $_sClassName, |
|
115 | + 'field_types_'.$_sClassName, |
|
116 | 116 | array( $this, '_replyToRegisterInputFieldType' ) |
117 | 117 | ); |
118 | 118 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | } |
162 | 162 | return is_array( $asLabel ) // if the user sets multiple items |
163 | 163 | ? $this->getElement( |
164 | - $asElement, // subject |
|
165 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
164 | + $asElement, // subject |
|
165 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
166 | 166 | '' // default - if the element is not found, return an empty |
167 | 167 | ) |
168 | 168 | : $asElement; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | protected function getFieldOutput( array $aFieldset ) { |
180 | 180 | |
181 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
181 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
182 | 182 | return ''; |
183 | 183 | } |
184 | 184 | |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
187 | 187 | |
188 | 188 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
189 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
189 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
190 | 190 | |
191 | 191 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
192 | - $aFieldset, // the field definition array |
|
193 | - $_oCallerForm->aSavedData, // the stored form data |
|
194 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | - $_oCallerForm->oMsg, // the system message object |
|
192 | + $aFieldset, // the field definition array |
|
193 | + $_oCallerForm->aSavedData, // the stored form data |
|
194 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | + $_oCallerForm->oMsg, // the system message object |
|
197 | 197 | $_oCallerForm->aCallbacks // field output element callables. |
198 | 198 | ); |
199 | 199 | return $_oFieldset->get(); |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | * @return array |
238 | 238 | * @internal |
239 | 239 | */ |
240 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
240 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
241 | 241 | |
242 | 242 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
243 | 243 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
244 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
245 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
246 | - : self::$_aDefaultKeys['attributes']; |
|
244 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
245 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
246 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
247 | 247 | |
248 | 248 | return array( |
249 | 249 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param string $sFieldSetType |
290 | 290 | * @internal |
291 | 291 | */ |
292 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
292 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
293 | 293 | $this->_sFieldSetType = $sFieldSetType; |
294 | 294 | } |
295 | 295 | |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | wp_enqueue_script( 'media-upload' ); |
345 | 345 | } |
346 | 346 | |
347 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
348 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
347 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
348 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
364 | 364 | |
365 | 365 | // Replace the button label in the media thick box. |
366 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
366 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
367 | 367 | return $sTranslated; |
368 | 368 | } |
369 | 369 | if ( $sText !== 'Insert into Post' ) { |
@@ -394,10 +394,10 @@ discard block |
||
394 | 394 | */ |
395 | 395 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
396 | 396 | |
397 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
397 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
398 | 398 | return $aTabs; |
399 | 399 | } |
400 | - if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { |
|
400 | + if ( !( boolean ) $_REQUEST[ 'enable_external_source' ] ) { |
|
401 | 401 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
402 | 402 | } |
403 | 403 | return $aTabs; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | * @since 3.8.0 |
417 | 417 | */ |
418 | - protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes=array() ) { |
|
418 | + protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes = array() ) { |
|
419 | 419 | |
420 | 420 | $aAttributes[ 'class' ] = $this->getClassAttribute( $asClassAttributes, $this->getElement( $aAttributes, 'class' ) ); |
421 | 421 | $aAttributes[ 'style' ] = $this->getStyleAttribute( |