@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * Defines the default key-values of this field type. |
28 | 28 | */ |
29 | 29 | protected $aDefaultKeys = array( |
30 | - 'select_all_button' => false, // 3.3.0+ to change the label, set the label here |
|
31 | - 'select_none_button' => false, // 3.3.0+ to change the label, set the label here |
|
30 | + 'select_all_button' => false, // 3.3.0+ to change the label, set the label here |
|
31 | + 'select_none_button' => false, // 3.3.0+ to change the label, set the label here |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function getScripts() { |
41 | 41 | new AdminPageFramework_Form_View___Script_CheckboxSelector; |
42 | - $_sClassSelectorSelectAll = $this->_getSelectButtonClassSelectors( |
|
42 | + $_sClassSelectorSelectAll = $this->_getSelectButtonClassSelectors( |
|
43 | 43 | $this->aFieldTypeSlugs, |
44 | 44 | 'select_all_button' // data attribute |
45 | 45 | ); |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @since 3.5.12 |
66 | 66 | * @return string |
67 | 67 | */ |
68 | - private function _getSelectButtonClassSelectors( array $aFieldTypeSlugs, $sDataAttribute='select_all_button' ) { |
|
68 | + private function _getSelectButtonClassSelectors( array $aFieldTypeSlugs, $sDataAttribute = 'select_all_button' ) { |
|
69 | 69 | |
70 | 70 | $_aClassSelectors = array(); |
71 | 71 | foreach ( $aFieldTypeSlugs as $_sSlug ) { |
72 | - if ( ! is_scalar( $_sSlug ) ) { |
|
72 | + if ( !is_scalar( $_sSlug ) ) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | - $_aClassSelectors[] = '.admin-page-framework-checkbox-container-' . $_sSlug . "[data-{$sDataAttribute}]"; |
|
75 | + $_aClassSelectors[ ] = '.admin-page-framework-checkbox-container-'.$_sSlug."[data-{$sDataAttribute}]"; |
|
76 | 76 | } |
77 | 77 | return implode( ',', $_aClassSelectors ); |
78 | 78 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | |
129 | 129 | $_aOutput = array(); |
130 | 130 | $_bIsMultiple = is_array( $aField[ 'label' ] ); |
131 | - foreach( $this->getAsArray( $aField[ 'label' ], true ) as $_sKey => $_sLabel ) { |
|
132 | - $_aOutput[] = $this->_getEachCheckboxOutput( |
|
131 | + foreach ( $this->getAsArray( $aField[ 'label' ], true ) as $_sKey => $_sLabel ) { |
|
132 | + $_aOutput[ ] = $this->_getEachCheckboxOutput( |
|
133 | 133 | $aField, |
134 | 134 | $_bIsMultiple |
135 | 135 | ? $_sKey |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $_sLabel |
138 | 138 | ); |
139 | 139 | } |
140 | - return "<div " . $this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ) . ">" |
|
140 | + return "<div ".$this->getAttributes( $this->_getCheckboxContainerAttributes( $aField ) ).">" |
|
141 | 141 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
142 | 142 | . implode( PHP_EOL, $_aOutput ) |
143 | 143 | . "</div>"; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function _getCheckboxContainerAttributes( array $aField ) { |
154 | 154 | return array( |
155 | - 'class' => 'admin-page-framework-checkbox-container-' . $aField[ 'type' ], |
|
155 | + 'class' => 'admin-page-framework-checkbox-container-'.$aField[ 'type' ], |
|
156 | 156 | 'data-select_all_button' => $aField[ 'select_all_button' ] |
157 | - ? ( ! is_string( $aField[ 'select_all_button' ] ) ? $this->oMsg->get( 'select_all' ) : $aField[ 'select_all_button' ] ) |
|
157 | + ? ( !is_string( $aField[ 'select_all_button' ] ) ? $this->oMsg->get( 'select_all' ) : $aField[ 'select_all_button' ] ) |
|
158 | 158 | : null, |
159 | 159 | 'data-select_none_button' => $aField[ 'select_none_button' ] |
160 | - ? ( ! is_string( $aField[ 'select_none_button' ] ) ? $this->oMsg->get( 'select_none' ) : $aField[ 'select_none_button' ] ) |
|
160 | + ? ( !is_string( $aField[ 'select_none_button' ] ) ? $this->oMsg->get( 'select_none' ) : $aField[ 'select_none_button' ] ) |
|
161 | 161 | : null, |
162 | 162 | ); |
163 | 163 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | $_oCheckbox->setAttributesByKey( $sKey ); |
175 | 175 | $_oCheckbox->addClass( $this->_sCheckboxClassSelector ); |
176 | 176 | return $this->getElement( $aField, array( 'before_label', $sKey ) ) |
177 | - . "<div class='admin-page-framework-input-label-container admin-page-framework-checkbox-label' style='min-width: " . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>" |
|
178 | - . "<label " . $this->getAttributes( |
|
177 | + . "<div class='admin-page-framework-input-label-container admin-page-framework-checkbox-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
178 | + . "<label ".$this->getAttributes( |
|
179 | 179 | array( |
180 | 180 | 'for' => $_oCheckbox->getAttribute( 'id' ), |
181 | 181 | 'class' => $_oCheckbox->getAttribute( 'disabled' ) |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | protected function setUp() { |
47 | 47 | |
48 | 48 | // If the WordPress version is greater than or equal to 3.5, then load the new WordPress color picker. |
49 | - if ( version_compare( $GLOBALS['wp_version'], '3.5', '>=' ) ) { |
|
49 | + if ( version_compare( $GLOBALS[ 'wp_version' ], '3.5', '>=' ) ) { |
|
50 | 50 | //Both the necessary css and javascript have been registered already by WordPress, so all we have to do is load them with their handle. |
51 | 51 | wp_enqueue_style( 'wp-color-picker' ); |
52 | 52 | wp_enqueue_script( 'wp-color-picker' ); |
@@ -209,29 +209,29 @@ discard block |
||
209 | 209 | protected function getField( $aField ) { |
210 | 210 | |
211 | 211 | // If the value is not set, apply the default value, 'transparent'. |
212 | - $aField['value'] = is_null( $aField['value'] ) |
|
212 | + $aField[ 'value' ] = is_null( $aField[ 'value' ] ) |
|
213 | 213 | ? 'transparent' |
214 | - : $aField['value']; |
|
214 | + : $aField[ 'value' ]; |
|
215 | 215 | |
216 | 216 | $aField[ 'attributes' ] = $this->_getInputAttributes( $aField ); |
217 | 217 | |
218 | 218 | return |
219 | - $aField['before_label'] |
|
219 | + $aField[ 'before_label' ] |
|
220 | 220 | . "<div class='admin-page-framework-input-label-container'>" |
221 | - . "<label for='{$aField['input_id']}'>" |
|
221 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
222 | 222 | . $aField[ 'before_input' ] |
223 | - . ( $aField['label'] && ! $aField['repeatable'] |
|
224 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>" |
|
223 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
224 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>" |
|
225 | 225 | : "" |
226 | 226 | ) |
227 | - . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
|
227 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
228 | 228 | . $aField[ 'after_input' ] |
229 | 229 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
230 | 230 | . "</label>" |
231 | - . "<div class='colorpicker' id='color_{$aField['input_id']}'></div>" // this div element with this class selector becomes a farbtastic color picker. ( below 3.4.x ) // rel='{$aField['input_id']}' |
|
232 | - . $this->_getColorPickerEnablerScript( "{$aField['input_id']}" ) |
|
231 | + . "<div class='colorpicker' id='color_{$aField[ 'input_id' ]}'></div>" // this div element with this class selector becomes a farbtastic color picker. ( below 3.4.x ) // rel='{$aField['input_id']}' |
|
232 | + . $this->_getColorPickerEnablerScript( "{$aField[ 'input_id' ]}" ) |
|
233 | 233 | . "</div>" |
234 | - . $aField['after_label']; |
|
234 | + . $aField[ 'after_label' ]; |
|
235 | 235 | |
236 | 236 | } |
237 | 237 | /** |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | private function _getInputAttributes( array $aField ) { |
243 | 243 | |
244 | 244 | return array( |
245 | - 'color' => $aField['value'], |
|
246 | - 'value' => $aField['value'], |
|
245 | + 'color' => $aField[ 'value' ], |
|
246 | + 'value' => $aField[ 'value' ], |
|
247 | 247 | 'data-default' => isset( $aField[ 'default' ] ) |
248 | 248 | ? $aField[ 'default' ] |
249 | 249 | : 'transparent', // used by the repeatable script |
250 | 250 | 'type' => 'text', // it must be text |
251 | - 'class' => trim( 'input_color ' . $aField['attributes']['class'] ), |
|
251 | + 'class' => trim( 'input_color '.$aField[ 'attributes' ][ 'class' ] ), |
|
252 | 252 | ) + $aField[ 'attributes' ]; |
253 | 253 | |
254 | 254 | } |
@@ -37,19 +37,19 @@ |
||
37 | 37 | */ |
38 | 38 | public function _replyToGetField( $aField ) { |
39 | 39 | return |
40 | - $aField['before_label'] |
|
40 | + $aField[ 'before_label' ] |
|
41 | 41 | . "<div class='admin-page-framework-input-label-container'>" |
42 | - . "<label for='{$aField['input_id']}'>" |
|
43 | - . $aField['before_input'] |
|
44 | - . ( $aField['label'] && ! $aField['repeatable'] |
|
45 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>" |
|
42 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
43 | + . $aField[ 'before_input' ] |
|
44 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
45 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>" |
|
46 | 46 | : "" |
47 | 47 | ) |
48 | - . $aField['value'] |
|
49 | - . $aField['after_input'] |
|
48 | + . $aField[ 'value' ] |
|
49 | + . $aField[ 'after_input' ] |
|
50 | 50 | . "</label>" |
51 | 51 | . "</div>" |
52 | - . $aField['after_label'] |
|
52 | + . $aField[ 'after_label' ] |
|
53 | 53 | ; |
54 | 54 | } |
55 | 55 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Defines the field type slugs used for this field type. |
22 | 22 | */ |
23 | - public $aFieldTypeSlugs = array( 'export', ); |
|
23 | + public $aFieldTypeSlugs = array( 'export',); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines the default key-values of this field type. |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
29 | 29 | */ |
30 | 30 | protected $aDefaultKeys = array( |
31 | - 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
32 | - 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
33 | - 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
31 | + 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
32 | + 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
33 | + 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
34 | 34 | 'attributes' => array( |
35 | 35 | 'class' => 'button button-primary', |
36 | 36 | ), |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | protected function getField( $aField ) { |
72 | 72 | |
73 | 73 | /* Set the transient data to export - If the value is not an array and the export data is set. */ |
74 | - if ( isset( $aField['data'] ) ) { |
|
75 | - $this->setTransient( md5( "{$aField['class_name']}_{$aField['input_id']}" ), $aField['data'], 60*2 ); // 2 minutes. |
|
74 | + if ( isset( $aField[ 'data' ] ) ) { |
|
75 | + $this->setTransient( md5( "{$aField[ 'class_name' ]}_{$aField[ 'input_id' ]}" ), $aField[ 'data' ], 60 * 2 ); // 2 minutes. |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /* Set some required values */ |
79 | - $aField['attributes']['name'] = "__export[submit][{$aField['input_id']}]"; |
|
80 | - $aField['file_name'] = $aField['file_name'] ? $aField['file_name'] : $this->_generateExportFileName( $aField['option_key'] ? $aField['option_key'] : $aField['class_name'], $aField['format'] ); |
|
81 | - $aField['label'] = $aField['label'] ? $aField['label'] : $this->oMsg->get( 'export' ); |
|
79 | + $aField[ 'attributes' ][ 'name' ] = "__export[submit][{$aField[ 'input_id' ]}]"; |
|
80 | + $aField[ 'file_name' ] = $aField[ 'file_name' ] ? $aField[ 'file_name' ] : $this->_generateExportFileName( $aField[ 'option_key' ] ? $aField[ 'option_key' ] : $aField[ 'class_name' ], $aField[ 'format' ] ); |
|
81 | + $aField[ 'label' ] = $aField[ 'label' ] ? $aField[ 'label' ] : $this->oMsg->get( 'export' ); |
|
82 | 82 | |
83 | 83 | return parent::getField( $aField ); |
84 | 84 | |
@@ -93,42 +93,42 @@ discard block |
||
93 | 93 | |
94 | 94 | $_aAttributes = array( 'type' => 'hidden' ); |
95 | 95 | return |
96 | - "<input " . $this->getAttributes( |
|
96 | + "<input ".$this->getAttributes( |
|
97 | 97 | array( |
98 | - 'name' => "__export[{$aField['input_id']}][input_id]", |
|
99 | - 'value' => $aField['input_id'], |
|
98 | + 'name' => "__export[{$aField[ 'input_id' ]}][input_id]", |
|
99 | + 'value' => $aField[ 'input_id' ], |
|
100 | 100 | ) + $_aAttributes |
101 | - ) . "/>" |
|
102 | - . "<input " . $this->getAttributes( |
|
101 | + )."/>" |
|
102 | + . "<input ".$this->getAttributes( |
|
103 | 103 | array( |
104 | - 'name' => "__export[{$aField['input_id']}][field_id]", |
|
105 | - 'value' => $aField['field_id'], |
|
104 | + 'name' => "__export[{$aField[ 'input_id' ]}][field_id]", |
|
105 | + 'value' => $aField[ 'field_id' ], |
|
106 | 106 | ) + $_aAttributes |
107 | - ) . "/>" |
|
108 | - . "<input " . $this->getAttributes( |
|
107 | + )."/>" |
|
108 | + . "<input ".$this->getAttributes( |
|
109 | 109 | array( |
110 | - 'name' => "__export[{$aField['input_id']}][section_id]", |
|
111 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
110 | + 'name' => "__export[{$aField[ 'input_id' ]}][section_id]", |
|
111 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
112 | 112 | ) + $_aAttributes |
113 | - ) . "/>" |
|
114 | - . "<input " . $this->getAttributes( |
|
113 | + )."/>" |
|
114 | + . "<input ".$this->getAttributes( |
|
115 | 115 | array( |
116 | - 'name' => "__export[{$aField['input_id']}][file_name]", |
|
117 | - 'value' => $aField['file_name'], |
|
116 | + 'name' => "__export[{$aField[ 'input_id' ]}][file_name]", |
|
117 | + 'value' => $aField[ 'file_name' ], |
|
118 | 118 | ) + $_aAttributes |
119 | - ) . "/>" |
|
120 | - . "<input " . $this->getAttributes( |
|
119 | + )."/>" |
|
120 | + . "<input ".$this->getAttributes( |
|
121 | 121 | array( |
122 | - 'name' => "__export[{$aField['input_id']}][format]", |
|
123 | - 'value' => $aField['format'], |
|
122 | + 'name' => "__export[{$aField[ 'input_id' ]}][format]", |
|
123 | + 'value' => $aField[ 'format' ], |
|
124 | 124 | ) + $_aAttributes |
125 | - ) . "/>" |
|
126 | - . "<input " . $this->getAttributes( |
|
125 | + )."/>" |
|
126 | + . "<input ".$this->getAttributes( |
|
127 | 127 | array( |
128 | - 'name' => "__export[{$aField['input_id']}][transient]", |
|
129 | - 'value' => isset( $aField['data'] ), |
|
128 | + 'name' => "__export[{$aField[ 'input_id' ]}][transient]", |
|
129 | + 'value' => isset( $aField[ 'data' ] ), |
|
130 | 130 | ) + $_aAttributes |
131 | - ) . "/>" |
|
131 | + )."/>" |
|
132 | 132 | ; |
133 | 133 | } |
134 | 134 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @since 2.0.0 |
142 | 142 | * @since 2.1.5 Moved from the AdminPageFramework_FormField class. |
143 | 143 | */ |
144 | - private function _generateExportFileName( $sOptionKey, $sExportFormat='json' ) { |
|
144 | + private function _generateExportFileName( $sOptionKey, $sExportFormat = 'json' ) { |
|
145 | 145 | |
146 | 146 | switch ( trim( strtolower( $sExportFormat ) ) ) { |
147 | 147 | case 'text': // for plain text. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | break; |
157 | 157 | } |
158 | 158 | |
159 | - return $sOptionKey . '_' . date("Ymd") . '.' . $sExt; |
|
159 | + return $sOptionKey.'_'.date( "Ymd" ).'.'.$sExt; |
|
160 | 160 | |
161 | 161 | } |
162 | 162 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Defines the field type slugs used for this field type. |
22 | 22 | */ |
23 | - public $aFieldTypeSlugs = array( 'file', ); |
|
23 | + public $aFieldTypeSlugs = array( 'file',); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines the default key-values of this field type. |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | array( |
77 | 77 | 'type' => 'hidden', |
78 | 78 | 'value' => '', |
79 | - 'name' => $aField[ 'attributes' ][ 'name' ] . '[_dummy_value]', |
|
79 | + 'name' => $aField[ 'attributes' ][ 'name' ].'[_dummy_value]', |
|
80 | 80 | ) |
81 | 81 | ) |
82 | 82 | . $this->getHTMLTag( |
83 | 83 | 'input', |
84 | 84 | array( |
85 | 85 | 'type' => 'hidden', |
86 | - 'name' => '__unset_' . $aField[ '_structure_type' ] . '[' . $aField[ '_input_name_flat' ] . '|_dummy_value' . ']', |
|
87 | - 'value' => $aField[ '_input_name_flat' ] . '|_dummy_value', |
|
86 | + 'name' => '__unset_'.$aField[ '_structure_type' ].'['.$aField[ '_input_name_flat' ].'|_dummy_value'.']', |
|
87 | + 'value' => $aField[ '_input_name_flat' ].'|_dummy_value', |
|
88 | 88 | 'class' => 'unset-element-names element-address', |
89 | 89 | ) |
90 | 90 | ); |
@@ -41,19 +41,19 @@ |
||
41 | 41 | protected function getField( $aField ) { |
42 | 42 | |
43 | 43 | return |
44 | - $aField['before_label'] |
|
44 | + $aField[ 'before_label' ] |
|
45 | 45 | . "<div class='admin-page-framework-input-label-container'>" |
46 | - . "<label for='{$aField['input_id']}'>" |
|
47 | - . $aField['before_input'] |
|
48 | - . ( $aField['label'] |
|
49 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>" |
|
46 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
47 | + . $aField[ 'before_input' ] |
|
48 | + . ( $aField[ 'label' ] |
|
49 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>" |
|
50 | 50 | : "" |
51 | 51 | ) |
52 | - . "<input " . $this->getAttributes( $aField['attributes'] ) . " />" |
|
53 | - . $aField['after_input'] |
|
52 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
53 | + . $aField[ 'after_input' ] |
|
54 | 54 | . "</label>" |
55 | 55 | . "</div>" |
56 | - . $aField['after_label']; |
|
56 | + . $aField[ 'after_label' ]; |
|
57 | 57 | |
58 | 58 | } |
59 | 59 |
@@ -625,7 +625,7 @@ |
||
625 | 625 | return $_aBaseAttributes; |
626 | 626 | |
627 | 627 | } |
628 | - /** |
|
628 | + /** |
|
629 | 629 | * Returns the set image url. |
630 | 630 | * |
631 | 631 | * When the 'attributes_to_store' argument is present, there will be sub elements to the field value. |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Defines the field type slugs used for this field type. |
24 | 24 | */ |
25 | - public $aFieldTypeSlugs = array( 'image', ); |
|
25 | + public $aFieldTypeSlugs = array( 'image',); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Defines the default key-values of this field type. |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected $aDefaultKeys = array( |
33 | 33 | 'attributes_to_store' => array(), // ( array ) This is for the image and media field type. The attributes to save besides URL. e.g. ( for the image field type ) array( 'title', 'alt', 'width', 'height', 'caption', 'id', 'align', 'link' ). |
34 | - 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
35 | - 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
34 | + 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
35 | + 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
36 | 36 | 'attributes' => array( |
37 | 37 | 'input' => array( |
38 | 38 | 'size' => 40, |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return // $this->_getScript_CustomMediaUploaderObject() . PHP_EOL |
61 | 61 | $this->_getScript_ImageSelector( |
62 | 62 | "admin_page_framework" |
63 | - ) . PHP_EOL |
|
63 | + ).PHP_EOL |
|
64 | 64 | . $this->_getScript_RegisterCallbacks(); |
65 | 65 | } |
66 | 66 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
184 | 184 | |
185 | 185 | // if the WordPress version is 3.4.x or below |
186 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
186 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
187 | 187 | |
188 | 188 | return <<<JAVASCRIPTS |
189 | 189 | /** |
@@ -569,11 +569,11 @@ discard block |
||
569 | 569 | . "<label for='{$aField[ 'input_id' ]}'>" |
570 | 570 | . $aField[ 'before_input' ] |
571 | 571 | . $this->getAOrB( |
572 | - $aField[ 'label' ] && ! $aField[ 'repeatable' ], |
|
573 | - "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>" . $aField[ 'label' ] . "</span>", |
|
572 | + $aField[ 'label' ] && !$aField[ 'repeatable' ], |
|
573 | + "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>", |
|
574 | 574 | '' |
575 | 575 | ) |
576 | - . "<input " . $this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) ) . " />" |
|
576 | + . "<input ".$this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) )." />" |
|
577 | 577 | . $aField[ 'after_input' ] |
578 | 578 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
579 | 579 | . $this->getExtraInputFields( $aField ) |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | */ |
613 | 613 | private function _getBaseAttributes( array $aField ) { |
614 | 614 | |
615 | - $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
615 | + $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
616 | 616 | unset( |
617 | 617 | $_aBaseAttributes[ 'input' ], |
618 | 618 | $_aBaseAttributes[ 'button' ], |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | protected function getExtraInputFields( array $aField ) { |
679 | 679 | |
680 | 680 | $_aOutputs = array(); |
681 | - foreach( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
682 | - $_aOutputs[] = "<input " . $this->getAttributes( |
|
681 | + foreach ( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
682 | + $_aOutputs[ ] = "<input ".$this->getAttributes( |
|
683 | 683 | array( |
684 | 684 | 'id' => "{$aField[ 'input_id' ]}_{$sAttribute}", |
685 | 685 | 'type' => 'hidden', |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | '' |
696 | 696 | ), |
697 | 697 | ) |
698 | - ) . "/>"; |
|
698 | + )."/>"; |
|
699 | 699 | } |
700 | 700 | return implode( PHP_EOL, $_aOutputs ); |
701 | 701 | |
@@ -707,15 +707,15 @@ discard block |
||
707 | 707 | */ |
708 | 708 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
709 | 709 | |
710 | - if ( ! $aField[ 'show_preview' ] ) { return ''; } |
|
710 | + if ( !$aField[ 'show_preview' ] ) { return ''; } |
|
711 | 711 | |
712 | 712 | $sImageURL = $this->getResolvedSRC( $sImageURL, true ); |
713 | 713 | return |
714 | - "<div " . $this->getAttributes( |
|
714 | + "<div ".$this->getAttributes( |
|
715 | 715 | array( |
716 | 716 | 'id' => "image_preview_container_{$aField[ 'input_id' ]}", |
717 | - 'class' => 'image_preview ' . $this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
718 | - 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
717 | + 'class' => 'image_preview '.$this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
718 | + 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
719 | 719 | . $this->getElement( $aPreviewAtrributes, 'style', '' ), |
720 | 720 | ) + $aPreviewAtrributes |
721 | 721 | ) |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
741 | 741 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
742 | 742 | // which causes the PHP syntax error. |
743 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $bRpeatable, $bExternalSource ) . '"'; |
|
743 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $bRpeatable, $bExternalSource ).'"'; |
|
744 | 744 | $_sScript = <<<JAVASCRIPTS |
745 | 745 | if ( 0 === jQuery( 'a#select_image_{$sInputID}' ).length ) { |
746 | 746 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | |
753 | 753 | return "<script type='text/javascript' class='admin-page-framework-image-uploader-button'>" |
754 | 754 | . $_sScript |
755 | - . "</script>". PHP_EOL; |
|
755 | + . "</script>".PHP_EOL; |
|
756 | 756 | |
757 | 757 | } |
758 | 758 | /** |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | $bRpeatable, |
771 | 771 | $bExternalSource |
772 | 772 | ); |
773 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
773 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
774 | 774 | . ( $_bIsLabelSet |
775 | 775 | ? $_aAttributes[ 'data-label' ] |
776 | 776 | : ( strrpos( $_aAttributes[ 'class' ], 'dashicons' ) |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | private function _getFormattedUploadButtonAttributes( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bRpeatable, $bExternalSource ) { |
790 | 790 | |
791 | - $_aAttributes = array( |
|
791 | + $_aAttributes = array( |
|
792 | 792 | 'id' => "select_image_{$sInputID}", |
793 | 793 | 'href' => '#', |
794 | 794 | 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | : $this->oMsg->get( 'select_image' ), |
802 | 802 | 'data-label' => null, |
803 | 803 | ); |
804 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
804 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
805 | 805 | 'select_image button button-small ', |
806 | 806 | $this->getAOrB( |
807 | 807 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -828,16 +828,16 @@ discard block |
||
828 | 828 | * @since 3.5.3 Aded the `$sType` parameter. |
829 | 829 | * @return string |
830 | 830 | */ |
831 | - protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
831 | + protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
832 | 832 | |
833 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
833 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
834 | 834 | return ''; |
835 | 835 | } |
836 | 836 | |
837 | 837 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
838 | 838 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
839 | 839 | // which causes the PHP syntax error. |
840 | - $_sButtonHTML = '"' . $this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ) . '"'; |
|
840 | + $_sButtonHTML = '"'.$this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ).'"'; |
|
841 | 841 | $_sScript = <<<JAVASCRIPTS |
842 | 842 | if ( 0 === jQuery( 'a#remove_{$sType}_{$sInputID}' ).length ) { |
843 | 843 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | |
847 | 847 | return "<script type='text/javascript' class='admin-page-framework-{$sType}-remove-button'>" |
848 | 848 | . $_sScript |
849 | - . "</script>". PHP_EOL; |
|
849 | + . "</script>".PHP_EOL; |
|
850 | 850 | |
851 | 851 | } |
852 | 852 | |
@@ -855,11 +855,11 @@ discard block |
||
855 | 855 | * @since 3.5.3 |
856 | 856 | * @return string The generated HTML remove button output. |
857 | 857 | */ |
858 | - protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
858 | + protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
859 | 859 | |
860 | 860 | $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
861 | 861 | $_aAttributes = $this->_getFormattedRemoveButtonAttributesByType( $sInputID, $aButtonAttributes, $_bIsLabelSet, $sType ); |
862 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
862 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
863 | 863 | . ( $_bIsLabelSet |
864 | 864 | ? $_aAttributes[ 'data-label' ] |
865 | 865 | : $this->getAOrB( |
@@ -877,9 +877,9 @@ discard block |
||
877 | 877 | * @since 3.5.3 |
878 | 878 | * @return array The formatted remove button attributes array. |
879 | 879 | */ |
880 | - protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType='image' ) { |
|
880 | + protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType = 'image' ) { |
|
881 | 881 | |
882 | - $_sOnClickFunctionName = 'removeInputValuesFor' . ucfirst( $sType ); |
|
882 | + $_sOnClickFunctionName = 'removeInputValuesFor'.ucfirst( $sType ); |
|
883 | 883 | $_aAttributes = array( |
884 | 884 | 'id' => "remove_{$sType}_{$sInputID}", |
885 | 885 | 'href' => '#', |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | ? $aButtonAttributes[ 'data-label' ] |
892 | 892 | : $this->oMsg->get( 'remove_value' ), |
893 | 893 | ); |
894 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
894 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
895 | 895 | "remove_value remove_{$sType} button button-small", |
896 | 896 | $this->getAOrB( |
897 | 897 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -478,7 +478,7 @@ |
||
478 | 478 | /** |
479 | 479 | * Returns the field type specific CSS rules. |
480 | 480 | */ |
481 | - protected function getStyles() { |
|
481 | + protected function getStyles() { |
|
482 | 482 | return <<<CSSRULES |
483 | 483 | /* Image Field Preview Container */ |
484 | 484 | .admin-page-framework-field .image_preview { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Defines the field type slugs used for this field type. |
22 | 22 | */ |
23 | - public $aFieldTypeSlugs = array( 'import', ); |
|
23 | + public $aFieldTypeSlugs = array( 'import',); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines the default key-values of this field type. |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | protected function getField( $aField ) { |
92 | 92 | |
93 | 93 | /* Set some required values */ |
94 | - $aField['attributes']['name'] = "__import[submit][{$aField['input_id']}]"; |
|
95 | - $aField['label'] = $aField['label'] |
|
96 | - ? $aField['label'] |
|
94 | + $aField[ 'attributes' ][ 'name' ] = "__import[submit][{$aField[ 'input_id' ]}]"; |
|
95 | + $aField[ 'label' ] = $aField[ 'label' ] |
|
96 | + ? $aField[ 'label' ] |
|
97 | 97 | : $this->oMsg->get( 'import' ); |
98 | 98 | return parent::getField( $aField ); |
99 | 99 | } |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @since 3.0.0 |
107 | 107 | */ |
108 | 108 | protected function _getExtraFieldsBeforeLabel( &$aField ) { |
109 | - return "<input " . $this->getAttributes( |
|
109 | + return "<input ".$this->getAttributes( |
|
110 | 110 | array( |
111 | - 'id' => "{$aField['input_id']}_file", |
|
111 | + 'id' => "{$aField[ 'input_id' ]}_file", |
|
112 | 112 | 'type' => 'file', |
113 | - 'name' => "__import[{$aField['input_id']}]", |
|
114 | - ) + $aField['attributes']['file'] |
|
115 | - ) . " />"; |
|
113 | + 'name' => "__import[{$aField[ 'input_id' ]}]", |
|
114 | + ) + $aField[ 'attributes' ][ 'file' ] |
|
115 | + )." />"; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -121,44 +121,44 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function _getExtraInputFields( &$aField ) { |
123 | 123 | |
124 | - $aHiddenAttributes = array( 'type' => 'hidden', ); |
|
124 | + $aHiddenAttributes = array( 'type' => 'hidden',); |
|
125 | 125 | return |
126 | - "<input " . $this->getAttributes( |
|
126 | + "<input ".$this->getAttributes( |
|
127 | 127 | array( |
128 | - 'name' => "__import[{$aField['input_id']}][input_id]", |
|
129 | - 'value' => $aField['input_id'], |
|
128 | + 'name' => "__import[{$aField[ 'input_id' ]}][input_id]", |
|
129 | + 'value' => $aField[ 'input_id' ], |
|
130 | 130 | ) + $aHiddenAttributes |
131 | - ) . "/>" |
|
132 | - . "<input " . $this->getAttributes( |
|
131 | + )."/>" |
|
132 | + . "<input ".$this->getAttributes( |
|
133 | 133 | array( |
134 | - 'name' => "__import[{$aField['input_id']}][field_id]", |
|
135 | - 'value' => $aField['field_id'], |
|
134 | + 'name' => "__import[{$aField[ 'input_id' ]}][field_id]", |
|
135 | + 'value' => $aField[ 'field_id' ], |
|
136 | 136 | ) + $aHiddenAttributes |
137 | - ) . "/>" |
|
138 | - . "<input " . $this->getAttributes( |
|
137 | + )."/>" |
|
138 | + . "<input ".$this->getAttributes( |
|
139 | 139 | array( |
140 | - 'name' => "__import[{$aField['input_id']}][section_id]", |
|
141 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
140 | + 'name' => "__import[{$aField[ 'input_id' ]}][section_id]", |
|
141 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
142 | 142 | ) + $aHiddenAttributes |
143 | - ) . "/>" |
|
144 | - . "<input " . $this->getAttributes( |
|
143 | + )."/>" |
|
144 | + . "<input ".$this->getAttributes( |
|
145 | 145 | array( |
146 | - 'name' => "__import[{$aField['input_id']}][is_merge]", |
|
147 | - 'value' => $aField['is_merge'], |
|
146 | + 'name' => "__import[{$aField[ 'input_id' ]}][is_merge]", |
|
147 | + 'value' => $aField[ 'is_merge' ], |
|
148 | 148 | ) + $aHiddenAttributes |
149 | - ) . "/>" |
|
150 | - . "<input " . $this->getAttributes( |
|
149 | + )."/>" |
|
150 | + . "<input ".$this->getAttributes( |
|
151 | 151 | array( |
152 | - 'name' => "__import[{$aField['input_id']}][option_key]", |
|
153 | - 'value' => $aField['option_key'], |
|
152 | + 'name' => "__import[{$aField[ 'input_id' ]}][option_key]", |
|
153 | + 'value' => $aField[ 'option_key' ], |
|
154 | 154 | ) + $aHiddenAttributes |
155 | - ) . "/>" |
|
156 | - . "<input " . $this->getAttributes( |
|
155 | + )."/>" |
|
156 | + . "<input ".$this->getAttributes( |
|
157 | 157 | array( |
158 | - 'name' => "__import[{$aField['input_id']}][format]", |
|
159 | - 'value' => $aField['format'], |
|
158 | + 'name' => "__import[{$aField[ 'input_id' ]}][format]", |
|
159 | + 'value' => $aField[ 'format' ], |
|
160 | 160 | ) + $aHiddenAttributes |
161 | - ) . "/>" |
|
161 | + )."/>" |
|
162 | 162 | ; |
163 | 163 | } |
164 | 164 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * @since 2.1.5 |
70 | 70 | * @since 3.3.1 Changed from `_replyToGetStyles()`. |
71 | 71 | */ |
72 | - protected function getStyles() { |
|
72 | + protected function getStyles() { |
|
73 | 73 | return <<<CSSRULES |
74 | 74 | /* Import Field */ |
75 | 75 | .admin-page-framework-field-import input { |
@@ -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( 'media', ); |
|
24 | + public $aFieldTypeSlugs = array( 'media',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return |
54 | 54 | $this->_getScript_MediaUploader( |
55 | 55 | "admin_page_framework" |
56 | - ) . PHP_EOL |
|
56 | + ).PHP_EOL |
|
57 | 57 | . $this->_getScript_RegisterCallbacks(); |
58 | 58 | } |
59 | 59 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
149 | 149 | |
150 | 150 | // If the WordPress version is 3.4.x or below |
151 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
151 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
152 | 152 | return <<<JAVASCRIPTS |
153 | 153 | /** |
154 | 154 | * Bind/rebinds the thickbox script the given selector element. |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
389 | 389 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
390 | 390 | // which causes the PHP syntax error. |
391 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ) . '"'; |
|
392 | - $_sScript = <<<JAVASCRIPTS |
|
391 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ).'"'; |
|
392 | + $_sScript = <<<JAVASCRIPTS |
|
393 | 393 | if ( jQuery( 'a#select_media_{$sInputID}' ).length == 0 ) { |
394 | 394 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
395 | 395 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | |
401 | 401 | return "<script type='text/javascript' class='admin-page-framework-media-uploader-button'>" |
402 | 402 | . $_sScript |
403 | - . "</script>". PHP_EOL; |
|
403 | + . "</script>".PHP_EOL; |
|
404 | 404 | |
405 | 405 | } |
406 | 406 | /** |
@@ -410,19 +410,19 @@ discard block |
||
410 | 410 | */ |
411 | 411 | private function _getUploaderButtonHTML_Media( $sInputID, array $aButtonAttributes, $bExternalSource ) { |
412 | 412 | |
413 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
413 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
414 | 414 | $_aAttributes = $this->_getFormattedUploadButtonAttributes_Media( |
415 | 415 | $sInputID, |
416 | 416 | $aButtonAttributes, |
417 | 417 | $_bIsLabelSet, |
418 | 418 | $bExternalSource |
419 | 419 | ); |
420 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
420 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
421 | 421 | . $this->getAOrB( |
422 | 422 | $_bIsLabelSet, |
423 | - $_aAttributes['data-label'], |
|
423 | + $_aAttributes[ 'data-label' ], |
|
424 | 424 | $this->getAOrB( |
425 | - strrpos( $_aAttributes['class'], 'dashicons' ), |
|
425 | + strrpos( $_aAttributes[ 'class' ], 'dashicons' ), |
|
426 | 426 | '', |
427 | 427 | $this->oMsg->get( 'select_file' ) |
428 | 428 | ) |
@@ -437,26 +437,26 @@ discard block |
||
437 | 437 | */ |
438 | 438 | private function _getFormattedUploadButtonAttributes_Media( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bExternalSource ) { |
439 | 439 | |
440 | - $_aAttributes = array( |
|
440 | + $_aAttributes = array( |
|
441 | 441 | 'id' => "select_media_{$sInputID}", |
442 | 442 | 'href' => '#', |
443 | - 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
444 | - 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
443 | + 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
444 | + 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
445 | 445 | ) |
446 | 446 | + $aButtonAttributes |
447 | 447 | + array( |
448 | 448 | 'title' => $_bIsLabelSet |
449 | - ? $aButtonAttributes['data-label'] |
|
449 | + ? $aButtonAttributes[ 'data-label' ] |
|
450 | 450 | : $this->oMsg->get( 'select_file' ), |
451 | 451 | 'data-label' => null, |
452 | 452 | ); |
453 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
453 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
454 | 454 | 'select_media button button-small ', |
455 | 455 | $this->getAOrB( |
456 | - trim( $aButtonAttributes['class'] ), |
|
457 | - $aButtonAttributes['class'], |
|
456 | + trim( $aButtonAttributes[ 'class' ] ), |
|
457 | + $aButtonAttributes[ 'class' ], |
|
458 | 458 | $this->getAOrB( |
459 | - ! $_bIsLabelSet && version_compare( $GLOBALS['wp_version'], '3.8', '>=' ), |
|
459 | + !$_bIsLabelSet && version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ), |
|
460 | 460 | 'dashicons dashicons-portfolio', |
461 | 461 | '' |
462 | 462 | ) |