@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | final class AdminPageFramework_Registry extends AdminPageFramework_Registry_Base { |
56 | 56 | |
57 | 57 | const TEXT_DOMAIN = 'admin-page-framework'; |
58 | - const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
58 | + const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Indicates whether the framework is loaded from the minified version or not. |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * Sets up static properties. |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - static public function setUp( $sFilePath=__FILE__ ) { |
|
101 | + static public function setUp( $sFilePath = __FILE__ ) { |
|
102 | 102 | |
103 | 103 | self::$sFilePath = $sFilePath; |
104 | 104 | self::$sDirPath = dirname( self::$sFilePath ); |
105 | 105 | self::$sFileURI = plugins_url( '', self::$sFilePath ); |
106 | - self::$sIncludeClassListPath = self::$sDirPath . '/admin-page-framework-include-class-list.php'; |
|
106 | + self::$sIncludeClassListPath = self::$sDirPath.'/admin-page-framework-include-class-list.php'; |
|
107 | 107 | self::$aClassFiles = self::_getClassFilePathList( self::$sIncludeClassListPath ); |
108 | 108 | self::$sAutoLoaderPath = isset( self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] ) |
109 | 109 | ? self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return array |
118 | 118 | */ |
119 | 119 | static private function _getClassFilePathList( $sInclusionClassListPath ) { |
120 | - $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
120 | + $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
121 | 121 | include( $sInclusionClassListPath ); |
122 | 122 | return $aClassFiles; |
123 | 123 | } |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | */ |
131 | 131 | static public function getVersion() { |
132 | 132 | |
133 | - if ( ! isset( self::$sAutoLoaderPath ) ) { |
|
134 | - trigger_error( 'Admin Page Framework: ' . ' : ' . sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
133 | + if ( !isset( self::$sAutoLoaderPath ) ) { |
|
134 | + trigger_error( 'Admin Page Framework: '.' : '.sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
135 | 135 | return self::VERSION; |
136 | 136 | } |
137 | 137 | $_aMinifiedVesionSuffix = array( |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | */ |
180 | 180 | final class AdminPageFramework_Bootstrap { |
181 | 181 | |
182 | - public function __construct( $sLibraryPath=__FILE__ ) { |
|
182 | + public function __construct( $sLibraryPath = __FILE__ ) { |
|
183 | 183 | |
184 | - if ( ! $this->_isLoadable() ) { |
|
184 | + if ( !$this->_isLoadable() ) { |
|
185 | 185 | return; |
186 | 186 | } |
187 | 187 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
7 | 7 | * |
8 | 8 | */ |
9 | -if ( ! class_exists( 'AdminPageFramework_NetworkAdmin_Documentation' ) ) : |
|
9 | +if ( !class_exists( 'AdminPageFramework_NetworkAdmin_Documentation' ) ) : |
|
10 | 10 | /** |
11 | 11 | * Provides an abstract base to create admin pages in the network admin area. |
12 | 12 | * |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @since 3.6.0 |
23 | 23 | */ |
24 | - public $aData = array(); |
|
24 | + public $aData = array(); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Stores the defaulte values. |
28 | 28 | */ |
29 | - public $aDefault = array(); |
|
29 | + public $aDefault = array(); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sets up properties. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $_aKeys = func_get_args() + array( null ); |
55 | 55 | |
56 | 56 | // If no key is specified, return the whole array. |
57 | - if ( ! isset( $_aKeys[ 0 ] ) ) { |
|
57 | + if ( !isset( $_aKeys[ 0 ] ) ) { |
|
58 | 58 | return $this->uniteArrays( |
59 | 59 | $this->aData, |
60 | 60 | $this->aDefault |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | |
70 | 70 | // Now either the section ID or field ID is given. |
71 | 71 | return $this->getArrayValueByArrayKeys( |
72 | - $this->aData, // subject array |
|
73 | - $_aKeys, // dimensional keys |
|
72 | + $this->aData, // subject array |
|
73 | + $_aKeys, // dimensional keys |
|
74 | 74 | $this->getDefaultValue( // default value |
75 | 75 | $_mDefault, |
76 | 76 | $_aKeys |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function set( /* $asKeys, $mValue */ ) { |
100 | 100 | |
101 | - $_aParameters = func_get_args(); |
|
102 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
101 | + $_aParameters = func_get_args(); |
|
102 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | $_asKeys = $_aParameters[ 0 ]; |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
125 | 125 | |
126 | - $_aParameters = func_get_args(); |
|
127 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
126 | + $_aParameters = func_get_args(); |
|
127 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | $_asKeys = $_aParameters[ 0 ]; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @remark An alias of the dumpArray() method. |
27 | 27 | * @since 3.2.0 |
28 | 28 | */ |
29 | - static public function dump( $asArray, $sFilePath=null ) { |
|
29 | + static public function dump( $asArray, $sFilePath = null ) { |
|
30 | 30 | echo self::get( $asArray, $sFilePath ); |
31 | 31 | } |
32 | 32 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @since unknown |
38 | 38 | * @deprecated 3.2.0 |
39 | 39 | */ |
40 | - static public function dumpArray( $asArray, $sFilePath=null ) { |
|
40 | + static public function dumpArray( $asArray, $sFilePath = null ) { |
|
41 | 41 | self::dump( $asArray, $sFilePath ); |
42 | 42 | } |
43 | 43 | |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @remark An alias of getArray() method. |
50 | 50 | * @since 3.2.0 |
51 | 51 | */ |
52 | - static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
|
52 | + static public function get( $asArray, $sFilePath = null, $bEscape = true ) { |
|
53 | 53 | |
54 | 54 | if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
55 | 55 | |
56 | 56 | return $bEscape |
57 | - ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
57 | + ? "<pre class='dump-array'>".htmlspecialchars( self::getAsString( $asArray ) )."</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
58 | 58 | : self::getAsString( $asArray ); // non-escape is used for exporting data into file. |
59 | 59 | |
60 | 60 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @since 3.0.0 Changed the $bEncloseInTag parameter to bEscape. |
68 | 68 | * @deprecated` 3.2.0 |
69 | 69 | */ |
70 | - static public function getArray( $asArray, $sFilePath=null, $bEscape=true ) { |
|
70 | + static public function getArray( $asArray, $sFilePath = null, $bEscape = true ) { |
|
71 | 71 | return self::get( $asArray, $sFilePath, $bEscape ); |
72 | 72 | } |
73 | 73 | |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | * @param string $sFilePath The log file path. |
84 | 84 | * @return void |
85 | 85 | **/ |
86 | - static public function log( $mValue, $sFilePath=null ) { |
|
86 | + static public function log( $mValue, $sFilePath = null ) { |
|
87 | 87 | |
88 | 88 | static $_fPreviousTimeStamp = 0; |
89 | 89 | |
90 | 90 | $_oCallerInfo = debug_backtrace(); |
91 | 91 | $_sCallerFunction = self::getElement( |
92 | - $_oCallerInfo, // subject array |
|
92 | + $_oCallerInfo, // subject array |
|
93 | 93 | array( 1, 'function' ), // key |
94 | 94 | '' // default |
95 | 95 | ); |
96 | - $_sCallerClass = self::getElement( |
|
97 | - $_oCallerInfo, // subject array |
|
96 | + $_sCallerClass = self::getElement( |
|
97 | + $_oCallerInfo, // subject array |
|
98 | 98 | array( 1, 'class' ), // key |
99 | 99 | '' // default |
100 | 100 | ); |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | self::_getLogFilePath( $sFilePath, $_sCallerClass ), |
105 | 105 | self::_getLogHeadingLine( |
106 | 106 | $_fCurrentTimeStamp, |
107 | - round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
107 | + round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
108 | 108 | $_sCallerClass, |
109 | 109 | $_sCallerFunction |
110 | - ) . PHP_EOL |
|
110 | + ).PHP_EOL |
|
111 | 111 | . self::_getLogContents( $mValue ), |
112 | 112 | FILE_APPEND |
113 | 113 | ); |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | return $sFilePath; |
128 | 128 | } |
129 | 129 | if ( true === $sFilePath ) { |
130 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . date( "Ymd" ) . '.log'; |
|
130 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.date( "Ymd" ).'.log'; |
|
131 | 131 | } |
132 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . $sCallerClass . '_' . date( "Ymd" ) . '.log'; |
|
132 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.$sCallerClass.'_'.date( "Ymd" ).'.log'; |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | /** |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | $_iLengths = self::_getValueLength( $mValue, $_sType ); |
145 | 145 | return '(' |
146 | 146 | . $_sType |
147 | - . ( null !== $_iLengths ? ', length: ' . $_iLengths : '' ) |
|
147 | + . ( null !== $_iLengths ? ', length: '.$_iLengths : '' ) |
|
148 | 148 | . ') ' |
149 | 149 | . self::getAsString( $mValue ) |
150 | - . PHP_EOL . PHP_EOL; |
|
150 | + . PHP_EOL.PHP_EOL; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | /** |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | $_nMicroseconds = str_pad( round( ( $_nNow - floor( $_nNow ) ) * 10000 ), 4, '0' ); |
189 | 189 | |
190 | 190 | $_aOutput = array( |
191 | - date( "Y/m/d H:i:s", $_nNow ) . '.' . $_nMicroseconds, |
|
191 | + date( "Y/m/d H:i:s", $_nNow ).'.'.$_nMicroseconds, |
|
192 | 192 | self::_getFormattedElapsedTime( $nElapsed ), |
193 | 193 | $_iPageLoadID, |
194 | 194 | AdminPageFramework_Registry::getVersion(), |
195 | - $sCallerClass . '::' . $sCallerFunction, |
|
195 | + $sCallerClass.'::'.$sCallerFunction, |
|
196 | 196 | current_filter(), |
197 | 197 | self::getCurrentURL(), |
198 | 198 | ); |
@@ -210,22 +210,22 @@ discard block |
||
210 | 210 | $_aElapsedParts = explode( ".", ( string ) $nElapsed ); |
211 | 211 | $_sElapsedFloat = str_pad( |
212 | 212 | self::getElement( |
213 | - $_aElapsedParts, // subject array |
|
213 | + $_aElapsedParts, // subject array |
|
214 | 214 | 1, // key |
215 | 215 | 0 // default |
216 | 216 | ), |
217 | 217 | 3, |
218 | 218 | '0' |
219 | 219 | ); |
220 | - $_sElapsed = self::getElement( |
|
221 | - $_aElapsedParts, // subject array |
|
222 | - 0, // key |
|
220 | + $_sElapsed = self::getElement( |
|
221 | + $_aElapsedParts, // subject array |
|
222 | + 0, // key |
|
223 | 223 | 0 // default |
224 | 224 | ); |
225 | - $_sElapsed = strlen( $_sElapsed ) > 1 |
|
226 | - ? '+' . substr( $_sElapsed, -1, 2 ) |
|
227 | - : ' ' . $_sElapsed; |
|
228 | - return $_sElapsed . '.' . $_sElapsedFloat; |
|
225 | + $_sElapsed = strlen( $_sElapsed ) > 1 |
|
226 | + ? '+'.substr( $_sElapsed, -1, 2 ) |
|
227 | + : ' '.$_sElapsed; |
|
228 | + return $_sElapsed.'.'.$_sElapsedFloat; |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @since 3.0.3 Changed the default log location and file name. |
236 | 236 | * @deprecated 3.1.0 Use the `log()` method instead. |
237 | 237 | */ |
238 | - static public function logArray( $asArray, $sFilePath=null ) { |
|
238 | + static public function logArray( $asArray, $sFilePath = null ) { |
|
239 | 239 | self::log( $asArray, $sFilePath ); |
240 | 240 | } |
241 | 241 | |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @since 3.4.4 |
267 | 267 | */ |
268 | - static public function getSliceByDepth( array $aSubject, $iDepth=0 ) { |
|
268 | + static public function getSliceByDepth( array $aSubject, $iDepth = 0 ) { |
|
269 | 269 | |
270 | 270 | foreach ( $aSubject as $_sKey => $_vValue ) { |
271 | 271 | if ( is_object( $_vValue ) ) { |
272 | 272 | $aSubject[ $_sKey ] = method_exists( $_vValue, '__toString' ) |
273 | 273 | ? ( string ) $_vValue // cast string |
274 | - : get_object_vars( $_vValue ); // convert it to array. |
|
274 | + : get_object_vars( $_vValue ); // convert it to array. |
|
275 | 275 | } |
276 | 276 | if ( is_array( $_vValue ) ) { |
277 | 277 | $_iDepth = $iDepth; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | private $_iLevel; |
40 | 40 | |
41 | - public function __construct( $iLevel=null ) { |
|
41 | + public function __construct( $iLevel = null ) { |
|
42 | 42 | $this->_iLevel = null !== $iLevel |
43 | 43 | ? $iLeevl |
44 | 44 | : error_reporting(); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | private function _getIncluded() { |
58 | 58 | |
59 | 59 | $_aIncluded = array(); |
60 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
60 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
61 | 61 | |
62 | 62 | // This is where we check if a level was used or not |
63 | 63 | if ( $this->_iLevel & $_iLevel ) { |
64 | - $_aIncluded[] = $_iLevel; |
|
64 | + $_aIncluded[ ] = $_iLevel; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | $_aValues = array(); |
76 | 76 | |
77 | 77 | if ( count( $aIncluded ) > $_iAll / 2 ) { |
78 | - $_aValues[] = 'E_ALL'; |
|
79 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
80 | - if ( ! in_array( $_iLevel, $aIncluded ) ) { |
|
81 | - $_aValues[] = $iLevelText; |
|
78 | + $_aValues[ ] = 'E_ALL'; |
|
79 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
80 | + if ( !in_array( $_iLevel, $aIncluded ) ) { |
|
81 | + $_aValues[ ] = $iLevelText; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | return implode( ' & ~', $_aValues ); |
85 | 85 | } |
86 | - foreach( $aIncluded as $_iLevel ) { |
|
87 | - $_aValues[] = $this->_aLevels[ $_iLevel ]; |
|
86 | + foreach ( $aIncluded as $_iLevel ) { |
|
87 | + $_aValues[ ] = $this->_aLevels[ $_iLevel ]; |
|
88 | 88 | } |
89 | 89 | return implode( ' | ', $_aValues ); |
90 | 90 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'is_recursive' => true, |
38 | 38 | 'exclude_dir_paths' => array(), |
39 | 39 | 'exclude_dir_names' => array( 'asset', 'assets', 'css', 'js', 'image', 'images', 'license', 'document', 'documents' ), |
40 | - 'allowed_extensions' => array( 'php', ), // 'inc' |
|
40 | + 'allowed_extensions' => array( 'php',), // 'inc' |
|
41 | 41 | 'include_function' => 'include', |
42 | 42 | 'exclude_class_names' => array( /* 'SomeClass', 'SomeOtherClass' */ ), |
43 | 43 | ); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * </code> |
66 | 66 | * @remark The directory paths set for the 'exclude_dir_paths' option should use the system directory separator. |
67 | 67 | */ |
68 | - function __construct( $asScanDirPaths, array $aOptions=array(), array $aClasses=array() ) { |
|
68 | + function __construct( $asScanDirPaths, array $aOptions = array(), array $aClasses = array() ) { |
|
69 | 69 | |
70 | 70 | $_aOptions = $aOptions + self::$_aStructure_Options; |
71 | 71 | $this->_aClasses = $aClasses + $this->_constructClassArray( $asScanDirPaths, $_aOptions ); |
72 | - $_sIncludeFunciton = in_array( $_aOptions['include_function'], array( 'require', 'require_once', 'include', 'include_once' ) ) |
|
73 | - ? $_aOptions['include_function'] |
|
74 | - : 'include'; // default |
|
72 | + $_sIncludeFunciton = in_array( $_aOptions[ 'include_function' ], array( 'require', 'require_once', 'include', 'include_once' ) ) |
|
73 | + ? $_aOptions[ 'include_function' ] |
|
74 | + : 'include'; // default |
|
75 | 75 | $this->_registerClasses( $_sIncludeFunciton ); |
76 | 76 | |
77 | 77 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | return array(); |
96 | 96 | } |
97 | 97 | $_aFilePaths = array(); |
98 | - foreach( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
98 | + foreach ( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
99 | 99 | if ( realpath( $_sClassDirPath ) ) { |
100 | 100 | $_aFilePaths = array_merge( $this->getFilePaths( $_sClassDirPath, $aSearchOptions ), $_aFilePaths ); |
101 | 101 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | // Store classes in an array. |
105 | 105 | $_aClasses = array(); |
106 | - foreach( $_aFilePaths as $_sFilePath ) { |
|
106 | + foreach ( $_aFilePaths as $_sFilePath ) { |
|
107 | 107 | |
108 | 108 | // Class name without a file extension. |
109 | 109 | $_sClassNameWOExt = pathinfo( $_sFilePath, PATHINFO_FILENAME ); |
110 | - if ( in_array( $_sClassNameWOExt, $aSearchOptions['exclude_class_names'] ) ) { |
|
110 | + if ( in_array( $_sClassNameWOExt, $aSearchOptions[ 'exclude_class_names' ] ) ) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | $_aClasses[ $_sClassNameWOExt ] = $_sFilePath; |
@@ -131,26 +131,26 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function getFilePaths( $sClassDirPath, array $aSearchOptions ) { |
133 | 133 | |
134 | - $sClassDirPath = rtrim( $sClassDirPath, '\\/' ) . DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
135 | - $_aAllowedExtensions = $aSearchOptions['allowed_extensions']; |
|
136 | - $_aExcludeDirPaths = ( array ) $aSearchOptions['exclude_dir_paths']; |
|
137 | - $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
|
134 | + $sClassDirPath = rtrim( $sClassDirPath, '\\/' ).DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
135 | + $_aAllowedExtensions = $aSearchOptions[ 'allowed_extensions' ]; |
|
136 | + $_aExcludeDirPaths = ( array ) $aSearchOptions[ 'exclude_dir_paths' ]; |
|
137 | + $_aExcludeDirNames = ( array ) $aSearchOptions[ 'exclude_dir_names' ]; |
|
138 | 138 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
139 | 139 | |
140 | 140 | if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
141 | 141 | $_aFilePaths = $_bIsRecursive |
142 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
143 | - : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
142 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
143 | + : ( array ) glob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
144 | 144 | return array_filter( $_aFilePaths ); // drop non-value elements. |
145 | 145 | } |
146 | 146 | |
147 | 147 | // For the Solaris operation system. |
148 | 148 | $_aFilePaths = array(); |
149 | - foreach( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
149 | + foreach ( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
150 | 150 | |
151 | 151 | $__aFilePaths = $_bIsRecursive |
152 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
153 | - : ( array ) glob( $sClassDirPath . '*.' . $__sAllowedExtension ); |
|
152 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
153 | + : ( array ) glob( $sClassDirPath.'*.'.$__sAllowedExtension ); |
|
154 | 154 | |
155 | 155 | $_aFilePaths = array_merge( $__aFilePaths, $_aFilePaths ); |
156 | 156 | |
@@ -162,27 +162,27 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * Constructs the file pattern of the file extension part used for the glob() function with the given file extensions. |
164 | 164 | */ |
165 | - protected function _getGlobPatternExtensionPart( array $aExtensions=array( 'php', 'inc' ) ) { |
|
165 | + protected function _getGlobPatternExtensionPart( array $aExtensions = array( 'php', 'inc' ) ) { |
|
166 | 166 | return empty( $aExtensions ) |
167 | 167 | ? '*' |
168 | - : '{' . implode( ',', $aExtensions ) . '}'; |
|
168 | + : '{'.implode( ',', $aExtensions ).'}'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | 172 | * The recursive version of the glob() function. |
173 | 173 | */ |
174 | - protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
|
174 | + protected function doRecursiveGlob( $sPathPatten, $nFlags = 0, array $aExcludeDirs = array(), array $aExcludeDirNames = array() ) { |
|
175 | 175 | |
176 | 176 | $_aFiles = glob( $sPathPatten, $nFlags ); |
177 | 177 | $_aFiles = is_array( $_aFiles ) ? $_aFiles : array(); // glob() can return false. |
178 | - $_aDirs = glob( dirname( $sPathPatten ) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR|GLOB_NOSORT ); |
|
178 | + $_aDirs = glob( dirname( $sPathPatten ).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR | GLOB_NOSORT ); |
|
179 | 179 | $_aDirs = is_array( $_aDirs ) ? $_aDirs : array(); |
180 | 180 | foreach ( $_aDirs as $_sDirPath ) { |
181 | 181 | |
182 | 182 | if ( in_array( $_sDirPath, $aExcludeDirs ) ) { continue; } |
183 | 183 | if ( in_array( pathinfo( $_sDirPath, PATHINFO_DIRNAME ), $aExcludeDirNames ) ) { continue; } |
184 | 184 | |
185 | - $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath . DIRECTORY_SEPARATOR . basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
185 | + $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath.DIRECTORY_SEPARATOR.basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | return $_aFiles; |
@@ -196,25 +196,25 @@ discard block |
||
196 | 196 | * |
197 | 197 | */ |
198 | 198 | protected function _registerClasses( $sIncludeFunction ) { |
199 | - spl_autoload_register( array( $this, '_replyToAutoLoad_' . $sIncludeFunction ) ); |
|
199 | + spl_autoload_register( array( $this, '_replyToAutoLoad_'.$sIncludeFunction ) ); |
|
200 | 200 | } |
201 | 201 | /** |
202 | 202 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
203 | 203 | */ |
204 | 204 | public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
205 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
205 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
206 | 206 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
207 | 207 | } |
208 | 208 | public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
209 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
209 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
210 | 210 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
211 | 211 | } |
212 | 212 | public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
213 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
213 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
214 | 214 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
215 | 215 | } |
216 | 216 | public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
217 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
217 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
|
218 | 218 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
219 | 219 | } |
220 | 220 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @since 3.6.3 |
24 | 24 | * @return string The captured output buffer. |
25 | 25 | */ |
26 | - static public function getOutputBuffer( $oCallable, array $aParameters=array() ) { |
|
26 | + static public function getOutputBuffer( $oCallable, array $aParameters = array() ) { |
|
27 | 27 | |
28 | 28 | ob_start(); |
29 | 29 | echo call_user_func_array( $oCallable, $aParameters ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return integer |
48 | 48 | * @internal |
49 | 49 | */ |
50 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
50 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
51 | 51 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
52 | 52 | ? $a[ $sKey ] - $b[ $sKey ] |
53 | 53 | : 1; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $_iCount = count( get_object_vars( $oInstance ) ); |
67 | 67 | $_sClassName = get_class( $oInstance ); |
68 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
68 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @since 3.1.1 |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
81 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
82 | 82 | return is_numeric( $sLength ) |
83 | - ? $sLength . $sUnit |
|
83 | + ? $sLength.$sUnit |
|
84 | 84 | : $sLength; |
85 | 85 | } |
86 | 86 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | */ |
105 | 105 | static public function getInlineCSS( array $aCSSRules ) { |
106 | 106 | $_aOutput = array(); |
107 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
108 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
107 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
108 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
109 | 109 | } |
110 | 110 | return implode( '; ', $_aOutput ); |
111 | 111 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | static public function getStyleAttribute( $asInlineCSSes ) { |
137 | 137 | |
138 | 138 | $_aCSSRules = array(); |
139 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
139 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
140 | 140 | |
141 | 141 | // For array, store in the container. |
142 | 142 | if ( is_array( $_asCSSRules ) ) { |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | |
147 | 147 | // At this point, it is a string. Break them down to array elements. |
148 | 148 | $__aCSSRules = explode( ';', $_asCSSRules ); |
149 | - foreach( $__aCSSRules as $_sPair ) { |
|
149 | + foreach ( $__aCSSRules as $_sPair ) { |
|
150 | 150 | $_aCSSPair = explode( ':', $_sPair ); |
151 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
151 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
152 | 152 | continue; |
153 | 153 | } |
154 | 154 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | */ |
186 | 186 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
187 | 187 | |
188 | - $_aClasses = array(); |
|
189 | - foreach( func_get_args() as $_asClasses ) { |
|
190 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
188 | + $_aClasses = array(); |
|
189 | + foreach ( func_get_args() as $_asClasses ) { |
|
190 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
191 | 191 | continue; |
192 | 192 | } |
193 | 193 | $_aClasses = array_merge( |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | : explode( ' ', $_asClasses ) |
198 | 198 | ); |
199 | 199 | } |
200 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
200 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
201 | 201 | |
202 | 202 | // @todo examine if it is okay to remove the trim() function below. |
203 | 203 | return trim( implode( ' ', $_aClasses ) ); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
214 | 214 | $_aParams = func_get_args(); |
215 | 215 | return call_user_func_array( |
216 | - array( __CLASS__ , 'getClassAttribute' ), |
|
216 | + array( __CLASS__, 'getClassAttribute' ), |
|
217 | 217 | $_aParams |
218 | 218 | ); |
219 | 219 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | static public function getDataAttributeArray( array $aArray ) { |
228 | 228 | |
229 | 229 | $_aNewArray = array(); |
230 | - foreach( $aArray as $sKey => $v ) { |
|
230 | + foreach ( $aArray as $sKey => $v ) { |
|
231 | 231 | if ( in_array( gettype( $v ), array( 'array', 'object' ) ) ) { |
232 | 232 | continue; |
233 | 233 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields false. |
250 | 250 | * @return mixed |
251 | 251 | */ |
252 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
252 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
253 | 253 | return $mValue ? $mTrue : $mFalse; |
254 | 254 | } |
255 | 255 |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
33 | 33 | * @deprecated 3.5.3 Use `getElement()`. |
34 | 34 | */ |
35 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
35 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault = '', $bBlankToDefault = false ) { |
|
36 | 36 | |
37 | 37 | // If $vSubject is null, |
38 | - if ( ! isset( $vSubject ) ) { return $sDefault; } |
|
38 | + if ( !isset( $vSubject ) ) { return $sDefault; } |
|
39 | 39 | |
40 | 40 | // If the $bBlankToDefault flag is set and the subject value is a blank string, return the default value. |
41 | 41 | if ( $bBlankToDefault && $vSubject == '' ) { return $sDefault; } |
42 | 42 | |
43 | 43 | // If $vSubject is not an array, |
44 | - if ( ! is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
44 | + if ( !is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
45 | 45 | |
46 | 46 | // Consider $vSubject as array. |
47 | 47 | if ( isset( $vSubject[ $sKey ] ) ) { return $vSubject[ $sKey ]; } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @since 3.5.3 Moved from `AdminPageFramework_FieldType_Base`. |
87 | 87 | * @deprecated 3.5.3 Use the `getElement()` method. |
88 | 88 | */ |
89 | - protected function getFieldElementByKey( $asElement, $sKey, $asDefault='' ) { |
|
89 | + protected function getFieldElementByKey( $asElement, $sKey, $asDefault = '' ) { |
|
90 | 90 | |
91 | - if ( ! is_array( $asElement ) || ! isset( $sKey ) ) { return $asElement; } |
|
91 | + if ( !is_array( $asElement ) || !isset( $sKey ) ) { return $asElement; } |
|
92 | 92 | |
93 | 93 | $aElements = &$asElement; // it is an array |
94 | 94 | return isset( $aElements[ $sKey ] ) |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | static public function shiftTillTrue( array $aArray ) { |
109 | 109 | |
110 | - foreach( $aArray as &$vElem ) { |
|
110 | + foreach ( $aArray as &$vElem ) { |
|
111 | 111 | |
112 | 112 | if ( $vElem ) { break; } |
113 | 113 | unset( $vElem ); |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | */ |
140 | 140 | static public function getAttributes( array $aAttributes ) { |
141 | 141 | |
142 | - $_sQuoteCharactor ="'"; |
|
142 | + $_sQuoteCharactor = "'"; |
|
143 | 143 | $_aOutput = array(); |
144 | - foreach( $aAttributes as $sAttribute => $sProperty ) { |
|
144 | + foreach ( $aAttributes as $sAttribute => $sProperty ) { |
|
145 | 145 | |
146 | 146 | // Must be resolved as a string. |
147 | 147 | if ( in_array( gettype( $sProperty ), array( 'array', 'object' ) ) ) { |
148 | 148 | continue; |
149 | 149 | } |
150 | - $_aOutput[] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
150 | + $_aOutput[ ] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | return implode( ' ', $_aOutput ); |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | * @param integer $iLines The number of lines to read. |
29 | 29 | * @return string |
30 | 30 | */ |
31 | - static public function getFileTailContents( $asPath=array(), $iLines=1 ) { |
|
31 | + static public function getFileTailContents( $asPath = array(), $iLines = 1 ) { |
|
32 | 32 | |
33 | - $_sPath = self::_getFirstItem( $asPath ); |
|
34 | - if ( ! @is_readable( $_sPath ) ) { |
|
33 | + $_sPath = self::_getFirstItem( $asPath ); |
|
34 | + if ( !@is_readable( $_sPath ) ) { |
|
35 | 35 | return ''; |
36 | 36 | } |
37 | 37 | return trim( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @since 3.4.6 |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - static public function sanitizeFileName( $sFileName, $sReplacement='_' ) { |
|
64 | + static public function sanitizeFileName( $sFileName, $sReplacement = '_' ) { |
|
65 | 65 | |
66 | 66 | // Remove anything which isn't a word, white space, number |
67 | 67 | // or any of the following characters -_~,;:[](). |