@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if ( is_string( $_sCustomMenuSlug ) ) { |
| 29 | 29 | return $_sCustomMenuSlug; |
| 30 | 30 | } |
| 31 | - return 'edit.php?post_type=' . $sPostTypeSlug; |
|
| 31 | + return 'edit.php?post_type='.$sPostTypeSlug; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | static public function getWPAdminDirPath() { |
| 62 | 62 | |
| 63 | 63 | $_sWPAdminPath = str_replace( |
| 64 | - get_bloginfo( 'url' ) . '/', // search |
|
| 65 | - ABSPATH, // replace |
|
| 64 | + get_bloginfo( 'url' ).'/', // search |
|
| 65 | + ABSPATH, // replace |
|
| 66 | 66 | get_admin_url() // subject - works even in the network admin |
| 67 | 67 | ); |
| 68 | 68 | return rtrim( $_sWPAdminPath, '/' ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @since 3.7.0 |
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | - static public function goToLocalURL( $sURL, $oCallbackOnError=null ) { |
|
| 81 | + static public function goToLocalURL( $sURL, $oCallbackOnError = null ) { |
|
| 82 | 82 | self::redirectByType( $sURL, 1, $oCallbackOnError ); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @since 3.7.0 Added the second callback parameter. |
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | - static public function goToURL( $sURL, $oCallbackOnError=null ) { |
|
| 92 | + static public function goToURL( $sURL, $oCallbackOnError = null ) { |
|
| 93 | 93 | self::redirectByType( $sURL, 0, $oCallbackOnError ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param integer $iType 0: external site, 1: local site (within the same domain). |
| 100 | 100 | * @param callable $oCallbackOnError |
| 101 | 101 | */ |
| 102 | - static public function redirectByType( $sURL, $iType=0, $oCallbackOnError=null ) { |
|
| 102 | + static public function redirectByType( $sURL, $iType = 0, $oCallbackOnError = null ) { |
|
| 103 | 103 | |
| 104 | 104 | $_iRedirectError = self::getRedirectPreError( $sURL, $iType ); |
| 105 | 105 | if ( $_iRedirectError && is_callable( $oCallbackOnError ) ) { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | static public function getRedirectPreError( $sURL, $iType ) { |
| 131 | 131 | |
| 132 | 132 | // check only externnal urls as local ones can be a relative url and always fails the below check. |
| 133 | - if ( ! $iType && filter_var( $sURL, FILTER_VALIDATE_URL) === false ) { |
|
| 133 | + if ( !$iType && filter_var( $sURL, FILTER_VALIDATE_URL ) === false ) { |
|
| 134 | 134 | return 1; |
| 135 | 135 | } |
| 136 | 136 | // If HTTP headers are already sent, redirect cannot be done. |
@@ -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 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | : @mysql_get_server_info(), |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - foreach( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
| 45 | + foreach ( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
| 46 | 46 | |
| 47 | 47 | $_aItem = array_values( $_aItem ); |
| 48 | 48 | $_sKey = array_shift( $_aItem ); |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | static public function getMySQLErrorLogPath() { |
| 64 | 64 | |
| 65 | 65 | $_aMySQLInfo = self::getMySQLInfo(); |
| 66 | - return isset( $_aMySQLInfo['log_error'] ) |
|
| 67 | - ? $_aMySQLInfo['log_error'] |
|
| 66 | + return isset( $_aMySQLInfo[ 'log_error' ] ) |
|
| 67 | + ? $_aMySQLInfo[ 'log_error' ] |
|
| 68 | 68 | : ''; |
| 69 | 69 | |
| 70 | 70 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * Returns a PHP error log. |
| 74 | 74 | * @since 3.4.6 |
| 75 | 75 | */ |
| 76 | - static public function getMySQLErrorLog( $iLines=1 ) { |
|
| 76 | + static public function getMySQLErrorLog( $iLines = 1 ) { |
|
| 77 | 77 | |
| 78 | 78 | $_sLog = self::getFileTailContents( self::getMySQLErrorLogPath(), $iLines ); |
| 79 | 79 | |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $_sQuoteCharactor = "'"; |
| 40 | 40 | $_aOutput = array(); |
| 41 | - foreach( $aAttributes as $_sAttribute => $_mProperty ) { |
|
| 41 | + foreach ( $aAttributes as $_sAttribute => $_mProperty ) { |
|
| 42 | 42 | if ( is_scalar( $_mProperty ) ) { |
| 43 | - $_aOutput[] = "{$_sAttribute}={$_sQuoteCharactor}" . esc_attr( $_mProperty ) . "{$_sQuoteCharactor}"; |
|
| 43 | + $_aOutput[ ] = "{$_sAttribute}={$_sQuoteCharactor}".esc_attr( $_mProperty )."{$_sQuoteCharactor}"; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | return implode( ' ', $_aOutput ); |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | * @since 3.6.0 |
| 80 | 80 | * @return string |
| 81 | 81 | */ |
| 82 | - static public function getHTMLTag( $sTagName, array $aAttributes, $sValue=null ) { |
|
| 82 | + static public function getHTMLTag( $sTagName, array $aAttributes, $sValue = null ) { |
|
| 83 | 83 | $_sTag = tag_escape( $sTagName ); |
| 84 | 84 | return null === $sValue |
| 85 | - ? "<" . $_sTag . " " . self::getAttributes( $aAttributes ) . " />" |
|
| 86 | - : "<" . $_sTag . " " . self::getAttributes( $aAttributes ) . ">" |
|
| 85 | + ? "<".$_sTag." ".self::getAttributes( $aAttributes )." />" |
|
| 86 | + : "<".$_sTag." ".self::getAttributes( $aAttributes ).">" |
|
| 87 | 87 | . $sValue |
| 88 | 88 | . "</{$_sTag}>"; |
| 89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return string |
| 94 | 94 | * @deprecated 3.6.0 Use `getHTMLTag()` instead. |
| 95 | 95 | */ |
| 96 | - static public function generateHTMLTag( $sTagName, array $aAttributes, $sValue=null ) { |
|
| 96 | + static public function generateHTMLTag( $sTagName, array $aAttributes, $sValue = null ) { |
|
| 97 | 97 | return self::getHTMLTag( $sTagName, $aAttributes, $sValue ); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | static public function getCurrentAdminURL() { |
| 27 | 27 | |
| 28 | - $sRequestURI = $GLOBALS['is_IIS'] ? $_SERVER['PATH_INFO'] : $_SERVER["REQUEST_URI"]; |
|
| 29 | - $sPageURL = 'on' == @$_SERVER["HTTPS"] ? "https://" : "http://"; |
|
| 28 | + $sRequestURI = $GLOBALS[ 'is_IIS' ] ? $_SERVER[ 'PATH_INFO' ] : $_SERVER[ "REQUEST_URI" ]; |
|
| 29 | + $sPageURL = 'on' == @$_SERVER[ "HTTPS" ] ? "https://" : "http://"; |
|
| 30 | 30 | |
| 31 | - if ( "80" != $_SERVER["SERVER_PORT"] ) { |
|
| 32 | - $sPageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $sRequestURI; |
|
| 31 | + if ( "80" != $_SERVER[ "SERVER_PORT" ] ) { |
|
| 32 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].":".$_SERVER[ "SERVER_PORT" ].$sRequestURI; |
|
| 33 | 33 | } else { |
| 34 | - $sPageURL .= $_SERVER["SERVER_NAME"] . $sRequestURI; |
|
| 34 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].$sRequestURI; |
|
| 35 | 35 | } |
| 36 | 36 | return $sPageURL; |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $sSubjectURL ( optional ) The subject url to modify |
| 49 | 49 | * @return string The modified url. |
| 50 | 50 | */ |
| 51 | - static public function getQueryAdminURL( $aAddingQueries=array(), $aRemovingQueryKeys=array(), $sSubjectURL='' ) { |
|
| 51 | + static public function getQueryAdminURL( $aAddingQueries = array(), $aRemovingQueryKeys = array(), $sSubjectURL = '' ) { |
|
| 52 | 52 | |
| 53 | 53 | $_sAdminURL = is_network_admin() |
| 54 | 54 | ? network_admin_url( AdminPageFramework_WPUtility_Page::getPageNow() ) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $_oWPStyles = new WP_Styles(); // It doesn't matter whether the file is a style or not. Just use the built-in WordPress class to calculate the SRC URL. |
| 99 | 99 | $_sRelativePath = AdminPageFramework_Utility::getRelativePath( ABSPATH, $sFilePath ); |
| 100 | 100 | $_sRelativePath = preg_replace( "/^\.[\/\\\]/", '', $_sRelativePath, 1 ); // removes the heading ./ or .\ |
| 101 | - $_sHref = trailingslashit( $_oWPStyles->base_url ) . $_sRelativePath; |
|
| 101 | + $_sHref = trailingslashit( $_oWPStyles->base_url ).$_sRelativePath; |
|
| 102 | 102 | unset( $_oWPStyles ); // for PHP 5.2.x or below |
| 103 | 103 | return $_sHref; |
| 104 | 104 | |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | * @since 3.7.9 Changed not to escape characters. |
| 116 | 116 | * @return string|null |
| 117 | 117 | */ |
| 118 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 118 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
| 119 | 119 | |
| 120 | - if ( ! self::isResourcePath( $sSRC ) ) { |
|
| 120 | + if ( !self::isResourcePath( $sSRC ) ) { |
|
| 121 | 121 | return $bReturnNullIfNotExist |
| 122 | 122 | ? null |
| 123 | 123 | : $sSRC; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | // If the file exists, it means it is an absolute path. If so, calculate the URL from the path. |
| 132 | 132 | if ( file_exists( realpath( $sSRC ) ) ) { |
| 133 | - return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
| 133 | + return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if ( $bReturnNullIfNotExist ) { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | /** |
| 145 | 145 | * @deprecated 3.6.0 Use `getResolvedSRC()` instead. |
| 146 | 146 | */ |
| 147 | - static public function resolveSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 147 | + static public function resolveSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
| 148 | 148 | return self::getResolvedSRC( $sSRC, $bReturnNullIfNotExist ); |
| 149 | 149 | } |
| 150 | 150 | |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | * @since 3.7.9 Changed not to escape characters. |
| 115 | 115 | * @return string|null |
| 116 | 116 | */ |
| 117 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 117 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
| 118 | 118 | |
| 119 | 119 | if ( ! self::isResourcePath( $sSRC ) ) { |
| 120 | 120 | return $bReturnNullIfNotExist |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | * @since 3.5.3 |
| 53 | 53 | * @return string The site language. |
| 54 | 54 | */ |
| 55 | - static public function getSiteLanguage( $sDefault='en_US' ) { |
|
| 55 | + static public function getSiteLanguage( $sDefault = 'en_US' ) { |
|
| 56 | 56 | return defined( 'WPLANG' ) && WPLANG ? WPLANG : $sDefault; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | $_aInvert = array(); |
| 206 | 206 | foreach( $aModel as $_isKey => $_v ) { |
| 207 | - if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
| 207 | + if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
| 208 | 208 | continue; |
| 209 | 209 | } |
| 210 | 210 | $_aInvert[ $_isKey ] = $_v; |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public static function uniteArraysRecursive( $aPrecedence, $aDefault ) { |
| 258 | 258 | |
| 259 | - if ( is_null( $aPrecedence ) ) { |
|
| 259 | + if ( is_null( $aPrecedence ) ) { |
|
| 260 | 260 | $aPrecedence = array(); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
| 263 | + if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
| 264 | 264 | return $aPrecedence; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @return integer |
| 34 | 34 | * @internal |
| 35 | 35 | */ |
| 36 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
| 36 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
| 37 | 37 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
| 38 | 38 | ? $a[ $sKey ] - $b[ $sKey ] |
| 39 | 39 | : 1; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
| 77 | 77 | |
| 78 | 78 | $_sKey = array_shift( $aKeys ); |
| 79 | - if ( ! empty( $aKeys ) ) { |
|
| 79 | + if ( !empty( $aKeys ) ) { |
|
| 80 | 80 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
| 81 | 81 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
| 82 | 82 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
| 98 | 98 | |
| 99 | 99 | $_sKey = array_shift( $aKeys ); |
| 100 | - if ( ! empty( $aKeys ) ) { |
|
| 101 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
| 100 | + if ( !empty( $aKeys ) ) { |
|
| 101 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
| 102 | 102 | $mSubject[ $_sKey ] = array(); |
| 103 | 103 | } |
| 104 | 104 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
| 154 | 154 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
| 155 | - foreach( $_aNumeric as &$_aElem ) { |
|
| 155 | + foreach ( $_aNumeric as &$_aElem ) { |
|
| 156 | 156 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
| 157 | 157 | } |
| 158 | - if ( ! empty( $_aAssociative ) ) { |
|
| 158 | + if ( !empty( $_aAssociative ) ) { |
|
| 159 | 159 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
| 160 | 160 | } |
| 161 | 161 | return $_aNumeric; |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | public static function castArrayContents( array $aModel, array $aSubject ) { |
| 179 | 179 | |
| 180 | 180 | $_aCast = array(); |
| 181 | - foreach( $aModel as $_isKey => $_v ) { |
|
| 181 | + foreach ( $aModel as $_isKey => $_v ) { |
|
| 182 | 182 | $_aCast[ $_isKey ] = self::getElement( |
| 183 | - $aSubject, // subject array |
|
| 184 | - $_isKey, // key |
|
| 183 | + $aSubject, // subject array |
|
| 184 | + $_isKey, // key |
|
| 185 | 185 | null // default |
| 186 | 186 | ); |
| 187 | 187 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
| 203 | 203 | |
| 204 | 204 | $_aInvert = array(); |
| 205 | - foreach( $aModel as $_isKey => $_v ) { |
|
| 205 | + foreach ( $aModel as $_isKey => $_v ) { |
|
| 206 | 206 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
| 207 | 207 | continue; |
| 208 | 208 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
| 229 | 229 | |
| 230 | 230 | $_aArray = array(); |
| 231 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
| 231 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
| 232 | 232 | $_aArray = self::uniteArraysRecursive( |
| 233 | 233 | self::getAsArray( $_aArg ), |
| 234 | 234 | $_aArray |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $aPrecedence = array(); |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
| 262 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
| 263 | 263 | return $aPrecedence; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | return $aPrecedence; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - foreach( $aDefault as $sKey => $v ) { |
|
| 271 | + foreach ( $aDefault as $sKey => $v ) { |
|
| 272 | 272 | |
| 273 | 273 | // If the precedence does not have the key, assign the default's value. |
| 274 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
| 274 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
| 275 | 275 | $aPrecedence[ $sKey ] = $v; |
| 276 | 276 | } else { |
| 277 | 277 | |
@@ -302,9 +302,9 @@ discard block |
||
| 302 | 302 | * - NULL |
| 303 | 303 | * @return array The modified array. |
| 304 | 304 | */ |
| 305 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
| 305 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
| 306 | 306 | |
| 307 | - foreach( $aArray as $isKey => $vValue ) { |
|
| 307 | + foreach ( $aArray as $isKey => $vValue ) { |
|
| 308 | 308 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
| 309 | 309 | unset( $aArray[ $isKey ] ); |
| 310 | 310 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | static public function dropElementByValue( array $aArray, $vValue ) { |
| 322 | 322 | |
| 323 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 323 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 324 | 324 | $_sKey = array_search( $_vValue, $aArray, true ); |
| 325 | 325 | if ( $_sKey === false ) { |
| 326 | 326 | continue; |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
| 344 | 344 | |
| 345 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 345 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 346 | 346 | unset( $aArray[ $_isKey ] ); |
| 347 | 347 | } |
| 348 | 348 | return $aArray; |
@@ -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 -_~,;:[](). |
@@ -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 | /** |