@@ -127,7 +127,7 @@ |
||
| 127 | 127 | * @return string The set class selector(s). |
| 128 | 128 | */ |
| 129 | 129 | public function addClass( /* $asSelectors1, $asSelectors2 */ ) { |
| 130 | - foreach( func_get_args() as $_asSelectors ) { |
|
| 130 | + foreach( func_get_args() as $_asSelectors ) { |
|
| 131 | 131 | $this->aAttributes['class'] = $this->getClassAttribute( |
| 132 | 132 | $this->aAttributes['class'], |
| 133 | 133 | $_asSelectors |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | * @param array $aAttributes The attribute array. A field definition array is deprecated. |
| 64 | 64 | * @param array $aOptions options that allows the user to set custom container tags and class selectors. |
| 65 | 65 | */ |
| 66 | - public function __construct( array $aAttributes, array $aOptions=array() ) { |
|
| 66 | + public function __construct( array $aAttributes, array $aOptions = array() ) { |
|
| 67 | 67 | |
| 68 | - $this->aAttributes = $this->getElementAsArray( |
|
| 68 | + $this->aAttributes = $this->getElementAsArray( |
|
| 69 | 69 | $aAttributes, |
| 70 | 70 | 'attributes', |
| 71 | 71 | $aAttributes // if the above key is not set, this will be set |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | * @return string The set class selector(s). |
| 128 | 128 | */ |
| 129 | 129 | public function addClass( /* $asSelectors1, $asSelectors2 */ ) { |
| 130 | - foreach( func_get_args() as $_asSelectors ) { |
|
| 131 | - $this->aAttributes['class'] = $this->getClassAttribute( |
|
| 132 | - $this->aAttributes['class'], |
|
| 130 | + foreach ( func_get_args() as $_asSelectors ) { |
|
| 131 | + $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
|
| 132 | + $this->aAttributes[ 'class' ], |
|
| 133 | 133 | $_asSelectors |
| 134 | 134 | ); |
| 135 | 135 | } |
| 136 | - return $this->aAttributes['class']; |
|
| 136 | + return $this->aAttributes[ 'class' ]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // $this->aAttributes[ $_aParams[ 0 ] ] = $_aParams[ 1 ]; |
| 159 | 159 | $this->setMultiDimensionalArray( |
| 160 | 160 | $this->aAttributes, |
| 161 | - $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
| 161 | + $this->getElementAsArray( $_aParams, 0 ), // $asAttributeName |
|
| 162 | 162 | $_aParams[ 1 ] // $mValue |
| 163 | 163 | ); |
| 164 | 164 | } |
@@ -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 | |
@@ -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 | |
@@ -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,8 +302,8 @@ discard block |
||
| 302 | 302 | * - NULL |
| 303 | 303 | * @return array The modified array. |
| 304 | 304 | */ |
| 305 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
| 306 | - foreach( $aArray as $isKey => $vValue ) { |
|
| 305 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
| 306 | + foreach ( $aArray as $isKey => $vValue ) { |
|
| 307 | 307 | if ( in_array( gettype( $vValue ), $aTypes, true ) ) { |
| 308 | 308 | unset( $aArray[ $isKey ] ); |
| 309 | 309 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | */ |
| 320 | 320 | static public function dropElementByValue( array $aArray, $vValue ) { |
| 321 | 321 | |
| 322 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 322 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 323 | 323 | $_sKey = array_search( $_vValue, $aArray, true ); |
| 324 | 324 | if ( $_sKey === false ) { |
| 325 | 325 | continue; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
| 343 | 343 | |
| 344 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 344 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 345 | 345 | unset( $aArray[ $_isKey ] ); |
| 346 | 346 | } |
| 347 | 347 | return $aArray; |
@@ -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 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $_aParameters = func_get_args() + array( |
| 37 | 37 | $this->aSubject, |
| 38 | 38 | ); |
| 39 | - $this->aSubject = $_aParameters[ 0 ]; |
|
| 39 | + $this->aSubject = $_aParameters[ 0 ]; |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | */ |
| 113 | 113 | public function removeSection( $sSectionID ) { |
| 114 | 114 | |
| 115 | - if ( '_default' === $sSectionID ){ |
|
| 115 | + if ( '_default' === $sSectionID ) { |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | unset( |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @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. |
| 45 | 45 | * @return boolean True if a setting notice is set; otherwise, false. |
| 46 | 46 | */ |
| 47 | - public function hasSubmitNotice( $sType='' ) { |
|
| 47 | + public function hasSubmitNotice( $sType = '' ) { |
|
| 48 | 48 | return $this->oSubmitNotice->hasNotice( $sType ); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @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. |
| 71 | 71 | * @return void |
| 72 | 72 | */ |
| 73 | - public function setSubmitNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
| 73 | + public function setSubmitNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
| 74 | 74 | $this->oSubmitNotice->set( |
| 75 | 75 | $sMessage, |
| 76 | 76 | $sType, |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $this->aSectionsets[ $aSectionset[ 'section_id' ] ] = $aSectionset; |
| 99 | 99 | $this->aFieldsets[ $aSectionset[ 'section_id' ] ] = $this->getElement( |
| 100 | - $this->aFieldsets, // subject array |
|
| 100 | + $this->aFieldsets, // subject array |
|
| 101 | 101 | $aSectionset[ 'section_id' ], // key |
| 102 | 102 | array() // default |
| 103 | 103 | ); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function removeSection( $sSectionID ) { |
| 114 | 114 | |
| 115 | - if ( '_default' === $sSectionID ){ |
|
| 115 | + if ( '_default' === $sSectionID ) { |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | unset( |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @return void |
| 152 | 152 | */ |
| 153 | 153 | public function addResource( $sKey, $sValue ) { |
| 154 | - self::$_aResources[ $sKey ][] = $sValue; |
|
| 154 | + self::$_aResources[ $sKey ][ ] = $sValue; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | public function addField( $asFieldset ) { |
| 175 | 175 | |
| 176 | 176 | // If it is a target section, update the property and return. |
| 177 | - if ( ! $this->_isFieldsetDefinition( $asFieldset ) ) { |
|
| 177 | + if ( !$this->_isFieldsetDefinition( $asFieldset ) ) { |
|
| 178 | 178 | $this->_asTargetSectionID = $this->_getTargetSectionID( $asFieldset ); |
| 179 | 179 | return $this->_asTargetSectionID; |
| 180 | 180 | } |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | // Set the target section ID |
| 185 | 185 | $this->_asTargetSectionID = $this->getElement( |
| 186 | - $_aFieldset, // subject array |
|
| 186 | + $_aFieldset, // subject array |
|
| 187 | 187 | 'section_id', // key |
| 188 | 188 | $this->_asTargetSectionID // default |
| 189 | 189 | ); |
| 190 | 190 | |
| 191 | 191 | // Required Keys - 3.8.0+ Now 'type' can be omitted. |
| 192 | - if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
| 192 | + if ( !isset( $_aFieldset[ 'field_id' ] ) ) { |
|
| 193 | 193 | return null; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | public function removeField( $sFieldID ) { |
| 294 | 294 | |
| 295 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 295 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 296 | 296 | |
| 297 | 297 | if ( array_key_exists( $sFieldID, $_aSubSectionsOrFields ) ) { |
| 298 | 298 | unset( $this->aFieldsets[ $_sSectionID ][ $sFieldID ] ); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $aOptions // data source |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | - foreach( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
| 73 | + foreach ( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
| 74 | 74 | |
| 75 | 75 | $_aSubSection = $this->_getSubSectionFromOptions( |
| 76 | 76 | $_sSectionID, |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $_aSubSection = array(); |
| 109 | 109 | $_iPrevIndex = null; |
| 110 | - foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
| 110 | + foreach ( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
| 111 | 111 | |
| 112 | 112 | // If it is not a sub-section array, skip. |
| 113 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
| 113 | + if ( !$this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
| 114 | 114 | continue; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | ); |
| 125 | 125 | |
| 126 | 126 | // Update the internal section index key |
| 127 | - foreach( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
| 127 | + foreach ( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
| 128 | 128 | $_aField[ '_section_index' ] = $_iIndex; |
| 129 | 129 | } |
| 130 | 130 | unset( $_aField ); // to be safe in PHP |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | private function _getSubSectionItemsFromOptions( array $_aSubSection, $_sSectionID, $_iIndex, $_iPrevIndex ) { |
| 152 | 152 | |
| 153 | - if ( ! isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
| 153 | + if ( !isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
| 154 | 154 | return array(); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | : $this->getNonIntegerKeyElements( $this->aFieldsets[ $_sSectionID ] ); |
| 160 | 160 | |
| 161 | 161 | // if empty, merge with the previous element. |
| 162 | - return ! empty( $_aFields ) |
|
| 162 | + return !empty( $_aFields ) |
|
| 163 | 163 | ? $_aFields |
| 164 | 164 | : $this->getElementAsArray( |
| 165 | 165 | $_aSubSection, |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | * @since 3.6.0 Moved from `AdminPageFramework_FormDefinition`. |
| 25 | 25 | */ |
| 26 | 26 | static public $aStructure = array( |
| 27 | - 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
| 28 | - 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
| 29 | - 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
| 30 | - 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
| 31 | - 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
| 32 | - 'type' => 'box', // 3.7.0+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
| 27 | + 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
| 28 | + 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
| 29 | + 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
| 30 | + 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
| 31 | + 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
| 32 | + 'type' => 'box', // 3.7.0+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | public $abCollapsible = false; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @remark The framework will not pass this parameter when formatting a section definition array. |
| 43 | 43 | * It will be passed when the framework is rendering a form table to generate collapsible elements. |
| 44 | 44 | */ |
| 45 | - public $aSection = array(); |
|
| 45 | + public $aSection = array(); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Sets up properties. |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $_aCollapsible = $this->getAsArray( $this->abCollapsible ) + array( |
| 87 | 87 | 'title' => $sTitle, |
| 88 | - ) + self::$aStructure; |
|
| 88 | + ) + self::$aStructure; |
|
| 89 | 89 | |
| 90 | 90 | $_aCollapsible[ 'toggle_all_button' ] = implode( |
| 91 | 91 | ',', |
| 92 | 92 | $this->getAsArray( $_aCollapsible[ 'toggle_all_button' ] ) |
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | - if ( ! empty( $aSection ) ) { |
|
| 95 | + if ( !empty( $aSection ) ) { |
|
| 96 | 96 | $_aCollapsible[ 'toggle_all_button' ] = $this->_getToggleAllButtonArgument( |
| 97 | 97 | $_aCollapsible[ 'toggle_all_button' ], |
| 98 | 98 | $aSection |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | private function _getToggleAllButtonArgument( $sToggleAll, array $aSection ) { |
| 118 | 118 | |
| 119 | - if ( ! $aSection[ 'repeatable' ] ) { |
|
| 119 | + if ( !$aSection[ 'repeatable' ] ) { |
|
| 120 | 120 | return $sToggleAll; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Disable the toggle all button for middle sub-sections in repeatable sections. |
| 129 | - if ( ! $aSection[ '_is_first_index' ] && ! $aSection[ '_is_last_index' ] ) { |
|
| 129 | + if ( !$aSection[ '_is_first_index' ] && !$aSection[ '_is_last_index' ] ) { |
|
| 130 | 130 | return 0; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $_aToggleAll = $this->getAOrB( |
| 134 | - true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
| 135 | - array( 'top-right', 'bottom-right' ), // if true |
|
| 134 | + true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
| 135 | + array( 'top-right', 'bottom-right' ), // if true |
|
| 136 | 136 | explode( ',', $sToggleAll ) // if false |
| 137 | 137 | ); |
| 138 | 138 | $_aToggleAll = $this->getAOrB( |