@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Defines the field type slugs used for this field type. |
42 | 42 | */ |
43 | - public $aFieldTypeSlugs = array( 'import', ); |
|
43 | + public $aFieldTypeSlugs = array( 'import',); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Defines the default key-values of this field type. |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return array( |
74 | 74 | array( |
75 | 75 | 'handle_id' => 'admin-page-framework-field-type-import', |
76 | - 'src' => dirname( __FILE__ ) . '/js/import.bundle.js', |
|
76 | + 'src' => dirname( __FILE__ ).'/js/import.bundle.js', |
|
77 | 77 | 'in_footer' => true, |
78 | 78 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
79 | 79 | 'translation_var' => 'AdminPageFrameworkImportFieldType', |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @return string |
98 | 98 | */ |
99 | 99 | protected function getField( $aField ) { |
100 | - $aField[ 'attributes'][ 'name' ] = "__import[submit][{$aField[ 'input_id' ]}]"; |
|
100 | + $aField[ 'attributes' ][ 'name' ] = "__import[submit][{$aField[ 'input_id' ]}]"; |
|
101 | 101 | $aField[ 'label' ] = $aField[ 'label' ] |
102 | 102 | ? $aField[ 'label' ] |
103 | 103 | : $this->oMsg->get( 'import' ); |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function _getExtraFieldsBeforeLabel( &$aField ) { |
118 | 118 | return "<label>" |
119 | - . "<input " . $this->getAttributes( |
|
119 | + . "<input ".$this->getAttributes( |
|
120 | 120 | array( |
121 | 121 | 'id' => "{$aField[ 'input_id' ]}_file", |
122 | 122 | 'type' => 'file', |
123 | 123 | 'name' => "__import[{$aField[ 'input_id' ]}]", |
124 | 124 | ) + $aField[ 'attributes' ][ 'file' ] |
125 | - ) . " />" |
|
125 | + )." />" |
|
126 | 126 | . "</label>"; |
127 | 127 | } |
128 | 128 | |
@@ -135,44 +135,44 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function _getExtraInputFields( &$aField ) { |
137 | 137 | |
138 | - $aHiddenAttributes = array( 'type' => 'hidden', ); |
|
138 | + $aHiddenAttributes = array( 'type' => 'hidden',); |
|
139 | 139 | return |
140 | - "<input " . $this->getAttributes( |
|
140 | + "<input ".$this->getAttributes( |
|
141 | 141 | array( |
142 | - 'name' => "__import[{$aField['input_id']}][input_id]", |
|
143 | - 'value' => $aField['input_id'], |
|
142 | + 'name' => "__import[{$aField[ 'input_id' ]}][input_id]", |
|
143 | + 'value' => $aField[ 'input_id' ], |
|
144 | 144 | ) + $aHiddenAttributes |
145 | - ) . "/>" |
|
146 | - . "<input " . $this->getAttributes( |
|
145 | + )."/>" |
|
146 | + . "<input ".$this->getAttributes( |
|
147 | 147 | array( |
148 | - 'name' => "__import[{$aField['input_id']}][field_id]", |
|
149 | - 'value' => $aField['field_id'], |
|
148 | + 'name' => "__import[{$aField[ 'input_id' ]}][field_id]", |
|
149 | + 'value' => $aField[ 'field_id' ], |
|
150 | 150 | ) + $aHiddenAttributes |
151 | - ) . "/>" |
|
152 | - . "<input " . $this->getAttributes( |
|
151 | + )."/>" |
|
152 | + . "<input ".$this->getAttributes( |
|
153 | 153 | array( |
154 | - 'name' => "__import[{$aField['input_id']}][section_id]", |
|
155 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
154 | + 'name' => "__import[{$aField[ 'input_id' ]}][section_id]", |
|
155 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
156 | 156 | ) + $aHiddenAttributes |
157 | - ) . "/>" |
|
158 | - . "<input " . $this->getAttributes( |
|
157 | + )."/>" |
|
158 | + . "<input ".$this->getAttributes( |
|
159 | 159 | array( |
160 | - 'name' => "__import[{$aField['input_id']}][is_merge]", |
|
161 | - 'value' => $aField['is_merge'], |
|
160 | + 'name' => "__import[{$aField[ 'input_id' ]}][is_merge]", |
|
161 | + 'value' => $aField[ 'is_merge' ], |
|
162 | 162 | ) + $aHiddenAttributes |
163 | - ) . "/>" |
|
164 | - . "<input " . $this->getAttributes( |
|
163 | + )."/>" |
|
164 | + . "<input ".$this->getAttributes( |
|
165 | 165 | array( |
166 | - 'name' => "__import[{$aField['input_id']}][option_key]", |
|
167 | - 'value' => $aField['option_key'], |
|
166 | + 'name' => "__import[{$aField[ 'input_id' ]}][option_key]", |
|
167 | + 'value' => $aField[ 'option_key' ], |
|
168 | 168 | ) + $aHiddenAttributes |
169 | - ) . "/>" |
|
170 | - . "<input " . $this->getAttributes( |
|
169 | + )."/>" |
|
170 | + . "<input ".$this->getAttributes( |
|
171 | 171 | array( |
172 | - 'name' => "__import[{$aField['input_id']}][format]", |
|
173 | - 'value' => $aField['format'], |
|
172 | + 'name' => "__import[{$aField[ 'input_id' ]}][format]", |
|
173 | + 'value' => $aField[ 'format' ], |
|
174 | 174 | ) + $aHiddenAttributes |
175 | - ) . "/>" |
|
175 | + )."/>" |
|
176 | 176 | ; |
177 | 177 | } |
178 | 178 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * Defines the field type slugs used for this field type. |
119 | 119 | * @var array |
120 | 120 | */ |
121 | - public $aFieldTypeSlugs = array( 'taxonomy', ); |
|
121 | + public $aFieldTypeSlugs = array( 'taxonomy',); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Defines the default key-values of this field type. |
@@ -127,41 +127,41 @@ discard block |
||
127 | 127 | * @var array |
128 | 128 | */ |
129 | 129 | protected $aDefaultKeys = array( |
130 | - 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
131 | - 'height' => '250px', // the tab box height |
|
132 | - 'width' => null, // 3.5.7.2+ the tab box width |
|
133 | - 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
134 | - 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
130 | + 'taxonomy_slugs' => 'category', // (array|string) This is for the taxonomy field type. |
|
131 | + 'height' => '250px', // the tab box height |
|
132 | + 'width' => null, // 3.5.7.2+ the tab box width |
|
133 | + 'max_width' => '100%', // for the taxonomy checklist field type, since 2.1.1. |
|
134 | + 'show_post_count' => true, // (boolean) 3.2.0+ whether or not the post count associated with the term should be displayed or not. |
|
135 | 135 | 'attributes' => array(), |
136 | - 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
137 | - 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
138 | - 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
139 | - 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
136 | + 'select_all_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
137 | + 'select_none_button' => true, // (boolean|string) 3.3.0+ to change the label, set the label here |
|
138 | + 'label_no_term_found' => null, // (string) 3.3.2+ The label to display when no term is found. null needs to be set here as the default value will be assigned in the field output method. |
|
139 | + 'label_list_title' => '', // (string) 3.3.2+ The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts. |
|
140 | 140 | 'query' => array( // (array) 3.3.2+ Defines the default query argument. |
141 | 141 | // see the arguments of the get_category() function: http://codex.wordpress.org/Function_Reference/get_categories |
142 | 142 | // see the argument of the get_terms() function: http://codex.wordpress.org/Function_Reference/get_terms |
143 | 143 | 'child_of' => 0, |
144 | 144 | 'parent' => '', |
145 | - 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
146 | - 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
147 | - 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
148 | - 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
149 | - 'number' => '', // (integer) The maximum number of the terms to show. |
|
150 | - 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
151 | - 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
145 | + 'orderby' => 'name', // (string) 'ID' or 'term_id' or 'name' |
|
146 | + 'order' => 'ASC', // (string) 'ASC' or 'DESC' |
|
147 | + 'hide_empty' => false, // (boolean) whether to show the terms with no post associated. Default: false |
|
148 | + 'hierarchical' => true, // (boolean) whether to show the terms as a hierarchical tree. |
|
149 | + 'number' => '', // (integer) The maximum number of the terms to show. |
|
150 | + 'pad_counts' => false, // (boolean) whether to sum up the post counts with the child post counts. |
|
151 | + 'exclude' => array(), // (string) Comma separated term IDs to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. |
|
152 | 152 | 'exclude_tree' => array(), |
153 | - 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
153 | + 'include' => array(), // (string) Comma separated term IDs to include in the list. |
|
154 | 154 | 'fields' => 'all', |
155 | 155 | 'slug' => '', |
156 | 156 | 'get' => '', |
157 | 157 | 'name__like' => '', |
158 | 158 | 'description__like' => '', |
159 | 159 | 'offset' => '', |
160 | - 'search' => '', // (string) The search keyword to get the term with. |
|
160 | + 'search' => '', // (string) The search keyword to get the term with. |
|
161 | 161 | 'cache_domain' => 'core', |
162 | 162 | ), |
163 | - 'queries' => array(), // (optional, array) 3.3.2+ Sets a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
164 | - 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
163 | + 'queries' => array(), // (optional, array) 3.3.2+ Sets a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array. |
|
164 | + 'save_unchecked' => true, // (optional, boolean) 3.8.8+ Whether to store the values of unchecked items. |
|
165 | 165 | ); |
166 | 166 | |
167 | 167 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | return array( |
173 | 173 | array( |
174 | 174 | 'handle_id' => 'admin-page-framework-field-type-taxonomy', |
175 | - 'src' => dirname( __FILE__ ) . '/js/taxonomy.bundle.js', |
|
175 | + 'src' => dirname( __FILE__ ).'/js/taxonomy.bundle.js', |
|
176 | 176 | 'in_footer' => true, |
177 | 177 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
178 | 178 | 'translation_var' => 'AdminPageFrameworkFieldTypeTaxonomy', |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | // Parse |
209 | 209 | $_aTabs = array(); |
210 | 210 | $_aCheckboxes = array(); |
211 | - foreach( $this->getAsArray( $aField[ 'taxonomy_slugs' ] ) as $_isKey => $_sTaxonomySlug ) { |
|
211 | + foreach ( $this->getAsArray( $aField[ 'taxonomy_slugs' ] ) as $_isKey => $_sTaxonomySlug ) { |
|
212 | 212 | $_aAssociatedDataAttributes = $this->___getDataAttributesOfAssociatedPostTypes( |
213 | 213 | $_sTaxonomySlug, |
214 | 214 | $this->___getPostTypesByTaxonomySlug( $_sTaxonomySlug ) |
215 | 215 | ); |
216 | - $_aTabs[] = $this->___getTaxonomyTab( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
217 | - $_aCheckboxes[] = $this->___getTaxonomyCheckboxes( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
216 | + $_aTabs[ ] = $this->___getTaxonomyTab( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
217 | + $_aCheckboxes[ ] = $this->___getTaxonomyCheckboxes( $aField, $_isKey, $_sTaxonomySlug, $_aAssociatedDataAttributes ); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // Output |
221 | - return "<div id='tabbox-{$aField['field_id']}' class='tab-box-container categorydiv' style='max-width:{$aField['max_width']};'>" |
|
221 | + return "<div id='tabbox-{$aField[ 'field_id' ]}' class='tab-box-container categorydiv' style='max-width:{$aField[ 'max_width' ]};'>" |
|
222 | 222 | . "<ul class='tab-box-tabs category-tabs'>" |
223 | 223 | . implode( PHP_EOL, $_aTabs ) |
224 | 224 | . "</ul>" |
225 | 225 | . "<div class='tab-box-contents-container'>" |
226 | - . "<div class='tab-box-contents' style='height: {$aField['height']};'>" |
|
226 | + . "<div class='tab-box-contents' style='height: {$aField[ 'height' ]};'>" |
|
227 | 227 | . implode( PHP_EOL, $_aCheckboxes ) |
228 | 228 | . "</div>" |
229 | 229 | . "</div>" |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | private function ___getDataAttributesOfAssociatedPostTypes( $sTaxonomySlusg, $aPostTypes ) { |
250 | 250 | return array( |
251 | 251 | 'data-associated-with' => $sTaxonomySlusg, |
252 | - 'data-associated-post-types' => implode( ',', $aPostTypes ) . ',', // must add a trailing comma for jQuery to detect the item. |
|
252 | + 'data-associated-post-types' => implode( ',', $aPostTypes ).',', // must add a trailing comma for jQuery to detect the item. |
|
253 | 253 | ); |
254 | 254 | } |
255 | 255 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | private function ___getTaxonomyCheckboxes( array $aField, $sKey, $sTaxonomySlug, $aAttributes ) { |
265 | 265 | |
266 | 266 | $_aTabBoxContainerArguments = array( |
267 | - 'id' => "tab_{$aField['input_id']}_{$sKey}", |
|
267 | + 'id' => "tab_{$aField[ 'input_id' ]}_{$sKey}", |
|
268 | 268 | 'class' => 'tab-box-content', |
269 | 269 | 'style' => $this->getInlineCSS( |
270 | 270 | array( |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | ) |
274 | 274 | ), |
275 | 275 | ) + $aAttributes; |
276 | - return "<div " . $this->getAttributes( $_aTabBoxContainerArguments ) . ">" |
|
276 | + return "<div ".$this->getAttributes( $_aTabBoxContainerArguments ).">" |
|
277 | 277 | . $this->getElement( $aField, array( 'before_label', $sKey ) ) |
278 | - . "<div " . $this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ) . ">" |
|
278 | + . "<div ".$this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ).">" |
|
279 | 279 | . "</div>" |
280 | 280 | . "<ul class='list:category taxonomychecklist form-no-clear'>" |
281 | 281 | . $this->___getTaxonomyChecklist( $aField, $sKey, $sTaxonomySlug ) |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'taxonomy' => $sTaxonomySlug, |
301 | 301 | '_name_prefix' => is_array( $aField[ 'taxonomy_slugs' ] ) |
302 | 302 | ? "{$aField[ '_input_name' ]}[{$sTaxonomySlug}]" |
303 | - : $aField[ '_input_name' ], // name prefix of the input |
|
303 | + : $aField[ '_input_name' ], // name prefix of the input |
|
304 | 304 | '_input_id_prefix' => $aField[ 'input_id' ], |
305 | 305 | '_attributes' => $this->getElementAsArray( |
306 | 306 | $aField, |
@@ -308,12 +308,12 @@ discard block |
||
308 | 308 | ) + $aField[ 'attributes' ], |
309 | 309 | |
310 | 310 | // checked items ( term IDs ) e.g. array( 6, 10, 7, 15 ), |
311 | - '_selected_items' => $this->___getSelectedKeyArray( $aField['value'], $sTaxonomySlug ), |
|
311 | + '_selected_items' => $this->___getSelectedKeyArray( $aField[ 'value' ], $sTaxonomySlug ), |
|
312 | 312 | |
313 | - 'echo' => false, // returns the output |
|
314 | - 'show_post_count' => $aField[ 'show_post_count' ], // 3.2.0+ |
|
315 | - 'show_option_none' => $aField[ 'label_no_term_found' ], // 3.3.2+ |
|
316 | - 'title_li' => $aField[ 'label_list_title' ], // 3.3.2+ |
|
313 | + 'echo' => false, // returns the output |
|
314 | + 'show_post_count' => $aField[ 'show_post_count' ], // 3.2.0+ |
|
315 | + 'show_option_none' => $aField[ 'label_no_term_found' ], // 3.3.2+ |
|
316 | + 'title_li' => $aField[ 'label_list_title' ], // 3.3.2+ |
|
317 | 317 | |
318 | 318 | '_save_unchecked' => $aField[ 'save_unchecked' ], // 3.8.8+ Whether to insert hidden input element for unchecked. |
319 | 319 | ) |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | $_aLiAttributes = array( |
359 | 359 | 'class' => 'tab-box-tab', |
360 | 360 | ) + $aAttributes; |
361 | - return "<li " . $this->getAttributes( $_aLiAttributes ) . ">" |
|
362 | - . "<a href='#tab_{$aField['input_id']}_{$sKey}'>" |
|
361 | + return "<li ".$this->getAttributes( $_aLiAttributes ).">" |
|
362 | + . "<a href='#tab_{$aField[ 'input_id' ]}_{$sKey}'>" |
|
363 | 363 | . "<span class='tab-box-tab-text'>" |
364 | 364 | . $this->___getLabelFromTaxonomySlug( $sTaxonomySlug ) |
365 | 365 | . "</span>" |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Defines the field type slugs used for this field type. |
38 | 38 | */ |
39 | - public $aFieldTypeSlugs = array( 'file', ); |
|
39 | + public $aFieldTypeSlugs = array( 'file',); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Defines the default key-values of this field type. |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | array( |
97 | 97 | 'type' => 'hidden', |
98 | 98 | 'value' => '', |
99 | - 'name' => $aField[ 'attributes' ][ 'name' ] . '[_dummy_value]', |
|
99 | + 'name' => $aField[ 'attributes' ][ 'name' ].'[_dummy_value]', |
|
100 | 100 | ) |
101 | 101 | ) |
102 | 102 | . $this->getHTMLTag( |
103 | 103 | 'input', |
104 | 104 | array( |
105 | 105 | 'type' => 'hidden', |
106 | - 'name' => '__unset_' . $aField[ '_structure_type' ] . '[' . $aField[ '_input_name_flat' ] . '|_dummy_value' . ']', |
|
107 | - 'value' => $aField[ '_input_name_flat' ] . '|_dummy_value', |
|
106 | + 'name' => '__unset_'.$aField[ '_structure_type' ].'['.$aField[ '_input_name_flat' ].'|_dummy_value'.']', |
|
107 | + 'value' => $aField[ '_input_name_flat' ].'|_dummy_value', |
|
108 | 108 | 'class' => 'unset-element-names element-address', |
109 | 109 | ) |
110 | 110 | ); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return array( |
126 | 126 | array( |
127 | 127 | 'handle_id' => 'admin-page-framework-field-type-textarea', |
128 | - 'src' => dirname( __FILE__ ) . '/js/textarea.bundle.js', |
|
128 | + 'src' => dirname( __FILE__ ).'/js/textarea.bundle.js', |
|
129 | 129 | 'in_footer' => true, |
130 | 130 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
131 | 131 | 'translation_var' => 'AdminPageFrameworkFieldTypeTextArea', |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | protected function getField( $aField ) { |
150 | 150 | |
151 | 151 | $_aOutput = array(); |
152 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
153 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
152 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
153 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
154 | 154 | $_sKey, |
155 | 155 | $_sLabel, |
156 | 156 | $aField |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // the repeatable field buttons will be replaced with this element. |
161 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
161 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
162 | 162 | return implode( '', $_aOutput ); |
163 | 163 | |
164 | 164 | } |
@@ -179,27 +179,27 @@ discard block |
||
179 | 179 | $aField[ 'rich' ] = $this->getElementByLabel( $aField[ 'rich' ], $sKey, $aField[ 'label' ] ); |
180 | 180 | $aField[ 'attributes' ] = $_bIsArray |
181 | 181 | ? array( |
182 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
183 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
182 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
183 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
184 | 184 | 'value' => $aField[ 'value' ], |
185 | 185 | ) |
186 | 186 | + $aField[ 'attributes' ] |
187 | 187 | : $aField[ 'attributes' ]; |
188 | - $_aOutput = array( |
|
189 | - $this->getElementByLabel( $aField['before_label'], $sKey, $aField[ 'label' ] ), |
|
188 | + $_aOutput = array( |
|
189 | + $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
|
190 | 190 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
191 | - "<label for='" . $aField[ 'attributes' ][ 'id' ] . "'>", |
|
192 | - $this->getElementByLabel( $aField['before_input'], $sKey, $aField[ 'label' ] ), |
|
191 | + "<label for='".$aField[ 'attributes' ][ 'id' ]."'>", |
|
192 | + $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
|
193 | 193 | $_sLabel |
194 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
194 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
195 | 195 | . $_sLabel |
196 | 196 | . "</span>" |
197 | 197 | : '', |
198 | 198 | $this->_getEditor( $aField ), |
199 | - $this->getElementByLabel( $aField['after_input'], $sKey, $aField[ 'label' ] ), |
|
199 | + $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
|
200 | 200 | "</label>", |
201 | 201 | "</div>", |
202 | - $this->getElementByLabel( $aField['after_label'], $sKey, $aField[ 'label' ] ), |
|
202 | + $this->getElementByLabel( $aField[ 'after_label' ], $sKey, $aField[ 'label' ] ), |
|
203 | 203 | ); |
204 | 204 | return implode( '', $_aOutput ); |
205 | 205 | |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | unset( $aField[ 'attributes' ][ 'value' ] ); |
218 | 218 | |
219 | 219 | // For no TinyMCE |
220 | - if ( empty( $aField[ 'rich' ] ) || ! $this->isTinyMCESupported() ) { |
|
221 | - return "<textarea " . $this->getAttributes( $aField[ 'attributes' ] ) . " >" // this method is defined in the base class |
|
220 | + if ( empty( $aField[ 'rich' ] ) || !$this->isTinyMCESupported() ) { |
|
221 | + return "<textarea ".$this->getAttributes( $aField[ 'attributes' ] )." >" // this method is defined in the base class |
|
222 | 222 | . esc_textarea( $aField[ 'value' ] ) |
223 | 223 | . "</textarea>"; |
224 | 224 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | ob_end_clean(); |
251 | 251 | |
252 | 252 | return $_sContent |
253 | - . "<input type='hidden' class='admin-page-framework-textarea-data-input' data-tinymce-textarea='" . esc_attr( $aField[ 'attributes' ][ 'id' ] ) . "' />"; // needed for JavaScript initialization |
|
253 | + . "<input type='hidden' class='admin-page-framework-textarea-data-input' data-tinymce-textarea='".esc_attr( $aField[ 'attributes' ][ 'id' ] )."' />"; // needed for JavaScript initialization |
|
254 | 254 | |
255 | 255 | } |
256 | 256 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // For front-end |
86 | 86 | // @see http://wordpress.stackexchange.com/a/82722 |
87 | - if ( ! is_admin() ) { |
|
87 | + if ( !is_admin() ) { |
|
88 | 88 | |
89 | 89 | // wp_enqueue_style( 'wp-color-picker' ); |
90 | 90 | wp_enqueue_script( |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return array( |
125 | 125 | array( |
126 | 126 | 'handle_id' => 'admin-page-framework-field-type-color', |
127 | - 'src' => dirname( __FILE__ ) . '/js/color.bundle.js', |
|
127 | + 'src' => dirname( __FILE__ ).'/js/color.bundle.js', |
|
128 | 128 | 'in_footer' => true, |
129 | 129 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
130 | 130 | 'translation_var' => 'AdminPageFrameworkColorFieldType', |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | $aField[ 'attributes' ] = $this->___getInputAttributes( $aField ); |
150 | 150 | return $aField[ 'before_label' ] |
151 | 151 | . "<div class='admin-page-framework-input-label-container'>" |
152 | - . ( $aField[ 'label' ] && ! $aField[ 'repeatable' ] |
|
153 | - ? "<label><span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
152 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
153 | + ? "<label><span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
154 | 154 | . $aField[ 'label' ] |
155 | 155 | . "</span></label>" |
156 | 156 | : "" |
157 | 157 | ) |
158 | 158 | . "<label for='{$aField[ 'input_id' ]}'>" |
159 | 159 | . $aField[ 'before_input' ] |
160 | - . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
|
160 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
161 | 161 | . $aField[ 'after_input' ] |
162 | 162 | . "</label>" |
163 | 163 | // this div element with this class selector becomes a farbtastic color picker. ( below 3.4.x ) // rel='{$aField['input_id']}' |
164 | - . "<div class='colorpicker admin-page-framework-field-color-picker' id='color_" . esc_attr( $aField[ 'input_id' ] ) . "' data-input_id='" . esc_attr( $aField[ 'input_id' ] ) . "'></div>" |
|
164 | + . "<div class='colorpicker admin-page-framework-field-color-picker' id='color_".esc_attr( $aField[ 'input_id' ] )."' data-input_id='".esc_attr( $aField[ 'input_id' ] )."'></div>" |
|
165 | 165 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
166 | 166 | . "</div>" |
167 | - . $aField['after_label']; |
|
167 | + . $aField[ 'after_label' ]; |
|
168 | 168 | |
169 | 169 | } |
170 | 170 | /** |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | private function ___getInputAttributes( array $aField ) { |
176 | 176 | |
177 | 177 | return array( |
178 | - 'color' => $aField['value'], |
|
179 | - 'value' => $aField['value'], |
|
178 | + 'color' => $aField[ 'value' ], |
|
179 | + 'value' => $aField[ 'value' ], |
|
180 | 180 | 'data-default' => isset( $aField[ 'default' ] ) |
181 | 181 | ? $aField[ 'default' ] |
182 | 182 | : 'transparent', // used by the repeatable script |
183 | 183 | 'type' => 'text', // it must be text |
184 | - 'class' => trim( 'input_color ' . $aField['attributes']['class'] ), |
|
184 | + 'class' => trim( 'input_color '.$aField[ 'attributes' ][ 'class' ] ), |
|
185 | 185 | ) + $aField[ 'attributes' ]; |
186 | 186 | |
187 | 187 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | /** |
209 | 209 | * Defines the field type slugs used for this field type. |
210 | 210 | */ |
211 | - public $aFieldTypeSlugs = array( 'table', ); |
|
211 | + public $aFieldTypeSlugs = array( 'table',); |
|
212 | 212 | |
213 | 213 | /** |
214 | 214 | * Defines the default key-values of this field type. |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | 'collapsible' => false, |
221 | 221 | 'escape' => false, |
222 | 222 | 'caption' => '', |
223 | - 'header' => array(), // (array) key-value pairs of the table header |
|
224 | - 'footer' => array(), // (array|string) key-value pairs of the table footer. When `USE_HEADER` is passed, the value set to the `header` argument will be applied. |
|
223 | + 'header' => array(), // (array) key-value pairs of the table header |
|
224 | + 'footer' => array(), // (array|string) key-value pairs of the table footer. When `USE_HEADER` is passed, the value set to the `header` argument will be applied. |
|
225 | 225 | |
226 | 226 | // [Not fully implemented] To fully support most use cases, a library like the tablesorter jQuery plugin is big in size. And it is more suitable for a custom field type. |
227 | 227 | // this argument just adds `sortable-column` class selector to specified column index but does nothing yet. |
228 | - 'sortable_column' => array(), // (array) linear array consisting of boolean values indicating which columns should be sortable by matching the array index with the header argument array index. |
|
228 | + 'sortable_column' => array(), // (array) linear array consisting of boolean values indicating which columns should be sortable by matching the array index with the header argument array index. |
|
229 | 229 | ); |
230 | 230 | |
231 | 231 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | return array( |
237 | 237 | array( |
238 | 238 | 'handle_id' => 'admin-page-framework-field-type-table', |
239 | - 'src' => dirname( __FILE__ ) . '/js/table.bundle.js', |
|
239 | + 'src' => dirname( __FILE__ ).'/js/table.bundle.js', |
|
240 | 240 | 'in_footer' => true, |
241 | 241 | 'dependencies' => array( 'jquery', 'jquery-ui-accordion', 'admin-page-framework-script-form-main' ), |
242 | 242 | 'translation_var' => 'AdminPageFrameworkFieldTypeTable', |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | * @return string |
270 | 270 | */ |
271 | 271 | private function ___getLabel( $aField ) { |
272 | - if ( ! strlen( $aField[ 'label' ] ) ) { |
|
272 | + if ( !strlen( $aField[ 'label' ] ) ) { |
|
273 | 273 | return ''; |
274 | 274 | } |
275 | 275 | return "<div class='admin-page-framework-input-label-container'>" |
276 | - . "<label for='" . esc_attr( $aField[ 'input_id' ] ) . "'>" |
|
277 | - . "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
276 | + . "<label for='".esc_attr( $aField[ 'input_id' ] )."'>" |
|
277 | + . "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
278 | 278 | . $aField[ 'label' ] |
279 | 279 | . "</span>" |
280 | 280 | . "</label>" |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | if ( empty( $_aCollapsible ) ) { |
300 | 300 | return $this->getTableOfArray( |
301 | 301 | $this->getAsArray( $aField[ 'data' ] ), |
302 | - $_aAttributes, // attributes |
|
303 | - $aField[ 'header' ], // header |
|
304 | - $_aFooter, // footer, |
|
302 | + $_aAttributes, // attributes |
|
303 | + $aField[ 'header' ], // header |
|
304 | + $_aFooter, // footer, |
|
305 | 305 | $aField[ 'escape' ], |
306 | 306 | $aField[ 'caption' ] |
307 | 307 | ); |
@@ -315,16 +315,16 @@ discard block |
||
315 | 315 | ? "<div class='text-content'>{$aField[ 'data' ]}</div>" // this allows to create simple FAQ |
316 | 316 | : $this->getTableOfArray( |
317 | 317 | $this->getAsArray( $aField[ 'data' ] ), |
318 | - $_aAttributes, // attributes, |
|
319 | - $aField[ 'header' ], // header |
|
320 | - $_aFooter, // footer, |
|
318 | + $_aAttributes, // attributes, |
|
319 | + $aField[ 'header' ], // header |
|
320 | + $_aFooter, // footer, |
|
321 | 321 | $aField[ 'escape' ] |
322 | - ); // omit caption |
|
322 | + ); // omit caption |
|
323 | 323 | $_aCollapsible = $this->getAsArray( $_aCollapsible ) + array( 'active' => null ); |
324 | 324 | $_aCollapsible[ 'active' ] = is_numeric( $_aCollapsible[ 'active' ] ) |
325 | 325 | ? ( integer ) $_aCollapsible[ 'active' ] // accepts numeric index values |
326 | - : ( $_aCollapsible[ 'active' ] ? 'true' : 'false' ); // passing a value as string to be parsed properly on the JS side |
|
327 | - return "<div class='accordion-container' " . $this->getDataAttributes( $_aCollapsible ) . ">" |
|
326 | + : ( $_aCollapsible[ 'active' ] ? 'true' : 'false' ); // passing a value as string to be parsed properly on the JS side |
|
327 | + return "<div class='accordion-container' ".$this->getDataAttributes( $_aCollapsible ).">" |
|
328 | 328 | . "<div class='accordion-title'><h4><span>{$_sCaption}</span></h4></div>" |
329 | 329 | . "<div class='accordion-content'>{$_sContent}</div>" |
330 | 330 | . "</div>"; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | ); |
343 | 343 | |
344 | 344 | // Add sortable header and footer classes |
345 | - foreach( $this->getAsArray( $aField[ 'sortable_column' ] ) as $_iColumnIndex => $_bSortable ) { |
|
345 | + foreach ( $this->getAsArray( $aField[ 'sortable_column' ] ) as $_iColumnIndex => $_bSortable ) { |
|
346 | 346 | if ( empty( $_bSortable ) ) { |
347 | 347 | continue; |
348 | 348 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * Defines the field type slugs used for this field type. |
104 | 104 | */ |
105 | - public $aFieldTypeSlugs = array( 'select', ); |
|
105 | + public $aFieldTypeSlugs = array( 'select',); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Defines the default key-values of this field type. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'select' => array( |
115 | 115 | 'size' => 1, |
116 | 116 | 'autofocusNew' => null, |
117 | - 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
117 | + 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
118 | 118 | 'required' => null, |
119 | 119 | ), |
120 | 120 | 'optgroup' => array(), |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | protected function getField( $aField ) { |
155 | 155 | |
156 | 156 | $_oSelectInput = new AdminPageFramework_Input_select( $aField[ 'attributes' ] ); |
157 | - if ( $aField[ 'is_multiple' ] ) { |
|
157 | + if ( $aField[ 'is_multiple' ] ) { |
|
158 | 158 | $_oSelectInput->setAttribute( array( 'select', 'multiple' ), 'multiple' ); |
159 | 159 | } |
160 | 160 | return |
161 | 161 | $aField[ 'before_label' ] |
162 | - . "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ) . ">" |
|
162 | + . "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ).">" |
|
163 | 163 | . "<label for='{$aField[ 'input_id' ]}'>" |
164 | 164 | . $aField[ 'before_input' ] |
165 | 165 | . $_oSelectInput->get( $aField[ 'label' ] ) |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | */ |
67 | 67 | protected function getField( $aField ) { |
68 | 68 | |
69 | - $_oCallerForm = $aField[ '_caller_object' ]; |
|
69 | + $_oCallerForm = $aField[ '_caller_object' ]; |
|
70 | 70 | |
71 | 71 | $_aInlineMixedOutput = array(); |
72 | - foreach( $this->getAsArray( $aField[ 'content' ] ) as $_aChildFieldset ) { |
|
72 | + foreach ( $this->getAsArray( $aField[ 'content' ] ) as $_aChildFieldset ) { |
|
73 | 73 | |
74 | 74 | if ( is_scalar( $_aChildFieldset ) ) { |
75 | 75 | continue; |
76 | 76 | } |
77 | 77 | |
78 | - if ( ! $this->isNormalPlacement( $_aChildFieldset ) ) { |
|
78 | + if ( !$this->isNormalPlacement( $_aChildFieldset ) ) { |
|
79 | 79 | continue; |
80 | 80 | } |
81 | 81 | |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
92 | 92 | $_aChildFieldset, |
93 | 93 | $_oCallerForm->aSavedData, |
94 | - $_oCallerForm->getFieldErrors(), // @todo Generate field errors. $this->aErrors, |
|
94 | + $_oCallerForm->getFieldErrors(), // @todo Generate field errors. $this->aErrors, |
|
95 | 95 | $_oCallerForm->aFieldTypeDefinitions, |
96 | 96 | $_oCallerForm->oMsg, |
97 | 97 | $_oCallerForm->aCallbacks // field output element callables. |
98 | 98 | ); |
99 | - $_aInlineMixedOutput[] = $_oFieldset->get(); // field output |
|
99 | + $_aInlineMixedOutput[ ] = $_oFieldset->get(); // field output |
|
100 | 100 | |
101 | 101 | |
102 | 102 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return array( |
65 | 65 | array( |
66 | 66 | 'handle_id' => 'admin-page-framework-field-type-radio', |
67 | - 'src' => dirname( __FILE__ ) . '/js/radio.bundle.js', |
|
67 | + 'src' => dirname( __FILE__ ).'/js/radio.bundle.js', |
|
68 | 68 | 'in_footer' => true, |
69 | 69 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
70 | 70 | 'translation_var' => 'AdminPageFrameworkFieldTypeRadio', |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @return string |
87 | 87 | */ |
88 | 88 | protected function getField( $aField ) { |
89 | - $_aOutput = array(); |
|
90 | - foreach( $this->getAsArray( $aField[ 'label' ] ) as $_sKey => $_sLabel ) { |
|
91 | - $_aOutput[] = $this->___getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
|
89 | + $_aOutput = array(); |
|
90 | + foreach ( $this->getAsArray( $aField[ 'label' ] ) as $_sKey => $_sLabel ) { |
|
91 | + $_aOutput[ ] = $this->___getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
|
92 | 92 | } |
93 | 93 | return implode( PHP_EOL, $_aOutput ); |
94 | 94 | } |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | |
109 | 109 | // Output |
110 | 110 | return $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ) |
111 | - . "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-radio-label' ) . ">" |
|
112 | - . "<label " . $this->getAttributes( |
|
111 | + . "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-radio-label' ).">" |
|
112 | + . "<label ".$this->getAttributes( |
|
113 | 113 | array( |
114 | 114 | 'for' => $_oRadio->getAttribute( 'id' ), |
115 | 115 | 'class' => $_oRadio->getAttribute( 'disabled' ) |