@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | add_action( 'wp_ajax_get_aesop_component', array( $this, 'get_aesop_component' ) ); |
| 61 | 61 | add_action( 'wp_ajax_editus_do_shortcode', array( $this, 'editus_do_shortcode' ) ); |
| 62 | - add_action( 'wp_ajax_editus_do_block', array( $this, 'editus_do_block' ) ); |
|
| 62 | + add_action( 'wp_ajax_editus_do_block', array( $this, 'editus_do_block' ) ); |
|
| 63 | 63 | add_action( 'wp_ajax_editus_lock_post', array( $this, 'editus_lock_post' ) ); |
| 64 | 64 | add_action( 'wp_ajax_editus_unlock_post', array( $this, 'editus_unlock_post' ) ); |
| 65 | 65 | add_action( 'wp_ajax_editus_hide_tour', array( $this, 'editus_hide_tour' ) ); |
@@ -69,19 +69,19 @@ discard block |
||
| 69 | 69 | add_action( 'wp_ajax_editus_featured_img', array( $this, 'set_featured_img' ) ); |
| 70 | 70 | add_action( 'wp_ajax_editus_del_featured_img', array( $this, 'del_featured_img' ) ); |
| 71 | 71 | |
| 72 | - add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
| 72 | + add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
| 73 | 73 | |
| 74 | - add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
| 75 | - add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
| 74 | + add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
| 75 | + add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
| 76 | 76 | |
| 77 | 77 | // enable saving custom fields through REST API |
| 78 | 78 | self::enable_metasave('post'); |
| 79 | 79 | self::enable_metasave('page'); |
| 80 | 80 | |
| 81 | - $default_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page')); |
|
| 81 | + $default_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page')); |
|
| 82 | 82 | $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', $default_post_types); |
| 83 | - foreach ( $allowed_post_types as $post_type ) { |
|
| 84 | - self::enable_metasave($post_type); |
|
| 83 | + foreach ( $allowed_post_types as $post_type ) { |
|
| 84 | + self::enable_metasave($post_type); |
|
| 85 | 85 | } |
| 86 | 86 | //enqueue assets |
| 87 | 87 | new assets(); |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - // new ajax function to lock post for editing |
|
| 281 | + // new ajax function to lock post for editing |
|
| 282 | 282 | public function editus_lock_post() |
| 283 | 283 | { |
| 284 | 284 | $post_id= $_POST["postid"]; |
| 285 | 285 | $locked = wp_check_post_lock($post_id); |
| 286 | 286 | |
| 287 | 287 | if (!$locked) { |
| 288 | - wp_set_post_lock($post_id); |
|
| 288 | + wp_set_post_lock($post_id); |
|
| 289 | 289 | echo "true"; |
| 290 | 290 | } else { |
| 291 | 291 | $user_info = get_userdata($locked); |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | { |
| 299 | 299 | $post_id= $_POST["postid"]; |
| 300 | 300 | $locked = wp_check_post_lock($post_id); |
| 301 | - if (!$locked) { |
|
| 302 | - delete_post_meta( $post_id, '_edit_lock'); |
|
| 303 | - } |
|
| 301 | + if (!$locked) { |
|
| 302 | + delete_post_meta( $post_id, '_edit_lock'); |
|
| 303 | + } |
|
| 304 | 304 | echo "true"; |
| 305 | 305 | |
| 306 | 306 | exit; |
@@ -328,14 +328,14 @@ discard block |
||
| 328 | 328 | $status = isset( $data['status'] ) ? $data['status'] : false; |
| 329 | 329 | $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
| 330 | 330 | $slug = isset( $data['story_slug'] ) ? $data['story_slug'] : false; |
| 331 | - $excerpt = isset( $data['excerpt'] ) ? $data['excerpt'] : false; |
|
| 331 | + $excerpt = isset( $data['excerpt'] ) ? $data['excerpt'] : false; |
|
| 332 | 332 | |
| 333 | 333 | |
| 334 | 334 | $args = array( |
| 335 | 335 | 'ID' => (int) $postid, |
| 336 | 336 | 'post_name' => $slug, |
| 337 | 337 | 'post_status' => $status, |
| 338 | - 'post_excerpt' => wp_strip_all_tags($excerpt,true) |
|
| 338 | + 'post_excerpt' => wp_strip_all_tags($excerpt,true) |
|
| 339 | 339 | ); |
| 340 | 340 | |
| 341 | 341 | |
@@ -410,12 +410,12 @@ discard block |
||
| 410 | 410 | exit; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - public function editus_do_block() |
|
| 413 | + public function editus_do_block() |
|
| 414 | 414 | { |
| 415 | 415 | |
| 416 | 416 | $code= $_POST["code"]; |
| 417 | 417 | |
| 418 | - $out = do_blocks( $code ); |
|
| 418 | + $out = do_blocks( $code ); |
|
| 419 | 419 | |
| 420 | 420 | echo $out; |
| 421 | 421 | exit; |
@@ -434,63 +434,63 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | if ($code == "aesop_video") { |
| 437 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 438 | - echo aesop_video_shortcode($atts); |
|
| 437 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 438 | + echo aesop_video_shortcode($atts); |
|
| 439 | 439 | } |
| 440 | 440 | else if ($code == "aesop_image") { |
| 441 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 442 | - echo aesop_image_shortcode($atts); |
|
| 441 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 442 | + echo aesop_image_shortcode($atts); |
|
| 443 | 443 | } |
| 444 | 444 | else if ($code == "aesop_quote") { |
| 445 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 446 | - echo aesop_quote_shortcode($atts); |
|
| 445 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 446 | + echo aesop_quote_shortcode($atts); |
|
| 447 | 447 | } |
| 448 | 448 | else if ($code == "aesop_parallax") { |
| 449 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 450 | - echo aesop_parallax_shortcode($atts); |
|
| 449 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 450 | + echo aesop_parallax_shortcode($atts); |
|
| 451 | 451 | } |
| 452 | 452 | else if ($code == "aesop_character") { |
| 453 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 454 | - echo aesop_character_shortcode($atts); |
|
| 453 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 454 | + echo aesop_character_shortcode($atts); |
|
| 455 | 455 | } |
| 456 | 456 | else if ($code == "aesop_collection") { |
| 457 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 458 | - echo aesop_collection_shortcode($atts); |
|
| 457 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 458 | + echo aesop_collection_shortcode($atts); |
|
| 459 | 459 | } |
| 460 | 460 | else if ($code == "aesop_chapter") { |
| 461 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 462 | - echo aesop_chapter_shortcode($atts); |
|
| 461 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 462 | + echo aesop_chapter_shortcode($atts); |
|
| 463 | 463 | } |
| 464 | 464 | else if ($code == "aesop_content") { |
| 465 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 466 | - echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 465 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 466 | + echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 467 | 467 | } |
| 468 | 468 | else if ($code == "aesop_gallery") { |
| 469 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 470 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 469 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 470 | + echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 471 | 471 | } |
| 472 | 472 | else if ($code == "aesop_audio") { |
| 473 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 474 | - echo aesop_audio_shortcode($atts); |
|
| 473 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 474 | + echo aesop_audio_shortcode($atts); |
|
| 475 | 475 | } |
| 476 | 476 | else if ($code == "aesop_document") { |
| 477 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-document.php'); |
|
| 478 | - echo aesop_document_shortcode($atts); |
|
| 477 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-document.php'); |
|
| 478 | + echo aesop_document_shortcode($atts); |
|
| 479 | 479 | } |
| 480 | - /*else if ($code == "aesop_content") { |
|
| 480 | + /*else if ($code == "aesop_content") { |
|
| 481 | 481 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-content.php'); |
| 482 | 482 | echo aesop_content_shortcode($atts); |
| 483 | 483 | }*/ |
| 484 | - else if ($code == "aesop_wpimg") { |
|
| 485 | - self::wpimg($atts); |
|
| 484 | + else if ($code == "aesop_wpimg") { |
|
| 485 | + self::wpimg($atts); |
|
| 486 | 486 | } |
| 487 | 487 | else if ($code == "aesop_wpimg-block") { |
| 488 | - self::wpimg_block($atts); |
|
| 488 | + self::wpimg_block($atts); |
|
| 489 | 489 | } |
| 490 | 490 | else { |
| 491 | 491 | $code = '['.$code.' '; |
| 492 | 492 | foreach ($atts as $key => $value) { |
| 493 | - $code = ''.$key.'="'.$value.'" '; |
|
| 493 | + $code = ''.$key.'="'.$value.'" '; |
|
| 494 | 494 | } |
| 495 | 495 | $code = $code.']'; |
| 496 | 496 | echo do_shortcode($code); |
@@ -499,95 +499,95 @@ discard block |
||
| 499 | 499 | exit; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - public static function wpimg($atts) { |
|
| 502 | + public static function wpimg($atts) { |
|
| 503 | 503 | |
| 504 | - echo '<figure data-component-type="wpimg"'; |
|
| 504 | + echo '<figure data-component-type="wpimg"'; |
|
| 505 | 505 | |
| 506 | - $extra = ""; |
|
| 506 | + $extra = ""; |
|
| 507 | 507 | |
| 508 | - // try to use srcset and sizes on new WP installs |
|
| 508 | + // try to use srcset and sizes on new WP installs |
|
| 509 | 509 | if ( function_exists('wp_get_attachment_image_srcset') && $attachment_id = attachment_url_to_postid( $atts['img'] ) ) { |
| 510 | 510 | $srcset = wp_get_attachment_image_srcset( $attachment_id, 'full' ); |
| 511 | 511 | $sizes = wp_get_attachment_image_sizes( $attachment_id, 'full' ); |
| 512 | - $extra = "srcset='$srcset' sizes='$sizes' "; |
|
| 513 | - } |
|
| 514 | - if ($atts['align']=="left") { |
|
| 515 | - $extra .= 'class="alignleft'; |
|
| 516 | - } else if ($atts['align']=="right") { |
|
| 517 | - $extra .= 'class="alignright'; |
|
| 518 | - } else { |
|
| 519 | - $extra .= 'class="aligncenter'; |
|
| 520 | - } |
|
| 521 | - if ($atts['imgwidth'] || $atts['imgheight']) { |
|
| 522 | - if ($atts['imgwidth']) { |
|
| 523 | - $extra .= 'width:'. $atts['imgwidth'].';'; |
|
| 524 | - } |
|
| 525 | - if ($atts['imgheight']) { |
|
| 526 | - $extra .= 'height:'. $atts['imgheight'].';'; |
|
| 527 | - } |
|
| 512 | + $extra = "srcset='$srcset' sizes='$sizes' "; |
|
| 513 | + } |
|
| 514 | + if ($atts['align']=="left") { |
|
| 515 | + $extra .= 'class="alignleft'; |
|
| 516 | + } else if ($atts['align']=="right") { |
|
| 517 | + $extra .= 'class="alignright'; |
|
| 518 | + } else { |
|
| 519 | + $extra .= 'class="aligncenter'; |
|
| 520 | + } |
|
| 521 | + if ($atts['imgwidth'] || $atts['imgheight']) { |
|
| 522 | + if ($atts['imgwidth']) { |
|
| 523 | + $extra .= 'width:'. $atts['imgwidth'].';'; |
|
| 524 | + } |
|
| 525 | + if ($atts['imgheight']) { |
|
| 526 | + $extra .= 'height:'. $atts['imgheight'].';'; |
|
| 527 | + } |
|
| 528 | 528 | |
| 529 | - } |
|
| 530 | - $extra .= '"'; |
|
| 529 | + } |
|
| 530 | + $extra .= '"'; |
|
| 531 | 531 | |
| 532 | - foreach ($atts as $key => $value) { |
|
| 532 | + foreach ($atts as $key => $value) { |
|
| 533 | 533 | echo ' data-'.$key.'="'.$value.'"'; |
| 534 | 534 | } |
| 535 | - //echo ' class="wp-image- lasso--wpimg__wrap lasso-component">'; |
|
| 536 | - echo ' class="wp-caption lasso-component">'; |
|
| 537 | - $hrefset = false; |
|
| 538 | - if ($atts['link'] != '' && (!isset($atts['linkoption']) || $atts['linkoption']=="url" )) |
|
| 539 | - { |
|
| 540 | - echo '<a href="' . $atts['link'] . '">'; |
|
| 541 | - $hrefset = true; |
|
| 542 | - } else if (isset($atts['linkoption']) && $atts['linkoption'] == 'img' ) { |
|
| 543 | - echo '<a href="' . $atts['img'] . '">'; |
|
| 544 | - $hrefset = true; |
|
| 545 | - } |
|
| 546 | - echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '" '. $extra. '>'; |
|
| 547 | - if ($hrefset) |
|
| 548 | - { |
|
| 549 | - echo '</a>'; |
|
| 550 | - } |
|
| 551 | - if ($atts['caption']) |
|
| 552 | - { |
|
| 553 | - echo '<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption>'; |
|
| 554 | - } |
|
| 555 | - echo '</figure>'; |
|
| 556 | - echo '<p><br></p>'; |
|
| 557 | - return; |
|
| 558 | - } |
|
| 535 | + //echo ' class="wp-image- lasso--wpimg__wrap lasso-component">'; |
|
| 536 | + echo ' class="wp-caption lasso-component">'; |
|
| 537 | + $hrefset = false; |
|
| 538 | + if ($atts['link'] != '' && (!isset($atts['linkoption']) || $atts['linkoption']=="url" )) |
|
| 539 | + { |
|
| 540 | + echo '<a href="' . $atts['link'] . '">'; |
|
| 541 | + $hrefset = true; |
|
| 542 | + } else if (isset($atts['linkoption']) && $atts['linkoption'] == 'img' ) { |
|
| 543 | + echo '<a href="' . $atts['img'] . '">'; |
|
| 544 | + $hrefset = true; |
|
| 545 | + } |
|
| 546 | + echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '" '. $extra. '>'; |
|
| 547 | + if ($hrefset) |
|
| 548 | + { |
|
| 549 | + echo '</a>'; |
|
| 550 | + } |
|
| 551 | + if ($atts['caption']) |
|
| 552 | + { |
|
| 553 | + echo '<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption>'; |
|
| 554 | + } |
|
| 555 | + echo '</figure>'; |
|
| 556 | + echo '<p><br></p>'; |
|
| 557 | + return; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | 560 | public static function wpimg_block($atts) { |
| 561 | 561 | $imgextra = ''; |
| 562 | 562 | if (!empty($atts['id'])) { |
| 563 | 563 | $imgextra = 'class="wp-image-'.$atts['id'].'"'; |
| 564 | 564 | } |
| 565 | - $figclass = 'aligncenter'; |
|
| 566 | - if ($atts['align']=="left") { |
|
| 567 | - $figclass = 'alignleft'; |
|
| 568 | - } else if ($atts['align']=="right") { |
|
| 569 | - $figclass = 'alignright'; |
|
| 570 | - } else { |
|
| 571 | - $figclass = 'aligncenter'; |
|
| 572 | - } |
|
| 565 | + $figclass = 'aligncenter'; |
|
| 566 | + if ($atts['align']=="left") { |
|
| 567 | + $figclass = 'alignleft'; |
|
| 568 | + } else if ($atts['align']=="right") { |
|
| 569 | + $figclass = 'alignright'; |
|
| 570 | + } else { |
|
| 571 | + $figclass = 'aligncenter'; |
|
| 572 | + } |
|
| 573 | 573 | |
| 574 | - echo '<div class="wp-block-image" data-component-type="wpimg-block">'; |
|
| 575 | - echo '<figure class="wp-block-image '.$figclass.' size-large" contenteditable="false">'; |
|
| 576 | - if (!empty($atts['link'])) { |
|
| 577 | - echo '<a href="'.$atts['link'].'">'; |
|
| 578 | - } |
|
| 579 | - echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '"' . $imgextra . ' >'; |
|
| 580 | - if ($atts['caption']) |
|
| 581 | - { |
|
| 582 | - echo '<figcaption>'.$atts['caption'].'</figcaption>'; |
|
| 583 | - } |
|
| 584 | - if (!empty($atts['link'])) { |
|
| 585 | - echo '</a>'; |
|
| 586 | - } |
|
| 587 | - echo '</figure></div>'; |
|
| 588 | - echo '<p><br></p>'; |
|
| 589 | - return; |
|
| 590 | - } |
|
| 574 | + echo '<div class="wp-block-image" data-component-type="wpimg-block">'; |
|
| 575 | + echo '<figure class="wp-block-image '.$figclass.' size-large" contenteditable="false">'; |
|
| 576 | + if (!empty($atts['link'])) { |
|
| 577 | + echo '<a href="'.$atts['link'].'">'; |
|
| 578 | + } |
|
| 579 | + echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '"' . $imgextra . ' >'; |
|
| 580 | + if ($atts['caption']) |
|
| 581 | + { |
|
| 582 | + echo '<figcaption>'.$atts['caption'].'</figcaption>'; |
|
| 583 | + } |
|
| 584 | + if (!empty($atts['link'])) { |
|
| 585 | + echo '</a>'; |
|
| 586 | + } |
|
| 587 | + echo '</figure></div>'; |
|
| 588 | + echo '<p><br></p>'; |
|
| 589 | + return; |
|
| 590 | + } |
|
| 591 | 591 | |
| 592 | 592 | |
| 593 | 593 | public function get_ase_options() |
@@ -623,12 +623,12 @@ discard block |
||
| 623 | 623 | exit; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - /* This function doesn't actually publish post, but should be called when a post is published */ |
|
| 627 | - public function on_publish_post( ) { |
|
| 626 | + /* This function doesn't actually publish post, but should be called when a post is published */ |
|
| 627 | + public function on_publish_post( ) { |
|
| 628 | 628 | |
| 629 | 629 | $post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
| 630 | 630 | |
| 631 | - do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
| 631 | + do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
| 632 | 632 | |
| 633 | 633 | exit; |
| 634 | 634 | } |
@@ -686,14 +686,14 @@ discard block |
||
| 686 | 686 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
| 687 | 687 | |
| 688 | 688 | if ($taxonomy =='category') { |
| 689 | - // convert from names to category ids |
|
| 689 | + // convert from names to category ids |
|
| 690 | 690 | $cats = array(); |
| 691 | 691 | foreach ($value as $cat) { |
| 692 | 692 | $cat_id = get_cat_ID($cat); |
| 693 | 693 | if ($cat_id !=0) { |
| 694 | 694 | $cats [] = $cat_id; |
| 695 | 695 | } else if ($allow_new_category) { |
| 696 | - $cats [] = wp_create_category($cat); |
|
| 696 | + $cats [] = wp_create_category($cat); |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | $value = $cats; |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - public function create_gallery( ) { |
|
| 716 | + public function create_gallery( ) { |
|
| 717 | 717 | |
| 718 | 718 | $postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
| 719 | 719 | |
@@ -767,10 +767,10 @@ discard block |
||
| 767 | 767 | 'message' => 'gallery-created', |
| 768 | 768 | 'id' => $postid) |
| 769 | 769 | ); |
| 770 | - exit; |
|
| 770 | + exit; |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - public function update_gallery( ) { |
|
| 773 | + public function update_gallery( ) { |
|
| 774 | 774 | |
| 775 | 775 | $options = isset( $_POST['fields'] ) ? $_POST['fields'] : false; |
| 776 | 776 | |
@@ -786,12 +786,12 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | self::save_gallery_options( $postid, $gallery_ids, $options, $type ); |
| 788 | 788 | |
| 789 | - echo json_encode( array('message' => 'gallery-updated') ); |
|
| 789 | + echo json_encode( array('message' => 'gallery-updated') ); |
|
| 790 | 790 | |
| 791 | - exit; |
|
| 791 | + exit; |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
| 794 | + public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
| 795 | 795 | |
| 796 | 796 | // gallery width |
| 797 | 797 | $gallery_width = isset( $options['width'] ) ? $options['width'] : false; |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | public function set_date( $postid, $value) { |
| 876 | 876 | if( $value ) { |
| 877 | 877 | $value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 )); |
| 878 | - wp_update_post( |
|
| 878 | + wp_update_post( |
|
| 879 | 879 | array ( |
| 880 | 880 | 'ID' => $postid, // ID of the post to update |
| 881 | 881 | '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'); |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b'); |
| 91 | 91 | $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i'); |
| 92 | 92 | |
| 93 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 93 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 94 | 94 | |
| 95 | - $use_wpimgblock = false; |
|
| 95 | + $use_wpimgblock = false; |
|
| 96 | 96 | |
| 97 | - $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor', 'off'); |
|
| 97 | + $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor', 'off'); |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | //text alignement |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | // allow change date for post |
| 110 | 110 | $allow_change_date = lasso_editor_get_option('allow_change_date', 'lasso_editor'); |
| 111 | 111 | |
| 112 | - // support custom taxonomy |
|
| 112 | + // support custom taxonomy |
|
| 113 | 113 | $support_custom_taxonomy = lasso_editor_get_option('support_custom_taxonomy', 'lasso_editor'); |
| 114 | 114 | |
| 115 | 115 | if ($show_color) { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $tz_offset = get_UTC_offset(); |
| 136 | 136 | $post_date = get_the_time('U', $postid); |
| 137 | 137 | $time = (time()+$tz_offset); |
| 138 | - $delta = $time - $post_date; |
|
| 138 | + $delta = $time - $post_date; |
|
| 139 | 139 | |
| 140 | 140 | $strings = array( |
| 141 | 141 | 'save' => __('Save','lasso'), |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | 'catsPlaceholder' => __('add categories...'), |
| 181 | 181 | 'tagsPlaceholder' => __('add tags...'), |
| 182 | - 'taxoPlaceholder' => __('add taxonomy terms...'), |
|
| 182 | + 'taxoPlaceholder' => __('add taxonomy terms...'), |
|
| 183 | 183 | |
| 184 | 184 | |
| 185 | 185 | ); |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
| 192 | 192 | |
| 193 | 193 | |
| 194 | - if ($allow_change_date) { |
|
| 195 | - $permalink = get_site_url().'/?p='.$postid; |
|
| 196 | - } else { |
|
| 197 | - $permalink = get_permalink($postid); |
|
| 198 | - } |
|
| 194 | + if ($allow_change_date) { |
|
| 195 | + $permalink = get_site_url().'/?p='.$postid; |
|
| 196 | + } else { |
|
| 197 | + $permalink = get_permalink($postid); |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | 200 | // rest api |
| 201 | 201 | $rest_nonce = ''; |
@@ -215,17 +215,17 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - //excerpt |
|
| 219 | - $post_excerpt = ""; |
|
| 220 | - $post_excerpt = wp_strip_all_tags($post->post_excerpt,true); |
|
| 218 | + //excerpt |
|
| 219 | + $post_excerpt = ""; |
|
| 220 | + $post_excerpt = wp_strip_all_tags($post->post_excerpt,true); |
|
| 221 | 221 | |
| 222 | - //find if this is multi page. -1 if not |
|
| 223 | - $multipage = self::is_multipage(); |
|
| 224 | - $post_content = ""; |
|
| 225 | - //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 226 | - //if ($multipage != -1) { |
|
| 227 | - $post_content = $post->post_content; |
|
| 228 | - //} |
|
| 222 | + //find if this is multi page. -1 if not |
|
| 223 | + $multipage = self::is_multipage(); |
|
| 224 | + $post_content = ""; |
|
| 225 | + //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 226 | + //if ($multipage != -1) { |
|
| 227 | + $post_content = $post->post_content; |
|
| 228 | + //} |
|
| 229 | 229 | |
| 230 | 230 | //get custom taxonomy |
| 231 | 231 | $custom_taxonomies = array_diff(get_object_taxonomies( get_post_type( $postid ), 'names' ), ['category','post_tag','post_format']); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | $existing_taxo_arr[$taxonomy] = lasso_get_objects( $taxonomy ); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 242 | - $new_post_text = !empty($new_post_text) ? $new_post_text : wp_strip_all_tags(apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso'))); |
|
| 241 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 242 | + $new_post_text = !empty($new_post_text) ? $new_post_text : wp_strip_all_tags(apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso'))); |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | // localized objects |
@@ -319,19 +319,19 @@ discard block |
||
| 319 | 319 | 'customFields' => $custom_fields, |
| 320 | 320 | 'clickToInsert' => ($insert_comp_ui =='click'), |
| 321 | 321 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
| 322 | - 'rtl' => is_rtl(), |
|
| 322 | + 'rtl' => is_rtl(), |
|
| 323 | 323 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
| 324 | 324 | 'linksEditable' => $links_editable, |
| 325 | 325 | 'supportPendingStatus' => !$no_pending_status, |
| 326 | 326 | '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><p></p>'), |
| 327 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 328 | - 'multipages'=> $multipage, |
|
| 329 | - 'post_content'=>$post_content, |
|
| 330 | - 'post_excerpt'=>$post_excerpt, |
|
| 331 | - 'supCustTaxo' => $support_custom_taxonomy == 'on', |
|
| 332 | - 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 333 | - 'useWPImgBlk'=> $use_wpimgblock, |
|
| 334 | - 'prefixHTTP'=> $link_prefix_http =='on' |
|
| 327 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 328 | + 'multipages'=> $multipage, |
|
| 329 | + 'post_content'=>$post_content, |
|
| 330 | + 'post_excerpt'=>$post_excerpt, |
|
| 331 | + 'supCustTaxo' => $support_custom_taxonomy == 'on', |
|
| 332 | + 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 333 | + 'useWPImgBlk'=> $use_wpimgblock, |
|
| 334 | + 'prefixHTTP'=> $link_prefix_http =='on' |
|
| 335 | 335 | ); |
| 336 | 336 | |
| 337 | 337 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | |
| 341 | 341 | if (!$using_restapiv2) { |
| 342 | - // enqueue REST API V1 |
|
| 342 | + // enqueue REST API V1 |
|
| 343 | 343 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
| 344 | 344 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
| 345 | 345 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | if ($show_color) { |
| 356 | 356 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
| 357 | 357 | } else { |
| 358 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 358 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 359 | 359 | } |
| 360 | 360 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
| 361 | 361 | |
@@ -364,44 +364,44 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - function gutenberg_active() { |
|
| 367 | + function gutenberg_active() { |
|
| 368 | 368 | |
| 369 | - // Gutenberg plugin is installed and activated. |
|
| 370 | - $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 371 | - |
|
| 372 | - // Block editor since 5.0. |
|
| 373 | - $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 374 | - |
|
| 375 | - if ( ! $gutenberg && ! $block_editor ) { |
|
| 376 | - return false; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - if ( self::is_classic_editor_plugin_active() ) { |
|
| 380 | - $editor_option = get_option( 'classic-editor-replace' ); |
|
| 381 | - $block_editor_active = array( 'no-replace', 'block' ); |
|
| 382 | - |
|
| 383 | - return in_array( $editor_option, $block_editor_active, true ); |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - return true; |
|
| 387 | - } |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * Check if Classic Editor plugin is active. |
|
| 391 | - * |
|
| 392 | - * @return bool |
|
| 393 | - */ |
|
| 394 | - function is_classic_editor_plugin_active() { |
|
| 395 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 396 | - include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 400 | - return true; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - return false; |
|
| 404 | - } |
|
| 369 | + // Gutenberg plugin is installed and activated. |
|
| 370 | + $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 371 | + |
|
| 372 | + // Block editor since 5.0. |
|
| 373 | + $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 374 | + |
|
| 375 | + if ( ! $gutenberg && ! $block_editor ) { |
|
| 376 | + return false; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + if ( self::is_classic_editor_plugin_active() ) { |
|
| 380 | + $editor_option = get_option( 'classic-editor-replace' ); |
|
| 381 | + $block_editor_active = array( 'no-replace', 'block' ); |
|
| 382 | + |
|
| 383 | + return in_array( $editor_option, $block_editor_active, true ); |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + return true; |
|
| 387 | + } |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * Check if Classic Editor plugin is active. |
|
| 391 | + * |
|
| 392 | + * @return bool |
|
| 393 | + */ |
|
| 394 | + function is_classic_editor_plugin_active() { |
|
| 395 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 396 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 400 | + return true; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + return false; |
|
| 404 | + } |
|
| 405 | 405 | |
| 406 | 406 | } |
| 407 | 407 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | if ( !is_user_logged_in() ) |
| 99 | 99 | return; |
| 100 | 100 | |
| 101 | - // check for lasso story engine and add a class doniting this |
|
| 102 | - $ase_status = class_exists( 'Aesop_Core' ) || defined( 'LASSO_CUSTOM' ) ? 'ase-active' : 'ase-not-active'; |
|
| 101 | + // check for lasso story engine and add a class doniting this |
|
| 102 | + $ase_status = class_exists( 'Aesop_Core' ) || defined( 'LASSO_CUSTOM' ) ? 'ase-active' : 'ase-not-active'; |
|
| 103 | 103 | |
| 104 | 104 | $article_object = lasso_editor_get_option( 'article_class', 'lasso_editor' ); |
| 105 | 105 | $featImgClass = lasso_editor_get_option( 'featimg_class', 'lasso_editor' ); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $edit_post_disabled = lasso_editor_get_option( 'post_edit_disabled', 'lasso_editor' ); |
| 111 | 111 | $post_settings_disabled = lasso_editor_get_option( 'post_settings_disabled', 'lasso_editor' ); |
| 112 | 112 | $allow_change_date = lasso_editor_get_option( 'allow_change_date', 'lasso_editor' ); |
| 113 | - $allow_edit_excerpt = lasso_editor_get_option( 'allow_edit_excerpt', 'lasso_editor' ); |
|
| 113 | + $allow_edit_excerpt = lasso_editor_get_option( 'allow_edit_excerpt', 'lasso_editor' ); |
|
| 114 | 114 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
| 115 | 115 | $shortcodify_disabled = lasso_editor_get_option( 'shortcodify_disabled', 'lasso_editor' ); |
| 116 | 116 | $enable_autosave = lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $bold_tag = lasso_editor_get_option( 'bold_tag', 'lasso_editor', "b"); |
| 136 | 136 | $i_tag = lasso_editor_get_option( 'i_tag', 'lasso_editor', "i"); |
| 137 | 137 | |
| 138 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 138 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 139 | 139 | |
| 140 | 140 | // do we support pending status |
| 141 | 141 | $no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor'); |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $insert_comp_ui = 'drag'; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor'); |
|
| 150 | + $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor'); |
|
| 151 | 151 | |
| 152 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 153 | - $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 152 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 153 | + $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 154 | 154 | |
| 155 | 155 | $support_custom_taxonomy = lasso_editor_get_option( 'support_custom_taxonomy', 'lasso_editor' ); |
| 156 | 156 | |
| 157 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 157 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 158 | 158 | |
| 159 | 159 | ?> |
| 160 | 160 | <div class="wrap"> |
@@ -34,8 +34,8 @@ |
||
| 34 | 34 | |
| 35 | 35 | $object = is_null( $data[ 'object'] ) ? false : $data[ 'object' ]; |
| 36 | 36 | |
| 37 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 38 | - $new_post_text = !empty($new_post_text) ? $new_post_text : wp_strip_all_tags(apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso'))); |
|
| 37 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 38 | + $new_post_text = !empty($new_post_text) ? $new_post_text : wp_strip_all_tags(apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso'))); |
|
| 39 | 39 | |
| 40 | 40 | // insert a new post |
| 41 | 41 | $args = array( |