@@ -131,7 +131,7 @@ |
||
131 | 131 | $bold_tag = lasso_editor_get_option( 'bold_tag', 'lasso_editor', "b"); |
132 | 132 | $i_tag = lasso_editor_get_option( 'i_tag', 'lasso_editor', "i"); |
133 | 133 | |
134 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
134 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
135 | 135 | |
136 | 136 | // do we support pending status |
137 | 137 | $no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); |
49 | 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( ) ); |
|
51 | + $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
52 | 52 | $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
53 | 53 | if (in_array( $post_type,$allowed_post_types)) { |
54 | 54 | $args['show_in_rest'] = true; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - return $args; |
|
60 | + return $args; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -106,25 +106,25 @@ discard block |
||
106 | 106 | //table codes to be added |
107 | 107 | class editus_table { |
108 | 108 | |
109 | - public function __construct(){ |
|
110 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
111 | - if ($add_table) { |
|
112 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
109 | + public function __construct(){ |
|
110 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
111 | + if ($add_table) { |
|
112 | + add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
113 | 113 | |
114 | - } |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | |
117 | - function scripts() |
|
118 | - { |
|
119 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
120 | - add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
121 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
122 | - wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
123 | - wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
124 | - } |
|
117 | + function scripts() |
|
118 | + { |
|
119 | + add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
120 | + add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
121 | + add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
122 | + wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
123 | + wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
124 | + } |
|
125 | 125 | |
126 | - function editus_table_edit_menu() |
|
127 | - { ?> |
|
126 | + function editus_table_edit_menu() |
|
127 | + { ?> |
|
128 | 128 | |
129 | 129 | <ul class='editus-table-menu'> |
130 | 130 | <li data-action="insertcol"><?php echo __('Insert Column','lasso')?></li> |
@@ -133,31 +133,31 @@ discard block |
||
133 | 133 | <li data-action="delrow"><?php echo __('Delete Row','lasso')?></li> |
134 | 134 | </ul> |
135 | 135 | <?php |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | 138 | |
139 | - function editus_html_table() |
|
140 | - { |
|
141 | - return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure>'; |
|
142 | - } |
|
139 | + function editus_html_table() |
|
140 | + { |
|
141 | + return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure>'; |
|
142 | + } |
|
143 | 143 | |
144 | 144 | |
145 | - function editus_components_add_table( $array ){ |
|
146 | - $custom = array( |
|
147 | - 'htmltable' => array( |
|
148 | - 'name' => __('HTML Table','lasso'), |
|
149 | - 'content' => self::editus_html_table(), |
|
150 | - ) |
|
151 | - ); |
|
152 | - return array_merge( $array, $custom ); |
|
153 | - } |
|
145 | + function editus_components_add_table( $array ){ |
|
146 | + $custom = array( |
|
147 | + 'htmltable' => array( |
|
148 | + 'name' => __('HTML Table','lasso'), |
|
149 | + 'content' => self::editus_html_table(), |
|
150 | + ) |
|
151 | + ); |
|
152 | + return array_merge( $array, $custom ); |
|
153 | + } |
|
154 | 154 | |
155 | 155 | |
156 | - function editus_toolbar_components_add_table( ) { |
|
157 | - ?> |
|
156 | + function editus_toolbar_components_add_table( ) { |
|
157 | + ?> |
|
158 | 158 | <li data-type="htmltable" title="<?php esc_attr_e( 'HTML Table', 'lasso' );?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li> |
159 | 159 | <?php |
160 | - } |
|
160 | + } |
|
161 | 161 | } |
162 | 162 | |
163 | 163 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | height: 42px; |
115 | 115 | } |
116 | 116 | <?php |
117 | - } |
|
117 | + } |
|
118 | 118 | } else { |
119 | 119 | ?> |
120 | 120 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | <?php |
126 | - } |
|
127 | - ?> |
|
126 | + } |
|
127 | + ?> |
|
128 | 128 | </style> |
129 | 129 | <div id="lasso--controls" class="lasso-post-status--<?php echo sanitize_html_class( $status );?> <?php echo sanitize_html_class( $custom_classes );?>" data-post-id="<?php echo get_the_ID();?>" > |
130 | 130 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $toolbar_class = $toolbar_headings ? 'toolbar-extended' : false; |
234 | 234 | |
235 | 235 | // mobile styles |
236 | - $mobile_class = $is_mobile ? 'lasso-mobile' : false; |
|
236 | + $mobile_class = $is_mobile ? 'lasso-mobile' : false; |
|
237 | 237 | $mobile_style =$is_mobile ? 'style="bottom:0px;"' : null; |
238 | 238 | |
239 | 239 | //show color |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | </div> |
537 | 537 | <?php |
538 | 538 | if ($allow_change_date) { |
539 | - $dateformat = get_option( 'date_format' ); |
|
539 | + $dateformat = get_option( 'date_format' ); |
|
540 | 540 | ?> |
541 | 541 | <label><?php _e( 'Post Date', 'lasso' ); ?></label> |
542 | 542 | <input type="text" class="editus_custom_date" name="post_date" value="<?php echo get_the_time($dateformat, $postid);?>"/> |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | if ( !empty( $types ) ) { |
652 | 652 | // get the first element |
653 | 653 | $keys = array_keys($types); |
654 | - $type =$keys[0]; |
|
654 | + $type =$keys[0]; |
|
655 | 655 | $type = preg_replace( '/s\b/','', $type ); |
656 | 656 | printf( '<input type="hidden" name="object" value="%s">', lcfirst( esc_attr( $type ) ) ); |
657 | 657 | } |
@@ -679,8 +679,8 @@ discard block |
||
679 | 679 | global $post; |
680 | 680 | |
681 | 681 | global $wp_post_types; |
682 | - $labels = &$wp_post_types['post']->labels; |
|
683 | - $labels->name = 'Articles'; |
|
682 | + $labels = &$wp_post_types['post']->labels; |
|
683 | + $labels->name = 'Articles'; |
|
684 | 684 | |
685 | 685 | ob_start(); |
686 | 686 | |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | $return .= '</form>'; |
924 | 924 | |
925 | 925 | // extra JS codes |
926 | - if (isset($shortcode['codes'])) { |
|
927 | - $return .= $shortcode['codes']; |
|
928 | - } |
|
926 | + if (isset($shortcode['codes'])) { |
|
927 | + $return .= $shortcode['codes']; |
|
928 | + } |
|
929 | 929 | $blob[$slug] = $return; |
930 | 930 | } |
931 | 931 | |
@@ -974,23 +974,23 @@ discard block |
||
974 | 974 | * @return string |
975 | 975 | */ |
976 | 976 | function lasso_editor_adjustBrightness($hex, $steps) { |
977 | - $steps = max(-255, min(255, $steps)); |
|
977 | + $steps = max(-255, min(255, $steps)); |
|
978 | 978 | |
979 | - // Normalize into a six character long hex string |
|
980 | - $hex = str_replace('#', '', $hex); |
|
981 | - if (strlen($hex) == 3) { |
|
982 | - $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
983 | - } |
|
979 | + // Normalize into a six character long hex string |
|
980 | + $hex = str_replace('#', '', $hex); |
|
981 | + if (strlen($hex) == 3) { |
|
982 | + $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
983 | + } |
|
984 | 984 | |
985 | - // Split into three parts: R, G and B |
|
986 | - $color_parts = str_split($hex, 2); |
|
987 | - $return = '#'; |
|
985 | + // Split into three parts: R, G and B |
|
986 | + $color_parts = str_split($hex, 2); |
|
987 | + $return = '#'; |
|
988 | 988 | |
989 | - foreach ($color_parts as $color) { |
|
990 | - $color = hexdec($color); // Convert to decimal |
|
991 | - $color = max(0,min(255,$color + $steps)); // Adjust color |
|
992 | - $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
993 | - } |
|
989 | + foreach ($color_parts as $color) { |
|
990 | + $color = hexdec($color); // Convert to decimal |
|
991 | + $color = max(0,min(255,$color + $steps)); // Adjust color |
|
992 | + $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
993 | + } |
|
994 | 994 | |
995 | - return $return; |
|
995 | + return $return; |
|
996 | 996 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | add_action( 'wp_ajax_editus_featured_img', array( $this, 'set_featured_img' ) ); |
69 | 69 | add_action( 'wp_ajax_editus_del_featured_img', array( $this, 'del_featured_img' ) ); |
70 | 70 | |
71 | - add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
71 | + add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
72 | 72 | |
73 | - add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
74 | - add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
73 | + add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
74 | + add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
75 | 75 | |
76 | 76 | // enable saving custom fields through REST API |
77 | 77 | self::enable_metasave('post'); |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
272 | 272 | } |
273 | 273 | |
274 | - // new ajax function to lock post for editing |
|
274 | + // new ajax function to lock post for editing |
|
275 | 275 | public function editus_lock_post() |
276 | 276 | { |
277 | 277 | $post_id= $_POST["postid"]; |
278 | 278 | $locked = wp_check_post_lock($post_id); |
279 | 279 | |
280 | 280 | if (!$locked) { |
281 | - wp_set_post_lock($post_id); |
|
281 | + wp_set_post_lock($post_id); |
|
282 | 282 | echo "true"; |
283 | 283 | } else { |
284 | 284 | $user_info = get_userdata($locked); |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | { |
292 | 292 | $post_id= $_POST["postid"]; |
293 | 293 | $locked = wp_check_post_lock($post_id); |
294 | - if (!$locked) { |
|
295 | - delete_post_meta( $post_id, '_edit_lock'); |
|
296 | - } |
|
294 | + if (!$locked) { |
|
295 | + delete_post_meta( $post_id, '_edit_lock'); |
|
296 | + } |
|
297 | 297 | echo "true"; |
298 | 298 | |
299 | 299 | exit; |
@@ -405,59 +405,59 @@ discard block |
||
405 | 405 | ); |
406 | 406 | foreach ($_POST as $key => $value) { |
407 | 407 | if ($key !="code" && $key !="action") { |
408 | - //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
408 | + //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
409 | 409 | $atts[$key] = $value; |
410 | 410 | } |
411 | 411 | } |
412 | 412 | if ($code == "aesop_video") { |
413 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
414 | - echo aesop_video_shortcode($atts); |
|
413 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
414 | + echo aesop_video_shortcode($atts); |
|
415 | 415 | } |
416 | 416 | else if ($code == "aesop_image") { |
417 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
418 | - echo aesop_image_shortcode($atts); |
|
417 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
418 | + echo aesop_image_shortcode($atts); |
|
419 | 419 | } |
420 | 420 | else if ($code == "aesop_quote") { |
421 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
422 | - echo aesop_quote_shortcode($atts); |
|
421 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
422 | + echo aesop_quote_shortcode($atts); |
|
423 | 423 | } |
424 | 424 | else if ($code == "aesop_parallax") { |
425 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
426 | - echo aesop_parallax_shortcode($atts); |
|
425 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
426 | + echo aesop_parallax_shortcode($atts); |
|
427 | 427 | } |
428 | 428 | else if ($code == "aesop_character") { |
429 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
430 | - echo aesop_character_shortcode($atts); |
|
429 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
430 | + echo aesop_character_shortcode($atts); |
|
431 | 431 | } |
432 | 432 | else if ($code == "aesop_collection") { |
433 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
434 | - echo aesop_collection_shortcode($atts); |
|
433 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
434 | + echo aesop_collection_shortcode($atts); |
|
435 | 435 | } |
436 | 436 | else if ($code == "aesop_chapter") { |
437 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
438 | - echo aesop_chapter_shortcode($atts); |
|
437 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
438 | + echo aesop_chapter_shortcode($atts); |
|
439 | 439 | } |
440 | 440 | else if ($code == "aesop_content") { |
441 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
442 | - echo aesop_content_shortcode($atts, $atts['content_data']); |
|
441 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
442 | + echo aesop_content_shortcode($atts, $atts['content_data']); |
|
443 | 443 | } |
444 | 444 | else if ($code == "aesop_gallery") { |
445 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
446 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
445 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
446 | + echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
447 | 447 | } |
448 | 448 | else if ($code == "aesop_audio") { |
449 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
450 | - echo aesop_audio_shortcode($atts); |
|
449 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
450 | + echo aesop_audio_shortcode($atts); |
|
451 | 451 | } |
452 | 452 | else { |
453 | 453 | $code = '['.$code.' '; |
454 | 454 | foreach ($atts as $key => $value) { |
455 | - $code = ''.$key.'="'.$value.'" '; |
|
455 | + $code = ''.$key.'="'.$value.'" '; |
|
456 | 456 | } |
457 | 457 | $code = $code.']'; |
458 | 458 | echo do_shortcode($code); |
459 | - //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php'); |
|
460 | - //echo aesop_audio_shortcode($atts); |
|
459 | + //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php'); |
|
460 | + //echo aesop_audio_shortcode($atts); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | exit; |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | exit; |
498 | 498 | } |
499 | 499 | |
500 | - /* This function doesn't actually publish post, but should be called when a post is published */ |
|
501 | - public function on_publish_post( ) { |
|
500 | + /* This function doesn't actually publish post, but should be called when a post is published */ |
|
501 | + public function on_publish_post( ) { |
|
502 | 502 | |
503 | 503 | $post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
504 | 504 | |
505 | - do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
505 | + do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
506 | 506 | |
507 | 507 | exit; |
508 | 508 | } |
@@ -560,14 +560,14 @@ discard block |
||
560 | 560 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
561 | 561 | |
562 | 562 | if ($taxonomy =='category') { |
563 | - // convert from names to category ids |
|
563 | + // convert from names to category ids |
|
564 | 564 | $cats = array(); |
565 | 565 | foreach ($value as $cat) { |
566 | 566 | $cat_id = get_cat_ID($cat); |
567 | 567 | if ($cat_id !=0) { |
568 | 568 | $cats [] = $cat_id; |
569 | 569 | } else if ($allow_new_category) { |
570 | - $cats [] = wp_create_category($cat); |
|
570 | + $cats [] = wp_create_category($cat); |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | $value = $cats; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | } |
588 | 588 | } |
589 | 589 | |
590 | - public function create_gallery( ) { |
|
590 | + public function create_gallery( ) { |
|
591 | 591 | |
592 | 592 | $postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
593 | 593 | |
@@ -641,10 +641,10 @@ discard block |
||
641 | 641 | 'message' => 'gallery-created', |
642 | 642 | 'id' => $postid) |
643 | 643 | ); |
644 | - exit; |
|
644 | + exit; |
|
645 | 645 | } |
646 | 646 | |
647 | - public function update_gallery( ) { |
|
647 | + public function update_gallery( ) { |
|
648 | 648 | |
649 | 649 | $options = isset( $_POST['fields'] ) ? $_POST['fields'] : false; |
650 | 650 | |
@@ -660,12 +660,12 @@ discard block |
||
660 | 660 | |
661 | 661 | self::save_gallery_options( $postid, $gallery_ids, $options, $type ); |
662 | 662 | |
663 | - echo json_encode( array('message' => 'gallery-updated') ); |
|
663 | + echo json_encode( array('message' => 'gallery-updated') ); |
|
664 | 664 | |
665 | - exit; |
|
665 | + exit; |
|
666 | 666 | } |
667 | 667 | |
668 | - public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
668 | + public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
669 | 669 | |
670 | 670 | // gallery width |
671 | 671 | $gallery_width = isset( $options['width'] ) ? $options['width'] : false; |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | public function set_date( $postid, $value) { |
750 | 750 | if( $value ) { |
751 | 751 | $value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 )); |
752 | - wp_update_post( |
|
752 | + wp_update_post( |
|
753 | 753 | array ( |
754 | 754 | 'ID' => $postid, // ID of the post to update |
755 | 755 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
@@ -15,29 +15,29 @@ discard block |
||
15 | 15 | add_action('wp_enqueue_scripts', array($this,'scripts')); |
16 | 16 | } |
17 | 17 | |
18 | - function is_multipage() |
|
19 | - { |
|
20 | - global $post; |
|
21 | - $pos = strpos($post->post_content, "<!--nextpage-->"); |
|
22 | - if (!$pos) return -1; |
|
18 | + function is_multipage() |
|
19 | + { |
|
20 | + global $post; |
|
21 | + $pos = strpos($post->post_content, "<!--nextpage-->"); |
|
22 | + if (!$pos) return -1; |
|
23 | 23 | |
24 | - global $wp; |
|
25 | - $url = home_url( $wp->request ); |
|
26 | - $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1; |
|
27 | - return $index; |
|
28 | - } |
|
24 | + global $wp; |
|
25 | + $url = home_url( $wp->request ); |
|
26 | + $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1; |
|
27 | + return $index; |
|
28 | + } |
|
29 | 29 | |
30 | 30 | public function scripts(){ |
31 | 31 | |
32 | 32 | |
33 | 33 | global $post; |
34 | 34 | if ( lasso_user_can('edit_posts') |
35 | - /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
36 | - /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
37 | - ) { |
|
35 | + /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
36 | + /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
37 | + ) { |
|
38 | 38 | |
39 | 39 | /** Returns the time offset from UTC |
40 | - */ |
|
40 | + */ |
|
41 | 41 | function get_UTC_offset() { |
42 | 42 | $timezone_string = get_option( 'timezone_string' ); |
43 | 43 | if (empty( $timezone_string ) ) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
54 | 54 | |
55 | - //don't load autocomplete if it's a stockholm theme |
|
55 | + //don't load autocomplete if it's a stockholm theme |
|
56 | 56 | $themename = wp_get_theme()->get('Name'); |
57 | 57 | if ($themename !='Stockholm' ) { |
58 | 58 | wp_enqueue_script('jquery-ui-autocomplete'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $tz_offset = get_UTC_offset(); |
127 | 127 | $post_date = get_the_time('U', $postid); |
128 | 128 | $time = (time()+$tz_offset); |
129 | - $delta = $time - $post_date; |
|
129 | + $delta = $time - $post_date; |
|
130 | 130 | |
131 | 131 | $strings = array( |
132 | 132 | 'save' => __('Save','lasso'), |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
182 | 182 | |
183 | 183 | |
184 | - if ($allow_change_date) { |
|
185 | - $permalink = get_site_url().'/?p='.$postid; |
|
186 | - } else { |
|
187 | - $permalink = get_permalink($postid); |
|
188 | - } |
|
184 | + if ($allow_change_date) { |
|
185 | + $permalink = get_site_url().'/?p='.$postid; |
|
186 | + } else { |
|
187 | + $permalink = get_permalink($postid); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | // rest api |
191 | 191 | $rest_nonce = ''; |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - //find if this is multi page. -1 if not |
|
209 | - $multipage = self::is_multipage(); |
|
210 | - $post_content = ""; |
|
211 | - //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
212 | - if ($multipage != -1) { |
|
213 | - $post_content = $post->post_content; |
|
214 | - } |
|
208 | + //find if this is multi page. -1 if not |
|
209 | + $multipage = self::is_multipage(); |
|
210 | + $post_content = ""; |
|
211 | + //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
212 | + if ($multipage != -1) { |
|
213 | + $post_content = $post->post_content; |
|
214 | + } |
|
215 | 215 | |
216 | 216 | // localized objects |
217 | 217 | $objects = array( |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | 'customFields' => $custom_fields, |
288 | 288 | 'clickToInsert' => ($insert_comp_ui =='click'), |
289 | 289 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
290 | - 'rtl' => is_rtl(), |
|
290 | + 'rtl' => is_rtl(), |
|
291 | 291 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
292 | 292 | 'linksEditable' => $links_editable, |
293 | 293 | 'supportPendingStatus' => !$no_pending_status, |
294 | 294 | 'tableCode' => apply_filters( 'lasso_table_html_code','<table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table>'), |
295 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
296 | - 'multipages'=> $multipage, |
|
297 | - 'post_content'=>$post_content |
|
295 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
296 | + 'multipages'=> $multipage, |
|
297 | + 'post_content'=>$post_content |
|
298 | 298 | ); |
299 | 299 | |
300 | 300 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | |
304 | 304 | if (!$using_restapiv2) { |
305 | - // enqueue REST API V1 |
|
305 | + // enqueue REST API V1 |
|
306 | 306 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
307 | 307 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
308 | 308 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | if ($show_color) { |
319 | 319 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
320 | 320 | } else { |
321 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
321 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
322 | 322 | } |
323 | 323 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
324 | 324 | |
@@ -327,44 +327,44 @@ discard block |
||
327 | 327 | |
328 | 328 | } |
329 | 329 | |
330 | - function gutenberg_active() { |
|
330 | + function gutenberg_active() { |
|
331 | 331 | |
332 | - // Gutenberg plugin is installed and activated. |
|
333 | - $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
334 | - |
|
335 | - // Block editor since 5.0. |
|
336 | - $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
337 | - |
|
338 | - if ( ! $gutenberg && ! $block_editor ) { |
|
339 | - return false; |
|
340 | - } |
|
341 | - |
|
342 | - if ( self::is_classic_editor_plugin_active() ) { |
|
343 | - $editor_option = get_option( 'classic-editor-replace' ); |
|
344 | - $block_editor_active = array( 'no-replace', 'block' ); |
|
345 | - |
|
346 | - return in_array( $editor_option, $block_editor_active, true ); |
|
347 | - } |
|
348 | - |
|
349 | - return true; |
|
350 | - } |
|
351 | - |
|
352 | - /** |
|
353 | - * Check if Classic Editor plugin is active. |
|
354 | - * |
|
355 | - * @return bool |
|
356 | - */ |
|
357 | - function is_classic_editor_plugin_active() { |
|
358 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
359 | - include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
360 | - } |
|
361 | - |
|
362 | - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
363 | - return true; |
|
364 | - } |
|
365 | - |
|
366 | - return false; |
|
367 | - } |
|
332 | + // Gutenberg plugin is installed and activated. |
|
333 | + $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
334 | + |
|
335 | + // Block editor since 5.0. |
|
336 | + $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
337 | + |
|
338 | + if ( ! $gutenberg && ! $block_editor ) { |
|
339 | + return false; |
|
340 | + } |
|
341 | + |
|
342 | + if ( self::is_classic_editor_plugin_active() ) { |
|
343 | + $editor_option = get_option( 'classic-editor-replace' ); |
|
344 | + $block_editor_active = array( 'no-replace', 'block' ); |
|
345 | + |
|
346 | + return in_array( $editor_option, $block_editor_active, true ); |
|
347 | + } |
|
348 | + |
|
349 | + return true; |
|
350 | + } |
|
351 | + |
|
352 | + /** |
|
353 | + * Check if Classic Editor plugin is active. |
|
354 | + * |
|
355 | + * @return bool |
|
356 | + */ |
|
357 | + function is_classic_editor_plugin_active() { |
|
358 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
359 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
360 | + } |
|
361 | + |
|
362 | + if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
363 | + return true; |
|
364 | + } |
|
365 | + |
|
366 | + return false; |
|
367 | + } |
|
368 | 368 | |
369 | 369 | } |
370 | 370 |