@@ -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 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return null|string Returns `null` if no value is found and the associated link url if found. |
48 | 48 | * Otherwise, the found value. |
49 | 49 | */ |
50 | - protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey='field_id' ) { |
|
50 | + protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey='field_id' ) { |
|
51 | 51 | |
52 | 52 | foreach( $aPostElements as $_sInputID => $_aSubElements ) { |
53 | 53 | |
@@ -58,7 +58,8 @@ discard block |
||
58 | 58 | $_aNameKeys = explode( '|', $_aSubElements[ 'name' ] ); |
59 | 59 | |
60 | 60 | // If the element is not found, skip. |
61 | - if ( null === $this->getElement( $_POST, $_aNameKeys, null ) ) { // sanitization unnecessary |
|
61 | + if ( null === $this->getElement( $_POST, $_aNameKeys, null ) ) { |
|
62 | +// sanitization unnecessary |
|
62 | 63 | continue; |
63 | 64 | } |
64 | 65 | |
@@ -85,7 +86,7 @@ discard block |
||
85 | 86 | */ |
86 | 87 | protected function _setSettingNoticeAfterValidation( $bIsInputEmtpy ) { |
87 | 88 | |
88 | - if ( $this->oFactory->hasSettingNotice() ) { |
|
89 | + if ( $this->oFactory->hasSettingNotice() ) { |
|
89 | 90 | return; |
90 | 91 | } |
91 | 92 | $this->oFactory->setSettingNotice( |
@@ -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 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class AdminPageFramework_Model__FormSubmission__Validator__ContactForm extends AdminPageFramework_Model__FormSubmission__Validator_Base { |
18 | 18 | |
19 | - public $sActionHookPrefix = 'try_validation_after_'; // 3.7.6 Changed it from `try_validation_before_` |
|
19 | + public $sActionHookPrefix = 'try_validation_after_'; // 3.7.6 Changed it from `try_validation_before_` |
|
20 | 20 | public $iHookPriority = 10; |
21 | 21 | public $iCallbackParameters = 5; |
22 | 22 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
34 | 34 | |
35 | 35 | // Check whether sending an email has been confirmed by the user or not. |
36 | - if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
36 | + if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | $this->getElement( $aSubmitInformation, 'section_id' ) |
45 | 45 | ); |
46 | 46 | $this->oFactory->oProp->_bDisableSavingOptions = true; |
47 | - $this->deleteTransient( 'apf_tfd' . md5( 'temporary_form_data_' . $this->oFactory->oProp->sClassName . get_current_user_id() ) ); |
|
47 | + $this->deleteTransient( 'apf_tfd'.md5( 'temporary_form_data_'.$this->oFactory->oProp->sClassName.get_current_user_id() ) ); |
|
48 | 48 | |
49 | 49 | // Schedule to remove the confirmation url query key. |
50 | 50 | add_action( "setting_update_url_{$this->oFactory->oProp->sClassName}", array( $this, '_replyToRemoveConfirmationQueryKey' ) ); |
51 | 51 | |
52 | 52 | // Go to the catch clause. |
53 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
53 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
54 | 54 | $_oException->aReturn = $aInputs; |
55 | 55 | throw $_oException; |
56 | 56 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | private function ___sendEmail( $aInputs, $sPressedInputNameFlat, $sSubmitSectionID ) { |
87 | 87 | |
88 | - $_sTransientKey = 'apf_em_' . md5( $sPressedInputNameFlat . get_current_user_id() ); |
|
88 | + $_sTransientKey = 'apf_em_'.md5( $sPressedInputNameFlat.get_current_user_id() ); |
|
89 | 89 | $_aEmailOptions = $this->getTransient( $_sTransientKey ); |
90 | 90 | $this->deleteTransient( $_sTransientKey ); |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ); |
103 | 103 | sleep( 5 ); |
104 | 104 | |
105 | - if ( false === wp_verify_nonce( $_aEmailOptions[ 'nonce' ], 'apf_email_nonce_' . md5( ( string ) site_url() ) ) ) { |
|
105 | + if ( false === wp_verify_nonce( $_aEmailOptions[ 'nonce' ], 'apf_email_nonce_'.md5( ( string ) site_url() ) ) ) { |
|
106 | 106 | $this->oFactory->setSettingNotice( |
107 | 107 | $this->oFactory->oMsg->get( 'nonce_verification_failed' ), |
108 | 108 | 'error' |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return string |
138 | 138 | */ |
139 | 139 | public function _replyToRemoveConfirmationQueryKey( $sSettingUpdateURL ) { |
140 | - return remove_query_arg( array( 'confirmation', ), $sSettingUpdateURL ); |
|
140 | + return remove_query_arg( array( 'confirmation',), $sSettingUpdateURL ); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | } |
@@ -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 |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public $aDisallowedQueryKeys = array( |
219 | 219 | 'settings-updated', |
220 | - 'confirmation', // 3.3.0+ |
|
220 | + 'confirmation', // 3.3.0+ |
|
221 | 221 | 'field_errors' // 3.4.1+ |
222 | 222 | ); |
223 | 223 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * Stores the cache lifetime of the transient used for the form options when the user passes an integer to the option key parameter. |
264 | 264 | * @since 3.5.9 |
265 | 265 | */ |
266 | - public $iOptionTransientDuration = 0; |
|
266 | + public $iOptionTransientDuration = 0; |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Constructs the instance of AdminPageFramework_Property_admin_page class object. |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | * @since 2.0.0 |
273 | 273 | * @since 2.1.5 The $oCaller parameter was added. |
274 | 274 | */ |
275 | - public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
275 | + public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
276 | 276 | |
277 | 277 | // 3.7.0+ This must be set before the parent constructor. As the form arguments array uses this value. |
278 | - $this->_sFormRegistrationHook = 'load_after_' . $sClassName; |
|
278 | + $this->_sFormRegistrationHook = 'load_after_'.$sClassName; |
|
279 | 279 | |
280 | 280 | parent::__construct( |
281 | 281 | $oCaller, |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | } |
352 | 352 | // The user want to save options in a transient. |
353 | 353 | if ( in_array( $_sType, array( 'integer' ) ) ) { |
354 | - return 'apf_' . md5( site_url() . '_' . $sClassName . '_' . get_current_user_id() ); |
|
354 | + return 'apf_'.md5( site_url().'_'.$sClassName.'_'.get_current_user_id() ); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | // Unknown type - maybe the user is trying to do something advanced. |
@@ -377,10 +377,10 @@ discard block |
||
377 | 377 | * @internal |
378 | 378 | */ |
379 | 379 | protected function _isAdminPage() { |
380 | - if ( ! is_admin() ) { |
|
380 | + if ( !is_admin() ) { |
|
381 | 381 | return false; |
382 | 382 | } |
383 | - return isset( $_GET[ 'page' ] ); // sanitization unnecessary |
|
383 | + return isset( $_GET[ 'page' ] ); // sanitization unnecessary |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | case 'transient': |
417 | 417 | return $this->getAsArray( |
418 | 418 | $this->getTransient( |
419 | - $this->sOptionKey, // transient key |
|
419 | + $this->sOptionKey, // transient key |
|
420 | 420 | array() // default |
421 | 421 | ) |
422 | 422 | ); |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @since 3.1.1 Made it return a value. |
431 | 431 | * @return boolean True if saved; otherwise, false. |
432 | 432 | */ |
433 | - public function updateOption( $aOptions=null ) { |
|
433 | + public function updateOption( $aOptions = null ) { |
|
434 | 434 | |
435 | 435 | if ( $this->_bDisableSavingOptions ) { |
436 | 436 | return false; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | ); |
459 | 459 | case 'transient': |
460 | 460 | return $this->setTransient( |
461 | - $this->sOptionKey, // transient key |
|
461 | + $this->sOptionKey, // transient key |
|
462 | 462 | $aOptions, |
463 | 463 | $this->iOptionTransientDuration |
464 | 464 | ); |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | * @since 2.1.0 Set the default value to the parameter and if the parameter value is empty, it applies the current `$_GET[ 'page' ]` value. |
474 | 474 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
475 | 475 | */ |
476 | - public function isPageAdded( $sPageSlug='' ) { |
|
476 | + public function isPageAdded( $sPageSlug = '' ) { |
|
477 | 477 | |
478 | 478 | $sPageSlug = trim( $sPageSlug ); |
479 | 479 | $sPageSlug = $sPageSlug |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @return string The found tab slug. An empty string if not found. |
507 | 507 | * @remark Do not return `null` when not found as some framework methods check the returned value with `isset()` and if null is given, `isset()` yields `false` while it does `true` for an empty string (''). |
508 | 508 | */ |
509 | - public function getCurrentTabSlug( $sCurrentPageSlug='' ) { |
|
509 | + public function getCurrentTabSlug( $sCurrentPageSlug = '' ) { |
|
510 | 510 | |
511 | 511 | // It is possible that the tab slug is not set if it is the default tab. |
512 | 512 | $_sTabSlug = $this->getElement( $this->aQuery, 'tab', '' ); |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @deprecated 3.5.3 |
528 | 528 | */ |
529 | - public function getCurrentTab( $sCurrentPageSlug='' ) { |
|
529 | + public function getCurrentTab( $sCurrentPageSlug = '' ) { |
|
530 | 530 | return $this->getCurrentTabSlug( $sCurrentPageSlug ); |
531 | 531 | } |
532 | 532 | |
@@ -541,11 +541,11 @@ discard block |
||
541 | 541 | */ |
542 | 542 | public function getDefaultInPageTab( $sPageSlug ) { |
543 | 543 | |
544 | - if ( ! $sPageSlug ) { |
|
544 | + if ( !$sPageSlug ) { |
|
545 | 545 | return ''; |
546 | 546 | } |
547 | 547 | return $this->getElement( |
548 | - $this->aDefaultInPageTabs, // subject array |
|
548 | + $this->aDefaultInPageTabs, // subject array |
|
549 | 549 | $sPageSlug, // key |
550 | 550 | '' // default |
551 | 551 | ); |