@@ -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 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->oFactory = $oFactory; |
30 | 30 | |
31 | 31 | add_filter( |
32 | - "validation_pre_" . $this->oFactory->oProp->sClassName, |
|
32 | + "validation_pre_".$this->oFactory->oProp->sClassName, |
|
33 | 33 | array( $this, '_replyToValidateUserFormInputs' ), |
34 | 34 | 10, |
35 | 35 | 4 |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | public function _replyToValidateUserFormInputs( $aInputs, $aRawInputs, $aOptions, $oFactory ) { |
53 | 53 | |
54 | 54 | // No need to retrieve the default tab slug here because it is an embedded value that is already set in the previous page load. |
55 | - $_sTabSlug = sanitize_text_field( $this->getElement( $_POST, 'tab_slug', '' ) ); // sanitization done |
|
56 | - $_sPageSlug = sanitize_text_field( $this->getElement( $_POST, 'page_slug', '' ) ); // sanitization done |
|
55 | + $_sTabSlug = sanitize_text_field( $this->getElement( $_POST, 'tab_slug', '' ) ); // sanitization done |
|
56 | + $_sPageSlug = sanitize_text_field( $this->getElement( $_POST, 'page_slug', '' ) ); // sanitization done |
|
57 | 57 | |
58 | - $_aSubmits = $this->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, '__submit', array() ) ); // sanitization done |
|
58 | + $_aSubmits = $this->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, '__submit', array() ) ); // sanitization done |
|
59 | 59 | $_sPressedInputName = $this->_getPressedSubmitButtonData( $_aSubmits, 'name' ); |
60 | 60 | $_sSubmitSectionID = $this->_getPressedSubmitButtonData( $_aSubmits, 'section_id' ); |
61 | 61 | |
62 | 62 | // Submit Information - [3.5.0+] this will be passed to validation callback methods. |
63 | - $_aSubmitsInformation = array( |
|
63 | + $_aSubmitsInformation = array( |
|
64 | 64 | 'page_slug' => $_sPageSlug, |
65 | 65 | 'tab_slug' => $_sTabSlug, |
66 | 66 | 'input_id' => $this->_getPressedSubmitButtonData( $_aSubmits, 'input_id' ), |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | 'AdminPageFramework_Model__FormSubmission__Validator__Export', |
81 | 81 | 'AdminPageFramework_Model__FormSubmission__Validator__Reset', |
82 | 82 | 'AdminPageFramework_Model__FormSubmission__Validator__ResetConfirm', // 3.7.6+ Moved to after validation from before validation |
83 | - 'AdminPageFramework_Model__FormSubmission__Validator__ContactForm', // 3.7.6+ Moved to after validation from before validation |
|
83 | + 'AdminPageFramework_Model__FormSubmission__Validator__ContactForm', // 3.7.6+ Moved to after validation from before validation |
|
84 | 84 | 'AdminPageFramework_Model__FormSubmission__Validator__ContactFormConfirm', |
85 | 85 | |
86 | 86 | ); |
87 | - foreach( $_aClassNames as $_sClassName ) { |
|
87 | + foreach ( $_aClassNames as $_sClassName ) { |
|
88 | 88 | new $_sClassName( $this->oFactory ); |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $this->addAndDoActions( |
95 | 95 | $this->oFactory, |
96 | - 'try_validation_before_' . $this->oFactory->oProp->sClassName, |
|
96 | + 'try_validation_before_'.$this->oFactory->oProp->sClassName, |
|
97 | 97 | $aInputs, |
98 | 98 | $aRawInputs, |
99 | 99 | $_aSubmits, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $this->addAndDoActions( |
114 | 114 | $this->oFactory, |
115 | - 'try_validation_after_' . $this->oFactory->oProp->sClassName, |
|
115 | + 'try_validation_after_'.$this->oFactory->oProp->sClassName, |
|
116 | 116 | $aInputs, |
117 | 117 | $aRawInputs, |
118 | 118 | $_aSubmits, |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
34 | 34 | |
35 | - if ( ! $this->_shouldProceed() ) { |
|
35 | + if ( !$this->_shouldProceed() ) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | $this->_exportOptions( |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if ( $this->oFactory->hasFieldError() ) { |
51 | 51 | return false; |
52 | 52 | } |
53 | - return isset( $_POST[ '__export' ][ 'submit' ] ); // sanitization done |
|
53 | + return isset( $_POST[ '__export' ][ 'submit' ] ); // sanitization done |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | */ |
68 | 68 | protected function _exportOptions( $mData, $sPageSlug, $sTabSlug ) { |
69 | 69 | |
70 | - $_oExport = new AdminPageFramework_ExportOptions( |
|
71 | - $this->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, array( '__export' ) ) ), // sanitization done |
|
70 | + $_oExport = new AdminPageFramework_ExportOptions( |
|
71 | + $this->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, array( '__export' ) ) ), // sanitization done |
|
72 | 72 | $this->oFactory->oProp->sClassName |
73 | 73 | ); |
74 | - $_aArguments = array( |
|
74 | + $_aArguments = array( |
|
75 | 75 | 'class_name' => $this->oFactory->oProp->sClassName, |
76 | 76 | 'page_slug' => $sPageSlug, |
77 | 77 | 'tab_slug' => $sTabSlug, |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $sExportFileName, |
144 | 144 | $aArguments[ 'pressed_field_id' ], |
145 | 145 | $aArguments[ 'pressed_input_id' ], |
146 | - $mData, // 3.4.6+ |
|
146 | + $mData, // 3.4.6+ |
|
147 | 147 | $this->oFactory // 3.4.6+ |
148 | 148 | ); |
149 | 149 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 3.6.3 |
36 | 36 | */ |
37 | 37 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
38 | - if ( ! $this->_shouldProceed() ) { |
|
38 | + if ( !$this->_shouldProceed() ) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | $this->_doImportOptions( |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return false; |
53 | 53 | } |
54 | 54 | return isset( |
55 | - $_POST[ '__import' ][ 'submit' ], // sanitization unnecessary |
|
55 | + $_POST[ '__import' ][ 'submit' ], // sanitization unnecessary |
|
56 | 56 | $_FILES[ '__import' ] // sanitization unnecessary |
57 | 57 | ); |
58 | 58 | } |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | */ |
94 | 94 | private function _importOptions( $aStoredOptions, $sPageSlug, $sTabSlug ) { |
95 | 95 | |
96 | - $_oImport = new AdminPageFramework_ImportOptions( |
|
96 | + $_oImport = new AdminPageFramework_ImportOptions( |
|
97 | 97 | $this->getHTTPRequestSanitized( $_FILES[ '__import' ], false ), // sanitization done |
98 | 98 | $this->getHTTPRequestSanitized( $_POST[ '__import' ] ) // sanitization done |
99 | 99 | ); |
100 | - $_aArguments = array( |
|
100 | + $_aArguments = array( |
|
101 | 101 | 'class_name' => $this->oFactory->oProp->sClassName, |
102 | 102 | 'page_slug' => $sPageSlug, |
103 | 103 | 'tab_slug' => $sTabSlug, |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | // Check the uploaded file MIME type. |
117 | 117 | $_aMIMEType = $this->_getImportMIMEType( $_aArguments ); |
118 | 118 | $_sType = $_oImport->getType(); |
119 | - if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
119 | + if ( !in_array( $_sType, $_aMIMEType ) ) { |
|
120 | 120 | $this->oFactory->setSettingNotice( sprintf( $this->oFactory->oMsg->get( 'uploaded_file_type_not_supported' ), $_sType ) ); |
121 | - return $aStoredOptions; // do not change the framework's options. |
|
121 | + return $aStoredOptions; // do not change the framework's options. |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // Retrieve the importing data. |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | array( |
184 | 184 | 'text/plain', |
185 | 185 | 'application/octet-stream', // .json file is dealt as a binary file. |
186 | - 'application/json', // 3.7.0+ some servers cannot upload json files without this |
|
187 | - 'text/html', // 3.7.2+ |
|
188 | - 'application/txt', // 3.7.2+ |
|
186 | + 'application/json', // 3.7.0+ some servers cannot upload json files without this |
|
187 | + 'text/html', // 3.7.2+ |
|
188 | + 'application/txt', // 3.7.2+ |
|
189 | 189 | ), |
190 | 190 | $aArguments |
191 | 191 | ); |
@@ -274,18 +274,18 @@ discard block |
||
274 | 274 | protected function _getPortFilterHookNames( $sPrefix, array $aArguments ) { |
275 | 275 | |
276 | 276 | return array( |
277 | - $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_input_id' ], |
|
277 | + $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_input_id' ], |
|
278 | 278 | $aArguments[ 'section_id' ] |
279 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] .'_' . $aArguments[ 'pressed_field_id' ] |
|
280 | - : $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_field_id' ], |
|
279 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ].'_'.$aArguments[ 'pressed_field_id' ] |
|
280 | + : $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_field_id' ], |
|
281 | 281 | $aArguments[ 'section_id' ] |
282 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] |
|
282 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ] |
|
283 | 283 | : null, |
284 | 284 | $aArguments[ 'tab_slug' ] |
285 | - ? $sPrefix . $aArguments[ 'page_slug' ] . '_' . $aArguments[ 'tab_slug' ] |
|
285 | + ? $sPrefix.$aArguments[ 'page_slug' ].'_'.$aArguments[ 'tab_slug' ] |
|
286 | 286 | : null, |
287 | - $sPrefix . $aArguments[ 'page_slug' ], |
|
288 | - $sPrefix . $aArguments[ 'class_name' ] |
|
287 | + $sPrefix.$aArguments[ 'page_slug' ], |
|
288 | + $sPrefix.$aArguments[ 'class_name' ] |
|
289 | 289 | ); |
290 | 290 | |
291 | 291 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( $oFactory, $aSavedData, $aArguments, $aSectionsets, $aFieldsets ) { |
30 | 30 | |
31 | - $this->oFactory = $oFactory; |
|
31 | + $this->oFactory = $oFactory; |
|
32 | 32 | |
33 | 33 | // add_action |
34 | 34 | // @deprecated 3.7.0 |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function _handleFormData() { |
73 | 73 | |
74 | - if ( ! $this->_shouldProceed() ) { |
|
74 | + if ( !$this->_shouldProceed() ) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | - $_sTabSlug = sanitize_text_field( $this->getElement( $_POST, 'tab_slug', '' ) ); // sanitization done |
|
78 | + $_sTabSlug = sanitize_text_field( $this->getElement( $_POST, 'tab_slug', '' ) ); // sanitization done |
|
79 | 79 | $_sPageSlug = sanitize_text_field( $this->getElement( $_POST, 'page_slug', '' ) ); // sanitization done |
80 | 80 | |
81 | 81 | // Apply user validation callbacks to the submitted data. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ); |
109 | 109 | |
110 | 110 | // Execute the submit_{...} actions. |
111 | - $_aSubmits = $this->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, '__submit', array() ) ); // sanitization done |
|
111 | + $_aSubmits = $this->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, '__submit', array() ) ); // sanitization done |
|
112 | 112 | $_sSubmitSectionID = $this->_getPressedSubmitButtonData( $_aSubmits, 'section_id' ); |
113 | 113 | $_sPressedFieldID = $this->_getPressedSubmitButtonData( $_aSubmits, 'field_id' ); |
114 | 114 | $_sPressedInputID = $this->_getPressedSubmitButtonData( $_aSubmits, 'input_id' ); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | new AdminPageFramework_Model__FormSubmission__Validator( $this->oFactory ); |
127 | 127 | |
128 | 128 | // [3.6.3+] Apply filters. All the sub-routines of handling form submit data use this filter hook. |
129 | - $_aInputs = $this->addAndApplyFilters( |
|
129 | + $_aInputs = $this->addAndApplyFilters( |
|
130 | 130 | $this->oFactory, |
131 | 131 | "validation_pre_{$this->oFactory->oProp->sClassName}", |
132 | 132 | $_aInputs, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | // Save the data. |
139 | 139 | $_bUpdated = false; |
140 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
140 | + if ( !$this->oFactory->oProp->_bDisableSavingOptions ) { |
|
141 | 141 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
142 | 142 | } |
143 | 143 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | private function _shouldProceed() { |
177 | 177 | |
178 | 178 | if ( |
179 | - ! isset( |
|
179 | + !isset( |
|
180 | 180 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started // sanitization unnecessary as just checking |
181 | 181 | $_POST[ '_wp_http_referer' ] // sanitization unnecessary as just checking |
182 | 182 | ) |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | // Referrer |
188 | - $_sRequestURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), sanitize_text_field( wp_unslash( $_SERVER[ 'REQUEST_URI' ] ) ) ); // sanitization done |
|
189 | - $_sRefererURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), sanitize_text_field( $_POST[ '_wp_http_referer' ] ) ); // sanitization done |
|
188 | + $_sRequestURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), sanitize_text_field( wp_unslash( $_SERVER[ 'REQUEST_URI' ] ) ) ); // sanitization done |
|
189 | + $_sRefererURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), sanitize_text_field( $_POST[ '_wp_http_referer' ] ) ); // sanitization done |
|
190 | 190 | if ( $_sRequestURI != $_sRefererURI ) { // see the function definition of wp_referer_field() in functions.php. |
191 | 191 | return false; |
192 | 192 | } |
193 | 193 | |
194 | 194 | // Check if all the form fields are sent. |
195 | 195 | if ( |
196 | - ! isset( |
|
196 | + !isset( |
|
197 | 197 | // these keys are supposed to be embedded at the end of the form. |
198 | 198 | // if the server truncates the form input values for `max_input_vars`, these will be lost in PHP 5.3.9 or above. |
199 | 199 | $_POST[ '_is_admin_page_framework' ], // holds the form nonce // sanitization unnecessary as just checking |
200 | - $_POST[ 'page_slug' ], // sanitization unnecessary as just checking |
|
200 | + $_POST[ 'page_slug' ], // sanitization unnecessary as just checking |
|
201 | 201 | $_POST[ 'tab_slug' ] // sanitization unnecessary as just checking |
202 | 202 | ) |
203 | 203 | ) { |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | |
216 | - $_bVerifyNonce = wp_verify_nonce( |
|
217 | - $_POST[ '_is_admin_page_framework' ], // sanitization should not be done as and leave the nonce check fail if the value modified |
|
218 | - 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ) |
|
216 | + $_bVerifyNonce = wp_verify_nonce( |
|
217 | + $_POST[ '_is_admin_page_framework' ], // sanitization should not be done as and leave the nonce check fail if the value modified |
|
218 | + 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ) |
|
219 | 219 | ); |
220 | - if ( ! $_bVerifyNonce ) { |
|
220 | + if ( !$_bVerifyNonce ) { |
|
221 | 221 | $this->oFactory->setAdminNotice( $this->oFactory->oMsg->get( 'nonce_verification_failed' ) ); |
222 | 222 | return false; |
223 | 223 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private function _getUserInputsFromPOST() { |
233 | 233 | return $this->oFactory->oForm->getSubmittedData( |
234 | - $this->oFactory->oForm->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, $this->oFactory->oProp->sOptionKey ) ), // sanitization done |
|
234 | + $this->oFactory->oForm->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, $this->oFactory->oProp->sOptionKey ) ), // sanitization done |
|
235 | 235 | false // do not extract from form fieldsets structure |
236 | 236 | ); |
237 | 237 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $this->oFactory, |
258 | 258 | array( |
259 | 259 | // @todo deprecate the hook with the input ID |
260 | - "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
260 | + "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
261 | 261 | $_sSubmitSectionID |
262 | 262 | ? "submit_{$this->oFactory->oProp->sClassName}_{$_sSubmitSectionID}_{$_sPressedFieldID}" |
263 | 263 | : "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedFieldID}", |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | null |
302 | 302 | ), |
303 | 303 | $this->getAOrB( |
304 | - isset( $_POST[ 'tab_slug' ] ), // sanitization unnecessary |
|
304 | + isset( $_POST[ 'tab_slug' ] ), // sanitization unnecessary |
|
305 | 305 | "submit_after_{$this->oFactory->oProp->sClassName}_{$_sPageSlug}_{$_sTabSlug}", |
306 | 306 | null |
307 | 307 | ), |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | |
341 | 341 | // Drop the 'field_errors' key. |
342 | 342 | $_aRemoveQueries = array(); |
343 | - if ( ! isset( $aStatus[ 'field_errors' ] ) || ! $aStatus[ 'field_errors' ] ) { |
|
343 | + if ( !isset( $aStatus[ 'field_errors' ] ) || !$aStatus[ 'field_errors' ] ) { |
|
344 | 344 | unset( $aStatus[ 'field_errors' ] ); |
345 | - $_aRemoveQueries[] = 'field_errors'; |
|
345 | + $_aRemoveQueries[ ] = 'field_errors'; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | return $this->addAndApplyFilters( // 3.4.4+ |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | private function _removePageElements( $aOptions, $sPageSlug, $sTabSlug ) { |
369 | 369 | |
370 | - if ( ! $sPageSlug && ! $sTabSlug ) { |
|
370 | + if ( !$sPageSlug && !$sTabSlug ) { |
|
371 | 371 | return $aOptions; |
372 | 372 | } |
373 | 373 |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | // Save the data. |
139 | 139 | $_bUpdated = false; |
140 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
140 | + if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
141 | 141 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
142 | 142 | } |
143 | 143 | |
@@ -180,14 +180,15 @@ discard block |
||
180 | 180 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started // sanitization unnecessary as just checking |
181 | 181 | $_POST[ '_wp_http_referer' ] // sanitization unnecessary as just checking |
182 | 182 | ) |
183 | - ) { |
|
183 | + ) { |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
187 | 187 | // Referrer |
188 | 188 | $_sRequestURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), sanitize_text_field( wp_unslash( $_SERVER[ 'REQUEST_URI' ] ) ) ); // sanitization done |
189 | 189 | $_sRefererURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), sanitize_text_field( $_POST[ '_wp_http_referer' ] ) ); // sanitization done |
190 | - if ( $_sRequestURI != $_sRefererURI ) { // see the function definition of wp_referer_field() in functions.php. |
|
190 | + if ( $_sRequestURI != $_sRefererURI ) { |
|
191 | +// see the function definition of wp_referer_field() in functions.php. |
|
191 | 192 | return false; |
192 | 193 | } |
193 | 194 |