@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // since meta boxes cannot detect the current post type if it loaded too early. |
33 | 33 | $this->oProp->aFieldCallbacks = $this->_getFormElementCallbacks(); |
34 | 34 | |
35 | - if ( ! $this->_isInThePage() ) { |
|
35 | + if ( !$this->_isInThePage() ) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | if ( $this->oProp->bIsAdminAjax ) { |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | 'hfTagID' => array( $this, '_replyToGetInputTagIDAttribute' ), // the fields & fieldset & field row container id attribute |
64 | 64 | 'hfName' => array( $this, '_replyToGetFieldNameAttribute' ), // the input name attribute |
65 | 65 | 'hfNameFlat' => array( $this, '_replyToGetFlatFieldName' ), // the flat input name attribute |
66 | - 'hfInputName' => array( $this, '_replyToGetInputNameAttribute' ), // 3.6.0+ the field input name attribute |
|
67 | - 'hfInputNameFlat' => array( $this, '_replyToGetFlatInputName' ), // 3.6.0+ the flat field input name |
|
66 | + 'hfInputName' => array( $this, '_replyToGetInputNameAttribute' ), // 3.6.0+ the field input name attribute |
|
67 | + 'hfInputNameFlat' => array( $this, '_replyToGetFlatInputName' ), // 3.6.0+ the flat field input name |
|
68 | 68 | 'hfClass' => array( $this, '_replyToGetInputClassAttribute' ), // the class attribute |
69 | 69 | 'hfSectionName' => array( $this, '_replyToGetSectionName' ), // 3.6.0+ |
70 | 70 | ) + $this->oProp->aFieldCallbacks; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return string the input id attribute |
78 | 78 | */ |
79 | 79 | public function _replyToGetSectionName( /* $sSectionName, $aSectionset */ ) { |
80 | - $_aParams = func_get_args() + array( null, null, ); |
|
80 | + $_aParams = func_get_args() + array( null, null,); |
|
81 | 81 | return $_aParams[ 0 ]; |
82 | 82 | } |
83 | 83 | |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * @since 3.6.0 |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function _replyToGetFieldNameAttribute( /* $sFieldName, $aFieldset */ ) { |
|
109 | - $_aParams = func_get_args() + array( null, null, ); |
|
108 | + public function _replyToGetFieldNameAttribute( /* $sFieldName, $aFieldset */ ) { |
|
109 | + $_aParams = func_get_args() + array( null, null,); |
|
110 | 110 | return $_aParams[ 0 ]; |
111 | 111 | } |
112 | 112 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return string |
117 | 117 | */ |
118 | 118 | public function _replyToGetFlatFieldName( /* $sFieldName, $aFieldset */ ) { |
119 | - $_aParams = func_get_args() + array( null, null, ); |
|
119 | + $_aParams = func_get_args() + array( null, null,); |
|
120 | 120 | return $_aParams[ 0 ]; |
121 | 121 | } |
122 | 122 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return string the flat input name attribute |
139 | 139 | */ |
140 | 140 | public function _replyToGetFlatInputName( /* $sFlatNameAttribute, $aField, $sKey */ ) { |
141 | - $_aParams = func_get_args() + array( null, null, null ); |
|
141 | + $_aParams = func_get_args() + array( null, null, null ); |
|
142 | 142 | return $_aParams[ 0 ]; |
143 | 143 | } |
144 | 144 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function _replyToPrintSettingNotice() { |
186 | 186 | |
187 | - if ( ! $this->_isInThePage() ) { |
|
187 | + if ( !$this->_isInThePage() ) { |
|
188 | 188 | return; |
189 | 189 | } |
190 | 190 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $this->oUtil->deleteTransient( "apf_notices_{$_iUserID}" ); |
203 | 203 | |
204 | 204 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
205 | - if ( isset( $_GET['settings-notice'] ) && ! $_GET['settings-notice'] ) { |
|
205 | + if ( isset( $_GET[ 'settings-notice' ] ) && !$_GET[ 'settings-notice' ] ) { |
|
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _getSettingNotice( array $aNotice ) { |
240 | 240 | |
241 | - if ( ! isset( $aNotice[ 'aAttributes' ], $aNotice[ 'sMessage' ] ) ) { |
|
241 | + if ( !isset( $aNotice[ 'aAttributes' ], $aNotice[ 'sMessage' ] ) ) { |
|
242 | 242 | return ''; |
243 | 243 | } |
244 | - if ( ! $aNotice[ 'sMessage' ] ) { |
|
244 | + if ( !$aNotice[ 'sMessage' ] ) { |
|
245 | 245 | return ''; |
246 | 246 | } |
247 | 247 | $aNotice[ 'aAttributes' ][ 'class' ] = $this->oUtil->getClassAttribute( |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | 'admin-page-framework-settings-notice-container', |
254 | 254 | 'notice is-dismissible' // 3.5.12+ |
255 | 255 | ); |
256 | - return "<div " . $this->oUtil->getAttributes( $aNotice['aAttributes'] ). ">" |
|
256 | + return "<div ".$this->oUtil->getAttributes( $aNotice[ 'aAttributes' ] ).">" |
|
257 | 257 | . "<p class='admin-page-framework-settings-notice-message'>" |
258 | - . $aNotice['sMessage'] |
|
258 | + . $aNotice[ 'sMessage' ] |
|
259 | 259 | . "</p>" |
260 | 260 | . "</div>"; |
261 | 261 | |
@@ -272,18 +272,18 @@ discard block |
||
272 | 272 | public function _replyToGetFieldOutput( $aField ) { |
273 | 273 | |
274 | 274 | $_oField = new AdminPageFramework_FormFieldset( |
275 | - $aField, // the field definition array |
|
275 | + $aField, // the field definition array |
|
276 | 276 | // @todo change it to $this->getSavedOptions() |
277 | - $this->oProp->aOptions, // the stored form data |
|
278 | - $this->_getFieldErrors(), // the field error array. |
|
279 | - $this->oProp->aFieldTypeDefinitions, // the field type definition array. |
|
280 | - $this->oMsg, // the system message object |
|
277 | + $this->oProp->aOptions, // the stored form data |
|
278 | + $this->_getFieldErrors(), // the field error array. |
|
279 | + $this->oProp->aFieldTypeDefinitions, // the field type definition array. |
|
280 | + $this->oMsg, // the system message object |
|
281 | 281 | $this->oProp->aFieldCallbacks // field output element callables. |
282 | 282 | ); |
283 | 283 | |
284 | 284 | $_sOutput = $this->oUtil->addAndApplyFilters( |
285 | 285 | $this, |
286 | - array( 'field_' . $this->oProp->sClassName . '_' . $aField['field_id'] ), // field_ + {extended class name} + _ {field id} |
|
286 | + array( 'field_'.$this->oProp->sClassName.'_'.$aField[ 'field_id' ] ), // field_ + {extended class name} + _ {field id} |
|
287 | 287 | $_oField->get(), // field output |
288 | 288 | $aField // the field array |
289 | 289 | ); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @since 3.6.0 |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function _replyToGetFieldNameAttribute( /* $sFieldName, $aFieldset */ ) { |
|
108 | + public function _replyToGetFieldNameAttribute( /* $sFieldName, $aFieldset */ ) { |
|
109 | 109 | $_aParams = func_get_args() + array( null, null, ); |
110 | 110 | return $_aParams[ 0 ]; |
111 | 111 | } |
@@ -184,25 +184,25 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function _replyToPrintSettingNotice() { |
186 | 186 | |
187 | - if ( ! $this->_isInThePage() ) { |
|
187 | + if ( ! $this->_isInThePage() ) { |
|
188 | 188 | return; |
189 | 189 | } |
190 | 190 | |
191 | 191 | // Ensure this method is called only once per a page load. |
192 | - if ( self::$_bSettingNoticeLoaded ) { |
|
192 | + if ( self::$_bSettingNoticeLoaded ) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | self::$_bSettingNoticeLoaded = true; |
196 | 196 | |
197 | 197 | $_iUserID = get_current_user_id(); |
198 | 198 | $_aNotices = $this->oUtil->getTransient( "apf_notices_{$_iUserID}" ); |
199 | - if ( false === $_aNotices ) { |
|
199 | + if ( false === $_aNotices ) { |
|
200 | 200 | return; |
201 | 201 | } |
202 | 202 | $this->oUtil->deleteTransient( "apf_notices_{$_iUserID}" ); |
203 | 203 | |
204 | 204 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
205 | - if ( isset( $_GET['settings-notice'] ) && ! $_GET['settings-notice'] ) { |
|
205 | + if ( isset( $_GET['settings-notice'] ) && ! $_GET['settings-notice'] ) { |
|
206 | 206 | return; |
207 | 207 | } |
208 | 208 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @since 2.1.0 |
61 | 61 | * @internal |
62 | 62 | */ |
63 | - protected function _setHelpTab( $sID, $sTitle, $aContents, $aSideBarContents=array() ) { |
|
63 | + protected function _setHelpTab( $sID, $sTitle, $aContents, $aSideBarContents = array() ) { |
|
64 | 64 | |
65 | 65 | if ( empty( $aContents ) ) { |
66 | 66 | return; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
80 | - if ( ! empty( $aSideBarContents ) ) { |
|
80 | + if ( !empty( $aSideBarContents ) ) { |
|
81 | 81 | $this->_oScreen->set_help_sidebar( implode( PHP_EOL, $aSideBarContents ) ); |
82 | 82 | } |
83 | 83 | |
@@ -89,6 +89,6 @@ discard block |
||
89 | 89 | * @internal |
90 | 90 | */ |
91 | 91 | protected function _formatHelpDescription( $sHelpDescription ) { |
92 | - return "<div class='contextual-help-description'>" . $sHelpDescription . "</div>"; |
|
92 | + return "<div class='contextual-help-description'>".$sHelpDescription."</div>"; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | \ No newline at end of file |
@@ -62,7 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | protected function _setHelpTab( $sID, $sTitle, $aContents, $aSideBarContents=array() ) { |
64 | 64 | |
65 | - if ( empty( $aContents ) ) { |
|
65 | + if ( empty( $aContents ) ) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 |
@@ -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 for creating fields in the taxonomy page (edit-tags.php). |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Sets up hooks and properties. |
24 | 24 | */ |
25 | - public function __construct( $oProp, $oMsg=null ) { |
|
25 | + public function __construct( $oProp, $oMsg = null ) { |
|
26 | 26 | |
27 | - if ( ! $this->_isLoadable( $oProp ) ) { |
|
27 | + if ( !$this->_isLoadable( $oProp ) ) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | add_action( 'in_admin_footer', array( $this, '_replyToSetFooterInfo' ) ); |
35 | 35 | |
36 | 36 | // Add an action link in the plugin listing page |
37 | - if ( 'plugins.php' === $this->oProp->sPageNow && 'plugin' === $this->oProp->aScriptInfo['sType'] ) { |
|
37 | + if ( 'plugins.php' === $this->oProp->sPageNow && 'plugin' === $this->oProp->aScriptInfo[ 'sType' ] ) { |
|
38 | 38 | add_filter( |
39 | - 'plugin_action_links_' . plugin_basename( $this->oProp->aScriptInfo['sPath'] ), |
|
39 | + 'plugin_action_links_'.plugin_basename( $this->oProp->aScriptInfo[ 'sPath' ] ), |
|
40 | 40 | array( $this, '_replyToAddSettingsLinkInPluginListingPage' ), |
41 | 41 | 20 // set a lower priority so that the link will be embedded at the beginning ( the most left hand side ). |
42 | 42 | ); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @return boolean |
51 | 51 | */ |
52 | 52 | private function _isLoadable( $oProp ) { |
53 | - if ( ! $oProp->bIsAdmin ) { |
|
53 | + if ( !$oProp->bIsAdmin ) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 | if ( $oProp->bIsAdminAjax ) { |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function _setDefaultFooterText() { |
82 | 82 | |
83 | - $this->oProp->aFooterInfo['sLeft'] = str_replace( |
|
83 | + $this->oProp->aFooterInfo[ 'sLeft' ] = str_replace( |
|
84 | 84 | '__SCRIPT_CREDIT__', |
85 | 85 | $this->_getFooterInfoLeft( $this->oProp->aScriptInfo ), |
86 | - $this->oProp->aFooterInfo['sLeft'] |
|
86 | + $this->oProp->aFooterInfo[ 'sLeft' ] |
|
87 | 87 | ); |
88 | - $this->oProp->aFooterInfo['sRight'] = str_replace( |
|
88 | + $this->oProp->aFooterInfo[ 'sRight' ] = str_replace( |
|
89 | 89 | '__FRAMEWORK_CREDIT__', |
90 | 90 | $this->_getFooterInfoRight( $this->oProp->_getLibraryData() ), |
91 | - $this->oProp->aFooterInfo['sRight'] |
|
91 | + $this->oProp->aFooterInfo[ 'sRight' ] |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | } |
@@ -102,52 +102,52 @@ discard block |
||
102 | 102 | private function _getFooterInfoLeft( $aScriptInfo ) { |
103 | 103 | |
104 | 104 | $_sDescription = $this->getAOrB( |
105 | - empty( $aScriptInfo['sDescription'] ), |
|
105 | + empty( $aScriptInfo[ 'sDescription' ] ), |
|
106 | 106 | '', |
107 | - " {$aScriptInfo['sDescription']}" |
|
107 | + " {$aScriptInfo[ 'sDescription' ]}" |
|
108 | 108 | ); |
109 | 109 | $_sVersion = $this->getAOrB( |
110 | - empty( $aScriptInfo['sVersion'] ), |
|
110 | + empty( $aScriptInfo[ 'sVersion' ] ), |
|
111 | 111 | '', |
112 | - " {$aScriptInfo['sVersion']}" |
|
112 | + " {$aScriptInfo[ 'sVersion' ]}" |
|
113 | 113 | ); |
114 | 114 | $_sPluginInfo = $this->getAOrB( |
115 | - empty( $aScriptInfo['sURI'] ), |
|
116 | - $aScriptInfo['sName'], |
|
115 | + empty( $aScriptInfo[ 'sURI' ] ), |
|
116 | + $aScriptInfo[ 'sName' ], |
|
117 | 117 | $this->getHTMLTag( |
118 | 118 | 'a', |
119 | 119 | array( |
120 | - 'href' => $aScriptInfo['sURI'], |
|
120 | + 'href' => $aScriptInfo[ 'sURI' ], |
|
121 | 121 | 'target' => '_blank', |
122 | - 'title' => $aScriptInfo['sName'] . $_sVersion . $_sDescription |
|
122 | + 'title' => $aScriptInfo[ 'sName' ].$_sVersion.$_sDescription |
|
123 | 123 | ), |
124 | - $aScriptInfo['sName'] |
|
124 | + $aScriptInfo[ 'sName' ] |
|
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | |
128 | 128 | $_sAuthorInfo = $this->getAOrB( |
129 | - empty( $aScriptInfo['sAuthorURI'] ), |
|
129 | + empty( $aScriptInfo[ 'sAuthorURI' ] ), |
|
130 | 130 | '', |
131 | 131 | $this->getHTMLTag( |
132 | 132 | 'a', |
133 | 133 | array( |
134 | - 'href' => $aScriptInfo['sAuthorURI'], |
|
134 | + 'href' => $aScriptInfo[ 'sAuthorURI' ], |
|
135 | 135 | 'target' => '_blank', |
136 | - 'title' => $aScriptInfo['sAuthor'], |
|
136 | + 'title' => $aScriptInfo[ 'sAuthor' ], |
|
137 | 137 | ), |
138 | - $aScriptInfo['sAuthor'] |
|
138 | + $aScriptInfo[ 'sAuthor' ] |
|
139 | 139 | ) |
140 | 140 | ); |
141 | 141 | $_sAuthorInfo = $this->getAOrB( |
142 | - empty( $aScriptInfo['sAuthor'] ), |
|
142 | + empty( $aScriptInfo[ 'sAuthor' ] ), |
|
143 | 143 | $_sAuthorInfo, |
144 | - ' by ' . $_sAuthorInfo |
|
144 | + ' by '.$_sAuthorInfo |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | // Enclosing the output in a span tag as the outer element is a '<p>' tag. So this cannot be div. |
148 | 148 | // 3.5.7+ Added the class attribute for acceptance testing |
149 | 149 | return "<span class='apf-script-info'>" |
150 | - . $_sPluginInfo . $_sAuthorInfo |
|
150 | + . $_sPluginInfo.$_sAuthorInfo |
|
151 | 151 | . "</span>"; |
152 | 152 | |
153 | 153 | } |
@@ -161,32 +161,32 @@ discard block |
||
161 | 161 | private function _getFooterInfoRight( $aScriptInfo ) { |
162 | 162 | |
163 | 163 | $_sDescription = $this->getAOrB( |
164 | - empty( $aScriptInfo['sDescription'] ), |
|
164 | + empty( $aScriptInfo[ 'sDescription' ] ), |
|
165 | 165 | '', |
166 | - " {$aScriptInfo['sDescription']}" |
|
166 | + " {$aScriptInfo[ 'sDescription' ]}" |
|
167 | 167 | ); |
168 | 168 | $_sVersion = $this->getAOrB( |
169 | - empty( $aScriptInfo['sVersion'] ), |
|
169 | + empty( $aScriptInfo[ 'sVersion' ] ), |
|
170 | 170 | '', |
171 | - " {$aScriptInfo['sVersion']}" |
|
171 | + " {$aScriptInfo[ 'sVersion' ]}" |
|
172 | 172 | ); |
173 | 173 | $_sLibraryInfo = $this->getAOrB( |
174 | - empty( $aScriptInfo['sURI'] ), |
|
175 | - $aScriptInfo['sName'], |
|
174 | + empty( $aScriptInfo[ 'sURI' ] ), |
|
175 | + $aScriptInfo[ 'sName' ], |
|
176 | 176 | $this->getHTMLTag( |
177 | 177 | 'a', |
178 | 178 | array( |
179 | - 'href' => $aScriptInfo['sURI'], |
|
179 | + 'href' => $aScriptInfo[ 'sURI' ], |
|
180 | 180 | 'target' => '_blank', |
181 | - 'title' => $aScriptInfo['sName'] . $_sVersion . $_sDescription, |
|
181 | + 'title' => $aScriptInfo[ 'sName' ].$_sVersion.$_sDescription, |
|
182 | 182 | ), |
183 | - $aScriptInfo['sName'] |
|
183 | + $aScriptInfo[ 'sName' ] |
|
184 | 184 | ) |
185 | 185 | ); |
186 | 186 | |
187 | 187 | // Update the variable |
188 | 188 | return "<span class='apf-credit'>" // 3.5.7+ added 'apf-credit' class attribute for acceptance testing |
189 | - . $this->oMsg->get( 'powered_by' ) . ' ' |
|
189 | + . $this->oMsg->get( 'powered_by' ).' ' |
|
190 | 190 | . $_sLibraryInfo |
191 | 191 | . ", " |
192 | 192 | . $this->getHTMLTag( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | array( |
195 | 195 | 'href' => 'https://wordpress.org', |
196 | 196 | 'target' => '_blank', |
197 | - 'title' => 'WordPress' . $GLOBALS['wp_version'] |
|
197 | + 'title' => 'WordPress'.$GLOBALS[ 'wp_version' ] |
|
198 | 198 | ), |
199 | 199 | 'WordPress' |
200 | 200 | ) |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function _setFooterHooks() { |
212 | 212 | |
213 | - add_filter( 'admin_footer_text' , array( $this, '_replyToAddInfoInFooterLeft' ) ); |
|
213 | + add_filter( 'admin_footer_text', array( $this, '_replyToAddInfoInFooterLeft' ) ); |
|
214 | 214 | add_filter( 'update_footer', array( $this, '_replyToAddInfoInFooterRight' ), 11 ); |
215 | 215 | |
216 | 216 | } |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | * @callback filter admin_footer_text |
223 | 223 | * @internal |
224 | 224 | */ |
225 | - public function _replyToAddInfoInFooterLeft( $sLinkHTML='' ) { |
|
225 | + public function _replyToAddInfoInFooterLeft( $sLinkHTML = '' ) { |
|
226 | 226 | |
227 | - $sLinkHTML = empty( $this->oProp->aScriptInfo['sName'] ) |
|
227 | + $sLinkHTML = empty( $this->oProp->aScriptInfo[ 'sName' ] ) |
|
228 | 228 | ? $sLinkHTML |
229 | - : $this->oProp->aFooterInfo['sLeft']; |
|
229 | + : $this->oProp->aFooterInfo[ 'sLeft' ]; |
|
230 | 230 | |
231 | 231 | return $this->addAndApplyFilters( |
232 | 232 | $this->oProp->_getCallerObject(), |
233 | - 'footer_left_' . $this->oProp->sClassName, |
|
233 | + 'footer_left_'.$this->oProp->sClassName, |
|
234 | 234 | $sLinkHTML |
235 | 235 | ); |
236 | 236 | |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | * @callback filter admin_footer_text |
244 | 244 | * @internal |
245 | 245 | */ |
246 | - public function _replyToAddInfoInFooterRight( $sLinkHTML='' ) { |
|
246 | + public function _replyToAddInfoInFooterRight( $sLinkHTML = '' ) { |
|
247 | 247 | return $this->addAndApplyFilters( |
248 | 248 | $this->oProp->_getCallerObject(), |
249 | - 'footer_right_' . $this->oProp->sClassName, |
|
250 | - $this->oProp->aFooterInfo['sRight'] |
|
249 | + 'footer_right_'.$this->oProp->sClassName, |
|
250 | + $this->oProp->aFooterInfo[ 'sRight' ] |
|
251 | 251 | ); |
252 | 252 | } |
253 | 253 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * @return boolean |
51 | 51 | */ |
52 | 52 | private function _isLoadable( $oProp ) { |
53 | - if ( ! $oProp->bIsAdmin ) { |
|
53 | + if ( ! $oProp->bIsAdmin ) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 | if ( $oProp->bIsAdminAjax ) { |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | 'confirm_perform_task' => 'Please confirm your action.', |
83 | 83 | 'specified_option_been_deleted' => 'The specified options have been deleted.', |
84 | 84 | 'nonce_verification_failed' => 'A problem occurred while processing the form data. Please try again.', |
85 | - 'check_max_input_vars' => 'Not all form fields could not be sent. Please check your server settings of PHP <code>max_input_vars</code> and consult the server administrator to increase the value. <code>max input vars</code>: %1$s. <code>$_POST</code> count: %2$s', // 3.5.11+ |
|
86 | - 'send_email' => 'Is it okay to send the email?', // 3.3.0+ |
|
87 | - 'email_sent' => 'The email has been sent.', // 3.3.0+, 3.3.5+ deprecated |
|
85 | + 'check_max_input_vars' => 'Not all form fields could not be sent. Please check your server settings of PHP <code>max_input_vars</code> and consult the server administrator to increase the value. <code>max input vars</code>: %1$s. <code>$_POST</code> count: %2$s', // 3.5.11+ |
|
86 | + 'send_email' => 'Is it okay to send the email?', // 3.3.0+ |
|
87 | + 'email_sent' => 'The email has been sent.', // 3.3.0+, 3.3.5+ deprecated |
|
88 | 88 | 'email_scheduled' => 'The email has been scheduled.', // 3.3.5+ |
89 | - 'email_could_not_send' => 'There was a problem sending the email', // 3.3.0+ |
|
89 | + 'email_could_not_send' => 'There was a problem sending the email', // 3.3.0+ |
|
90 | 90 | |
91 | 91 | // AdminPageFramework_PostType |
92 | 92 | 'title' => 'Title', |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | 'upload_file' => 'Upload File', |
113 | 113 | 'use_this_file' => 'Use This File', |
114 | 114 | 'select_file' => 'Select File', |
115 | - 'remove_value' => 'Remove Value', // 3.2.0+ |
|
116 | - 'select_all' => 'Select All', // 3.3.0+ |
|
117 | - 'select_none' => 'Select None', // 3.3.0+ |
|
115 | + 'remove_value' => 'Remove Value', // 3.2.0+ |
|
116 | + 'select_all' => 'Select All', // 3.3.0+ |
|
117 | + 'select_none' => 'Select None', // 3.3.0+ |
|
118 | 118 | 'no_term_found' => 'No term found.', // 3.3.2+ |
119 | 119 | |
120 | 120 | // AdminPageFramework_Form_View___Script_{...} |
121 | 121 | 'select' => 'Select', // 3.4.2+ |
122 | - 'insert' => 'Insert', // 3.4.2+ |
|
122 | + 'insert' => 'Insert', // 3.4.2+ |
|
123 | 123 | 'use_this' => 'Use This', // 3.4.2+ |
124 | 124 | 'return_to_library' => 'Return to Library', // 3.4.2+ |
125 | 125 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @since 3.2.0 Changed it to create an instance per text domain basis. |
191 | 191 | * @remark This class should be instantiated via this method. |
192 | 192 | */ |
193 | - public static function getInstance( $sTextDomain='admin-page-framework' ) { |
|
193 | + public static function getInstance( $sTextDomain = 'admin-page-framework' ) { |
|
194 | 194 | |
195 | 195 | $_oInstance = isset( self::$_aInstancesByTextDomain[ $sTextDomain ] ) && ( self::$_aInstancesByTextDomain[ $sTextDomain ] instanceof AdminPageFramework_Message ) |
196 | 196 | ? self::$_aInstancesByTextDomain[ $sTextDomain ] |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | * Ensures that only one instance of this class object exists. ( no multiple instances of this object ) |
204 | 204 | * @deprecated 3.2.0 |
205 | 205 | */ |
206 | - public static function instantiate( $sTextDomain='admin-page-framework' ) { |
|
206 | + public static function instantiate( $sTextDomain = 'admin-page-framework' ) { |
|
207 | 207 | return self::getInstance( $sTextDomain ); |
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Sets up properties. |
212 | 212 | */ |
213 | - public function __construct( $sTextDomain='admin-page-framework' ) { |
|
213 | + public function __construct( $sTextDomain = 'admin-page-framework' ) { |
|
214 | 214 | |
215 | 215 | $this->_sTextDomain = $sTextDomain; |
216 | 216 | |
217 | 217 | // Fill the $aMessages property with the keys extracted from the $aDefaults property |
218 | 218 | // with the value of null. The null is set to let it trigger the __get() method |
219 | 219 | // so that each translation item gets processed individually. |
220 | - $this->aMessages = array_fill_keys( |
|
220 | + $this->aMessages = array_fill_keys( |
|
221 | 221 | array_keys( $this->aDefaults ), |
222 | 222 | null |
223 | 223 | ); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @deprecated 3.2.0 |
145 | 145 | * @internal |
146 | 146 | */ |
147 | - public static $_sDefaultStyle =""; |
|
147 | + public static $_sDefaultStyle = ""; |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * The default CSS rules for IE loaded in the head tag of the created admin pages. |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | * @internal |
288 | 288 | * @since 3.2.0 |
289 | 289 | */ |
290 | - public $aFieldCallbacks = array( |
|
291 | - 'hfID' => null, // the input id attribute |
|
292 | - 'hfTagID' => null, // the field container id attribute |
|
293 | - 'hfName' => null, // the field name attribute |
|
294 | - 'hfNameFlat' => null, // the flat field name attribute |
|
295 | - 'hfInputName' => null, // 3.6.0+ the field input name attribute |
|
296 | - 'hfInputNameFlat' => null, // 3.6.0+ the flat field input name |
|
297 | - 'hfClass' => null, // the class attribute |
|
290 | + public $aFieldCallbacks = array( |
|
291 | + 'hfID' => null, // the input id attribute |
|
292 | + 'hfTagID' => null, // the field container id attribute |
|
293 | + 'hfName' => null, // the field name attribute |
|
294 | + 'hfNameFlat' => null, // the flat field name attribute |
|
295 | + 'hfInputName' => null, // 3.6.0+ the field input name attribute |
|
296 | + 'hfInputNameFlat' => null, // 3.6.0+ the flat field input name |
|
297 | + 'hfClass' => null, // the class attribute |
|
298 | 298 | ); |
299 | 299 | |
300 | 300 | /** |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | 'manage_options', |
323 | 323 | $sCapability |
324 | 324 | ); |
325 | - $this->sTextDomain = $this->oUtil->getAOrB( |
|
325 | + $this->sTextDomain = $this->oUtil->getAOrB( |
|
326 | 326 | empty( $sTextDomain ), |
327 | 327 | 'admin-page-framework', |
328 | 328 | $sTextDomain |
329 | 329 | ); |
330 | - $this->sFieldsType = $sFieldsType; |
|
331 | - $GLOBALS['aAdminPageFramework'] = isset( $GLOBALS['aAdminPageFramework'] ) && is_array( $GLOBALS['aAdminPageFramework'] ) |
|
332 | - ? $GLOBALS['aAdminPageFramework'] |
|
330 | + $this->sFieldsType = $sFieldsType; |
|
331 | + $GLOBALS[ 'aAdminPageFramework' ] = isset( $GLOBALS[ 'aAdminPageFramework' ] ) && is_array( $GLOBALS[ 'aAdminPageFramework' ] ) |
|
332 | + ? $GLOBALS[ 'aAdminPageFramework' ] |
|
333 | 333 | : array( 'aFieldFlags' => array() ); |
334 | 334 | $this->sPageNow = $this->oUtil->getPageNow(); |
335 | 335 | $this->bIsAdmin = is_admin(); |
@@ -403,19 +403,19 @@ discard block |
||
403 | 403 | * @remark The information can be used to embed into the footer etc. |
404 | 404 | * @return array The information of the script. |
405 | 405 | */ |
406 | - protected function getCallerInfo( $sCallerPath=null ) { |
|
406 | + protected function getCallerInfo( $sCallerPath = null ) { |
|
407 | 407 | |
408 | 408 | $_aCallerInfo = self::$_aStructure_CallerInfo; |
409 | - $_aCallerInfo['sPath'] = $sCallerPath; |
|
410 | - $_aCallerInfo['sType'] = $this->_getCallerType( $_aCallerInfo['sPath'] ); |
|
409 | + $_aCallerInfo[ 'sPath' ] = $sCallerPath; |
|
410 | + $_aCallerInfo[ 'sType' ] = $this->_getCallerType( $_aCallerInfo[ 'sPath' ] ); |
|
411 | 411 | |
412 | - if ( 'unknown' == $_aCallerInfo['sType'] ) { |
|
412 | + if ( 'unknown' == $_aCallerInfo[ 'sType' ] ) { |
|
413 | 413 | return $_aCallerInfo; |
414 | 414 | } |
415 | - if ( 'plugin' == $_aCallerInfo['sType'] ) { |
|
416 | - return $this->oUtil->getScriptData( $_aCallerInfo['sPath'], $_aCallerInfo['sType'] ) + $_aCallerInfo; |
|
415 | + if ( 'plugin' == $_aCallerInfo[ 'sType' ] ) { |
|
416 | + return $this->oUtil->getScriptData( $_aCallerInfo[ 'sPath' ], $_aCallerInfo[ 'sType' ] ) + $_aCallerInfo; |
|
417 | 417 | } |
418 | - if ( 'theme' == $_aCallerInfo['sType'] ) { |
|
418 | + if ( 'theme' == $_aCallerInfo[ 'sType' ] ) { |
|
419 | 419 | $_oTheme = wp_get_theme(); // stores the theme info object |
420 | 420 | return array( |
421 | 421 | 'sName' => $_oTheme->Name, |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | */ |
474 | 474 | protected function _getLastInput() { |
475 | 475 | |
476 | - $_sKey = 'apf_tfd' . md5( 'temporary_form_data_' . $this->sClassName . get_current_user_id() ); |
|
476 | + $_sKey = 'apf_tfd'.md5( 'temporary_form_data_'.$this->sClassName.get_current_user_id() ); |
|
477 | 477 | $_vValue = $this->oUtil->getTransient( $_sKey ); |
478 | 478 | $this->oUtil->deleteTransient( $_sKey ); |
479 | 479 | if ( is_array( $_vValue ) ) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param object $oCaller The caller object. Each formatted field will have the caller object. |
89 | 89 | * This give power to each field to create nested fields. |
90 | 90 | */ |
91 | - public function __construct( $sFieldsType, $sCapability, $oCaller=null ) { |
|
91 | + public function __construct( $sFieldsType, $sCapability, $oCaller = null ) { |
|
92 | 92 | |
93 | 93 | $this->sFieldsType = $sFieldsType; |
94 | 94 | $this->sCapability = $sCapability; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->aSections[ $aSection[ 'section_id' ] ] = $aSection; |
115 | 115 | $this->aFields[ $aSection[ 'section_id' ] ] = $this->getElement( |
116 | - $this->aFields, // subject array |
|
116 | + $this->aFields, // subject array |
|
117 | 117 | $aSection[ 'section_id' ], // key |
118 | 118 | array() // default |
119 | 119 | ); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function removeSection( $sSectionID ) { |
129 | 129 | |
130 | - if ( '_default' === $sSectionID ){ |
|
130 | + if ( '_default' === $sSectionID ) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | unset( |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function addField( $asField ) { |
148 | 148 | |
149 | - if ( ! is_array( $asField ) ) { |
|
149 | + if ( !is_array( $asField ) ) { |
|
150 | 150 | $this->_sTargetSectionID = $this->getAOrB( |
151 | 151 | is_string( $asField ), |
152 | 152 | $asField, |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | $_aField = $asField; |
158 | 158 | $this->_sTargetSectionID = $this->getElement( |
159 | - $_aField, // subject array |
|
159 | + $_aField, // subject array |
|
160 | 160 | 'section_id', // key |
161 | 161 | $this->_sTargetSectionID // default |
162 | 162 | ); |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | ); |
171 | 171 | |
172 | 172 | // Required Keys |
173 | - if ( ! isset( $_aField['field_id'], $_aField['type'] ) ) { |
|
173 | + if ( !isset( $_aField[ 'field_id' ], $_aField[ 'type' ] ) ) { |
|
174 | 174 | return null; |
175 | 175 | } |
176 | 176 | |
177 | 177 | // Sanitize the IDs since they are used as a callback method name. |
178 | - $_aField['field_id'] = $this->sanitizeSlug( $_aField['field_id'] ); |
|
179 | - $_aField['section_id'] = $this->sanitizeSlug( $_aField['section_id'] ); |
|
178 | + $_aField[ 'field_id' ] = $this->sanitizeSlug( $_aField[ 'field_id' ] ); |
|
179 | + $_aField[ 'section_id' ] = $this->sanitizeSlug( $_aField[ 'section_id' ] ); |
|
180 | 180 | |
181 | - $this->aFields[ $_aField['section_id'] ][ $_aField['field_id'] ] = $_aField; |
|
181 | + $this->aFields[ $_aField[ 'section_id' ] ][ $_aField[ 'field_id' ] ] = $_aField; |
|
182 | 182 | return $_aField; |
183 | 183 | |
184 | 184 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function removeField( $sFieldID ) { |
213 | 213 | |
214 | - foreach( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
214 | + foreach ( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
215 | 215 | |
216 | 216 | if ( array_key_exists( $sFieldID, $_aSubSectionsOrFields ) ) { |
217 | 217 | unset( $this->aFields[ $_sSectionID ][ $sFieldID ] ); |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | public function formatSections( array $aSections, $sFieldsType, $sCapability ) { |
256 | 256 | |
257 | 257 | $_aNewSectionArray = array(); |
258 | - foreach( $aSections as $_sSectionID => $_aSection ) { |
|
258 | + foreach ( $aSections as $_sSectionID => $_aSection ) { |
|
259 | 259 | |
260 | - if ( ! is_array( $_aSection ) ) { |
|
260 | + if ( !is_array( $_aSection ) ) { |
|
261 | 261 | continue; |
262 | 262 | } |
263 | 263 | |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | public function formatFields( array $aFields, $sFieldsType, $sCapability ) { |
311 | 311 | |
312 | 312 | $_aNewFields = array(); |
313 | - foreach( $aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
313 | + foreach ( $aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
314 | 314 | |
315 | - if ( ! isset( $this->aSections[ $_sSectionID ] ) ) { |
|
315 | + if ( !isset( $this->aSections[ $_sSectionID ] ) ) { |
|
316 | 316 | continue; |
317 | 317 | } |
318 | 318 | |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | $_aNewFields[ $_sSectionID ] = $this->getElementAsArray( $_aNewFields, $_sSectionID, array() ); |
327 | 327 | |
328 | 328 | // If there are sub-section items, |
329 | - $_abSectionRepeatable = $this->aSections[ $_sSectionID ]['repeatable']; // a setting array or boolean or true/false |
|
329 | + $_abSectionRepeatable = $this->aSections[ $_sSectionID ][ 'repeatable' ]; // a setting array or boolean or true/false |
|
330 | 330 | |
331 | 331 | // If sub-section exists or repeatable, |
332 | 332 | if ( count( $this->getIntegerKeyElements( $_aSubSectionsOrFields ) ) || $_abSectionRepeatable ) { |
333 | 333 | |
334 | - foreach( $this->numerizeElements( $_aSubSectionsOrFields ) as $_iSectionIndex => $_aFields ) { |
|
334 | + foreach ( $this->numerizeElements( $_aSubSectionsOrFields ) as $_iSectionIndex => $_aFields ) { |
|
335 | 335 | |
336 | - foreach( $_aFields as $_aField ) { |
|
336 | + foreach ( $_aFields as $_aField ) { |
|
337 | 337 | $_iCountElement = count( $this->getElementAsArray( $_aNewFields, array( $_sSectionID, $_iSectionIndex ), array() ) ); |
338 | 338 | $_aField = $this->formatField( |
339 | 339 | $_aField, |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | $_abSectionRepeatable, |
345 | 345 | $this->oCaller |
346 | 346 | ); |
347 | - if ( ! empty( $_aField ) ) { |
|
348 | - $_aNewFields[ $_sSectionID ][ $_iSectionIndex ][ $_aField['field_id'] ] = $_aField; |
|
347 | + if ( !empty( $_aField ) ) { |
|
348 | + $_aNewFields[ $_sSectionID ][ $_iSectionIndex ][ $_aField[ 'field_id' ] ] = $_aField; |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | uasort( $_aNewFields[ $_sSectionID ][ $_iSectionIndex ], array( $this, 'sortArrayByKey' ) ); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | // Otherwise, these are normal sectioned fields. |
359 | 359 | $_aSectionedFields = $_aSubSectionsOrFields; |
360 | - foreach( $_aSectionedFields as $_sFieldID => $_aField ) { |
|
360 | + foreach ( $_aSectionedFields as $_sFieldID => $_aField ) { |
|
361 | 361 | |
362 | 362 | // Insert the formatted field definition array. The fields count is needed to set each order value. |
363 | 363 | $_iCountElement = count( $this->getElementAsArray( $_aNewFields, $_sSectionID, array() ) ); |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | $_abSectionRepeatable, |
371 | 371 | $this->oCaller |
372 | 372 | ); |
373 | - if ( ! empty( $_aField ) ) { |
|
374 | - $_aNewFields[ $_sSectionID ][ $_aField['field_id'] ] = $_aField; |
|
373 | + if ( !empty( $_aField ) ) { |
|
374 | + $_aNewFields[ $_sSectionID ][ $_aField[ 'field_id' ] ] = $_aField; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | } |
404 | 404 | |
405 | 405 | $_aSortedFields = array(); |
406 | - foreach( $aSections as $_sSectionID => $_aSeciton ) { |
|
406 | + foreach ( $aSections as $_sSectionID => $_aSeciton ) { |
|
407 | 407 | if ( isset( $aFields[ $_sSectionID ] ) ) { |
408 | 408 | $_aSortedFields[ $_sSectionID ] = $aFields[ $_sSectionID ]; |
409 | 409 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | protected function formatField( $aField, $sFieldsType, $sCapability, $iCountOfElements, $iSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
422 | 422 | |
423 | - if ( ! isset( $aField[ 'field_id' ], $aField[ 'type' ] ) ) { |
|
423 | + if ( !isset( $aField[ 'field_id' ], $aField[ 'type' ] ) ) { |
|
424 | 424 | return; |
425 | 425 | } |
426 | 426 | |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | * @since 3.5.3 Added a type hint and changed the default value to array from null. |
459 | 459 | * @return array The conditioned sections array. |
460 | 460 | */ |
461 | - public function getConditionedSections( array $aSections=array() ) { |
|
461 | + public function getConditionedSections( array $aSections = array() ) { |
|
462 | 462 | |
463 | - $_aNewSections = array(); |
|
464 | - foreach( $aSections as $_sSectionID => $_aSection ) { |
|
463 | + $_aNewSections = array(); |
|
464 | + foreach ( $aSections as $_sSectionID => $_aSection ) { |
|
465 | 465 | $_aSection = $this->getConditionedSection( $_aSection ); |
466 | - if ( ! empty( $_aSection ) ) { |
|
466 | + if ( !empty( $_aSection ) ) { |
|
467 | 467 | $_aNewSections[ $_sSectionID ] = $_aSection; |
468 | 468 | } |
469 | 469 | } |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | protected function getConditionedSection( array $aSection ) { |
484 | 484 | |
485 | 485 | // Check capability. If the access level is not sufficient, skip. |
486 | - if ( ! current_user_can( $aSection['capability'] ) ) { |
|
486 | + if ( !current_user_can( $aSection[ 'capability' ] ) ) { |
|
487 | 487 | return array(); |
488 | 488 | } |
489 | - if ( ! $aSection['if'] ) { |
|
489 | + if ( !$aSection[ 'if' ] ) { |
|
490 | 490 | return array(); |
491 | 491 | } |
492 | 492 | |
@@ -507,18 +507,18 @@ discard block |
||
507 | 507 | |
508 | 508 | // Drop keys of fields-array which do not exist in the sections-array. |
509 | 509 | // For this reasons, the sections-array should be conditioned first before applying this method. |
510 | - $aFields = $this->castArrayContents( $aSections, $aFields ); |
|
510 | + $aFields = $this->castArrayContents( $aSections, $aFields ); |
|
511 | 511 | |
512 | 512 | $_aNewFields = array(); |
513 | - foreach( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
|
513 | + foreach ( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
|
514 | 514 | |
515 | 515 | // This type check is important as the parsing field array is content-cast, which can set null value to elements. |
516 | - if ( ! is_array( $_aSubSectionOrFields ) ) { |
|
516 | + if ( !is_array( $_aSubSectionOrFields ) ) { |
|
517 | 517 | continue; |
518 | 518 | } |
519 | 519 | |
520 | 520 | $this->_setConditionedFields( |
521 | - $_aNewFields, // by reference - gets updated in the method. |
|
521 | + $_aNewFields, // by reference - gets updated in the method. |
|
522 | 522 | $_aSubSectionOrFields, |
523 | 523 | $_sSectionID |
524 | 524 | ); |
@@ -538,16 +538,16 @@ discard block |
||
538 | 538 | */ |
539 | 539 | private function _setConditionedFields( array &$_aNewFields, $_aSubSectionOrFields, $_sSectionID ) { |
540 | 540 | |
541 | - foreach( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) { |
|
541 | + foreach ( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) { |
|
542 | 542 | |
543 | 543 | // If it is a sub-section array. |
544 | 544 | if ( $this->isNumericInteger( $_sIndexOrFieldID ) ) { |
545 | 545 | $_sSubSectionIndex = $_sIndexOrFieldID; |
546 | 546 | $_aFields = $_aSubSectionOrField; |
547 | - foreach( $_aFields as $_aField ) { |
|
547 | + foreach ( $_aFields as $_aField ) { |
|
548 | 548 | $_aField = $this->getConditionedField( $_aField ); |
549 | - if ( ! empty( $_aField ) ) { |
|
550 | - $_aNewFields[ $_sSectionID ][ $_sSubSectionIndex ][ $_aField['field_id'] ] = $_aField; |
|
549 | + if ( !empty( $_aField ) ) { |
|
550 | + $_aNewFields[ $_sSectionID ][ $_sSubSectionIndex ][ $_aField[ 'field_id' ] ] = $_aField; |
|
551 | 551 | } |
552 | 552 | } |
553 | 553 | continue; |
@@ -557,8 +557,8 @@ discard block |
||
557 | 557 | // Otherwise, insert the formatted field definition array. |
558 | 558 | $_aField = $_aSubSectionOrField; |
559 | 559 | $_aField = $this->getConditionedField( $_aField ); |
560 | - if ( ! empty( $_aField ) ) { |
|
561 | - $_aNewFields[ $_sSectionID ][ $_aField['field_id'] ] = $_aField; |
|
560 | + if ( !empty( $_aField ) ) { |
|
561 | + $_aNewFields[ $_sSectionID ][ $_aField[ 'field_id' ] ] = $_aField; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | } |
@@ -576,10 +576,10 @@ discard block |
||
576 | 576 | protected function getConditionedField( array $aField ) { |
577 | 577 | |
578 | 578 | // Check capability. If the access level is not sufficient, skip. |
579 | - if ( ! current_user_can( $aField['capability'] ) ) { |
|
579 | + if ( !current_user_can( $aField[ 'capability' ] ) ) { |
|
580 | 580 | return array(); |
581 | 581 | } |
582 | - if ( ! $aField['if'] ) { |
|
582 | + if ( !$aField[ 'if' ] ) { |
|
583 | 583 | return array(); |
584 | 584 | } |
585 | 585 | return $aField; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | public function setDynamicElements( $aOptions ) { |
603 | 603 | |
604 | 604 | $aOptions = $this->castArrayContents( $this->aConditionedSections, $aOptions ); |
605 | - foreach( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
605 | + foreach ( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
606 | 606 | |
607 | 607 | $_aSubSection = $this->_getSubSectionFromOptions( |
608 | 608 | $_sSectionID, |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | |
638 | 638 | $_aSubSection = array(); |
639 | 639 | $_iPrevIndex = null; |
640 | - foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
640 | + foreach ( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
641 | 641 | |
642 | 642 | // If it is not a sub-section array, skip. |
643 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
643 | + if ( !$this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
644 | 644 | continue; |
645 | 645 | } |
646 | 646 | |
@@ -654,8 +654,8 @@ discard block |
||
654 | 654 | ); |
655 | 655 | |
656 | 656 | // Update the internal section index key |
657 | - foreach( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
658 | - $_aField['_section_index'] = $_iIndex; |
|
657 | + foreach ( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
658 | + $_aField[ '_section_index' ] = $_iIndex; |
|
659 | 659 | } |
660 | 660 | unset( $_aField ); // to be safe in PHP |
661 | 661 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | */ |
679 | 679 | private function _getSubSectionItemsFromOptions( array $_aSubSection, $_sSectionID, $_iIndex, $_iPrevIndex ) { |
680 | 680 | |
681 | - if ( ! isset( $this->aConditionedFields[ $_sSectionID ] ) ) { |
|
681 | + if ( !isset( $this->aConditionedFields[ $_sSectionID ] ) ) { |
|
682 | 682 | return array(); |
683 | 683 | } |
684 | 684 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | : $this->getNonIntegerKeyElements( $this->aConditionedFields[ $_sSectionID ] ); |
688 | 688 | |
689 | 689 | // if empty, merge with the previous element. |
690 | - return ! empty( $_aFields ) |
|
690 | + return !empty( $_aFields ) |
|
691 | 691 | ? $_aFields |
692 | 692 | : $this->getElementAsArray( |
693 | 693 | $_aSubSection, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function removeSection( $sSectionID ) { |
129 | 129 | |
130 | - if ( '_default' === $sSectionID ){ |
|
130 | + if ( '_default' === $sSectionID ) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | unset( |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | ); |
171 | 171 | |
172 | 172 | // Required Keys |
173 | - if ( ! isset( $_aField['field_id'], $_aField['type'] ) ) { |
|
173 | + if ( ! isset( $_aField['field_id'], $_aField['type'] ) ) { |
|
174 | 174 | return null; |
175 | 175 | } |
176 | 176 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $_aNewSectionArray = array(); |
258 | 258 | foreach( $aSections as $_sSectionID => $_aSection ) { |
259 | 259 | |
260 | - if ( ! is_array( $_aSection ) ) { |
|
260 | + if ( ! is_array( $_aSection ) ) { |
|
261 | 261 | continue; |
262 | 262 | } |
263 | 263 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | count( $_aNewSectionArray ), // this new array gets updated in this loops so the count will be updated. |
269 | 269 | $this->oCaller |
270 | 270 | ); |
271 | - if ( empty( $_aSection ) ) { |
|
271 | + if ( empty( $_aSection ) ) { |
|
272 | 272 | continue; |
273 | 273 | } |
274 | 274 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $_aNewFields = array(); |
313 | 313 | foreach( $aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
314 | 314 | |
315 | - if ( ! isset( $this->aSections[ $_sSectionID ] ) ) { |
|
315 | + if ( ! isset( $this->aSections[ $_sSectionID ] ) ) { |
|
316 | 316 | continue; |
317 | 317 | } |
318 | 318 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $_abSectionRepeatable = $this->aSections[ $_sSectionID ]['repeatable']; // a setting array or boolean or true/false |
330 | 330 | |
331 | 331 | // If sub-section exists or repeatable, |
332 | - if ( count( $this->getIntegerKeyElements( $_aSubSectionsOrFields ) ) || $_abSectionRepeatable ) { |
|
332 | + if ( count( $this->getIntegerKeyElements( $_aSubSectionsOrFields ) ) || $_abSectionRepeatable ) { |
|
333 | 333 | |
334 | 334 | foreach( $this->numerizeElements( $_aSubSectionsOrFields ) as $_iSectionIndex => $_aFields ) { |
335 | 335 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | } |
404 | 404 | |
405 | 405 | $_aSortedFields = array(); |
406 | - foreach( $aSections as $_sSectionID => $_aSeciton ) { |
|
406 | + foreach( $aSections as $_sSectionID => $_aSeciton ) { |
|
407 | 407 | if ( isset( $aFields[ $_sSectionID ] ) ) { |
408 | 408 | $_aSortedFields[ $_sSectionID ] = $aFields[ $_sSectionID ]; |
409 | 409 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | protected function formatField( $aField, $sFieldsType, $sCapability, $iCountOfElements, $iSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
422 | 422 | |
423 | - if ( ! isset( $aField[ 'field_id' ], $aField[ 'type' ] ) ) { |
|
423 | + if ( ! isset( $aField[ 'field_id' ], $aField[ 'type' ] ) ) { |
|
424 | 424 | return; |
425 | 425 | } |
426 | 426 | |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | protected function getConditionedSection( array $aSection ) { |
484 | 484 | |
485 | 485 | // Check capability. If the access level is not sufficient, skip. |
486 | - if ( ! current_user_can( $aSection['capability'] ) ) { |
|
486 | + if ( ! current_user_can( $aSection['capability'] ) ) { |
|
487 | 487 | return array(); |
488 | 488 | } |
489 | - if ( ! $aSection['if'] ) { |
|
489 | + if ( ! $aSection['if'] ) { |
|
490 | 490 | return array(); |
491 | 491 | } |
492 | 492 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | foreach( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
514 | 514 | |
515 | 515 | // This type check is important as the parsing field array is content-cast, which can set null value to elements. |
516 | - if ( ! is_array( $_aSubSectionOrFields ) ) { |
|
516 | + if ( ! is_array( $_aSubSectionOrFields ) ) { |
|
517 | 517 | continue; |
518 | 518 | } |
519 | 519 | |
@@ -576,10 +576,10 @@ discard block |
||
576 | 576 | protected function getConditionedField( array $aField ) { |
577 | 577 | |
578 | 578 | // Check capability. If the access level is not sufficient, skip. |
579 | - if ( ! current_user_can( $aField['capability'] ) ) { |
|
579 | + if ( ! current_user_can( $aField['capability'] ) ) { |
|
580 | 580 | return array(); |
581 | 581 | } |
582 | - if ( ! $aField['if'] ) { |
|
582 | + if ( ! $aField['if'] ) { |
|
583 | 583 | return array(); |
584 | 584 | } |
585 | 585 | return $aField; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
641 | 641 | |
642 | 642 | // If it is not a sub-section array, skip. |
643 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
643 | + if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
644 | 644 | continue; |
645 | 645 | } |
646 | 646 |