@@ -277,7 +277,7 @@ |
||
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
280 | - /** |
|
280 | + /** |
|
281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
282 | 282 | * |
283 | 283 | * @since 3.5.6 |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | public function _replyToSetUpValidationHooks( $oScreen ) { |
47 | 47 | |
48 | 48 | // Validation hooks |
49 | - foreach( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
49 | + foreach ( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
50 | 50 | |
51 | 51 | if ( is_scalar( $_asTabArrayOrPageSlug ) ) { |
52 | 52 | $_sPageSlug = $_asTabArrayOrPageSlug; |
53 | - add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
53 | + add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
54 | 54 | add_filter( "validation_{$_sPageSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
55 | 55 | add_filter( "options_update_status_{$_sPageSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
56 | 56 | continue; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // At this point, the array key is the page slug. It means the user specified the tab(s). |
60 | 60 | $_sPageSlug = $_sIndexOrPageSlug; |
61 | 61 | $_aTabs = $_asTabArrayOrPageSlug; |
62 | - foreach( $_aTabs as $_sTabSlug ) { |
|
62 | + foreach ( $_aTabs as $_sTabSlug ) { |
|
63 | 63 | add_filter( "validation_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
64 | 64 | add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
65 | 65 | add_filter( "options_update_status_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | * @callback action add_meta_boxes |
81 | 81 | */ |
82 | - public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
|
83 | - foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
84 | - if ( is_string( $_asPage ) ) { |
|
82 | + public function _replyToRegisterMetaBoxes( $sPageHook = '' ) { |
|
83 | + foreach ( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
84 | + if ( is_string( $_asPage ) ) { |
|
85 | 85 | $this->_registerMetaBox( $_asPage ); |
86 | 86 | continue; |
87 | 87 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @return void |
98 | 98 | */ |
99 | 99 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
100 | - foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
101 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
100 | + foreach ( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
101 | + if ( !$this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | $this->_registerMetaBox( $sPageSlug ); |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function _registerMetaBox( $sPageSlug ) { |
117 | 117 | add_meta_box( |
118 | - $this->oProp->sMetaBoxID, // id |
|
119 | - $this->oProp->sTitle, // title |
|
118 | + $this->oProp->sMetaBoxID, // id |
|
119 | + $this->oProp->sTitle, // title |
|
120 | 120 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
121 | 121 | $this->oProp->_getScreenIDOfPage( $sPageSlug ), // screen ID |
122 | - $this->oProp->sContext, // context |
|
123 | - $this->oProp->sPriority, // priority |
|
122 | + $this->oProp->sContext, // context |
|
123 | + $this->oProp->sPriority, // priority |
|
124 | 124 | null // argument (deprecated) |
125 | 125 | ); |
126 | 126 | } |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | |
169 | 169 | $_aNewMetaBoxInputs = $this->oForm->getSubmittedData( $_POST ); |
170 | 170 | $_aOldMetaBoxInputs = $this->oUtil->castArrayContents( |
171 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
171 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
172 | 172 | $aOldPageOptions // data source |
173 | 173 | ); |
174 | 174 | |
175 | 175 | // Apply filters - third party scripts will have access to the input. |
176 | 176 | $_aNewMetaBoxInputsRaw = $_aNewMetaBoxInputs; // copy one for validation errors. |
177 | 177 | $_aNewMetaBoxInputs = call_user_func_array( |
178 | - array( $this, 'validate' ), // triggers __call() |
|
178 | + array( $this, 'validate' ), // triggers __call() |
|
179 | 179 | array( $_aNewMetaBoxInputs, $_aOldMetaBoxInputs, $this, $aSubmitInfo ) |
180 | 180 | ); // 3.5.3+ |
181 | - $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
181 | + $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
182 | 182 | $this, |
183 | 183 | "validation_{$this->oProp->sClassName}", |
184 | 184 | $_aNewMetaBoxInputs, |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function _replyToModifyOptionsUpdateStatus( $aStatus ) { |
215 | 215 | |
216 | - if ( ! $this->hasFieldError() ) { |
|
216 | + if ( !$this->hasFieldError() ) { |
|
217 | 217 | return $aStatus; |
218 | 218 | } |
219 | 219 | |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | public function _replyToGetSavedFormData() { |
238 | 238 | $_aPageOptions = $this->oUtil->addAndApplyFilter( |
239 | 239 | $this, // the caller factory object |
240 | - 'options_' . $this->oProp->sClassName, |
|
240 | + 'options_'.$this->oProp->sClassName, |
|
241 | 241 | $this->oProp->oAdminPage->oProp->aOptions |
242 | 242 | ); |
243 | 243 | |
244 | 244 | return $this->oUtil->castArrayContents( |
245 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
245 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
246 | 246 | $_aPageOptions // data source |
247 | 247 | ); |
248 | 248 | } |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | private function _getPageMetaBoxOptionsFromPageOptions( array $aPageOptions, array $aFieldsets ) { |
259 | 259 | |
260 | 260 | $_aOptions = array(); |
261 | - foreach( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
262 | - if ( '_default' === $_sSectionID ) { |
|
263 | - foreach( $_aFieldsets as $_aField ) { |
|
261 | + foreach ( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
262 | + if ( '_default' === $_sSectionID ) { |
|
263 | + foreach ( $_aFieldsets as $_aField ) { |
|
264 | 264 | if ( array_key_exists( $_aField[ 'field_id' ], $aPageOptions ) ) { |
265 | 265 | $_aOptions[ $_aField[ 'field_id' ] ] = $aPageOptions[ $_aField[ 'field_id' ] ]; |
266 | 266 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | */ |
82 | 82 | public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
83 | 83 | foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
84 | - if ( is_string( $_asPage ) ) { |
|
84 | + if ( is_string( $_asPage ) ) { |
|
85 | 85 | $this->_registerMetaBox( $_asPage ); |
86 | 86 | continue; |
87 | 87 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function construct() { |
31 | 31 | |
32 | 32 | add_filter( |
33 | - 'options_' . $this->aArguments[ 'caller_id' ], |
|
33 | + 'options_'.$this->aArguments[ 'caller_id' ], |
|
34 | 34 | array( $this, '_replyToSanitizeSavedFormData' ), |
35 | 35 | 5 // high priority as it must be done eariler |
36 | 36 | ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | // Extract the meta box field form data (options) from the page form data (options). |
56 | 56 | return $this->castArrayContents( |
57 | - $this->getDataStructureFromAddedFieldsets(), // form data structure generate from fieldsets |
|
57 | + $this->getDataStructureFromAddedFieldsets(), // form data structure generate from fieldsets |
|
58 | 58 | $aSavedFormData |
59 | 59 | ); |
60 | 60 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | '' // default value |
38 | 38 | ); |
39 | 39 | |
40 | - if ( ! $this->canUserView( $this->sCapability ) ) { |
|
40 | + if ( !$this->canUserView( $this->sCapability ) ) { |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function _replyToSaveFieldValues( $iUserID ) { |
65 | 65 | |
66 | - if ( ! current_user_can( 'edit_user', $iUserID ) ) { |
|
66 | + if ( !current_user_can( 'edit_user', $iUserID ) ) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Extract the fields data from $_POST |
71 | 71 | // Retrieve the submitted data. |
72 | - $_aInputs = $this->oForm->getSubmittedData( |
|
73 | - $_POST, // subject data to be parsed |
|
74 | - true, // extract data with the fieldset structure |
|
72 | + $_aInputs = $this->oForm->getSubmittedData( |
|
73 | + $_POST, // subject data to be parsed |
|
74 | + true, // extract data with the fieldset structure |
|
75 | 75 | false // strip slashes |
76 | 76 | ); |
77 | - $_aInputsRaw = $_aInputs; // store one for the last input array. |
|
77 | + $_aInputsRaw = $_aInputs; // store one for the last input array. |
|
78 | 78 | |
79 | 79 | // Prepare the saved data. For a new post, the id is set to 0. |
80 | - $_aSavedMeta = $this->oUtil->getSavedUserMetaArray( $iUserID, array_keys( $_aInputs ) ); |
|
80 | + $_aSavedMeta = $this->oUtil->getSavedUserMetaArray( $iUserID, array_keys( $_aInputs ) ); |
|
81 | 81 | |
82 | 82 | // Apply filters to the array of the submitted values. |
83 | 83 | $_aInputs = $this->oUtil->addAndApplyFilters( |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $this->oForm->updateMetaDataByType( |
100 | - $iUserID, // object id |
|
101 | - $_aInputs, // user submit form data |
|
100 | + $iUserID, // object id |
|
101 | + $_aInputs, // user submit form data |
|
102 | 102 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
103 | 103 | $this->oForm->sStructureType // fields type |
104 | 104 | ); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function get() { |
46 | 46 | |
47 | - if ( ! $this->iUserID ) { |
|
47 | + if ( !$this->iUserID ) { |
|
48 | 48 | return array(); |
49 | 49 | } |
50 | 50 | return $this->_getSavedDataFromFieldsets( |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | |
64 | 64 | $_aMetaKeys = array_keys( get_user_meta( $iUserID ) ); |
65 | 65 | $_aMetaData = array(); |
66 | - foreach( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
66 | + foreach ( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
67 | 67 | |
68 | - if ( '_default' == $_sSectionID ) { |
|
69 | - foreach( $_aFieldsets as $_aFieldset ) { |
|
70 | - if ( ! in_array( $_aFieldset[ 'field_id' ], $_aMetaKeys ) ) { |
|
68 | + if ( '_default' == $_sSectionID ) { |
|
69 | + foreach ( $_aFieldsets as $_aFieldset ) { |
|
70 | + if ( !in_array( $_aFieldset[ 'field_id' ], $_aMetaKeys ) ) { |
|
71 | 71 | continue; |
72 | 72 | } |
73 | 73 | $_aMetaData[ $_aFieldset[ 'field_id' ] ] = get_user_meta( |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ); |
78 | 78 | } |
79 | 79 | } |
80 | - if ( ! in_array( $_sSectionID, $_aMetaKeys ) ) { |
|
80 | + if ( !in_array( $_sSectionID, $_aMetaKeys ) ) { |
|
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | $_aMetaData[ $_sSectionID ] = get_user_meta( |
@@ -44,22 +44,22 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | - * The method for necessary set-ups. |
|
48 | - * |
|
49 | - * <h4>Example</h4> |
|
50 | - * <code> |
|
51 | - * public function setUp() { |
|
52 | - * $this->setArguments( |
|
53 | - * array( |
|
54 | - * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
55 | - * ) |
|
56 | - * ); |
|
57 | - * } |
|
58 | - * </code> |
|
59 | - * |
|
60 | - * @abstract |
|
61 | - * @since 3.2.0 |
|
62 | - */ |
|
47 | + * The method for necessary set-ups. |
|
48 | + * |
|
49 | + * <h4>Example</h4> |
|
50 | + * <code> |
|
51 | + * public function setUp() { |
|
52 | + * $this->setArguments( |
|
53 | + * array( |
|
54 | + * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
55 | + * ) |
|
56 | + * ); |
|
57 | + * } |
|
58 | + * </code> |
|
59 | + * |
|
60 | + * @abstract |
|
61 | + * @since 3.2.0 |
|
62 | + */ |
|
63 | 63 | public function setUp() {} |
64 | 64 | |
65 | 65 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @since 3.2.0 |
127 | 127 | * @internal Temporarily marked internal |
128 | 128 | */ |
129 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
129 | + public function enqueueStyles( $aSRCs, $aCustomArgs = array() ) { |
|
130 | 130 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
131 | 131 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
132 | 132 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @since 3.2.0 |
140 | 140 | * @internal Temporarily marked internal |
141 | 141 | */ |
142 | - public function enqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
142 | + public function enqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
143 | 143 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
144 | 144 | return $this->oResource->_enqueueStyle( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
145 | 145 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @since 3.2.0 |
153 | 153 | * @internal Temporarily marked internal |
154 | 154 | */ |
155 | - public function enqueueScripts( $aSRCs, $aCustomArgs=array() ) { |
|
155 | + public function enqueueScripts( $aSRCs, $aCustomArgs = array() ) { |
|
156 | 156 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
157 | 157 | return $this->oResource->_enqueueScripts( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
158 | 158 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @since 3.2.0 |
166 | 166 | * @internal Temporarily marked internal |
167 | 167 | */ |
168 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
168 | + public function enqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
169 | 169 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
170 | 170 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
171 | 171 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @since 3.2.0 |
180 | 180 | * @return void |
181 | 181 | */ |
182 | - protected function setArguments( array $aArguments=array() ) { |
|
182 | + protected function setArguments( array $aArguments = array() ) { |
|
183 | 183 | $this->oProp->aWidgetArguments = $aArguments; |
184 | 184 | } |
185 | 185 |
@@ -24,12 +24,12 @@ |
||
24 | 24 | */ |
25 | 25 | public function content( $sContent ) { |
26 | 26 | |
27 | - $_aReplacements = array( |
|
27 | + $_aReplacements = array( |
|
28 | 28 | '%PLUGIN_DIR_URL%' => AdminPageFrameworkLoader_Registry::getPluginURL(), |
29 | 29 | '%WP_ADMIN_URL%' => admin_url(), |
30 | 30 | ); |
31 | 31 | $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser( |
32 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/about.txt', |
|
32 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/text/about.txt', |
|
33 | 33 | $_aReplacements |
34 | 34 | ); |
35 | 35 | return '' |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | public function replyToDoTab( $oFactory ) { |
36 | 36 | |
37 | - echo "<h3>" . __( 'Saved Options', 'admin-page-framework-loader' ) . "</h3>"; |
|
37 | + echo "<h3>".__( 'Saved Options', 'admin-page-framework-loader' )."</h3>"; |
|
38 | 38 | $oFactory->oDebug->dump( $oFactory->oProp->aOptions ); |
39 | 39 | |
40 | 40 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $oAdminPage, |
27 | 27 | $this->sPageSlug, |
28 | 28 | array( |
29 | - 'section_id' => $this->sTabSlug, // avoid hyphen(dash), dots, and white spaces |
|
29 | + 'section_id' => $this->sTabSlug, // avoid hyphen(dash), dots, and white spaces |
|
30 | 30 | 'tab_slug' => $this->sTabSlug, |
31 | 31 | 'title' => __( 'Download Framework', 'admin-page-framework-loader' ), |
32 | 32 | 'description' => array( |