@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * Get an array of addon data for the settings modal |
44 | 44 | * @since 0.9.4 |
45 | 45 | */ |
46 | -function lasso_get_modal_tabs(){ |
|
46 | +function lasso_get_modal_tabs() { |
|
47 | 47 | |
48 | 48 | $tabs = array(); |
49 | 49 | |
@@ -60,34 +60,34 @@ discard block |
||
60 | 60 | * @uses lasso_modal_addons_content() |
61 | 61 | * @since 0.9.4 |
62 | 62 | */ |
63 | -function lasso_modal_addons( $type = 'tab' ){ |
|
63 | +function lasso_modal_addons($type = 'tab') { |
|
64 | 64 | |
65 | 65 | $tabs = lasso_get_modal_tabs(); |
66 | 66 | $out = ''; |
67 | 67 | |
68 | - if ( $tabs ): |
|
68 | + if ($tabs): |
|
69 | 69 | |
70 | - if ( 'tab' == $type ) { |
|
70 | + if ('tab' == $type) { |
|
71 | 71 | |
72 | 72 | $out = '<ul class="lasso--modal__tabs">'; |
73 | 73 | |
74 | 74 | $out .= '<li class="active-tab" data-addon-name="core">Editus</li>'; |
75 | 75 | |
76 | - foreach ( $tabs as $tab ) { |
|
76 | + foreach ($tabs as $tab) { |
|
77 | 77 | |
78 | - if ( isset( $tab ) ) { |
|
78 | + if (isset($tab)) { |
|
79 | 79 | |
80 | - $out .= lasso_modal_addons_content( $tab, $type ); |
|
80 | + $out .= lasso_modal_addons_content($tab, $type); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | 84 | $out .= '</ul>'; |
85 | 85 | |
86 | - } elseif ( 'content' == $type ) { |
|
87 | - foreach ( $tabs as $tab ) { |
|
86 | + } elseif ('content' == $type) { |
|
87 | + foreach ($tabs as $tab) { |
|
88 | 88 | |
89 | - if ( isset( $tab ) ) { |
|
90 | - $out .= lasso_modal_addons_content( $tab , $type ); |
|
89 | + if (isset($tab)) { |
|
90 | + $out .= lasso_modal_addons_content($tab, $type); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | endif; |
97 | 97 | |
98 | - return !empty( $out ) ? $out : false; |
|
98 | + return !empty($out) ? $out : false; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -115,26 +115,26 @@ discard block |
||
115 | 115 | * @since 0.9.5 |
116 | 116 | * @subpackage lasso_modal_addons_content |
117 | 117 | */ |
118 | -function lasso_option_form( $name = '', $options = array() ){ |
|
118 | +function lasso_option_form($name = '', $options = array()) { |
|
119 | 119 | |
120 | 120 | ob_start(); |
121 | 121 | |
122 | - if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) |
|
122 | + if (empty($name) || empty($options) || !is_array($options)) |
|
123 | 123 | return; |
124 | 124 | |
125 | 125 | $nonce = wp_create_nonce('lasso-process-post-meta'); |
126 | - $key = sprintf('_lasso_%s_settings', $name ); |
|
126 | + $key = sprintf('_lasso_%s_settings', $name); |
|
127 | 127 | |
128 | - $out = sprintf('<form id="lasso--post-form" class="lasso--post-form">' ); |
|
128 | + $out = sprintf('<form id="lasso--post-form" class="lasso--post-form">'); |
|
129 | 129 | |
130 | - $out .= lasso_option_fields( $name, $options ); |
|
131 | - $out .='<div class="form--bottom">'; |
|
132 | - $out .='<input type="submit" value="'.__( 'Save', 'lasso' ).'">'; |
|
133 | - $out .='<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
134 | - $out .='<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
135 | - $out .='<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
136 | - $out .='<input type="hidden" name="action" value="process_meta_update">'; |
|
137 | - $out .='</div>'; |
|
130 | + $out .= lasso_option_fields($name, $options); |
|
131 | + $out .= '<div class="form--bottom">'; |
|
132 | + $out .= '<input type="submit" value="'.__('Save', 'lasso').'">'; |
|
133 | + $out .= '<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
134 | + $out .= '<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
135 | + $out .= '<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
136 | + $out .= '<input type="hidden" name="action" value="process_meta_update">'; |
|
137 | + $out .= '</div>'; |
|
138 | 138 | |
139 | 139 | $out .= '</form>'; |
140 | 140 | |
@@ -178,31 +178,31 @@ discard block |
||
178 | 178 | * @since 0.9.5 |
179 | 179 | * @subpackage lasso_modal_addons_content |
180 | 180 | */ |
181 | -function lasso_option_fields( $name = '', $options = array() ){ |
|
181 | +function lasso_option_fields($name = '', $options = array()) { |
|
182 | 182 | |
183 | - $out = ''; |
|
183 | + $out = ''; |
|
184 | 184 | $before = '<div class="lasso--postsettings__option">'; |
185 | 185 | $after = '</div>'; |
186 | 186 | |
187 | - if ( empty( $name ) || empty( $options ) ) |
|
187 | + if (empty($name) || empty($options)) |
|
188 | 188 | return; |
189 | 189 | |
190 | - foreach ( (array) $options as $option ) { |
|
190 | + foreach ((array) $options as $option) { |
|
191 | 191 | |
192 | - $type = isset( $option['type'] ) ? $option['type'] : 'text'; |
|
192 | + $type = isset($option['type']) ? $option['type'] : 'text'; |
|
193 | 193 | |
194 | - switch ( $type ) { |
|
194 | + switch ($type) { |
|
195 | 195 | case 'text': |
196 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'text' ), $after ); |
|
196 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'text'), $after); |
|
197 | 197 | break; |
198 | 198 | case 'textarea': |
199 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'textarea' ), $after ); |
|
199 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'textarea'), $after); |
|
200 | 200 | break; |
201 | 201 | case 'imgurl': |
202 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'imgurl' ), $after ); |
|
202 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'imgurl'), $after); |
|
203 | 203 | break; |
204 | 204 | case 'checkbox': |
205 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'checkbox' ), $after ); |
|
205 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'checkbox'), $after); |
|
206 | 206 | break; |
207 | 207 | } |
208 | 208 | |
@@ -222,30 +222,30 @@ discard block |
||
222 | 222 | * @param $type string text, textarea, checkbox, color |
223 | 223 | * @since 5.0 |
224 | 224 | */ |
225 | -function lasso_option_engine_option( $name = '', $option = '', $type = '') { |
|
225 | +function lasso_option_engine_option($name = '', $option = '', $type = '') { |
|
226 | 226 | |
227 | - if ( empty( $type ) || empty( $option ) ) |
|
227 | + if (empty($type) || empty($option)) |
|
228 | 228 | return; |
229 | 229 | |
230 | - $id = isset( $option['id'] ) ? $option['id'] : false; |
|
231 | - $id = $id ? lasso_clean_string( $id ) : false; |
|
230 | + $id = isset($option['id']) ? $option['id'] : false; |
|
231 | + $id = $id ? lasso_clean_string($id) : false; |
|
232 | 232 | |
233 | - $desc = isset( $option['desc'] ) ? $option['desc'] : false; |
|
233 | + $desc = isset($option['desc']) ? $option['desc'] : false; |
|
234 | 234 | |
235 | - $value = get_post_meta( get_the_id(), $option[ 'id' ], true ); |
|
235 | + $value = get_post_meta(get_the_id(), $option['id'], true); |
|
236 | 236 | |
237 | - switch ( $type ) { |
|
237 | + switch ($type) { |
|
238 | 238 | case 'text': |
239 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">',$id, esc_html( $desc ), $id, $id, $value ); |
|
239 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">', $id, esc_html($desc), $id, $id, $value); |
|
240 | 240 | break; |
241 | 241 | case 'textarea': |
242 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>',$id, esc_html( $desc ), $id, $id, $value ); |
|
242 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>', $id, esc_html($desc), $id, $id, $value); |
|
243 | 243 | break; |
244 | 244 | case 'imgurl': |
245 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image" class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div>',$id, esc_html( $desc ), $value, $id, $id, $value ); |
|
245 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image" class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div>', $id, esc_html($desc), $value, $id, $id, $value); |
|
246 | 246 | break; |
247 | 247 | case 'checkbox': |
248 | - $out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s',$id, $id, $id ,esc_html( $desc ) ); |
|
248 | + $out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s', $id, $id, $id, esc_html($desc)); |
|
249 | 249 | break; |
250 | 250 | } |
251 | 251 |