@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @internal |
123 | 123 | * @param string $sInputID The input ID that will be the base of each generated option tag ID. |
124 | 124 | * @param array $aLabels The array holding labels. |
125 | - * @param array $aAttributes The attribute arrays. Accepts the following arguments. |
|
125 | + * @param array $aBaseAttributes The attribute arrays. Accepts the following arguments. |
|
126 | 126 | * - optgroup |
127 | 127 | * - option |
128 | 128 | */ |
@@ -160,6 +160,7 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * Returns an HTML output of optgroup tag. |
162 | 162 | * @since 3.5.3 |
163 | + * @param string $sInputID |
|
163 | 164 | * @return string an HTML output of optgroup tag. |
164 | 165 | */ |
165 | 166 | private function _getOptGroup( array $aBaseAttributes, $sInputID, $sKey, $asLabel ) { |
@@ -179,6 +180,7 @@ discard block |
||
179 | 180 | /** |
180 | 181 | * |
181 | 182 | * @since 3.5.3 |
183 | + * @param string $sInputID |
|
182 | 184 | */ |
183 | 185 | private function _getOptionTagAttributes( array $aBaseAttributes, $sInputID, $sKey, $aValues ) { |
184 | 186 |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | // For backward compatibility. |
45 | 45 | |
46 | 46 | // If the $aField property is set, extract certain elements from it and set them to the attribute array. |
47 | - if ( isset( $this->aField['is_multiple'] ) ) { |
|
48 | - $this->aAttributes['select']['multiple'] = $this->aField['is_multiple'] |
|
47 | + if ( isset( $this->aField[ 'is_multiple' ] ) ) { |
|
48 | + $this->aAttributes[ 'select' ][ 'multiple' ] = $this->aField[ 'is_multiple' ] |
|
49 | 49 | ? 'multiple' |
50 | 50 | : $this->getElement( $this->aAttributes, array( 'select', 'multiple' ) ); |
51 | 51 | } |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | return |
72 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
73 | - . "<select " . $this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) ) . " >" |
|
72 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
73 | + . "<select ".$this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) )." >" |
|
74 | 74 | . $this->_getDropDownList( |
75 | 75 | $this->getAttribute( 'id' ), |
76 | 76 | $this->getAsArray( |
77 | 77 | isset( $_aLabels ) |
78 | 78 | ? $_aLabels |
79 | - : $this->aField['label'], // backward compatibility |
|
79 | + : $this->aField[ 'label' ], // backward compatibility |
|
80 | 80 | true |
81 | 81 | ), |
82 | 82 | $_aAttributes |
83 | 83 | ) |
84 | 84 | . "</select>" |
85 | - . "</{$this->aOptions['input_container_tag']}>" |
|
85 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
86 | 86 | ; |
87 | 87 | |
88 | 88 | } |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | ? 'multiple' |
105 | 105 | : null, |
106 | 106 | 'name' => $_bIsMultiple |
107 | - ? $this->getAttribute( 'name' ) . '[]' |
|
107 | + ? $this->getAttribute( 'name' ).'[]' |
|
108 | 108 | : $this->getAttribute( 'name' ), |
109 | - 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
109 | + 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
110 | 110 | ) |
111 | 111 | ); |
112 | 112 | |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private function _getDropDownList( $sInputID, array $aLabels, array $aBaseAttributes ) { |
130 | 130 | |
131 | - $_aOutput = array(); |
|
132 | - foreach( $aLabels as $__sKey => $__asLabel ) { |
|
131 | + $_aOutput = array(); |
|
132 | + foreach ( $aLabels as $__sKey => $__asLabel ) { |
|
133 | 133 | |
134 | 134 | // For an optgroup tag, |
135 | 135 | if ( is_array( $__asLabel ) ) { |
136 | - $_aOutput[] = $this->_getOptGroup( |
|
136 | + $_aOutput[ ] = $this->_getOptGroup( |
|
137 | 137 | $aBaseAttributes, |
138 | 138 | $sInputID, |
139 | 139 | $__sKey, |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // A normal option tag, |
146 | - $_aOutput[] = $this->_getOptionTag( |
|
147 | - $__asLabel, // the text label the user sees to be selected |
|
146 | + $_aOutput[ ] = $this->_getOptionTag( |
|
147 | + $__asLabel, // the text label the user sees to be selected |
|
148 | 148 | $this->_getOptionTagAttributes( |
149 | 149 | $aBaseAttributes, |
150 | 150 | $sInputID, |
151 | 151 | $__sKey, |
152 | - $this->getAsArray( $aBaseAttributes['value'], true ) |
|
152 | + $this->getAsArray( $aBaseAttributes[ 'value' ], true ) |
|
153 | 153 | ) |
154 | 154 | ); |
155 | 155 | |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function _getOptGroup( array $aBaseAttributes, $sInputID, $sKey, $asLabel ) { |
166 | 166 | |
167 | - $_aOptGroupAttributes = isset( $aBaseAttributes['optgroup'][ $sKey ] ) && is_array( $aBaseAttributes['optgroup'][ $sKey ] ) |
|
168 | - ? $aBaseAttributes['optgroup'][ $sKey ] + $aBaseAttributes['optgroup'] |
|
169 | - : $aBaseAttributes['optgroup']; |
|
167 | + $_aOptGroupAttributes = isset( $aBaseAttributes[ 'optgroup' ][ $sKey ] ) && is_array( $aBaseAttributes[ 'optgroup' ][ $sKey ] ) |
|
168 | + ? $aBaseAttributes[ 'optgroup' ][ $sKey ] + $aBaseAttributes[ 'optgroup' ] |
|
169 | + : $aBaseAttributes[ 'optgroup' ]; |
|
170 | 170 | $_aOptGroupAttributes = array( |
171 | 171 | 'label' => $sKey, |
172 | 172 | ) + $_aOptGroupAttributes; |
173 | - return "<optgroup " . $this->getAttributes( $_aOptGroupAttributes ) . ">" |
|
173 | + return "<optgroup ".$this->getAttributes( $_aOptGroupAttributes ).">" |
|
174 | 174 | . $this->_getDropDownList( $sInputID, $asLabel, $aBaseAttributes ) |
175 | 175 | . "</optgroup>"; |
176 | 176 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | $aValues |
189 | 189 | ); |
190 | 190 | return array( |
191 | - 'id' => $sInputID . '_' . $sKey, |
|
191 | + 'id' => $sInputID.'_'.$sKey, |
|
192 | 192 | 'value' => $sKey, |
193 | 193 | 'selected' => in_array( ( string ) $sKey, $aValues ) |
194 | 194 | ? 'selected' |
195 | 195 | : null, |
196 | - ) + ( isset( $aBaseAttributes['option'][ $sKey ] ) && is_array( $aBaseAttributes['option'][ $sKey ] ) |
|
197 | - ? $aBaseAttributes['option'][ $sKey ] + $aBaseAttributes['option'] |
|
198 | - : $aBaseAttributes['option'] ); |
|
196 | + ) + ( isset( $aBaseAttributes[ 'option' ][ $sKey ] ) && is_array( $aBaseAttributes[ 'option' ][ $sKey ] ) |
|
197 | + ? $aBaseAttributes[ 'option' ][ $sKey ] + $aBaseAttributes[ 'option' ] |
|
198 | + : $aBaseAttributes[ 'option' ] ); |
|
199 | 199 | |
200 | 200 | } |
201 | 201 | |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @sicne 3.4.0 |
205 | 205 | * @return string The generated option tag HTML output. |
206 | 206 | */ |
207 | - private function _getOptionTag( $sLabel, array $aOptionTagAttributes=array() ) { |
|
208 | - return "<option " . $this->getAttributes( $aOptionTagAttributes ) . " >" |
|
207 | + private function _getOptionTag( $sLabel, array $aOptionTagAttributes = array() ) { |
|
208 | + return "<option ".$this->getAttributes( $aOptionTagAttributes )." >" |
|
209 | 209 | . $sLabel |
210 | 210 | . "</option>"; |
211 | 211 | } |
@@ -170,6 +170,7 @@ |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * The recursive version of the glob() function. |
173 | + * @param string $sPathPatten |
|
173 | 174 | */ |
174 | 175 | protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
175 | 176 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * Helps to set up auto-load classes. |
|
6 | - * |
|
7 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
8 | - * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
9 | - * |
|
10 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * Helps to set up auto-load classes. |
|
6 | + * |
|
7 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
8 | + * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
9 | + * |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Registers classes in the given directory to be auto-loaded. |
@@ -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 |
@@ -137,7 +137,8 @@ discard block |
||
137 | 137 | $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
138 | 138 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
139 | 139 | |
140 | - if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
|
140 | + if ( defined( 'GLOB_BRACE' ) ) { |
|
141 | +// in some OSes this flag constant is not available. |
|
141 | 142 | $_aFilePaths = $_bIsRecursive |
142 | 143 | ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
143 | 144 | : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
@@ -201,19 +202,19 @@ discard block |
||
201 | 202 | /** |
202 | 203 | * 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 | 204 | */ |
204 | - public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
205 | + public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
205 | 206 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
206 | 207 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
207 | 208 | } |
208 | - public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
209 | + public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
209 | 210 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
210 | 211 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
211 | 212 | } |
212 | - public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
213 | + public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
213 | 214 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
214 | 215 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
215 | 216 | } |
216 | - public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
217 | + public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
217 | 218 | if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { return; } |
218 | 219 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
219 | 220 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Converts non-alphabetic characters to underscore. |
22 | 22 | * |
23 | 23 | * @since 2.0.0 |
24 | - * @return string|null The sanitized string. |
|
24 | + * @return string The sanitized string. |
|
25 | 25 | * @todo Change the method name as it does not tell for what it will sanitized. |
26 | 26 | * @todo Examine why null needs to be returned. |
27 | 27 | */ |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * Returns the given string length. |
92 | 92 | * @since 3.3.0 |
93 | - * @return integer|null Null if an array is given. |
|
93 | + * @return integer Null if an array is given. |
|
94 | 94 | */ |
95 | 95 | static public function getStringLength( $sString ) { |
96 | 96 | return function_exists( 'mb_strlen' ) |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @since 2.0.0 |
57 | 57 | * @return string|integer A numeric value will be returned. |
58 | 58 | */ |
59 | - static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
59 | + static public function fixNumber( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
60 | 60 | |
61 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
61 | + if ( !is_numeric( trim( $nToFix ) ) ) { |
|
62 | 62 | return $nDefault; |
63 | 63 | } |
64 | 64 | if ( $nMin !== '' && $nToFix < $nMin ) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | static public function minifyCSS( $sCSSRules ) { |
81 | 81 | |
82 | 82 | return str_replace( |
83 | - array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' '), // remove line breaks, tab, and white sspaces. |
|
83 | + array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), // remove line breaks, tab, and white sspaces. |
|
84 | 84 | '', |
85 | 85 | preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $sCSSRules ) // remove comments |
86 | 86 | ); |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | */ |
106 | 106 | static public function getNumberOfReadableSize( $nSize ) { |
107 | 107 | |
108 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
109 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
108 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
109 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
110 | 110 | case 'P': |
111 | 111 | $_nReturn *= 1024; |
112 | 112 | case 'T': |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $_nLog = log( $nBytes, 1024 ); |
133 | 133 | $_iPower = ( int ) $_nLog; |
134 | 134 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
135 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
135 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -58,13 +58,13 @@ |
||
58 | 58 | */ |
59 | 59 | static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
60 | 60 | |
61 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
61 | + if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
62 | 62 | return $nDefault; |
63 | 63 | } |
64 | - if ( $nMin !== '' && $nToFix < $nMin ) { |
|
64 | + if ( $nMin !== '' && $nToFix < $nMin ) { |
|
65 | 65 | return $nMin; |
66 | 66 | } |
67 | - if ( $nMax !== '' && $nToFix > $nMax ) { |
|
67 | + if ( $nMax !== '' && $nToFix > $nMax ) { |
|
68 | 68 | return $nMax; |
69 | 69 | } |
70 | 70 | return $nToFix; |
@@ -95,7 +95,7 @@ |
||
95 | 95 | * Returns an array of constants. |
96 | 96 | * |
97 | 97 | * @since 3.4.6 |
98 | - * @param array|string $asCategory The category key names of the returning array. |
|
98 | + * @param array|string $asCategories The category key names of the returning array. |
|
99 | 99 | */ |
100 | 100 | static public function getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) { |
101 | 101 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $_sOutput = preg_replace( |
42 | 42 | array( |
43 | 43 | '#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', |
44 | - '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
44 | + '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
45 | 45 | "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', |
46 | 46 | '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>' |
47 | 47 | .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#', |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | '#</tr>#' |
53 | 53 | ), |
54 | 54 | array( |
55 | - '$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', |
|
55 | + '$1', '', '', '', '</$1>'."\n", '<', ' ', ' ', ' ', '', ' ', |
|
56 | 56 | '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'. |
57 | 57 | "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>', |
58 | 58 | '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', |
59 | - '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . '<tr><td>Zend Egg</td><td>$1</td></tr>', |
|
59 | + '<tr><td>Zend Engine</td><td>$2</td></tr>'."\n".'<tr><td>Zend Egg</td><td>$1</td></tr>', |
|
60 | 60 | ' ', |
61 | 61 | '%S%', |
62 | 62 | '%E%' |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | unset( $_aSections[ 0 ] ); |
69 | 69 | |
70 | 70 | $_aOutput = array(); |
71 | - foreach( $_aSections as $_sSection ) { |
|
71 | + foreach ( $_aSections as $_sSection ) { |
|
72 | 72 | $_iIndex = substr( $_sSection, 0, strpos( $_sSection, '</h2>' ) ); |
73 | 73 | preg_match_all( |
74 | 74 | '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | $_aAskApache, |
77 | 77 | PREG_SET_ORDER |
78 | 78 | ); |
79 | - foreach( $_aAskApache as $_aMatches ) { |
|
80 | - if ( ! isset( $_aMatches[ 1 ], $_aMatches[ 2 ] ) ) { |
|
79 | + foreach ( $_aAskApache as $_aMatches ) { |
|
80 | + if ( !isset( $_aMatches[ 1 ], $_aMatches[ 2 ] ) ) { |
|
81 | 81 | array_slice( $_aMatches, 2 ); |
82 | 82 | continue; |
83 | 83 | } |
84 | - $_aOutput[ $_iIndex ][ $_aMatches[ 1 ] ] = ! isset( $_aMatches[ 3 ] ) || $_aMatches[ 2 ] == $_aMatches[ 3 ] |
|
84 | + $_aOutput[ $_iIndex ][ $_aMatches[ 1 ] ] = !isset( $_aMatches[ 3 ] ) || $_aMatches[ 2 ] == $_aMatches[ 3 ] |
|
85 | 85 | ? $_aMatches[ 2 ] |
86 | 86 | : array_slice( $_aMatches, 2 ); |
87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @since 3.4.6 |
98 | 98 | * @param array|string $asCategory The category key names of the returning array. |
99 | 99 | */ |
100 | - static public function getDefinedConstants( $asCategories=null, $asRemovingCategories=null ) { |
|
100 | + static public function getDefinedConstants( $asCategories = null, $asRemovingCategories = null ) { |
|
101 | 101 | |
102 | 102 | $_aCategories = is_array( $asCategories ) ? $asCategories : array( $asCategories ); |
103 | 103 | $_aCategories = array_filter( $_aCategories ); |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | static public function getPHPErrorLogPath() { |
125 | 125 | |
126 | 126 | $_aPHPInfo = self::getPHPInfo(); |
127 | - return isset( $_aPHPInfo['PHP Core']['error_log'] ) |
|
128 | - ? $_aPHPInfo['PHP Core']['error_log'] |
|
127 | + return isset( $_aPHPInfo[ 'PHP Core' ][ 'error_log' ] ) |
|
128 | + ? $_aPHPInfo[ 'PHP Core' ][ 'error_log' ] |
|
129 | 129 | : ''; |
130 | 130 | |
131 | 131 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * Returns a PHP error log. |
135 | 135 | * @since 3.4.6 |
136 | 136 | */ |
137 | - static public function getPHPErrorLog( $iLines=1 ) { |
|
137 | + static public function getPHPErrorLog( $iLines = 1 ) { |
|
138 | 138 | |
139 | 139 | $_sLog = self::getFileTailContents( self::getPHPErrorLogPath(), $iLines ); |
140 | 140 |
@@ -23,6 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @since 2.0.0 |
25 | 25 | * @since 3.5.7 Moved from `AdminPageFramework_Utility`. |
26 | + * @param string $sQueryKey |
|
26 | 27 | * @return string|null |
27 | 28 | */ |
28 | 29 | static public function getQueryValueInURLByKey( $sURL, $sQueryKey ) { |
@@ -72,6 +73,7 @@ discard block |
||
72 | 73 | /** |
73 | 74 | * Returns the port suffix in the currently loading url. |
74 | 75 | * @since 3.5.7 |
76 | + * @param boolean $_bSSL |
|
75 | 77 | * @return string |
76 | 78 | */ |
77 | 79 | static private function _getURLPortSuffix( $_bSSL ) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 0 => '', |
53 | 53 | 1 => 's', |
54 | 54 | ); |
55 | - $_sProtocol = substr( $_sServerProtocol, 0, strpos( $_sServerProtocol, '/' ) ) |
|
55 | + $_sProtocol = substr( $_sServerProtocol, 0, strpos( $_sServerProtocol, '/' ) ) |
|
56 | 56 | . $_aProrocolSuffix[ ( int ) $_bSSL ]; |
57 | 57 | |
58 | 58 | // Port: e.g. :80 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | : $_SERVER[ 'SERVER_NAME' ] |
67 | 67 | ); |
68 | 68 | |
69 | - return $_sProtocol . '://' . $_sHost . $_sPort . $_SERVER[ 'REQUEST_URI' ]; |
|
69 | + return $_sProtocol.'://'.$_sHost.$_sPort.$_SERVER[ 'REQUEST_URI' ]; |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | /** |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | ? ( string ) $_SERVER[ 'SERVER_PORT' ] |
80 | 80 | : ''; |
81 | 81 | $_aPort = array( |
82 | - 0 => ':' . $_sPort, |
|
82 | + 0 => ':'.$_sPort, |
|
83 | 83 | 1 => '', |
84 | 84 | ); |
85 | - $_bPortSet = ( ! $_bSSL && '80' === $_sPort ) || ( $_bSSL && '443' === $_sPort ); |
|
85 | + $_bPortSet = ( !$_bSSL && '80' === $_sPort ) || ( $_bSSL && '443' === $_sPort ); |
|
86 | 86 | return $_aPort[ ( int ) $_bPortSet ]; |
87 | 87 | } |
88 | 88 |
@@ -115,6 +115,8 @@ discard block |
||
115 | 115 | * @access public |
116 | 116 | * @since 2.0.0 |
117 | 117 | * @remark Accepts variadic parameters. |
118 | + * @param AdminPageFramework_Factory_Router $oCallerObject |
|
119 | + * @param AdminPageFramework_Factory_Router $vArgs1 |
|
118 | 120 | * @return void |
119 | 121 | */ |
120 | 122 | static public function addAndDoAction( $oCallerObject, $sActionHook, $vArgs1=null, $vArgs2=null, $_and_more=null ) { |
@@ -178,10 +180,6 @@ discard block |
||
178 | 180 | * ` |
179 | 181 | * |
180 | 182 | * @since 2.0.0 |
181 | - * @param object $oCallerObject |
|
182 | - * @param string $sFilter The filter hook name. |
|
183 | - * @param mixed $vData The filtering data |
|
184 | - * @param mixed $vArgs The arguments. |
|
185 | 183 | */ |
186 | 184 | static public function addAndApplyFilter( /* $oCallerObject, $sFilter, $vData, $vArgs... */ ) { |
187 | 185 | |
@@ -212,6 +210,7 @@ discard block |
||
212 | 210 | * |
213 | 211 | * @since 2.0.0 |
214 | 212 | * @access public |
213 | + * @param string $sPrefix |
|
215 | 214 | * @return array Returns an array consisting of the filters. |
216 | 215 | */ |
217 | 216 | static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse=false ) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @since 3.4.2 |
27 | 27 | * @todo Create a similar function for filters. |
28 | 28 | */ |
29 | - static public function registerAction( $sActionHook, $oCallable, $iPriority=10 ) { |
|
29 | + static public function registerAction( $sActionHook, $oCallable, $iPriority = 10 ) { |
|
30 | 30 | |
31 | 31 | if ( did_action( $sActionHook ) ) { |
32 | 32 | return call_user_func_array( $oCallable, array() ); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | * @param mixed $_and_more add as many arguments as necessary to the next parameters. |
64 | 64 | * @return void does not return a value. |
65 | 65 | */ |
66 | - static public function doActions( $aActionHooks, $vArgs1=null, $vArgs2=null, $_and_more=null ) { |
|
66 | + static public function doActions( $aActionHooks, $vArgs1 = null, $vArgs2 = null, $_and_more = null ) { |
|
67 | 67 | |
68 | 68 | $aArgs = func_get_args(); |
69 | 69 | $aActionHooks = $aArgs[ 0 ]; |
70 | - foreach( ( array ) $aActionHooks as $sActionHook ) { |
|
70 | + foreach ( ( array ) $aActionHooks as $sActionHook ) { |
|
71 | 71 | $aArgs[ 0 ] = $sActionHook; |
72 | - call_user_func_array( 'do_action' , $aArgs ); |
|
72 | + call_user_func_array( 'do_action', $aArgs ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | } |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | * @param mixed $_and_more add as many arguments as necessary to the next parameters. |
97 | 97 | * @return void |
98 | 98 | */ |
99 | - static public function addAndDoActions( $oCallerObject, $aActionHooks, $vArgs1=null, $vArgs2=null, $_and_more=null ) { |
|
99 | + static public function addAndDoActions( $oCallerObject, $aActionHooks, $vArgs1 = null, $vArgs2 = null, $_and_more = null ) { |
|
100 | 100 | |
101 | 101 | $aArgs = func_get_args(); |
102 | 102 | $oCallerObject = $aArgs[ 0 ]; |
103 | 103 | $aActionHooks = $aArgs[ 1 ]; |
104 | - foreach( ( array ) $aActionHooks as $sActionHook ) { |
|
105 | - if ( ! $sActionHook ) { continue; } |
|
104 | + foreach ( ( array ) $aActionHooks as $sActionHook ) { |
|
105 | + if ( !$sActionHook ) { continue; } |
|
106 | 106 | $aArgs[ 1 ] = $sActionHook; |
107 | - call_user_func_array( array( get_class(), 'addAndDoAction' ) , $aArgs ); |
|
107 | + call_user_func_array( array( get_class(), 'addAndDoAction' ), $aArgs ); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | } |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | * @remark Accepts variadic parameters. |
118 | 118 | * @return void |
119 | 119 | */ |
120 | - static public function addAndDoAction( $oCallerObject, $sActionHook, $vArgs1=null, $vArgs2=null, $_and_more=null ) { |
|
120 | + static public function addAndDoAction( $oCallerObject, $sActionHook, $vArgs1 = null, $vArgs2 = null, $_and_more = null ) { |
|
121 | 121 | |
122 | 122 | $_iArgs = func_num_args(); |
123 | 123 | $_aArgs = func_get_args(); |
124 | 124 | $_oCallerObject = $_aArgs[ 0 ]; |
125 | 125 | $_sActionHook = $_aArgs[ 1 ]; |
126 | - if ( ! $_sActionHook ) { return; } |
|
126 | + if ( !$_sActionHook ) { return; } |
|
127 | 127 | add_action( $_sActionHook, array( $_oCallerObject, $_sActionHook ), 10, $_iArgs - 2 ); |
128 | 128 | array_shift( $_aArgs ); // remove the first element, the caller object |
129 | - call_user_func_array( 'do_action' , $_aArgs ); |
|
129 | + call_user_func_array( 'do_action', $_aArgs ); |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | /** |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | $_aFilters = $_aArgs[ 1 ]; |
154 | 154 | $_vInput = $_aArgs[ 2 ]; |
155 | 155 | |
156 | - foreach( ( array ) $_aFilters as $_sFilter ) { |
|
157 | - if ( ! $_sFilter ) { continue; } |
|
156 | + foreach ( ( array ) $_aFilters as $_sFilter ) { |
|
157 | + if ( !$_sFilter ) { continue; } |
|
158 | 158 | $_aArgs[ 1 ] = $_sFilter; |
159 | - $_aArgs[ 2 ] = $_vInput; // assigns the updated value as it is filtered in previous iterations |
|
159 | + $_aArgs[ 2 ] = $_vInput; // assigns the updated value as it is filtered in previous iterations |
|
160 | 160 | $_vInput = call_user_func_array( |
161 | 161 | array( get_class(), 'addAndApplyFilter' ), |
162 | 162 | $_aArgs |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $_aArgs = func_get_args(); |
191 | 191 | $_oCallerObject = $_aArgs[ 0 ]; |
192 | 192 | $_sFilter = $_aArgs[ 1 ]; |
193 | - if ( ! $_sFilter ) { |
|
193 | + if ( !$_sFilter ) { |
|
194 | 194 | return $_aArgs[ 2 ]; |
195 | 195 | } |
196 | 196 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | add_filter( $_sFilter, array( $_oCallerObject, $_sFilter ), 10, $_iArgs - 2 ); |
199 | 199 | |
200 | 200 | // Remove the first element, the caller object |
201 | - array_shift( $_aArgs ); // removes the caller object |
|
201 | + array_shift( $_aArgs ); // removes the caller object |
|
202 | 202 | |
203 | 203 | // Trigger the magic method __call(). |
204 | 204 | return call_user_func_array( 'apply_filters', $_aArgs ); // $_aArgs: $vData, $vArgs... |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | * @access public |
215 | 215 | * @return array Returns an array consisting of the filters. |
216 | 216 | */ |
217 | - static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse=false ) { |
|
217 | + static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse = false ) { |
|
218 | 218 | |
219 | 219 | $_aFilters = array(); |
220 | 220 | if ( $sTabSlug && $sPageSlug ) { |
221 | - $_aFilters[] = "{$sPrefix}{$sPageSlug}_{$sTabSlug}"; |
|
221 | + $_aFilters[ ] = "{$sPrefix}{$sPageSlug}_{$sTabSlug}"; |
|
222 | 222 | } |
223 | 223 | if ( $sPageSlug ) { |
224 | - $_aFilters[] = "{$sPrefix}{$sPageSlug}"; |
|
224 | + $_aFilters[ ] = "{$sPrefix}{$sPageSlug}"; |
|
225 | 225 | } |
226 | 226 | if ( $sClassName ) { |
227 | - $_aFilters[] = "{$sPrefix}{$sClassName}"; |
|
227 | + $_aFilters[ ] = "{$sPrefix}{$sClassName}"; |
|
228 | 228 | } |
229 | 229 | return $bReverse |
230 | 230 | ? array_reverse( $_aFilters ) |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @since 2.0.0 |
148 | 148 | */ |
149 | - static public function addAndApplyFilters( /* $oCallerObject, $aFilters, $vInput, $vArgs... */ ) { |
|
149 | + static public function addAndApplyFilters( /* $oCallerObject, $aFilters, $vInput, $vArgs... */ ) { |
|
150 | 150 | |
151 | 151 | $_aArgs = func_get_args(); |
152 | 152 | // $oCallerObject = $_aArgs[ 0 ]; |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | * @param mixed $vData The filtering data |
184 | 184 | * @param mixed $vArgs The arguments. |
185 | 185 | */ |
186 | - static public function addAndApplyFilter( /* $oCallerObject, $sFilter, $vData, $vArgs... */ ) { |
|
186 | + static public function addAndApplyFilter( /* $oCallerObject, $sFilter, $vData, $vArgs... */ ) { |
|
187 | 187 | |
188 | 188 | // Parameters |
189 | 189 | $_iArgs = func_num_args(); |
190 | 190 | $_aArgs = func_get_args(); |
191 | 191 | $_oCallerObject = $_aArgs[ 0 ]; |
192 | 192 | $_sFilter = $_aArgs[ 1 ]; |
193 | - if ( ! $_sFilter ) { |
|
193 | + if ( ! $_sFilter ) { |
|
194 | 194 | return $_aArgs[ 2 ]; |
195 | 195 | } |
196 | 196 |
@@ -284,6 +284,7 @@ |
||
284 | 284 | * Checkes whether the passed base url name is of the admin index page. |
285 | 285 | * @since 3.5.3 |
286 | 286 | * return boolean Whether the passed base url name is of the admin index page. |
287 | + * @param string $sPageNow |
|
287 | 288 | */ |
288 | 289 | static private function _isInAdminIndex( $sPageNow ) { |
289 | 290 | return in_array( |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'getPostTypeByTypeNow', |
57 | 57 | 'getPostTypeByScreenObject', |
58 | 58 | 'getPostTypeByREQUEST', |
59 | - 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
59 | + 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
60 | 60 | ); |
61 | 61 | foreach ( $_aMethodsToTry as $_sMethodName ) { |
62 | 62 | $_sPostType = call_user_func( array( __CLASS__, $_sMethodName ) ); |
@@ -75,28 +75,28 @@ discard block |
||
75 | 75 | * @since 3.5.3 |
76 | 76 | */ |
77 | 77 | static public function getPostTypeByTypeNow() { |
78 | - if ( isset( $GLOBALS['typenow'] ) && $GLOBALS['typenow'] ) { |
|
79 | - return $GLOBALS['typenow']; |
|
78 | + if ( isset( $GLOBALS[ 'typenow' ] ) && $GLOBALS[ 'typenow' ] ) { |
|
79 | + return $GLOBALS[ 'typenow' ]; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | static public function getPostTypeByScreenObject() { |
83 | 83 | if ( |
84 | - isset( $GLOBALS['current_screen']->post_type ) |
|
85 | - && $GLOBALS['current_screen']->post_type |
|
84 | + isset( $GLOBALS[ 'current_screen' ]->post_type ) |
|
85 | + && $GLOBALS[ 'current_screen' ]->post_type |
|
86 | 86 | ) { |
87 | - return $GLOBALS['current_screen']->post_type; |
|
87 | + return $GLOBALS[ 'current_screen' ]->post_type; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | /** |
91 | 91 | * Tries to find the post type from the URL query for type. |
92 | 92 | */ |
93 | 93 | static public function getPostTypeByREQUEST() { |
94 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
95 | - return sanitize_key( $_REQUEST['post_type'] ); |
|
94 | + if ( isset( $_REQUEST[ 'post_type' ] ) ) { |
|
95 | + return sanitize_key( $_REQUEST[ 'post_type' ] ); |
|
96 | 96 | } |
97 | - if ( isset( $_GET['post'] ) && $_GET['post'] ) { |
|
97 | + if ( isset( $_GET[ 'post' ] ) && $_GET[ 'post' ] ) { |
|
98 | 98 | // It will perform a database query. |
99 | - return get_post_type( $_GET['post'] ); |
|
99 | + return get_post_type( $_GET[ 'post' ] ); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | /** |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | */ |
105 | 105 | static public function getPostTypeByPostObject() { |
106 | 106 | if ( |
107 | - isset( $GLOBALS['post'], $GLOBALS['post']->post_type ) |
|
108 | - && $GLOBALS['post']->post_type |
|
107 | + isset( $GLOBALS[ 'post' ], $GLOBALS[ 'post' ]->post_type ) |
|
108 | + && $GLOBALS[ 'post' ]->post_type |
|
109 | 109 | ) { |
110 | - return $GLOBALS['post']->post_type; |
|
110 | + return $GLOBALS[ 'post' ]->post_type; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | /**#@-*/ |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * @param array|string The post type slug(s) to check. If this is empty, the method just checks the current page is a taxonomy page. |
120 | 120 | * @return boolean |
121 | 121 | */ |
122 | - static public function isCustomTaxonomyPage( $asPostTypes=array() ) { |
|
122 | + static public function isCustomTaxonomyPage( $asPostTypes = array() ) { |
|
123 | 123 | |
124 | - if ( ! in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', ) ) ) { |
|
124 | + if ( !in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php',) ) ) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | * Otherwise, it will check if the page belongs to the given post type(s). |
137 | 137 | * @return boolean |
138 | 138 | */ |
139 | - static public function isPostDefinitionPage( $asPostTypes=array() ) { |
|
139 | + static public function isPostDefinitionPage( $asPostTypes = array() ) { |
|
140 | 140 | |
141 | 141 | // If it's not the post definition page, |
142 | - if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
142 | + if ( !in_array( self::getPageNow(), array( 'post.php', 'post-new.php',) ) ) { |
|
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @since 3.0.0 |
174 | 174 | */ |
175 | - static public function isPostListingPage( $asPostTypes=array() ) { |
|
175 | + static public function isPostListingPage( $asPostTypes = array() ) { |
|
176 | 176 | |
177 | 177 | if ( 'edit.php' != self::getPageNow() ) { |
178 | 178 | return false; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
182 | 182 | |
183 | - if ( ! isset( $_GET['post_type'] ) ) { |
|
183 | + if ( !isset( $_GET[ 'post_type' ] ) ) { |
|
184 | 184 | return in_array( 'post', $_aPostTypes ); |
185 | 185 | } |
186 | 186 | |
187 | - return in_array( $_GET['post_type'], $_aPostTypes ); |
|
187 | + return in_array( $_GET[ 'post_type' ], $_aPostTypes ); |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | // If already set, use that. |
212 | - if ( isset( $GLOBALS['pagenow'] ) ) { |
|
213 | - self::$_sPageNow = $GLOBALS['pagenow']; |
|
212 | + if ( isset( $GLOBALS[ 'pagenow' ] ) ) { |
|
213 | + self::$_sPageNow = $GLOBALS[ 'pagenow' ]; |
|
214 | 214 | return self::$_sPageNow; |
215 | 215 | } |
216 | 216 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return string The current page url base name. |
231 | 231 | */ |
232 | 232 | static private function _getPageNow_FrontEnd() { |
233 | - if ( preg_match( '#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $_aMatches ) ) { |
|
233 | + if ( preg_match( '#([^/]+\.php)([?/].*?)?$#i', $_SERVER[ 'PHP_SELF' ], $_aMatches ) ) { |
|
234 | 234 | return strtolower( $_aMatches[ 1 ] ); |
235 | 235 | } |
236 | 236 | return 'index.php'; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | else { |
277 | 277 | $_sNeedle = '#/wp-admin/?(.*?)$#i'; |
278 | 278 | } |
279 | - preg_match( $_sNeedle, $_SERVER['PHP_SELF'], $_aMatches ); |
|
279 | + preg_match( $_sNeedle, $_SERVER[ 'PHP_SELF' ], $_aMatches ); |
|
280 | 280 | return preg_replace( '#\?.*?$#', '', trim( $_aMatches[ 1 ], '/' ) ); |
281 | 281 | |
282 | 282 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | if ( isset( $GLBOALS[ 'page_hook' ] ) ) { |
313 | 313 | return is_network_admin() |
314 | - ? $GLBOALS[ 'page_hook' ] . '-network' |
|
314 | + ? $GLBOALS[ 'page_hook' ].'-network' |
|
315 | 315 | : $GLBOALS[ 'page_hook' ]; |
316 | 316 | } |
317 | 317 | |
@@ -325,11 +325,11 @@ discard block |
||
325 | 325 | * @since DEVVER |
326 | 326 | * @return boolean |
327 | 327 | */ |
328 | - static public function doesMetaBoxExist( $sContext='' ) { |
|
328 | + static public function doesMetaBoxExist( $sContext = '' ) { |
|
329 | 329 | |
330 | 330 | $_aDimensions = array( 'wp_meta_boxes', $GLOBALS[ 'page_hook' ] ); |
331 | 331 | if ( $sContext ) { |
332 | - $_aDimensions[] = $sContext; |
|
332 | + $_aDimensions[ ] = $sContext; |
|
333 | 333 | } |
334 | 334 | $_aSideMetaBoxes = self::getElementAsArray( |
335 | 335 | $GLOBALS, |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // Since the current page will be the same throughout the execution of the script, |
35 | 35 | // once it's found, there is no need to find it again. |
36 | - if ( $_sCurrentPostType ) { |
|
36 | + if ( $_sCurrentPostType ) { |
|
37 | 37 | return $_sCurrentPostType; |
38 | 38 | } |
39 | 39 | $_sCurrentPostType = self::_getCurrentPostType(); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | static public function isPostDefinitionPage( $asPostTypes=array() ) { |
140 | 140 | |
141 | 141 | // If it's not the post definition page, |
142 | - if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
142 | + if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
159 | 159 | |
160 | 160 | // If the parameter is empty, |
161 | - if ( empty( $_aPostTypes ) ) { |
|
161 | + if ( empty( $_aPostTypes ) ) { |
|
162 | 162 | return true; |
163 | 163 | } |
164 | 164 | |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | */ |
175 | 175 | static public function isPostListingPage( $asPostTypes=array() ) { |
176 | 176 | |
177 | - if ( 'edit.php' != self::getPageNow() ) { |
|
177 | + if ( 'edit.php' != self::getPageNow() ) { |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
181 | 181 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
182 | 182 | |
183 | - if ( ! isset( $_GET['post_type'] ) ) { |
|
183 | + if ( ! isset( $_GET['post_type'] ) ) { |
|
184 | 184 | return in_array( 'post', $_aPostTypes ); |
185 | 185 | } |
186 | 186 | |
@@ -269,11 +269,9 @@ discard block |
||
269 | 269 | |
270 | 270 | if ( is_network_admin() ) { |
271 | 271 | $_sNeedle = '#/wp-admin/network/?(.*?)$#i'; |
272 | - } |
|
273 | - else if ( is_user_admin() ) { |
|
272 | + } else if ( is_user_admin() ) { |
|
274 | 273 | $_sNeedle = '#/wp-admin/user/?(.*?)$#i'; |
275 | - } |
|
276 | - else { |
|
274 | + } else { |
|
277 | 275 | $_sNeedle = '#/wp-admin/?(.*?)$#i'; |
278 | 276 | } |
279 | 277 | preg_match( $_sNeedle, $_SERVER['PHP_SELF'], $_aMatches ); |
@@ -202,6 +202,7 @@ |
||
202 | 202 | * |
203 | 203 | * @since 3.3.0 |
204 | 204 | * @since 3.4.2 Moved from the validation class. |
205 | + * @param string $sKey |
|
205 | 206 | */ |
206 | 207 | private function _getEmailArgument( $aInput, array $aEmailOptions, $sKey, $sSectionID ) { |
207 | 208 |
@@ -167,7 +167,7 @@ |
||
167 | 167 | return ''; |
168 | 168 | |
169 | 169 | } |
170 | - /** |
|
170 | + /** |
|
171 | 171 | * Sets the mail content type to HTML. |
172 | 172 | * @since 3.3.0 |
173 | 173 | * @since 3.4.2 Moved from the validation class. |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // Send mail. |
88 | - $_bSent = wp_mail( |
|
88 | + $_bSent = wp_mail( |
|
89 | 89 | $this->_getEmailArgument( $aInput, $aEmailOptions, 'to', $sSubmitSectionID ), |
90 | 90 | $this->_getEmailArgument( $aInput, $aEmailOptions, 'subject', $sSubmitSectionID ), |
91 | 91 | $_bIsHTML |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | remove_filter( 'wp_mail_from_name', array( $this, '_replyToSetEmailSenderAddress' ) ); |
101 | 101 | |
102 | 102 | // Clean up. |
103 | - foreach( $this->_aPathsToDelete as $_sPath ) { |
|
103 | + foreach ( $this->_aPathsToDelete as $_sPath ) { |
|
104 | 104 | unlink( $_sPath ); |
105 | 105 | } |
106 | 106 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | $_aAttachments = $this->getAsArray( $asAttachments ); |
124 | - foreach( $_aAttachments as $_iIndex => $_sPathORURL ) { |
|
124 | + foreach ( $_aAttachments as $_iIndex => $_sPathORURL ) { |
|
125 | 125 | |
126 | 126 | // If it is a file path, fine. |
127 | 127 | if ( is_file( $_sPathORURL ) ) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | // If the key element is empty, search the corresponding item in the same section. |
214 | - if ( ! $aEmailOptions[ $sKey ] ) { |
|
214 | + if ( !$aEmailOptions[ $sKey ] ) { |
|
215 | 215 | return $this->getArrayValueByArrayKeys( $aInput, array( $sSectionID, $sKey ) ); |
216 | 216 | } |
217 | 217 |
@@ -159,7 +159,7 @@ |
||
159 | 159 | |
160 | 160 | // Download the file. It returns a string value on success. WP Error object on failure. |
161 | 161 | $_sPath = $this->download( $sURL, 10 ); |
162 | - if ( is_string( $_sPath ) ) { |
|
162 | + if ( is_string( $_sPath ) ) { |
|
163 | 163 | $this->_aPathsToDelete[ $_sPath ] = $_sPath; |
164 | 164 | return $_sPath; |
165 | 165 | } |
@@ -89,6 +89,11 @@ |
||
89 | 89 | return $vData; |
90 | 90 | |
91 | 91 | } |
92 | + |
|
93 | + /** |
|
94 | + * @param string $vData |
|
95 | + * @param string $sFormatType |
|
96 | + */ |
|
92 | 97 | public function formatImportData( &$vData, $sFormatType=null ) { |
93 | 98 | |
94 | 99 | $sFormatType = isset( $sFormatType ) ? $sFormatType : $this->getFormatType(); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | |
58 | 58 | } |
59 | 59 | |
60 | - private function getElementInFilesArray( array $aFilesImport, $sInputID, $sElementKey='error' ) { |
|
60 | + private function getElementInFilesArray( array $aFilesImport, $sInputID, $sElementKey = 'error' ) { |
|
61 | 61 | |
62 | 62 | $sElementKey = strtolower( $sElementKey ); |
63 | 63 | return $this->getElement( |
64 | - $aFilesImport, // subject array |
|
64 | + $aFilesImport, // subject array |
|
65 | 65 | array( $sElementKey, $sInputID ), // dimensional keys |
66 | 66 | null // default |
67 | 67 | ); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return $vData; |
90 | 90 | |
91 | 91 | } |
92 | - public function formatImportData( &$vData, $sFormatType=null ) { |
|
92 | + public function formatImportData( &$vData, $sFormatType = null ) { |
|
93 | 93 | |
94 | 94 | $sFormatType = isset( $sFormatType ) ? $sFormatType : $this->getFormatType(); |
95 | 95 | switch ( strtolower( $sFormatType ) ) { |