@@ -25,6 +25,7 @@ |
||
25 | 25 | /** |
26 | 26 | * Sets up properties. |
27 | 27 | * @since 3.6.3 |
28 | + * @param AdminPageFramework_Model_Form $oFactory |
|
28 | 29 | */ |
29 | 30 | public function __construct( $oFactory ) { |
30 | 31 |
@@ -28,10 +28,10 @@ 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 | 37 | if ( 'email' !== $_GET[ 'apf_action' ] ) { |
@@ -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 |
@@ -26,6 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Sets up hooks and properties. |
28 | 28 | * @since 3.6.3 |
29 | + * @param AdminPageFramework_Model_Form $oFactory |
|
29 | 30 | */ |
30 | 31 | public function __construct( $oFactory, $aSavedData, $aArguments, $aSectionsets, $aFieldsets ) { |
31 | 32 | |
@@ -250,6 +251,9 @@ discard block |
||
250 | 251 | * Do the 'submit_...' actions. |
251 | 252 | * |
252 | 253 | * @internal |
254 | + * @param null|string $_sSubmitSectionID |
|
255 | + * @param null|string $_sPressedFieldID |
|
256 | + * @param null|string $_sPressedInputID |
|
253 | 257 | * @return void |
254 | 258 | * @since 3.5.3 |
255 | 259 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
@@ -296,6 +300,8 @@ discard block |
||
296 | 300 | * Do the 'submit_after_...' actions. |
297 | 301 | * |
298 | 302 | * @internal |
303 | + * @param null|string $_sSubmitSectionID |
|
304 | + * @param null|string $_sPressedFieldID |
|
299 | 305 | * @return void |
300 | 306 | * @since 3.5.3 |
301 | 307 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct( $oFactory, $aSavedData, $aArguments, $aSectionsets, $aFieldsets ) { |
31 | 31 | |
32 | - $this->oFactory = $oFactory; |
|
32 | + $this->oFactory = $oFactory; |
|
33 | 33 | |
34 | 34 | // add_action |
35 | 35 | // @deprecated DEVVER |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function _handleFormData() { |
74 | 74 | |
75 | - if ( ! $this->_shouldProceed() ) { |
|
75 | + if ( !$this->_shouldProceed() ) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | new AdminPageFramework_Model__FormSubmission__Validator( $this->oFactory ); |
128 | 128 | |
129 | 129 | // [3.6.3+] Apply filters. All the sub-routines of handling form submit data use this filter hook. |
130 | - $_aInputs = $this->addAndApplyFilters( |
|
130 | + $_aInputs = $this->addAndApplyFilters( |
|
131 | 131 | $this->oFactory, |
132 | 132 | "validation_pre_{$this->oFactory->oProp->sClassName}", |
133 | 133 | $_aInputs, |
@@ -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 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | private function _shouldProceed() { |
178 | 178 | |
179 | 179 | if ( |
180 | - ! isset( |
|
180 | + !isset( |
|
181 | 181 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
182 | 182 | $_POST[ '_wp_http_referer' ] |
183 | 183 | ) |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | // Check if all the form fields are sent. |
196 | 196 | if ( |
197 | - ! isset( |
|
197 | + !isset( |
|
198 | 198 | // these keys are supposed to be embedded at the end of the form. |
199 | 199 | // if the server truncates the form input values for `max_input_vars`, these will be lost in PHP 5.3.9 or above. |
200 | 200 | $_POST[ '_is_admin_page_framework' ], // holds the form nonce |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | |
217 | - $_sNonceTransientKey = 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ); |
|
217 | + $_sNonceTransientKey = 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ); |
|
218 | 218 | if ( $_POST[ '_is_admin_page_framework' ] !== $this->getTransient( $_sNonceTransientKey ) ) { |
219 | 219 | $this->oFactory->setAdminNotice( $this->oFactory->oMsg->get( 'nonce_verification_failed' ) ); |
220 | 220 | return false; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | private function _getUserInputsFromPOST() { |
234 | 234 | |
235 | - $_aInputs = $this->getElementAsArray( |
|
235 | + $_aInputs = $this->getElementAsArray( |
|
236 | 236 | $_POST, |
237 | 237 | $this->oFactory->oProp->sOptionKey, |
238 | 238 | array() |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // Warnings for deprecated hooks. |
260 | 260 | if ( has_action( "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}" ) ) { |
261 | 261 | trigger_error( |
262 | - 'Admin Page Framework: ' . ' : ' |
|
262 | + 'Admin Page Framework: '.' : ' |
|
263 | 263 | . sprintf( |
264 | 264 | __( 'The hook <code>%1$s</code>is deprecated. Use <code>%2$s</code> instead.', $this->oFactory->oProp->sTextDomain ), |
265 | 265 | "submit_{instantiated class name}_{pressed input id}", |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $this->oFactory, |
273 | 273 | array( |
274 | 274 | // @todo deprecate the hook with the input ID |
275 | - "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
275 | + "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
276 | 276 | $_sSubmitSectionID |
277 | 277 | ? "submit_{$this->oFactory->oProp->sClassName}_{$_sSubmitSectionID}_{$_sPressedFieldID}" |
278 | 278 | : "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedFieldID}", |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | |
356 | 356 | // Drop the 'field_errors' key. |
357 | 357 | $_aRemoveQueries = array(); |
358 | - if ( ! isset( $aStatus[ 'field_errors' ] ) || ! $aStatus[ 'field_errors' ] ) { |
|
358 | + if ( !isset( $aStatus[ 'field_errors' ] ) || !$aStatus[ 'field_errors' ] ) { |
|
359 | 359 | unset( $aStatus[ 'field_errors' ] ); |
360 | - $_aRemoveQueries[] = 'field_errors'; |
|
360 | + $_aRemoveQueries[ ] = 'field_errors'; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | return $this->addAndApplyFilters( // 3.4.4+ |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | private function _removePageElements( $aOptions, $sPageSlug, $sTabSlug ) { |
384 | 384 | |
385 | - if ( ! $sPageSlug && ! $sTabSlug ) { |
|
385 | + if ( !$sPageSlug && !$sTabSlug ) { |
|
386 | 386 | return $aOptions; |
387 | 387 | } |
388 | 388 |
@@ -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 |
@@ -79,6 +79,7 @@ |
||
79 | 79 | * @since 3.5.3 |
80 | 80 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Validation_Option`. |
81 | 81 | * @internal |
82 | + * @param boolean $bIsInputEmtpy |
|
82 | 83 | * @return void |
83 | 84 | * @remark Accessed from some of the parent/child classes. |
84 | 85 | */ |
@@ -46,12 +46,12 @@ |
||
46 | 46 | * @return null|string Returns `null` if no value is found and the associated link url if found. |
47 | 47 | * Otherwise, the found value. |
48 | 48 | */ |
49 | - protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey='field_id' ) { |
|
49 | + protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey = 'field_id' ) { |
|
50 | 50 | |
51 | - foreach( $aPostElements as $_sInputID => $_aSubElements ) { |
|
51 | + foreach ( $aPostElements as $_sInputID => $_aSubElements ) { |
|
52 | 52 | |
53 | 53 | // The 'name' key must be set. |
54 | - if ( ! isset( $_aSubElements[ 'name' ] ) ) { |
|
54 | + if ( !isset( $_aSubElements[ 'name' ] ) ) { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | $_aNameKeys = explode( '|', $_aSubElements[ 'name' ] ); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return null|string Returns `null` if no value is found and the associated link url if found. |
47 | 47 | * Otherwise, the found value. |
48 | 48 | */ |
49 | - protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey='field_id' ) { |
|
49 | + protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey='field_id' ) { |
|
50 | 50 | |
51 | 51 | foreach( $aPostElements as $_sInputID => $_aSubElements ) { |
52 | 52 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function _setSettingNoticeAfterValidation( $bIsInputEmtpy ) { |
86 | 86 | |
87 | - if ( $this->oFactory->hasSettingNotice() ) { |
|
87 | + if ( $this->oFactory->hasSettingNotice() ) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | $this->oFactory->setSettingNotice( |
@@ -92,6 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 3.5.4 |
94 | 94 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
95 | + * @param string $sFileName |
|
95 | 96 | * @return array |
96 | 97 | */ |
97 | 98 | private function _getExportHeaderArray( array $aArguments, $sFileName, $mData ) { |
@@ -132,6 +133,7 @@ discard block |
||
132 | 133 | * @since 3.5.3 |
133 | 134 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
134 | 135 | * @internal |
136 | + * @param string $mData |
|
135 | 137 | * @return string The export file name. |
136 | 138 | */ |
137 | 139 | private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
@@ -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. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
35 | 35 | |
36 | - if ( ! $this->_shouldProceed() ) { |
|
36 | + if ( !$this->_shouldProceed() ) { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | $this->_exportOptions( |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function _exportOptions( $mData, $sPageSlug, $sTabSlug ) { |
67 | 67 | |
68 | - $_oExport = new AdminPageFramework_ExportOptions( |
|
68 | + $_oExport = new AdminPageFramework_ExportOptions( |
|
69 | 69 | $_POST[ '__export' ], |
70 | 70 | $this->oFactory->oProp->sClassName |
71 | 71 | ); |
72 | - $_aArguments = array( |
|
72 | + $_aArguments = array( |
|
73 | 73 | 'class_name' => $this->oFactory->oProp->sClassName, |
74 | 74 | 'page_slug' => $sPageSlug, |
75 | 75 | 'tab_slug' => $sTabSlug, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $sExportFileName, |
142 | 142 | $aArguments[ 'pressed_field_id' ], |
143 | 143 | $aArguments[ 'pressed_input_id' ], |
144 | - $mData, // 3.4.6+ |
|
144 | + $mData, // 3.4.6+ |
|
145 | 145 | $this->oFactory // 3.4.6+ |
146 | 146 | ); |
147 | 147 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @internal |
121 | 121 | * @return string the filtered export data. |
122 | 122 | */ |
123 | - private function _getFilteredExportingData( array $aArguments, $mData ) { |
|
123 | + private function _getFilteredExportingData( array $aArguments, $mData ) { |
|
124 | 124 | return $this->_getFilteredItemForPortByPrefix( |
125 | 125 | 'export_', |
126 | 126 | $mData, |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @internal |
135 | 135 | * @return string The export file name. |
136 | 136 | */ |
137 | - private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
|
137 | + private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
|
138 | 138 | return $this->addAndApplyFilters( |
139 | 139 | $this->oFactory, |
140 | 140 | $this->_getPortFilterHookNames( 'export_name_', $aArguments ), |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @internal |
153 | 153 | * @return string The export format type. |
154 | 154 | */ |
155 | - private function _getExportFormatType( array $aArguments, $sExportFileFormat ) { |
|
155 | + private function _getExportFormatType( array $aArguments, $sExportFileFormat ) { |
|
156 | 156 | return $this->_getFilteredItemForPortByPrefix( |
157 | 157 | 'export_format_', |
158 | 158 | $sExportFileFormat, |
@@ -143,6 +143,7 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * Sets update admin notice. |
145 | 145 | * @since 3.5.3 |
146 | + * @param boolean $bEmpty |
|
146 | 147 | * @return void |
147 | 148 | */ |
148 | 149 | private function _setImportAdminNotice( $bEmpty ) { |
@@ -204,6 +205,8 @@ discard block |
||
204 | 205 | * @since 3.5.3 |
205 | 206 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Import`. |
206 | 207 | * @internal |
208 | + * @param string $sFormatType |
|
209 | + * @param string $sImportOptionKey |
|
207 | 210 | * @return string The filtered import data. |
208 | 211 | */ |
209 | 212 | private function _getFilteredImportData( array $aArguments, $mData, $aStoredOptions, $sFormatType, $sImportOptionKey ) { |
@@ -232,6 +235,7 @@ discard block |
||
232 | 235 | * @param string The filter prefix. |
233 | 236 | * @param mixed The subject filtering value. |
234 | 237 | * @param array An argument array holding submit information. Part of this will be passed to the filter callbacks but this itself does not mean is for the filter callbacks. |
238 | + * @param string $sPrefix |
|
235 | 239 | */ |
236 | 240 | protected function _getFilteredItemForPortByPrefix( $sPrefix, $mFilteringValue, array $aArguments ) { |
237 | 241 | return $this->addAndApplyFilters( |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @callback action try_validation_after_{class name} |
33 | 33 | */ |
34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
35 | - if ( ! $this->_shouldProceed() ) { |
|
35 | + if ( !$this->_shouldProceed() ) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | $this->_doImportOptions( |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | // Check the uploaded file MIME type. |
103 | 103 | $_aMIMEType = $this->_getImportMIMEType( $_aArguments ); |
104 | 104 | $_sType = $_oImport->getType(); |
105 | - if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
105 | + if ( !in_array( $_sType, $_aMIMEType ) ) { |
|
106 | 106 | $this->oFactory->setSettingNotice( sprintf( $this->oFactory->oMsg->get( 'uploaded_file_type_not_supported' ), $_sType ) ); |
107 | - return $aStoredOptions; // do not change the framework's options. |
|
107 | + return $aStoredOptions; // do not change the framework's options. |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | // Retrieve the importing data. |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | protected function _getPortFilterHookNames( $sPrefix, array $aArguments ) { |
255 | 255 | |
256 | 256 | return array( |
257 | - $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_input_id' ], |
|
257 | + $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_input_id' ], |
|
258 | 258 | $aArguments[ 'section_id' ] |
259 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] .'_' . $aArguments[ 'pressed_field_id' ] |
|
260 | - : $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_field_id' ], |
|
259 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ].'_'.$aArguments[ 'pressed_field_id' ] |
|
260 | + : $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_field_id' ], |
|
261 | 261 | $aArguments[ 'section_id' ] |
262 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] |
|
262 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ] |
|
263 | 263 | : null, |
264 | 264 | $aArguments[ 'tab_slug' ] |
265 | - ? $sPrefix . $aArguments[ 'page_slug' ] . '_' . $aArguments[ 'tab_slug' ] |
|
265 | + ? $sPrefix.$aArguments[ 'page_slug' ].'_'.$aArguments[ 'tab_slug' ] |
|
266 | 266 | : null, |
267 | - $sPrefix . $aArguments[ 'page_slug' ], |
|
268 | - $sPrefix . $aArguments[ 'class_name' ] |
|
267 | + $sPrefix.$aArguments[ 'page_slug' ], |
|
268 | + $sPrefix.$aArguments[ 'class_name' ] |
|
269 | 269 | ); |
270 | 270 | |
271 | 271 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // Check the uploaded file MIME type. |
103 | 103 | $_aMIMEType = $this->_getImportMIMEType( $_aArguments ); |
104 | 104 | $_sType = $_oImport->getType(); |
105 | - if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
105 | + if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
106 | 106 | $this->oFactory->setSettingNotice( sprintf( $this->oFactory->oMsg->get( 'uploaded_file_type_not_supported' ), $_sType ) ); |
107 | 107 | return $aStoredOptions; // do not change the framework's options. |
108 | 108 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @since 3.5.3 |
164 | 164 | * @return array An array holding processable MIME types. |
165 | 165 | */ |
166 | - private function _getImportMIMEType( array $aArguments ) { |
|
166 | + private function _getImportMIMEType( array $aArguments ) { |
|
167 | 167 | return $this->_getFilteredItemForPortByPrefix( |
168 | 168 | 'import_mime_types_', |
169 | 169 | array( 'text/plain', 'application/octet-stream' ), // .json file is dealt as a binary file. |
@@ -66,6 +66,7 @@ |
||
66 | 66 | * Sets the given URL's transient. |
67 | 67 | * @since unknown |
68 | 68 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
69 | + * @param string $sURL |
|
69 | 70 | */ |
70 | 71 | private function _setRedirectTransients( $sURL, $sPageSlug ) { |
71 | 72 | if ( empty( $sURL ) ) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $aSubmits, |
36 | 36 | 'redirect_url' |
37 | 37 | ); |
38 | - if ( ! $_sRedirectURL ) { |
|
38 | + if ( !$_sRedirectURL ) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | if ( empty( $sURL ) ) { |
72 | 72 | return; |
73 | 73 | } |
74 | - $_sTransient = 'apf_rurl' . md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$sPageSlug}" ) ); |
|
75 | - return $this->setTransient( $_sTransient, $sURL , 60*2 ); |
|
74 | + $_sTransient = 'apf_rurl'.md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$sPageSlug}" ) ); |
|
75 | + return $this->setTransient( $_sTransient, $sURL, 60 * 2 ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | } |
79 | 79 | \ No newline at end of file |
@@ -68,7 +68,7 @@ |
||
68 | 68 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
69 | 69 | */ |
70 | 70 | private function _setRedirectTransients( $sURL, $sPageSlug ) { |
71 | - if ( empty( $sURL ) ) { |
|
71 | + if ( empty( $sURL ) ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | $_sTransient = 'apf_rurl' . md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$sPageSlug}" ) ); |
@@ -60,6 +60,7 @@ |
||
60 | 60 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
61 | 61 | * @remark `$aInputs` has only the page elements that called the validation callback. |
62 | 62 | * In other words, it does not hold other pages' option keys. |
63 | + * @param string $sKeyToReset |
|
63 | 64 | * @return array The modified input array. |
64 | 65 | */ |
65 | 66 | private function _resetOptions( $sKeyToReset, array $aInputs, array $aSubmitInformation ) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'reset_key' |
42 | 42 | ); |
43 | 43 | $_sKeyToReset = trim( $_sKeyToReset ); |
44 | - if ( ! $_sKeyToReset ) { |
|
44 | + if ( !$_sKeyToReset ) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | $_oException = new Exception( 'aReturn' ); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $this->_doResetActions( $sKeyToReset, $aInputs, $aSubmitInformation ); |
69 | 69 | |
70 | 70 | // As of 3.1.0, an empty value is accepted for the option key. |
71 | - if ( ! $this->oFactory->oProp->sOptionKey ) { |
|
71 | + if ( !$this->oFactory->oProp->sOptionKey ) { |
|
72 | 72 | return array(); |
73 | 73 | } |
74 | 74 | |
75 | 75 | // The key to delete is not specified, 1 is sent from the form input. |
76 | - if ( in_array( $sKeyToReset, array( '1', ), true ) ) { |
|
76 | + if ( in_array( $sKeyToReset, array( '1',), true ) ) { |
|
77 | 77 | delete_option( $this->oFactory->oProp->sOptionKey ); |
78 | 78 | return array(); |
79 | 79 | } |
@@ -28,6 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * Sets up properties. |
30 | 30 | * @since 3.6.3 |
31 | + * @param AdminPageFramework_View_Page $oFactory |
|
31 | 32 | */ |
32 | 33 | public function __construct( $oFactory, $sPageSlug, $sTabSlug ) { |
33 | 34 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // Do actions before rendering the page. In this order, global -> page -> in-page tab |
49 | 49 | $this->addAndDoActions( |
50 | - $this->oFactory, // the caller object |
|
50 | + $this->oFactory, // the caller object |
|
51 | 51 | $this->getFilterArrayByPrefix( 'do_before_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
52 | 52 | $this->oFactory // the argument 1 |
53 | 53 | ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | </div><!-- #post-body --> |
73 | 73 | </div><!-- #poststuff --> |
74 | 74 | |
75 | - <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
75 | + <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
76 | 76 | </div><!-- .admin-page-framework-container --> |
77 | 77 | |
78 | 78 | <?php |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <?php |
84 | 84 | // Do actions after rendering the page. |
85 | 85 | $this->addAndDoActions( |
86 | - $this->oFactory, // the caller object |
|
86 | + $this->oFactory, // the caller object |
|
87 | 87 | $this->getFilterArrayByPrefix( 'do_after_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
88 | 88 | $this->oFactory // the argument 1 |
89 | 89 | ); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function _getNumberOfColumns() { |
102 | 102 | |
103 | - if ( ! $this->doesMetaBoxExist( 'side' ) ) { |
|
103 | + if ( !$this->doesMetaBoxExist( 'side' ) ) { |
|
104 | 104 | return 1; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $_iColumns = $this->getNumberOfScreenColumns(); |
108 | 108 | return $_iColumns |
109 | 109 | ? $_iColumns |
110 | - : 1; // default - this is because generic pages do not have meta boxes. |
|
110 | + : 1; // default - this is because generic pages do not have meta boxes. |
|
111 | 111 | } |
112 | 112 | // @deprecated |
113 | 113 | // Make sure if no side meta box exists, set it 1. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | private function _getContentTop() { |
127 | 127 | |
128 | 128 | // Screen icon, page heading tabs(page title), and in-page tabs. |
129 | - $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
129 | + $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
130 | 130 | $this->oFactory, |
131 | 131 | $this->sPageSlug, |
132 | 132 | $this->sTabSlug |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->oFactory, |
143 | 143 | $this->sPageSlug |
144 | 144 | ); |
145 | - $_sContentTop .= $_oInPageTabs->get(); |
|
145 | + $_sContentTop .= $_oInPageTabs->get(); |
|
146 | 146 | |
147 | 147 | // Apply filters in this order, in-page tab -> page -> global. |
148 | 148 | return $this->addAndApplyFilters( |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function _getFormOutput( $sPageSlug ) { |
216 | 216 | |
217 | - if ( ! $this->oFactory->oProp->bEnableForm ) { |
|
217 | + if ( !$this->oFactory->oProp->bEnableForm ) { |
|
218 | 218 | return ''; |
219 | 219 | } |
220 | 220 | return $this->oFactory->oForm->get(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @internal |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - private function _printFormOpeningTag( $fEnableForm=true ) { |
|
247 | + private function _printFormOpeningTag( $fEnableForm = true ) { |
|
248 | 248 | |
249 | - if ( ! $fEnableForm ) { |
|
249 | + if ( !$fEnableForm ) { |
|
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | 'action' => wp_unslash( remove_query_arg( 'settings-updated', $this->oFactory->oProp->sTargetFormPage ) ), |
260 | 260 | ) |
261 | 261 | ) |
262 | - . " >" . PHP_EOL; |
|
262 | + . " >".PHP_EOL; |
|
263 | 263 | |
264 | 264 | // [3.5.11+] Insert a mark that indicates the framework form has started. |
265 | 265 | // This will be checked in the validation method with the `is_admin_page_framework` input value which gets inserted at the end of the form |
266 | 266 | // in order to determine all the fields are sent for the PHP max_input_vars limitation set in the server configuration. |
267 | - echo "<input type='hidden' name='admin_page_framework_start' value='1' />" . PHP_EOL; |
|
267 | + echo "<input type='hidden' name='admin_page_framework_start' value='1' />".PHP_EOL; |
|
268 | 268 | |
269 | 269 | // Embed the '_wp_http_referer' hidden field that is checked in the submit data processing method. |
270 | 270 | settings_fields( $this->oFactory->oProp->sOptionKey ); |
@@ -280,19 +280,19 @@ discard block |
||
280 | 280 | * @internal |
281 | 281 | * @return void |
282 | 282 | */ |
283 | - private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm=true ) { |
|
283 | + private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm = true ) { |
|
284 | 284 | |
285 | - if ( ! $fEnableForm ) { |
|
285 | + if ( !$fEnableForm ) { |
|
286 | 286 | return; |
287 | 287 | } |
288 | 288 | |
289 | - $_sNonceTransientKey = 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ); |
|
290 | - $_sNonce = $this->getTransient( $_sNonceTransientKey, '_admin_page_framework_form_nonce_' . uniqid() ); |
|
291 | - $this->setTransient( $_sNonceTransientKey, $_sNonce, 60*60 ); // 60 minutes |
|
292 | - echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />" . PHP_EOL |
|
293 | - . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />" . PHP_EOL |
|
294 | - . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />" . PHP_EOL |
|
295 | - . "</form><!-- End Form -->" . PHP_EOL; |
|
289 | + $_sNonceTransientKey = 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ); |
|
290 | + $_sNonce = $this->getTransient( $_sNonceTransientKey, '_admin_page_framework_form_nonce_'.uniqid() ); |
|
291 | + $this->setTransient( $_sNonceTransientKey, $_sNonce, 60 * 60 ); // 60 minutes |
|
292 | + echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />".PHP_EOL |
|
293 | + . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />".PHP_EOL |
|
294 | + . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />".PHP_EOL |
|
295 | + . "</form><!-- End Form -->".PHP_EOL; |
|
296 | 296 | |
297 | 297 | } |
298 | 298 |
@@ -244,7 +244,7 @@ |
||
244 | 244 | * @internal |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - private function _printFormOpeningTag( $fEnableForm=true ) { |
|
247 | + private function _printFormOpeningTag( $fEnableForm=true ) { |
|
248 | 248 | |
249 | 249 | if ( ! $fEnableForm ) { |
250 | 250 | return; |
@@ -60,6 +60,7 @@ discard block |
||
60 | 60 | * @since 3.3.1 Moved from `AdminPageFramework_Page`. |
61 | 61 | * @since 3.5.3 Deprecated the `$aOutput` parameter. |
62 | 62 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. Changed the name from `_getPageHeadingTabs()`. |
63 | + * @param string $sTag |
|
63 | 64 | * @return string the output of page heading tabs. |
64 | 65 | */ |
65 | 66 | private function _getOutput( $aPage, $sTag ) { |
@@ -100,6 +101,7 @@ discard block |
||
100 | 101 | * @internal |
101 | 102 | * @since 3.5.3 |
102 | 103 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
104 | + * @param string $sTag |
|
103 | 105 | * @return string the HTML page heading tab navigation bar output. |
104 | 106 | */ |
105 | 107 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
46 | 46 | |
47 | 47 | // If the page title is disabled, return an empty string. |
48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
48 | + if ( !$_aPage[ 'show_page_title' ] ) { |
|
49 | 49 | return ""; |
50 | 50 | } |
51 | 51 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private function _getOutput( $aPage, $sTag ) { |
66 | 66 | |
67 | - $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
67 | + $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
68 | 68 | |
69 | 69 | // If the page heading tab visibility is disabled, or only one page is registered, return the title. |
70 | - if ( ! $aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
70 | + if ( !$aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
71 | 71 | return "<{$sTag}>" |
72 | 72 | . $aPage[ 'title' ] |
73 | 73 | . "</{$sTag}>"; |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
106 | 106 | |
107 | 107 | $_oTabBar = new AdminPageFramework_TabNavigationBar( |
108 | - $aPages, // tab items |
|
108 | + $aPages, // tab items |
|
109 | 109 | $sCurrentPageSlug, // active tab slug |
110 | - $sTag, // container tag |
|
110 | + $sTag, // container tag |
|
111 | 111 | array( // container attributes |
112 | 112 | // 'class' => '...', |
113 | 113 | ), |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * @since 3.5.10 |
131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
132 | 132 | */ |
133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
134 | - switch( $aSubPage['type'] ) { |
|
133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments = array() ) { |
|
134 | + switch ( $aSubPage[ 'type' ] ) { |
|
135 | 135 | case 'link': |
136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |
137 | 137 | default: |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | */ |
149 | 149 | private function _getFormattedPageHeadingtabNavigationBarPageItem( array $aSubPage, $aStructure ) { |
150 | 150 | |
151 | - if ( ! isset( $aSubPage[ 'page_slug' ] ) ) { |
|
151 | + if ( !isset( $aSubPage[ 'page_slug' ] ) ) { |
|
152 | 152 | return array(); |
153 | 153 | } |
154 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
154 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
155 | 155 | return array(); |
156 | 156 | } |
157 | 157 | return array( |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function _getFormattedPageHeadingtabNavigationBarLinkItem( array $aSubPage, $aStructure ) { |
184 | 184 | |
185 | - if ( ! isset( $aSubPage[ 'href' ] ) ) { |
|
185 | + if ( !isset( $aSubPage[ 'href' ] ) ) { |
|
186 | 186 | return array(); |
187 | 187 | } |
188 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
188 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
189 | 189 | return array(); |
190 | 190 | } |
191 | 191 | $aSubPage = array( |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | + array( 'class' => null ) |
198 | 198 | + $aStructure; |
199 | 199 | |
200 | - $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ] . ' link' ); |
|
200 | + $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ].' link' ); |
|
201 | 201 | return $aSubPage; |
202 | 202 | } |
203 | 203 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
46 | 46 | |
47 | 47 | // If the page title is disabled, return an empty string. |
48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
48 | + if ( ! $_aPage[ 'show_page_title' ] ) { |
|
49 | 49 | return ""; |
50 | 50 | } |
51 | 51 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @since 3.5.10 |
131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
132 | 132 | */ |
133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
134 | 134 | switch( $aSubPage['type'] ) { |
135 | 135 | case 'link': |
136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |