@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | * @return the option value |
13 | 13 | * @since 1.0 |
14 | 14 | */ |
15 | -function lasso_editor_get_option( $option, $section, $default = '' ) { |
|
15 | +function lasso_editor_get_option($option, $section, $default = '') { |
|
16 | 16 | |
17 | - if ( empty( $option ) ) |
|
17 | + if (empty($option)) |
|
18 | 18 | return; |
19 | 19 | |
20 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
20 | + if (function_exists('is_multisite') && is_multisite()) { |
|
21 | 21 | |
22 | - $options = get_site_option( $section ); |
|
22 | + $options = get_site_option($section); |
|
23 | 23 | |
24 | 24 | } else { |
25 | 25 | |
26 | - $options = get_option( $section ); |
|
26 | + $options = get_option($section); |
|
27 | 27 | } |
28 | 28 | |
29 | - if ( isset( $options[$option] ) ) { |
|
29 | + if (isset($options[$option])) { |
|
30 | 30 | return $options[$option]; |
31 | 31 | } |
32 | 32 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function lasso_editor_galleries_exist() { |
42 | 42 | |
43 | - $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
|
43 | + $q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish')); |
|
44 | 44 | |
45 | - if ( $q->have_posts() ) |
|
45 | + if ($q->have_posts()) |
|
46 | 46 | return true; |
47 | 47 | else |
48 | 48 | return false; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | function lasso_get_supported_theme_class() { |
58 | 58 | |
59 | 59 | $name = wp_get_theme()->get('Name'); |
60 | - $slug = lasso_clean_string( $name ); |
|
60 | + $slug = lasso_clean_string($name); |
|
61 | 61 | |
62 | - switch ( $slug ) { |
|
62 | + switch ($slug) { |
|
63 | 63 | |
64 | 64 | case 'twentytwelve': // automattic |
65 | 65 | $out = '.entry-content'; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - return !empty( $out ) ? $out : false; |
|
115 | + return !empty($out) ? $out : false; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @since 0.8.7 |
123 | 123 | * @return string of comma separated classes |
124 | 124 | */ |
125 | -function lasso_supported_no_save(){ |
|
125 | +function lasso_supported_no_save() { |
|
126 | 126 | |
127 | 127 | return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .twitter-tweet'); |
128 | 128 | } |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return array|mixed|object|string|void |
138 | 138 | */ |
139 | -function lasso_sanitize_data( $data ) { |
|
140 | - return \lasso\sanatize::do_sanitize( $data ); |
|
139 | +function lasso_sanitize_data($data) { |
|
140 | + return \lasso\sanatize::do_sanitize($data); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -147,18 +147,18 @@ discard block |
||
147 | 147 | * @since 0.9.3 |
148 | 148 | * @return string of comma delimited category slugs |
149 | 149 | */ |
150 | -function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
|
150 | +function lasso_get_post_objects($postid = '', $taxonomy = 'category') { |
|
151 | 151 | |
152 | - if ( empty( $postid ) ) |
|
152 | + if (empty($postid)) |
|
153 | 153 | $postid = get_the_ID(); |
154 | 154 | |
155 | - $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
|
155 | + $objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid); |
|
156 | 156 | |
157 | - if ( empty( $objects) ) |
|
157 | + if (empty($objects)) |
|
158 | 158 | return; |
159 | 159 | |
160 | 160 | $out = ''; |
161 | - foreach( $objects as $object ) { |
|
161 | + foreach ($objects as $object) { |
|
162 | 162 | $out .= $object->slug.', '; |
163 | 163 | } |
164 | 164 | |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | * @since 0.9.3 |
173 | 173 | * @return array all categoiries |
174 | 174 | */ |
175 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
175 | +function lasso_get_objects($taxonomy = 'category') { |
|
176 | 176 | |
177 | 177 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
178 | 178 | |
179 | - if ( empty( $objects) ) |
|
179 | + if (empty($objects)) |
|
180 | 180 | return; |
181 | 181 | |
182 | 182 | $out = array(); |
183 | - foreach( $objects as $object ) { |
|
183 | + foreach ($objects as $object) { |
|
184 | 184 | $out[] = $object->slug; |
185 | 185 | } |
186 | 186 | |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | */ |
197 | 197 | function lasso_post_types() { |
198 | 198 | |
199 | - $post_types = get_post_types( array( |
|
199 | + $post_types = get_post_types(array( |
|
200 | 200 | 'public' => true, |
201 | - ), 'objects' ); |
|
202 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
203 | - unset( $post_types[ 'attachment' ] ); |
|
201 | + ), 'objects'); |
|
202 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
203 | + unset($post_types['attachment']); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Set which post types are allowed |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
211 | 211 | */ |
212 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page' ) ); |
|
213 | - foreach( $post_types as $name => $label ) { |
|
214 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
215 | - unset( $post_types[ $name ] ); |
|
212 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', array('post', 'page')); |
|
213 | + foreach ($post_types as $name => $label) { |
|
214 | + if (!in_array($name, $allowed_post_types)) { |
|
215 | + unset($post_types[$name]); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } |
@@ -232,22 +232,22 @@ discard block |
||
232 | 232 | * @uses lasso_modal_addons() |
233 | 233 | * @since 0.9.4 |
234 | 234 | */ |
235 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
235 | +function lasso_modal_addons_content($tab = '', $type) { |
|
236 | 236 | |
237 | - $name = lasso_clean_string( $tab['name'] ); |
|
237 | + $name = lasso_clean_string($tab['name']); |
|
238 | 238 | |
239 | - if ( 'tab' == $type ) { |
|
239 | + if ('tab' == $type) { |
|
240 | 240 | |
241 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
241 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
242 | 242 | |
243 | - } else if ( 'content' == $type ){ |
|
243 | + } else if ('content' == $type) { |
|
244 | 244 | |
245 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
246 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
245 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
246 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
247 | 247 | |
248 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
248 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
249 | 249 | %s%s |
250 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
250 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
251 | 251 | |
252 | 252 | } |
253 | 253 | |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @return void|string |
264 | 264 | */ |
265 | -function lasso_clean_string( $string = '' ) { |
|
265 | +function lasso_clean_string($string = '') { |
|
266 | 266 | |
267 | - if ( empty( $string ) ) |
|
267 | + if (empty($string)) |
|
268 | 268 | return; |
269 | 269 | |
270 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
270 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return void|string |
282 | 282 | */ |
283 | -function lasso_unclean_string( $string = '' ) { |
|
283 | +function lasso_unclean_string($string = '') { |
|
284 | 284 | |
285 | - if ( empty( $string ) ) { |
|
285 | + if (empty($string)) { |
|
286 | 286 | return; |
287 | 287 | } |
288 | 288 | |
289 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
289 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | * @param unknown $postid int the id of the post object to check against |
302 | 302 | * @since 1.0 |
303 | 303 | */ |
304 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
305 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
304 | +if (!function_exists('lasso_user_can')): |
|
305 | + function lasso_user_can($action = '', $postid = 0) { |
|
306 | 306 | |
307 | - if ( empty( $action ) ) |
|
307 | + if (empty($action)) |
|
308 | 308 | $action = 'edit_posts'; |
309 | 309 | |
310 | - if ( empty( $postid ) ) |
|
310 | + if (empty($postid)) |
|
311 | 311 | $postid = get_the_ID(); |
312 | 312 | |
313 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
313 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
314 | 314 | |
315 | 315 | return true; |
316 | 316 | |
@@ -328,25 +328,25 @@ discard block |
||
328 | 328 | * |
329 | 329 | * @since 0.9.5 |
330 | 330 | */ |
331 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
331 | +if (!function_exists('lasso_editor_empty_results')): |
|
332 | 332 | |
333 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
333 | + function lasso_editor_empty_results($type = 'posts') { |
|
334 | 334 | |
335 | - if ( 'posts' == $type ) { |
|
335 | + if ('posts' == $type) { |
|
336 | 336 | |
337 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
337 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
338 | 338 | $icon = 'lasso-icon-file-text2'; |
339 | 339 | $button = false; |
340 | 340 | |
341 | - } elseif ( 'revision' == $type ) { |
|
341 | + } elseif ('revision' == $type) { |
|
342 | 342 | |
343 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
343 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
344 | 344 | $icon = 'lasso-icon-history'; |
345 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
345 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
346 | 346 | |
347 | 347 | } |
348 | 348 | |
349 | - return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button ); |
|
349 | + return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | endif; |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | require_once LASSO_DIR.'/public/includes/option-engine.php'; |
52 | 52 | |
53 | 53 | // Activate plugin when new blog is added |
54 | - add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) ); |
|
54 | + add_action('wpmu_new_blog', array($this, 'activate_new_site')); |
|
55 | 55 | |
56 | 56 | // Load plugin text domain |
57 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
57 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
58 | 58 | |
59 | 59 | //enqueue assets |
60 | 60 | new assets(); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public static function get_instance() { |
83 | 83 | |
84 | 84 | // If the single instance hasn't been set, set it now. |
85 | - if ( null == self::$instance ) { |
|
85 | + if (null == self::$instance) { |
|
86 | 86 | self::$instance = new self; |
87 | 87 | } |
88 | 88 | |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | * WPMU is disabled or plugin is |
100 | 100 | * activated on an individual blog. |
101 | 101 | */ |
102 | - public static function activate( $network_wide ) { |
|
102 | + public static function activate($network_wide) { |
|
103 | 103 | |
104 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
104 | + if (function_exists('is_multisite') && is_multisite()) { |
|
105 | 105 | |
106 | - if ( $network_wide ) { |
|
106 | + if ($network_wide) { |
|
107 | 107 | |
108 | 108 | // Get all blog ids |
109 | 109 | $blog_ids = self::get_blog_ids(); |
110 | 110 | |
111 | - foreach ( $blog_ids as $blog_id ) { |
|
111 | + foreach ($blog_ids as $blog_id) { |
|
112 | 112 | |
113 | - switch_to_blog( $blog_id ); |
|
113 | + switch_to_blog($blog_id); |
|
114 | 114 | self::single_activate(); |
115 | 115 | } |
116 | 116 | |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | * WPMU is disabled or plugin is |
137 | 137 | * deactivated on an individual blog. |
138 | 138 | */ |
139 | - public static function deactivate( $network_wide ) { |
|
139 | + public static function deactivate($network_wide) { |
|
140 | 140 | |
141 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
141 | + if (function_exists('is_multisite') && is_multisite()) { |
|
142 | 142 | |
143 | - if ( $network_wide ) { |
|
143 | + if ($network_wide) { |
|
144 | 144 | |
145 | 145 | // Get all blog ids |
146 | 146 | $blog_ids = self::get_blog_ids(); |
147 | 147 | |
148 | - foreach ( $blog_ids as $blog_id ) { |
|
148 | + foreach ($blog_ids as $blog_id) { |
|
149 | 149 | |
150 | - switch_to_blog( $blog_id ); |
|
150 | + switch_to_blog($blog_id); |
|
151 | 151 | self::single_deactivate(); |
152 | 152 | |
153 | 153 | } |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @param int $blog_id ID of the new blog. |
173 | 173 | */ |
174 | - public function activate_new_site( $blog_id ) { |
|
174 | + public function activate_new_site($blog_id) { |
|
175 | 175 | |
176 | - if ( 1 !== did_action( 'wpmu_new_blog' ) ) { |
|
176 | + if (1 !== did_action('wpmu_new_blog')) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
180 | - switch_to_blog( $blog_id ); |
|
180 | + switch_to_blog($blog_id); |
|
181 | 181 | self::single_activate(); |
182 | 182 | restore_current_blog(); |
183 | 183 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | WHERE archived = '0' AND spam = '0' |
203 | 203 | AND deleted = '0'"; |
204 | 204 | |
205 | - return $wpdb->get_col( $sql ); |
|
205 | + return $wpdb->get_col($sql); |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
@@ -213,18 +213,18 @@ discard block |
||
213 | 213 | */ |
214 | 214 | private static function single_activate() { |
215 | 215 | |
216 | - $curr_version = get_option( 'lasso_version' ); |
|
216 | + $curr_version = get_option('lasso_version'); |
|
217 | 217 | |
218 | 218 | // update upgraded from |
219 | - if ( $curr_version ) { |
|
220 | - update_option( 'lasso_updated_from', $curr_version ); |
|
219 | + if ($curr_version) { |
|
220 | + update_option('lasso_updated_from', $curr_version); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | // update lasso version option |
224 | - update_option( 'lasso_version', LASSO_VERSION ); |
|
224 | + update_option('lasso_version', LASSO_VERSION); |
|
225 | 225 | |
226 | 226 | // set transietn for activation welcome |
227 | - set_transient( '_lasso_welcome_redirect', true, 30 ); |
|
227 | + set_transient('_lasso_welcome_redirect', true, 30); |
|
228 | 228 | |
229 | 229 | |
230 | 230 | } |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | public function load_plugin_textdomain() { |
247 | 247 | |
248 | 248 | $domain = $this->plugin_slug; |
249 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
249 | + $locale = apply_filters('plugin_locale', get_locale(), $domain); |
|
250 | 250 | |
251 | - $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
|
251 | + $out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo'); |
|
252 | 252 | } |
253 | 253 | } |
@@ -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,36 +60,36 @@ 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">Lasso</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 ) { |
|
86 | + } elseif ('content' == $type) { |
|
87 | 87 | |
88 | 88 | |
89 | - foreach ( $tabs as $tab ) { |
|
89 | + foreach ($tabs as $tab) { |
|
90 | 90 | |
91 | - if ( isset( $tab ) ) { |
|
92 | - $out .= lasso_modal_addons_content( $tab , $type ); |
|
91 | + if (isset($tab)) { |
|
92 | + $out .= lasso_modal_addons_content($tab, $type); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | endif; |
99 | 99 | |
100 | - return !empty( $out ) ? $out : false; |
|
100 | + return !empty($out) ? $out : false; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,26 +117,26 @@ discard block |
||
117 | 117 | * @since 0.9.5 |
118 | 118 | * @subpackage lasso_modal_addons_content |
119 | 119 | */ |
120 | -function lasso_option_form( $name = '', $options = array() ){ |
|
120 | +function lasso_option_form($name = '', $options = array()) { |
|
121 | 121 | |
122 | 122 | ob_start(); |
123 | 123 | |
124 | - if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) |
|
124 | + if (empty($name) || empty($options) || !is_array($options)) |
|
125 | 125 | return; |
126 | 126 | |
127 | 127 | $nonce = wp_create_nonce('lasso-process-post-meta'); |
128 | - $key = sprintf('_lasso_%s_settings', $name ); |
|
128 | + $key = sprintf('_lasso_%s_settings', $name); |
|
129 | 129 | |
130 | - $out = sprintf('<form id="lasso--post-form" class="lasso--post-form">' ); |
|
130 | + $out = sprintf('<form id="lasso--post-form" class="lasso--post-form">'); |
|
131 | 131 | |
132 | - $out .= lasso_option_fields( $name, $options ); |
|
133 | - $out .='<div class="form--bottom">'; |
|
134 | - $out .='<input type="submit" value="Save">'; |
|
135 | - $out .='<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
136 | - $out .='<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
137 | - $out .='<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
138 | - $out .='<input type="hidden" name="action" value="process_meta_update">'; |
|
139 | - $out .='</div>'; |
|
132 | + $out .= lasso_option_fields($name, $options); |
|
133 | + $out .= '<div class="form--bottom">'; |
|
134 | + $out .= '<input type="submit" value="Save">'; |
|
135 | + $out .= '<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
136 | + $out .= '<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
137 | + $out .= '<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
138 | + $out .= '<input type="hidden" name="action" value="process_meta_update">'; |
|
139 | + $out .= '</div>'; |
|
140 | 140 | |
141 | 141 | $out .= '</form>'; |
142 | 142 | |
@@ -154,28 +154,28 @@ discard block |
||
154 | 154 | * @since 0.9.5 |
155 | 155 | * @subpackage lasso_modal_addons_content |
156 | 156 | */ |
157 | -function lasso_option_fields( $name = '', $options = array() ){ |
|
157 | +function lasso_option_fields($name = '', $options = array()) { |
|
158 | 158 | |
159 | - $out = ''; |
|
159 | + $out = ''; |
|
160 | 160 | $before = '<div class="lasso--postsettings__option">'; |
161 | 161 | $after = '</div>'; |
162 | 162 | |
163 | - if ( empty( $name ) || empty( $options ) ) |
|
163 | + if (empty($name) || empty($options)) |
|
164 | 164 | return; |
165 | 165 | |
166 | - foreach ( (array) $options as $option ) { |
|
166 | + foreach ((array) $options as $option) { |
|
167 | 167 | |
168 | - $type = isset( $option['type'] ) ? $option['type'] : 'text'; |
|
168 | + $type = isset($option['type']) ? $option['type'] : 'text'; |
|
169 | 169 | |
170 | - switch ( $type ) { |
|
170 | + switch ($type) { |
|
171 | 171 | case 'text': |
172 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'text' ), $after ); |
|
172 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'text'), $after); |
|
173 | 173 | break; |
174 | 174 | case 'textarea': |
175 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'textarea' ), $after ); |
|
175 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'textarea'), $after); |
|
176 | 176 | break; |
177 | 177 | case 'checkbox': |
178 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'checkbox' ), $after ); |
|
178 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'checkbox'), $after); |
|
179 | 179 | break; |
180 | 180 | } |
181 | 181 | |
@@ -193,27 +193,27 @@ discard block |
||
193 | 193 | * @param $type string text, textarea, checkbox, color |
194 | 194 | * @since 5.0 |
195 | 195 | */ |
196 | -function lasso_option_engine_option( $name = '', $option = '', $type = '') { |
|
196 | +function lasso_option_engine_option($name = '', $option = '', $type = '') { |
|
197 | 197 | |
198 | - if ( empty( $type ) || empty( $option ) ) |
|
198 | + if (empty($type) || empty($option)) |
|
199 | 199 | return; |
200 | 200 | |
201 | - $id = isset( $option['id'] ) ? $option['id'] : false; |
|
202 | - $id = $id ? lasso_clean_string( $id ) : false; |
|
201 | + $id = isset($option['id']) ? $option['id'] : false; |
|
202 | + $id = $id ? lasso_clean_string($id) : false; |
|
203 | 203 | |
204 | - $desc = isset( $option['desc'] ) ? $option['desc'] : false; |
|
204 | + $desc = isset($option['desc']) ? $option['desc'] : false; |
|
205 | 205 | |
206 | - $value = get_post_meta( get_the_id(), $option[ 'id' ], true ); |
|
206 | + $value = get_post_meta(get_the_id(), $option['id'], true); |
|
207 | 207 | |
208 | - switch ( $type ) { |
|
208 | + switch ($type) { |
|
209 | 209 | case 'text': |
210 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" name="%s" type="text" value="%s">',$id, esc_html( $desc ), $id, $id, $value ); |
|
210 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" name="%s" type="text" value="%s">', $id, esc_html($desc), $id, $id, $value); |
|
211 | 211 | break; |
212 | 212 | case 'textarea': |
213 | - $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 ); |
|
213 | + $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); |
|
214 | 214 | break; |
215 | 215 | case 'checkbox': |
216 | - $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 ) ); |
|
216 | + $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)); |
|
217 | 217 | break; |
218 | 218 | } |
219 | 219 |
@@ -15,22 +15,22 @@ |
||
15 | 15 | * |
16 | 16 | * @param array $fields |
17 | 17 | */ |
18 | - public function __construct( $fields ) { |
|
18 | + public function __construct($fields) { |
|
19 | 19 | $this->fields = $fields; |
20 | - add_filter( 'lasso_api_params', function( $params ) { |
|
21 | - foreach( $this->fields as $field => $cbs ) { |
|
22 | - $field = lasso_clean_string( $field ); |
|
23 | - $params[ 'process_meta_update' ][ $field ] = $cbs; |
|
20 | + add_filter('lasso_api_params', function($params) { |
|
21 | + foreach ($this->fields as $field => $cbs) { |
|
22 | + $field = lasso_clean_string($field); |
|
23 | + $params['process_meta_update'][$field] = $cbs; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | return $params; |
27 | 27 | |
28 | 28 | }); |
29 | 29 | |
30 | - add_filter( 'lasso_meta_fields', function( $allowed ) { |
|
30 | + add_filter('lasso_meta_fields', function($allowed) { |
|
31 | 31 | |
32 | - foreach( array_keys( $this->fields ) as $field ) { |
|
33 | - $field = lasso_clean_string( $field ); |
|
32 | + foreach (array_keys($this->fields) as $field) { |
|
33 | + $field = lasso_clean_string($field); |
|
34 | 34 | $allowed[] = $field; |
35 | 35 | |
36 | 36 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | public function __construct() { |
13 | 13 | |
14 | - add_action( 'wp_footer', array( $this, 'draw_tour' ) ); |
|
14 | + add_action('wp_footer', array($this, 'draw_tour')); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function draw_tour() { |
23 | 23 | |
24 | - $tour_hidden = get_user_meta( get_current_user_ID(), 'lasso_hide_tour', true ); |
|
24 | + $tour_hidden = get_user_meta(get_current_user_ID(), 'lasso_hide_tour', true); |
|
25 | 25 | |
26 | - if ( lasso_user_can() && !$tour_hidden ) { |
|
26 | + if (lasso_user_can() && !$tour_hidden) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $nonce = wp_create_nonce( 'lasso-editor-tour' ); |
|
30 | + $nonce = wp_create_nonce('lasso-editor-tour'); |
|
31 | 31 | |
32 | 32 | // let users add custom css classes |
33 | - $custom_classes = apply_filters( 'lasso_modal_tour_classes', '' ); |
|
33 | + $custom_classes = apply_filters('lasso_modal_tour_classes', ''); |
|
34 | 34 | |
35 | 35 | ?> |
36 | - <div id="lasso--tour__modal" class="lasso--modal lasso--tour__modal lasso--modal__checkbox <?php echo sanitize_html_class( $custom_classes );?>"> |
|
36 | + <div id="lasso--tour__modal" class="lasso--modal lasso--tour__modal lasso--modal__checkbox <?php echo sanitize_html_class($custom_classes); ?>"> |
|
37 | 37 | <script> |
38 | 38 | jQuery(window).ready(function($){ |
39 | 39 | |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | </script> |
52 | 52 | <div class="lasso--modal__inner"> |
53 | 53 | |
54 | - <?php echo self::tour_slides();?> |
|
54 | + <?php echo self::tour_slides(); ?> |
|
55 | 55 | |
56 | 56 | <div class="lasso--postsettings__footer"> |
57 | 57 | |
58 | 58 | <div class="lasso--postsettings__option"> |
59 | 59 | <label for="hide_tour" class="checkbox-control checkbox"> |
60 | - <input type="checkbox" id="hide_tour" name="hide_tour" <?php checked( $tour_hidden, 1 ); ?>> |
|
60 | + <input type="checkbox" id="hide_tour" name="hide_tour" <?php checked($tour_hidden, 1); ?>> |
|
61 | 61 | <span class="control-indicator"></span> |
62 | - <?php _e('Don\'t show this again','lasso');?> |
|
62 | + <?php _e('Don\'t show this again', 'lasso'); ?> |
|
63 | 63 | </label> |
64 | 64 | </div> |
65 | 65 | |
66 | - <input type="submit" value="<?php _e( 'Okay, got it!', 'lasso' );?>" data-nonce="<?php echo $nonce;?>" > |
|
66 | + <input type="submit" value="<?php _e('Okay, got it!', 'lasso'); ?>" data-nonce="<?php echo $nonce; ?>" > |
|
67 | 67 | </div> |
68 | 68 | |
69 | 69 | </div> |
@@ -87,20 +87,20 @@ discard block |
||
87 | 87 | <?php |
88 | 88 | |
89 | 89 | $out = '<ul><li>'; |
90 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-1.jpg' ); |
|
91 | - $out .= '<p>'.__('Access posts by clicking the list icon. Create a new post by clicking the new post icon.','lasso').'</p>'; |
|
90 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-1.jpg'); |
|
91 | + $out .= '<p>'.__('Access posts by clicking the list icon. Create a new post by clicking the new post icon.', 'lasso').'</p>'; |
|
92 | 92 | $out .= '</li><li>'; |
93 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-2.jpg' ); |
|
94 | - $out .= '<p>'.__('While on a single post, edit by clicking the Pen icon. Access post settings with the settings icon. Press escape to exit any modal.','lasso').'</p>'; |
|
93 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-2.jpg'); |
|
94 | + $out .= '<p>'.__('While on a single post, edit by clicking the Pen icon. Access post settings with the settings icon. Press escape to exit any modal.', 'lasso').'</p>'; |
|
95 | 95 | $out .= '</li><li>'; |
96 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-3.jpg' ); |
|
97 | - $out .= '<p>'.__('Highlight a piece of text, and click on a formatting option to style it. Click the Disk icon or CMD-S to save. Click the orange "X" button to exit the editor.','lasso').'</p>'; |
|
96 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-3.jpg'); |
|
97 | + $out .= '<p>'.__('Highlight a piece of text, and click on a formatting option to style it. Click the Disk icon or CMD-S to save. Click the orange "X" button to exit the editor.', 'lasso').'</p>'; |
|
98 | 98 | $out .= '</li><li>'; |
99 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-4.jpg' ); |
|
100 | - $out .= '<p>'.__('Story components can be added by clicking the plus icon, and dragging any component from the component tray into the story.','lasso').'</p>'; |
|
99 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-4.jpg'); |
|
100 | + $out .= '<p>'.__('Story components can be added by clicking the plus icon, and dragging any component from the component tray into the story.', 'lasso').'</p>'; |
|
101 | 101 | $out .= '</li></ul>'; |
102 | 102 | |
103 | - echo apply_filters( 'lasso_tour_slides', $out ); |
|
103 | + echo apply_filters('lasso_tour_slides', $out); |
|
104 | 104 | |
105 | 105 | ?></div><?php |
106 | 106 |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( !function_exists( 'lasso_backbone_templates' ) ): |
|
3 | +if (!function_exists('lasso_backbone_templates')): |
|
4 | 4 | |
5 | 5 | add_action('wp_footer', 'lasso_backbone_templates'); |
6 | - function lasso_backbone_templates(){ |
|
6 | + function lasso_backbone_templates() { |
|
7 | 7 | |
8 | 8 | $can_delete = lasso_user_can('delete_others_posts'); |
9 | 9 | $can_delete_class = $can_delete ? false : 'no-delete'; |
10 | 10 | |
11 | 11 | // only run on posts and pages if user is logged in |
12 | - if ( is_user_logged_in() && lasso_user_can('edit_posts') ) { ?> |
|
12 | + if (is_user_logged_in() && lasso_user_can('edit_posts')) { ?> |
|
13 | 13 | <script type="text/html" id="lasso-tmpl--post"> |
14 | 14 | <li> |
15 | - <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class;?> <%= post.status %>" data-postid="<%= post.ID %>" > |
|
15 | + <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class; ?> <%= post.status %>" data-postid="<%= post.ID %>" > |
|
16 | 16 | <%= post.title %> |
17 | 17 | |
18 | 18 | <div class="lasso--post-list__controls"> |
19 | - <span title="<?php echo esc_attr_e('Edit Post','lasso');?>" id="lasso--post__edit"></span> |
|
20 | - <?php if( $can_delete ): ?> |
|
21 | - <span title="<?php echo esc_attr_e('Delete Post','lasso');?>" id="lasso--post__delete"></span> |
|
19 | + <span title="<?php echo esc_attr_e('Edit Post', 'lasso'); ?>" id="lasso--post__edit"></span> |
|
20 | + <?php if ($can_delete): ?> |
|
21 | + <span title="<?php echo esc_attr_e('Delete Post', 'lasso'); ?>" id="lasso--post__delete"></span> |
|
22 | 22 | <?php endif; ?> |
23 | 23 | </div> |
24 | 24 | </a> |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // If uninstall not called from WordPress, then exit |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 |