@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Creates an object instance with dynamic parameters. |
44 | 44 | */ |
45 | - static public function getInstance( $sClassName, array $aParameters=array() ) { |
|
45 | + static public function getInstance( $sClassName, array $aParameters = array() ) { |
|
46 | 46 | |
47 | 47 | $_oReflection = new ReflectionClass( $sClassName ); |
48 | 48 | return $_oReflection->newInstanceArgs( $aParameters ); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // For PHP 5.2.x or below |
59 | 59 | if ( version_compare( phpversion(), '<', '5.3.0' ) ) { |
60 | 60 | trigger_error( |
61 | - 'Program Name' . ': ' |
|
61 | + 'Program Name'.': ' |
|
62 | 62 | . sprintf( |
63 | 63 | 'The method cannot run with your PHP version: %1$s', |
64 | 64 | phpversion() |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package AdminPageFramework |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! class_exists( 'AdminPageFramework_Registry', false ) ) : |
|
13 | +if ( !class_exists( 'AdminPageFramework_Registry', false ) ) : |
|
14 | 14 | /** |
15 | 15 | * Facilitates WordPress plugin and theme development. |
16 | 16 | * |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | final class AdminPageFramework_Registry extends AdminPageFramework_Registry_Base { |
57 | 57 | |
58 | 58 | const TEXT_DOMAIN = 'admin-page-framework'; |
59 | - const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
59 | + const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Indicates whether the framework is loaded from the minified version or not. |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * Sets up static properties. |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - static public function setUp( $sFilePath=__FILE__ ) { |
|
101 | + static public function setUp( $sFilePath = __FILE__ ) { |
|
102 | 102 | |
103 | 103 | self::$sFilePath = $sFilePath; |
104 | 104 | self::$sDirPath = dirname( self::$sFilePath ); |
105 | - self::$sIncludeClassListPath = self::$sDirPath . '/admin-page-framework-include-class-list.php'; |
|
105 | + self::$sIncludeClassListPath = self::$sDirPath.'/admin-page-framework-include-class-list.php'; |
|
106 | 106 | self::$aClassFiles = self::_getClassFilePathList( self::$sIncludeClassListPath ); |
107 | 107 | self::$sAutoLoaderPath = isset( self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] ) |
108 | 108 | ? self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return array |
118 | 118 | */ |
119 | 119 | static private function _getClassFilePathList( $sInclusionClassListPath ) { |
120 | - $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
120 | + $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
121 | 121 | include( $sInclusionClassListPath ); |
122 | 122 | return $aClassFiles; |
123 | 123 | } |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | */ |
131 | 131 | static public function getVersion() { |
132 | 132 | |
133 | - if ( ! isset( self::$sAutoLoaderPath ) ) { |
|
134 | - trigger_error( 'Admin Page Framework: ' . ' : ' . sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
133 | + if ( !isset( self::$sAutoLoaderPath ) ) { |
|
134 | + trigger_error( 'Admin Page Framework: '.' : '.sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
135 | 135 | return self::VERSION; |
136 | 136 | } |
137 | - $_aMinifiedVesionSuffix = array( |
|
137 | + $_aMinifiedVesionSuffix = array( |
|
138 | 138 | 0 => '', |
139 | 139 | 1 => '.min', |
140 | 140 | ); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | endif; |
165 | 165 | |
166 | -if ( ! class_exists( 'AdminPageFramework_Bootstrap', false ) ) : |
|
166 | +if ( !class_exists( 'AdminPageFramework_Bootstrap', false ) ) : |
|
167 | 167 | /** |
168 | 168 | * Loads the Admin Page Framework library. |
169 | 169 | * |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function __construct( $sLibraryPath ) { |
186 | 186 | |
187 | - if ( ! $this->_isLoadable() ) { |
|
187 | + if ( !$this->_isLoadable() ) { |
|
188 | 188 | return; |
189 | 189 | } |
190 | 190 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
35 | 35 | |
36 | - if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
36 | + if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ); |
47 | 47 | |
48 | 48 | // Go to the catch clause. |
49 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
49 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
50 | 50 | $_oException->aReturn = $this->_confirmSubmitButtonAction( |
51 | 51 | $this->getElement( $aSubmitInformation, 'input_name' ), |
52 | 52 | $this->getElement( $aSubmitInformation, 'section_id' ), |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides an abstract base class to create meta boxes in generic admin pages created by the framework. |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides utility methods which can be accessed among different components of the framework. |
@@ -165,6 +165,7 @@ discard block |
||
165 | 165 | * Returns the HTML output of the number input part. |
166 | 166 | * |
167 | 167 | * @since 3.5.3 |
168 | + * @param boolean $bMultiLabels |
|
168 | 169 | * @return string The number input output. |
169 | 170 | */ |
170 | 171 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
@@ -217,6 +218,7 @@ discard block |
||
217 | 218 | * Returns the HTML output of the unit select input part. |
218 | 219 | * |
219 | 220 | * @since 3.5.3 |
221 | + * @param boolean $bMultiLabels |
|
220 | 222 | * @return string The unit select input output. |
221 | 223 | */ |
222 | 224 | private function _getUnitSelectInput( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'size', ); |
|
24 | + public $aFieldTypeSlugs = array( 'size',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected $aDefaultKeys = array( |
32 | 32 | 'is_multiple' => false, // indicates whether the select tag alloes multiple selections. |
33 | - 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
33 | + 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
34 | 34 | 'attributes' => array( |
35 | 35 | 'size' => array( |
36 | 36 | 'min' => null, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | protected $aDefaultUnits = array( |
60 | 60 | 'px' => 'px', // pixel |
61 | - '%' => '%', // percentage |
|
61 | + '%' => '%', // percentage |
|
62 | 62 | 'em' => 'em', // font size |
63 | 63 | 'ex' => 'ex', // font height |
64 | 64 | 'in' => 'in', // inch |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | ); |
116 | 116 | |
117 | 117 | $_aOutput = array(); |
118 | - foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
119 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
118 | + foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
119 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
120 | 120 | $_isKey, |
121 | 121 | $_sLabel, |
122 | 122 | $aField |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | $_aBaseAttributes = $_bMultiLabels |
140 | 140 | ? array( |
141 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]", |
|
142 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}", |
|
141 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]", |
|
142 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$isKey}", |
|
143 | 143 | 'value' => $aField[ 'value' ], |
144 | 144 | ) |
145 | 145 | + $aField[ 'attributes' ] |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | |
152 | 152 | $_aOutput = array( |
153 | 153 | $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ), |
154 | - "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: " . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>", |
|
155 | - $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
156 | - $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
154 | + "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>", |
|
155 | + $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
156 | + $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
157 | 157 | "</div>", |
158 | 158 | $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] ) |
159 | 159 | ); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
170 | 170 | |
171 | 171 | // Size and Size Label |
172 | - $_aSizeAttributes = $this->_getSizeAttributes( |
|
172 | + $_aSizeAttributes = $this->_getSizeAttributes( |
|
173 | 173 | $aField, |
174 | 174 | $aBaseAttributes, |
175 | 175 | $bMultiLabels |
@@ -177,32 +177,32 @@ discard block |
||
177 | 177 | : '' |
178 | 178 | ); |
179 | 179 | |
180 | - $_aSizeLabelAttributes = array( |
|
180 | + $_aSizeLabelAttributes = array( |
|
181 | 181 | 'for' => $_aSizeAttributes[ 'id' ], |
182 | 182 | 'class' => $_aSizeAttributes[ 'disabled' ] |
183 | 183 | ? 'disabled' |
184 | 184 | : null, |
185 | 185 | ); |
186 | 186 | |
187 | - $_sLabel = $this->getElementByLabel( |
|
187 | + $_sLabel = $this->getElementByLabel( |
|
188 | 188 | $aField[ 'label' ], |
189 | 189 | $isKey, |
190 | 190 | $aField[ 'label' ] |
191 | 191 | ); |
192 | - return "<label " . $this->getAttributes( $_aSizeLabelAttributes ) . ">" |
|
192 | + return "<label ".$this->getAttributes( $_aSizeLabelAttributes ).">" |
|
193 | 193 | . $this->getElement( |
194 | 194 | $aField, |
195 | 195 | $bMultiLabels |
196 | 196 | ? array( 'before_label', $isKey, 'size' ) |
197 | 197 | : array( 'before_label', 'size' ) |
198 | 198 | ) |
199 | - . ( $aField['label'] && ! $aField[ 'repeatable' ] |
|
200 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>" |
|
199 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
200 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
201 | 201 | . $_sLabel |
202 | 202 | . "</span>" |
203 | 203 | : "" |
204 | 204 | ) |
205 | - . "<input " . $this->getAttributes( $_aSizeAttributes ) . " />" |
|
205 | + . "<input ".$this->getAttributes( $_aSizeAttributes )." />" |
|
206 | 206 | . $this->getElement( |
207 | 207 | $aField, |
208 | 208 | $bMultiLabels |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | ) |
245 | 245 | : $aField[ 'units' ]; |
246 | 246 | |
247 | - return "<label " . $this->getAttributes( |
|
247 | + return "<label ".$this->getAttributes( |
|
248 | 248 | array( |
249 | 249 | 'for' => $_aUnitAttributes[ 'id' ], |
250 | 250 | 'class' => $_aUnitAttributes[ 'disabled' ] |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @since 3.5.3 |
276 | 276 | * @return array an unit attribute array |
277 | 277 | */ |
278 | - private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey='' ) { |
|
278 | + private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey = '' ) { |
|
279 | 279 | |
280 | - $_bIsMultiple = $aField[ 'is_multiple' ] |
|
280 | + $_bIsMultiple = $aField[ 'is_multiple' ] |
|
281 | 281 | ? true |
282 | 282 | : $this->getElement( |
283 | 283 | $aField, |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | |
290 | 290 | $_aSelectAttributes = array( |
291 | 291 | 'type' => 'select', |
292 | - 'id' => $aField[ 'input_id' ] . ( '' === $isLabelKey ? '' : '_' . $isLabelKey ) . '_' . 'unit', |
|
292 | + 'id' => $aField[ 'input_id' ].( '' === $isLabelKey ? '' : '_'.$isLabelKey ).'_'.'unit', |
|
293 | 293 | 'multiple' => $_bIsMultiple |
294 | 294 | ? 'multiple' |
295 | 295 | : null, |
296 | 296 | 'name' => $_bIsMultiple |
297 | - ? "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit][]" |
|
298 | - : "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit]", |
|
297 | + ? "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit][]" |
|
298 | + : "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit]", |
|
299 | 299 | 'value' => $this->getElement( |
300 | 300 | $aField, |
301 | 301 | array( 'value', 'unit' ), |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | '' === $isLabelKey |
308 | 308 | ? array( 'attributes', 'unit' ) |
309 | 309 | : array( 'attributes', $isLabelKey, 'unit' ), |
310 | - $this->aDefaultKeys['attributes']['unit'] |
|
310 | + $this->aDefaultKeys[ 'attributes' ][ 'unit' ] |
|
311 | 311 | ) |
312 | 312 | + $aBaseAttributes; |
313 | 313 | return $_aSelectAttributes; |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | * @since 3.5.3 |
321 | 321 | * @return array an size attribute array |
322 | 322 | */ |
323 | - private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey='' ) { |
|
323 | + private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey = '' ) { |
|
324 | 324 | |
325 | 325 | return array( |
326 | 326 | 'type' => 'number', |
327 | - 'id' => $aField['input_id'] . '_' . ( '' !== $sLabelKey ? $sLabelKey . '_' : '' ) . 'size', |
|
328 | - 'name' => $aField[ '_input_name' ] . ( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ) . '[size]', |
|
327 | + 'id' => $aField[ 'input_id' ].'_'.( '' !== $sLabelKey ? $sLabelKey.'_' : '' ).'size', |
|
328 | + 'name' => $aField[ '_input_name' ].( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ).'[size]', |
|
329 | 329 | 'value' => $this->getElement( |
330 | - $aField, // subject |
|
331 | - array( 'value', 'size' ), // dimensional keys |
|
330 | + $aField, // subject |
|
331 | + array( 'value', 'size' ), // dimensional keys |
|
332 | 332 | '' // default |
333 | 333 | ), |
334 | 334 | ) |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides utility methods which can be accessed among different components of the framework. |