@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Admin Page Framework |
|
| 4 | - * |
|
| 5 | - * Facilitates WordPress plugin and theme development. |
|
| 6 | - * |
|
| 7 | - * @author Michael Uno <[email protected]> |
|
| 8 | - * @copyright 2013-2015 (c) Michael Uno |
|
| 9 | - * @license MIT <http://opensource.org/licenses/MIT> |
|
| 10 | - * @package AdminPageFramework |
|
| 11 | - */ |
|
| 3 | + * Admin Page Framework |
|
| 4 | + * |
|
| 5 | + * Facilitates WordPress plugin and theme development. |
|
| 6 | + * |
|
| 7 | + * @author Michael Uno <[email protected]> |
|
| 8 | + * @copyright 2013-2015 (c) Michael Uno |
|
| 9 | + * @license MIT <http://opensource.org/licenses/MIT> |
|
| 10 | + * @package AdminPageFramework |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Facilitates WordPress plugin and theme development. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | final class AdminPageFramework_Registry extends AdminPageFramework_Registry_Base { |
| 56 | 56 | |
| 57 | 57 | const TEXT_DOMAIN = 'admin-page-framework'; |
| 58 | - const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
| 58 | + const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Indicates whether the framework is loaded from the minified version or not. |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | * Sets up static properties. |
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | - static public function setUp( $sFilePath=__FILE__ ) { |
|
| 101 | + static public function setUp( $sFilePath = __FILE__ ) { |
|
| 102 | 102 | |
| 103 | 103 | self::$sFilePath = $sFilePath; |
| 104 | 104 | self::$sDirPath = dirname( self::$sFilePath ); |
| 105 | 105 | self::$sFileURI = plugins_url( '', self::$sFilePath ); |
| 106 | - self::$sIncludeClassListPath = self::$sDirPath . '/admin-page-framework-include-class-list.php'; |
|
| 106 | + self::$sIncludeClassListPath = self::$sDirPath.'/admin-page-framework-include-class-list.php'; |
|
| 107 | 107 | self::$aClassFiles = self::_getClassFilePathList( self::$sIncludeClassListPath ); |
| 108 | 108 | self::$sAutoLoaderPath = isset( self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] ) |
| 109 | 109 | ? self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return array |
| 118 | 118 | */ |
| 119 | 119 | static private function _getClassFilePathList( $sInclusionClassListPath ) { |
| 120 | - $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
| 120 | + $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
| 121 | 121 | include( $sInclusionClassListPath ); |
| 122 | 122 | return $aClassFiles; |
| 123 | 123 | } |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | static public function getVersion() { |
| 132 | 132 | |
| 133 | - if ( ! isset( self::$sAutoLoaderPath ) ) { |
|
| 134 | - trigger_error( 'Admin Page Framework: ' . ' : ' . sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
| 133 | + if ( !isset( self::$sAutoLoaderPath ) ) { |
|
| 134 | + trigger_error( 'Admin Page Framework: '.' : '.sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
| 135 | 135 | return self::VERSION; |
| 136 | 136 | } |
| 137 | 137 | $_aMinifiedVesionSuffix = array( |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | final class AdminPageFramework_Bootstrap { |
| 181 | 181 | |
| 182 | - public function __construct( $sLibraryPath=__FILE__ ) { |
|
| 182 | + public function __construct( $sLibraryPath = __FILE__ ) { |
|
| 183 | 183 | |
| 184 | - if ( ! $this->_isLoadable() ) { |
|
| 184 | + if ( !$this->_isLoadable() ) { |
|
| 185 | 185 | return; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -if ( ! class_exists( 'AdminPageFramework_NetworkAdmin_Documentation' ) ) : |
|
| 9 | +if ( !class_exists( 'AdminPageFramework_NetworkAdmin_Documentation' ) ) : |
|
| 10 | 10 | /** |
| 11 | 11 | * Provides an abstract base to create admin pages in the network admin area. |
| 12 | 12 | * |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @since 3.6.0 |
| 23 | 23 | */ |
| 24 | - public $aData = array(); |
|
| 24 | + public $aData = array(); |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Stores the defaulte values. |
| 28 | 28 | */ |
| 29 | - public $aDefault = array(); |
|
| 29 | + public $aDefault = array(); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Sets up properties. |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $_aKeys = func_get_args() + array( null ); |
| 55 | 55 | |
| 56 | 56 | // If no key is specified, return the whole array. |
| 57 | - if ( ! isset( $_aKeys[ 0 ] ) ) { |
|
| 57 | + if ( !isset( $_aKeys[ 0 ] ) ) { |
|
| 58 | 58 | return $this->uniteArrays( |
| 59 | 59 | $this->aData, |
| 60 | 60 | $this->aDefault |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // Now either the section ID or field ID is given. |
| 71 | 71 | return $this->getArrayValueByArrayKeys( |
| 72 | - $this->aData, // subject array |
|
| 73 | - $_aKeys, // dimensional keys |
|
| 72 | + $this->aData, // subject array |
|
| 73 | + $_aKeys, // dimensional keys |
|
| 74 | 74 | $this->getDefaultValue( // default value |
| 75 | 75 | $_mDefault, |
| 76 | 76 | $_aKeys |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function set( /* $asKeys, $mValue */ ) { |
| 100 | 100 | |
| 101 | - $_aParameters = func_get_args(); |
|
| 102 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 101 | + $_aParameters = func_get_args(); |
|
| 102 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | $_asKeys = $_aParameters[ 0 ]; |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
| 125 | 125 | |
| 126 | - $_aParameters = func_get_args(); |
|
| 127 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 126 | + $_aParameters = func_get_args(); |
|
| 127 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 128 | 128 | return; |
| 129 | 129 | } |
| 130 | 130 | $_asKeys = $_aParameters[ 0 ]; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @remark An alias of the dumpArray() method. |
| 27 | 27 | * @since 3.2.0 |
| 28 | 28 | */ |
| 29 | - static public function dump( $asArray, $sFilePath=null ) { |
|
| 29 | + static public function dump( $asArray, $sFilePath = null ) { |
|
| 30 | 30 | echo self::get( $asArray, $sFilePath ); |
| 31 | 31 | } |
| 32 | 32 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @since unknown |
| 38 | 38 | * @deprecated 3.2.0 |
| 39 | 39 | */ |
| 40 | - static public function dumpArray( $asArray, $sFilePath=null ) { |
|
| 40 | + static public function dumpArray( $asArray, $sFilePath = null ) { |
|
| 41 | 41 | self::dump( $asArray, $sFilePath ); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | * @remark An alias of getArray() method. |
| 50 | 50 | * @since 3.2.0 |
| 51 | 51 | */ |
| 52 | - static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
|
| 52 | + static public function get( $asArray, $sFilePath = null, $bEscape = true ) { |
|
| 53 | 53 | |
| 54 | 54 | if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
| 55 | 55 | |
| 56 | 56 | return $bEscape |
| 57 | - ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
| 57 | + ? "<pre class='dump-array'>".htmlspecialchars( self::getAsString( $asArray ) )."</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
| 58 | 58 | : self::getAsString( $asArray ); // non-escape is used for exporting data into file. |
| 59 | 59 | |
| 60 | 60 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @since 3.0.0 Changed the $bEncloseInTag parameter to bEscape. |
| 68 | 68 | * @deprecated` 3.2.0 |
| 69 | 69 | */ |
| 70 | - static public function getArray( $asArray, $sFilePath=null, $bEscape=true ) { |
|
| 70 | + static public function getArray( $asArray, $sFilePath = null, $bEscape = true ) { |
|
| 71 | 71 | return self::get( $asArray, $sFilePath, $bEscape ); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -83,18 +83,18 @@ discard block |
||
| 83 | 83 | * @param string $sFilePath The log file path. |
| 84 | 84 | * @return void |
| 85 | 85 | **/ |
| 86 | - static public function log( $mValue, $sFilePath=null ) { |
|
| 86 | + static public function log( $mValue, $sFilePath = null ) { |
|
| 87 | 87 | |
| 88 | 88 | static $_fPreviousTimeStamp = 0; |
| 89 | 89 | |
| 90 | 90 | $_oCallerInfo = debug_backtrace(); |
| 91 | 91 | $_sCallerFunction = self::getElement( |
| 92 | - $_oCallerInfo, // subject array |
|
| 92 | + $_oCallerInfo, // subject array |
|
| 93 | 93 | array( 1, 'function' ), // key |
| 94 | 94 | '' // default |
| 95 | 95 | ); |
| 96 | - $_sCallerClass = self::getElement( |
|
| 97 | - $_oCallerInfo, // subject array |
|
| 96 | + $_sCallerClass = self::getElement( |
|
| 97 | + $_oCallerInfo, // subject array |
|
| 98 | 98 | array( 1, 'class' ), // key |
| 99 | 99 | '' // default |
| 100 | 100 | ); |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | self::_getLogFilePath( $sFilePath, $_sCallerClass ), |
| 105 | 105 | self::_getLogHeadingLine( |
| 106 | 106 | $_fCurrentTimeStamp, |
| 107 | - round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
| 107 | + round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
| 108 | 108 | $_sCallerClass, |
| 109 | 109 | $_sCallerFunction |
| 110 | - ) . PHP_EOL |
|
| 110 | + ).PHP_EOL |
|
| 111 | 111 | . self::_getLogContents( $mValue ), |
| 112 | 112 | FILE_APPEND |
| 113 | 113 | ); |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | return $sFilePath; |
| 128 | 128 | } |
| 129 | 129 | if ( true === $sFilePath ) { |
| 130 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . date( "Ymd" ) . '.log'; |
|
| 130 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.date( "Ymd" ).'.log'; |
|
| 131 | 131 | } |
| 132 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . $sCallerClass . '_' . date( "Ymd" ) . '.log'; |
|
| 132 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.$sCallerClass.'_'.date( "Ymd" ).'.log'; |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | /** |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | $_iLengths = self::_getValueLength( $mValue, $_sType ); |
| 145 | 145 | return '(' |
| 146 | 146 | . $_sType |
| 147 | - . ( null !== $_iLengths ? ', length: ' . $_iLengths : '' ) |
|
| 147 | + . ( null !== $_iLengths ? ', length: '.$_iLengths : '' ) |
|
| 148 | 148 | . ') ' |
| 149 | 149 | . self::getAsString( $mValue ) |
| 150 | - . PHP_EOL . PHP_EOL; |
|
| 150 | + . PHP_EOL.PHP_EOL; |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | /** |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | $_nMicroseconds = str_pad( round( ( $_nNow - floor( $_nNow ) ) * 10000 ), 4, '0' ); |
| 189 | 189 | |
| 190 | 190 | $_aOutput = array( |
| 191 | - date( "Y/m/d H:i:s", $_nNow ) . '.' . $_nMicroseconds, |
|
| 191 | + date( "Y/m/d H:i:s", $_nNow ).'.'.$_nMicroseconds, |
|
| 192 | 192 | self::_getFormattedElapsedTime( $nElapsed ), |
| 193 | 193 | $_iPageLoadID, |
| 194 | 194 | AdminPageFramework_Registry::getVersion(), |
| 195 | - $sCallerClass . '::' . $sCallerFunction, |
|
| 195 | + $sCallerClass.'::'.$sCallerFunction, |
|
| 196 | 196 | current_filter(), |
| 197 | 197 | self::getCurrentURL(), |
| 198 | 198 | ); |
@@ -210,22 +210,22 @@ discard block |
||
| 210 | 210 | $_aElapsedParts = explode( ".", ( string ) $nElapsed ); |
| 211 | 211 | $_sElapsedFloat = str_pad( |
| 212 | 212 | self::getElement( |
| 213 | - $_aElapsedParts, // subject array |
|
| 213 | + $_aElapsedParts, // subject array |
|
| 214 | 214 | 1, // key |
| 215 | 215 | 0 // default |
| 216 | 216 | ), |
| 217 | 217 | 3, |
| 218 | 218 | '0' |
| 219 | 219 | ); |
| 220 | - $_sElapsed = self::getElement( |
|
| 221 | - $_aElapsedParts, // subject array |
|
| 222 | - 0, // key |
|
| 220 | + $_sElapsed = self::getElement( |
|
| 221 | + $_aElapsedParts, // subject array |
|
| 222 | + 0, // key |
|
| 223 | 223 | 0 // default |
| 224 | 224 | ); |
| 225 | - $_sElapsed = strlen( $_sElapsed ) > 1 |
|
| 226 | - ? '+' . substr( $_sElapsed, -1, 2 ) |
|
| 227 | - : ' ' . $_sElapsed; |
|
| 228 | - return $_sElapsed . '.' . $_sElapsedFloat; |
|
| 225 | + $_sElapsed = strlen( $_sElapsed ) > 1 |
|
| 226 | + ? '+'.substr( $_sElapsed, -1, 2 ) |
|
| 227 | + : ' '.$_sElapsed; |
|
| 228 | + return $_sElapsed.'.'.$_sElapsedFloat; |
|
| 229 | 229 | |
| 230 | 230 | } |
| 231 | 231 | /** |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @since 3.0.3 Changed the default log location and file name. |
| 236 | 236 | * @deprecated 3.1.0 Use the `log()` method instead. |
| 237 | 237 | */ |
| 238 | - static public function logArray( $asArray, $sFilePath=null ) { |
|
| 238 | + static public function logArray( $asArray, $sFilePath = null ) { |
|
| 239 | 239 | self::log( $asArray, $sFilePath ); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @since 3.4.4 |
| 267 | 267 | */ |
| 268 | - static public function getSliceByDepth( array $aSubject, $iDepth=0 ) { |
|
| 268 | + static public function getSliceByDepth( array $aSubject, $iDepth = 0 ) { |
|
| 269 | 269 | |
| 270 | 270 | foreach ( $aSubject as $_sKey => $_vValue ) { |
| 271 | 271 | if ( is_object( $_vValue ) ) { |
| 272 | 272 | $aSubject[ $_sKey ] = method_exists( $_vValue, '__toString' ) |
| 273 | 273 | ? ( string ) $_vValue // cast string |
| 274 | - : get_object_vars( $_vValue ); // convert it to array. |
|
| 274 | + : get_object_vars( $_vValue ); // convert it to array. |
|
| 275 | 275 | } |
| 276 | 276 | if ( is_array( $_vValue ) ) { |
| 277 | 277 | $_iDepth = $iDepth; |
@@ -51,7 +51,9 @@ |
||
| 51 | 51 | */ |
| 52 | 52 | static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
| 53 | 53 | |
| 54 | - if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
|
| 54 | + if ( $sFilePath ) { |
|
| 55 | + self::log( $asArray, $sFilePath ); |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | return $bEscape |
| 57 | 59 | ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | private $_iLevel; |
| 40 | 40 | |
| 41 | - public function __construct( $iLevel=null ) { |
|
| 41 | + public function __construct( $iLevel = null ) { |
|
| 42 | 42 | $this->_iLevel = null !== $iLevel |
| 43 | 43 | ? $iLeevl |
| 44 | 44 | : error_reporting(); |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | private function _getIncluded() { |
| 58 | 58 | |
| 59 | 59 | $_aIncluded = array(); |
| 60 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 60 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 61 | 61 | |
| 62 | 62 | // This is where we check if a level was used or not |
| 63 | 63 | if ( $this->_iLevel & $_iLevel ) { |
| 64 | - $_aIncluded[] = $_iLevel; |
|
| 64 | + $_aIncluded[ ] = $_iLevel; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | } |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | $_aValues = array(); |
| 76 | 76 | |
| 77 | 77 | if ( count( $aIncluded ) > $_iAll / 2 ) { |
| 78 | - $_aValues[] = 'E_ALL'; |
|
| 79 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 80 | - if ( ! in_array( $_iLevel, $aIncluded ) ) { |
|
| 81 | - $_aValues[] = $iLevelText; |
|
| 78 | + $_aValues[ ] = 'E_ALL'; |
|
| 79 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 80 | + if ( !in_array( $_iLevel, $aIncluded ) ) { |
|
| 81 | + $_aValues[ ] = $iLevelText; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | return implode( ' & ~', $_aValues ); |
| 85 | 85 | } |
| 86 | - foreach( $aIncluded as $_iLevel ) { |
|
| 87 | - $_aValues[] = $this->_aLevels[ $_iLevel ]; |
|
| 86 | + foreach ( $aIncluded as $_iLevel ) { |
|
| 87 | + $_aValues[ ] = $this->_aLevels[ $_iLevel ]; |
|
| 88 | 88 | } |
| 89 | 89 | return implode( ' | ', $_aValues ); |
| 90 | 90 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @since 3.6.3 |
| 24 | 24 | * @return string The captured output buffer. |
| 25 | 25 | */ |
| 26 | - static public function getOutputBuffer( $oCallable, array $aParameters=array() ) { |
|
| 26 | + static public function getOutputBuffer( $oCallable, array $aParameters = array() ) { |
|
| 27 | 27 | |
| 28 | 28 | ob_start(); |
| 29 | 29 | echo call_user_func_array( $oCallable, $aParameters ); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @return integer |
| 48 | 48 | * @internal |
| 49 | 49 | */ |
| 50 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
| 50 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
| 51 | 51 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
| 52 | 52 | ? $a[ $sKey ] - $b[ $sKey ] |
| 53 | 53 | : 1; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $_iCount = count( get_object_vars( $oInstance ) ); |
| 67 | 67 | $_sClassName = get_class( $oInstance ); |
| 68 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
| 68 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @since 3.1.1 |
| 79 | 79 | * @return string |
| 80 | 80 | */ |
| 81 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
| 81 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
| 82 | 82 | return is_numeric( $sLength ) |
| 83 | - ? $sLength . $sUnit |
|
| 83 | + ? $sLength.$sUnit |
|
| 84 | 84 | : $sLength; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | static public function getInlineCSS( array $aCSSRules ) { |
| 106 | 106 | $_aOutput = array(); |
| 107 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
| 108 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
| 107 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
| 108 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
| 109 | 109 | } |
| 110 | 110 | return implode( '; ', $_aOutput ); |
| 111 | 111 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | static public function getStyleAttribute( $asInlineCSSes ) { |
| 137 | 137 | |
| 138 | 138 | $_aCSSRules = array(); |
| 139 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
| 139 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
| 140 | 140 | |
| 141 | 141 | // For array, store in the container. |
| 142 | 142 | if ( is_array( $_asCSSRules ) ) { |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | // At this point, it is a string. Break them down to array elements. |
| 148 | 148 | $__aCSSRules = explode( ';', $_asCSSRules ); |
| 149 | - foreach( $__aCSSRules as $_sPair ) { |
|
| 149 | + foreach ( $__aCSSRules as $_sPair ) { |
|
| 150 | 150 | $_aCSSPair = explode( ':', $_sPair ); |
| 151 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
| 151 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
| 152 | 152 | continue; |
| 153 | 153 | } |
| 154 | 154 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
| 187 | 187 | |
| 188 | - $_aClasses = array(); |
|
| 189 | - foreach( func_get_args() as $_asClasses ) { |
|
| 190 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
| 188 | + $_aClasses = array(); |
|
| 189 | + foreach ( func_get_args() as $_asClasses ) { |
|
| 190 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
| 191 | 191 | continue; |
| 192 | 192 | } |
| 193 | 193 | $_aClasses = array_merge( |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | : explode( ' ', $_asClasses ) |
| 198 | 198 | ); |
| 199 | 199 | } |
| 200 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
| 200 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
| 201 | 201 | |
| 202 | 202 | // @todo examine if it is okay to remove the trim() function below. |
| 203 | 203 | return trim( implode( ' ', $_aClasses ) ); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
| 214 | 214 | $_aParams = func_get_args(); |
| 215 | 215 | return call_user_func_array( |
| 216 | - array( __CLASS__ , 'getClassAttribute' ), |
|
| 216 | + array( __CLASS__, 'getClassAttribute' ), |
|
| 217 | 217 | $_aParams |
| 218 | 218 | ); |
| 219 | 219 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | static public function getDataAttributeArray( array $aArray ) { |
| 228 | 228 | |
| 229 | 229 | $_aNewArray = array(); |
| 230 | - foreach( $aArray as $sKey => $v ) { |
|
| 230 | + foreach ( $aArray as $sKey => $v ) { |
|
| 231 | 231 | if ( in_array( gettype( $v ), array( 'array', 'object' ) ) ) { |
| 232 | 232 | continue; |
| 233 | 233 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields false. |
| 250 | 250 | * @return mixed |
| 251 | 251 | */ |
| 252 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
| 252 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
| 253 | 253 | return $mValue ? $mTrue : $mFalse; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $_aInvert = array(); |
| 124 | 124 | foreach( $aModel as $_isKey => $_v ) { |
| 125 | - if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
| 125 | + if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
| 126 | 126 | continue; |
| 127 | 127 | } |
| 128 | 128 | $_aInvert[ $_isKey ] = $_v; |
@@ -172,11 +172,11 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public static function uniteArraysRecursive( $aPrecedence, $aDefault ) { |
| 174 | 174 | |
| 175 | - if ( is_null( $aPrecedence ) ) { |
|
| 175 | + if ( is_null( $aPrecedence ) ) { |
|
| 176 | 176 | $aPrecedence = array(); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
| 179 | + if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
| 180 | 180 | return $aPrecedence; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -346,7 +346,8 @@ discard block |
||
| 346 | 346 | // array_key_exists( $_sKey, $aArray ) caused warnings in some occasions |
| 347 | 347 | if ( isset( $aArray[ $_sKey ] ) ) { |
| 348 | 348 | |
| 349 | - if ( empty( $aKeys ) ) { // no more keys |
|
| 349 | + if ( empty( $aKeys ) ) { |
|
| 350 | +// no more keys |
|
| 350 | 351 | return $aArray[ $_sKey ]; |
| 351 | 352 | } |
| 352 | 353 | |
@@ -473,7 +474,7 @@ discard block |
||
| 473 | 474 | static public function getReadableListOfArray( array $aArray ) { |
| 474 | 475 | |
| 475 | 476 | $_aOutput = array(); |
| 476 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
| 477 | + foreach( $aArray as $_sKey => $_vValue ) { |
|
| 477 | 478 | $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
| 478 | 479 | } |
| 479 | 480 | return implode( PHP_EOL, $_aOutput ); |
@@ -529,7 +530,7 @@ discard block |
||
| 529 | 530 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
| 530 | 531 | |
| 531 | 532 | $_aOutput = array(); |
| 532 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
| 533 | + foreach( $aArray as $_sKey => $_vValue ) { |
|
| 533 | 534 | $_aOutput[] = "<ul class='array-contents'>" |
| 534 | 535 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
| 535 | 536 | . "</ul>" . PHP_EOL; |
@@ -562,7 +563,7 @@ discard block |
||
| 562 | 563 | } |
| 563 | 564 | |
| 564 | 565 | // Now it is a nested item. |
| 565 | - foreach ( $vValue as $_sKey => $_vValue ) { |
|
| 566 | + foreach ( $vValue as $_sKey => $_vValue ) { |
|
| 566 | 567 | $_aOutput[] = "<ul class='array-contents'>" |
| 567 | 568 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
| 568 | 569 | . "</ul>"; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @since 3.6.0 |
| 24 | 24 | */ |
| 25 | 25 | static public function getFirstElement( array $aArray ) { |
| 26 | - foreach( $aArray as $_mElement ) { |
|
| 26 | + foreach ( $aArray as $_mElement ) { |
|
| 27 | 27 | return $_mElement; |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param string|array $asToDefault When the returning value matches oen of the set values here, the value(s) will be discarded and the default value will be applied. |
| 42 | 42 | * @return mixed The set value or the default value. |
| 43 | 43 | */ |
| 44 | - static public function getElement( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
| 44 | + static public function getElement( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
| 45 | 45 | |
| 46 | 46 | $_aToDefault = is_null( $asToDefault ) |
| 47 | 47 | ? array( null ) |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @since 3.5.3 The second parameter accepts dimensional array keys and added the fourth parameter. |
| 68 | 68 | * @return array The cast retrieved element value. |
| 69 | 69 | */ |
| 70 | - static public function getElementAsArray( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
| 70 | + static public function getElementAsArray( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
| 71 | 71 | return self::getAsArray( |
| 72 | 72 | self::getElement( $aSubject, $aisKey, $mDefault, $asToDefault ), |
| 73 | 73 | true // preserve an empty value |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | public static function castArrayContents( array $aModel, array $aSubject ) { |
| 89 | 89 | |
| 90 | 90 | $_aCast = array(); |
| 91 | - foreach( $aModel as $_isKey => $_v ) { |
|
| 91 | + foreach ( $aModel as $_isKey => $_v ) { |
|
| 92 | 92 | $_aCast[ $_isKey ] = self::getElement( |
| 93 | - $aSubject, // subject array |
|
| 94 | - $_isKey, // key |
|
| 93 | + $aSubject, // subject array |
|
| 94 | + $_isKey, // key |
|
| 95 | 95 | null // default |
| 96 | 96 | ); |
| 97 | 97 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
| 112 | 112 | |
| 113 | 113 | $_aInvert = array(); |
| 114 | - foreach( $aModel as $_isKey => $_v ) { |
|
| 114 | + foreach ( $aModel as $_isKey => $_v ) { |
|
| 115 | 115 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
| 116 | 116 | continue; |
| 117 | 117 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
| 137 | 137 | |
| 138 | 138 | $_aArray = array(); |
| 139 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
| 139 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
| 140 | 140 | $_aArray = self::uniteArraysRecursive( |
| 141 | 141 | self::getAsArray( $_aArg ), |
| 142 | 142 | $_aArray |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | $aPrecedence = array(); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
| 169 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
| 170 | 170 | return $aPrecedence; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - foreach( $aDefault as $sKey => $v ) { |
|
| 173 | + foreach ( $aDefault as $sKey => $v ) { |
|
| 174 | 174 | |
| 175 | 175 | // If the precedence does not have the key, assign the default's value. |
| 176 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
| 176 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
| 177 | 177 | $aPrecedence[ $sKey ] = $v; |
| 178 | 178 | } else { |
| 179 | 179 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | foreach ( $aParse as $_isKey => $_v ) { |
| 221 | 221 | |
| 222 | - if ( ! is_numeric( $_isKey ) ) { |
|
| 222 | + if ( !is_numeric( $_isKey ) ) { |
|
| 223 | 223 | unset( $aParse[ $_isKey ] ); |
| 224 | 224 | continue; |
| 225 | 225 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | // Convert string numeric value to integer or float. |
| 228 | 228 | $_isKey = $_isKey + 0; |
| 229 | 229 | |
| 230 | - if ( ! is_int( $_isKey ) ) { |
|
| 230 | + if ( !is_int( $_isKey ) ) { |
|
| 231 | 231 | unset( $aParse[ $_isKey ] ); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | static public function getNonIntegerKeyElements( array $aParse ) { |
| 246 | 246 | |
| 247 | 247 | foreach ( $aParse as $_isKey => $_v ) { |
| 248 | - if ( is_numeric( $_isKey ) && is_int( $_isKey+ 0 ) ) { |
|
| 248 | + if ( is_numeric( $_isKey ) && is_int( $_isKey + 0 ) ) { |
|
| 249 | 249 | unset( $aParse[ $_isKey ] ); |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
| 297 | 297 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
| 298 | - foreach( $_aNumeric as &$_aElem ) { |
|
| 298 | + foreach ( $_aNumeric as &$_aElem ) { |
|
| 299 | 299 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
| 300 | 300 | } |
| 301 | - if ( ! empty( $_aAssociative ) ) { |
|
| 301 | + if ( !empty( $_aAssociative ) ) { |
|
| 302 | 302 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
| 303 | 303 | } |
| 304 | 304 | return $_aNumeric; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @since 3.0.1 |
| 330 | 330 | * @return mixed |
| 331 | 331 | */ |
| 332 | - static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault=null ) { |
|
| 332 | + static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault = null ) { |
|
| 333 | 333 | |
| 334 | 334 | $_sKey = array_shift( $aKeys ); |
| 335 | 335 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | return self::getArrayValueByArrayKeys( $aArray[ $_sKey ], $aKeys, $vDefault ); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - return $aArray[ $_sKey ]; // 3.5.3+ Fixes an issue that setting a non existent key resulted in null. |
|
| 347 | + return $aArray[ $_sKey ]; // 3.5.3+ Fixes an issue that setting a non existent key resulted in null. |
|
| 348 | 348 | |
| 349 | 349 | } |
| 350 | 350 | return $vDefault; |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
| 388 | 388 | |
| 389 | 389 | $_sKey = array_shift( $aKeys ); |
| 390 | - if ( ! empty( $aKeys ) ) { |
|
| 390 | + if ( !empty( $aKeys ) ) { |
|
| 391 | 391 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
| 392 | 392 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
| 393 | 393 | } |
@@ -407,8 +407,8 @@ discard block |
||
| 407 | 407 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
| 408 | 408 | |
| 409 | 409 | $_sKey = array_shift( $aKeys ); |
| 410 | - if ( ! empty( $aKeys ) ) { |
|
| 411 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
| 410 | + if ( !empty( $aKeys ) ) { |
|
| 411 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
| 412 | 412 | $mSubject[ $_sKey ] = array(); |
| 413 | 413 | } |
| 414 | 414 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * @param boolean bPreserveEmpty If `false` is given, a value that yields `false` such as `false`, an empty sttring `''`, or `0` will not create an element such as `array( false )`. It will be just `array()`. |
| 430 | 430 | * @return array The cast array. |
| 431 | 431 | */ |
| 432 | - static public function getAsArray( $mValue, $bPreserveEmpty=false ) { |
|
| 432 | + static public function getAsArray( $mValue, $bPreserveEmpty = false ) { |
|
| 433 | 433 | |
| 434 | 434 | if ( is_array( $mValue ) ) { |
| 435 | 435 | return $mValue; |
@@ -456,9 +456,9 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | static public function getReadableListOfArray( array $aArray ) { |
| 458 | 458 | |
| 459 | - $_aOutput = array(); |
|
| 460 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
| 461 | - $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
|
| 459 | + $_aOutput = array(); |
|
| 460 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
| 461 | + $_aOutput[ ] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ).PHP_EOL; |
|
| 462 | 462 | } |
| 463 | 463 | return implode( PHP_EOL, $_aOutput ); |
| 464 | 464 | |
@@ -469,37 +469,37 @@ discard block |
||
| 469 | 469 | * @since 3.3.0 |
| 470 | 470 | * @return string The generated human readable array contents. |
| 471 | 471 | */ |
| 472 | - static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths=16, $iOffset=0 ) { |
|
| 472 | + static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths = 16, $iOffset = 0 ) { |
|
| 473 | 473 | |
| 474 | 474 | $_aOutput = array(); |
| 475 | - $_aOutput[] = ( $iOffset |
|
| 476 | - ? str_pad( ' ', $iOffset ) |
|
| 475 | + $_aOutput[ ] = ( $iOffset |
|
| 476 | + ? str_pad( ' ', $iOffset ) |
|
| 477 | 477 | : '' |
| 478 | 478 | ) |
| 479 | 479 | . ( $sKey |
| 480 | - ? '[' . $sKey . ']' |
|
| 480 | + ? '['.$sKey.']' |
|
| 481 | 481 | : '' |
| 482 | 482 | ); |
| 483 | 483 | |
| 484 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
| 485 | - $_aOutput[] = $vValue; |
|
| 484 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
| 485 | + $_aOutput[ ] = $vValue; |
|
| 486 | 486 | return implode( PHP_EOL, $_aOutput ); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | foreach ( $vValue as $_sTitle => $_asDescription ) { |
| 490 | - if ( ! in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
| 491 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
| 490 | + if ( !in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
| 491 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
| 492 | 492 | . $_sTitle |
| 493 | 493 | . str_pad( ':', $sLabelCharLengths - self::getStringLength( $_sTitle ) ) |
| 494 | 494 | . $_asDescription; |
| 495 | 495 | continue; |
| 496 | 496 | } |
| 497 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
| 497 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
| 498 | 498 | . $_sTitle |
| 499 | 499 | . ": {" |
| 500 | 500 | . self::getReadableArrayContents( '', $_asDescription, 16, $iOffset + 4 ) |
| 501 | 501 | . PHP_EOL |
| 502 | - . str_pad( ' ', $iOffset ) . "}"; |
|
| 502 | + . str_pad( ' ', $iOffset )."}"; |
|
| 503 | 503 | } |
| 504 | 504 | return implode( PHP_EOL, $_aOutput ); |
| 505 | 505 | |
@@ -512,11 +512,11 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
| 514 | 514 | |
| 515 | - $_aOutput = array(); |
|
| 516 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
| 517 | - $_aOutput[] = "<ul class='array-contents'>" |
|
| 515 | + $_aOutput = array(); |
|
| 516 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
| 517 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
| 518 | 518 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
| 519 | - . "</ul>" . PHP_EOL; |
|
| 519 | + . "</ul>".PHP_EOL; |
|
| 520 | 520 | } |
| 521 | 521 | return implode( PHP_EOL, $_aOutput ); |
| 522 | 522 | |
@@ -533,25 +533,25 @@ discard block |
||
| 533 | 533 | $_aOutput = array(); |
| 534 | 534 | |
| 535 | 535 | // Title - array key |
| 536 | - $_aOutput[] = $sKey |
|
| 537 | - ? "<h3 class='array-key'>" . $sKey . "</h3>" |
|
| 536 | + $_aOutput[ ] = $sKey |
|
| 537 | + ? "<h3 class='array-key'>".$sKey."</h3>" |
|
| 538 | 538 | : ""; |
| 539 | 539 | |
| 540 | 540 | // If it does not have a nested array or object, |
| 541 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
| 542 | - $_aOutput[] = "<div class='array-value'>" |
|
| 541 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
| 542 | + $_aOutput[ ] = "<div class='array-value'>" |
|
| 543 | 543 | . html_entity_decode( nl2br( str_replace( ' ', ' ', $vValue ) ), ENT_QUOTES ) |
| 544 | 544 | . "</div>"; |
| 545 | - return "<li>" . implode( PHP_EOL, $_aOutput ) . "</li>"; |
|
| 545 | + return "<li>".implode( PHP_EOL, $_aOutput )."</li>"; |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | // Now it is a nested item. |
| 549 | 549 | foreach ( $vValue as $_sKey => $_vValue ) { |
| 550 | - $_aOutput[] = "<ul class='array-contents'>" |
|
| 550 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
| 551 | 551 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
| 552 | 552 | . "</ul>"; |
| 553 | 553 | } |
| 554 | - return implode( PHP_EOL, $_aOutput ) ; |
|
| 554 | + return implode( PHP_EOL, $_aOutput ); |
|
| 555 | 555 | |
| 556 | 556 | } |
| 557 | 557 | |
@@ -571,9 +571,9 @@ discard block |
||
| 571 | 571 | * - NULL |
| 572 | 572 | * @return array The modified array. |
| 573 | 573 | */ |
| 574 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
| 574 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
| 575 | 575 | |
| 576 | - foreach( $aArray as $isKey => $vValue ) { |
|
| 576 | + foreach ( $aArray as $isKey => $vValue ) { |
|
| 577 | 577 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
| 578 | 578 | unset( $aArray[ $isKey ] ); |
| 579 | 579 | } |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | */ |
| 589 | 589 | static public function dropElementByValue( array $aArray, $vValue ) { |
| 590 | 590 | |
| 591 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 591 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 592 | 592 | $_sKey = array_search( $_vValue, $aArray, true ); |
| 593 | 593 | if ( $_sKey === false ) { |
| 594 | 594 | continue; |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | */ |
| 610 | 610 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
| 611 | 611 | |
| 612 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 612 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 613 | 613 | unset( $aArray[ $_isKey ] ); |
| 614 | 614 | } |
| 615 | 615 | return $aArray; |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
| 33 | 33 | * @deprecated 3.5.3 Use `getElement()`. |
| 34 | 34 | */ |
| 35 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
| 35 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault = '', $bBlankToDefault = false ) { |
|
| 36 | 36 | |
| 37 | 37 | // If $vSubject is null, |
| 38 | - if ( ! isset( $vSubject ) ) { return $sDefault; } |
|
| 38 | + if ( !isset( $vSubject ) ) { return $sDefault; } |
|
| 39 | 39 | |
| 40 | 40 | // If the $bBlankToDefault flag is set and the subject value is a blank string, return the default value. |
| 41 | 41 | if ( $bBlankToDefault && $vSubject == '' ) { return $sDefault; } |
| 42 | 42 | |
| 43 | 43 | // If $vSubject is not an array, |
| 44 | - if ( ! is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
| 44 | + if ( !is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
| 45 | 45 | |
| 46 | 46 | // Consider $vSubject as array. |
| 47 | 47 | if ( isset( $vSubject[ $sKey ] ) ) { return $vSubject[ $sKey ]; } |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | * @since 3.5.3 Moved from `AdminPageFramework_FieldType_Base`. |
| 87 | 87 | * @deprecated 3.5.3 Use the `getElement()` method. |
| 88 | 88 | */ |
| 89 | - protected function getFieldElementByKey( $asElement, $sKey, $asDefault='' ) { |
|
| 89 | + protected function getFieldElementByKey( $asElement, $sKey, $asDefault = '' ) { |
|
| 90 | 90 | |
| 91 | - if ( ! is_array( $asElement ) || ! isset( $sKey ) ) { return $asElement; } |
|
| 91 | + if ( !is_array( $asElement ) || !isset( $sKey ) ) { return $asElement; } |
|
| 92 | 92 | |
| 93 | 93 | $aElements = &$asElement; // it is an array |
| 94 | 94 | return isset( $aElements[ $sKey ] ) |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | static public function shiftTillTrue( array $aArray ) { |
| 109 | 109 | |
| 110 | - foreach( $aArray as &$vElem ) { |
|
| 110 | + foreach ( $aArray as &$vElem ) { |
|
| 111 | 111 | |
| 112 | 112 | if ( $vElem ) { break; } |
| 113 | 113 | unset( $vElem ); |
@@ -139,15 +139,15 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | static public function getAttributes( array $aAttributes ) { |
| 141 | 141 | |
| 142 | - $_sQuoteCharactor ="'"; |
|
| 142 | + $_sQuoteCharactor = "'"; |
|
| 143 | 143 | $_aOutput = array(); |
| 144 | - foreach( $aAttributes as $sAttribute => $sProperty ) { |
|
| 144 | + foreach ( $aAttributes as $sAttribute => $sProperty ) { |
|
| 145 | 145 | |
| 146 | 146 | // Must be resolved as a string. |
| 147 | 147 | if ( in_array( gettype( $sProperty ), array( 'array', 'object' ) ) ) { |
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | - $_aOutput[] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
| 150 | + $_aOutput[ ] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | return implode( ' ', $_aOutput ); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
| 33 | 33 | * @deprecated 3.5.3 Use `getElement()`. |
| 34 | 34 | */ |
| 35 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
| 35 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
| 36 | 36 | |
| 37 | 37 | // If $vSubject is null, |
| 38 | 38 | if ( ! isset( $vSubject ) ) { return $sDefault; } |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | * @param integer $iLines The number of lines to read. |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - static public function getFileTailContents( $asPath=array(), $iLines=1 ) { |
|
| 31 | + static public function getFileTailContents( $asPath = array(), $iLines = 1 ) { |
|
| 32 | 32 | |
| 33 | - $_sPath = self::_getFirstItem( $asPath ); |
|
| 34 | - if ( ! @is_readable( $_sPath ) ) { |
|
| 33 | + $_sPath = self::_getFirstItem( $asPath ); |
|
| 34 | + if ( !@is_readable( $_sPath ) ) { |
|
| 35 | 35 | return ''; |
| 36 | 36 | } |
| 37 | 37 | return trim( |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @since 3.4.6 |
| 62 | 62 | * @return string |
| 63 | 63 | */ |
| 64 | - static public function sanitizeFileName( $sFileName, $sReplacement='_' ) { |
|
| 64 | + static public function sanitizeFileName( $sFileName, $sReplacement = '_' ) { |
|
| 65 | 65 | |
| 66 | 66 | // Remove anything which isn't a word, white space, number |
| 67 | 67 | // or any of the following characters -_~,;:[](). |