@@ -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 | |
@@ -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 -_~,;:[](). |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | static public function getRelativePath( $from, $to ) { |
| 32 | 32 | |
| 33 | 33 | // some compatibility fixes for Windows paths |
| 34 | - $from = is_dir( $from ) ? rtrim( $from, '\/') . '/' : $from; |
|
| 35 | - $to = is_dir( $to ) ? rtrim( $to, '\/') . '/' : $to; |
|
| 34 | + $from = is_dir( $from ) ? rtrim( $from, '\/' ).'/' : $from; |
|
| 35 | + $to = is_dir( $to ) ? rtrim( $to, '\/' ).'/' : $to; |
|
| 36 | 36 | $from = str_replace( '\\', '/', $from ); |
| 37 | 37 | $to = str_replace( '\\', '/', $to ); |
| 38 | 38 | |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | $to = explode( '/', $to ); |
| 41 | 41 | $relPath = $to; |
| 42 | 42 | |
| 43 | - foreach( $from as $depth => $dir ) { |
|
| 43 | + foreach ( $from as $depth => $dir ) { |
|
| 44 | 44 | // find first non-matching dir |
| 45 | - if( $dir === $to[ $depth ] ) { |
|
| 45 | + if ( $dir === $to[ $depth ] ) { |
|
| 46 | 46 | // ignore this directory |
| 47 | 47 | array_shift( $relPath ); |
| 48 | 48 | } else { |
| 49 | 49 | // get number of remaining dirs to $from |
| 50 | 50 | $remaining = count( $from ) - $depth; |
| 51 | - if( $remaining > 1 ) { |
|
| 51 | + if ( $remaining > 1 ) { |
|
| 52 | 52 | // add traversals up to first matching dir |
| 53 | 53 | $padLength = ( count( $relPath ) + $remaining - 1 ) * -1; |
| 54 | 54 | $relPath = array_pad( $relPath, $padLength, '..' ); |
| 55 | 55 | break; |
| 56 | 56 | } else { |
| 57 | - $relPath[ 0 ] = './' . $relPath[ 0 ]; |
|
| 57 | + $relPath[ 0 ] = './'.$relPath[ 0 ]; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @since 3.0.0 |
| 69 | 69 | * @return string |
| 70 | 70 | */ |
| 71 | - static public function getCallerScriptPath( $asRedirectedFiles=array( __FILE__ ) ) { |
|
| 71 | + static public function getCallerScriptPath( $asRedirectedFiles = array( __FILE__ ) ) { |
|
| 72 | 72 | |
| 73 | 73 | $aRedirectedFiles = ( array ) $asRedirectedFiles; |
| 74 | - $aRedirectedFiles[] = __FILE__; |
|
| 74 | + $aRedirectedFiles[ ] = __FILE__; |
|
| 75 | 75 | $_sCallerFilePath = ''; |
| 76 | - foreach( debug_backtrace() as $aDebugInfo ) { |
|
| 77 | - $_sCallerFilePath = $aDebugInfo['file']; |
|
| 76 | + foreach ( debug_backtrace() as $aDebugInfo ) { |
|
| 77 | + $_sCallerFilePath = $aDebugInfo[ 'file' ]; |
|
| 78 | 78 | if ( in_array( $_sCallerFilePath, $aRedirectedFiles ) ) { continue; } |
| 79 | 79 | break; // catch the first found item. |
| 80 | 80 | } |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | $aRedirectedFiles = ( array ) $asRedirectedFiles; |
| 74 | 74 | $aRedirectedFiles[] = __FILE__; |
| 75 | 75 | $_sCallerFilePath = ''; |
| 76 | - foreach( debug_backtrace() as $aDebugInfo ) { |
|
| 76 | + foreach( debug_backtrace() as $aDebugInfo ) { |
|
| 77 | 77 | $_sCallerFilePath = $aDebugInfo['file']; |
| 78 | 78 | if ( in_array( $_sCallerFilePath, $aRedirectedFiles ) ) { continue; } |
| 79 | 79 | break; // catch the first found item. |
@@ -48,8 +48,8 @@ |
||
| 48 | 48 | * @since 3.6.3 |
| 49 | 49 | * @return boolean If the passed value is not null, true; otherwise, false. |
| 50 | 50 | */ |
| 51 | - static public function isNotNull( $mValue=null ) { |
|
| 52 | - return ! is_null( $mValue ); |
|
| 51 | + static public function isNotNull( $mValue = null ) { |
|
| 52 | + return !is_null( $mValue ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @since 3.6.2 Supported a text content to be passed to the first parameter. |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | - static public function getScriptData( $sPathOrContent, $sType='plugin', $aDefaultHeaderKeys=array() ) { |
|
| 31 | + static public function getScriptData( $sPathOrContent, $sType = 'plugin', $aDefaultHeaderKeys = array() ) { |
|
| 32 | 32 | |
| 33 | 33 | $_aHeaderKeys = $aDefaultHeaderKeys + array( |
| 34 | 34 | // storing array key => the comment entry header label |
@@ -66,19 +66,19 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | switch ( trim( $sType ) ) { |
| 68 | 68 | case 'theme': |
| 69 | - $aData['sName'] = $aData['sThemeName']; |
|
| 70 | - $aData['sURI'] = $aData['sThemeURI']; |
|
| 69 | + $aData[ 'sName' ] = $aData[ 'sThemeName' ]; |
|
| 70 | + $aData[ 'sURI' ] = $aData[ 'sThemeURI' ]; |
|
| 71 | 71 | break; |
| 72 | 72 | case 'library': |
| 73 | - $aData['sName'] = $aData['sLibraryName']; |
|
| 74 | - $aData['sURI'] = $aData['sLibraryURI']; |
|
| 73 | + $aData[ 'sName' ] = $aData[ 'sLibraryName' ]; |
|
| 74 | + $aData[ 'sURI' ] = $aData[ 'sLibraryURI' ]; |
|
| 75 | 75 | break; |
| 76 | 76 | case 'script': |
| 77 | - $aData['sName'] = $aData['sScriptName']; |
|
| 77 | + $aData[ 'sName' ] = $aData[ 'sScriptName' ]; |
|
| 78 | 78 | break; |
| 79 | 79 | case 'plugin': |
| 80 | - $aData['sName'] = $aData['sPluginName']; |
|
| 81 | - $aData['sURI'] = $aData['sPluginURI']; |
|
| 80 | + $aData[ 'sName' ] = $aData[ 'sPluginName' ]; |
|
| 81 | + $aData[ 'sURI' ] = $aData[ 'sPluginURI' ]; |
|
| 82 | 82 | break; |
| 83 | 83 | default: |
| 84 | 84 | break; |
@@ -93,22 +93,22 @@ discard block |
||
| 93 | 93 | * @since 3.6.2 |
| 94 | 94 | * @return array The script data |
| 95 | 95 | */ |
| 96 | - static public function getScriptDataFromContents( $sContent, $sType='plugin', $aDefaultHeaderKeys=array() ) { |
|
| 96 | + static public function getScriptDataFromContents( $sContent, $sType = 'plugin', $aDefaultHeaderKeys = array() ) { |
|
| 97 | 97 | |
| 98 | 98 | // Make sure we catch CR-only line endings. |
| 99 | 99 | $sContent = str_replace( "\r", "\n", $sContent ); |
| 100 | 100 | |
| 101 | - $_aHeaders = $aDefaultHeaderKeys; |
|
| 101 | + $_aHeaders = $aDefaultHeaderKeys; |
|
| 102 | 102 | if ( $sType ) { |
| 103 | 103 | $_aExtraHeaders = apply_filters( "extra_{$sType}_headers", array() ); |
| 104 | - if ( ! empty( $_aExtraHeaders ) ) { |
|
| 104 | + if ( !empty( $_aExtraHeaders ) ) { |
|
| 105 | 105 | $_aExtraHeaders = array_combine( $_aExtraHeaders, $_aExtraHeaders ); // keys equal values |
| 106 | 106 | $_aHeaders = array_merge( $_aExtraHeaders, ( array ) $aDefaultHeaderKeys ); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | foreach ( $_aHeaders as $_sHeaderKey => $_sRegex ) { |
| 111 | - $_bFound = preg_match( '/^[ \t\/*#@]*' . preg_quote( $_sRegex, '/' ) . ':(.*)$/mi', $sContent, $_aMatch ); |
|
| 111 | + $_bFound = preg_match( '/^[ \t\/*#@]*'.preg_quote( $_sRegex, '/' ).':(.*)$/mi', $sContent, $_aMatch ); |
|
| 112 | 112 | $_aHeaders[ $_sHeaderKey ] = $_bFound && $_aMatch[ 1 ] |
| 113 | 113 | ? _cleanup_header_comment( $_aMatch[ 1 ] ) |
| 114 | 114 | : ''; |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | * @since 3.4.2 |
| 126 | 126 | * @see download_url() in file.php in core. |
| 127 | 127 | */ |
| 128 | - static public function download( $sURL, $iTimeOut=300 ) { |
|
| 128 | + static public function download( $sURL, $iTimeOut = 300 ) { |
|
| 129 | 129 | |
| 130 | 130 | if ( false === filter_var( $sURL, FILTER_VALIDATE_URL ) ) { |
| 131 | 131 | return false; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $_sTmpFileName = self::setTempPath( self::getBaseNameOfURL( $sURL ) ); |
| 135 | - if ( ! $_sTmpFileName ) { |
|
| 135 | + if ( !$_sTmpFileName ) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ){ |
|
| 153 | + if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ) { |
|
| 154 | 154 | unlink( $_sTmpFileName ); |
| 155 | 155 | return false; |
| 156 | 156 | } |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | * @since 3.4.2 |
| 176 | 176 | * @return string The set file path. |
| 177 | 177 | */ |
| 178 | - static public function setTempPath( $sFilePath='' ) { |
|
| 178 | + static public function setTempPath( $sFilePath = '' ) { |
|
| 179 | 179 | |
| 180 | 180 | $_sDir = get_temp_dir(); |
| 181 | 181 | |
| 182 | 182 | $sFilePath = basename( $sFilePath ); |
| 183 | 183 | if ( empty( $sFilePath ) ) { |
| 184 | - $sFilePath = time() . '.tmp'; |
|
| 184 | + $sFilePath = time().'.tmp'; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $sFilePath = $_sDir . wp_unique_filename( $_sDir, $sFilePath ); |
|
| 187 | + $sFilePath = $_sDir.wp_unique_filename( $_sDir, $sFilePath ); |
|
| 188 | 188 | touch( $sFilePath ); |
| 189 | 189 | return $sFilePath; |
| 190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | static public function getBaseNameOfURL( $sURL ) { |
| 199 | 199 | |
| 200 | - $_sPath = parse_url( $sURL, PHP_URL_PATH) ; |
|
| 200 | + $_sPath = parse_url( $sURL, PHP_URL_PATH ); |
|
| 201 | 201 | $_sFileBaseName = basename( $_sPath ); |
| 202 | 202 | return $_sFileBaseName; |
| 203 | 203 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ){ |
|
| 153 | + if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ) { |
|
| 154 | 154 | unlink( $_sTmpFileName ); |
| 155 | 155 | return false; |
| 156 | 156 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $_sDir = get_temp_dir(); |
| 181 | 181 | |
| 182 | 182 | $sFilePath = basename( $sFilePath ); |
| 183 | - if ( empty( $sFilePath ) ) { |
|
| 183 | + if ( empty( $sFilePath ) ) { |
|
| 184 | 184 | $sFilePath = time() . '.tmp'; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -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 | |