@@ -31,7 +31,7 @@ |
||
31 | 31 | * @return string The generated field name model. |
32 | 32 | */ |
33 | 33 | public function getModel() { |
34 | - return $this->get() . '|' . $this->sIndexMark; |
|
34 | + return $this->get().'|'.$this->sIndexMark; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -25,26 +25,26 @@ |
||
25 | 25 | return $this->_getFiltered( $this->_getSectionName() ); |
26 | 26 | } |
27 | 27 | |
28 | - public function getModel() { |
|
29 | - return $this->get() . '[' . $this->sIndexMark . ']'; |
|
28 | + public function getModel() { |
|
29 | + return $this->get().'['.$this->sIndexMark.']'; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @return string |
34 | 34 | */ |
35 | - protected function _getSectionName( $isIndex=null ) { |
|
35 | + protected function _getSectionName( $isIndex = null ) { |
|
36 | 36 | |
37 | 37 | $this->aArguments = $this->aArguments + array( |
38 | 38 | 'section_id' => null, |
39 | 39 | '_index' => null, |
40 | 40 | ); |
41 | - if( isset( $isIndex ) ) { |
|
41 | + if ( isset( $isIndex ) ) { |
|
42 | 42 | $this->aArguments[ '_index' ] = $isIndex; |
43 | 43 | } |
44 | 44 | |
45 | 45 | $_aNameParts = $this->aArguments[ '_section_path_array' ]; |
46 | 46 | if ( isset( $this->aArguments[ 'section_id' ], $this->aArguments[ '_index' ] ) ) { |
47 | - $_aNameParts[] = $this->aArguments[ '_index' ]; |
|
47 | + $_aNameParts[ ] = $this->aArguments[ '_index' ]; |
|
48 | 48 | } |
49 | 49 | $_sResult = $this->_getInputNameConstructed( $_aNameParts ); |
50 | 50 | return $_sResult; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | return $this->_getFiltered( $this->_getSectionName() ); |
26 | 26 | } |
27 | 27 | |
28 | - public function getModel() { |
|
28 | + public function getModel() { |
|
29 | 29 | return $this->get() . '[' . $this->sIndexMark . ']'; |
30 | 30 | } |
31 | 31 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return string |
41 | 41 | */ |
42 | 42 | private function _getTransientKey() { |
43 | - return 'apf_ntc_' . get_current_user_id(); |
|
43 | + return 'apf_ntc_'.get_current_user_id(); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
53 | 53 | * @return boolean True if a setting notice is set; otherwise, false. |
54 | 54 | */ |
55 | - public function hasNotice( $sType='' ) { |
|
55 | + public function hasNotice( $sType = '' ) { |
|
56 | 56 | |
57 | - if ( ! $sType ) { |
|
57 | + if ( !$sType ) { |
|
58 | 58 | return ( boolean ) count( self::$_aNotices ); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Check if there is a message of the type. |
62 | - foreach( self::$_aNotices as $_aNotice ) { |
|
62 | + foreach ( self::$_aNotices as $_aNotice ) { |
|
63 | 63 | $_sClassAttribute = $this->getElement( |
64 | 64 | $_aNotice, |
65 | 65 | array( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function set( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
101 | + public function set( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
102 | 102 | |
103 | 103 | // If the array is empty, schedule the task of saving the array at shutdown. |
104 | 104 | if ( empty( self::$_aNotices ) ) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $_sID = md5( trim( $sMessage ) ); |
109 | 109 | |
110 | 110 | // If the override is false and a message is already set, do not add. |
111 | - if ( ! $bOverride && isset( self::$_aNotices[ $_sID ] ) ) { |
|
111 | + if ( !$bOverride && isset( self::$_aNotices[ $_sID ] ) ) { |
|
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | $_aAttributes = $this->getAsArray( $asAttributes ); |
121 | - if ( is_string( $asAttributes ) && ! empty( $asAttributes ) ) { |
|
121 | + if ( is_string( $asAttributes ) && !empty( $asAttributes ) ) { |
|
122 | 122 | $_aAttributes[ 'id' ] = $asAttributes; |
123 | 123 | } |
124 | 124 | self::$_aNotices[ $_sID ] = array( |
125 | 125 | 'sMessage' => $sMessage, |
126 | 126 | 'aAttributes' => $_aAttributes + array( |
127 | 127 | 'class' => $sType, |
128 | - 'id' => 'form_submit_notice_' . $_sID, |
|
128 | + 'id' => 'form_submit_notice_'.$_sID, |
|
129 | 129 | ), |
130 | 130 | ); |
131 | 131 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
169 | - if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
169 | + if ( isset( $_GET[ 'settings-notice' ] ) && !$_GET[ 'settings-notice' ] ) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return void |
142 | 142 | */ |
143 | 143 | public function _replyToSaveNotices() { |
144 | - if ( empty( self::$_aNotices ) ) { |
|
144 | + if ( empty( self::$_aNotices ) ) { |
|
145 | 145 | return; |
146 | 146 | } |
147 | 147 | $_bResult = $this->setTransient( |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | |
162 | 162 | // Retrieve the notifications set in a transient. |
163 | 163 | $_aNotices = $this->_getNotices(); |
164 | - if ( false === $_aNotices ) { |
|
164 | + if ( false === $_aNotices ) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
169 | - if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
169 | + if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 |
@@ -38,11 +38,11 @@ |
||
38 | 38 | * Retrieves meta data by given keys and type (user or post). |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - static public function getMetaDataByKeys( $iObjectID, $aKeys, $sMetaType='post' ) { |
|
41 | + static public function getMetaDataByKeys( $iObjectID, $aKeys, $sMetaType = 'post' ) { |
|
42 | 42 | |
43 | 43 | $_aSavedMeta = array(); |
44 | 44 | |
45 | - if ( ! $iObjectID ) { |
|
45 | + if ( !$iObjectID ) { |
|
46 | 46 | return $_aSavedMeta; |
47 | 47 | } |
48 | 48 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | : @mysql_get_server_info(), |
43 | 43 | ); |
44 | 44 | |
45 | - foreach( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
45 | + foreach ( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
46 | 46 | |
47 | 47 | $_aItem = array_values( $_aItem ); |
48 | 48 | $_sKey = array_shift( $_aItem ); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | static public function getMySQLErrorLogPath() { |
64 | 64 | |
65 | 65 | $_aMySQLInfo = self::getMySQLInfo(); |
66 | - return isset( $_aMySQLInfo['log_error'] ) |
|
67 | - ? $_aMySQLInfo['log_error'] |
|
66 | + return isset( $_aMySQLInfo[ 'log_error' ] ) |
|
67 | + ? $_aMySQLInfo[ 'log_error' ] |
|
68 | 68 | : ''; |
69 | 69 | |
70 | 70 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * Returns a PHP error log. |
74 | 74 | * @since 3.4.6 |
75 | 75 | */ |
76 | - static public function getMySQLErrorLog( $iLines=1 ) { |
|
76 | + static public function getMySQLErrorLog( $iLines = 1 ) { |
|
77 | 77 | |
78 | 78 | $_sLog = self::getFileTailContents( self::getMySQLErrorLogPath(), $iLines ); |
79 | 79 |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | $_sQuoteCharactor = "'"; |
40 | 40 | $_aOutput = array(); |
41 | - foreach( $aAttributes as $_sAttribute => $_mProperty ) { |
|
41 | + foreach ( $aAttributes as $_sAttribute => $_mProperty ) { |
|
42 | 42 | if ( is_scalar( $_mProperty ) ) { |
43 | - $_aOutput[] = "{$_sAttribute}={$_sQuoteCharactor}" . esc_attr( $_mProperty ) . "{$_sQuoteCharactor}"; |
|
43 | + $_aOutput[ ] = "{$_sAttribute}={$_sQuoteCharactor}".esc_attr( $_mProperty )."{$_sQuoteCharactor}"; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | return implode( ' ', $_aOutput ); |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | * @since 3.6.0 |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - static public function getHTMLTag( $sTagName, array $aAttributes, $sValue=null ) { |
|
82 | + static public function getHTMLTag( $sTagName, array $aAttributes, $sValue = null ) { |
|
83 | 83 | $_sTag = tag_escape( $sTagName ); |
84 | 84 | return null === $sValue |
85 | - ? "<" . $_sTag . " " . self::getAttributes( $aAttributes ) . " />" |
|
86 | - : "<" . $_sTag . " " . self::getAttributes( $aAttributes ) . ">" |
|
85 | + ? "<".$_sTag." ".self::getAttributes( $aAttributes )." />" |
|
86 | + : "<".$_sTag." ".self::getAttributes( $aAttributes ).">" |
|
87 | 87 | . $sValue |
88 | 88 | . "</{$_sTag}>"; |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return string |
94 | 94 | * @deprecated 3.6.0 Use `getHTMLTag()` instead. |
95 | 95 | */ |
96 | - static public function generateHTMLTag( $sTagName, array $aAttributes, $sValue=null ) { |
|
96 | + static public function generateHTMLTag( $sTagName, array $aAttributes, $sValue = null ) { |
|
97 | 97 | return self::getHTMLTag( $sTagName, $aAttributes, $sValue ); |
98 | 98 | } |
99 | 99 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | * @since 3.5.3 |
53 | 53 | * @return string The site language. |
54 | 54 | */ |
55 | - static public function getSiteLanguage( $sDefault='en_US' ) { |
|
55 | + static public function getSiteLanguage( $sDefault = 'en_US' ) { |
|
56 | 56 | return defined( 'WPLANG' ) && WPLANG ? WPLANG : $sDefault; |
57 | 57 | } |
58 | 58 |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | $_aInvert = array(); |
206 | 206 | foreach( $aModel as $_isKey => $_v ) { |
207 | - if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
207 | + if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | $_aInvert[ $_isKey ] = $_v; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public static function uniteArraysRecursive( $aPrecedence, $aDefault ) { |
258 | 258 | |
259 | - if ( is_null( $aPrecedence ) ) { |
|
259 | + if ( is_null( $aPrecedence ) ) { |
|
260 | 260 | $aPrecedence = array(); |
261 | 261 | } |
262 | 262 | |
263 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
263 | + if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
264 | 264 | return $aPrecedence; |
265 | 265 | } |
266 | 266 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return integer |
34 | 34 | * @internal |
35 | 35 | */ |
36 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
36 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
37 | 37 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
38 | 38 | ? $a[ $sKey ] - $b[ $sKey ] |
39 | 39 | : 1; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
77 | 77 | |
78 | 78 | $_sKey = array_shift( $aKeys ); |
79 | - if ( ! empty( $aKeys ) ) { |
|
79 | + if ( !empty( $aKeys ) ) { |
|
80 | 80 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
81 | 81 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
82 | 82 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
98 | 98 | |
99 | 99 | $_sKey = array_shift( $aKeys ); |
100 | - if ( ! empty( $aKeys ) ) { |
|
101 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
100 | + if ( !empty( $aKeys ) ) { |
|
101 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
102 | 102 | $mSubject[ $_sKey ] = array(); |
103 | 103 | } |
104 | 104 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | |
153 | 153 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
154 | 154 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
155 | - foreach( $_aNumeric as &$_aElem ) { |
|
155 | + foreach ( $_aNumeric as &$_aElem ) { |
|
156 | 156 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
157 | 157 | } |
158 | - if ( ! empty( $_aAssociative ) ) { |
|
158 | + if ( !empty( $_aAssociative ) ) { |
|
159 | 159 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
160 | 160 | } |
161 | 161 | return $_aNumeric; |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | public static function castArrayContents( array $aModel, array $aSubject ) { |
179 | 179 | |
180 | 180 | $_aCast = array(); |
181 | - foreach( $aModel as $_isKey => $_v ) { |
|
181 | + foreach ( $aModel as $_isKey => $_v ) { |
|
182 | 182 | $_aCast[ $_isKey ] = self::getElement( |
183 | - $aSubject, // subject array |
|
184 | - $_isKey, // key |
|
183 | + $aSubject, // subject array |
|
184 | + $_isKey, // key |
|
185 | 185 | null // default |
186 | 186 | ); |
187 | 187 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
203 | 203 | |
204 | 204 | $_aInvert = array(); |
205 | - foreach( $aModel as $_isKey => $_v ) { |
|
205 | + foreach ( $aModel as $_isKey => $_v ) { |
|
206 | 206 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
207 | 207 | continue; |
208 | 208 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
229 | 229 | |
230 | 230 | $_aArray = array(); |
231 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
231 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
232 | 232 | $_aArray = self::uniteArraysRecursive( |
233 | 233 | self::getAsArray( $_aArg ), |
234 | 234 | $_aArray |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $aPrecedence = array(); |
260 | 260 | } |
261 | 261 | |
262 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
262 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
263 | 263 | return $aPrecedence; |
264 | 264 | } |
265 | 265 | |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | return $aPrecedence; |
269 | 269 | } |
270 | 270 | |
271 | - foreach( $aDefault as $sKey => $v ) { |
|
271 | + foreach ( $aDefault as $sKey => $v ) { |
|
272 | 272 | |
273 | 273 | // If the precedence does not have the key, assign the default's value. |
274 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
274 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
275 | 275 | $aPrecedence[ $sKey ] = $v; |
276 | 276 | } else { |
277 | 277 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | * - NULL |
303 | 303 | * @return array The modified array. |
304 | 304 | */ |
305 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
305 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
306 | 306 | |
307 | - foreach( $aArray as $isKey => $vValue ) { |
|
307 | + foreach ( $aArray as $isKey => $vValue ) { |
|
308 | 308 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
309 | 309 | unset( $aArray[ $isKey ] ); |
310 | 310 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | static public function dropElementByValue( array $aArray, $vValue ) { |
322 | 322 | |
323 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
323 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
324 | 324 | $_sKey = array_search( $_vValue, $aArray, true ); |
325 | 325 | if ( $_sKey === false ) { |
326 | 326 | continue; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
344 | 344 | |
345 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
345 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
346 | 346 | unset( $aArray[ $_isKey ] ); |
347 | 347 | } |
348 | 348 | return $aArray; |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |