@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $_sPageSlug = $this->getHTTPQueryGET( 'page', '' ); |
57 | 57 | $_sTabSlug = $this->getHTTPQueryGET( 'tab', '' ); |
58 | 58 | $_sUserID = get_current_user_id(); |
59 | - return "apf_li_" . md5( |
|
59 | + return "apf_li_".md5( |
|
60 | 60 | $_sPageNow |
61 | 61 | . $_sPageSlug |
62 | 62 | . $_sTabSlug |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | * @return void |
95 | 95 | */ |
96 | 96 | public function _replyToSave() { |
97 | - if ( ! isset( self::$_aLastInputs ) ) { |
|
97 | + if ( !isset( self::$_aLastInputs ) ) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | $this->setTransient( |
101 | 101 | $this->sTransientKey, |
102 | 102 | self::$_aLastInputs, |
103 | - 60*60 // store it for 1 hour |
|
103 | + 60 * 60 // store it for 1 hour |
|
104 | 104 | ); |
105 | 105 | } |
106 | 106 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $_aLastInputs = self::$_aCaches[ $this->sTransientKey ]; |
121 | 121 | } else { |
122 | 122 | $_aLastInputs = $this->getTransient( $this->sTransientKey ); |
123 | - self::$_aCaches[ $this->sTransientKey ] = $_aLastInputs; |
|
123 | + self::$_aCaches[ $this->sTransientKey ] = $_aLastInputs; |
|
124 | 124 | if ( false !== $_aLastInputs ) { |
125 | - $this->delete(); // deletes at the end of the script. |
|
125 | + $this->delete(); // deletes at the end of the script. |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $_sPageSlug = $this->getHTTPQueryGET( 'page', '' ); |
46 | 46 | $_sTabSlug = $this->getHTTPQueryGET( 'tab', '' ); |
47 | 47 | $_sUserID = get_current_user_id(); |
48 | - return "apf_fe_" . md5( |
|
48 | + return "apf_fe_".md5( |
|
49 | 49 | $this->getPageNow() |
50 | 50 | . $_sPageSlug |
51 | 51 | . $_sTabSlug |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function get() { |
134 | 134 | |
135 | 135 | // Use a cache if exists. |
136 | - self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
136 | + self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
137 | 137 | ? self::$_aFieldErrorCaches[ $this->sTransientKey ] |
138 | 138 | : $this->getTransient( $this->sTransientKey ); |
139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @since 3.7.0 |
151 | 151 | */ |
152 | 152 | public function delete() { |
153 | - if ( $this->hasBeenCalled( 'delete_' . $this->sTransientKey ) ) { |
|
153 | + if ( $this->hasBeenCalled( 'delete_'.$this->sTransientKey ) ) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | add_action( 'shutdown', array( $this, '_replyToDelete' ) ); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | array( $this, '_replyToRegisterFormItems' ), |
47 | 47 | 100 // priority - low value is set as meta boxes use the `current_screen` action hook for `setUp()`. |
48 | 48 | ); |
49 | - } else { |
|
49 | + } else { |
|
50 | 50 | add_action( |
51 | 51 | $this->aArguments[ 'action_hook_form_registration' ], |
52 | 52 | array( $this, '_replyToRegisterFormItems' ) |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * Changed the name from `getFieldsModel()`. |
161 | 161 | * @return array |
162 | 162 | */ |
163 | - public function getDataStructureFromAddedFieldsets() { |
|
163 | + public function getDataStructureFromAddedFieldsets() { |
|
164 | 164 | |
165 | 165 | $_aFormDataStructure = array(); |
166 | 166 | foreach ( $this->getAsArray( $this->aFieldsets ) as $_sSectionID => $_aFieldsets ) { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param array $aSubject The subject array to modify. Usually the saved option data. |
199 | 199 | * @return array The modified options array. |
200 | 200 | */ |
201 | - public function dropRepeatableElements( array $aSubject ) { |
|
201 | + public function dropRepeatableElements( array $aSubject ) { |
|
202 | 202 | $_oFilterRepeatableElements = new AdminPageFramework_Form_Model___Modifier_FilterRepeatableElements( |
203 | 203 | $aSubject, |
204 | 204 | $this->getHTTPRequestSanitized( $this->getElementAsArray( |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @return array |
65 | 65 | * @since 3.7.0 |
66 | 66 | */ |
67 | - public function getSubmittedData( array $aDataToParse, $bExtractFromFieldStructure=true, $bStripSlashes=true ) { |
|
67 | + public function getSubmittedData( array $aDataToParse, $bExtractFromFieldStructure = true, $bStripSlashes = true ) { |
|
68 | 68 | |
69 | 69 | // Extracts the form data from the subject data for parsing |
70 | - $_aSubmittedFormData = $bExtractFromFieldStructure |
|
70 | + $_aSubmittedFormData = $bExtractFromFieldStructure |
|
71 | 71 | ? $this->castArrayContents( |
72 | 72 | $this->getDataStructureFromAddedFieldsets(), // form data (options) structure |
73 | 73 | $aDataToParse // the subject data array, usually `$_POST`. |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | array_merge( |
96 | 96 | $this->getElementAsArray( |
97 | 97 | $_POST, // sanitization done |
98 | - '__repeatable_elements_' . $this->aArguments[ 'structure_type' ], |
|
98 | + '__repeatable_elements_'.$this->aArguments[ 'structure_type' ], |
|
99 | 99 | array() |
100 | 100 | ), |
101 | 101 | $this->getElementAsArray( |
102 | 102 | $_POST, // sanitization done |
103 | - '__sortable_elements_' . $this->aArguments[ 'structure_type' ], |
|
103 | + '__sortable_elements_'.$this->aArguments[ 'structure_type' ], |
|
104 | 104 | array() |
105 | 105 | ) |
106 | 106 | ) |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | * Changed the name from `getFieldsModel()`. |
161 | 161 | * @return array |
162 | 162 | */ |
163 | - public function getDataStructureFromAddedFieldsets() { |
|
163 | + public function getDataStructureFromAddedFieldsets() { |
|
164 | 164 | |
165 | - $_aFormDataStructure = array(); |
|
165 | + $_aFormDataStructure = array(); |
|
166 | 166 | foreach ( $this->getAsArray( $this->aFieldsets ) as $_sSectionID => $_aFieldsets ) { |
167 | 167 | |
168 | 168 | if ( $_sSectionID !== '_default' ) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | // For default field items. |
174 | - foreach( $_aFieldsets as $_sFieldID => $_aFieldset ) { |
|
174 | + foreach ( $_aFieldsets as $_sFieldID => $_aFieldset ) { |
|
175 | 175 | $_aFormDataStructure[ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
176 | 176 | } |
177 | 177 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $aSubject, |
204 | 204 | $this->getHTTPRequestSanitized( $this->getElementAsArray( |
205 | 205 | $_POST, // sanitization done |
206 | - '__repeatable_elements_' . $this->aArguments[ 'structure_type' ] |
|
206 | + '__repeatable_elements_'.$this->aArguments[ 'structure_type' ] |
|
207 | 207 | ) ) |
208 | 208 | ); |
209 | 209 | return $_oFilterRepeatableElements->get(); |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | public function _replyToRegisterFormItems() { |
217 | 217 | |
218 | 218 | // Check if the form should be created or not. |
219 | - if ( ! $this->isInThePage() ) { |
|
219 | + if ( !$this->isInThePage() ) { |
|
220 | 220 | return; |
221 | 221 | } |
222 | 222 | |
223 | 223 | // Load field type definitions. |
224 | - $this->_setFieldTypeDefinitions( 'admin_page_framework' ); // site-wide |
|
225 | - $this->_setFieldTypeDefinitions( $this->aArguments[ 'caller_id' ] ); // per class |
|
224 | + $this->_setFieldTypeDefinitions( 'admin_page_framework' ); // site-wide |
|
225 | + $this->_setFieldTypeDefinitions( $this->aArguments[ 'caller_id' ] ); // per class |
|
226 | 226 | |
227 | 227 | // Set the options array |
228 | 228 | $this->aSavedData = $this->_getSavedData( |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $this->aArguments, |
251 | 251 | $this->aFieldsets, |
252 | 252 | self::$_aResources, |
253 | - $this->aFieldTypeDefinitions, // must be called after performing `_setFieldTypeDefinitions()`. |
|
253 | + $this->aFieldTypeDefinitions, // must be called after performing `_setFieldTypeDefinitions()`. |
|
254 | 254 | $this->aCallbacks, |
255 | 255 | $this->oMsg |
256 | 256 | ); |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | $this->callBack( |
269 | 269 | $this->aCallbacks[ 'handle_form_data' ], |
270 | 270 | array( |
271 | - $this->aSavedData, // 1st parameter |
|
272 | - $this->aArguments, // 2nd parameter |
|
273 | - $this->aSectionsets, // 3rd parameter |
|
274 | - $this->aFieldsets, // 4th parameter |
|
271 | + $this->aSavedData, // 1st parameter |
|
272 | + $this->aArguments, // 2nd parameter |
|
273 | + $this->aSectionsets, // 3rd parameter |
|
274 | + $this->aFieldsets, // 4th parameter |
|
275 | 275 | ) |
276 | 276 | ); |
277 | 277 | |
@@ -285,15 +285,15 @@ discard block |
||
285 | 285 | $this->aSectionsets = $this->callBack( |
286 | 286 | $this->aCallbacks[ 'sectionsets_before_registration' ], |
287 | 287 | array( |
288 | - $this->aSectionsets, // 1st parameter |
|
288 | + $this->aSectionsets, // 1st parameter |
|
289 | 289 | ) |
290 | 290 | ); |
291 | 291 | // Let the main routine modify the fieldsets definition array. |
292 | 292 | $this->aFieldsets = $this->callBack( |
293 | 293 | $this->aCallbacks[ 'fieldsets_before_registration' ], |
294 | 294 | array( |
295 | - $this->aFieldsets, // 1st parameter |
|
296 | - $this->aSectionsets, // 2nd parameter |
|
295 | + $this->aFieldsets, // 1st parameter |
|
296 | + $this->aSectionsets, // 2nd parameter |
|
297 | 297 | ) |
298 | 298 | ); |
299 | 299 |
@@ -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 ) ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | if ( isset( $_GET[ 'post' ] ) && $_GET[ 'post' ] ) { // sanitization unnecessary |
98 | 98 | // It will perform a database query. |
99 | - return get_post_type( absint( self::getHTTPQueryGET( 'post', 0 ) ) ); // sanitization done |
|
99 | + return get_post_type( absint( self::getHTTPQueryGET( 'post', 0 ) ) ); // sanitization done |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -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,17 +173,17 @@ 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' ] ) ) { // sanitization unnecessary |
|
183 | + if ( !isset( $_GET[ 'post_type' ] ) ) { // sanitization unnecessary |
|
184 | 184 | return in_array( 'post', $_aPostTypes, true ); |
185 | 185 | } |
186 | - return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); // sanitization unnecessary |
|
186 | + return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); // sanitization unnecessary |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
@@ -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, |
@@ -91,10 +91,12 @@ discard block |
||
91 | 91 | * Tries to find the post type from the URL query for type. |
92 | 92 | */ |
93 | 93 | static public function getPostTypeByREQUEST() { |
94 | - if ( isset( $_REQUEST[ 'post_type' ] ) ) { // sanitization unnecessary |
|
94 | + if ( isset( $_REQUEST[ 'post_type' ] ) ) { |
|
95 | +// sanitization unnecessary |
|
95 | 96 | return sanitize_key( sanitize_text_field( $_REQUEST[ 'post_type' ] ) ); // sanitization done |
96 | 97 | } |
97 | - if ( isset( $_GET[ 'post' ] ) && $_GET[ 'post' ] ) { // sanitization unnecessary |
|
98 | + if ( isset( $_GET[ 'post' ] ) && $_GET[ 'post' ] ) { |
|
99 | +// sanitization unnecessary |
|
98 | 100 | // It will perform a database query. |
99 | 101 | return get_post_type( absint( self::getHTTPQueryGET( 'post', 0 ) ) ); // sanitization done |
100 | 102 | } |
@@ -180,7 +182,8 @@ discard block |
||
180 | 182 | } |
181 | 183 | |
182 | 184 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
183 | - if ( ! isset( $_GET[ 'post_type' ] ) ) { // sanitization unnecessary |
|
185 | + if ( ! isset( $_GET[ 'post_type' ] ) ) { |
|
186 | +// sanitization unnecessary |
|
184 | 187 | return in_array( 'post', $_aPostTypes, true ); |
185 | 188 | } |
186 | 189 | return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); // sanitization unnecessary |
@@ -270,11 +273,9 @@ discard block |
||
270 | 273 | |
271 | 274 | if ( is_network_admin() ) { |
272 | 275 | $_sNeedle = '#/wp-admin/network/?(.*?)$#i'; |
273 | - } |
|
274 | - else if ( is_user_admin() ) { |
|
276 | + } else if ( is_user_admin() ) { |
|
275 | 277 | $_sNeedle = '#/wp-admin/user/?(.*?)$#i'; |
276 | - } |
|
277 | - else { |
|
278 | + } else { |
|
278 | 279 | $_sNeedle = '#/wp-admin/?(.*?)$#i'; |
279 | 280 | } |
280 | 281 | preg_match( $_sNeedle, $_SERVER[ 'PHP_SELF' ], $_aMatches ); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * @return string|array |
30 | 30 | * @since 3.8.32 |
31 | 31 | */ |
32 | - static public function getHTTPQueryGET( $asKeys=array(), $mDefault=null ) { |
|
32 | + static public function getHTTPQueryGET( $asKeys = array(), $mDefault = null ) { |
|
33 | 33 | self::$___aGET = isset( self::$___aGET ) |
34 | 34 | ? self::$___aGET |
35 | - : self::getArrayMappedRecursive( 'sanitize_text_field', $_GET ); // sanitization done |
|
35 | + : self::getArrayMappedRecursive( 'sanitize_text_field', $_GET ); // sanitization done |
|
36 | 36 | if ( empty( $asKeys ) ) { |
37 | 37 | return self::$___aGET; |
38 | 38 | } |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $sPageURL = 'on' == @$_SERVER[ "HTTPS" ] ? "https://" : "http://"; |
52 | 52 | |
53 | 53 | if ( "80" != $_SERVER[ "SERVER_PORT" ] ) { |
54 | - $sPageURL .= $_SERVER[ "SERVER_NAME" ] . ":" . $_SERVER[ "SERVER_PORT" ] . $sRequestURI; |
|
54 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].":".$_SERVER[ "SERVER_PORT" ].$sRequestURI; |
|
55 | 55 | } else { |
56 | - $sPageURL .= $_SERVER[ "SERVER_NAME" ] . $sRequestURI; |
|
56 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].$sRequestURI; |
|
57 | 57 | } |
58 | 58 | return $sPageURL; |
59 | 59 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $sSubjectURL ( optional ) The subject url to modify |
71 | 71 | * @return string The modified url. |
72 | 72 | */ |
73 | - static public function getQueryAdminURL( $aAddingQueries=array(), $aRemovingQueryKeys=array(), $sSubjectURL='' ) { |
|
73 | + static public function getQueryAdminURL( $aAddingQueries = array(), $aRemovingQueryKeys = array(), $sSubjectURL = '' ) { |
|
74 | 74 | |
75 | 75 | $_sAdminURL = is_network_admin() |
76 | 76 | ? network_admin_url( AdminPageFramework_WPUtility_Page::getPageNow() ) |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | * @remark The parsable path is limited to under the WP_CONTENT_DIR directory. |
117 | 117 | */ |
118 | 118 | static public function getSRCFromPath( $sFilePath ) { |
119 | - $sFilePath = str_replace('\\', '/', $sFilePath ); |
|
120 | - $_sContentDirPath = str_replace('\\', '/', WP_CONTENT_DIR ); |
|
119 | + $sFilePath = str_replace( '\\', '/', $sFilePath ); |
|
120 | + $_sContentDirPath = str_replace( '\\', '/', WP_CONTENT_DIR ); |
|
121 | 121 | if ( false !== strpos( $sFilePath, $_sContentDirPath ) ) { |
122 | - $_sRelativePath = AdminPageFramework_Utility::getRelativePath( WP_CONTENT_DIR , $sFilePath ); |
|
123 | - $_sRelativePath = preg_replace("/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
122 | + $_sRelativePath = AdminPageFramework_Utility::getRelativePath( WP_CONTENT_DIR, $sFilePath ); |
|
123 | + $_sRelativePath = preg_replace( "/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
124 | 124 | return content_url( $_sRelativePath ); |
125 | 125 | } |
126 | - $_sRelativePath = AdminPageFramework_Utility::getRelativePath( ABSPATH , $sFilePath ); |
|
127 | - $_sRelativePath = preg_replace("/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
128 | - return trailingslashit( get_bloginfo( 'url' ) ) . $_sRelativePath; |
|
126 | + $_sRelativePath = AdminPageFramework_Utility::getRelativePath( ABSPATH, $sFilePath ); |
|
127 | + $_sRelativePath = preg_replace( "/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
128 | + return trailingslashit( get_bloginfo( 'url' ) ).$_sRelativePath; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | * @param string $sSRC |
142 | 142 | * @param boolean $bReturnNullIfNotExist |
143 | 143 | */ |
144 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
144 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
145 | 145 | |
146 | - if ( ! self::isResourcePath( $sSRC ) ) { |
|
146 | + if ( !self::isResourcePath( $sSRC ) ) { |
|
147 | 147 | return $bReturnNullIfNotExist |
148 | 148 | ? null |
149 | 149 | : $sSRC; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // If the file exists, it means it is an absolute path. If so, calculate the URL from the path. |
158 | 158 | if ( file_exists( realpath( $sSRC ) ) ) { |
159 | - return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
159 | + return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | if ( $bReturnNullIfNotExist ) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param boolean $bReturnNullIfNotExist |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - static public function resolveSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
176 | + static public function resolveSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
177 | 177 | return self::getResolvedSRC( $sSRC, $bReturnNullIfNotExist ); |
178 | 178 | } |
179 | 179 |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * @see wp_create_nonce() |
31 | 31 | * @since 3.8.32 |
32 | 32 | */ |
33 | - static public function getNonceCreated( $sAction=-1, $iLifespan=86400 ) { |
|
33 | + static public function getNonceCreated( $sAction = -1, $iLifespan = 86400 ) { |
|
34 | 34 | self::$___iCustomNonceLifeSpan = $iLifespan; |
35 | 35 | add_filter( 'nonce_life', array( __CLASS__, '_replyToSetNonceLifeSpan' ) ); |
36 | - $_sNonce = ( string ) wp_create_nonce($sAction ); |
|
36 | + $_sNonce = ( string ) wp_create_nonce( $sAction ); |
|
37 | 37 | remove_filter( 'nonce_life', array( __CLASS__, '_replyToSetNonceLifeSpan' ) ); |
38 | 38 | self::$___iCustomNonceLifeSpan = null; |
39 | - return $_sNonce ; |
|
39 | + return $_sNonce; |
|
40 | 40 | } |
41 | 41 | /** |
42 | 42 | * @param integer $iLifespanInSeconds |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if ( is_string( $_sCustomMenuSlug ) ) { |
63 | 63 | return $_sCustomMenuSlug; |
64 | 64 | } |
65 | - return 'edit.php?post_type=' . $sPostTypeSlug; |
|
65 | + return 'edit.php?post_type='.$sPostTypeSlug; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | static public function getWPAdminDirPath() { |
97 | 97 | |
98 | 98 | $_sWPAdminPath = str_replace( |
99 | - get_bloginfo( 'url' ) . '/', // search |
|
100 | - ABSPATH, // replace |
|
99 | + get_bloginfo( 'url' ).'/', // search |
|
100 | + ABSPATH, // replace |
|
101 | 101 | get_admin_url() // subject - works even in the network admin |
102 | 102 | ); |
103 | 103 | return rtrim( $_sWPAdminPath, '/' ); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @since 3.7.0 |
116 | 116 | * @return void |
117 | 117 | */ |
118 | - static public function goToLocalURL( $sURL, $oCallbackOnError=null ) { |
|
118 | + static public function goToLocalURL( $sURL, $oCallbackOnError = null ) { |
|
119 | 119 | self::redirectByType( $sURL, 1, $oCallbackOnError ); |
120 | 120 | } |
121 | 121 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @since 3.6.3 |
129 | 129 | * @since 3.7.0 Added the second callback parameter. |
130 | 130 | */ |
131 | - static public function goToURL( $sURL, $oCallbackOnError=null ) { |
|
131 | + static public function goToURL( $sURL, $oCallbackOnError = null ) { |
|
132 | 132 | self::redirectByType( $sURL, 0, $oCallbackOnError ); |
133 | 133 | } |
134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param integer $iType 0: external site, 1: local site (within the same domain). |
139 | 139 | * @param callable $oCallbackOnError |
140 | 140 | */ |
141 | - static public function redirectByType( $sURL, $iType=0, $oCallbackOnError=null ) { |
|
141 | + static public function redirectByType( $sURL, $iType = 0, $oCallbackOnError = null ) { |
|
142 | 142 | |
143 | 143 | $_iRedirectError = self::getRedirectPreError( $sURL, $iType ); |
144 | 144 | if ( $_iRedirectError && is_callable( $oCallbackOnError ) ) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | static public function getRedirectPreError( $sURL, $iType ) { |
170 | 170 | |
171 | 171 | // check only external urls as local ones can be a relative url and always fails the below check. |
172 | - if ( ! $iType && filter_var( $sURL, FILTER_VALIDATE_URL) === false ) { |
|
172 | + if ( !$iType && filter_var( $sURL, FILTER_VALIDATE_URL ) === false ) { |
|
173 | 173 | return 1; |
174 | 174 | } |
175 | 175 | // If HTTP headers are already sent, redirect cannot be done. |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @since 3.8.24 |
26 | 26 | * @since 3.8.32 Added a default value for the `$bStripSlashes` parameter. |
27 | 27 | */ |
28 | - static public function getHTTPRequestSanitized( array $aRequest, $bStripSlashes=true ) { |
|
29 | - foreach( $aRequest as $_isIndex => $_mValue ) { |
|
28 | + static public function getHTTPRequestSanitized( array $aRequest, $bStripSlashes = true ) { |
|
29 | + foreach ( $aRequest as $_isIndex => $_mValue ) { |
|
30 | 30 | if ( is_array( $_mValue ) ) { |
31 | 31 | $aRequest[ $_isIndex ] = self::getHTTPRequestSanitized( $_mValue, $bStripSlashes ); |
32 | 32 | continue; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @sicne 3.8.32 Added the `$bStripSlashes` parameter. |
51 | 51 | * @see _sanitize_text_fields() |
52 | 52 | */ |
53 | - static private function ___getHTTPRequestTextValueSanitized( $sString, $bStripSlashes, $bKeepLineFeeds=true ) { |
|
53 | + static private function ___getHTTPRequestTextValueSanitized( $sString, $bStripSlashes, $bKeepLineFeeds = true ) { |
|
54 | 54 | |
55 | 55 | $sString = $bStripSlashes ? stripslashes( $sString ) : $sString; |
56 | 56 | |
57 | 57 | $_sFiltered = wp_check_invalid_utf8( $sString ); |
58 | - if ( ! $bKeepLineFeeds ) { |
|
58 | + if ( !$bKeepLineFeeds ) { |
|
59 | 59 | $_sFiltered = preg_replace( '/[\r\n\t ]+/', ' ', $_sFiltered ); |
60 | 60 | } |
61 | 61 | $_sFiltered = trim( $_sFiltered ); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | . '/i'; |
87 | 87 | $_iPos = 0; |
88 | 88 | while ( preg_match( $_sPattern, $sString, $_aMatches, PREG_OFFSET_CAPTURE, $_iPos ) ) { |
89 | - if ( ! isset( $_aMatches[ 0 ][ 0 ], $_aMatches[ 0 ][ 1 ] ) ) { |
|
89 | + if ( !isset( $_aMatches[ 0 ][ 0 ], $_aMatches[ 0 ][ 1 ] ) ) { |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | $_iPos = $_aMatches[ 0 ][ 1 ]; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return mixed |
129 | 129 | * @since 3.8.24 |
130 | 130 | */ |
131 | - static public function getObjectCache( $asName, $mDefault=null ) { |
|
131 | + static public function getObjectCache( $asName, $mDefault = null ) { |
|
132 | 132 | return self::getArrayValueByArrayKeys( self::$___aObjectCache, self::getAsArray( $asName ), $mDefault ); |
133 | 133 | } |
134 | 134 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | * @param string $sProgramName |
144 | 144 | * @since 3.8.8 |
145 | 145 | */ |
146 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='Admin Page Framework' ) { |
|
146 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = 'Admin Page Framework' ) { |
|
147 | 147 | trigger_error( |
148 | - $sProgramName . ': ' . sprintf( |
|
148 | + $sProgramName.': '.sprintf( |
|
149 | 149 | $sAlternative |
150 | 150 | ? '<code>%1$s</code> has been deprecated. Use <code>%2$s</code> instead.' |
151 | 151 | : '<code>%1$s</code> has been deprecated.', |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @param string|array $asParameters Parameters to pass to the callback function. |
169 | 169 | * @return mixed |
170 | 170 | */ |
171 | - public function callBack( $oCallable, $asParameters=array() ) { |
|
172 | - $_aParameters = self::getAsArray( |
|
171 | + public function callBack( $oCallable, $asParameters = array() ) { |
|
172 | + $_aParameters = self::getAsArray( |
|
173 | 173 | $asParameters, |
174 | 174 | true // preserve empty |
175 | 175 | ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @param array $aParameters |
209 | 209 | * @return string The captured output buffer. |
210 | 210 | */ |
211 | - static public function getOutputBuffer( $cCallable, array $aParameters=array() ) { |
|
211 | + static public function getOutputBuffer( $cCallable, array $aParameters = array() ) { |
|
212 | 212 | |
213 | 213 | ob_start(); |
214 | 214 | echo call_user_func_array( $cCallable, $aParameters ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $_iCount = count( get_object_vars( $oInstance ) ); |
232 | 232 | $_sClassName = get_class( $oInstance ); |
233 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
233 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
234 | 234 | |
235 | 235 | } |
236 | 236 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @param boolean|integer|double|string|array|object|resource|NULL $mFalse The value to return when the first parameter value yields false. |
248 | 248 | * @return mixed |
249 | 249 | */ |
250 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
250 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
251 | 251 | return $mValue ? $mTrue : $mFalse; |
252 | 252 | } |
253 | 253 |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @since 3.8.0 |
56 | 56 | * @internal |
57 | 57 | */ |
58 | - protected function _setOptionArray( $iTermID=null, $_deprecated=null ) { |
|
58 | + protected function _setOptionArray( $iTermID = null, $_deprecated = null ) { |
|
59 | 59 | $this->oForm->aSavedData = $this->oUtil->addAndApplyFilter( |
60 | 60 | $this, // the caller factory object |
61 | - 'options_' . $this->oProp->sClassName, |
|
61 | + 'options_'.$this->oProp->sClassName, |
|
62 | 62 | $this->_getSavedTermMetas( $iTermID, $this->oForm->aFieldsets ) |
63 | 63 | // @todo maybe pass the term id because the user will not know whihch form data is |
64 | 64 | ); |
@@ -90,27 +90,27 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function _replyToValidateOptions( $iTermID ) { |
92 | 92 | |
93 | - if ( ! $this->_shouldProceedValidation() ) { |
|
93 | + if ( !$this->_shouldProceedValidation() ) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $_aSavedFormData = $this->_getSavedTermMetas( $iTermID, $this->oForm->aFieldsets ); |
98 | - $_aSubmittedFormData = $this->oForm->getSubmittedData( $this->oForm->getHTTPRequestSanitized( $_POST ) ); // sanitization done |
|
98 | + $_aSubmittedFormData = $this->oForm->getSubmittedData( $this->oForm->getHTTPRequestSanitized( $_POST ) ); // sanitization done |
|
99 | 99 | $_aSubmittedFormData = $this->oUtil->addAndApplyFilters( |
100 | 100 | $this, |
101 | - 'validation_' . $this->oProp->sClassName, |
|
101 | + 'validation_'.$this->oProp->sClassName, |
|
102 | 102 | call_user_func_array( // 1st param |
103 | 103 | array( $this, 'validate' ), // triggers __call() |
104 | 104 | array( $_aSubmittedFormData, $_aSavedFormData, $this ) |
105 | 105 | ), // 3.5.10+ |
106 | - $_aSavedFormData, // 2nd param |
|
106 | + $_aSavedFormData, // 2nd param |
|
107 | 107 | $this // 3rd param |
108 | 108 | ); |
109 | 109 | |
110 | 110 | // @todo Update term metas |
111 | 111 | $this->oForm->updateMetaDataByType( |
112 | - $iTermID, // object id |
|
113 | - $_aSubmittedFormData, // user submit form data |
|
112 | + $iTermID, // object id |
|
113 | + $_aSubmittedFormData, // user submit form data |
|
114 | 114 | $this->oForm->dropRepeatableElements( $_aSavedFormData ), // Drop repeatable section elements from the saved meta array. |
115 | 115 | $this->oForm->sStructureType // fields type |
116 | 116 | ); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( $oFactory ) { |
30 | 30 | |
31 | - $this->oFactory = $oFactory; |
|
31 | + $this->oFactory = $oFactory; |
|
32 | 32 | |
33 | 33 | // wp_mail() will be loaded by the time 'after_setup_theme' is loaded. |
34 | 34 | // @deprecated 3.7.0 |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function _replyToCheckRedirects() { |
54 | 54 | |
55 | - if ( ! $this->_shouldProceed() ) { |
|
55 | + if ( !$this->_shouldProceed() ) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | 59 | // The redirect transient key. |
60 | 60 | $_sPageSlug = $this->getHTTPQueryGET( 'page', '' ); |
61 | - $_sTransient = 'apf_rurl' . md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$_sPageSlug}" ) ); |
|
61 | + $_sTransient = 'apf_rurl'.md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$_sPageSlug}" ) ); |
|
62 | 62 | |
63 | 63 | // Check the settings error transient. |
64 | 64 | $_aError = $this->oFactory->getFieldErrors(); |
65 | - if ( ! empty( $_aError ) ) { |
|
65 | + if ( !empty( $_aError ) ) { |
|
66 | 66 | $this->deleteTransient( $_sTransient ); // we don't need it any more. |
67 | 67 | return; |
68 | 68 | } |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | private function _shouldProceed() { |
90 | 90 | |
91 | 91 | // Check if it's one of the plugin's added page. If not, do nothing. |
92 | - if ( ! $this->oFactory->isInThePage() ) { |
|
92 | + if ( !$this->oFactory->isInThePage() ) { |
|
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | |
96 | 96 | // If the settings have not updated the options, do nothing. |
97 | - if ( ! $this->getHTTPQueryGET( 'settings-updated', false ) ) { |
|
97 | + if ( !$this->getHTTPQueryGET( 'settings-updated', false ) ) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 |