@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
| 27 | 27 | */ |
| 28 | 28 | static public function getFirstElement( array $aArray ) { |
| 29 | - foreach( $aArray as $_mElement ) { |
|
| 29 | + foreach ( $aArray as $_mElement ) { |
|
| 30 | 30 | return $_mElement; |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @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. |
| 46 | 46 | * @return mixed The set value or the default value. |
| 47 | 47 | */ |
| 48 | - static public function getElement( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
| 48 | + static public function getElement( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
| 49 | 49 | |
| 50 | 50 | $_aToDefault = is_null( $asToDefault ) |
| 51 | 51 | ? array( null ) |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
| 73 | 73 | * @return array The cast retrieved element value. |
| 74 | 74 | */ |
| 75 | - static public function getElementAsArray( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
| 75 | + static public function getElementAsArray( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
| 76 | 76 | return self::getAsArray( |
| 77 | 77 | self::getElement( $aSubject, $aisKey, $mDefault, $asToDefault ), |
| 78 | 78 | true // preserve an empty value |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | foreach ( $aParse as $_isKey => $_v ) { |
| 93 | 93 | |
| 94 | - if ( ! is_numeric( $_isKey ) ) { |
|
| 94 | + if ( !is_numeric( $_isKey ) ) { |
|
| 95 | 95 | unset( $aParse[ $_isKey ] ); |
| 96 | 96 | continue; |
| 97 | 97 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | // Convert string numeric value to integer or float. |
| 100 | 100 | $_isKey = $_isKey + 0; |
| 101 | 101 | |
| 102 | - if ( ! is_int( $_isKey ) ) { |
|
| 102 | + if ( !is_int( $_isKey ) ) { |
|
| 103 | 103 | unset( $aParse[ $_isKey ] ); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | static public function getNonIntegerKeyElements( array $aParse ) { |
| 119 | 119 | |
| 120 | 120 | foreach ( $aParse as $_isKey => $_v ) { |
| 121 | - if ( is_numeric( $_isKey ) && is_int( $_isKey+ 0 ) ) { |
|
| 121 | + if ( is_numeric( $_isKey ) && is_int( $_isKey + 0 ) ) { |
|
| 122 | 122 | unset( $aParse[ $_isKey ] ); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
| 152 | 152 | * @return mixed |
| 153 | 153 | */ |
| 154 | - static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault=null ) { |
|
| 154 | + static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault = null ) { |
|
| 155 | 155 | |
| 156 | 156 | $_sKey = array_shift( $aKeys ); |
| 157 | 157 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @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()`. |
| 191 | 191 | * @return array The cast array. |
| 192 | 192 | */ |
| 193 | - static public function getAsArray( $mValue, $bPreserveEmpty=false ) { |
|
| 193 | + static public function getAsArray( $mValue, $bPreserveEmpty = false ) { |
|
| 194 | 194 | |
| 195 | 195 | if ( is_array( $mValue ) ) { |
| 196 | 196 | return $mValue; |
@@ -158,7 +158,8 @@ |
||
| 158 | 158 | // array_key_exists( $_sKey, $aArray ) caused warnings in some occasions |
| 159 | 159 | if ( isset( $aArray[ $_sKey ] ) ) { |
| 160 | 160 | |
| 161 | - if ( empty( $aKeys ) ) { // no more keys |
|
| 161 | + if ( empty( $aKeys ) ) { |
|
| 162 | +// no more keys |
|
| 162 | 163 | return $aArray[ $_sKey ]; |
| 163 | 164 | } |
| 164 | 165 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return integer |
| 35 | 35 | * @internal |
| 36 | 36 | */ |
| 37 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
| 37 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
| 38 | 38 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
| 39 | 39 | ? $a[ $sKey ] - $b[ $sKey ] |
| 40 | 40 | : 1; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
| 78 | 78 | |
| 79 | 79 | $_sKey = array_shift( $aKeys ); |
| 80 | - if ( ! empty( $aKeys ) ) { |
|
| 80 | + if ( !empty( $aKeys ) ) { |
|
| 81 | 81 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
| 82 | 82 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
| 83 | 83 | } |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
| 99 | 99 | |
| 100 | 100 | $_sKey = array_shift( $aKeys ); |
| 101 | - if ( ! empty( $aKeys ) ) { |
|
| 102 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
| 101 | + if ( !empty( $aKeys ) ) { |
|
| 102 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
| 103 | 103 | $mSubject[ $_sKey ] = array(); |
| 104 | 104 | } |
| 105 | 105 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
| 155 | 155 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
| 156 | - foreach( $_aNumeric as &$_aElem ) { |
|
| 156 | + foreach ( $_aNumeric as &$_aElem ) { |
|
| 157 | 157 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
| 158 | 158 | } |
| 159 | - if ( ! empty( $_aAssociative ) ) { |
|
| 159 | + if ( !empty( $_aAssociative ) ) { |
|
| 160 | 160 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
| 161 | 161 | } |
| 162 | 162 | return $_aNumeric; |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | public static function castArrayContents( array $aModel, array $aSubject ) { |
| 180 | 180 | |
| 181 | 181 | $_aCast = array(); |
| 182 | - foreach( $aModel as $_isKey => $_v ) { |
|
| 182 | + foreach ( $aModel as $_isKey => $_v ) { |
|
| 183 | 183 | $_aCast[ $_isKey ] = self::getElement( |
| 184 | - $aSubject, // subject array |
|
| 185 | - $_isKey, // key |
|
| 184 | + $aSubject, // subject array |
|
| 185 | + $_isKey, // key |
|
| 186 | 186 | null // default |
| 187 | 187 | ); |
| 188 | 188 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
| 204 | 204 | |
| 205 | 205 | $_aInvert = array(); |
| 206 | - foreach( $aModel as $_isKey => $_v ) { |
|
| 206 | + foreach ( $aModel as $_isKey => $_v ) { |
|
| 207 | 207 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
| 208 | 208 | continue; |
| 209 | 209 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
| 230 | 230 | |
| 231 | 231 | $_aArray = array(); |
| 232 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
| 232 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
| 233 | 233 | $_aArray = self::uniteArraysRecursive( |
| 234 | 234 | self::getAsArray( $_aArg ), |
| 235 | 235 | $_aArray |
@@ -260,14 +260,14 @@ discard block |
||
| 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 | |
| 267 | - foreach( $aDefault as $sKey => $v ) { |
|
| 267 | + foreach ( $aDefault as $sKey => $v ) { |
|
| 268 | 268 | |
| 269 | 269 | // If the precedence does not have the key, assign the default's value. |
| 270 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
| 270 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
| 271 | 271 | $aPrecedence[ $sKey ] = $v; |
| 272 | 272 | } else { |
| 273 | 273 | |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | * - NULL |
| 299 | 299 | * @return array The modified array. |
| 300 | 300 | */ |
| 301 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
| 301 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
| 302 | 302 | |
| 303 | - foreach( $aArray as $isKey => $vValue ) { |
|
| 303 | + foreach ( $aArray as $isKey => $vValue ) { |
|
| 304 | 304 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
| 305 | 305 | unset( $aArray[ $isKey ] ); |
| 306 | 306 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | static public function dropElementByValue( array $aArray, $vValue ) { |
| 318 | 318 | |
| 319 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 319 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
| 320 | 320 | $_sKey = array_search( $_vValue, $aArray, true ); |
| 321 | 321 | if ( $_sKey === false ) { |
| 322 | 322 | continue; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
| 340 | 340 | |
| 341 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 341 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
| 342 | 342 | unset( $aArray[ $_isKey ] ); |
| 343 | 343 | } |
| 344 | 344 | return $aArray; |
@@ -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 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | static public function getInlineCSS( array $aCSSRules ) { |
| 38 | 38 | $_aOutput = array(); |
| 39 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
| 40 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
| 39 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
| 40 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
| 41 | 41 | } |
| 42 | 42 | return implode( '; ', $_aOutput ); |
| 43 | 43 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | static public function getStyleAttribute( $asInlineCSSes ) { |
| 69 | 69 | |
| 70 | 70 | $_aCSSRules = array(); |
| 71 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
| 71 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
| 72 | 72 | |
| 73 | 73 | // For array, store in the container. |
| 74 | 74 | if ( is_array( $_asCSSRules ) ) { |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // At this point, it is a string. Break them down to array elements. |
| 80 | 80 | $__aCSSRules = explode( ';', $_asCSSRules ); |
| 81 | - foreach( $__aCSSRules as $_sPair ) { |
|
| 81 | + foreach ( $__aCSSRules as $_sPair ) { |
|
| 82 | 82 | $_aCSSPair = explode( ':', $_sPair ); |
| 83 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
| 83 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
| 84 | 84 | continue; |
| 85 | 85 | } |
| 86 | 86 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
| 119 | 119 | |
| 120 | - $_aClasses = array(); |
|
| 121 | - foreach( func_get_args() as $_asClasses ) { |
|
| 122 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
| 120 | + $_aClasses = array(); |
|
| 121 | + foreach ( func_get_args() as $_asClasses ) { |
|
| 122 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | 125 | $_aClasses = array_merge( |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | : explode( ' ', $_asClasses ) |
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
| 132 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
| 133 | 133 | |
| 134 | 134 | // @todo examine if it is okay to remove the trim() function below. |
| 135 | 135 | return trim( implode( ' ', $_aClasses ) ); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
| 146 | 146 | $_aParams = func_get_args(); |
| 147 | 147 | return call_user_func_array( |
| 148 | - array( __CLASS__ , 'getClassAttribute' ), |
|
| 148 | + array( __CLASS__, 'getClassAttribute' ), |
|
| 149 | 149 | $_aParams |
| 150 | 150 | ); |
| 151 | 151 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | static public function getDataAttributeArray( array $aArray ) { |
| 160 | 160 | |
| 161 | 161 | $_aNewArray = array(); |
| 162 | - foreach( $aArray as $sKey => $v ) { |
|
| 162 | + foreach ( $aArray as $sKey => $v ) { |
|
| 163 | 163 | if ( in_array( gettype( $v ), array( 'array', 'object' ) ) ) { |
| 164 | 164 | continue; |
| 165 | 165 | } |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * @since 3.1.1 |
| 27 | 27 | * @return string |
| 28 | 28 | */ |
| 29 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
| 29 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
| 30 | 30 | return is_numeric( $sLength ) |
| 31 | - ? $sLength . $sUnit |
|
| 31 | + ? $sLength.$sUnit |
|
| 32 | 32 | : $sLength; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | * @since 2.0.0 |
| 72 | 72 | * @return string|integer A numeric value will be returned. |
| 73 | 73 | */ |
| 74 | - static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
| 74 | + static public function fixNumber( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
| 75 | 75 | |
| 76 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
| 76 | + if ( !is_numeric( trim( $nToFix ) ) ) { |
|
| 77 | 77 | return $nDefault; |
| 78 | 78 | } |
| 79 | 79 | if ( $nMin !== '' && $nToFix < $nMin ) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | static public function minifyCSS( $sCSSRules ) { |
| 96 | 96 | |
| 97 | 97 | return str_replace( |
| 98 | - array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' '), // remove line breaks, tab, and white sspaces. |
|
| 98 | + array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), // remove line breaks, tab, and white sspaces. |
|
| 99 | 99 | '', |
| 100 | 100 | preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $sCSSRules ) // remove comments |
| 101 | 101 | ); |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | static public function getNumberOfReadableSize( $nSize ) { |
| 122 | 122 | |
| 123 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
| 124 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
| 123 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
| 124 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
| 125 | 125 | case 'P': |
| 126 | 126 | $_nReturn *= 1024; |
| 127 | 127 | case 'T': |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $_nLog = log( $nBytes, 1024 ); |
| 148 | 148 | $_iPower = ( int ) $_nLog; |
| 149 | 149 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
| 150 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
| 150 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @since 3.2.0 |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 28 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments = array() ) { |
|
| 29 | 29 | |
| 30 | 30 | $aArguments = $aArguments |
| 31 | 31 | + array( |
@@ -34,17 +34,17 @@ discard block |
||
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | 36 | parent::__construct( |
| 37 | - $oCaller->oProp->sClassName, // base id |
|
| 38 | - $sWidgetTitle, // widget title |
|
| 37 | + $oCaller->oProp->sClassName, // base id |
|
| 38 | + $sWidgetTitle, // widget title |
|
| 39 | 39 | $aArguments // widget arguments |
| 40 | 40 | ); |
| 41 | 41 | $this->oCaller = $oCaller; |
| 42 | 42 | |
| 43 | 43 | // Set up callbacks for field element outputs such as for name and it attributes. |
| 44 | 44 | $this->oCaller->oProp->aFormCallbacks = array( |
| 45 | - 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 46 | - 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 47 | - 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
| 45 | + 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 46 | + 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 47 | + 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
| 48 | 48 | 'hfInputName' => array( $this, '_replyToGetFieldInputName' ), |
| 49 | 49 | // 'hfClass' => array( $this, '_replyToAddClassSelector' ), |
| 50 | 50 | // 'hfNameFlat' => array( $this, '_replyToGetFlatFieldName' ), // @deprecated 3.6.0+ the same as the framework factory method. |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $this->oCaller->oUtil->addAndDoActions( |
| 70 | 70 | $this->oCaller, |
| 71 | - 'do_' . $this->oCaller->oProp->sClassName, |
|
| 71 | + 'do_'.$this->oCaller->oProp->sClassName, |
|
| 72 | 72 | $this->oCaller |
| 73 | 73 | ); |
| 74 | 74 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function _getTitle( array $aArguments, array $aFormData ) { |
| 101 | 101 | |
| 102 | - if ( ! $this->oCaller->oProp->bShowWidgetTitle ) { |
|
| 102 | + if ( !$this->oCaller->oProp->bShowWidgetTitle ) { |
|
| 103 | 103 | return ''; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | $aFormData, |
| 114 | 114 | $this->id_base |
| 115 | 115 | ); |
| 116 | - if ( ! $_sTitle ) { |
|
| 116 | + if ( !$_sTitle ) { |
|
| 117 | 117 | return ''; |
| 118 | 118 | } |
| 119 | - return $aArguments['before_title'] |
|
| 119 | + return $aArguments[ 'before_title' ] |
|
| 120 | 120 | . $_sTitle |
| 121 | - . $aArguments['after_title']; |
|
| 121 | + . $aArguments[ 'after_title' ]; |
|
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $this->oCaller, |
| 135 | 135 | "validation_{$this->oCaller->oProp->sClassName}", |
| 136 | 136 | call_user_func_array( |
| 137 | - array( $this->oCaller, 'validate' ), // triggers __call() |
|
| 137 | + array( $this->oCaller, 'validate' ), // triggers __call() |
|
| 138 | 138 | array( $aSubmittedFormData, $aSavedFormData, $this->oCaller ) // parameters |
| 139 | 139 | ), // 3.5.3+ |
| 140 | 140 | $aSavedFormData, |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | $this->oCaller->oForm = new AdminPageFramework_Form_widget( |
| 180 | 180 | array( |
| 181 | 181 | 'register_if_action_already_done' => false, // do not register fields right away |
| 182 | - ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
| 183 | - $this->oCaller->oProp->aFormCallbacks, // callbacks |
|
| 182 | + ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
| 183 | + $this->oCaller->oProp->aFormCallbacks, // callbacks |
|
| 184 | 184 | $this->oCaller->oMsg |
| 185 | 185 | ); |
| 186 | 186 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $this->oCaller->oUtil->addAndDoActions( |
| 199 | 199 | $this->oCaller, |
| 200 | 200 | array( |
| 201 | - 'load_' . $this->oCaller->oProp->sClassName, |
|
| 201 | + 'load_'.$this->oCaller->oProp->sClassName, |
|
| 202 | 202 | ), |
| 203 | 203 | $this->oCaller |
| 204 | 204 | ); |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | $_aParams = func_get_args() + array( null, null, null ); |
| 218 | 218 | $aField = $_aParams[ 1 ]; |
| 219 | 219 | |
| 220 | - $_sSectionIndex = isset( $aField['section_id'], $aField['_section_index'] ) |
|
| 221 | - ? "[{$aField['_section_index']}]" |
|
| 220 | + $_sSectionIndex = isset( $aField[ 'section_id' ], $aField[ '_section_index' ] ) |
|
| 221 | + ? "[{$aField[ '_section_index' ]}]" |
|
| 222 | 222 | : ""; |
| 223 | 223 | $_sID = $this->oCaller->isSectionSet( $aField ) |
| 224 | - ? $aField['section_id'] . "]" . $_sSectionIndex . "[" . $aField[ 'field_id' ] |
|
| 225 | - : $aField['field_id']; |
|
| 224 | + ? $aField[ 'section_id' ]."]".$_sSectionIndex."[".$aField[ 'field_id' ] |
|
| 225 | + : $aField[ 'field_id' ]; |
|
| 226 | 226 | return $this->get_field_name( $_sID ); |
| 227 | 227 | |
| 228 | 228 | } |
@@ -241,15 +241,15 @@ discard block |
||
| 241 | 241 | $_sIndex = $this->oCaller->oUtil->getAOrB( |
| 242 | 242 | '0' !== $sIndex && empty( $sIndex ), |
| 243 | 243 | '', |
| 244 | - "[" . $sIndex . "]" |
|
| 244 | + "[".$sIndex."]" |
|
| 245 | 245 | ); |
| 246 | - $_sSectionIndex = isset( $aField['section_id'], $aField['_section_index'] ) |
|
| 247 | - ? "[{$aField['_section_index']}]" |
|
| 246 | + $_sSectionIndex = isset( $aField[ 'section_id' ], $aField[ '_section_index' ] ) |
|
| 247 | + ? "[{$aField[ '_section_index' ]}]" |
|
| 248 | 248 | : ""; |
| 249 | 249 | $_sID = $this->oCaller->isSectionSet( $aField ) |
| 250 | - ? $aField['section_id'] . "]" . $_sSectionIndex . "[" . $aField[ 'field_id' ] |
|
| 250 | + ? $aField[ 'section_id' ]."]".$_sSectionIndex."[".$aField[ 'field_id' ] |
|
| 251 | 251 | : $aField[ 'field_id' ]; |
| 252 | - return $this->get_field_name( $_sID ) . $_sIndex; |
|
| 252 | + return $this->get_field_name( $_sID ).$_sIndex; |
|
| 253 | 253 | |
| 254 | 254 | } |
| 255 | 255 | |
@@ -104,9 +104,9 @@ |
||
| 104 | 104 | * Sets up properties. |
| 105 | 105 | * @since DEVVER |
| 106 | 106 | */ |
| 107 | - public function __construct( $oCaller, $sCallerPath, $sClassName, $sCapability='manage_options', $sTextDomain='admin-page-framework', $sStructureType ) { |
|
| 107 | + public function __construct( $oCaller, $sCallerPath, $sClassName, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework', $sStructureType ) { |
|
| 108 | 108 | |
| 109 | - $this->_sFormRegistrationHook = 'load_' . $sClassName; // DEVVER+ |
|
| 109 | + $this->_sFormRegistrationHook = 'load_'.$sClassName; // DEVVER+ |
|
| 110 | 110 | // $this->_sFormRegistrationHook = 'current_screen'; |
| 111 | 111 | |
| 112 | 112 | parent::__construct( |
@@ -18,16 +18,16 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function start() { |
| 20 | 20 | |
| 21 | - if ( ! $this->oProp->bIsAdmin ) { |
|
| 21 | + if ( !$this->oProp->bIsAdmin ) { |
|
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // Allows the user to switch the menu visibility. |
| 26 | - if ( isset( $_GET['enable_apfl_admin_pages'] ) ) { |
|
| 26 | + if ( isset( $_GET[ 'enable_apfl_admin_pages' ] ) ) { |
|
| 27 | 27 | |
| 28 | 28 | // Update the options and reload the page |
| 29 | - $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys['main'] ); |
|
| 30 | - $_oOption->update( 'enable_admin_pages', $_GET['enable_apfl_admin_pages'] ); |
|
| 29 | + $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys[ 'main' ] ); |
|
| 30 | + $_oOption->update( 'enable_admin_pages', $_GET[ 'enable_apfl_admin_pages' ] ); |
|
| 31 | 31 | |
| 32 | 32 | $this->oUtil->goToLocalURL( |
| 33 | 33 | remove_query_arg( 'enable_apfl_admin_pages' ), |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Enable / disable the demo pages |
| 40 | - if ( isset( $_GET['enable_apfl_demo_pages'] ) ) { |
|
| 40 | + if ( isset( $_GET[ 'enable_apfl_demo_pages' ] ) ) { |
|
| 41 | 41 | |
| 42 | 42 | // Update the options and reload the page |
| 43 | - $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys['main'] ); |
|
| 44 | - $_oOption->update( 'enable_demo', $_GET['enable_apfl_demo_pages'] ); |
|
| 43 | + $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys[ 'main' ] ); |
|
| 44 | + $_oOption->update( 'enable_demo', $_GET[ 'enable_apfl_demo_pages' ] ); |
|
| 45 | 45 | |
| 46 | 46 | if ( $_GET[ 'enable_apfl_demo_pages' ] ) { |
| 47 | 47 | $this->setSettingNotice( |
@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | public function setUp() { |
| 68 | 68 | |
| 69 | 69 | $_aOptions = $this->oProp->aOptions; |
| 70 | - $_bAdminPageEnabled = ! is_array( $_aOptions ) // for the first time of loading, the option is not set and it is not an array. |
|
| 71 | - || ( isset( $_aOptions['enable_admin_pages'] ) && $_aOptions['enable_admin_pages'] ); |
|
| 70 | + $_bAdminPageEnabled = !is_array( $_aOptions ) // for the first time of loading, the option is not set and it is not an array. |
|
| 71 | + || ( isset( $_aOptions[ 'enable_admin_pages' ] ) && $_aOptions[ 'enable_admin_pages' ] ); |
|
| 72 | 72 | |
| 73 | 73 | // Set up pages |
| 74 | 74 | if ( $_bAdminPageEnabled ) { |
| 75 | 75 | |
| 76 | 76 | $this->setRootMenuPage( |
| 77 | - AdminPageFrameworkLoader_Registry::SHORTNAME, // menu slug |
|
| 78 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/image/wp-logo_16x16.png', // menu icon |
|
| 77 | + AdminPageFrameworkLoader_Registry::SHORTNAME, // menu slug |
|
| 78 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/image/wp-logo_16x16.png', // menu icon |
|
| 79 | 79 | 4 // menu position |
| 80 | 80 | ); |
| 81 | 81 | |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | new AdminPageFrameworkLoader_AdminPage_Tool( |
| 84 | 84 | $this, |
| 85 | 85 | array( |
| 86 | - 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages['tool'], |
|
| 86 | + 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'tool' ], |
|
| 87 | 87 | 'title' => __( 'Tools', 'admin-page-framework-loader' ), |
| 88 | 88 | ) |
| 89 | 89 | ); |
| 90 | 90 | new AdminPageFrameworkLoader_AdminPage_Addon( |
| 91 | 91 | $this, |
| 92 | 92 | array( |
| 93 | - 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages['addon'], // page slug |
|
| 93 | + 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'addon' ], // page slug |
|
| 94 | 94 | 'title' => __( 'Add Ons', 'admin-page-framework-loader' ), |
| 95 | 95 | ) |
| 96 | 96 | ); |
| 97 | 97 | new AdminPageFrameworkLoader_AdminPage_Help( |
| 98 | 98 | $this, |
| 99 | 99 | array( |
| 100 | - 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages['help'], |
|
| 100 | + 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'help' ], |
|
| 101 | 101 | 'title' => __( 'Help', 'admin-page-framework-loader' ), |
| 102 | 102 | 'order' => 1000, // to be the last menu item |
| 103 | 103 | ) |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | $this->setPluginSettingsLinkLabel( '' ); // pass an empty string to disable it. |
| 121 | 121 | |
| 122 | 122 | // Styles |
| 123 | - $this->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/code.css' ); |
|
| 124 | - $this->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/admin.css' ); |
|
| 123 | + $this->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/code.css' ); |
|
| 124 | + $this->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/admin.css' ); |
|
| 125 | 125 | |
| 126 | 126 | // Action Links (plugin.php) |
| 127 | 127 | $this->addLinkToPluginTitle( |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->_getDemoSwitcherLink( $_bAdminPageEnabled, $_aOptions ) |
| 131 | 131 | ); |
| 132 | 132 | $this->addLinkToPluginDescription( |
| 133 | - "<a href='https://wordpress.org/support/plugin/admin-page-framework' target='_blank'>" . __( 'Support', 'admin-page-framework-loader' ) . "</a>" |
|
| 133 | + "<a href='https://wordpress.org/support/plugin/admin-page-framework' target='_blank'>".__( 'Support', 'admin-page-framework-loader' )."</a>" |
|
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | 136 | } |
@@ -138,24 +138,24 @@ discard block |
||
| 138 | 138 | * Returns the Tools admin page link. |
| 139 | 139 | */ |
| 140 | 140 | private function _getAdminURLTools( $_bAdminPageEnabled ) { |
| 141 | - if ( ! $_bAdminPageEnabled ) { |
|
| 141 | + if ( !$_bAdminPageEnabled ) { |
|
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | - $_sLink = esc_url( |
|
| 144 | + $_sLink = esc_url( |
|
| 145 | 145 | add_query_arg( |
| 146 | 146 | array( |
| 147 | - 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages['tool'], |
|
| 147 | + 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'tool' ], |
|
| 148 | 148 | ), |
| 149 | 149 | admin_url( 'admin.php' ) |
| 150 | 150 | ) |
| 151 | 151 | ); |
| 152 | - return "<a href='{$_sLink}'>" . __( 'Tools', 'admin-page-framework-loader' ) . "</a>"; |
|
| 152 | + return "<a href='{$_sLink}'>".__( 'Tools', 'admin-page-framework-loader' )."</a>"; |
|
| 153 | 153 | } |
| 154 | 154 | /** |
| 155 | 155 | * Returns the Enable /Disable Admin Pages link. |
| 156 | 156 | */ |
| 157 | 157 | private function _getAdminPageSwitchLink( $bEnabled ) { |
| 158 | - $_sLink = esc_url( |
|
| 158 | + $_sLink = esc_url( |
|
| 159 | 159 | add_query_arg( |
| 160 | 160 | array( |
| 161 | 161 | 'enable_apfl_admin_pages' => $bEnabled ? 0 : 1, |
@@ -163,19 +163,19 @@ discard block |
||
| 163 | 163 | ) |
| 164 | 164 | ); |
| 165 | 165 | return $bEnabled |
| 166 | - ? "<a href='{$_sLink}'>" . __( 'Disable Admin Pages', 'admin-page-framework-loader' ) . "</a>" |
|
| 167 | - : "<a href='{$_sLink}'>" . __( 'Enable Admin Pages', 'admin-page-framework-loader' ) . "</a>"; |
|
| 166 | + ? "<a href='{$_sLink}'>".__( 'Disable Admin Pages', 'admin-page-framework-loader' )."</a>" |
|
| 167 | + : "<a href='{$_sLink}'>".__( 'Enable Admin Pages', 'admin-page-framework-loader' )."</a>"; |
|
| 168 | 168 | } |
| 169 | 169 | /** |
| 170 | 170 | * Returns the switch link of the demo pages. |
| 171 | 171 | */ |
| 172 | - private function _getDemoSwitcherLink( $_bAdminPageEnabled, $mOptions=array() ) { |
|
| 172 | + private function _getDemoSwitcherLink( $_bAdminPageEnabled, $mOptions = array() ) { |
|
| 173 | 173 | |
| 174 | - if ( ! $_bAdminPageEnabled ) { |
|
| 174 | + if ( !$_bAdminPageEnabled ) { |
|
| 175 | 175 | return ''; |
| 176 | 176 | } |
| 177 | - $_bEnabled = isset( $mOptions['enable_demo'] ) && $mOptions['enable_demo']; |
|
| 178 | - $_sLink = esc_url( |
|
| 177 | + $_bEnabled = isset( $mOptions[ 'enable_demo' ] ) && $mOptions[ 'enable_demo' ]; |
|
| 178 | + $_sLink = esc_url( |
|
| 179 | 179 | add_query_arg( |
| 180 | 180 | array( |
| 181 | 181 | 'enable_apfl_demo_pages' => $_bEnabled ? 0 : 1, |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | ) |
| 184 | 184 | ); |
| 185 | 185 | return $_bEnabled |
| 186 | - ? "<a href='{$_sLink}'>" . __( 'Disable Demo', 'admin-page-framework-loader' ) . "</a>" |
|
| 187 | - : "<a href='{$_sLink}'><strong id='activate-demo-action-link' style='font-size: 1em;'>" . __( 'Enable Demo', 'admin-page-framework-loader' ) . "</strong></a>"; |
|
| 186 | + ? "<a href='{$_sLink}'>".__( 'Disable Demo', 'admin-page-framework-loader' )."</a>" |
|
| 187 | + : "<a href='{$_sLink}'><strong id='activate-demo-action-link' style='font-size: 1em;'>".__( 'Enable Demo', 'admin-page-framework-loader' )."</strong></a>"; |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function __construct() { |
| 21 | 21 | |
| 22 | - if ( ! $this->_shouldLoadDemo() ) { |
|
| 22 | + if ( !$this->_shouldLoadDemo() ) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | do_action( 'admin_page_framework_loader_action_before_loading_demo' ); |
| 31 | 31 | |
| 32 | 32 | // Include example components. |
| 33 | - include( AdminPageFrameworkLoader_Registry::$sDirPath . '/example/admin-page-framework-demo-bootstrap.php' ); |
|
| 33 | + include( AdminPageFrameworkLoader_Registry::$sDirPath.'/example/admin-page-framework-demo-bootstrap.php' ); |
|
| 34 | 34 | |
| 35 | 35 | do_action( 'admin_page_framework_loader_action_after_loading_demo' ); |
| 36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // Check if the demo is enabled. |
| 49 | 49 | $_oOption = AdminPageFrameworkLoader_Option::getInstance(); |
| 50 | - if ( ! $_oOption->get( 'enable_demo' ) ) { |
|
| 50 | + if ( !$_oOption->get( 'enable_demo' ) ) { |
|
| 51 | 51 | $this->_setPointerToolTips(); |
| 52 | 52 | return false; |
| 53 | 53 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | 'options' => array( |
| 77 | 77 | 'content' => sprintf( '<h3> %1$s </h3> <p> %2$s </p>', |
| 78 | 78 | AdminPageFrameworkLoader_Registry::NAME, |
| 79 | - __( 'Check out the functionality of Admin Page Framework by enabling the demo.','admin-page-framework-loader' ) |
|
| 79 | + __( 'Check out the functionality of Admin Page Framework by enabling the demo.', 'admin-page-framework-loader' ) |
|
| 80 | 80 | ), |
| 81 | 81 | 'position' => array( 'edge' => 'left', 'align' => 'middle' ) |
| 82 | 82 | ) |