@@ -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' ) |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Defines the field type slugs used for this field type. |
25 | 25 | */ |
26 | - public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week', ); |
|
26 | + public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week',); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Defines the default key-values of this field type. |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | protected function getField( $aField ) { |
66 | 66 | |
67 | 67 | $_aOutput = array(); |
68 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
69 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
68 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
69 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
70 | 70 | $_sKey, |
71 | 71 | $_sLabel, |
72 | 72 | $aField |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | // the repeatable field buttons will be replaced with this element. |
77 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
77 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
78 | 78 | return implode( '', $_aOutput ); |
79 | 79 | |
80 | 80 | } |
@@ -93,23 +93,23 @@ discard block |
||
93 | 93 | $aField[ 'value' ] = $this->getElementByLabel( $aField[ 'value' ], $sKey, $aField[ 'label' ] ); |
94 | 94 | $_aInputAttributes = $_bIsArray |
95 | 95 | ? array( |
96 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
97 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
96 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
97 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
98 | 98 | 'value' => $aField[ 'value' ], |
99 | 99 | ) |
100 | 100 | + $aField[ 'attributes' ] |
101 | 101 | : $aField[ 'attributes' ]; |
102 | - $_aOutput = array( |
|
102 | + $_aOutput = array( |
|
103 | 103 | $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
104 | 104 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
105 | - "<label for='" . $_aInputAttributes[ 'id' ] . "'>", |
|
105 | + "<label for='".$_aInputAttributes[ 'id' ]."'>", |
|
106 | 106 | $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
107 | 107 | $_sLabel |
108 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
108 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
109 | 109 | . $_sLabel |
110 | 110 | . "</span>" |
111 | 111 | : '', |
112 | - "<input " . $this->getAttributes( $_aInputAttributes ) . " />", |
|
112 | + "<input ".$this->getAttributes( $_aInputAttributes )." />", |
|
113 | 113 | $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
114 | 114 | "</label>", |
115 | 115 | "</div>", |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @since 2.1.5 |
44 | 44 | * @since 3.3.1 Changed from `_replyToGetStyles()`. |
45 | 45 | */ |
46 | - protected function getStyles() { |
|
46 | + protected function getStyles() { |
|
47 | 47 | return <<<CSSRULES |
48 | 48 | /* Text Field Type */ |
49 | 49 | .admin-page-framework-field.admin-page-framework-field-text > .admin-page-framework-input-label-container { |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | * - use_desc_for_title (boolean|int) default is 1 - Whether to use the category description as the title attribute. side note: the framework enables this by default. |
64 | 64 | * @param integer $iCurrentObjectID |
65 | 65 | */ |
66 | - function start_el( &$sOutput, $oTerm, $iDepth=0, $aArgs=array(), $iCurrentObjectID=0 ) { |
|
66 | + function start_el( &$sOutput, $oTerm, $iDepth = 0, $aArgs = array(), $iCurrentObjectID = 0 ) { |
|
67 | 67 | |
68 | 68 | $aArgs = $aArgs + array( |
69 | 69 | '_name_prefix' => null, |
70 | 70 | '_input_id_prefix' => null, |
71 | 71 | '_attributes' => array(), |
72 | 72 | '_selected_items' => array(), |
73 | - 'taxonomy' => null, // parsed by the core function to perform the database query. |
|
74 | - 'disabled' => null, // not sure what this was for |
|
73 | + 'taxonomy' => null, // parsed by the core function to perform the database query. |
|
74 | + 'disabled' => null, // not sure what this was for |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Local variables |
@@ -79,22 +79,22 @@ discard block |
||
79 | 79 | $_sTaxonomySlug = empty( $aArgs[ 'taxonomy' ] ) |
80 | 80 | ? 'category' |
81 | 81 | : $aArgs[ 'taxonomy' ]; |
82 | - $_sID = "{$aArgs['_input_id_prefix']}_{$_sTaxonomySlug}_{$_iID}"; |
|
82 | + $_sID = "{$aArgs[ '_input_id_prefix' ]}_{$_sTaxonomySlug}_{$_iID}"; |
|
83 | 83 | |
84 | 84 | // Post count |
85 | - $_sPostCount = $aArgs['show_post_count'] |
|
86 | - ? " <span class='font-lighter'>(" . $oTerm->count . ")</span>" |
|
85 | + $_sPostCount = $aArgs[ 'show_post_count' ] |
|
86 | + ? " <span class='font-lighter'>(".$oTerm->count.")</span>" |
|
87 | 87 | : ''; |
88 | 88 | |
89 | 89 | // Attributes |
90 | 90 | $_aInputAttributes = isset( $_aInputAttributes[ $_iID ] ) |
91 | - ? $_aInputAttributes[ $_iID ] + $aArgs['_attributes'] |
|
92 | - : $aArgs['_attributes']; |
|
91 | + ? $_aInputAttributes[ $_iID ] + $aArgs[ '_attributes' ] |
|
92 | + : $aArgs[ '_attributes' ]; |
|
93 | 93 | $_aInputAttributes = array( |
94 | 94 | 'id' => $_sID, |
95 | 95 | 'value' => 1, // must be 1 because the index of zero exists so the index value cannot be assigned here. |
96 | 96 | 'type' => 'checkbox', |
97 | - 'name' => "{$aArgs['_name_prefix']}[{$_iID}]", |
|
97 | + 'name' => "{$aArgs[ '_name_prefix' ]}[{$_iID}]", |
|
98 | 98 | 'checked' => in_array( $_iID, ( array ) $aArgs[ '_selected_items' ] ) |
99 | 99 | ? 'checked' |
100 | 100 | : null, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | + array( |
103 | 103 | 'class' => null, |
104 | 104 | ); |
105 | - $_aInputAttributes['class'] .= ' apf_checkbox'; |
|
105 | + $_aInputAttributes[ 'class' ] .= ' apf_checkbox'; |
|
106 | 106 | |
107 | 107 | $_aLiTagAttributes = array( |
108 | 108 | 'id' => "list-{$_sID}", |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | |
113 | 113 | // Output - the variable is by reference so the modification takes effect |
114 | 114 | $sOutput .= "\n" |
115 | - . "<li " . AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ) . ">" |
|
115 | + . "<li ".AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ).">" |
|
116 | 116 | . "<label for='{$_sID}' class='taxonomy-checklist-label'>" |
117 | - . "<input value='0' type='hidden' name='" . $_aInputAttributes[ 'name' ] . "' class='apf_checkbox' />" |
|
118 | - . "<input " . AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes ) . " />" |
|
117 | + . "<input value='0' type='hidden' name='".$_aInputAttributes[ 'name' ]."' class='apf_checkbox' />" |
|
118 | + . "<input ".AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes )." />" |
|
119 | 119 | . esc_html( apply_filters( 'the_category', $oTerm->name ) ) |
120 | 120 | . $_sPostCount |
121 | 121 | . "</label>"; |
@@ -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 |
@@ -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 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param object $oMsg The framework message object. |
100 | 100 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
101 | 101 | */ |
102 | - public function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
102 | + public function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
103 | 103 | |
104 | 104 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) |
105 | 105 | ? $this->aFieldTypeSlugs |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
112 | 112 | if ( $bAutoRegister ) { |
113 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
113 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
114 | 114 | add_filter( |
115 | - 'field_types_' . $_sClassName, |
|
115 | + 'field_types_'.$_sClassName, |
|
116 | 116 | array( $this, '_replyToRegisterInputFieldType' ) |
117 | 117 | ); |
118 | 118 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | } |
159 | 159 | return is_array( $asLabel ) // if the user stes multiple items |
160 | 160 | ? $this->getElement( |
161 | - $asElement, // subject |
|
162 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
161 | + $asElement, // subject |
|
162 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
163 | 163 | '' // default - if the element is not found, return an empty |
164 | 164 | ) |
165 | 165 | : $asElement; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | protected function geFieldOutput( array $aFieldset ) { |
176 | 176 | |
177 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
177 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
178 | 178 | return ''; |
179 | 179 | } |
180 | 180 | |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
183 | 183 | |
184 | 184 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
185 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
185 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
186 | 186 | |
187 | 187 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
188 | - $aFieldset, // the field definition array |
|
189 | - $_oCallerForm->aSavedData, // the stored form data |
|
190 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | - $_oCallerForm->oMsg, // the system message object |
|
188 | + $aFieldset, // the field definition array |
|
189 | + $_oCallerForm->aSavedData, // the stored form data |
|
190 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | + $_oCallerForm->oMsg, // the system message object |
|
193 | 193 | $_oCallerForm->aCallbacks // field output element callables. |
194 | 194 | ); |
195 | 195 | return $_oFieldset->get(); |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | * @since 3.0.3 Tweaked it to have better execution speed. |
224 | 224 | * @internal |
225 | 225 | */ |
226 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
226 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
227 | 227 | |
228 | 228 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
229 | 229 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
230 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
231 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
232 | - : self::$_aDefaultKeys['attributes']; |
|
230 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
231 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
232 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
233 | 233 | |
234 | 234 | return array( |
235 | 235 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @since 3.0.0 |
268 | 268 | * @internal |
269 | 269 | */ |
270 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
270 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
271 | 271 | $this->_sFieldSetType = $sFieldSetType; |
272 | 272 | } |
273 | 273 | |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | wp_enqueue_script( 'media-upload' ); |
322 | 322 | } |
323 | 323 | |
324 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
325 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
324 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
325 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
338 | 338 | |
339 | 339 | // Replace the button label in the media thick box. |
340 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
340 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
341 | 341 | return $sTranslated; |
342 | 342 | } |
343 | 343 | if ( $sText !== 'Insert into Post' ) { |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | return $sTranslated; |
348 | 348 | } |
349 | 349 | |
350 | - if ( isset( $_GET['button_label'] ) ) { |
|
351 | - return $_GET['button_label']; |
|
350 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
351 | + return $_GET[ 'button_label' ]; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return $this->oProp->sThickBoxButtonUseThis |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
369 | 369 | |
370 | - if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
370 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
371 | 371 | return $aTabs; |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! $_REQUEST['enable_external_source'] ) { |
|
375 | - unset( $aTabs['type_url'] ); // removes the 'From URL' tab in the thick box. |
|
374 | + if ( !$_REQUEST[ 'enable_external_source' ] ) { |
|
375 | + unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
|
376 | 376 | } |
377 | 377 | return $aTabs; |
378 | 378 |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | wp_enqueue_script( 'thickbox' ); |
316 | 316 | wp_enqueue_style( 'thickbox' ); |
317 | 317 | |
318 | - if ( function_exists( 'wp_enqueue_media' ) ) { |
|
318 | + if ( function_exists( 'wp_enqueue_media' ) ) { |
|
319 | 319 | // If the WordPress version is 3.5 or above, |
320 | 320 | new AdminPageFramework_Form_View___Script_MediaUploader( $this->oMsg ); |
321 | 321 | } else { |
322 | 322 | wp_enqueue_script( 'media-upload' ); |
323 | 323 | } |
324 | 324 | |
325 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
325 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
326 | 326 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
327 | 327 | } |
328 | 328 | |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
339 | 339 | |
340 | 340 | // Replace the button label in the media thick box. |
341 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
341 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
342 | 342 | return $sTranslated; |
343 | 343 | } |
344 | - if ( $sText !== 'Insert into Post' ) { |
|
344 | + if ( $sText !== 'Insert into Post' ) { |
|
345 | 345 | return $sTranslated; |
346 | 346 | } |
347 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
347 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
348 | 348 | return $sTranslated; |
349 | 349 | } |
350 | 350 | |
351 | - if ( isset( $_GET['button_label'] ) ) { |
|
351 | + if ( isset( $_GET['button_label'] ) ) { |
|
352 | 352 | return $_GET['button_label']; |
353 | 353 | } |
354 | 354 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
370 | 370 | |
371 | - if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
371 | + if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
372 | 372 | return $aTabs; |
373 | 373 | } |
374 | 374 |
@@ -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( 'submit', ); |
|
24 | + public $aFieldTypeSlugs = array( 'submit',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'redirect_url' => null, |
33 | 33 | 'href' => null, |
34 | 34 | 'reset' => null, |
35 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
35 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
36 | 36 | /* |
37 | 37 | array( |
38 | 38 | 'to' => null, // string|array The email address to send to or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the the field ID. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | 'attachments' => null, // string|array The file path(s) or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the the field ID. |
43 | 43 | ) |
44 | 44 | */ |
45 | - 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
45 | + 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
46 | 46 | 'attributes' => array( |
47 | 47 | 'class' => 'button button-primary', |
48 | 48 | ), |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | |
79 | 79 | return |
80 | 80 | $aField[ 'before_label' ] |
81 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
81 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
82 | 82 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
83 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
83 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
84 | 84 | . $aField[ 'before_input' ] |
85 | 85 | . $this->_getExtraInputFields( $aField ) |
86 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
86 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
87 | 87 | . $aField[ 'after_input' ] |
88 | 88 | . "</label>" |
89 | 89 | . "</div>" |
90 | - . $aField['after_label']; |
|
90 | + . $aField[ 'after_label' ]; |
|
91 | 91 | |
92 | 92 | } |
93 | 93 | /** |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _getLabelAttributes( array $aField, array $aInputAttributes ) { |
116 | 116 | return array( |
117 | - 'style' => $aField['label_min_width'] |
|
118 | - ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
|
117 | + 'style' => $aField[ 'label_min_width' ] |
|
118 | + ? "min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";" |
|
119 | 119 | : null, |
120 | - 'for' => $aInputAttributes['id'], |
|
121 | - 'class' => $aInputAttributes['disabled'] |
|
120 | + 'for' => $aInputAttributes[ 'id' ], |
|
121 | + 'class' => $aInputAttributes[ 'disabled' ] |
|
122 | 122 | ? 'disabled' |
123 | 123 | : null, |
124 | 124 | ); |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function _getLabelContainerAttributes( array $aField ) { |
132 | 132 | return array( |
133 | - 'style' => $aField['label_min_width'] |
|
134 | - ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
|
133 | + 'style' => $aField[ 'label_min_width' ] |
|
134 | + ? "min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";" |
|
135 | 135 | : null, |
136 | 136 | 'class' => 'admin-page-framework-input-label-container' |
137 | 137 | . ' admin-page-framework-input-button-container' |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | protected function _getExtraInputFields( &$aField ) { |
177 | 177 | |
178 | 178 | $_aOutput = array(); |
179 | - $_aOutput[] = $this->getHTMLTag( |
|
179 | + $_aOutput[ ] = $this->getHTMLTag( |
|
180 | 180 | 'input', |
181 | 181 | array( |
182 | 182 | 'type' => 'hidden', |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'value' => $aField[ 'input_id' ], |
185 | 185 | ) |
186 | 186 | ); |
187 | - $_aOutput[] = $this->getHTMLTag( |
|
187 | + $_aOutput[ ] = $this->getHTMLTag( |
|
188 | 188 | 'input', |
189 | 189 | array( |
190 | 190 | 'type' => 'hidden', |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | 'value' => $aField[ 'field_id' ], |
193 | 193 | ) |
194 | 194 | ); |
195 | - $_aOutput[] = $this->getHTMLTag( |
|
195 | + $_aOutput[ ] = $this->getHTMLTag( |
|
196 | 196 | 'input', |
197 | 197 | array( |
198 | 198 | 'type' => 'hidden', |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | 'value' => $aField[ '_input_name_flat' ], |
201 | 201 | ) |
202 | 202 | ); |
203 | - $_aOutput[] = $this->_getHiddenInput_SectionID( $aField ); |
|
204 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
205 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
206 | - $_aOutput[] = $this->_getHiddenInput_Reset( $aField ); |
|
207 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
203 | + $_aOutput[ ] = $this->_getHiddenInput_SectionID( $aField ); |
|
204 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
205 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
206 | + $_aOutput[ ] = $this->_getHiddenInput_Reset( $aField ); |
|
207 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
208 | 208 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
209 | 209 | |
210 | 210 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | 'input', |
221 | 221 | array( |
222 | 222 | 'type' => 'hidden', |
223 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
224 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
225 | - ? $aField['section_id'] |
|
223 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
224 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
225 | + ? $aField[ 'section_id' ] |
|
226 | 226 | : '', |
227 | 227 | ) |
228 | 228 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | 'input', |
241 | 241 | array( |
242 | 242 | 'type' => 'hidden', |
243 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
243 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
244 | 244 | 'value' => $aField[ $sKey ], |
245 | 245 | ) |
246 | 246 | ) |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | * @return string the HTML input tag output for the 'reset' argument. |
255 | 255 | */ |
256 | 256 | private function _getHiddenInput_Reset( array $aField ) { |
257 | - if ( ! $aField['reset'] ) { |
|
257 | + if ( !$aField[ 'reset' ] ) { |
|
258 | 258 | return ''; |
259 | 259 | } |
260 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
260 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
261 | 261 | ? $this->getHTMLTag( |
262 | 262 | 'input', |
263 | 263 | array( |
264 | 264 | 'type' => 'hidden', |
265 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
265 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
266 | 266 | 'value' => '1', |
267 | 267 | ) |
268 | 268 | ) |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | 'input', |
271 | 271 | array( |
272 | 272 | 'type' => 'hidden', |
273 | - 'name' => "__submit[{$aField['input_id']}][reset_key]", |
|
274 | - 'value' => is_array( $aField['reset'] ) // set the option array key to delete. |
|
275 | - ? implode( '|', $aField['reset'] ) |
|
276 | - : $aField['reset'], |
|
273 | + 'name' => "__submit[{$aField[ 'input_id' ]}][reset_key]", |
|
274 | + 'value' => is_array( $aField[ 'reset' ] ) // set the option array key to delete. |
|
275 | + ? implode( '|', $aField[ 'reset' ] ) |
|
276 | + : $aField[ 'reset' ], |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | } |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | return ''; |
291 | 291 | } |
292 | 292 | $this->setTransient( |
293 | - 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ), |
|
293 | + 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ), |
|
294 | 294 | $aField[ 'email' ] |
295 | 295 | ); |
296 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
296 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
297 | 297 | ? $this->getHTMLTag( |
298 | 298 | 'input', |
299 | 299 | array( |
@@ -316,19 +316,19 @@ discard block |
||
316 | 316 | * A helper function for the above getSubmitField() that checks if a reset confirmation message has been displayed or not when the 'reset' key is set. |
317 | 317 | * |
318 | 318 | */ |
319 | - private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) { |
|
319 | + private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) { |
|
320 | 320 | |
321 | - switch( $sType ) { |
|
321 | + switch ( $sType ) { |
|
322 | 322 | default: |
323 | 323 | case 'reset': // admin page framework _ reset confirmation |
324 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
324 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
325 | 325 | break; |
326 | 326 | case 'email': // admin page framework _ email confirmation |
327 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
327 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
328 | 328 | break; |
329 | 329 | } |
330 | 330 | |
331 | - $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && ! $aField[ 'skip_confirmation' ] |
|
331 | + $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ] |
|
332 | 332 | ? false |
333 | 333 | : true; |
334 | 334 | |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | protected function _getInputFieldValueFromLabel( $aField ) { |
359 | 359 | |
360 | 360 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
361 | - if ( isset( $aField['value'] ) && $aField['value'] != '' ) { return $aField['value']; } |
|
361 | + if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { return $aField[ 'value' ]; } |
|
362 | 362 | |
363 | - if ( isset( $aField['label'] ) ) { return $aField['label']; } |
|
363 | + if ( isset( $aField[ 'label' ] ) ) { return $aField[ 'label' ]; } |
|
364 | 364 | |
365 | 365 | // If the default value is set, |
366 | - if ( isset( $aField['default'] ) ) { return $aField['default']; } |
|
366 | + if ( isset( $aField[ 'default' ] ) ) { return $aField[ 'default' ]; } |
|
367 | 367 | |
368 | 368 | } |
369 | 369 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @since 3.5.3 |
128 | 128 | * @return array The label container attribute array. |
129 | 129 | */ |
130 | - private function _getLabelContainerAttributes( array $aField ) { |
|
130 | + private function _getLabelContainerAttributes( array $aField ) { |
|
131 | 131 | return array( |
132 | 132 | 'style' => $aField['label_min_width'] |
133 | 133 | ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @since 2.0.0 |
355 | 355 | * @since 2.1.5 Moved from AdminPageFramwrork_InputField. Changed the scope to protected from private. Removed the second parameter. |
356 | 356 | */ |
357 | - protected function _getInputFieldValueFromLabel( $aField ) { |
|
357 | + protected function _getInputFieldValueFromLabel( $aField ) { |
|
358 | 358 | |
359 | 359 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
360 | 360 | if ( isset( $aField['value'] ) && $aField['value'] != '' ) { return $aField['value']; } |
@@ -277,7 +277,7 @@ |
||
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
280 | - /** |
|
280 | + /** |
|
281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
282 | 282 | * |
283 | 283 | * @since 3.5.6 |
@@ -478,7 +478,7 @@ discard block |
||
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 { |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
709 | 709 | |
710 | - if ( ! $aField[ 'show_preview' ] ) { |
|
710 | + if ( ! $aField[ 'show_preview' ] ) { |
|
711 | 711 | return ''; |
712 | 712 | } |
713 | 713 |
@@ -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,17 +707,17 @@ discard block |
||
707 | 707 | */ |
708 | 708 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
709 | 709 | |
710 | - if ( ! $aField[ 'show_preview' ] ) { |
|
710 | + if ( !$aField[ 'show_preview' ] ) { |
|
711 | 711 | return ''; |
712 | 712 | } |
713 | 713 | |
714 | 714 | $sImageURL = esc_url( $this->getResolvedSRC( $sImageURL, true ) ); |
715 | 715 | return |
716 | - "<div " . $this->getAttributes( |
|
716 | + "<div ".$this->getAttributes( |
|
717 | 717 | array( |
718 | 718 | 'id' => "image_preview_container_{$aField[ 'input_id' ]}", |
719 | - 'class' => 'image_preview ' . $this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
720 | - 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
719 | + 'class' => 'image_preview '.$this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
720 | + 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
721 | 721 | . $this->getElement( $aPreviewAtrributes, 'style', '' ), |
722 | 722 | ) + $aPreviewAtrributes |
723 | 723 | ) |
@@ -739,12 +739,12 @@ discard block |
||
739 | 739 | */ |
740 | 740 | protected function _getUploaderButtonScript( $sInputID, $abRepeatable, $bExternalSource, array $aButtonAttributes ) { |
741 | 741 | |
742 | - $_bRepeatable = ! empty( $abRepeatable ); |
|
742 | + $_bRepeatable = !empty( $abRepeatable ); |
|
743 | 743 | |
744 | 744 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
745 | 745 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
746 | 746 | // which causes the PHP syntax error. |
747 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ) . '"'; |
|
747 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ).'"'; |
|
748 | 748 | $_sRepeatable = $this->getAOrB( $_bRepeatable, 'true', 'false' ); |
749 | 749 | $_bExternalSource = $this->getAOrB( $bExternalSource, 'true', 'false' ); |
750 | 750 | $_sScript = <<<JAVASCRIPTS |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | . '/* <![CDATA[ */' |
761 | 761 | . $_sScript |
762 | 762 | . '/* ]]> */' |
763 | - . "</script>". PHP_EOL; |
|
763 | + . "</script>".PHP_EOL; |
|
764 | 764 | |
765 | 765 | } |
766 | 766 | /** |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | $bRepeatable, |
779 | 779 | $bExternalSource |
780 | 780 | ); |
781 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
781 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
782 | 782 | . ( $_bIsLabelSet |
783 | 783 | ? $_aAttributes[ 'data-label' ] |
784 | 784 | : ( strrpos( $_aAttributes[ 'class' ], 'dashicons' ) |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | */ |
797 | 797 | private function _getFormattedUploadButtonAttributes( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bRepeatable, $bExternalSource ) { |
798 | 798 | |
799 | - $_aAttributes = array( |
|
799 | + $_aAttributes = array( |
|
800 | 800 | 'id' => "select_image_{$sInputID}", |
801 | 801 | 'href' => '#', |
802 | 802 | 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | : $this->oMsg->get( 'select_image' ), |
810 | 810 | 'data-label' => null, |
811 | 811 | ); |
812 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
812 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
813 | 813 | 'select_image button button-small ', |
814 | 814 | $this->getAOrB( |
815 | 815 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -836,16 +836,16 @@ discard block |
||
836 | 836 | * @since 3.5.3 Added the `$sType` parameter. |
837 | 837 | * @return string |
838 | 838 | */ |
839 | - protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
839 | + protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
840 | 840 | |
841 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
841 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
842 | 842 | return ''; |
843 | 843 | } |
844 | 844 | |
845 | 845 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
846 | 846 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
847 | 847 | // which causes the PHP syntax error. |
848 | - $_sButtonHTML = '"' . $this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ) . '"'; |
|
848 | + $_sButtonHTML = '"'.$this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ).'"'; |
|
849 | 849 | $_sScript = <<<JAVASCRIPTS |
850 | 850 | if ( 0 === jQuery( 'a#remove_{$sType}_{$sInputID}' ).length ) { |
851 | 851 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | . '/* <![CDATA[ */' |
857 | 857 | . $_sScript |
858 | 858 | . '/* ]]> */' |
859 | - . "</script>". PHP_EOL; |
|
859 | + . "</script>".PHP_EOL; |
|
860 | 860 | |
861 | 861 | } |
862 | 862 | |
@@ -865,11 +865,11 @@ discard block |
||
865 | 865 | * @since 3.5.3 |
866 | 866 | * @return string The generated HTML remove button output. |
867 | 867 | */ |
868 | - protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
868 | + protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
869 | 869 | |
870 | 870 | $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
871 | 871 | $_aAttributes = $this->_getFormattedRemoveButtonAttributesByType( $sInputID, $aButtonAttributes, $_bIsLabelSet, $sType ); |
872 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
872 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
873 | 873 | . ( $_bIsLabelSet |
874 | 874 | ? $_aAttributes[ 'data-label' ] |
875 | 875 | : $this->getAOrB( |
@@ -887,9 +887,9 @@ discard block |
||
887 | 887 | * @since 3.5.3 |
888 | 888 | * @return array The formatted remove button attributes array. |
889 | 889 | */ |
890 | - protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType='image' ) { |
|
890 | + protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType = 'image' ) { |
|
891 | 891 | |
892 | - $_sOnClickFunctionName = 'removeInputValuesFor' . ucfirst( $sType ); |
|
892 | + $_sOnClickFunctionName = 'removeInputValuesFor'.ucfirst( $sType ); |
|
893 | 893 | $_aAttributes = array( |
894 | 894 | 'id' => "remove_{$sType}_{$sInputID}", |
895 | 895 | 'href' => '#', |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | ? $aButtonAttributes[ 'data-label' ] |
902 | 902 | : $this->oMsg->get( 'remove_value' ), |
903 | 903 | ); |
904 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
904 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
905 | 905 | "remove_value remove_{$sType} button button-small", |
906 | 906 | $this->getAOrB( |
907 | 907 | trim( $aButtonAttributes[ 'class' ] ), |