@@ -61,6 +61,10 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | +/** |
|
65 | + * @param string $option |
|
66 | + * @param string $section |
|
67 | + */ |
|
64 | 68 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
65 | 69 | |
66 | 70 | if ( empty( $option ) ) |
@@ -18,27 +18,27 @@ discard block |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | // If this file is called directly, abort. |
21 | -if ( ! defined( 'WPINC' ) ) { |
|
21 | +if (!defined('WPINC')) { |
|
22 | 22 | die; |
23 | 23 | } |
24 | 24 | |
25 | 25 | // Set some constants |
26 | -define( 'LASSO_VERSION', '0.9.16.0' ); |
|
27 | -define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) ); |
|
28 | -define( 'LASSO_URL', plugins_url( '', __FILE__ ) ); |
|
29 | -define( 'LASSO_FILE', __FILE__ ); |
|
26 | +define('LASSO_VERSION', '0.9.16.0'); |
|
27 | +define('LASSO_DIR', plugin_dir_path(__FILE__)); |
|
28 | +define('LASSO_URL', plugins_url('', __FILE__)); |
|
29 | +define('LASSO_FILE', __FILE__); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Load plugin if PHP version is 5.4 or later. |
33 | 33 | */ |
34 | -if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) { |
|
34 | +if (version_compare(PHP_VERSION, '5.4.0', '>=')) { |
|
35 | 35 | |
36 | - include_once( LASSO_DIR . '/bootstrap.php' ); |
|
36 | + include_once(LASSO_DIR.'/bootstrap.php'); |
|
37 | 37 | |
38 | 38 | } else { |
39 | 39 | |
40 | 40 | add_action('admin_head', 'lasso_fail_notice'); |
41 | - function lasso_fail_notice(){ |
|
41 | + function lasso_fail_notice() { |
|
42 | 42 | |
43 | 43 | printf('<div class="error"><p>Lasso requires PHP 5.4 or higher.</p></div>'); |
44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); |
49 | -function lasso_show_in_rest($args, $post_type){ |
|
49 | +function lasso_show_in_rest($args, $post_type) { |
|
50 | 50 | |
51 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
52 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
53 | - if (in_array( $post_type,$allowed_post_types)) { |
|
51 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array( )); |
|
52 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
53 | + if (in_array($post_type, $allowed_post_types)) { |
|
54 | 54 | $args['show_in_rest'] = true; |
55 | 55 | if ($post_type != 'post' && $post_type != 'page') { |
56 | 56 | $args['rest_base'] = $post_type; |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | -function lasso_editor_get_option( $option, $section, $default = '' ) { |
|
64 | +function lasso_editor_get_option($option, $section, $default = '') { |
|
65 | 65 | |
66 | - if ( empty( $option ) ) |
|
66 | + if (empty($option)) |
|
67 | 67 | return; |
68 | 68 | |
69 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
69 | + if (function_exists('is_multisite') && is_multisite()) { |
|
70 | 70 | |
71 | - $options = get_site_option( $section ); |
|
71 | + $options = get_site_option($section); |
|
72 | 72 | |
73 | 73 | } else { |
74 | 74 | |
75 | - $options = get_option( $section ); |
|
75 | + $options = get_option($section); |
|
76 | 76 | } |
77 | 77 | |
78 | - if ( isset( $options[$option] ) ) { |
|
78 | + if (isset($options[$option])) { |
|
79 | 79 | return $options[$option]; |
80 | 80 | } |
81 | 81 |
@@ -63,8 +63,9 @@ |
||
63 | 63 | |
64 | 64 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
65 | 65 | |
66 | - if ( empty( $option ) ) |
|
67 | - return; |
|
66 | + if ( empty( $option ) ) { |
|
67 | + return; |
|
68 | + } |
|
68 | 69 | |
69 | 70 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
70 | 71 |
@@ -13,6 +13,11 @@ discard block |
||
13 | 13 | * @since 1.0 |
14 | 14 | */ |
15 | 15 | if( !function_exists('lasso_editor_get_option')): |
16 | + |
|
17 | + /** |
|
18 | + * @param string $option |
|
19 | + * @param string $section |
|
20 | + */ |
|
16 | 21 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
17 | 22 | |
18 | 23 | if ( empty( $option ) ) |
@@ -216,7 +221,7 @@ discard block |
||
216 | 221 | * Return an array of categories for autocomplete |
217 | 222 | * |
218 | 223 | * @since 0.9.3 |
219 | - * @return array all categoiries |
|
224 | + * @return null|string all categoiries |
|
220 | 225 | */ |
221 | 226 | function lasso_get_objects( $taxonomy = 'category' ) { |
222 | 227 | |
@@ -309,7 +314,7 @@ discard block |
||
309 | 314 | * Used internally as a callback to build a tab or content area for modal addons |
310 | 315 | * |
311 | 316 | * @param $tab object |
312 | -* @param $type string tab or content |
|
317 | +* @param string $type string tab or content |
|
313 | 318 | * @uses lasso_modal_addons() |
314 | 319 | * @since 0.9.4 |
315 | 320 | */ |
@@ -12,22 +12,22 @@ discard block |
||
12 | 12 | * @return the option value |
13 | 13 | * @since 1.0 |
14 | 14 | */ |
15 | -if( !function_exists('lasso_editor_get_option')): |
|
16 | - function lasso_editor_get_option( $option, $section, $default = '' ) { |
|
15 | +if (!function_exists('lasso_editor_get_option')): |
|
16 | + function lasso_editor_get_option($option, $section, $default = '') { |
|
17 | 17 | |
18 | - if ( empty( $option ) ) |
|
18 | + if (empty($option)) |
|
19 | 19 | return; |
20 | 20 | |
21 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
21 | + if (function_exists('is_multisite') && is_multisite()) { |
|
22 | 22 | |
23 | - $options = get_site_option( $section ); |
|
23 | + $options = get_site_option($section); |
|
24 | 24 | |
25 | 25 | } else { |
26 | 26 | |
27 | - $options = get_option( $section ); |
|
27 | + $options = get_option($section); |
|
28 | 28 | } |
29 | 29 | |
30 | - if ( isset( $options[$option] ) ) { |
|
30 | + if (isset($options[$option])) { |
|
31 | 31 | return $options[$option]; |
32 | 32 | } |
33 | 33 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function lasso_editor_galleries_exist() { |
44 | 44 | |
45 | - $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
|
45 | + $q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish')); |
|
46 | 46 | |
47 | - if ( $q->have_posts() ) |
|
47 | + if ($q->have_posts()) |
|
48 | 48 | return true; |
49 | 49 | else |
50 | 50 | return false; |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | function lasso_get_supported_theme_class() { |
60 | 60 | |
61 | 61 | $name = wp_get_theme()->get('Name'); |
62 | - $slug = lasso_clean_string( $name ); |
|
62 | + $slug = lasso_clean_string($name); |
|
63 | 63 | |
64 | - switch ( $slug ) { |
|
64 | + switch ($slug) { |
|
65 | 65 | case 'aesop-story-theme': // aesop |
66 | 66 | $out = '.aesop-entry-content'; |
67 | 67 | break; |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | |
111 | 111 | } |
112 | 112 | |
113 | - return apply_filters('lasso_content_class', !empty( $out ) ? $out : false); |
|
113 | + return apply_filters('lasso_content_class', !empty($out) ? $out : false); |
|
114 | 114 | //return !empty( $out ) ? $out : false; |
115 | 115 | } |
116 | 116 | |
117 | 117 | function lasso_get_supported_theme_title_class() { |
118 | 118 | |
119 | 119 | $name = wp_get_theme()->get('Name'); |
120 | - $slug = lasso_clean_string( $name ); |
|
120 | + $slug = lasso_clean_string($name); |
|
121 | 121 | |
122 | - switch ( $slug ) { |
|
122 | + switch ($slug) { |
|
123 | 123 | |
124 | 124 | case 'aesop-story-theme': // aesop |
125 | 125 | $out = '.aesop-entry-title'; |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | break; |
148 | 148 | } |
149 | 149 | |
150 | - return apply_filters('lasso_title_class', !empty( $out ) ? $out : false); |
|
150 | + return apply_filters('lasso_title_class', !empty($out) ? $out : false); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | //since 0.9.9.6 |
154 | 154 | function lasso_get_supported_theme_featured_image_class() { |
155 | 155 | |
156 | 156 | $name = wp_get_theme()->get('Name'); |
157 | - $slug = lasso_clean_string( $name ); |
|
157 | + $slug = lasso_clean_string($name); |
|
158 | 158 | |
159 | - return apply_filters('lasso_featured_image_class', !empty( $out ) ? $out : false); |
|
159 | + return apply_filters('lasso_featured_image_class', !empty($out) ? $out : false); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @since 0.8.7 |
168 | 168 | * @return string of comma separated classes |
169 | 169 | */ |
170 | -function lasso_supported_no_save(){ |
|
170 | +function lasso_supported_no_save() { |
|
171 | 171 | |
172 | 172 | return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .meta, .edit-link, .ssba, .jp-relatedposts, .fb-comments'); |
173 | 173 | } |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return array|mixed|object|string|void |
183 | 183 | */ |
184 | -function lasso_sanitize_data( $data ) { |
|
185 | - return \lasso\sanatize::do_sanitize( $data ); |
|
184 | +function lasso_sanitize_data($data) { |
|
185 | + return \lasso\sanatize::do_sanitize($data); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -192,18 +192,18 @@ discard block |
||
192 | 192 | * @since 0.9.3 |
193 | 193 | * @return string of comma delimited category slugs |
194 | 194 | */ |
195 | -function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
|
195 | +function lasso_get_post_objects($postid = '', $taxonomy = 'category') { |
|
196 | 196 | |
197 | - if ( empty( $postid ) ) |
|
197 | + if (empty($postid)) |
|
198 | 198 | $postid = get_the_ID(); |
199 | 199 | |
200 | - $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
|
200 | + $objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid); |
|
201 | 201 | |
202 | - if ( empty( $objects) ) |
|
202 | + if (empty($objects)) |
|
203 | 203 | return; |
204 | 204 | |
205 | 205 | $out = ''; |
206 | - foreach( $objects as $object ) { |
|
206 | + foreach ($objects as $object) { |
|
207 | 207 | //$out .= $object->slug.', '; |
208 | 208 | $out .= $object->name.','; |
209 | 209 | } |
@@ -218,15 +218,15 @@ discard block |
||
218 | 218 | * @since 0.9.3 |
219 | 219 | * @return array all categoiries |
220 | 220 | */ |
221 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
221 | +function lasso_get_objects($taxonomy = 'category') { |
|
222 | 222 | |
223 | 223 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
224 | 224 | |
225 | - if ( empty( $objects) ) |
|
225 | + if (empty($objects)) |
|
226 | 226 | return; |
227 | 227 | |
228 | 228 | $out = ""; |
229 | - foreach( $objects as $object ) { |
|
229 | + foreach ($objects as $object) { |
|
230 | 230 | $out .= $object->name.','; |
231 | 231 | } |
232 | 232 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | * @since 0.9.4 |
242 | 242 | */ |
243 | 243 | function lasso_post_types_names() { |
244 | - $post_types = get_post_types( array( |
|
244 | + $post_types = get_post_types(array( |
|
245 | 245 | 'public' => true, |
246 | - ), 'objects' ); |
|
247 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
248 | - unset( $post_types[ 'attachment' ] ); |
|
246 | + ), 'objects'); |
|
247 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
248 | + unset($post_types['attachment']); |
|
249 | 249 | |
250 | 250 | /** |
251 | 251 | * Set which post types are allowed |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
256 | 256 | */ |
257 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
258 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
257 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
258 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
259 | 259 | if (!current_user_can('edit_pages')) { |
260 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
260 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
261 | 261 | } |
262 | - foreach( $post_types as $name => $label ) { |
|
263 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
264 | - unset( $post_types[ $name ] ); |
|
262 | + foreach ($post_types as $name => $label) { |
|
263 | + if (!in_array($name, $allowed_post_types)) { |
|
264 | + unset($post_types[$name]); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | return $post_types; |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | |
270 | 270 | |
271 | 271 | function lasso_post_types() { |
272 | - $post_types = get_post_types( array( |
|
272 | + $post_types = get_post_types(array( |
|
273 | 273 | 'public' => true, |
274 | - ), 'names' ); |
|
275 | - unset( $post_types[ 'attachment' ] ); |
|
274 | + ), 'names'); |
|
275 | + unset($post_types['attachment']); |
|
276 | 276 | |
277 | 277 | /** |
278 | 278 | * Set which post types are allowed |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
283 | 283 | */ |
284 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') ); |
|
285 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
286 | - foreach( $post_types as $name => $label ) { |
|
287 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
288 | - unset( $post_types[ $name ] ); |
|
284 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post')); |
|
285 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
286 | + foreach ($post_types as $name => $label) { |
|
287 | + if (!in_array($name, $allowed_post_types)) { |
|
288 | + unset($post_types[$name]); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | return $post_types; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | global $wp_post_types; |
296 | 296 | $post_types = lasso_post_types(); |
297 | 297 | $rest_base = array(); |
298 | - foreach ( $post_types as $post_type) { |
|
298 | + foreach ($post_types as $post_type) { |
|
299 | 299 | $rest_base[$post_type] = $wp_post_types[$post_type]->rest_base; |
300 | 300 | } |
301 | 301 | |
@@ -313,22 +313,22 @@ discard block |
||
313 | 313 | * @uses lasso_modal_addons() |
314 | 314 | * @since 0.9.4 |
315 | 315 | */ |
316 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
316 | +function lasso_modal_addons_content($tab = '', $type) { |
|
317 | 317 | |
318 | - $name = lasso_clean_string( $tab['name'] ); |
|
318 | + $name = lasso_clean_string($tab['name']); |
|
319 | 319 | |
320 | - if ( 'tab' == $type ) { |
|
320 | + if ('tab' == $type) { |
|
321 | 321 | |
322 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
322 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
323 | 323 | |
324 | - } else if ( 'content' == $type ){ |
|
324 | + } else if ('content' == $type) { |
|
325 | 325 | |
326 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
327 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
326 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
327 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
328 | 328 | |
329 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
329 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
330 | 330 | %s%s |
331 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
331 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
332 | 332 | |
333 | 333 | } |
334 | 334 | |
@@ -343,12 +343,12 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return void|string |
345 | 345 | */ |
346 | -function lasso_clean_string( $string = '' ) { |
|
346 | +function lasso_clean_string($string = '') { |
|
347 | 347 | |
348 | - if ( empty( $string ) ) |
|
348 | + if (empty($string)) |
|
349 | 349 | return; |
350 | 350 | |
351 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
351 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | * |
362 | 362 | * @return void|string |
363 | 363 | */ |
364 | -function lasso_unclean_string( $string = '' ) { |
|
364 | +function lasso_unclean_string($string = '') { |
|
365 | 365 | |
366 | - if ( empty( $string ) ) { |
|
366 | + if (empty($string)) { |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
370 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
370 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -382,39 +382,39 @@ discard block |
||
382 | 382 | * @param unknown $postid int the id of the post object to check against |
383 | 383 | * @since 0.9.9.7 added filter 'lasso_user_can_filter' |
384 | 384 | */ |
385 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
386 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
385 | +if (!function_exists('lasso_user_can')): |
|
386 | + function lasso_user_can($action = '', $postid = 0) { |
|
387 | 387 | $result = false; |
388 | - if ( empty( $action ) ) |
|
388 | + if (empty($action)) |
|
389 | 389 | $action = 'edit_posts'; |
390 | 390 | |
391 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
391 | + if (empty($postid) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
392 | 392 | $postid = get_the_ID(); |
393 | 393 | |
394 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
394 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
395 | 395 | // check against post types: |
396 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
396 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
397 | 397 | |
398 | 398 | if (!current_user_can('edit_pages')) { |
399 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
399 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | if (!empty($allowed_post_types) && !empty($postid)) { |
403 | - $type = get_post_type( $postid ); |
|
404 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
403 | + $type = get_post_type($postid); |
|
404 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
405 | 405 | |
406 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
407 | - $result = true; |
|
406 | + if (in_array($type, $allowed_post_types)) { |
|
407 | + $result = true; |
|
408 | 408 | } |
409 | 409 | } else { |
410 | 410 | //we are not checking against a post, return true |
411 | - $result = true; |
|
411 | + $result = true; |
|
412 | 412 | } |
413 | 413 | } else { |
414 | 414 | $result = false; |
415 | 415 | } |
416 | 416 | |
417 | - return apply_filters( 'lasso_user_can_filter', $result, $action, $postid); |
|
417 | + return apply_filters('lasso_user_can_filter', $result, $action, $postid); |
|
418 | 418 | } |
419 | 419 | endif; |
420 | 420 | |
@@ -423,25 +423,25 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @since 0.9.5 |
425 | 425 | */ |
426 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
426 | +if (!function_exists('lasso_editor_empty_results')): |
|
427 | 427 | |
428 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
428 | + function lasso_editor_empty_results($type = 'posts') { |
|
429 | 429 | |
430 | - if ( 'posts' == $type ) { |
|
430 | + if ('posts' == $type) { |
|
431 | 431 | |
432 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
432 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
433 | 433 | $icon = 'lasso-icon-file-text2'; |
434 | 434 | $button = false; |
435 | 435 | |
436 | - } elseif ( 'revision' == $type ) { |
|
436 | + } elseif ('revision' == $type) { |
|
437 | 437 | |
438 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
438 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
439 | 439 | $icon = 'lasso-icon-history'; |
440 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
440 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
441 | 441 | |
442 | 442 | } |
443 | 443 | |
444 | - 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 ); |
|
444 | + 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); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | endif; |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | if( !function_exists('lasso_editor_get_option')): |
16 | 16 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
17 | 17 | |
18 | - if ( empty( $option ) ) |
|
19 | - return; |
|
18 | + if ( empty( $option ) ) { |
|
19 | + return; |
|
20 | + } |
|
20 | 21 | |
21 | 22 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
22 | 23 | |
@@ -44,11 +45,12 @@ discard block |
||
44 | 45 | |
45 | 46 | $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
46 | 47 | |
47 | - if ( $q->have_posts() ) |
|
48 | - return true; |
|
49 | - else |
|
50 | - return false; |
|
51 | -} |
|
48 | + if ( $q->have_posts() ) { |
|
49 | + return true; |
|
50 | + } else { |
|
51 | + return false; |
|
52 | + } |
|
53 | + } |
|
52 | 54 | |
53 | 55 | /** |
54 | 56 | * Return a CSS class of an automatically supported theme |
@@ -194,13 +196,15 @@ discard block |
||
194 | 196 | */ |
195 | 197 | function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
196 | 198 | |
197 | - if ( empty( $postid ) ) |
|
198 | - $postid = get_the_ID(); |
|
199 | + if ( empty( $postid ) ) { |
|
200 | + $postid = get_the_ID(); |
|
201 | + } |
|
199 | 202 | |
200 | 203 | $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
201 | 204 | |
202 | - if ( empty( $objects) ) |
|
203 | - return; |
|
205 | + if ( empty( $objects) ) { |
|
206 | + return; |
|
207 | + } |
|
204 | 208 | |
205 | 209 | $out = ''; |
206 | 210 | foreach( $objects as $object ) { |
@@ -222,8 +226,9 @@ discard block |
||
222 | 226 | |
223 | 227 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
224 | 228 | |
225 | - if ( empty( $objects) ) |
|
226 | - return; |
|
229 | + if ( empty( $objects) ) { |
|
230 | + return; |
|
231 | + } |
|
227 | 232 | |
228 | 233 | $out = ""; |
229 | 234 | foreach( $objects as $object ) { |
@@ -345,8 +350,9 @@ discard block |
||
345 | 350 | */ |
346 | 351 | function lasso_clean_string( $string = '' ) { |
347 | 352 | |
348 | - if ( empty( $string ) ) |
|
349 | - return; |
|
353 | + if ( empty( $string ) ) { |
|
354 | + return; |
|
355 | + } |
|
350 | 356 | |
351 | 357 | return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
352 | 358 | } |
@@ -385,11 +391,13 @@ discard block |
||
385 | 391 | if ( !function_exists( 'lasso_user_can' ) ): |
386 | 392 | function lasso_user_can( $action = '', $postid = 0 ) { |
387 | 393 | $result = false; |
388 | - if ( empty( $action ) ) |
|
389 | - $action = 'edit_posts'; |
|
394 | + if ( empty( $action ) ) { |
|
395 | + $action = 'edit_posts'; |
|
396 | + } |
|
390 | 397 | |
391 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
392 | - $postid = get_the_ID(); |
|
398 | + if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') { |
|
399 | + $postid = get_the_ID(); |
|
400 | + } |
|
393 | 401 | |
394 | 402 | if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
395 | 403 | // check against post types: |