@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @since 3.0.0 |
23 | 23 | */ |
24 | - public function enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
24 | + public function enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
25 | 25 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
26 | 26 | return $this->oResource->_enqueueStyles( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
27 | 27 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param array (optional) The argument array for more advanced parameters. |
38 | 38 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
39 | 39 | */ |
40 | - public function enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
40 | + public function enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
41 | 41 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
42 | 42 | return $this->oResource->_enqueueStyle( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
43 | 43 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 2.1.5 |
49 | 49 | */ |
50 | - public function enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
50 | + public function enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
51 | 51 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
52 | 52 | return $this->oResource->_enqueueScripts( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
53 | 53 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param array (optional) The argument array for more advanced parameters. |
64 | 64 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
65 | 65 | */ |
66 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
66 | + public function enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
67 | 67 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
68 | 68 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
69 | 69 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function _replyToSetFooterInfo() { |
38 | 38 | |
39 | - if ( ! $this->oProp->isPageAdded() ) { |
|
39 | + if ( !$this->oProp->isPageAdded() ) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | parent::_replyToSetFooterInfo(); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function _addLinkToPluginDescription( $asLinks ) { |
58 | 58 | |
59 | - if ( ! is_array( $asLinks ) ) { |
|
60 | - $this->oProp->aPluginDescriptionLinks[] = $asLinks; |
|
59 | + if ( !is_array( $asLinks ) ) { |
|
60 | + $this->oProp->aPluginDescriptionLinks[ ] = $asLinks; |
|
61 | 61 | } else { |
62 | 62 | $this->oProp->aPluginDescriptionLinks = array_merge( |
63 | 63 | $this->oProp->aPluginDescriptionLinks, |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function _addLinkToPluginTitle( $asLinks ) { |
86 | 86 | |
87 | - if ( ! is_array( $asLinks ) ) { |
|
88 | - $this->oProp->aPluginTitleLinks[] = $asLinks; |
|
87 | + if ( !is_array( $asLinks ) ) { |
|
88 | + $this->oProp->aPluginTitleLinks[ ] = $asLinks; |
|
89 | 89 | } else { |
90 | 90 | $this->oProp->aPluginTitleLinks = array_merge( |
91 | 91 | $this->oProp->aPluginTitleLinks, |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | $_sPluginBaseName = plugin_basename( $this->oProp->aScriptInfo[ 'sPath' ] ); |
122 | 122 | add_filter( |
123 | - $this->_sFilterSuffix_PluginActionLinks . $_sPluginBaseName, |
|
123 | + $this->_sFilterSuffix_PluginActionLinks.$_sPluginBaseName, |
|
124 | 124 | array( $this, '_replyToAddPluginActionLinks' ) |
125 | 125 | ); |
126 | 126 | } |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | * @return string |
134 | 134 | * @internal |
135 | 135 | */ |
136 | - public function _replyToAddInfoInFooterLeft( $sLinkHTML='' ) { |
|
136 | + public function _replyToAddInfoInFooterLeft( $sLinkHTML = '' ) { |
|
137 | 137 | |
138 | - if ( ! $this->_isPageAdded() ) { |
|
138 | + if ( !$this->_isPageAdded() ) { |
|
139 | 139 | return $sLinkHTML; // $sLinkHTML is given by the hook. |
140 | 140 | } |
141 | - $sLinkHTML = empty( $this->oProp->aScriptInfo['sName'] ) |
|
141 | + $sLinkHTML = empty( $this->oProp->aScriptInfo[ 'sName' ] ) |
|
142 | 142 | ? $sLinkHTML |
143 | - : $this->oProp->aFooterInfo['sLeft']; |
|
143 | + : $this->oProp->aFooterInfo[ 'sLeft' ]; |
|
144 | 144 | |
145 | 145 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
146 | 146 | $_sTabSlug = $this->oProp->getCurrentTabSlug(); |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | array( |
152 | 152 | $this->getAOrB( |
153 | 153 | $_sTabSlug, |
154 | - 'footer_left_' . $_sPageSlug . '_' . $_sTabSlug, |
|
154 | + 'footer_left_'.$_sPageSlug.'_'.$_sTabSlug, |
|
155 | 155 | null // will be ignored |
156 | 156 | ), |
157 | - 'footer_left_' . $_sPageSlug, |
|
158 | - 'footer_left_' . $this->oProp->sClassName |
|
157 | + 'footer_left_'.$_sPageSlug, |
|
158 | + 'footer_left_'.$this->oProp->sClassName |
|
159 | 159 | ), |
160 | 160 | $sLinkHTML |
161 | 161 | ); |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * @return string |
170 | 170 | * @internal |
171 | 171 | */ |
172 | - public function _replyToAddInfoInFooterRight( $sLinkHTML='' ) { |
|
172 | + public function _replyToAddInfoInFooterRight( $sLinkHTML = '' ) { |
|
173 | 173 | |
174 | - if ( ! $this->_isPageAdded() ) { |
|
174 | + if ( !$this->_isPageAdded() ) { |
|
175 | 175 | return $sLinkHTML; // $sLinkTHML is given by the hook. |
176 | 176 | } |
177 | 177 | |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | array( |
185 | 185 | $this->getAOrB( |
186 | 186 | $_sTabSlug, |
187 | - 'footer_right_' . $_sPageSlug . '_' . $_sTabSlug, |
|
187 | + 'footer_right_'.$_sPageSlug.'_'.$_sTabSlug, |
|
188 | 188 | null // will be ignored |
189 | 189 | ), |
190 | - 'footer_right_' . $_sPageSlug, |
|
191 | - 'footer_right_' . $this->oProp->sClassName |
|
190 | + 'footer_right_'.$_sPageSlug, |
|
191 | + 'footer_right_'.$this->oProp->sClassName |
|
192 | 192 | ), |
193 | - $this->oProp->aFooterInfo['sRight'] |
|
193 | + $this->oProp->aFooterInfo[ 'sRight' ] |
|
194 | 194 | ); |
195 | 195 | |
196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function _isPageAdded() { |
205 | 205 | |
206 | - if ( ! isset( $_GET[ 'page' ] ) ) { |
|
206 | + if ( !isset( $_GET[ 'page' ] ) ) { |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | return ( bool ) $this->oProp->isPageAdded( $_GET[ 'page' ] ); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | : $this->oProp->sLabelPluginSettingsLink; |
229 | 229 | |
230 | 230 | // If the user disables the settings link, the label property is empty. If so, do not add it. |
231 | - if ( ! $this->oProp->sLabelPluginSettingsLink ) { |
|
231 | + if ( !$this->oProp->sLabelPluginSettingsLink ) { |
|
232 | 232 | return $aLinks; |
233 | 233 | } |
234 | 234 | |
@@ -246,13 +246,13 @@ discard block |
||
246 | 246 | array_unshift( |
247 | 247 | $aLinks, |
248 | 248 | // '<a href="' . esc_url( $_sLinkURL ) . '">' |
249 | - '<a ' . $this->getAttributes( |
|
249 | + '<a '.$this->getAttributes( |
|
250 | 250 | array( |
251 | 251 | 'href' => esc_url( $_sLinkURL ), |
252 | 252 | // 3.5.7+ Added for acceptance testing |
253 | 253 | 'class' => 'apf-plugin-title-action-link apf-post-type', |
254 | 254 | ) |
255 | - ) . '>' |
|
255 | + ).'>' |
|
256 | 256 | . $this->oProp->sLabelPluginSettingsLink |
257 | 257 | . '</a>' |
258 | 258 | ); |
@@ -275,16 +275,16 @@ discard block |
||
275 | 275 | |
276 | 276 | // Backward compatibility sanitisation. |
277 | 277 | $_aAddingLinks = array(); |
278 | - foreach( array_filter( $this->oProp->aPluginDescriptionLinks ) as $_sLLinkHTML ) { |
|
278 | + foreach ( array_filter( $this->oProp->aPluginDescriptionLinks ) as $_sLLinkHTML ) { |
|
279 | 279 | |
280 | - if ( ! $_sLLinkHTML ) { |
|
280 | + if ( !$_sLLinkHTML ) { |
|
281 | 281 | continue; |
282 | 282 | } |
283 | 283 | if ( is_array( $_sLLinkHTML ) ) { // should not be an array |
284 | 284 | $_aAddingLinks = array_merge( $_sLLinkHTML, $_aAddingLinks ); |
285 | 285 | continue; |
286 | 286 | } |
287 | - $_aAddingLinks[] = ( string ) $_sLLinkHTML; |
|
287 | + $_aAddingLinks[ ] = ( string ) $_sLLinkHTML; |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | return array_merge( $aLinks, $_aAddingLinks ); |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | public function _replyToAddPluginActionLinks( $aLinks ) { |
302 | 302 | |
303 | 303 | $_aAddingLinks = array(); |
304 | - foreach( array_filter( $this->oProp->aPluginTitleLinks ) as $_sLinkHTML ) { |
|
304 | + foreach ( array_filter( $this->oProp->aPluginTitleLinks ) as $_sLinkHTML ) { |
|
305 | 305 | |
306 | 306 | if ( is_array( $_sLinkHTML ) ) { |
307 | 307 | $_aAddingLinks = array_merge( $_sLinkHTML, $_aAddingLinks ); |
308 | 308 | continue; |
309 | 309 | } |
310 | - $_aAddingLinks[] = ( string ) $_sLinkHTML; |
|
310 | + $_aAddingLinks[ ] = ( string ) $_sLinkHTML; |
|
311 | 311 | |
312 | 312 | } |
313 | 313 | return array_merge( $aLinks, $_aAddingLinks ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | private $_iLevel; |
39 | 39 | |
40 | - public function __construct( $iLevel=null ) { |
|
40 | + public function __construct( $iLevel = null ) { |
|
41 | 41 | $this->_iLevel = null !== $iLevel |
42 | 42 | ? $iLevel |
43 | 43 | : error_reporting(); |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | private function _getIncluded() { |
57 | 57 | |
58 | 58 | $_aIncluded = array(); |
59 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
59 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
60 | 60 | |
61 | 61 | // This is where we check if a level was used or not |
62 | 62 | if ( $this->_iLevel & $_iLevel ) { |
63 | - $_aIncluded[] = $_iLevel; |
|
63 | + $_aIncluded[ ] = $_iLevel; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | $_aValues = array(); |
75 | 75 | |
76 | 76 | if ( count( $aIncluded ) > $_iAll / 2 ) { |
77 | - $_aValues[] = 'E_ALL'; |
|
78 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
79 | - if ( ! in_array( $_iLevel, $aIncluded ) ) { |
|
80 | - $_aValues[] = $iLevelText; |
|
77 | + $_aValues[ ] = 'E_ALL'; |
|
78 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
79 | + if ( !in_array( $_iLevel, $aIncluded ) ) { |
|
80 | + $_aValues[ ] = $iLevelText; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | return implode( ' & ~', $_aValues ); |
84 | 84 | } |
85 | - foreach( $aIncluded as $_iLevel ) { |
|
86 | - $_aValues[] = $this->_aLevels[ $_iLevel ]; |
|
85 | + foreach ( $aIncluded as $_iLevel ) { |
|
86 | + $_aValues[ ] = $this->_aLevels[ $_iLevel ]; |
|
87 | 87 | } |
88 | 88 | return implode( ' | ', $_aValues ); |
89 | 89 |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
18 | 18 | |
19 | - const VERSION = '3.8.29b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
19 | + const VERSION = '3.8.29b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
20 | 20 | const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
21 | - const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
21 | + const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
22 | 22 | const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
23 | 23 | const URI = 'http://admin-page-framework.michaeluno.jp/'; |
24 | 24 | const AUTHOR = 'miunosoft (Michael Uno)'; |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @remark This is also accessed from `uninstall.php` so do not remove. |
56 | 56 | * @remark Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added. |
57 | 57 | */ |
58 | - const TRANSIENT_PREFIX = 'APFL_'; |
|
58 | + const TRANSIENT_PREFIX = 'APFL_'; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * The hook slug used for the prefix of action and filter hook names. |
62 | 62 | * |
63 | 63 | * @remark The ending underscore is not necessary. |
64 | 64 | */ |
65 | - const HOOK_SLUG = 'admin_page_framework_loader'; |
|
65 | + const HOOK_SLUG = 'admin_page_framework_loader'; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * The text domain slug and its path. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | static public $aAdminPages = array( |
118 | 118 | // key => 'page slug' |
119 | - 'about' => 'apfl_about', // the welcome page |
|
119 | + 'about' => 'apfl_about', // the welcome page |
|
120 | 120 | 'addon' => 'apfl_addons', |
121 | 121 | 'tool' => 'apfl_tools', |
122 | 122 | 'help' => 'apfl_contact', |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | * @since 3.5.0 |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public static function getPluginURL( $sRelativePath='' ) { |
|
157 | + public static function getPluginURL( $sRelativePath = '' ) { |
|
158 | 158 | if ( isset( self::$_sPluginURLCache ) ) { |
159 | - return self::$_sPluginURLCache . $sRelativePath; |
|
159 | + return self::$_sPluginURLCache.$sRelativePath; |
|
160 | 160 | } |
161 | 161 | self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) ); |
162 | - return self::$_sPluginURLCache . $sRelativePath; |
|
162 | + return self::$_sPluginURLCache.$sRelativePath; |
|
163 | 163 | } |
164 | 164 | /** |
165 | 165 | * @since 3.7.9 |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @since 3.5.0 |
190 | 190 | * @return void |
191 | 191 | */ |
192 | - static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
|
193 | - if ( ! is_admin() ) { |
|
192 | + static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) { |
|
193 | + if ( !is_admin() ) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | - self::$_aAdminNotices[] = array( |
|
196 | + self::$_aAdminNotices[ ] = array( |
|
197 | 197 | 'message' => $sMessage, |
198 | - 'class_attribute' => trim( $sClassAttribute ) . ' notice is-dismissible', |
|
198 | + 'class_attribute' => trim( $sClassAttribute ).' notice is-dismissible', |
|
199 | 199 | ); |
200 | 200 | add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) ); |
201 | 201 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | static public function _replyToSetAdminNotice() { |
208 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | - echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
|
208 | + foreach ( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | + echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>" |
|
210 | 210 | ."<p>" |
211 | 211 | . sprintf( |
212 | - '<strong>%1$s</strong>: ' . $_aAdminNotice['message'], |
|
213 | - self::NAME . ' ' . self::VERSION |
|
212 | + '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ], |
|
213 | + self::NAME.' '.self::VERSION |
|
214 | 214 | ) |
215 | 215 | . "</p>" |
216 | 216 | . "</div>"; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | AdminPageFrameworkLoader_Registry::setUp( __FILE__ ); |
223 | 223 | |
224 | 224 | // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file. |
225 | -if ( ! defined( 'ABSPATH' ) ) { |
|
225 | +if ( !defined( 'ABSPATH' ) ) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | if ( defined( 'DOING_UNINSTALL' ) && DOING_UNINSTALL ) { |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | |
235 | 235 | $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false ); |
236 | 236 | if ( |
237 | - ! $_bFrameworkLoaded |
|
238 | - || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
237 | + !$_bFrameworkLoaded |
|
238 | + || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
239 | 239 | || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' ) |
240 | 240 | ) { |
241 | 241 | AdminPageFrameworkLoader_Registry::setAdminNotice( |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' ); |
254 | 254 | |
255 | 255 | // Include the library file - the development version will be available if you cloned the GitHub repository. |
256 | -$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php'; |
|
256 | +$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php'; |
|
257 | 257 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
258 | 258 | $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath ); |
259 | 259 | include( |
260 | 260 | $_bLoadDevelopmentVersion |
261 | 261 | ? $_sDevelopmentVersionPath |
262 | - : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php' |
|
262 | + : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php' |
|
263 | 263 | ); |
264 | 264 | |
265 | 265 | // Include the framework loader plugin components. |
266 | 266 | include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] ); |
267 | -include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
267 | +include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
268 | 268 | new AdminPageFrameworkLoader_Bootstrap( |
269 | 269 | AdminPageFrameworkLoader_Registry::$sFilePath, |
270 | 270 | AdminPageFrameworkLoader_Registry::HOOK_SLUG // hook prefix |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return integer |
34 | 34 | * @internal |
35 | 35 | */ |
36 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
36 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
37 | 37 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
38 | 38 | ? $a[ $sKey ] - $b[ $sKey ] |
39 | 39 | : 1; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
77 | 77 | |
78 | 78 | $_sKey = array_shift( $aKeys ); |
79 | - if ( ! empty( $aKeys ) ) { |
|
79 | + if ( !empty( $aKeys ) ) { |
|
80 | 80 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
81 | 81 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
82 | 82 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
98 | 98 | |
99 | 99 | $_sKey = array_shift( $aKeys ); |
100 | - if ( ! empty( $aKeys ) ) { |
|
101 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
100 | + if ( !empty( $aKeys ) ) { |
|
101 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
102 | 102 | $mSubject[ $_sKey ] = array(); |
103 | 103 | } |
104 | 104 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | |
153 | 153 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
154 | 154 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
155 | - foreach( $_aNumeric as &$_aElem ) { |
|
155 | + foreach ( $_aNumeric as &$_aElem ) { |
|
156 | 156 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
157 | 157 | } |
158 | - if ( ! empty( $_aAssociative ) ) { |
|
158 | + if ( !empty( $_aAssociative ) ) { |
|
159 | 159 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
160 | 160 | } |
161 | 161 | return $_aNumeric; |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | public static function castArrayContents( array $aModel, array $aSubject ) { |
179 | 179 | |
180 | 180 | $_aCast = array(); |
181 | - foreach( $aModel as $_isKey => $_v ) { |
|
181 | + foreach ( $aModel as $_isKey => $_v ) { |
|
182 | 182 | $_aCast[ $_isKey ] = self::getElement( |
183 | - $aSubject, // subject array |
|
184 | - $_isKey, // key |
|
183 | + $aSubject, // subject array |
|
184 | + $_isKey, // key |
|
185 | 185 | null // default |
186 | 186 | ); |
187 | 187 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
203 | 203 | |
204 | 204 | $_aInvert = array(); |
205 | - foreach( $aModel as $_isKey => $_v ) { |
|
205 | + foreach ( $aModel as $_isKey => $_v ) { |
|
206 | 206 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
207 | 207 | continue; |
208 | 208 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
229 | 229 | |
230 | 230 | $_aArray = array(); |
231 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
231 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
232 | 232 | $_aArray = self::uniteArraysRecursive( |
233 | 233 | self::getAsArray( $_aArg ), |
234 | 234 | $_aArray |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $aPrecedence = array(); |
260 | 260 | } |
261 | 261 | |
262 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
262 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
263 | 263 | return $aPrecedence; |
264 | 264 | } |
265 | 265 | |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | return $aPrecedence; |
269 | 269 | } |
270 | 270 | |
271 | - foreach( $aDefault as $sKey => $v ) { |
|
271 | + foreach ( $aDefault as $sKey => $v ) { |
|
272 | 272 | |
273 | 273 | // If the precedence does not have the key, assign the default's value. |
274 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
274 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
275 | 275 | $aPrecedence[ $sKey ] = $v; |
276 | 276 | } else { |
277 | 277 | |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | * - NULL |
303 | 303 | * @return array The modified array. |
304 | 304 | */ |
305 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
306 | - foreach( $aArray as $isKey => $vValue ) { |
|
305 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
306 | + foreach ( $aArray as $isKey => $vValue ) { |
|
307 | 307 | if ( in_array( gettype( $vValue ), $aTypes, true ) ) { |
308 | 308 | unset( $aArray[ $isKey ] ); |
309 | 309 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | static public function dropElementByValue( array $aArray, $vValue ) { |
321 | 321 | |
322 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
322 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
323 | 323 | $_sKey = array_search( $_vValue, $aArray, true ); |
324 | 324 | if ( $_sKey === false ) { |
325 | 325 | continue; |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
343 | 343 | |
344 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
344 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
345 | 345 | unset( $aArray[ $_isKey ] ); |
346 | 346 | } |
347 | 347 | return $aArray; |