@@ -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 |
@@ -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 | } |
@@ -277,7 +277,7 @@ |
||
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
280 | - /** |
|
280 | + /** |
|
281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
282 | 282 | * |
283 | 283 | * @since 3.5.6 |
@@ -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 ) ) { |
@@ -281,6 +281,8 @@ discard block |
||
281 | 281 | * @remark Used by the setInPageTabsVisibility() method. |
282 | 282 | * @since 2.0.0 |
283 | 283 | * @since 2.1.5 The $oCaller parameter was added. |
284 | + * @param AdminPageFramework_Router $oCaller |
|
285 | + * @param string $sClassName |
|
284 | 286 | */ |
285 | 287 | public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
286 | 288 | |
@@ -419,6 +421,7 @@ discard block |
||
419 | 421 | * |
420 | 422 | * This is to support transient form data which disappears with the set timeout. |
421 | 423 | * |
424 | + * @param string $sOptionType |
|
422 | 425 | * @return array The retrieved options array. |
423 | 426 | */ |
424 | 427 | private function _getOptionsByType( $sOptionType ) { |
@@ -486,6 +489,7 @@ discard block |
||
486 | 489 | /** |
487 | 490 | * |
488 | 491 | * @since 3.5.9 |
492 | + * @param string $sOptionType |
|
489 | 493 | * @return boolean True if saved; otherwise, false. |
490 | 494 | */ |
491 | 495 | private function _updateOptionsByType( $aOptions, $sOptionType ) { |
@@ -581,6 +585,7 @@ discard block |
||
581 | 585 | * @since 2.1.5 Made it public and moved from the AdminPageFramework_Page class since this method is used by the AdminPageFramework_HeadTab class as well. |
582 | 586 | * @internal |
583 | 587 | * @remark Used in the __call() method in the main class. |
588 | + * @param string $sPageSlug |
|
584 | 589 | * @return string The default in-page tab slug if found; otherwise, an empty string. |
585 | 590 | */ |
586 | 591 | public function getDefaultInPageTab( $sPageSlug ) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public $aDisallowedQueryKeys = array( |
220 | 220 | 'settings-updated', |
221 | - 'confirmation', // 3.3.0+ |
|
221 | + 'confirmation', // 3.3.0+ |
|
222 | 222 | 'field_errors' // 3.4.1+ |
223 | 223 | ); |
224 | 224 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * Stores the cache lifetime of the transient used for the form options when the user passes an integer to the option key parameter. |
274 | 274 | * @since 3.5.9 |
275 | 275 | */ |
276 | - public $iOptionTransientDuration = 0; |
|
276 | + public $iOptionTransientDuration = 0; |
|
277 | 277 | |
278 | 278 | /** |
279 | 279 | * Constructs the instance of AdminPageFramework_Property_Page class object. |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | * @since 2.0.0 |
283 | 283 | * @since 2.1.5 The $oCaller parameter was added. |
284 | 284 | */ |
285 | - public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
285 | + public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
286 | 286 | |
287 | 287 | // DEVVER+ This must be set before the parent constructor. As the form arguments array uses this value. |
288 | - $this->_sFormRegistrationHook = 'load_after_' . $sClassName; |
|
288 | + $this->_sFormRegistrationHook = 'load_after_'.$sClassName; |
|
289 | 289 | |
290 | 290 | parent::__construct( |
291 | 291 | $oCaller, |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | } |
362 | 362 | // The user want to save options in a transient. |
363 | 363 | if ( in_array( $_sType, array( 'integer' ) ) ) { |
364 | - return 'apf_' . $sClassName . '_' . get_current_user_id(); |
|
364 | + return 'apf_'.$sClassName.'_'.get_current_user_id(); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | // Unknown type - maybe the user is trying to do something advanced. |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | protected function _isAdminPage() { |
390 | 390 | |
391 | - if ( ! is_admin() ) { |
|
391 | + if ( !is_admin() ) { |
|
392 | 392 | return false; |
393 | 393 | } |
394 | 394 | return isset( $_GET[ 'page' ] ); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | case 'transient': |
437 | 437 | return $this->getAsArray( |
438 | 438 | $this->getTransient( |
439 | - $this->sOptionKey, // transient key |
|
439 | + $this->sOptionKey, // transient key |
|
440 | 440 | array() // default |
441 | 441 | ) |
442 | 442 | ); |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @since 3.1.1 Made it return a value. |
471 | 471 | * @return boolean True if saved; otherwise, false. |
472 | 472 | */ |
473 | - public function updateOption( $aOptions=null ) { |
|
473 | + public function updateOption( $aOptions = null ) { |
|
474 | 474 | |
475 | 475 | if ( $this->_bDisableSavingOptions ) { |
476 | 476 | return false; |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | ); |
499 | 499 | case 'transient': |
500 | 500 | return $this->setTransient( |
501 | - $this->sOptionKey, // transient key |
|
501 | + $this->sOptionKey, // transient key |
|
502 | 502 | $aOptions, |
503 | 503 | $this->iOptionTransientDuration |
504 | 504 | ); |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @since 2.1.0 Set the default value to the parameter and if the parameter value is empty, it applies the current $_GET[ 'page' ] value. |
514 | 514 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
515 | 515 | */ |
516 | - public function isPageAdded( $sPageSlug='' ) { |
|
516 | + public function isPageAdded( $sPageSlug = '' ) { |
|
517 | 517 | |
518 | 518 | $sPageSlug = trim( $sPageSlug ); |
519 | 519 | $sPageSlug = $sPageSlug |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | */ |
533 | 533 | public function getCurrentPageSlug() { |
534 | 534 | return $this->getElement( |
535 | - $_GET, // subject array |
|
535 | + $_GET, // subject array |
|
536 | 536 | 'page', // key |
537 | 537 | '' // default |
538 | 538 | ); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @return string The found tab slug. An empty string if not found. |
551 | 551 | * @remark Do not return `null` when not found as some framework methods check the returned value with `isset()` and if null is given, `isset()` yields `false` while it does `true` for an empty string (''). |
552 | 552 | */ |
553 | - public function getCurrentTabSlug( $sCurrentPageSlug='' ) { |
|
553 | + public function getCurrentTabSlug( $sCurrentPageSlug = '' ) { |
|
554 | 554 | |
555 | 555 | // It is possible that the tab slug is not set if it is the default tab. |
556 | 556 | $_sTabSlug = $this->getElement( $_GET, 'tab' ); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * |
571 | 571 | * @deprecated 3.5.3 |
572 | 572 | */ |
573 | - public function getCurrentTab( $sCurrentPageSlug='' ) { |
|
573 | + public function getCurrentTab( $sCurrentPageSlug = '' ) { |
|
574 | 574 | return $this->getCurrentTabSlug( $sCurrentPageSlug ); |
575 | 575 | } |
576 | 576 | |
@@ -585,11 +585,11 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function getDefaultInPageTab( $sPageSlug ) { |
587 | 587 | |
588 | - if ( ! $sPageSlug ) { |
|
588 | + if ( !$sPageSlug ) { |
|
589 | 589 | return ''; |
590 | 590 | } |
591 | 591 | return $this->getElement( |
592 | - $this->aDefaultInPageTabs, // subject array |
|
592 | + $this->aDefaultInPageTabs, // subject array |
|
593 | 593 | $sPageSlug, // key |
594 | 594 | '' // default |
595 | 595 | ); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @since 3.5.9 |
323 | 323 | * @return void |
324 | 324 | */ |
325 | - private function _setOptionsProperties( $aisOptionKey, $sClassName ) { |
|
325 | + private function _setOptionsProperties( $aisOptionKey, $sClassName ) { |
|
326 | 326 | |
327 | 327 | $_aArguments = is_array( $aisOptionKey ) |
328 | 328 | ? $aisOptionKey |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @since 2.1.0 Set the default value to the parameter and if the parameter value is empty, it applies the current $_GET[ 'page' ] value. |
514 | 514 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
515 | 515 | */ |
516 | - public function isPageAdded( $sPageSlug='' ) { |
|
516 | + public function isPageAdded( $sPageSlug='' ) { |
|
517 | 517 | |
518 | 518 | $sPageSlug = trim( $sPageSlug ); |
519 | 519 | $sPageSlug = $sPageSlug |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | // It is possible that the tab slug is not set if it is the default tab. |
556 | 556 | $_sTabSlug = $this->getElement( $_GET, 'tab' ); |
557 | - if ( $_sTabSlug ) { |
|
557 | + if ( $_sTabSlug ) { |
|
558 | 558 | return $_sTabSlug; |
559 | 559 | } |
560 | 560 | $sCurrentPageSlug = $sCurrentPageSlug |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function getDefaultInPageTab( $sPageSlug ) { |
587 | 587 | |
588 | - if ( ! $sPageSlug ) { |
|
588 | + if ( ! $sPageSlug ) { |
|
589 | 589 | return ''; |
590 | 590 | } |
591 | 591 | return $this->getElement( |
@@ -25,6 +25,7 @@ |
||
25 | 25 | /** |
26 | 26 | * Sets up properties. |
27 | 27 | * @since 3.6.3 |
28 | + * @param AdminPageFramework_Model_Form $oFactory |
|
28 | 29 | */ |
29 | 30 | public function __construct( $oFactory ) { |
30 | 31 |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( $oFactory ) { |
30 | 30 | |
31 | - $this->oFactory = $oFactory; |
|
31 | + $this->oFactory = $oFactory; |
|
32 | 32 | |
33 | 33 | // Form emails. |
34 | - if ( ! isset( $_GET[ 'apf_action' ], $_GET[ 'transient' ] ) ) { |
|
34 | + if ( !isset( $_GET[ 'apf_action' ], $_GET[ 'transient' ] ) ) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | if ( 'email' !== $_GET[ 'apf_action' ] ) { |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | self::$_bDoneEmail = true; |
74 | 74 | |
75 | 75 | $_sTransient = $this->getElement( $_GET, 'transient', '' ); |
76 | - if ( ! $_sTransient ) { |
|
76 | + if ( !$_sTransient ) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 | $_aFormEmail = $this->getTransient( $_sTransient ); |
80 | 80 | $this->deleteTransient( $_sTransient ); |
81 | - if ( ! is_array( $_aFormEmail ) ) { |
|
81 | + if ( !is_array( $_aFormEmail ) ) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 |
@@ -26,6 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Sets up hooks and properties. |
28 | 28 | * @since 3.6.3 |
29 | + * @param AdminPageFramework_Model_Form $oFactory |
|
29 | 30 | */ |
30 | 31 | public function __construct( $oFactory, $aSavedData, $aArguments, $aSectionsets, $aFieldsets ) { |
31 | 32 | |
@@ -250,6 +251,9 @@ discard block |
||
250 | 251 | * Do the 'submit_...' actions. |
251 | 252 | * |
252 | 253 | * @internal |
254 | + * @param null|string $_sSubmitSectionID |
|
255 | + * @param null|string $_sPressedFieldID |
|
256 | + * @param null|string $_sPressedInputID |
|
253 | 257 | * @return void |
254 | 258 | * @since 3.5.3 |
255 | 259 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
@@ -296,6 +300,8 @@ discard block |
||
296 | 300 | * Do the 'submit_after_...' actions. |
297 | 301 | * |
298 | 302 | * @internal |
303 | + * @param null|string $_sSubmitSectionID |
|
304 | + * @param null|string $_sPressedFieldID |
|
299 | 305 | * @return void |
300 | 306 | * @since 3.5.3 |
301 | 307 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct( $oFactory, $aSavedData, $aArguments, $aSectionsets, $aFieldsets ) { |
31 | 31 | |
32 | - $this->oFactory = $oFactory; |
|
32 | + $this->oFactory = $oFactory; |
|
33 | 33 | |
34 | 34 | // add_action |
35 | 35 | // @deprecated DEVVER |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function _handleFormData() { |
74 | 74 | |
75 | - if ( ! $this->_shouldProceed() ) { |
|
75 | + if ( !$this->_shouldProceed() ) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | new AdminPageFramework_Model__FormSubmission__Validator( $this->oFactory ); |
128 | 128 | |
129 | 129 | // [3.6.3+] Apply filters. All the sub-routines of handling form submit data use this filter hook. |
130 | - $_aInputs = $this->addAndApplyFilters( |
|
130 | + $_aInputs = $this->addAndApplyFilters( |
|
131 | 131 | $this->oFactory, |
132 | 132 | "validation_pre_{$this->oFactory->oProp->sClassName}", |
133 | 133 | $_aInputs, |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | // Save the data. |
140 | 140 | $_bUpdated = false; |
141 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
141 | + if ( !$this->oFactory->oProp->_bDisableSavingOptions ) { |
|
142 | 142 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
143 | 143 | } |
144 | 144 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | private function _shouldProceed() { |
178 | 178 | |
179 | 179 | if ( |
180 | - ! isset( |
|
180 | + !isset( |
|
181 | 181 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
182 | 182 | $_POST[ '_wp_http_referer' ] |
183 | 183 | ) |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | // Check if all the form fields are sent. |
196 | 196 | if ( |
197 | - ! isset( |
|
197 | + !isset( |
|
198 | 198 | // these keys are supposed to be embedded at the end of the form. |
199 | 199 | // if the server truncates the form input values for `max_input_vars`, these will be lost in PHP 5.3.9 or above. |
200 | 200 | $_POST[ '_is_admin_page_framework' ], // holds the form nonce |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | |
217 | - $_sNonceTransientKey = 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ); |
|
217 | + $_sNonceTransientKey = 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ); |
|
218 | 218 | if ( $_POST[ '_is_admin_page_framework' ] !== $this->getTransient( $_sNonceTransientKey ) ) { |
219 | 219 | $this->oFactory->setAdminNotice( $this->oFactory->oMsg->get( 'nonce_verification_failed' ) ); |
220 | 220 | return false; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | private function _getUserInputsFromPOST() { |
234 | 234 | |
235 | - $_aInputs = $this->getElementAsArray( |
|
235 | + $_aInputs = $this->getElementAsArray( |
|
236 | 236 | $_POST, |
237 | 237 | $this->oFactory->oProp->sOptionKey, |
238 | 238 | array() |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // Warnings for deprecated hooks. |
260 | 260 | if ( has_action( "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}" ) ) { |
261 | 261 | trigger_error( |
262 | - 'Admin Page Framework: ' . ' : ' |
|
262 | + 'Admin Page Framework: '.' : ' |
|
263 | 263 | . sprintf( |
264 | 264 | __( 'The hook <code>%1$s</code>is deprecated. Use <code>%2$s</code> instead.', $this->oFactory->oProp->sTextDomain ), |
265 | 265 | "submit_{instantiated class name}_{pressed input id}", |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $this->oFactory, |
273 | 273 | array( |
274 | 274 | // @todo deprecate the hook with the input ID |
275 | - "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
275 | + "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
276 | 276 | $_sSubmitSectionID |
277 | 277 | ? "submit_{$this->oFactory->oProp->sClassName}_{$_sSubmitSectionID}_{$_sPressedFieldID}" |
278 | 278 | : "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedFieldID}", |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | |
356 | 356 | // Drop the 'field_errors' key. |
357 | 357 | $_aRemoveQueries = array(); |
358 | - if ( ! isset( $aStatus[ 'field_errors' ] ) || ! $aStatus[ 'field_errors' ] ) { |
|
358 | + if ( !isset( $aStatus[ 'field_errors' ] ) || !$aStatus[ 'field_errors' ] ) { |
|
359 | 359 | unset( $aStatus[ 'field_errors' ] ); |
360 | - $_aRemoveQueries[] = 'field_errors'; |
|
360 | + $_aRemoveQueries[ ] = 'field_errors'; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | return $this->addAndApplyFilters( // 3.4.4+ |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | private function _removePageElements( $aOptions, $sPageSlug, $sTabSlug ) { |
384 | 384 | |
385 | - if ( ! $sPageSlug && ! $sTabSlug ) { |
|
385 | + if ( !$sPageSlug && !$sTabSlug ) { |
|
386 | 386 | return $aOptions; |
387 | 387 | } |
388 | 388 |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | // Save the data. |
140 | 140 | $_bUpdated = false; |
141 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
141 | + if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
142 | 142 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
143 | 143 | } |
144 | 144 | |
@@ -181,14 +181,15 @@ discard block |
||
181 | 181 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
182 | 182 | $_POST[ '_wp_http_referer' ] |
183 | 183 | ) |
184 | - ) { |
|
184 | + ) { |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | |
188 | 188 | // Referrer |
189 | 189 | $_sRequestURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), wp_unslash( $_SERVER[ 'REQUEST_URI' ] ) ); |
190 | 190 | $_sReffererURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), $_POST[ '_wp_http_referer' ] ); |
191 | - if ( $_sRequestURI != $_sReffererURI ) { // see the function definition of wp_referer_field() in functions.php. |
|
191 | + if ( $_sRequestURI != $_sReffererURI ) { |
|
192 | +// see the function definition of wp_referer_field() in functions.php. |
|
192 | 193 | return false; |
193 | 194 | } |
194 | 195 |