@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if ( in_array( $oProp->sClassName, self::$aClassNames ) ) |
30 | 30 | return self::$_oInstance; |
31 | 31 | |
32 | - self::$aClassNames[] = $oProp->sClassName; |
|
32 | + self::$aClassNames[ ] = $oProp->sClassName; |
|
33 | 33 | self::$_oInstance = new AdminPageFramework_PageLoadInfo_post_type( $oProp, $oMsg ); |
34 | 34 | |
35 | 35 | return self::$_oInstance; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function _replyToSetPageLoadInfoInFooter() { |
44 | 44 | |
45 | 45 | // Some users sets $_GET['post_type'] element even in regular admin pages. In that case, do not load the style to avoid duplicates. |
46 | - if ( isset( $_GET['page'] ) && $_GET['page'] ) { return; } |
|
46 | + if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] ) { return; } |
|
47 | 47 | |
48 | 48 | // For post type pages |
49 | 49 | if ( |
@@ -26,8 +26,9 @@ |
||
26 | 26 | */ |
27 | 27 | public static function instantiate( $oProp, $oMsg ) { |
28 | 28 | |
29 | - if ( in_array( $oProp->sClassName, self::$aClassNames ) ) |
|
30 | - return self::$_oInstance; |
|
29 | + if ( in_array( $oProp->sClassName, self::$aClassNames ) ) { |
|
30 | + return self::$_oInstance; |
|
31 | + } |
|
31 | 32 | |
32 | 33 | self::$aClassNames[] = $oProp->sClassName; |
33 | 34 | self::$_oInstance = new AdminPageFramework_PageLoadInfo_post_type( $oProp, $oMsg ); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @since 3.2.0 |
17 | 17 | * @package AdminPageFramework/Factory/Widget |
18 | 18 | */ |
19 | -abstract class AdminPageFramework_Widget_View extends AdminPageFramework_Widget_Model { |
|
19 | +abstract class AdminPageFramework_Widget_View extends AdminPageFramework_Widget_Model { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Filters the post type post content. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @since 3.2.0 |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - public function content( $sContent, $aArguments, $aFormData ) { |
|
42 | + public function content( $sContent, $aArguments, $aFormData ) { |
|
43 | 43 | return $sContent; |
44 | 44 | } |
45 | 45 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @since 3.7.0 |
21 | 21 | * @return string |
22 | 22 | */ |
23 | - protected function _get() { |
|
23 | + protected function _get() { |
|
24 | 24 | return $this->_getWidgetRules(); |
25 | 25 | } |
26 | 26 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | } |
104 | 104 | // If the WordPress version is greater than equal to 3.8, add MP6(the admin style introduced in 3.8) specific CSS rules. |
105 | - if ( version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ) ) { |
|
105 | + if ( version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ) ) { |
|
106 | 106 | |
107 | 107 | $_sCSSRules .= <<<CSSRULES |
108 | 108 | /* Widget Forms */ |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @since 3.7.0 |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - public function construct() { |
|
29 | + public function construct() { |
|
30 | 30 | $this->_addDefaultResources(); |
31 | 31 | } |
32 | 32 |
@@ -19,22 +19,22 @@ |
||
19 | 19 | abstract class AdminPageFramework_Widget_Controller extends AdminPageFramework_Widget_View { |
20 | 20 | |
21 | 21 | /** |
22 | - * The method for necessary set-ups. |
|
23 | - * |
|
24 | - * <h4>Example</h4> |
|
25 | - * <code> |
|
26 | - * public function setUp() { |
|
27 | - * $this->setArguments( |
|
28 | - * array( |
|
29 | - * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
30 | - * ) |
|
31 | - * ); |
|
32 | - * } |
|
33 | - * </code> |
|
34 | - * |
|
35 | - * @abstract |
|
36 | - * @since 3.2.0 |
|
37 | - */ |
|
22 | + * The method for necessary set-ups. |
|
23 | + * |
|
24 | + * <h4>Example</h4> |
|
25 | + * <code> |
|
26 | + * public function setUp() { |
|
27 | + * $this->setArguments( |
|
28 | + * array( |
|
29 | + * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
30 | + * ) |
|
31 | + * ); |
|
32 | + * } |
|
33 | + * </code> |
|
34 | + * |
|
35 | + * @abstract |
|
36 | + * @since 3.2.0 |
|
37 | + */ |
|
38 | 38 | public function setUp() {} |
39 | 39 | |
40 | 40 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @since 3.2.0 |
128 | 128 | * @internal Temporarily marked internal |
129 | 129 | */ |
130 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
130 | + public function enqueueStyles( $aSRCs, $aCustomArgs = array() ) { |
|
131 | 131 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
132 | 132 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
133 | 133 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @since 3.2.0 |
141 | 141 | * @internal Temporarily marked internal |
142 | 142 | */ |
143 | - public function enqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
143 | + public function enqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
144 | 144 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
145 | 145 | return $this->oResource->_enqueueStyle( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
146 | 146 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 3.2.0 |
154 | 154 | * @internal Temporarily marked internal |
155 | 155 | */ |
156 | - public function enqueueScripts( $aSRCs, $aCustomArgs=array() ) { |
|
156 | + public function enqueueScripts( $aSRCs, $aCustomArgs = array() ) { |
|
157 | 157 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
158 | 158 | return $this->oResource->_enqueueScripts( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
159 | 159 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @since 3.2.0 |
167 | 167 | * @internal Temporarily marked internal |
168 | 168 | */ |
169 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
169 | + public function enqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
170 | 170 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
171 | 171 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
172 | 172 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @see https://codex.wordpress.org/Function_Reference/wp_register_sidebar_widget |
188 | 188 | * @return void |
189 | 189 | */ |
190 | - protected function setArguments( array $aArguments=array() ) { |
|
190 | + protected function setArguments( array $aArguments = array() ) { |
|
191 | 191 | $this->oProp->aWidgetArguments = $aArguments; |
192 | 192 | } |
193 | 193 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @since 3.2.0 |
17 | 17 | * @package AdminPageFramework/Factory/Widget |
18 | 18 | */ |
19 | -abstract class AdminPageFramework_Widget_Controller extends AdminPageFramework_Widget_View { |
|
19 | +abstract class AdminPageFramework_Widget_Controller extends AdminPageFramework_Widget_View { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * The method for necessary set-ups. |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @since 3.2.0 |
128 | 128 | * @internal Temporarily marked internal |
129 | 129 | */ |
130 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
130 | + public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
131 | 131 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
132 | 132 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
133 | 133 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @since 3.2.0 |
167 | 167 | * @internal Temporarily marked internal |
168 | 168 | */ |
169 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
169 | + public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
170 | 170 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
171 | 171 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
172 | 172 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @package AdminPageFramework/Factory/Widget |
16 | 16 | * @internal |
17 | 17 | */ |
18 | -abstract class AdminPageFramework_Widget_Router extends AdminPageFramework_Factory { |
|
18 | +abstract class AdminPageFramework_Widget_Router extends AdminPageFramework_Factory { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Sets up hooks and properties. |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | static public function getRelativePath( $from, $to ) { |
29 | 29 | |
30 | 30 | // some compatibility fixes for Windows paths |
31 | - $from = is_dir( $from ) ? rtrim( $from, '\/') . '/' : $from; |
|
32 | - $to = is_dir( $to ) ? rtrim( $to, '\/') . '/' : $to; |
|
31 | + $from = is_dir( $from ) ? rtrim( $from, '\/' ).'/' : $from; |
|
32 | + $to = is_dir( $to ) ? rtrim( $to, '\/' ).'/' : $to; |
|
33 | 33 | $from = str_replace( '\\', '/', $from ); |
34 | 34 | $to = str_replace( '\\', '/', $to ); |
35 | 35 | |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | $to = explode( '/', $to ); |
38 | 38 | $relPath = $to; |
39 | 39 | |
40 | - foreach( $from as $depth => $dir ) { |
|
40 | + foreach ( $from as $depth => $dir ) { |
|
41 | 41 | // find first non-matching dir |
42 | - if( $dir === $to[ $depth ] ) { |
|
42 | + if ( $dir === $to[ $depth ] ) { |
|
43 | 43 | // ignore this directory |
44 | 44 | array_shift( $relPath ); |
45 | 45 | } else { |
46 | 46 | // get number of remaining dirs to $from |
47 | 47 | $remaining = count( $from ) - $depth; |
48 | - if( $remaining > 1 ) { |
|
48 | + if ( $remaining > 1 ) { |
|
49 | 49 | // add traversals up to first matching dir |
50 | 50 | $padLength = ( count( $relPath ) + $remaining - 1 ) * -1; |
51 | 51 | $relPath = array_pad( $relPath, $padLength, '..' ); |
52 | 52 | break; |
53 | 53 | } else { |
54 | - $relPath[ 0 ] = './' . $relPath[ 0 ]; |
|
54 | + $relPath[ 0 ] = './'.$relPath[ 0 ]; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'debug_backtrace', |
76 | 76 | self::_getDebugBacktraceArguments() |
77 | 77 | ); |
78 | - foreach( $_aBackTrace as $_aDebugInfo ) { |
|
78 | + foreach ( $_aBackTrace as $_aDebugInfo ) { |
|
79 | 79 | $_sCallerFilePath = $_aDebugInfo[ 'file' ]; |
80 | 80 | if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
81 | 81 | continue; |
@@ -75,9 +75,9 @@ |
||
75 | 75 | 'debug_backtrace', |
76 | 76 | self::_getDebugBacktraceArguments() |
77 | 77 | ); |
78 | - foreach( $_aBackTrace as $_aDebugInfo ) { |
|
78 | + foreach( $_aBackTrace as $_aDebugInfo ) { |
|
79 | 79 | $_sCallerFilePath = $_aDebugInfo[ 'file' ]; |
80 | - if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
|
80 | + if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
|
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | break; // catch the first found item. |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | */ |
37 | 37 | static public function getInlineCSS( array $aCSSRules ) { |
38 | 38 | $_aOutput = array(); |
39 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
39 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
40 | 40 | if ( is_null( $_sValue ) ) { |
41 | 41 | continue; |
42 | 42 | } |
43 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
43 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
44 | 44 | } |
45 | 45 | return implode( '; ', $_aOutput ); |
46 | 46 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | static public function getStyleAttribute( $asInlineCSSes ) { |
72 | 72 | |
73 | 73 | $_aCSSRules = array(); |
74 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
74 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
75 | 75 | |
76 | 76 | // For array, store in the container. |
77 | 77 | if ( is_array( $_asCSSRules ) ) { |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | // At this point, it is a string. Break them down to array elements. |
83 | 83 | $__aCSSRules = explode( ';', $_asCSSRules ); |
84 | - foreach( $__aCSSRules as $_sPair ) { |
|
84 | + foreach ( $__aCSSRules as $_sPair ) { |
|
85 | 85 | $_aCSSPair = explode( ':', $_sPair ); |
86 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
86 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | */ |
121 | 121 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
122 | 122 | |
123 | - $_aClasses = array(); |
|
124 | - foreach( func_get_args() as $_asClasses ) { |
|
125 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
123 | + $_aClasses = array(); |
|
124 | + foreach ( func_get_args() as $_asClasses ) { |
|
125 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
126 | 126 | continue; |
127 | 127 | } |
128 | 128 | $_aClasses = array_merge( |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | : explode( ' ', $_asClasses ) |
133 | 133 | ); |
134 | 134 | } |
135 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
135 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
136 | 136 | |
137 | 137 | // @todo examine if it is okay to remove the trim() function below. |
138 | 138 | return trim( implode( ' ', $_aClasses ) ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
149 | 149 | $_aParams = func_get_args(); |
150 | 150 | return call_user_func_array( |
151 | - array( __CLASS__ , 'getClassAttribute' ), |
|
151 | + array( __CLASS__, 'getClassAttribute' ), |
|
152 | 152 | $_aParams |
153 | 153 | ); |
154 | 154 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | static public function getDataAttributeArray( array $aArray ) { |
166 | 166 | |
167 | 167 | $_aNewArray = array(); |
168 | - foreach( $aArray as $sKey => $v ) { |
|
168 | + foreach ( $aArray as $sKey => $v ) { |
|
169 | 169 | |
170 | 170 | if ( in_array( gettype( $v ), array( 'object', 'NULL' ) ) ) { |
171 | 171 | continue; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @since 3.1.3 |
65 | 65 | * @since 3.1.5 Added the $vDefault parameter. |
66 | 66 | */ |
67 | - static public function getTransient( $sTransientKey, $vDefault=null ) { |
|
67 | + static public function getTransient( $sTransientKey, $vDefault = null ) { |
|
68 | 68 | |
69 | 69 | // Temporarily disable $_wp_using_ext_object_cache |
70 | 70 | global $_wp_using_ext_object_cache; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @since 3.1.3 |
107 | 107 | * @return boolean True if set; otherwise, false. |
108 | 108 | */ |
109 | - static public function setTransient( $sTransientKey, $vValue, $iExpiration=0 ) { |
|
109 | + static public function setTransient( $sTransientKey, $vValue, $iExpiration = 0 ) { |
|
110 | 110 | |
111 | 111 | // Temporarily disable `$_wp_using_ext_object_cache`. |
112 | 112 | global $_wp_using_ext_object_cache; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * The method will replace last ending 33 characters if the given string in the first parameter exceeds the limit. So this number must be greater than 33. |
147 | 147 | * @return string |
148 | 148 | */ |
149 | - static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength=45 ) { |
|
149 | + static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength = 45 ) { |
|
150 | 150 | |
151 | 151 | // Check if the given string eceees the length limit. |
152 | 152 | if ( strlen( $sSubject ) <= $iAllowedCharacterLength ) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 0, // start position |
161 | 161 | $_iPrefixLengthToKeep - 1 // how many characters to extract |
162 | 162 | ); |
163 | - return $_sPrefixToKeep . '_' . md5( $sSubject ); |
|
163 | + return $_sPrefixToKeep.'_'.md5( $sSubject ); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
175 | 175 | * @param array $aAdditionalOptions an additional options array to merge with the options array. |
176 | 176 | */ |
177 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
177 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
178 | 178 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions ); |
179 | 179 | } |
180 | 180 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @remark Used in the network admin area. |
190 | 190 | * @return mixed |
191 | 191 | */ |
192 | - static public function getSiteOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
192 | + static public function getSiteOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
193 | 193 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions, 'get_site_option' ); |
194 | 194 | } |
195 | 195 | /** |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | * @since 3.5.3 |
199 | 199 | * @return mixed |
200 | 200 | */ |
201 | - static private function _getOptionByFunctionName( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array(), $sFunctionName='get_option' ) { |
|
201 | + static private function _getOptionByFunctionName( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array(), $sFunctionName = 'get_option' ) { |
|
202 | 202 | |
203 | 203 | // Entire options |
204 | - if ( ! isset( $asKey ) ) { |
|
204 | + if ( !isset( $asKey ) ) { |
|
205 | 205 | $_aOptions = $sFunctionName( |
206 | 206 | $sOptionKey, |
207 | 207 | isset( $vDefault ) |
208 | 208 | ? $vDefault |
209 | 209 | : array() |
210 | - );; |
|
210 | + ); ; |
|
211 | 211 | return empty( $aAdditionalOptions ) |
212 | 212 | ? $_aOptions |
213 | 213 | : self::uniteArrays( |