@@ -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 |
@@ -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( |
@@ -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 ); |
@@ -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 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @since 2.0.0 |
35 | 35 | * @see http://codex.wordpress.org/Roles_and_Capabilities |
36 | 36 | * @see http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains |
37 | - * @param array|integer|string $aisOptionKey (optional) specifies the option key name to store in the options table. If this is not set, the instantiated class name will be used as default. |
|
37 | + * @param array|integer|string $isOptionKey (optional) specifies the option key name to store in the options table. If this is not set, the instantiated class name will be used as default. |
|
38 | 38 | * [3.5.9+] If an integer is given, a transient will be used. If an array of option key arguments is given, the argument values will be set to the framework properties. |
39 | 39 | * - type - either `options_table` or `transient`. |
40 | 40 | * - key - the option key or the transient key |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @param string $sCapability (optional) sets the overall access level to the admin pages created by the framework. The used capabilities are listed <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. The capability can be set per page, tab, setting section, setting field. Default: `manage_options` |
57 | 57 | * @param string $sTextDomain (optional) the <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains" target="_blank">text domain</a> used for the framework's system messages. Default: admin-page-framework. |
58 | 58 | */ |
59 | - public function __construct( $isOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ){ |
|
59 | + public function __construct( $isOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
60 | 60 | |
61 | - if ( ! $this->_isInstantiatable() ) { |
|
61 | + if ( !$this->_isInstantiatable() ) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | $isOptionKey, |
67 | 67 | $sCallerPath |
68 | 68 | ? trim( $sCallerPath ) |
69 | - : $sCallerPath = ( is_admin() && ( isset( $GLOBALS['pagenow'] ) && in_array( $GLOBALS['pagenow'], array( 'plugins.php', ) ) || isset( $_GET['page'] ) ) |
|
69 | + : $sCallerPath = ( is_admin() && ( isset( $GLOBALS[ 'pagenow' ] ) && in_array( $GLOBALS[ 'pagenow' ], array( 'plugins.php',) ) || isset( $_GET[ 'page' ] ) ) |
|
70 | 70 | ? AdminPageFramework_Utility::getCallerScriptPath( __FILE__ ) |
71 | 71 | : null |
72 | - ), // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
72 | + ), // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
73 | 73 | $sCapability, |
74 | 74 | $sTextDomain |
75 | 75 | ); |
76 | 76 | |
77 | - $this->oUtil->addAndDoAction( $this, 'start_' . $this->oProp->sClassName, $this ); |
|
77 | + $this->oUtil->addAndDoAction( $this, 'start_'.$this->oProp->sClassName, $this ); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | * @param string $sCapability (optional) sets the overall access level to the admin pages created by the framework. The used capabilities are listed <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. The capability can be set per page, tab, setting section, setting field. Default: `manage_options` |
57 | 57 | * @param string $sTextDomain (optional) the <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains" target="_blank">text domain</a> used for the framework's system messages. Default: admin-page-framework. |
58 | 58 | */ |
59 | - public function __construct( $isOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ){ |
|
59 | + public function __construct( $isOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
60 | 60 | |
61 | 61 | if ( ! $this->_isInstantiatable() ) { |
62 | 62 | return; |
@@ -142,6 +142,7 @@ discard block |
||
142 | 142 | * <li>**media** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
143 | 143 | * <li>**attributes** - (optional, array) [3.3.0+] attributes array. `array( 'data-id' => '...' )`</li> |
144 | 144 | * </ul> |
145 | + * @param string $sSRC |
|
145 | 146 | * @return string The style handle ID. If the passed url is not a valid url string, an empty string will be returned. |
146 | 147 | */ |
147 | 148 | public function enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
@@ -234,6 +235,7 @@ discard block |
||
234 | 235 | * @param string the tagged HTML link text. |
235 | 236 | * @param string (optional) another tagged HTML link text. |
236 | 237 | * @param string (optional) add more as many as want by adding items to the next parameters. |
238 | + * @param string $sTaggedLinkHTML1 |
|
237 | 239 | * @access public |
238 | 240 | * @return void |
239 | 241 | */ |
@@ -258,6 +260,9 @@ discard block |
||
258 | 260 | * @param string the tagged HTML link text. |
259 | 261 | * @param string (optional) another tagged HTML link text. |
260 | 262 | * @param string (optional) add more as many as want by adding items to the next parameters. |
263 | + * @param null|string $sTaggedLinkHTML1 |
|
264 | + * @param string $sTaggedLinkHTML2 |
|
265 | + * @param string $_and_more |
|
261 | 266 | * @access public |
262 | 267 | * @return void |
263 | 268 | */ |
@@ -274,6 +279,7 @@ discard block |
||
274 | 279 | * |
275 | 280 | * @since 3.1.0 |
276 | 281 | * @since 3.3.1 Moved from `AdminPageFramework`. |
282 | + * @param string $sLabel |
|
277 | 283 | */ |
278 | 284 | public function setPluginSettingsLinkLabel( $sLabel ) { |
279 | 285 | $this->oProp->sLabelPluginSettingsLink = $sLabel; |
@@ -219,24 +219,24 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | - * Adds the given link(s) into the description cell of the plugin listing table. |
|
223 | - * |
|
224 | - * <h4>Example</h4> |
|
225 | - * <code>$this->addLinkToPluginDescription( |
|
226 | - * "<a href='http://www.google.com'>Google</a>", |
|
227 | - * "<a href='http://www.yahoo.com'>Yahoo!</a>" |
|
228 | - * );</code> |
|
229 | - * |
|
230 | - * @since 2.0.0 |
|
231 | - * @since 3.0.0 Changed the scope to public from protected. |
|
232 | - * @since 3.3.1 Moved from `AdminPageFramework`. |
|
233 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
234 | - * @param string the tagged HTML link text. |
|
235 | - * @param string (optional) another tagged HTML link text. |
|
236 | - * @param string (optional) add more as many as want by adding items to the next parameters. |
|
237 | - * @access public |
|
238 | - * @return void |
|
239 | - */ |
|
222 | + * Adds the given link(s) into the description cell of the plugin listing table. |
|
223 | + * |
|
224 | + * <h4>Example</h4> |
|
225 | + * <code>$this->addLinkToPluginDescription( |
|
226 | + * "<a href='http://www.google.com'>Google</a>", |
|
227 | + * "<a href='http://www.yahoo.com'>Yahoo!</a>" |
|
228 | + * );</code> |
|
229 | + * |
|
230 | + * @since 2.0.0 |
|
231 | + * @since 3.0.0 Changed the scope to public from protected. |
|
232 | + * @since 3.3.1 Moved from `AdminPageFramework`. |
|
233 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
234 | + * @param string the tagged HTML link text. |
|
235 | + * @param string (optional) another tagged HTML link text. |
|
236 | + * @param string (optional) add more as many as want by adding items to the next parameters. |
|
237 | + * @access public |
|
238 | + * @return void |
|
239 | + */ |
|
240 | 240 | public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
241 | 241 | if ( method_exists( $this->oLink, '_addLinkToPluginDescription' ) ) { |
242 | 242 | $this->oLink->_addLinkToPluginDescription( func_get_args() ); |
@@ -244,23 +244,23 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
247 | - * Adds the given link(s) into the title cell of the plugin listing table. |
|
248 | - * |
|
249 | - * <h4>Example</h4> |
|
250 | - * <code>$this->addLinkToPluginTitle( |
|
251 | - * "<a href='http://www.wordpress.org'>WordPress</a>" |
|
252 | - * );</code> |
|
253 | - * |
|
254 | - * @since 2.0.0 |
|
255 | - * @since 3.0.0 Changed the scope to public from protected. |
|
256 | - * @since 3.3.1 Moved from `AdminPageFramework`. |
|
257 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
258 | - * @param string the tagged HTML link text. |
|
259 | - * @param string (optional) another tagged HTML link text. |
|
260 | - * @param string (optional) add more as many as want by adding items to the next parameters. |
|
261 | - * @access public |
|
262 | - * @return void |
|
263 | - */ |
|
247 | + * Adds the given link(s) into the title cell of the plugin listing table. |
|
248 | + * |
|
249 | + * <h4>Example</h4> |
|
250 | + * <code>$this->addLinkToPluginTitle( |
|
251 | + * "<a href='http://www.wordpress.org'>WordPress</a>" |
|
252 | + * );</code> |
|
253 | + * |
|
254 | + * @since 2.0.0 |
|
255 | + * @since 3.0.0 Changed the scope to public from protected. |
|
256 | + * @since 3.3.1 Moved from `AdminPageFramework`. |
|
257 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
258 | + * @param string the tagged HTML link text. |
|
259 | + * @param string (optional) another tagged HTML link text. |
|
260 | + * @param string (optional) add more as many as want by adding items to the next parameters. |
|
261 | + * @access public |
|
262 | + * @return void |
|
263 | + */ |
|
264 | 264 | public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
265 | 265 | if ( method_exists( $this->oLink, '_addLinkToPluginTitle' ) ) { |
266 | 266 | $this->oLink->_addLinkToPluginTitle( func_get_args() ); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param array $aCustomArgs (optional) The argument array for more advanced parameters. |
108 | 108 | * @return array The array holing the queued items. |
109 | 109 | */ |
110 | - public function enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
110 | + public function enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
111 | 111 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
112 | 112 | return $this->oResource->_enqueueStyles( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
113 | 113 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * </ul> |
145 | 145 | * @return string The style handle ID. If the passed url is not a valid url string, an empty string will be returned. |
146 | 146 | */ |
147 | - public function enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
147 | + public function enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
148 | 148 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
149 | 149 | return $this->oResource->_enqueueStyle( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
150 | 150 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param array (optional) The argument array for more advanced parameters. |
172 | 172 | * @return array The array holding the queued items. |
173 | 173 | */ |
174 | - public function enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
174 | + public function enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
175 | 175 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
176 | 176 | return $this->oResource->_enqueueScripts( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
177 | 177 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * </ul> |
213 | 213 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
214 | 214 | */ |
215 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
215 | + public function enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
216 | 216 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
217 | 217 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
218 | 218 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @access public |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
240 | + public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
241 | 241 | if ( method_exists( $this->oLink, '_addLinkToPluginDescription' ) ) { |
242 | 242 | $this->oLink->_addLinkToPluginDescription( func_get_args() ); |
243 | 243 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @access public |
262 | 262 | * @return void |
263 | 263 | */ |
264 | - public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
264 | + public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
265 | 265 | if ( method_exists( $this->oLink, '_addLinkToPluginTitle' ) ) { |
266 | 266 | $this->oLink->_addLinkToPluginTitle( func_get_args() ); |
267 | 267 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @param string (optional) The class selector used in the message HTML element. 'error' and 'updated' are prepared by WordPress but it's not limited to them and can pass a custom name. Default: 'error'. |
318 | 318 | * @param string (optional) The ID of the message. If not set, the hash of the message will be used. |
319 | 319 | */ |
320 | - public function setAdminNotice( $sMessage, $sClassSelector='error', $sID='' ) { |
|
320 | + public function setAdminNotice( $sMessage, $sClassSelector = 'error', $sID = '' ) { |
|
321 | 321 | |
322 | 322 | $sID = $sID ? $sID : md5( $sMessage ); |
323 | 323 | |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | * @param boolean If true, the passed key(s) will be appended to the property; otherwise, it will override the property. |
355 | 355 | * @return void |
356 | 356 | */ |
357 | - public function setDisallowedQueryKeys( $asQueryKeys, $bAppend=true ) { |
|
357 | + public function setDisallowedQueryKeys( $asQueryKeys, $bAppend = true ) { |
|
358 | 358 | |
359 | - if ( ! $bAppend ) { |
|
359 | + if ( !$bAppend ) { |
|
360 | 360 | $this->oProp->aDisallowedQueryKeys = ( array ) $asQueryKeys; |
361 | 361 | return; |
362 | 362 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
400 | 400 | * @return mixed If the field ID is not specified |
401 | 401 | */ |
402 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null ) { |
|
402 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null ) { |
|
403 | 403 | return AdminPageFramework_WPUtility::getOption( $sOptionKey, $asKey, $vDefault ); |
404 | 404 | } |
405 | 405 |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * </ul> |
213 | 213 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
214 | 214 | */ |
215 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
215 | + public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
216 | 216 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
217 | 217 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
218 | 218 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @access public |
262 | 262 | * @return void |
263 | 263 | */ |
264 | - public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
264 | + public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
265 | 265 | if ( method_exists( $this->oLink, '_addLinkToPluginTitle' ) ) { |
266 | 266 | $this->oLink->_addLinkToPluginTitle( func_get_args() ); |
267 | 267 | } |
@@ -153,9 +153,6 @@ |
||
153 | 153 | * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
154 | 154 | * @access public |
155 | 155 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
156 | - * @param string $sSectionID1 the section ID to remove. |
|
157 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
158 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
159 | 156 | * @return void |
160 | 157 | */ |
161 | 158 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
@@ -140,24 +140,24 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * Removes the given section(s) by section ID. |
|
144 | - * |
|
145 | - * This accesses the property storing the added section arrays and removes the specified ones. |
|
146 | - * |
|
147 | - * <h4>Example</h4> |
|
148 | - * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
149 | - * </code> |
|
150 | - * |
|
151 | - * @since 2.0.0 |
|
152 | - * @since 3.0.0 Changed the scope to public from protected. |
|
153 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
154 | - * @access public |
|
155 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
156 | - * @param string $sSectionID1 the section ID to remove. |
|
157 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
158 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
159 | - * @return void |
|
160 | - */ |
|
143 | + * Removes the given section(s) by section ID. |
|
144 | + * |
|
145 | + * This accesses the property storing the added section arrays and removes the specified ones. |
|
146 | + * |
|
147 | + * <h4>Example</h4> |
|
148 | + * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
149 | + * </code> |
|
150 | + * |
|
151 | + * @since 2.0.0 |
|
152 | + * @since 3.0.0 Changed the scope to public from protected. |
|
153 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
154 | + * @access public |
|
155 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
156 | + * @param string $sSectionID1 the section ID to remove. |
|
157 | + * @param string $sSectionID2 (optional) another section ID to remove. |
|
158 | + * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
159 | + * @return void |
|
160 | + */ |
|
161 | 161 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
162 | 162 | |
163 | 163 | foreach( func_get_args() as $_sSectionID ) { |
@@ -224,38 +224,38 @@ discard block |
||
224 | 224 | } |
225 | 225 | } |
226 | 226 | /** |
227 | - * Adds the given field array items into the field array property. |
|
228 | - * |
|
229 | - * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
230 | - * |
|
231 | - * @since 2.1.2 |
|
232 | - * @since 3.0.0 Changed the scope to public from protected. |
|
233 | - * @access public |
|
234 | - * @param array|string $asField the field array or the target section ID. If the target section ID is set, the section_id key can be omitted from the next passing field array. |
|
235 | - * @return void |
|
236 | - */ |
|
227 | + * Adds the given field array items into the field array property. |
|
228 | + * |
|
229 | + * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
230 | + * |
|
231 | + * @since 2.1.2 |
|
232 | + * @since 3.0.0 Changed the scope to public from protected. |
|
233 | + * @access public |
|
234 | + * @param array|string $asField the field array or the target section ID. If the target section ID is set, the section_id key can be omitted from the next passing field array. |
|
235 | + * @return void |
|
236 | + */ |
|
237 | 237 | public function addSettingField( $asField ) { |
238 | 238 | $this->oForm->addField( $asField ); |
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
242 | - * Removes the given field(s) by field ID. |
|
243 | - * |
|
244 | - * This accesses the property storing the added field arrays and removes the specified ones. |
|
245 | - * |
|
246 | - * <h4>Example</h4> |
|
247 | - * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
248 | - * </code> |
|
249 | - * |
|
250 | - * @since 2.0.0 |
|
251 | - * @since 3.0.0 Changed the scope to public from protected. |
|
252 | - * @access public |
|
253 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
254 | - * @param string $sFieldID1 the field ID to remove. |
|
255 | - * @param string $sFieldID2 (optional) another field ID to remove. |
|
256 | - * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
257 | - * @return void |
|
258 | - */ |
|
242 | + * Removes the given field(s) by field ID. |
|
243 | + * |
|
244 | + * This accesses the property storing the added field arrays and removes the specified ones. |
|
245 | + * |
|
246 | + * <h4>Example</h4> |
|
247 | + * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
248 | + * </code> |
|
249 | + * |
|
250 | + * @since 2.0.0 |
|
251 | + * @since 3.0.0 Changed the scope to public from protected. |
|
252 | + * @access public |
|
253 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
254 | + * @param string $sFieldID1 the field ID to remove. |
|
255 | + * @param string $sFieldID2 (optional) another field ID to remove. |
|
256 | + * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
257 | + * @return void |
|
258 | + */ |
|
259 | 259 | public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
260 | 260 | foreach( func_get_args() as $_sFieldID ) { |
261 | 261 | $this->oForm->removeField( $_sFieldID ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
74 | 74 | |
75 | - foreach( func_get_args() as $asSection ) { |
|
75 | + foreach( func_get_args() as $asSection ) { |
|
76 | 76 | $this->addSettingSection( $asSection ); |
77 | 77 | } |
78 | 78 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
|
161 | + public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
|
162 | 162 | |
163 | 163 | foreach( func_get_args() as $_sSectionID ) { |
164 | 164 | $this->oForm->removeSection( $_sSectionID ); |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
219 | 219 | * @remark The actual registration will be performed in the <em>_replyToRegisterSettings()</em> method with the <em>admin_menu</em> hook. |
220 | 220 | */ |
221 | - public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
|
222 | - foreach( func_get_args() as $aField ) { |
|
221 | + public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
|
222 | + foreach( func_get_args() as $aField ) { |
|
223 | 223 | $this->addSettingField( $aField ); |
224 | 224 | } |
225 | 225 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return void |
258 | 258 | */ |
259 | 259 | public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
260 | - foreach( func_get_args() as $_sFieldID ) { |
|
260 | + foreach( func_get_args() as $_sFieldID ) { |
|
261 | 261 | $this->oForm->removeField( $_sFieldID ); |
262 | 262 | } |
263 | 263 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
74 | 74 | |
75 | - foreach( func_get_args() as $asSection ) { |
|
75 | + foreach ( func_get_args() as $asSection ) { |
|
76 | 76 | $this->addSettingSection( $asSection ); |
77 | 77 | } |
78 | 78 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function addSettingSection( $asSection ) { |
97 | 97 | |
98 | - if ( ! is_array( $asSection ) ) { |
|
98 | + if ( !is_array( $asSection ) ) { |
|
99 | 99 | $this->_sTargetPageSlug = is_string( $asSection ) |
100 | 100 | ? $asSection |
101 | 101 | : $this->_sTargetPageSlug; |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | ) |
123 | 123 | ); // avoid undefined index warnings. |
124 | 124 | |
125 | - $aSection['page_slug'] = $aSection['page_slug'] |
|
126 | - ? $this->oUtil->sanitizeSlug( $aSection['page_slug'] ) |
|
125 | + $aSection[ 'page_slug' ] = $aSection[ 'page_slug' ] |
|
126 | + ? $this->oUtil->sanitizeSlug( $aSection[ 'page_slug' ] ) |
|
127 | 127 | : ( $this->oProp->sDefaultPageSlug |
128 | 128 | ? $this->oProp->sDefaultPageSlug |
129 | 129 | : null |
130 | 130 | ); |
131 | - $aSection['tab_slug'] = $this->oUtil->sanitizeSlug( $aSection['tab_slug'] ); |
|
132 | - $aSection['section_tab_slug'] = $this->oUtil->sanitizeSlug( $aSection['section_tab_slug'] ); |
|
131 | + $aSection[ 'tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'tab_slug' ] ); |
|
132 | + $aSection[ 'section_tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'section_tab_slug' ] ); |
|
133 | 133 | |
134 | 134 | // A page slug is required. |
135 | - if ( ! $aSection['page_slug'] ) { |
|
135 | + if ( !$aSection[ 'page_slug' ] ) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | $this->oForm->addSection( $aSection ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
162 | 162 | |
163 | - foreach( func_get_args() as $_sSectionID ) { |
|
163 | + foreach ( func_get_args() as $_sSectionID ) { |
|
164 | 164 | $this->oForm->removeSection( $_sSectionID ); |
165 | 165 | } |
166 | 166 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @remark The actual registration will be performed in the <em>_replyToRegisterSettings()</em> method with the <em>admin_menu</em> hook. |
220 | 220 | */ |
221 | 221 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
222 | - foreach( func_get_args() as $aField ) { |
|
222 | + foreach ( func_get_args() as $aField ) { |
|
223 | 223 | $this->addSettingField( $aField ); |
224 | 224 | } |
225 | 225 | } |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
257 | 257 | * @return void |
258 | 258 | */ |
259 | - public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
|
260 | - foreach( func_get_args() as $_sFieldID ) { |
|
259 | + public function removeSettingFields( $sFieldID1, $sFieldID2 = null, $_and_more ) { |
|
260 | + foreach ( func_get_args() as $_sFieldID ) { |
|
261 | 261 | $this->oForm->removeField( $_sFieldID ); |
262 | 262 | } |
263 | 263 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $this->oProp->sOptionKey, |
305 | 305 | empty( $_aParams ) |
306 | 306 | ? null // will return the entire options array |
307 | - : $_aDimensionalKeys, // dimensional keys |
|
307 | + : $_aDimensionalKeys, // dimensional keys |
|
308 | 308 | $_mDefault, // default |
309 | 309 | $this->getSavedOptions() + $this->oProp->getDefaultOptions( $this->oForm->aFields ) // additional array to merge with the options |
310 | 310 | ); |
@@ -323,18 +323,18 @@ discard block |
||
323 | 323 | * If the user has not submitted the form, the framework will try to return the default value set in the field definition array. |
324 | 324 | * @deprecated 3.3.0 |
325 | 325 | */ |
326 | - public function getFieldValue( $sFieldID, $sSectionID='' ) { |
|
326 | + public function getFieldValue( $sFieldID, $sSectionID = '' ) { |
|
327 | 327 | |
328 | - trigger_error( 'Admin Page Framework: ' . ' : ' . sprintf( __( 'The method is deprecated: %1$s. Use %2$s instead.', $this->oProp->sTextDomain ), __METHOD__, 'getValue()' ), E_USER_WARNING ); |
|
328 | + trigger_error( 'Admin Page Framework: '.' : '.sprintf( __( 'The method is deprecated: %1$s. Use %2$s instead.', $this->oProp->sTextDomain ), __METHOD__, 'getValue()' ), E_USER_WARNING ); |
|
329 | 329 | |
330 | 330 | $_aOptions = $this->oUtil->uniteArrays( $this->oProp->aOptions, $this->oProp->getDefaultOptions( $this->oForm->aFields ) ); |
331 | 331 | /* If it's saved, return it */ |
332 | - if ( ! $sSectionID ) { |
|
332 | + if ( !$sSectionID ) { |
|
333 | 333 | if ( array_key_exists( $sFieldID, $_aOptions ) ) { |
334 | 334 | return $_aOptions[ $sFieldID ]; |
335 | 335 | } |
336 | 336 | // loop through section elements |
337 | - foreach( $_aOptions as $aOptions ) { |
|
337 | + foreach ( $_aOptions as $aOptions ) { |
|
338 | 338 | if ( array_key_exists( $sFieldID, $aOptions ) ) { |
339 | 339 | return $aOptions[ $sFieldID ]; |
340 | 340 | } |
@@ -48,6 +48,8 @@ discard block |
||
48 | 48 | * <li>a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with 'data:image/svg+xml;base64,'.</li> |
49 | 49 | * </ul> |
50 | 50 | * @param string (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function. |
51 | + * @param string $sIcon16x16 |
|
52 | + * @param integer $iMenuPosition |
|
51 | 53 | * @return void |
52 | 54 | */ |
53 | 55 | public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) { |
@@ -70,6 +72,7 @@ discard block |
||
70 | 72 | * |
71 | 73 | * @since 2.0.0 |
72 | 74 | * @internal |
75 | + * @param string $sMenuLabel |
|
73 | 76 | * @return void|string Returns the associated slug string, if true. |
74 | 77 | */ |
75 | 78 | private function _isBuiltInMenuItem( $sMenuLabel ) { |
@@ -104,39 +104,39 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | - * Adds sub-menu items on the left sidebar menu of the administration panel. |
|
108 | - * |
|
109 | - * It supports pages and links. Each of them has the specific array structure. |
|
110 | - * |
|
111 | - * <h4>Example</h4> |
|
112 | - * <code>$this->addSubMenuItems( |
|
113 | - * array( |
|
114 | - * 'title' => 'Various Form Fields', |
|
115 | - * 'page_slug' => 'first_page', |
|
116 | - * 'screen_icon' => 'options-general', |
|
117 | - * ), |
|
118 | - * array( |
|
119 | - * 'title' => 'Manage Options', |
|
120 | - * 'page_slug' => 'second_page', |
|
121 | - * 'screen_icon' => 'link-manager', |
|
122 | - * ), |
|
123 | - * array( |
|
124 | - * 'title' => 'Google', |
|
125 | - * 'href' => 'http://www.google.com', |
|
126 | - * 'show_page_heading_tab' => false, // this removes the title from the page heading tabs. |
|
127 | - * ) |
|
128 | - * );</code> |
|
129 | - * |
|
130 | - * @since 2.0.0 |
|
131 | - * @since 3.0.0 Changed the scope to public. |
|
132 | - * @remark The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug. |
|
133 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
134 | - * @param array $aSubMenuItem1 a first sub-menu array. A sub-menu array can be a link or a page. For the specifications of the array structures and its arguments, refer to the parameter section of the `addSubMenuItem()` method. |
|
135 | - * @param array $aSubMenuItem2 (optional) a second sub-menu array. |
|
136 | - * @param array $_and_more (optional) a third and add items as many as necessary with next parameters. |
|
137 | - * @access public |
|
138 | - * @return void |
|
139 | - */ |
|
107 | + * Adds sub-menu items on the left sidebar menu of the administration panel. |
|
108 | + * |
|
109 | + * It supports pages and links. Each of them has the specific array structure. |
|
110 | + * |
|
111 | + * <h4>Example</h4> |
|
112 | + * <code>$this->addSubMenuItems( |
|
113 | + * array( |
|
114 | + * 'title' => 'Various Form Fields', |
|
115 | + * 'page_slug' => 'first_page', |
|
116 | + * 'screen_icon' => 'options-general', |
|
117 | + * ), |
|
118 | + * array( |
|
119 | + * 'title' => 'Manage Options', |
|
120 | + * 'page_slug' => 'second_page', |
|
121 | + * 'screen_icon' => 'link-manager', |
|
122 | + * ), |
|
123 | + * array( |
|
124 | + * 'title' => 'Google', |
|
125 | + * 'href' => 'http://www.google.com', |
|
126 | + * 'show_page_heading_tab' => false, // this removes the title from the page heading tabs. |
|
127 | + * ) |
|
128 | + * );</code> |
|
129 | + * |
|
130 | + * @since 2.0.0 |
|
131 | + * @since 3.0.0 Changed the scope to public. |
|
132 | + * @remark The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug. |
|
133 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
134 | + * @param array $aSubMenuItem1 a first sub-menu array. A sub-menu array can be a link or a page. For the specifications of the array structures and its arguments, refer to the parameter section of the `addSubMenuItem()` method. |
|
135 | + * @param array $aSubMenuItem2 (optional) a second sub-menu array. |
|
136 | + * @param array $_and_more (optional) a third and add items as many as necessary with next parameters. |
|
137 | + * @access public |
|
138 | + * @return void |
|
139 | + */ |
|
140 | 140 | public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2=null, $_and_more=null ) { |
141 | 141 | foreach ( func_get_args() as $_aSubMenuItem ) { |
142 | 142 | $this->addSubMenuItem( $_aSubMenuItem ); |
@@ -144,50 +144,50 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | - * Adds the given sub-menu item on the left sidebar menu of the administration panel. |
|
148 | - * |
|
149 | - * It supports pages and links. Each of them has the specific array structure. |
|
150 | - * |
|
151 | - * <h4>Example</h4> |
|
152 | - * <code>$this->addSubMenuItem( |
|
153 | - * array( |
|
154 | - * 'title' => 'Read Me', |
|
155 | - * 'menu_title' => 'About' |
|
156 | - * 'page_slug' => 'my_plugin_readme', |
|
157 | - * ) |
|
158 | - * );</code> |
|
159 | - * |
|
160 | - * @since 2.0.0 |
|
161 | - * @since 3.0.0 Changed the scope to public. |
|
162 | - * @remark The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug. |
|
163 | - * @param array a sub-menu array. It can be a page or a link. The array structures are as follows: |
|
164 | - * <h4>Sub-menu Page Array</h4> |
|
165 | - * <ul> |
|
166 | - * <li>**title** - (string) the page title of the page.</li> |
|
167 | - * <li>**page_slug** - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li> |
|
168 | - * <li>**screen_icon** - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below. |
|
169 | - * <pre>edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic</pre> |
|
170 | - * <p>( Notes: the `generic` icon is available WordPress version 3.5 or above.)</p> |
|
171 | - * </li> |
|
172 | - * <li>**capability** - (optional, string) the access level to the created admin pages defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
173 | - * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
174 | - * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
175 | - * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
176 | - * <li>**page_title** - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.</li> |
|
177 | - * <li>**menu_title** - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.</li> |
|
178 | - * </ul> |
|
179 | - * <h4>Sub-menu Link Array</h4> |
|
180 | - * <ul> |
|
181 | - * <li>**title** - (string) the link title.</li> |
|
182 | - * <li>**href** - (string) the URL of the target link.</li> |
|
183 | - * <li>**capability** - (optional, string) the access level to show the item, defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
184 | - * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
185 | - * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
186 | - * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
187 | - * </ul> |
|
188 | - * @access public |
|
189 | - * @return void |
|
190 | - */ |
|
147 | + * Adds the given sub-menu item on the left sidebar menu of the administration panel. |
|
148 | + * |
|
149 | + * It supports pages and links. Each of them has the specific array structure. |
|
150 | + * |
|
151 | + * <h4>Example</h4> |
|
152 | + * <code>$this->addSubMenuItem( |
|
153 | + * array( |
|
154 | + * 'title' => 'Read Me', |
|
155 | + * 'menu_title' => 'About' |
|
156 | + * 'page_slug' => 'my_plugin_readme', |
|
157 | + * ) |
|
158 | + * );</code> |
|
159 | + * |
|
160 | + * @since 2.0.0 |
|
161 | + * @since 3.0.0 Changed the scope to public. |
|
162 | + * @remark The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug. |
|
163 | + * @param array a sub-menu array. It can be a page or a link. The array structures are as follows: |
|
164 | + * <h4>Sub-menu Page Array</h4> |
|
165 | + * <ul> |
|
166 | + * <li>**title** - (string) the page title of the page.</li> |
|
167 | + * <li>**page_slug** - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li> |
|
168 | + * <li>**screen_icon** - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below. |
|
169 | + * <pre>edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic</pre> |
|
170 | + * <p>( Notes: the `generic` icon is available WordPress version 3.5 or above.)</p> |
|
171 | + * </li> |
|
172 | + * <li>**capability** - (optional, string) the access level to the created admin pages defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
173 | + * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
174 | + * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
175 | + * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
176 | + * <li>**page_title** - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.</li> |
|
177 | + * <li>**menu_title** - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.</li> |
|
178 | + * </ul> |
|
179 | + * <h4>Sub-menu Link Array</h4> |
|
180 | + * <ul> |
|
181 | + * <li>**title** - (string) the link title.</li> |
|
182 | + * <li>**href** - (string) the URL of the target link.</li> |
|
183 | + * <li>**capability** - (optional, string) the access level to show the item, defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
184 | + * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
185 | + * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
186 | + * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
187 | + * </ul> |
|
188 | + * @access public |
|
189 | + * @return void |
|
190 | + */ |
|
191 | 191 | public function addSubMenuItem( array $aSubMenuItem ) { |
192 | 192 | if ( isset( $aSubMenuItem[ 'href' ] ) ) { |
193 | 193 | $this->addSubMenuLink( $aSubMenuItem ); |
@@ -197,20 +197,20 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
200 | - * Adds the given link into the menu on the left sidebar of the administration panel. |
|
201 | - * |
|
202 | - * @since 2.0.0 |
|
203 | - * @since 3.0.0 Changed the scope to public from protected. |
|
204 | - * @since 3.5.0 Changed the scope to public as it was still protected. |
|
205 | - * @param string the menu title. |
|
206 | - * @param string the URL linked to the menu. |
|
207 | - * @param string (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>. |
|
208 | - * @param string (optional) the order number. The larger it is, the lower the position it gets. |
|
209 | - * @param string (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page. |
|
210 | - * @access public |
|
211 | - * @return void |
|
212 | - * @internal |
|
213 | - */ |
|
200 | + * Adds the given link into the menu on the left sidebar of the administration panel. |
|
201 | + * |
|
202 | + * @since 2.0.0 |
|
203 | + * @since 3.0.0 Changed the scope to public from protected. |
|
204 | + * @since 3.5.0 Changed the scope to public as it was still protected. |
|
205 | + * @param string the menu title. |
|
206 | + * @param string the URL linked to the menu. |
|
207 | + * @param string (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>. |
|
208 | + * @param string (optional) the order number. The larger it is, the lower the position it gets. |
|
209 | + * @param string (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page. |
|
210 | + * @access public |
|
211 | + * @return void |
|
212 | + * @internal |
|
213 | + */ |
|
214 | 214 | public function addSubMenuLink( array $aSubMenuLink ) { |
215 | 215 | |
216 | 216 | // If required keys are not set, return. |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param string (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function. |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) { |
|
53 | + public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16 = null, $iMenuPosition = null ) { |
|
54 | 54 | |
55 | 55 | $sRootMenuLabel = trim( $sRootMenuLabel ); |
56 | 56 | $_sSlug = $this->_isBuiltInMenuItem( $sRootMenuLabel ); // if true, this method returns the slug |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function setRootMenuPageBySlug( $sRootMenuSlug ) { |
100 | 100 | |
101 | - $this->oProp->aRootMenu['sPageSlug'] = $sRootMenuSlug; // do not sanitize the slug here because post types includes a question mark. |
|
102 | - $this->oProp->aRootMenu['fCreateRoot'] = false; // indicates to use an existing menu item. |
|
101 | + $this->oProp->aRootMenu[ 'sPageSlug' ] = $sRootMenuSlug; // do not sanitize the slug here because post types includes a question mark. |
|
102 | + $this->oProp->aRootMenu[ 'fCreateRoot' ] = false; // indicates to use an existing menu item. |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @access public |
138 | 138 | * @return void |
139 | 139 | */ |
140 | - public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2=null, $_and_more=null ) { |
|
140 | + public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2 = null, $_and_more = null ) { |
|
141 | 141 | foreach ( func_get_args() as $_aSubMenuItem ) { |
142 | 142 | $this->addSubMenuItem( $_aSubMenuItem ); |
143 | 143 | } |
@@ -214,16 +214,16 @@ discard block |
||
214 | 214 | public function addSubMenuLink( array $aSubMenuLink ) { |
215 | 215 | |
216 | 216 | // If required keys are not set, return. |
217 | - if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { |
|
217 | + if ( !isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | 221 | // If the set URL is not valid, return. |
222 | - if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { |
|
222 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
226 | + $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
227 | 227 | $aSubMenuLink, |
228 | 228 | $this |
229 | 229 | ); |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function addSubMenuPage( array $aSubMenuPage ) { |
314 | 314 | |
315 | - if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
315 | + if ( !isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
316 | 316 | return; |
317 | 317 | } |
318 | 318 | |
319 | - $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
319 | + $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
320 | 320 | $aSubMenuPage, |
321 | 321 | $this |
322 | 322 | ); |
@@ -75,8 +75,9 @@ discard block |
||
75 | 75 | private function _isBuiltInMenuItem( $sMenuLabel ) { |
76 | 76 | |
77 | 77 | $_sMenuLabelLower = strtolower( $sMenuLabel ); |
78 | - if ( array_key_exists( $_sMenuLabelLower, $this->_aBuiltInRootMenuSlugs ) ) |
|
79 | - return $this->_aBuiltInRootMenuSlugs[ $_sMenuLabelLower ]; |
|
78 | + if ( array_key_exists( $_sMenuLabelLower, $this->_aBuiltInRootMenuSlugs ) ) { |
|
79 | + return $this->_aBuiltInRootMenuSlugs[ $_sMenuLabelLower ]; |
|
80 | + } |
|
80 | 81 | |
81 | 82 | } |
82 | 83 | |
@@ -214,12 +215,12 @@ discard block |
||
214 | 215 | public function addSubMenuLink( array $aSubMenuLink ) { |
215 | 216 | |
216 | 217 | // If required keys are not set, return. |
217 | - if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { |
|
218 | + if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { |
|
218 | 219 | return; |
219 | 220 | } |
220 | 221 | |
221 | 222 | // If the set URL is not valid, return. |
222 | - if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { |
|
223 | + if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { |
|
223 | 224 | return; |
224 | 225 | } |
225 | 226 | |
@@ -312,7 +313,7 @@ discard block |
||
312 | 313 | */ |
313 | 314 | public function addSubMenuPage( array $aSubMenuPage ) { |
314 | 315 | |
315 | - if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
316 | + if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
316 | 317 | return; |
317 | 318 | } |
318 | 319 |