@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( $oFactory ) { |
30 | 30 | |
31 | - $this->oFactory = $oFactory; |
|
31 | + $this->oFactory = $oFactory; |
|
32 | 32 | |
33 | 33 | // Form emails. |
34 | - if ( ! isset( $_GET[ 'apf_action' ], $_GET[ 'transient' ] ) ) { |
|
34 | + if ( !isset( $_GET[ 'apf_action' ], $_GET[ 'transient' ] ) ) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | - if ( 'email' !== $_GET['apf_action'] ) { |
|
37 | + if ( 'email' !== $_GET[ 'apf_action' ] ) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | self::$_bDoneEmail = true; |
74 | 74 | |
75 | 75 | $_sTransient = $this->getElement( $_GET, 'transient', '' ); |
76 | - if ( ! $_sTransient ) { |
|
76 | + if ( !$_sTransient ) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 | $_aFormEmail = $this->getTransient( $_sTransient ); |
80 | 80 | $this->deleteTransient( $_sTransient ); |
81 | - if ( ! is_array( $_aFormEmail ) ) { |
|
81 | + if ( !is_array( $_aFormEmail ) ) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 |
@@ -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 DEVVER |
@@ -52,18 +52,18 @@ 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 | - $_sTransient = 'apf_rurl' . md5( |
|
61 | - trim( "redirect_{$this->oFactory->oProp->sClassName}_{$_GET['page']}" ) |
|
60 | + $_sTransient = 'apf_rurl'.md5( |
|
61 | + trim( "redirect_{$this->oFactory->oProp->sClassName}_{$_GET[ 'page' ]}" ) |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Check the settings error transient. |
65 | 65 | $_aError = $this->oFactory->_getFieldErrors( $_GET[ 'page' ], false ); |
66 | - if ( ! empty( $_aError ) ) { |
|
66 | + if ( !empty( $_aError ) ) { |
|
67 | 67 | $this->deleteTransient( $_sTransient ); // we don't need it any more. |
68 | 68 | return; |
69 | 69 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | private function _shouldProceed() { |
91 | 91 | |
92 | 92 | // Check if it's one of the plugin's added page. If not, do nothing. |
93 | - if ( ! $this->oFactory->_isInThePage() ) { |
|
93 | + if ( !$this->oFactory->_isInThePage() ) { |
|
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'settings-updated', |
104 | 104 | false |
105 | 105 | ); |
106 | - if ( ! $_bsSettingsUpdatedFlag ) { |
|
106 | + if ( !$_bsSettingsUpdatedFlag ) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 |
@@ -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 | add_action( |
34 | 34 | "load_after_{$this->oFactory->oProp->sClassName}", |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function _replyToRegisterSettings() { |
62 | 62 | |
63 | - if ( ! $this->oFactory->_isInThePage() ) { |
|
63 | + if ( !$this->oFactory->_isInThePage() ) { |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | "sections_{$this->oFactory->oProp->sClassName}", |
71 | 71 | $this->oFactory->oForm->aSections |
72 | 72 | ); |
73 | - foreach( $this->oFactory->oForm->aFields as $_sSectionID => &$_aFields ) { |
|
73 | + foreach ( $this->oFactory->oForm->aFields as $_sSectionID => &$_aFields ) { |
|
74 | 74 | $_aFields = $this->addAndApplyFilter( // Parameters: $oCallerObject, $aFilters, $vInput, $vArgs... |
75 | 75 | $this->oFactory, |
76 | 76 | "fields_{$this->oFactory->oProp->sClassName}_{$_sSectionID}", |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $this->oFactory->loadFieldTypeDefinitions(); |
112 | 112 | |
113 | 113 | /* 4. Set up the contextual help pane for sections. */ |
114 | - foreach( $this->oFactory->oForm->aConditionedSections as $_aSection ) { |
|
114 | + foreach ( $this->oFactory->oForm->aConditionedSections as $_aSection ) { |
|
115 | 115 | |
116 | 116 | if ( empty( $_aSection[ 'help' ] ) ) { |
117 | 117 | continue; |
@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | public function _replyToRegisterSettings() { |
62 | 62 | |
63 | - if ( ! $this->oFactory->_isInThePage() ) { |
|
63 | + if ( ! $this->oFactory->_isInThePage() ) { |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct( $oFactory ) { |
31 | 31 | |
32 | - $this->oFactory = $oFactory; |
|
32 | + $this->oFactory = $oFactory; |
|
33 | 33 | |
34 | 34 | // add_action |
35 | 35 | add_action( |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function _replyToProcessFormData() { |
72 | 72 | |
73 | - if ( ! $this->_shouldProceed() ) { |
|
73 | + if ( !$this->_shouldProceed() ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | new AdminPageFramework_Model_FormSubmission_Validator( $this->oFactory ); |
121 | 121 | |
122 | 122 | // [3.6.3+] Apply filters. All sub-routines of handling form submit data use this filter hook. |
123 | - $_aInputs = $this->addAndApplyFilters( |
|
123 | + $_aInputs = $this->addAndApplyFilters( |
|
124 | 124 | $this->oFactory, |
125 | 125 | "validation_pre_{$this->oFactory->oProp->sClassName}", |
126 | 126 | $_aInputs, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | // Save the data. |
133 | 133 | $_bUpdated = false; |
134 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
134 | + if ( !$this->oFactory->oProp->_bDisableSavingOptions ) { |
|
135 | 135 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
136 | 136 | } |
137 | 137 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | private function _shouldProceed() { |
173 | 173 | |
174 | 174 | if ( |
175 | - ! isset( |
|
175 | + !isset( |
|
176 | 176 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
177 | 177 | $_POST[ '_wp_http_referer' ] |
178 | 178 | ) |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | // Check if all the form fields are sent. |
191 | 191 | if ( |
192 | - ! isset( |
|
192 | + !isset( |
|
193 | 193 | // these keys are supposed to be embedded at the end of the form. |
194 | 194 | // if the server truncates the form input values for `max_input_vars`, these will be lost in PHP 5.3.9 or above. |
195 | 195 | $_POST[ '_is_admin_page_framework' ], // holds the form nonce |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
212 | - $_sNonceTransientKey = 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ); |
|
212 | + $_sNonceTransientKey = 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ); |
|
213 | 213 | if ( $_POST[ '_is_admin_page_framework' ] !== $this->getTransient( $_sNonceTransientKey ) ) { |
214 | 214 | $this->oFactory->setAdminNotice( $this->oFactory->oMsg->get( 'nonce_verification_failed' ) ); |
215 | 215 | return false; |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | */ |
228 | 228 | private function _getUserInputsFromPOST() { |
229 | 229 | |
230 | - $_aInputs = $this->getElementAsArray( |
|
230 | + $_aInputs = $this->getElementAsArray( |
|
231 | 231 | $_POST, |
232 | 232 | $this->oFactory->oProp->sOptionKey, |
233 | 233 | array() |
234 | 234 | ); |
235 | - $_aInputs = stripslashes_deep( $_aInputs ); |
|
235 | + $_aInputs = stripslashes_deep( $_aInputs ); |
|
236 | 236 | return $this->oFactory->getSortedInputs( $_aInputs ); // 3.6.0+ |
237 | 237 | |
238 | 238 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | // Warnings for deprecated hooks. |
251 | 251 | if ( has_action( "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}" ) ) { |
252 | 252 | trigger_error( |
253 | - 'Admin Page Framework: ' . ' : ' |
|
253 | + 'Admin Page Framework: '.' : ' |
|
254 | 254 | . sprintf( |
255 | 255 | __( 'The hook <code>%1$s</code>is deprecated. Use <code>%2$s</code> instead.', $this->oFactory->oProp->sTextDomain ), |
256 | 256 | "submit_{instantiated class name}_{pressed input id}", |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $this->oFactory, |
264 | 264 | array( |
265 | 265 | // @todo deprecate the hook with the input ID |
266 | - "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
266 | + "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
267 | 267 | $_sSubmitSectionID |
268 | 268 | ? "submit_{$this->oFactory->oProp->sClassName}_{$_sSubmitSectionID}_{$_sPressedFieldID}" |
269 | 269 | : "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedFieldID}", |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | |
347 | 347 | // Drop the 'field_errors' key. |
348 | 348 | $_aRemoveQueries = array(); |
349 | - if ( ! isset( $aStatus[ 'field_errors' ] ) || ! $aStatus[ 'field_errors' ] ) { |
|
349 | + if ( !isset( $aStatus[ 'field_errors' ] ) || !$aStatus[ 'field_errors' ] ) { |
|
350 | 350 | unset( $aStatus[ 'field_errors' ] ); |
351 | - $_aRemoveQueries[] = 'field_errors'; |
|
351 | + $_aRemoveQueries[ ] = 'field_errors'; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return $this->addAndApplyFilters( // 3.4.4+ |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | private function _removePageElements( $aOptions, $sPageSlug, $sTabSlug ) { |
375 | 375 | |
376 | - if ( ! $sPageSlug && ! $sTabSlug ) { |
|
376 | + if ( !$sPageSlug && !$sTabSlug ) { |
|
377 | 377 | return $aOptions; |
378 | 378 | } |
379 | 379 |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | // Save the data. |
140 | 140 | $_bUpdated = false; |
141 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
141 | + if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
142 | 142 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
143 | 143 | } |
144 | 144 | |
@@ -181,14 +181,15 @@ discard block |
||
181 | 181 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
182 | 182 | $_POST[ '_wp_http_referer' ] |
183 | 183 | ) |
184 | - ) { |
|
184 | + ) { |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | |
188 | 188 | // Referrer |
189 | 189 | $_sRequestURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), wp_unslash( $_SERVER[ 'REQUEST_URI' ] ) ); |
190 | 190 | $_sReffererURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), $_POST[ '_wp_http_referer' ] ); |
191 | - if ( $_sRequestURI != $_sReffererURI ) { // see the function definition of wp_referer_field() in functions.php. |
|
191 | + if ( $_sRequestURI != $_sReffererURI ) { |
|
192 | +// see the function definition of wp_referer_field() in functions.php. |
|
192 | 193 | return false; |
193 | 194 | } |
194 | 195 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->oFactory = $oFactory; |
31 | 31 | |
32 | 32 | add_filter( |
33 | - "validation_pre_" . $this->oFactory->oProp->sClassName, |
|
33 | + "validation_pre_".$this->oFactory->oProp->sClassName, |
|
34 | 34 | array( $this, '_replyToValiateUserFormInputs' ), |
35 | 35 | 10, |
36 | 36 | 4 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $_sSubmitSectionID = $this->_getPressedSubmitButtonData( $_aSubmits, 'section_id' ); |
62 | 62 | |
63 | 63 | // Submit Information - [3.5.0+] this will be passed to validation callback methods. |
64 | - $_aSubmitsInformation = array( |
|
64 | + $_aSubmitsInformation = array( |
|
65 | 65 | 'page_slug' => $_sPageSlug, |
66 | 66 | 'tab_slug' => $_sTabSlug, |
67 | 67 | 'input_id' => $this->_getPressedSubmitButtonData( $_aSubmits, 'input_id' ), |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'AdminPageFramework_Model__FormSubmission__Validator__ContactFormConfirm', |
86 | 86 | |
87 | 87 | ); |
88 | - foreach( $_aClassNames as $_sClassName ) { |
|
88 | + foreach ( $_aClassNames as $_sClassName ) { |
|
89 | 89 | new $_sClassName( $this->oFactory ); |
90 | 90 | } |
91 | 91 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $this->addAndDoActions( |
96 | 96 | $this->oFactory, |
97 | - 'try_validation_before_' . $this->oFactory->oProp->sClassName, |
|
97 | + 'try_validation_before_'.$this->oFactory->oProp->sClassName, |
|
98 | 98 | $aInputs, |
99 | 99 | $aRawInputs, |
100 | 100 | $_aSubmits, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->addAndDoActions( |
115 | 115 | $this->oFactory, |
116 | - 'try_validation_after_' . $this->oFactory->oProp->sClassName, |
|
116 | + 'try_validation_after_'.$this->oFactory->oProp->sClassName, |
|
117 | 117 | $aInputs, |
118 | 118 | $aRawInputs, |
119 | 119 | $_aSubmits, |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides methods to handle importing options. |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | : 'add_filter'; |
37 | 37 | |
38 | 38 | $_sFunctionName( |
39 | - $this->sActionHookPrefix . $this->oFactory->oProp->sClassName, |
|
39 | + $this->sActionHookPrefix.$this->oFactory->oProp->sClassName, |
|
40 | 40 | array( $this, $this->sCallbackName ), |
41 | 41 | $this->iHookPriority, |
42 | 42 | $this->iCallbackParameters |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
57 | 57 | * @return array The intact stored options. |
58 | 58 | */ |
59 | - protected function _confirmSubmitButtonAction( $sPressedInputName, $sSectionID, $sType='reset' ) { |
|
59 | + protected function _confirmSubmitButtonAction( $sPressedInputName, $sSectionID, $sType = 'reset' ) { |
|
60 | 60 | |
61 | - switch( $sType ) { |
|
61 | + switch ( $sType ) { |
|
62 | 62 | default: |
63 | 63 | case 'reset': |
64 | 64 | $_sFieldErrorMessage = $this->oFactory->oMsg->get( 'reset_options' ); |
65 | - $_sTransientKey = 'apf_rc_' . md5( $sPressedInputName . get_current_user_id() ); |
|
65 | + $_sTransientKey = 'apf_rc_'.md5( $sPressedInputName.get_current_user_id() ); |
|
66 | 66 | break; |
67 | 67 | case 'email': |
68 | 68 | $_sFieldErrorMessage = $this->oFactory->oMsg->get( 'send_email' ); |
69 | - $_sTransientKey = 'apf_ec_' . md5( $sPressedInputName . get_current_user_id() ); |
|
69 | + $_sTransientKey = 'apf_ec_'.md5( $sPressedInputName.get_current_user_id() ); |
|
70 | 70 | break; |
71 | 71 | } |
72 | 72 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->oFactory->setFieldErrors( $_aErrors ); |
89 | 89 | |
90 | 90 | // Set a flag that the confirmation is displayed |
91 | - $this->setTransient( $_sTransientKey, $sPressedInputName, 60*2 ); |
|
91 | + $this->setTransient( $_sTransientKey, $sPressedInputName, 60 * 2 ); |
|
92 | 92 | |
93 | 93 | // Set the admin notice |
94 | 94 | $this->oFactory->setSettingNotice( $this->oFactory->oMsg->get( 'confirm_perform_task' ), 'error confirmation' ); |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
35 | 35 | |
36 | 36 | // Check whether sending an email has been confirmed by the user or not. |
37 | - $_bConfirmedToSendEmail = ( bool ) $this->_getPressedSubmitButtonData( |
|
37 | + $_bConfirmedToSendEmail = ( bool ) $this->_getPressedSubmitButtonData( |
|
38 | 38 | $aSubmits, |
39 | 39 | 'confirmed_sending_email' |
40 | 40 | ); |
41 | - if ( ! $_bConfirmedToSendEmail ) { |
|
41 | + if ( !$_bConfirmedToSendEmail ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | $this->getElement( $aSubmitInformation, 'section_id' ) |
50 | 50 | ); |
51 | 51 | $this->oFactory->oProp->_bDisableSavingOptions = true; |
52 | - $this->deleteTransient( 'apf_tfd' . md5( 'temporary_form_data_' . $this->oFactory->oProp->sClassName . get_current_user_id() ) ); |
|
52 | + $this->deleteTransient( 'apf_tfd'.md5( 'temporary_form_data_'.$this->oFactory->oProp->sClassName.get_current_user_id() ) ); |
|
53 | 53 | |
54 | 54 | // Schedule to remove the confirmation url query key. |
55 | 55 | add_action( "setting_update_url_{$this->oFactory->oProp->sClassName}", array( $this, '_replyToRemoveConfirmationQueryKey' ) ); |
56 | 56 | |
57 | 57 | // Go to the catch clause. |
58 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
58 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
59 | 59 | $_oException->aReturn = $aInputs; |
60 | 60 | throw $_oException; |
61 | 61 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | private function _sendEmailInBackground( $aInputs, $sPressedInputNameFlat, $sSubmitSectionID ) { |
75 | 75 | |
76 | - $_sTranskentKey = 'apf_em_' . md5( $sPressedInputNameFlat . get_current_user_id() ); |
|
76 | + $_sTranskentKey = 'apf_em_'.md5( $sPressedInputNameFlat.get_current_user_id() ); |
|
77 | 77 | $_aEmailOptions = $this->getTransient( $_sTranskentKey ); |
78 | 78 | $this->deleteTransient( $_sTranskentKey ); |
79 | 79 | |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | 'name' => '', |
89 | 89 | ); |
90 | 90 | |
91 | - $_sTransientKey = 'apf_emd_' . md5( $sPressedInputNameFlat . get_current_user_id() ); |
|
91 | + $_sTransientKey = 'apf_emd_'.md5( $sPressedInputNameFlat.get_current_user_id() ); |
|
92 | 92 | $_aFormEmailData = array( |
93 | 93 | 'email_options' => $_aEmailOptions, |
94 | 94 | 'input' => $aInputs, |
95 | 95 | 'section_id' => $sSubmitSectionID, |
96 | 96 | ); |
97 | - $_bIsSet = $this->setTransient( $_sTransientKey, $_aFormEmailData, 100 ); |
|
97 | + $_bIsSet = $this->setTransient( $_sTransientKey, $_aFormEmailData, 100 ); |
|
98 | 98 | |
99 | 99 | // Send the email in the background. |
100 | 100 | wp_remote_get( |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ); |
113 | 113 | |
114 | 114 | // @remark Not possible to tell whether it is sent or not at the moment because it is performed in the background. |
115 | - $_bSent = $_bIsSet; |
|
115 | + $_bSent = $_bIsSet; |
|
116 | 116 | $this->oFactory->setSettingNotice( |
117 | 117 | $this->oFactory->oMsg->get( |
118 | 118 | $this->getAOrB( |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @return string |
135 | 135 | */ |
136 | 136 | public function _replyToRemoveConfirmationQueryKey( $sSettingUpdateURL ) { |
137 | - return remove_query_arg( array( 'confirmation', ), $sSettingUpdateURL ); |
|
137 | + return remove_query_arg( array( 'confirmation',), $sSettingUpdateURL ); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } |
141 | 141 | \ No newline at end of file |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | if ( $this->oFactory->hasFieldError() ) { |
37 | 37 | return; |
38 | 38 | } |
39 | - $_bConfirmingToSendEmail = ( bool ) $this->_getPressedSubmitButtonData( |
|
39 | + $_bConfirmingToSendEmail = ( bool ) $this->_getPressedSubmitButtonData( |
|
40 | 40 | $aSubmits, |
41 | 41 | 'confirming_sending_email' |
42 | 42 | ); |
43 | - if ( ! $_bConfirmingToSendEmail ) { |
|
43 | + if ( !$_bConfirmingToSendEmail ) { |
|
44 | 44 | return; |
45 | 45 | } |
46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ); |
54 | 54 | |
55 | 55 | // Go to the catch clause. |
56 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
56 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
57 | 57 | $_oException->aReturn = $this->_confirmSubmitButtonAction( |
58 | 58 | $this->getElement( $aSubmitInformation, 'input_name' ), |
59 | 59 | $this->getElement( $aSubmitInformation, 'section_id' ), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->oFactory |
90 | 90 | ), |
91 | 91 | 'aStoredTabDataWODynamicElements' => array(), |
92 | - 'aEmbeddedDataWODynamicElements' => array(), // stores page meta box field options. This will be updated inside the validation methods. |
|
92 | + 'aEmbeddedDataWODynamicElements' => array(), // stores page meta box field options. This will be updated inside the validation methods. |
|
93 | 93 | 'aSubmitInformation' => $aSubmitInformation, // 3.5.0+ |
94 | 94 | ); |
95 | 95 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | call_user_func_array( |
105 | 105 | array( $this->oFactory, 'validate' ), // triggers __call() |
106 | 106 | array( $_aData[ 'aInput' ], $_aData[ 'aStoredData' ], $this->oFactory, $_aData[ 'aSubmitInformation' ] ) |
107 | - ), // 3.5.3+ |
|
107 | + ), // 3.5.3+ |
|
108 | 108 | $_aData[ 'aStoredData' ], |
109 | 109 | $_aData[ 'aSubmitInformation' ] // 3.5.0+ |
110 | 110 | ); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // If everything fine, return the filtered input data. |
117 | 117 | $this->_bHasFieldErrors = $this->oFactory->hasFieldError(); |
118 | - if ( ! $this->_bHasFieldErrors ) { |
|
118 | + if ( !$this->_bHasFieldErrors ) { |
|
119 | 119 | return $_aInput; |
120 | 120 | } |
121 | 121 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | ); |
130 | 130 | |
131 | 131 | // Go to the catch clause. |
132 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
132 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
133 | 133 | $_oException->aReturn = $_aInput; |
134 | 134 | throw $_oException; |
135 | 135 | |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | */ |
153 | 153 | private function _getInputByUnset( array $aInputs ) { |
154 | 154 | |
155 | - $_sUnsetKey = '__unset_' . $this->oFactory->oProp->sFieldsType; |
|
156 | - if ( ! isset( $_POST[ $_sUnsetKey ] ) ) { |
|
155 | + $_sUnsetKey = '__unset_'.$this->oFactory->oProp->sFieldsType; |
|
156 | + if ( !isset( $_POST[ $_sUnsetKey ] ) ) { |
|
157 | 157 | return $aInputs; |
158 | 158 | } |
159 | 159 | |
160 | 160 | $_aUnsetElements = array_unique( $_POST[ $_sUnsetKey ] ); |
161 | - foreach( $_aUnsetElements as $_sFlatInputName ) { |
|
161 | + foreach ( $_aUnsetElements as $_sFlatInputName ) { |
|
162 | 162 | $_aDimensionalKeys = explode( '|', $_sFlatInputName ); |
163 | 163 | |
164 | 164 | // The first element is the option key; the section or field dimensional keys follow. |
@@ -181,22 +181,22 @@ discard block |
||
181 | 181 | */ |
182 | 182 | private function _validateEachField( array $aData, array $aInputsToParse ) { |
183 | 183 | |
184 | - foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
184 | + foreach ( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
185 | 185 | |
186 | 186 | // For each section |
187 | 187 | if ( $this->oFactory->oForm->isSection( $_sID ) ) { |
188 | 188 | |
189 | 189 | // If the parsing item does not belong to the current page, do not call the validation callback method. |
190 | - if ( ! $this->_isValidSection( $_sID, $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
190 | + if ( !$this->_isValidSection( $_sID, $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
191 | 191 | continue; |
192 | 192 | } |
193 | 193 | |
194 | 194 | // Call the validation callback method. |
195 | - foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
195 | + foreach ( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
196 | 196 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ] = $this->_getValidatedData( |
197 | 197 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}_{$_sFieldID}", |
198 | 198 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ], |
199 | - $this->getElement( $aData, array( 'aStoredData', $_sID, $_sFieldID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] ) ? $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] : null, |
|
199 | + $this->getElement( $aData, array( 'aStoredData', $_sID, $_sFieldID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] ) ? $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] : null, |
|
200 | 200 | $aData[ 'aSubmitInformation' ] // 3.5.0+ |
201 | 201 | ); |
202 | 202 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $aData[ 'aInput' ][ $_sID ] = $this->_getValidatedData( |
218 | 218 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}", |
219 | 219 | $_aSectionInput, |
220 | - $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
220 | + $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
221 | 221 | $aData[ 'aSubmitInformation' ] |
222 | 222 | ); |
223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | // Check if the parsing item (the default section) belongs to the current page; if not, do not call the validation callback method. |
229 | - if ( ! $this->_isValidSection( '_default', $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
229 | + if ( !$this->_isValidSection( '_default', $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
230 | 230 | continue; |
231 | 231 | } |
232 | 232 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $aData[ 'aInput' ][ $_sID ] = $this->_getValidatedData( |
235 | 235 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}", |
236 | 236 | $aData[ 'aInput' ][ $_sID ], |
237 | - $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
237 | + $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
238 | 238 | $aData[ 'aSubmitInformation' ] |
239 | 239 | ); |
240 | 240 | |
@@ -276,22 +276,22 @@ discard block |
||
276 | 276 | */ |
277 | 277 | private function _validateTabFields( array $aData ) { |
278 | 278 | |
279 | - if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
279 | + if ( !$aData[ 'sTabSlug' ] || !$aData[ 'sPageSlug' ] ) { |
|
280 | 280 | return $aData; |
281 | 281 | } |
282 | 282 | |
283 | - $aData[ 'aStoredTabData' ] = $this->oFactory->oForm->getTabOptions( |
|
283 | + $aData[ 'aStoredTabData' ] = $this->oFactory->oForm->getTabOptions( |
|
284 | 284 | $aData[ 'aStoredData' ], |
285 | 285 | $aData[ 'sPageSlug' ], |
286 | 286 | $aData[ 'sTabSlug' ] |
287 | 287 | ); // respects page meta box fields |
288 | - $aData[ 'aStoredTabData' ] = $this->addAndApplyFilter( |
|
288 | + $aData[ 'aStoredTabData' ] = $this->addAndApplyFilter( |
|
289 | 289 | $this->oFactory, |
290 | 290 | "validation_saved_options_{$aData[ 'sPageSlug' ]}_{$aData[ 'sTabSlug' ]}", |
291 | 291 | $aData[ 'aStoredTabData' ], |
292 | 292 | $this->oFactory |
293 | 293 | ); |
294 | - $_aOtherTabOptions = $this->oFactory->oForm->getOtherTabOptions( $aData[ 'aStoredData' ], $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ); |
|
294 | + $_aOtherTabOptions = $this->oFactory->oForm->getOtherTabOptions( $aData[ 'aStoredData' ], $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ); |
|
295 | 295 | |
296 | 296 | // This options data contain embedded options. |
297 | 297 | $aData[ 'aStoredTabDataWODynamicElements' ] = $this->oFactory->oForm->getTabOptions( $aData[ 'aStoredDataWODynamicElements' ], $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | private function _validatePageFields( array $aData ) { |
339 | 339 | |
340 | - if ( ! $aData[ 'sPageSlug' ] ) { |
|
340 | + if ( !$aData[ 'sPageSlug' ] ) { |
|
341 | 341 | return $aData[ 'aInput' ]; |
342 | 342 | } |
343 | 343 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $_aPageOptionsWODynamicElements = $this->addAndApplyFilter( |
350 | 350 | $this->oFactory, |
351 | 351 | "validation_saved_options_without_dynamic_elements_{$aData[ 'sPageSlug' ]}", |
352 | - $this->oFactory->oForm->getPageOptions( $aData[ 'aStoredDataWODynamicElements' ], $aData[ 'sPageSlug' ] ), // united with the in-page tab specific data in order to override the page-specific dynamic elements. |
|
352 | + $this->oFactory->oForm->getPageOptions( $aData[ 'aStoredDataWODynamicElements' ], $aData[ 'sPageSlug' ] ), // united with the in-page tab specific data in order to override the page-specific dynamic elements. |
|
353 | 353 | $this->oFactory |
354 | 354 | ); |
355 | 355 | |
@@ -362,15 +362,15 @@ discard block |
||
362 | 362 | // Validate the input data. |
363 | 363 | $aData[ 'aInput' ] = $this->_getValidatedData( |
364 | 364 | "validation_{$aData[ 'sPageSlug' ]}", |
365 | - $aData[ 'aInput' ], // new values |
|
366 | - $_aPageOptions, // stored page options |
|
365 | + $aData[ 'aInput' ], // new values |
|
366 | + $_aPageOptions, // stored page options |
|
367 | 367 | $aData[ 'aSubmitInformation' ] // submit information 3.5.0+ |
368 | 368 | ); |
369 | 369 | |
370 | 370 | // If it's in a tab-page, drop the elements which belong to the tab so that arrayed-options will not be merged such as multiple select options. |
371 | - $_aPageOptions = $aData[ 'sTabSlug' ] && ! empty( $aData[ 'aStoredTabData' ] ) |
|
371 | + $_aPageOptions = $aData[ 'sTabSlug' ] && !empty( $aData[ 'aStoredTabData' ] ) |
|
372 | 372 | ? $this->invertCastArrayContents( $_aPageOptions, $aData[ 'aStoredTabData' ] ) |
373 | - : ( ! $aData[ 'sTabSlug' ] // if the tab is not specified, do not merge the input array with the page options as the input array already includes the page options. This is for dynamic elements(repeatable sections). |
|
373 | + : ( !$aData[ 'sTabSlug' ] // if the tab is not specified, do not merge the input array with the page options as the input array already includes the page options. This is for dynamic elements(repeatable sections). |
|
374 | 374 | ? array() |
375 | 375 | : $_aPageOptions |
376 | 376 | ); |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | * @param array $aStoredData The stored option. |
426 | 426 | * @param array $aSubmitInfo [3.5.0+] The form submit information such as the field ID of the pressed submit field. |
427 | 427 | */ |
428 | - private function _getValidatedData( $sFilterName, $aInputs, $aStoredData, $aSubmitInfo=array() ) { |
|
428 | + private function _getValidatedData( $sFilterName, $aInputs, $aStoredData, $aSubmitInfo = array() ) { |
|
429 | 429 | return $this->addAndApplyFilter( |
430 | - $this->oFactory, // caller |
|
431 | - $sFilterName, // hook name |
|
432 | - $aInputs, // 1st argument |
|
433 | - $aStoredData, // 2nd argument |
|
434 | - $this->oFactory, // 3rd argument |
|
430 | + $this->oFactory, // caller |
|
431 | + $sFilterName, // hook name |
|
432 | + $aInputs, // 1st argument |
|
433 | + $aStoredData, // 2nd argument |
|
434 | + $this->oFactory, // 3rd argument |
|
435 | 435 | $aSubmitInfo // 4th argument 3.5.0+ |
436 | 436 | ); |
437 | 437 | } |
@@ -181,7 +181,8 @@ discard block |
||
181 | 181 | */ |
182 | 182 | private function _validateEachField( array $aData, array $aInputsToParse ) { |
183 | 183 | |
184 | - foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
184 | + foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { |
|
185 | +// $_sID is either a section id or a field id |
|
185 | 186 | |
186 | 187 | // For each section |
187 | 188 | if ( $this->oFactory->oForm->isSection( $_sID ) ) { |
@@ -192,7 +193,8 @@ discard block |
||
192 | 193 | } |
193 | 194 | |
194 | 195 | // Call the validation callback method. |
195 | - foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
196 | + foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { |
|
197 | +// For fields |
|
196 | 198 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ] = $this->_getValidatedData( |
197 | 199 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}_{$_sFieldID}", |
198 | 200 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ], |
@@ -276,7 +278,7 @@ discard block |
||
276 | 278 | */ |
277 | 279 | private function _validateTabFields( array $aData ) { |
278 | 280 | |
279 | - if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
281 | + if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
280 | 282 | return $aData; |
281 | 283 | } |
282 | 284 | |
@@ -337,7 +339,7 @@ discard block |
||
337 | 339 | */ |
338 | 340 | private function _validatePageFields( array $aData ) { |
339 | 341 | |
340 | - if ( ! $aData[ 'sPageSlug' ] ) { |
|
342 | + if ( ! $aData[ 'sPageSlug' ] ) { |
|
341 | 343 | return $aData[ 'aInput' ]; |
342 | 344 | } |
343 | 345 |