@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | * If we're on multsite we'll grab the site option which is stored in the main blogs site option tables, otherwise |
7 | 7 | * we'll grab the option which is stored on the single blogs option tables |
8 | 8 | * |
9 | - * @param unknown $option string name of the option |
|
10 | - * @param unknown $section string name of the section |
|
9 | + * @param string $option string name of the option |
|
10 | + * @param string $section string name of the section |
|
11 | 11 | * @param unknown $default string/int default option value |
12 | 12 | * @return the option value |
13 | 13 | * @since 1.0 |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * Return an array of categories for autocomplete |
215 | 215 | * |
216 | 216 | * @since 0.9.3 |
217 | - * @return array all categoiries |
|
217 | + * @return null|string all categoiries |
|
218 | 218 | */ |
219 | 219 | function lasso_get_objects( $taxonomy = 'category' ) { |
220 | 220 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * Used internally as a callback to build a tab or content area for modal addons |
300 | 300 | * |
301 | 301 | * @param $tab object |
302 | -* @param $type string tab or content |
|
302 | +* @param string $type string tab or content |
|
303 | 303 | * @uses lasso_modal_addons() |
304 | 304 | * @since 0.9.4 |
305 | 305 | */ |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | 'public' => true, |
244 | 244 | ), 'objects' ); |
245 | 245 | $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
246 | - unset( $post_types[ 'attachment' ] ); |
|
246 | + unset( $post_types[ 'attachment' ] ); |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Set which post types are allowed |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | 'public' => true, |
272 | 272 | ), 'names' ); |
273 | 273 | //$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
274 | - unset( $post_types[ 'attachment' ] ); |
|
274 | + unset( $post_types[ 'attachment' ] ); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Set which post types are allowed |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | */ |
375 | 375 | if ( !function_exists( 'lasso_user_can' ) ): |
376 | 376 | function lasso_user_can( $action = '', $postid = 0 ) { |
377 | - $result = false; |
|
377 | + $result = false; |
|
378 | 378 | if ( empty( $action ) ) |
379 | 379 | $action = 'edit_posts'; |
380 | 380 | |
@@ -389,17 +389,17 @@ discard block |
||
389 | 389 | $allowed_post_types = array_diff($allowed_post_types,array('page')); |
390 | 390 | } |
391 | 391 | |
392 | - if (!empty($allowed_post_types) && !empty($postid)) { |
|
392 | + if (!empty($allowed_post_types) && !empty($postid)) { |
|
393 | 393 | $type = get_post_type( $postid ); |
394 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
394 | + $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
395 | 395 | |
396 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
396 | + if ( in_array( $type, $allowed_post_types ) ) { |
|
397 | 397 | $result = true; |
398 | - } |
|
399 | - } else { |
|
400 | - //we are not checking against a post, return true |
|
398 | + } |
|
399 | + } else { |
|
400 | + //we are not checking against a post, return true |
|
401 | 401 | $result = true; |
402 | - } |
|
402 | + } |
|
403 | 403 | } else { |
404 | 404 | $result = false; |
405 | 405 | } |
@@ -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 | case 'aesop-story-theme': // aesop |
64 | 64 | $out = '.aesop-entry-content'; |
65 | 65 | break; |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters('lasso_content_class', !empty( $out ) ? $out : false); |
|
111 | + return apply_filters('lasso_content_class', !empty($out) ? $out : false); |
|
112 | 112 | //return !empty( $out ) ? $out : false; |
113 | 113 | } |
114 | 114 | |
115 | 115 | function lasso_get_supported_theme_title_class() { |
116 | 116 | |
117 | 117 | $name = wp_get_theme()->get('Name'); |
118 | - $slug = lasso_clean_string( $name ); |
|
118 | + $slug = lasso_clean_string($name); |
|
119 | 119 | |
120 | - switch ( $slug ) { |
|
120 | + switch ($slug) { |
|
121 | 121 | |
122 | 122 | case 'aesop-story-theme': // aesop |
123 | 123 | $out = '.aesop-entry-title'; |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | break; |
146 | 146 | } |
147 | 147 | |
148 | - return apply_filters('lasso_title_class', !empty( $out ) ? $out : false); |
|
148 | + return apply_filters('lasso_title_class', !empty($out) ? $out : false); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | //since 0.9.9.6 |
152 | 152 | function lasso_get_supported_theme_featured_image_class() { |
153 | 153 | |
154 | 154 | $name = wp_get_theme()->get('Name'); |
155 | - $slug = lasso_clean_string( $name ); |
|
155 | + $slug = lasso_clean_string($name); |
|
156 | 156 | |
157 | - return apply_filters('lasso_featured_image_class', !empty( $out ) ? $out : false); |
|
157 | + return apply_filters('lasso_featured_image_class', !empty($out) ? $out : false); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @since 0.8.7 |
166 | 166 | * @return string of comma separated classes |
167 | 167 | */ |
168 | -function lasso_supported_no_save(){ |
|
168 | +function lasso_supported_no_save() { |
|
169 | 169 | |
170 | 170 | return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .twitter-tweet, .meta, .edit-link, .ssba, .jp-relatedposts, .fb-comments'); |
171 | 171 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return array|mixed|object|string|void |
181 | 181 | */ |
182 | -function lasso_sanitize_data( $data ) { |
|
183 | - return \lasso\sanatize::do_sanitize( $data ); |
|
182 | +function lasso_sanitize_data($data) { |
|
183 | + return \lasso\sanatize::do_sanitize($data); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | * @since 0.9.3 |
191 | 191 | * @return string of comma delimited category slugs |
192 | 192 | */ |
193 | -function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
|
193 | +function lasso_get_post_objects($postid = '', $taxonomy = 'category') { |
|
194 | 194 | |
195 | - if ( empty( $postid ) ) |
|
195 | + if (empty($postid)) |
|
196 | 196 | $postid = get_the_ID(); |
197 | 197 | |
198 | - $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
|
198 | + $objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid); |
|
199 | 199 | |
200 | - if ( empty( $objects) ) |
|
200 | + if (empty($objects)) |
|
201 | 201 | return; |
202 | 202 | |
203 | 203 | $out = ''; |
204 | - foreach( $objects as $object ) { |
|
204 | + foreach ($objects as $object) { |
|
205 | 205 | //$out .= $object->slug.', '; |
206 | 206 | $out .= $object->name.', '; |
207 | 207 | } |
@@ -216,15 +216,15 @@ discard block |
||
216 | 216 | * @since 0.9.3 |
217 | 217 | * @return array all categoiries |
218 | 218 | */ |
219 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
219 | +function lasso_get_objects($taxonomy = 'category') { |
|
220 | 220 | |
221 | 221 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
222 | 222 | |
223 | - if ( empty( $objects) ) |
|
223 | + if (empty($objects)) |
|
224 | 224 | return; |
225 | 225 | |
226 | 226 | $out = ""; |
227 | - foreach( $objects as $object ) { |
|
227 | + foreach ($objects as $object) { |
|
228 | 228 | $out .= $object->name.','; |
229 | 229 | } |
230 | 230 | |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @since 0.9.4 |
240 | 240 | */ |
241 | 241 | function lasso_post_types_names() { |
242 | - $post_types = get_post_types( array( |
|
242 | + $post_types = get_post_types(array( |
|
243 | 243 | 'public' => true, |
244 | - ), 'objects' ); |
|
245 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
246 | - unset( $post_types[ 'attachment' ] ); |
|
244 | + ), 'objects'); |
|
245 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
246 | + unset($post_types['attachment']); |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Set which post types are allowed |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
254 | 254 | */ |
255 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
256 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
255 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
256 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
257 | 257 | if (!current_user_can('edit_pages')) { |
258 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
258 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
259 | 259 | } |
260 | - foreach( $post_types as $name => $label ) { |
|
261 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
262 | - unset( $post_types[ $name ] ); |
|
260 | + foreach ($post_types as $name => $label) { |
|
261 | + if (!in_array($name, $allowed_post_types)) { |
|
262 | + unset($post_types[$name]); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | return $post_types; |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | |
268 | 268 | |
269 | 269 | function lasso_post_types() { |
270 | - $post_types = get_post_types( array( |
|
270 | + $post_types = get_post_types(array( |
|
271 | 271 | 'public' => true, |
272 | - ), 'names' ); |
|
272 | + ), 'names'); |
|
273 | 273 | //$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
274 | - unset( $post_types[ 'attachment' ] ); |
|
274 | + unset($post_types['attachment']); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Set which post types are allowed |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
282 | 282 | */ |
283 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') ); |
|
284 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
285 | - foreach( $post_types as $name => $label ) { |
|
286 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
287 | - unset( $post_types[ $name ] ); |
|
283 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post')); |
|
284 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
285 | + foreach ($post_types as $name => $label) { |
|
286 | + if (!in_array($name, $allowed_post_types)) { |
|
287 | + unset($post_types[$name]); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | return $post_types; |
@@ -303,22 +303,22 @@ discard block |
||
303 | 303 | * @uses lasso_modal_addons() |
304 | 304 | * @since 0.9.4 |
305 | 305 | */ |
306 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
306 | +function lasso_modal_addons_content($tab = '', $type) { |
|
307 | 307 | |
308 | - $name = lasso_clean_string( $tab['name'] ); |
|
308 | + $name = lasso_clean_string($tab['name']); |
|
309 | 309 | |
310 | - if ( 'tab' == $type ) { |
|
310 | + if ('tab' == $type) { |
|
311 | 311 | |
312 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
312 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
313 | 313 | |
314 | - } else if ( 'content' == $type ){ |
|
314 | + } else if ('content' == $type) { |
|
315 | 315 | |
316 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
317 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
316 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
317 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
318 | 318 | |
319 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
319 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
320 | 320 | %s%s |
321 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
321 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -333,12 +333,12 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @return void|string |
335 | 335 | */ |
336 | -function lasso_clean_string( $string = '' ) { |
|
336 | +function lasso_clean_string($string = '') { |
|
337 | 337 | |
338 | - if ( empty( $string ) ) |
|
338 | + if (empty($string)) |
|
339 | 339 | return; |
340 | 340 | |
341 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
341 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @return void|string |
353 | 353 | */ |
354 | -function lasso_unclean_string( $string = '' ) { |
|
354 | +function lasso_unclean_string($string = '') { |
|
355 | 355 | |
356 | - if ( empty( $string ) ) { |
|
356 | + if (empty($string)) { |
|
357 | 357 | return; |
358 | 358 | } |
359 | 359 | |
360 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
360 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -372,39 +372,39 @@ discard block |
||
372 | 372 | * @param unknown $postid int the id of the post object to check against |
373 | 373 | * @since 0.9.9.7 added filter 'lasso_user_can_filter' |
374 | 374 | */ |
375 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
376 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
375 | +if (!function_exists('lasso_user_can')): |
|
376 | + function lasso_user_can($action = '', $postid = 0) { |
|
377 | 377 | $result = false; |
378 | - if ( empty( $action ) ) |
|
378 | + if (empty($action)) |
|
379 | 379 | $action = 'edit_posts'; |
380 | 380 | |
381 | - if ( empty( $postid ) ) |
|
381 | + if (empty($postid)) |
|
382 | 382 | $postid = get_the_ID(); |
383 | 383 | |
384 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
384 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
385 | 385 | // check against post types: |
386 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
386 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
387 | 387 | |
388 | 388 | if (!current_user_can('edit_pages')) { |
389 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
389 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | if (!empty($allowed_post_types) && !empty($postid)) { |
393 | - $type = get_post_type( $postid ); |
|
394 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
393 | + $type = get_post_type($postid); |
|
394 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
395 | 395 | |
396 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
397 | - $result = true; |
|
396 | + if (in_array($type, $allowed_post_types)) { |
|
397 | + $result = true; |
|
398 | 398 | } |
399 | 399 | } else { |
400 | 400 | //we are not checking against a post, return true |
401 | - $result = true; |
|
401 | + $result = true; |
|
402 | 402 | } |
403 | 403 | } else { |
404 | 404 | $result = false; |
405 | 405 | } |
406 | 406 | |
407 | - return apply_filters( 'lasso_user_can_filter', $result, $action, $postid); |
|
407 | + return apply_filters('lasso_user_can_filter', $result, $action, $postid); |
|
408 | 408 | } |
409 | 409 | endif; |
410 | 410 | |
@@ -413,25 +413,25 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @since 0.9.5 |
415 | 415 | */ |
416 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
416 | +if (!function_exists('lasso_editor_empty_results')): |
|
417 | 417 | |
418 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
418 | + function lasso_editor_empty_results($type = 'posts') { |
|
419 | 419 | |
420 | - if ( 'posts' == $type ) { |
|
420 | + if ('posts' == $type) { |
|
421 | 421 | |
422 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
422 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
423 | 423 | $icon = 'lasso-icon-file-text2'; |
424 | 424 | $button = false; |
425 | 425 | |
426 | - } elseif ( 'revision' == $type ) { |
|
426 | + } elseif ('revision' == $type) { |
|
427 | 427 | |
428 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
428 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
429 | 429 | $icon = 'lasso-icon-history'; |
430 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
430 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
431 | 431 | |
432 | 432 | } |
433 | 433 | |
434 | - 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 ); |
|
434 | + 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); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | endif; |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
16 | 16 | |
17 | - if ( empty( $option ) ) |
|
18 | - return; |
|
17 | + if ( empty( $option ) ) { |
|
18 | + return; |
|
19 | + } |
|
19 | 20 | |
20 | 21 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
21 | 22 | |
@@ -42,11 +43,12 @@ discard block |
||
42 | 43 | |
43 | 44 | $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
44 | 45 | |
45 | - if ( $q->have_posts() ) |
|
46 | - return true; |
|
47 | - else |
|
48 | - return false; |
|
49 | -} |
|
46 | + if ( $q->have_posts() ) { |
|
47 | + return true; |
|
48 | + } else { |
|
49 | + return false; |
|
50 | + } |
|
51 | + } |
|
50 | 52 | |
51 | 53 | /** |
52 | 54 | * Return a CSS class of an automatically supported theme |
@@ -192,13 +194,15 @@ discard block |
||
192 | 194 | */ |
193 | 195 | function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
194 | 196 | |
195 | - if ( empty( $postid ) ) |
|
196 | - $postid = get_the_ID(); |
|
197 | + if ( empty( $postid ) ) { |
|
198 | + $postid = get_the_ID(); |
|
199 | + } |
|
197 | 200 | |
198 | 201 | $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
199 | 202 | |
200 | - if ( empty( $objects) ) |
|
201 | - return; |
|
203 | + if ( empty( $objects) ) { |
|
204 | + return; |
|
205 | + } |
|
202 | 206 | |
203 | 207 | $out = ''; |
204 | 208 | foreach( $objects as $object ) { |
@@ -220,8 +224,9 @@ discard block |
||
220 | 224 | |
221 | 225 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
222 | 226 | |
223 | - if ( empty( $objects) ) |
|
224 | - return; |
|
227 | + if ( empty( $objects) ) { |
|
228 | + return; |
|
229 | + } |
|
225 | 230 | |
226 | 231 | $out = ""; |
227 | 232 | foreach( $objects as $object ) { |
@@ -335,8 +340,9 @@ discard block |
||
335 | 340 | */ |
336 | 341 | function lasso_clean_string( $string = '' ) { |
337 | 342 | |
338 | - if ( empty( $string ) ) |
|
339 | - return; |
|
343 | + if ( empty( $string ) ) { |
|
344 | + return; |
|
345 | + } |
|
340 | 346 | |
341 | 347 | return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
342 | 348 | } |
@@ -375,11 +381,13 @@ discard block |
||
375 | 381 | if ( !function_exists( 'lasso_user_can' ) ): |
376 | 382 | function lasso_user_can( $action = '', $postid = 0 ) { |
377 | 383 | $result = false; |
378 | - if ( empty( $action ) ) |
|
379 | - $action = 'edit_posts'; |
|
384 | + if ( empty( $action ) ) { |
|
385 | + $action = 'edit_posts'; |
|
386 | + } |
|
380 | 387 | |
381 | - if ( empty( $postid ) ) |
|
382 | - $postid = get_the_ID(); |
|
388 | + if ( empty( $postid ) ) { |
|
389 | + $postid = get_the_ID(); |
|
390 | + } |
|
383 | 391 | |
384 | 392 | if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
385 | 393 | // check against post types: |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | -if ( lasso_user_can( 'edit_posts' ) && ! is_admin() ) { |
|
10 | - add_filter( 'the_content', 'lasso_wrap_shortcodes', 9 ); |
|
9 | +if (lasso_user_can('edit_posts') && !is_admin()) { |
|
10 | + add_filter('the_content', 'lasso_wrap_shortcodes', 9); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -20,33 +20,33 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return string |
22 | 22 | */ |
23 | -function lasso_wrap_shortcodes( $content ) { |
|
23 | +function lasso_wrap_shortcodes($content) { |
|
24 | 24 | global $shortcode_tags; |
25 | 25 | |
26 | - if ( false === strpos( $content, '[' ) ) { |
|
26 | + if (false === strpos($content, '[')) { |
|
27 | 27 | return $content; |
28 | 28 | } |
29 | 29 | |
30 | - if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { |
|
30 | + if (empty($shortcode_tags) || !is_array($shortcode_tags)) { |
|
31 | 31 | return $content; |
32 | 32 | } |
33 | 33 | |
34 | - $tagnames = array_keys( $shortcode_tags ); |
|
35 | - $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) ); |
|
34 | + $tagnames = array_keys($shortcode_tags); |
|
35 | + $tagregexp = join('|', array_map('preg_quote', $tagnames)); |
|
36 | 36 | $pattern = "/\\[($tagregexp)/s"; |
37 | 37 | |
38 | - if ( 0 === preg_match( $pattern, $content ) ) { |
|
38 | + if (0 === preg_match($pattern, $content)) { |
|
39 | 39 | // Avoids parsing HTML when there are no shortcodes or embeds anyway. |
40 | 40 | return $content; |
41 | 41 | } |
42 | 42 | |
43 | - $content = do_shortcodes_in_html_tags( $content, true ,$tagnames); |
|
43 | + $content = do_shortcodes_in_html_tags($content, true, $tagnames); |
|
44 | 44 | |
45 | 45 | $pattern = get_shortcode_regex(); |
46 | - $content = preg_replace_callback( "/$pattern/s", 'lasso_wrap_shortcode_tag', $content ); |
|
46 | + $content = preg_replace_callback("/$pattern/s", 'lasso_wrap_shortcode_tag', $content); |
|
47 | 47 | |
48 | 48 | // Always restore square braces so we don't break things like <!--[if IE ]> |
49 | - $content = unescape_invalid_shortcodes( $content ); |
|
49 | + $content = unescape_invalid_shortcodes($content); |
|
50 | 50 | |
51 | 51 | return $content; |
52 | 52 | } |
@@ -60,32 +60,32 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | -function lasso_wrap_shortcode_tag( $m ) { |
|
63 | +function lasso_wrap_shortcode_tag($m) { |
|
64 | 64 | // allow [[foo]] syntax for escaping a tag |
65 | - if ( $m[1] == '[' && $m[6] == ']' ) { |
|
66 | - return substr( $m[0], 1, - 1 ); |
|
65 | + if ($m[1] == '[' && $m[6] == ']') { |
|
66 | + return substr($m[0], 1, - 1); |
|
67 | 67 | } |
68 | - $exception_arr1 = array('aesop_gallery_pop','aesop_character_carousel'); |
|
69 | - $exception_arr2 = array('su_box', 'su_note', 'su_document', 'su_spoiler','av_textblock','av_toggle_container','av_toggle'); |
|
68 | + $exception_arr1 = array('aesop_gallery_pop', 'aesop_character_carousel'); |
|
69 | + $exception_arr2 = array('su_box', 'su_note', 'su_document', 'su_spoiler', 'av_textblock', 'av_toggle_container', 'av_toggle'); |
|
70 | 70 | |
71 | - if ( strpos( $m[2],'aesop_' ) === 0 ) { |
|
71 | + if (strpos($m[2], 'aesop_') === 0) { |
|
72 | 72 | // check against the exceptions |
73 | - if (strpos_arr($m[2],$exception_arr1)===false) { |
|
73 | + if (strpos_arr($m[2], $exception_arr1) === false) { |
|
74 | 74 | return $m[0]; |
75 | 75 | } |
76 | 76 | } |
77 | - if (strpos_arr($m[2],$exception_arr2)!==false) { |
|
77 | + if (strpos_arr($m[2], $exception_arr2) !== false) { |
|
78 | 78 | return $m[0]; |
79 | 79 | } |
80 | 80 | |
81 | - return '<!--EDITUS_OTHER_SHORTCODE_START|[' . $m[0] . ']-->' . $m[0] . '<!--EDITUS_OTHER_SHORTCODE_END-->'; |
|
81 | + return '<!--EDITUS_OTHER_SHORTCODE_START|['.$m[0].']-->'.$m[0].'<!--EDITUS_OTHER_SHORTCODE_END-->'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /* a helper function */ |
85 | 85 | function strpos_arr($haystack, $needle) { |
86 | - if(!is_array($needle)) $needle = array($needle); |
|
87 | - foreach($needle as $what) { |
|
88 | - if(($pos = strpos($haystack, $what))!==false) return $pos; |
|
86 | + if (!is_array($needle)) $needle = array($needle); |
|
87 | + foreach ($needle as $what) { |
|
88 | + if (($pos = strpos($haystack, $what)) !== false) return $pos; |
|
89 | 89 | } |
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | \ No newline at end of file |
@@ -10,15 +10,15 @@ discard block |
||
10 | 10 | |
11 | 11 | class assets { |
12 | 12 | |
13 | - public function __construct(){ |
|
13 | + public function __construct() { |
|
14 | 14 | |
15 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
15 | + add_action('wp_enqueue_scripts', array($this, 'scripts')); |
|
16 | 16 | } |
17 | 17 | |
18 | - public function scripts(){ |
|
18 | + public function scripts() { |
|
19 | 19 | |
20 | 20 | |
21 | - if ( lasso_user_can('edit_posts')) { |
|
21 | + if (lasso_user_can('edit_posts')) { |
|
22 | 22 | |
23 | 23 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
24 | 24 | |
@@ -33,22 +33,22 @@ discard block |
||
33 | 33 | // url for json api |
34 | 34 | $home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false; |
35 | 35 | |
36 | - $article_object = lasso_editor_get_option('article_class','lasso_editor'); |
|
36 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
37 | 37 | |
38 | - $article_object = empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
38 | + $article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
39 | 39 | |
40 | - $featImgClass = lasso_editor_get_option('featimg_class','lasso_editor'); |
|
41 | - if (empty( $featImgClass )) { |
|
40 | + $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
41 | + if (empty($featImgClass)) { |
|
42 | 42 | $featImgClass = lasso_get_supported_theme_featured_image_class(); |
43 | 43 | } |
44 | - $titleClass = lasso_editor_get_option('title_class','lasso_editor'); |
|
45 | - if (empty( $titleClass )) { |
|
44 | + $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
45 | + if (empty($titleClass)) { |
|
46 | 46 | $titleClass = lasso_get_supported_theme_title_class(); |
47 | 47 | } |
48 | - $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
49 | - $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
48 | + $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
49 | + $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
50 | 50 | $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
51 | - $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
51 | + $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
52 | 52 | $disableRESTSave = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor'); |
53 | 53 | |
54 | 54 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | if ($show_color) { |
62 | 62 | //color picker |
63 | - wp_enqueue_style( 'wp-color-picker' ); |
|
64 | - wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); |
|
63 | + wp_enqueue_style('wp-color-picker'); |
|
64 | + wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,59 +73,59 @@ discard block |
||
73 | 73 | $delta = time() - $post_date; |
74 | 74 | |
75 | 75 | $strings = array( |
76 | - 'save' => __('Save','lasso'), |
|
77 | - 'saving' => __('Saving...','lasso'), |
|
78 | - 'saved' => __('Saved!','lasso'), |
|
79 | - 'adding' => __('Adding...','lasso'), |
|
80 | - 'added' => __('Added!','lasso'), |
|
81 | - 'loading' => __('Loading...','lasso'), |
|
82 | - 'loadMore' => __('Load More','lasso'), |
|
83 | - 'noPostsFound' => __('No more posts found','lasso'), |
|
84 | - 'fetchFail' => __('Fetching failed.','lasso'), |
|
85 | - 'galleryCreated' => __('Gallery Created!','lasso'), |
|
86 | - 'galleryUpdated' => __('Gallery Updated!','lasso'), |
|
87 | - 'justWrite' => __('Just write...','lasso'), |
|
88 | - 'chooseImage' => __('Choose an image','lasso'), |
|
89 | - 'updateImage' => __('Update Image','lasso'), |
|
90 | - 'insertImage' => __('Insert Image','lasso'), |
|
91 | - 'selectImage' => __('Select Image','lasso'), |
|
92 | - 'removeFeatImg' => __('Remove featured image?','lasso'), |
|
93 | - 'updateSelectedImg' => __('Update Selected Image','lasso'), |
|
94 | - 'chooseImages' => __('Choose images','lasso'), |
|
95 | - 'editImage' => __('Edit Image','lasso'), |
|
96 | - 'addImages' => __('Add Images','lasso'), |
|
97 | - 'addNewGallery' => __('Add New Gallery','lasso'), |
|
98 | - 'selectGallery' => __('Select Lasso Gallery Image','lasso'), |
|
99 | - 'useSelectedImages' => __('Use Selected Images','lasso'), |
|
100 | - 'publishPost' => __('Publish Post?','lasso'), |
|
101 | - 'publishYes' => __('Yes, publish it!','lasso'), |
|
102 | - 'deletePost' => __('Trash Post?','lasso'), |
|
103 | - 'deleteYes' => __('Yes, trash it!','lasso'), |
|
104 | - 'warning' => __('Oh snap!','laso'), |
|
105 | - 'cancelText' => __('O.K. got it!','lasso'), |
|
106 | - 'missingClass' => __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.','lasso'), |
|
76 | + 'save' => __('Save', 'lasso'), |
|
77 | + 'saving' => __('Saving...', 'lasso'), |
|
78 | + 'saved' => __('Saved!', 'lasso'), |
|
79 | + 'adding' => __('Adding...', 'lasso'), |
|
80 | + 'added' => __('Added!', 'lasso'), |
|
81 | + 'loading' => __('Loading...', 'lasso'), |
|
82 | + 'loadMore' => __('Load More', 'lasso'), |
|
83 | + 'noPostsFound' => __('No more posts found', 'lasso'), |
|
84 | + 'fetchFail' => __('Fetching failed.', 'lasso'), |
|
85 | + 'galleryCreated' => __('Gallery Created!', 'lasso'), |
|
86 | + 'galleryUpdated' => __('Gallery Updated!', 'lasso'), |
|
87 | + 'justWrite' => __('Just write...', 'lasso'), |
|
88 | + 'chooseImage' => __('Choose an image', 'lasso'), |
|
89 | + 'updateImage' => __('Update Image', 'lasso'), |
|
90 | + 'insertImage' => __('Insert Image', 'lasso'), |
|
91 | + 'selectImage' => __('Select Image', 'lasso'), |
|
92 | + 'removeFeatImg' => __('Remove featured image?', 'lasso'), |
|
93 | + 'updateSelectedImg' => __('Update Selected Image', 'lasso'), |
|
94 | + 'chooseImages' => __('Choose images', 'lasso'), |
|
95 | + 'editImage' => __('Edit Image', 'lasso'), |
|
96 | + 'addImages' => __('Add Images', 'lasso'), |
|
97 | + 'addNewGallery' => __('Add New Gallery', 'lasso'), |
|
98 | + 'selectGallery' => __('Select Lasso Gallery Image', 'lasso'), |
|
99 | + 'useSelectedImages' => __('Use Selected Images', 'lasso'), |
|
100 | + 'publishPost' => __('Publish Post?', 'lasso'), |
|
101 | + 'publishYes' => __('Yes, publish it!', 'lasso'), |
|
102 | + 'deletePost' => __('Trash Post?', 'lasso'), |
|
103 | + 'deleteYes' => __('Yes, trash it!', 'lasso'), |
|
104 | + 'warning' => __('Oh snap!', 'laso'), |
|
105 | + 'cancelText' => __('O.K. got it!', 'lasso'), |
|
106 | + 'missingClass' => __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.', 'lasso'), |
|
107 | 107 | 'missingConfirm' => __('Update Settings', 'lasso'), |
108 | - 'helperText' => __('one more letter','lasso'), |
|
108 | + 'helperText' => __('one more letter', 'lasso'), |
|
109 | 109 | 'editingBackup' => __('You are currently editing a backup copy of this post.'), |
110 | 110 | ); |
111 | 111 | |
112 | - $api_url = trailingslashit( home_url() ) . 'lasso-internal-api'; |
|
112 | + $api_url = trailingslashit(home_url()).'lasso-internal-api'; |
|
113 | 113 | |
114 | 114 | $gallery_class = new gallery(); |
115 | 115 | $gallery_nonce_action = $gallery_class->nonce_action; |
116 | - $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
|
116 | + $gallery_nonce = wp_create_nonce($gallery_nonce_action); |
|
117 | 117 | $rest_nonce = ''; |
118 | - $rest_root =''; |
|
118 | + $rest_root = ''; |
|
119 | 119 | if (function_exists('rest_url')) { |
120 | - $rest_root = esc_url_raw( rest_url()); |
|
121 | - $rest_nonce = wp_create_nonce( 'wp_rest' ); |
|
122 | - $settings = array( 'root' => $rest_root, 'nonce' => $rest_nonce ); |
|
120 | + $rest_root = esc_url_raw(rest_url()); |
|
121 | + $rest_nonce = wp_create_nonce('wp_rest'); |
|
122 | + $settings = array('root' => $rest_root, 'nonce' => $rest_nonce); |
|
123 | 123 | //wp_enqueue_script( 'wp-api' ); |
124 | - wp_enqueue_script( 'wp-api', '', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
125 | - wp_localize_script( 'wp-api', 'wpApiSettings', $settings ); |
|
126 | - wp_localize_script( 'wp-api', 'WP_API_Settings', $settings ); |
|
124 | + wp_enqueue_script('wp-api', '', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
125 | + wp_localize_script('wp-api', 'wpApiSettings', $settings); |
|
126 | + wp_localize_script('wp-api', 'WP_API_Settings', $settings); |
|
127 | 127 | |
128 | - if ( class_exists( 'WP_REST_Controller' )) { |
|
128 | + if (class_exists('WP_REST_Controller')) { |
|
129 | 129 | // we are using REST API V2 |
130 | 130 | $using_restapiv2 = true; |
131 | 131 | } |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | |
134 | 134 | // localized objects |
135 | 135 | $objects = array( |
136 | - 'ajaxurl' => esc_url( $api_url ), |
|
137 | - 'ajaxurl2' => esc_url( admin_url( 'admin-ajax.php' )), |
|
136 | + 'ajaxurl' => esc_url($api_url), |
|
137 | + 'ajaxurl2' => esc_url(admin_url('admin-ajax.php')), |
|
138 | 138 | 'rest_root' => $rest_root, |
139 | 139 | 'rest_nonce' => $rest_nonce, |
140 | 140 | 'editor' => 'lasso--content', // ID of editable content (without #) DONT CHANGE |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | 'featImgClass' => $featImgClass, |
143 | 143 | 'titleClass' => $titleClass, |
144 | 144 | 'strings' => $strings, |
145 | - 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ), |
|
146 | - 'post_status' => get_post_status( $postid ), |
|
145 | + 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), |
|
146 | + 'post_status' => get_post_status($postid), |
|
147 | 147 | 'postid' => $postid, |
148 | 148 | 'permalink' => get_permalink(), |
149 | 149 | 'edit_others_pages' => current_user_can('edit_others_pages') ? true : false, |
150 | 150 | 'edit_others_posts' => current_user_can('edit_others_posts') ? true : false, |
151 | - 'userCanEdit' => current_user_can('edit_post', $postid ), |
|
151 | + 'userCanEdit' => current_user_can('edit_post', $postid), |
|
152 | 152 | 'can_publish_posts' => current_user_can('publish_posts'), |
153 | 153 | 'can_publish_pages' => current_user_can('publish_pages'), |
154 | 154 | 'author' => is_user_logged_in() ? get_current_user_ID() : false, |
@@ -183,20 +183,20 @@ discard block |
||
183 | 183 | 'postTags' => lasso_get_objects('tag'), |
184 | 184 | 'noResultsDiv' => lasso_editor_empty_results(), |
185 | 185 | 'noRevisionsDiv' => lasso_editor_empty_results('revision'), |
186 | - 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false, |
|
187 | - 'mapLocations' => get_post_meta( $postid, 'ase_map_component_locations' ), |
|
188 | - 'mapStart' => get_post_meta( $postid, 'ase_map_component_start_point', true ), |
|
189 | - 'mapZoom' => get_post_meta( $postid, 'ase_map_component_zoom', true ), |
|
186 | + 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, |
|
187 | + 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), |
|
188 | + 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), |
|
189 | + 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), |
|
190 | 190 | 'revisionModal' => lasso_editor_revision_modal(), |
191 | 191 | 'isMobile' => wp_is_mobile(), |
192 | - 'enableAutoSave' => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ), |
|
192 | + 'enableAutoSave' => lasso_editor_get_option('enable_autosave', 'lasso_editor'), |
|
193 | 193 | 'showColor' => $show_color, |
194 | 194 | 'showAlignment' => $show_align, |
195 | 195 | 'showIgnoredItems' => lasso_editor_get_option('show_ignored_items', 'lasso_editor'), |
196 | 196 | 'restapi2' => $using_restapiv2, |
197 | 197 | 'saveusingrest' => $using_restapiv2 && !$disableRESTSave, |
198 | - 'newObjectContent' => apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ), |
|
199 | - 'skipToEdit' =>( $delta < 30 ) // if it's a new post, skip to edit mode |
|
198 | + 'newObjectContent' => apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')), |
|
199 | + 'skipToEdit' =>($delta < 30) // if it's a new post, skip to edit mode |
|
200 | 200 | ); |
201 | 201 | |
202 | 202 | |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | |
206 | 206 | if (!$using_restapiv2) { |
207 | 207 | // enqueue REST API V1 |
208 | - wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
209 | - $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
|
210 | - wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
|
208 | + wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
209 | + $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json')); |
|
210 | + wp_localize_script('wp-api-js', 'WP_API_Settings', $settings); |
|
211 | 211 | } |
212 | 212 | |
213 | - $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
|
213 | + $postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min'; |
|
214 | 214 | if ($show_color) { |
215 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'iris'), LASSO_VERSION, true); |
|
215 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'iris'), LASSO_VERSION, true); |
|
216 | 216 | } else { |
217 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true); |
|
217 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true); |
|
218 | 218 | } |
219 | - wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
|
219 | + wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects)); |
|
220 | 220 | |
221 | 221 | |
222 | 222 | } |
@@ -18,27 +18,27 @@ |
||
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.14.6' ); |
|
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.14.6'); |
|
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 |