Completed
Push — master ( f6ea62...ab6983 )
by
unknown
35s
created
public/includes/lasso.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'  => $excerpt
338
+			'post_excerpt'  => $excerpt
339 339
 		);
340 340
 		
341 341
 		
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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="'.$figclass.' size-large">';   
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="'.$figclass.' size-large">';   
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) ),
Please login to merge, or discard this patch.
public/includes/helpers.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 	if ( empty( $postid ) )
200 200
 		$postid = get_the_ID();
201 201
 
202
-    if ('category' == $taxonomy)  {
203
-        $objects = get_the_category( $postid );
204
-    } else if ('tag' == $taxonomy)  {
205
-        $objects = get_the_tags( $postid );
206
-    } else {
207
-        $objects = get_the_terms( $postid, $taxonomy );
208
-    }
202
+	if ('category' == $taxonomy)  {
203
+		$objects = get_the_category( $postid );
204
+	} else if ('tag' == $taxonomy)  {
205
+		$objects = get_the_tags( $postid );
206
+	} else {
207
+		$objects = get_the_terms( $postid, $taxonomy );
208
+	}
209 209
 
210 210
 	if ( empty( $objects) )
211 211
 		return;
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
 */
228 228
 function lasso_get_objects( $taxonomy = 'category' ) {
229 229
 
230
-    if ('category' == $taxonomy)  {
231
-        $objects = get_categories(array('hide_empty' => 0));
232
-    } else if ('tag' == $taxonomy)  {
233
-        $objects = get_tags(array('hide_empty' => 0));
234
-    } else {
235
-        $objects = get_terms( array(
236
-            'taxonomy' => $taxonomy,
237
-            'hide_empty' => false,
238
-        ));
239
-    }
230
+	if ('category' == $taxonomy)  {
231
+		$objects = get_categories(array('hide_empty' => 0));
232
+	} else if ('tag' == $taxonomy)  {
233
+		$objects = get_tags(array('hide_empty' => 0));
234
+	} else {
235
+		$objects = get_terms( array(
236
+			'taxonomy' => $taxonomy,
237
+			'hide_empty' => false,
238
+		));
239
+	}
240 240
 	
241 241
 	if ( empty( $objects) )
242 242
 		return;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		'public' => true,
262 262
 	), 'objects' );
263 263
 	$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
264
-    unset( $post_types[ 'attachment' ] );
264
+	unset( $post_types[ 'attachment' ] );
265 265
 
266 266
 	/**
267 267
 	 * Set which post types are allowed
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	$post_types = get_post_types( array(
289 289
 		'public' => true,
290 290
 	), 'names' );
291
-    unset( $post_types[ 'attachment' ] );
291
+	unset( $post_types[ 'attachment' ] );
292 292
 
293 293
 	/**
294 294
 	 * Set which post types are allowed
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
  */
401 401
 if ( !function_exists( 'lasso_user_can' ) ):
402 402
 	function lasso_user_can( $action = '', $postid = 0 ) {
403
-        $result = false;
403
+		$result = false;
404 404
 		if ( empty( $action ) )
405 405
 			$action = 'edit_posts';
406 406
 
@@ -415,17 +415,17 @@  discard block
 block discarded – undo
415 415
 				$allowed_post_types = array_diff($allowed_post_types,array('page'));
416 416
 			}
417 417
 			
418
-            if (!empty($allowed_post_types) && !empty($postid)) {
418
+			if (!empty($allowed_post_types) && !empty($postid)) {
419 419
 				$type = get_post_type( $postid );
420
-                $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
420
+				$allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
421 421
 				
422
-                if ( in_array( $type, $allowed_post_types ) ) {
422
+				if ( in_array( $type, $allowed_post_types ) ) {
423 423
 				   $result =  true;
424
-			    }
425
-            } else {
426
-                //we are not checking against a post, return true
424
+				}
425
+			} else {
426
+				//we are not checking against a post, return true
427 427
 				$result =  true;
428
-        	}
428
+			}
429 429
 		} else {
430 430
 			$result = false;
431 431
 		}
Please login to merge, or discard this patch.
public/includes/editor-modules.php 1 patch
Indentation   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 				height: 42px;
115 115
 			}
116 116
 		<?php
117
-            } 
117
+			} 
118 118
 		} else { 
119 119
 		?> 
120 120
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	
249 249
 	$sc_saving_class = ('on' == $shortcodify_disabled || $ase_status == 'ase-not-active')  ? 'shortcodify-disabled' : 'shortcodify-enabled';
250 250
 
251
-    $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off');
251
+	$use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off');
252 252
 
253 253
 	?>
254 254
 	<div class="lasso--toolbar_wrap lasso-editor-controls--wrap <?php echo $toolbar_class.' '.$mobile_class.' '.$ase_status.' '.sanitize_html_class( $custom_classes );?>" <?php echo $mobile_style ?>>
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	
462 462
 	//editor options
463 463
 	$allow_change_date = lasso_editor_get_option('allow_change_date', 'lasso_editor');
464
-    $allow_edit_excerpt = lasso_editor_get_option('allow_edit_excerpt', 'lasso_editor');
464
+	$allow_edit_excerpt = lasso_editor_get_option('allow_edit_excerpt', 'lasso_editor');
465 465
 	$no_url_setting = lasso_editor_get_option('no_url_setting', 'lasso_editor');
466 466
 	$support_custom_taxonomy   = lasso_editor_get_option( 'support_custom_taxonomy', 'lasso_editor' );
467 467
 	
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	// do we support pending status
483 483
 	$no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor');
484 484
     
485
-    $excerpt = $post->post_excerpt;
485
+	$excerpt = $post->post_excerpt;
486 486
 
487 487
 ?>
488 488
 	<div id="lasso--post-settings__modal" class="lasso--modal lassoShowAnimate <?php echo sanitize_html_class( $custom_classes );?>">
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 						}?>
580 580
 						<?php 
581 581
 						if ($allow_change_date) { 
582
-						    $dateformat = get_option( 'date_format' ); 
582
+							$dateformat = get_option( 'date_format' ); 
583 583
 						?>
584 584
 						    <label><?php _e( 'Post Date', 'lasso' ); ?></label>
585 585
 							<input type="text" class="editus_custom_date" name="post_date" value="<?php echo get_the_time($dateformat, $postid);?>"/>
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
 								$types = lasso_post_types_names();
674 674
 								if ( !empty( $types ) ) {
675 675
 									foreach( $types as $name => $label ) 
676
-                                    {   	
677
-                                        $type = $name;									
676
+									{   	
677
+										$type = $name;									
678 678
 										//$type = preg_replace( '/s\b/','', $name );
679 679
 										if ($type == 'page' && !current_user_can('edit_pages')) {
680 680
 											continue;
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 						if ( !empty( $types ) ) {
697 697
 							// get the first element
698 698
 							$keys = array_keys($types);
699
-						    $type =$keys[0];						
699
+							$type =$keys[0];						
700 700
 							$type = preg_replace( '/s\b/','', $type );
701 701
 							printf( '<input type="hidden" name="object" value="%s">', lcfirst( esc_attr( $type ) ) );		
702 702
 						}
@@ -724,8 +724,8 @@  discard block
 block discarded – undo
724 724
 	global $post;
725 725
 	
726 726
 	global $wp_post_types;
727
-    $labels = &$wp_post_types['post']->labels;
728
-    $labels->name = 'Articles';
727
+	$labels = &$wp_post_types['post']->labels;
728
+	$labels->name = 'Articles';
729 729
 
730 730
 	ob_start();
731 731
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 	ob_start();
786 786
 
787 787
 
788
-    $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off');
788
+	$use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off');
789 789
     
790 790
 	// let users add custom css classes
791 791
 	$custom_classes = apply_filters( 'lasso_wpimg_classes', '' );
@@ -887,9 +887,9 @@  discard block
 block discarded – undo
887 887
 function lasso_editor_options_blob() {
888 888
 
889 889
 	$codes   = function_exists( 'aesop_shortcodes' ) ? aesop_shortcodes() : array();
890
-    $codes   = add_wpimg_options( $codes );
890
+	$codes   = add_wpimg_options( $codes );
891 891
 	$codes   = add_wpimg_block_options( $codes );
892
-    $codes   = apply_filters( 'lasso_custom_options', $codes );
892
+	$codes   = apply_filters( 'lasso_custom_options', $codes );
893 893
 	$galleries  = function_exists( 'lasso_editor_galleries_exist' ) && lasso_editor_galleries_exist() ? 'has-galleries' : 'creating-gallery';
894 894
 
895 895
 	$nonce = wp_create_nonce( 'lasso_gallery' );
@@ -991,9 +991,9 @@  discard block
 block discarded – undo
991 991
 		$return .= '</form>';
992 992
 
993 993
 		// extra JS codes
994
-        if (isset($shortcode['codes'])) {
995
-		    $return .= $shortcode['codes'];
996
-        }
994
+		if (isset($shortcode['codes'])) {
995
+			$return .= $shortcode['codes'];
996
+		}
997 997
 		$blob[$slug] = $return;
998 998
 	}
999 999
 
@@ -1002,95 +1002,95 @@  discard block
 block discarded – undo
1002 1002
 
1003 1003
 
1004 1004
 function add_wpimg_options( $shortcodes ) {
1005
-    $custom = array(
1006
-        'wpimg'    => array(
1007
-            'name'     => __( 'Image', 'lasso' ),
1008
-            'type'     => 'single',
1009
-            'atts'     => array(
1010
-                'img'    => array(
1011
-                    'type'  => 'media_upload',
1012
-                    'default'  => '',
1013
-                    'desc'   => __( 'Image URL', 'lasso' ),
1014
-                    'tip'  => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' )
1015
-                ),
1016
-                'align'    => array(
1017
-                    'type'  => 'select',
1018
-                    'values'  => array(						
1019
-                        array(
1020
-                            'value' => 'center',
1021
-                            'name' => __( 'Center', 'aesop-core' )
1022
-                        ),
1023
-                        array(
1024
-                            'value' => 'left',
1025
-                            'name' => __( 'Left', 'aesop-core' )
1026
-                        ),
1027
-                        array(
1028
-                            'value' => 'right',
1029
-                            'name' => __( 'Right', 'aesop-core' )
1030
-                        ),
1031
-                    ),
1032
-                    'default'  => 'center',
1033
-                    'desc'   => __( 'Alignment', 'lasso' ),
1034
-                    'tip'=>''
1035
-                ),			
1005
+	$custom = array(
1006
+		'wpimg'    => array(
1007
+			'name'     => __( 'Image', 'lasso' ),
1008
+			'type'     => 'single',
1009
+			'atts'     => array(
1010
+				'img'    => array(
1011
+					'type'  => 'media_upload',
1012
+					'default'  => '',
1013
+					'desc'   => __( 'Image URL', 'lasso' ),
1014
+					'tip'  => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' )
1015
+				),
1016
+				'align'    => array(
1017
+					'type'  => 'select',
1018
+					'values'  => array(						
1019
+						array(
1020
+							'value' => 'center',
1021
+							'name' => __( 'Center', 'aesop-core' )
1022
+						),
1023
+						array(
1024
+							'value' => 'left',
1025
+							'name' => __( 'Left', 'aesop-core' )
1026
+						),
1027
+						array(
1028
+							'value' => 'right',
1029
+							'name' => __( 'Right', 'aesop-core' )
1030
+						),
1031
+					),
1032
+					'default'  => 'center',
1033
+					'desc'   => __( 'Alignment', 'lasso' ),
1034
+					'tip'=>''
1035
+				),			
1036 1036
                 
1037
-                'imgwidth'    => array(
1038
-                    'type'  => 'text_small',
1039
-                    'default'  => '300px',
1040
-                    'desc'   => __( 'Image Width', 'lasso' ),
1041
-                    'tip'  => __( 'Width of the image. You can enter the size in pixels or percentage such as <code>40%</code> or <code>500px</code>.', 'aesop-core' )
1042
-                ),
1043
-                'imgheight'    => array(
1044
-                    'type'  => 'text_small',
1045
-                    'default'  => '',
1046
-                    'desc'   => __( 'Image Height', 'lasso' ),
1047
-                    'tip'  => __( 'Used only for the Panorama mode. Can be set using pixel values such as <code>500px</code>. If unspecified, the original height would be used. ', 'aesop-core' )
1048
-                ),	
1049
-                'linkoption'    => array(
1050
-                    'type'  => 'select',
1051
-                    'values'  => array(						
1052
-                        array(
1053
-                            'value' => 'none',
1054
-                            'name' => __( 'None', 'aesop-core' )
1055
-                        ),
1056
-                        array(
1057
-                            'value' => 'img',
1058
-                            'name' => __( 'Image', 'aesop-core' )
1059
-                        ),
1060
-                        array(
1061
-                            'value' => 'url',
1062
-                            'name' => __( 'URL', 'aesop-core' )
1063
-                        ),
1064
-                    ),
1065
-                    'default'  => 'none',
1066
-                    'desc'   => __( 'Link', 'lasso' ),
1067
-                    'tip'  => __( 'Click leads to:', 'lasso' )
1068
-                ),				
1037
+				'imgwidth'    => array(
1038
+					'type'  => 'text_small',
1039
+					'default'  => '300px',
1040
+					'desc'   => __( 'Image Width', 'lasso' ),
1041
+					'tip'  => __( 'Width of the image. You can enter the size in pixels or percentage such as <code>40%</code> or <code>500px</code>.', 'aesop-core' )
1042
+				),
1043
+				'imgheight'    => array(
1044
+					'type'  => 'text_small',
1045
+					'default'  => '',
1046
+					'desc'   => __( 'Image Height', 'lasso' ),
1047
+					'tip'  => __( 'Used only for the Panorama mode. Can be set using pixel values such as <code>500px</code>. If unspecified, the original height would be used. ', 'aesop-core' )
1048
+				),	
1049
+				'linkoption'    => array(
1050
+					'type'  => 'select',
1051
+					'values'  => array(						
1052
+						array(
1053
+							'value' => 'none',
1054
+							'name' => __( 'None', 'aesop-core' )
1055
+						),
1056
+						array(
1057
+							'value' => 'img',
1058
+							'name' => __( 'Image', 'aesop-core' )
1059
+						),
1060
+						array(
1061
+							'value' => 'url',
1062
+							'name' => __( 'URL', 'aesop-core' )
1063
+						),
1064
+					),
1065
+					'default'  => 'none',
1066
+					'desc'   => __( 'Link', 'lasso' ),
1067
+					'tip'  => __( 'Click leads to:', 'lasso' )
1068
+				),				
1069 1069
                 
1070
-                'link'    => array(
1071
-                    'type'  => 'text',
1072
-                    'default'  => '',
1073
-                    'desc'   => __( 'URL Link', 'lasso' ),
1074
-                    'tip'  => __( 'URL link', 'lasso' )
1075
-                ),
1076
-                'alt'    => array(
1077
-                    'type'  => 'text',
1078
-                    'default'  => '',
1079
-                    'desc'   => __( 'Image ALT', 'lasso' ),
1080
-                    'tip'  => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' )
1081
-                ),
1070
+				'link'    => array(
1071
+					'type'  => 'text',
1072
+					'default'  => '',
1073
+					'desc'   => __( 'URL Link', 'lasso' ),
1074
+					'tip'  => __( 'URL link', 'lasso' )
1075
+				),
1076
+				'alt'    => array(
1077
+					'type'  => 'text',
1078
+					'default'  => '',
1079
+					'desc'   => __( 'Image ALT', 'lasso' ),
1080
+					'tip'  => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' )
1081
+				),
1082 1082
                 
1083
-                'caption'    => array(
1084
-                    'type'  => 'text_area',
1085
-                    'default'  => '',
1086
-                    'desc'   => __( 'Caption', 'lasso' ),
1087
-                    'tip'  => __( 'Optional caption for the image.', 'lasso' )
1088
-                ),
1083
+				'caption'    => array(
1084
+					'type'  => 'text_area',
1085
+					'default'  => '',
1086
+					'desc'   => __( 'Caption', 'lasso' ),
1087
+					'tip'  => __( 'Optional caption for the image.', 'lasso' )
1088
+				),
1089 1089
                 
1090 1090
 
1091
-            ),
1092
-            'desc'     => __( 'An image.', 'aesop-core' ),
1093
-            'codes'    => '<script>	            
1091
+			),
1092
+			'desc'     => __( 'An image.', 'aesop-core' ),
1093
+			'codes'    => '<script>	            
1094 1094
 						jQuery(document).ready(function($){
1095 1095
                             function linkSetting(l){								
1096 1096
 							    if ( l=="url") {
@@ -1110,75 +1110,75 @@  discard block
 block discarded – undo
1110 1110
 							})
1111 1111
 						});
1112 1112
 			           </script>'
1113
-        )
1114
-    );
1113
+		)
1114
+	);
1115 1115
 
1116
-    return array_merge( $shortcodes, $custom );
1116
+	return array_merge( $shortcodes, $custom );
1117 1117
 }
1118 1118
 
1119 1119
 function add_wpimg_block_options( $shortcodes ) {
1120
-    $custom = array(
1121
-        'wpimg-block'    => array(
1122
-            'name'     => __( 'Image', 'lasso' ),
1123
-            'type'     => 'single',
1124
-            'atts'     => array(
1125
-                'img'    => array(
1126
-                    'type'  => 'media_upload',
1127
-                    'default'  => '',
1128
-                    'desc'   => __( 'Image URL', 'lasso' ),
1129
-                    'tip'  => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' )
1130
-                ),
1131
-                'align'    => array(
1132
-                    'type'  => 'select',
1133
-                    'values'  => array(						
1134
-                        array(
1135
-                            'value' => 'center',
1136
-                            'name' => __( 'Center', 'aesop-core' )
1137
-                        ),
1138
-                        array(
1139
-                            'value' => 'left',
1140
-                            'name' => __( 'Left', 'aesop-core' )
1141
-                        ),
1142
-                        array(
1143
-                            'value' => 'right',
1144
-                            'name' => __( 'Right', 'aesop-core' )
1145
-                        ),
1146
-                    ),
1147
-                    'default'  => 'center',
1148
-                    'desc'   => __( 'Alignment', 'lasso' ),
1149
-                    'tip'=>''
1150
-                ),		
1151
-                'alt'    => array(
1152
-                    'type'  => 'text',
1153
-                    'default'  => '',
1154
-                    'desc'   => __( 'Image ALT', 'lasso' ),
1155
-                    'tip'  => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' )
1156
-                ),
1157
-                'caption'    => array(
1158
-                    'type'  => 'text',
1159
-                    'default'  => '',
1160
-                    'desc'   => __( 'Caption', 'lasso' ),
1161
-                    'tip'  => __( 'Optional caption for the image.', 'lasso' )
1162
-                ),
1163
-                'link'    => array(
1164
-                    'type'  => 'text',
1165
-                    'default'  => '',
1166
-                    'desc'   => __( 'Link URL', 'lasso' ),
1167
-                    'tip'  => __( 'Optional URL to link.', 'lasso' )
1168
-                ),
1120
+	$custom = array(
1121
+		'wpimg-block'    => array(
1122
+			'name'     => __( 'Image', 'lasso' ),
1123
+			'type'     => 'single',
1124
+			'atts'     => array(
1125
+				'img'    => array(
1126
+					'type'  => 'media_upload',
1127
+					'default'  => '',
1128
+					'desc'   => __( 'Image URL', 'lasso' ),
1129
+					'tip'  => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' )
1130
+				),
1131
+				'align'    => array(
1132
+					'type'  => 'select',
1133
+					'values'  => array(						
1134
+						array(
1135
+							'value' => 'center',
1136
+							'name' => __( 'Center', 'aesop-core' )
1137
+						),
1138
+						array(
1139
+							'value' => 'left',
1140
+							'name' => __( 'Left', 'aesop-core' )
1141
+						),
1142
+						array(
1143
+							'value' => 'right',
1144
+							'name' => __( 'Right', 'aesop-core' )
1145
+						),
1146
+					),
1147
+					'default'  => 'center',
1148
+					'desc'   => __( 'Alignment', 'lasso' ),
1149
+					'tip'=>''
1150
+				),		
1151
+				'alt'    => array(
1152
+					'type'  => 'text',
1153
+					'default'  => '',
1154
+					'desc'   => __( 'Image ALT', 'lasso' ),
1155
+					'tip'  => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' )
1156
+				),
1157
+				'caption'    => array(
1158
+					'type'  => 'text',
1159
+					'default'  => '',
1160
+					'desc'   => __( 'Caption', 'lasso' ),
1161
+					'tip'  => __( 'Optional caption for the image.', 'lasso' )
1162
+				),
1163
+				'link'    => array(
1164
+					'type'  => 'text',
1165
+					'default'  => '',
1166
+					'desc'   => __( 'Link URL', 'lasso' ),
1167
+					'tip'  => __( 'Optional URL to link.', 'lasso' )
1168
+				),
1169 1169
                
1170 1170
 
1171
-            ),
1172
-            'desc'     => __( 'A WP Image Block.', 'aesop-core' ),
1173
-            'codes'    => '<script>	            
1171
+			),
1172
+			'desc'     => __( 'A WP Image Block.', 'aesop-core' ),
1173
+			'codes'    => '<script>	            
1174 1174
 						jQuery(document).ready(function($){
1175 1175
                             
1176 1176
 						});
1177 1177
 			           </script>'
1178
-        )
1179
-    );
1178
+		)
1179
+	);
1180 1180
 
1181
-    return array_merge( $shortcodes, $custom );
1181
+	return array_merge( $shortcodes, $custom );
1182 1182
 }
1183 1183
 
1184 1184
 /**
@@ -1223,23 +1223,23 @@  discard block
 block discarded – undo
1223 1223
  * @return string
1224 1224
  */
1225 1225
 function lasso_editor_adjustBrightness($hex, $steps) { 
1226
-    $steps = max(-255, min(255, $steps));
1226
+	$steps = max(-255, min(255, $steps));
1227 1227
 
1228
-    // Normalize into a six character long hex string
1229
-    $hex = str_replace('#', '', $hex);
1230
-    if (strlen($hex) == 3) {
1231
-        $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
1232
-    }
1228
+	// Normalize into a six character long hex string
1229
+	$hex = str_replace('#', '', $hex);
1230
+	if (strlen($hex) == 3) {
1231
+		$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
1232
+	}
1233 1233
 
1234
-    // Split into three parts: R, G and B
1235
-    $color_parts = str_split($hex, 2);
1236
-    $return = '#';
1234
+	// Split into three parts: R, G and B
1235
+	$color_parts = str_split($hex, 2);
1236
+	$return = '#';
1237 1237
 
1238
-    foreach ($color_parts as $color) {
1239
-        $color   = hexdec($color); // Convert to decimal
1240
-        $color   = max(0,min(255,$color + $steps)); // Adjust color
1241
-        $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
1242
-    }
1238
+	foreach ($color_parts as $color) {
1239
+		$color   = hexdec($color); // Convert to decimal
1240
+		$color   = max(0,min(255,$color + $steps)); // Adjust color
1241
+		$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
1242
+	}
1243 1243
 
1244
-    return $return;
1244
+	return $return;
1245 1245
 }
Please login to merge, or discard this patch.
public/includes/assets.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
215 215
 				}
216 216
 			}
217 217
             
218
-            //excerpt
219
-            $post_excerpt = "";
220
-            $post_excerpt = $post->post_excerpt;
218
+			//excerpt
219
+			$post_excerpt = "";
220
+			$post_excerpt = $post->post_excerpt;
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']);
@@ -315,19 +315,19 @@  discard block
 block discarded – undo
315 315
 				'customFields'      => $custom_fields,
316 316
 				'clickToInsert'     => ($insert_comp_ui =='click'),
317 317
 				'buttonOnEmptyP'     => ($insert_comp_ui =='mediumcom'),      // auto show a button to insert components on an empty paragraph      
318
-                'rtl'               => is_rtl(),				
318
+				'rtl'               => is_rtl(),				
319 319
 				'skipToEdit'        =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode
320 320
 				'linksEditable'    => $links_editable,
321 321
 				'supportPendingStatus' => !$no_pending_status,
322 322
 				'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>'),
323
-                'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//,
324
-                'multipages'=> $multipage,
325
-                'post_content'=>$post_content,
326
-                'post_excerpt'=>$post_excerpt,
327
-                'supCustTaxo' => $support_custom_taxonomy == 'on',
328
-                'oldWPimg'=> $use_old_wpimg =='on',
329
-                'useWPImgBlk'=> $use_wpimgblock,
330
-                'prefixHTTP'=> $link_prefix_http =='on'
323
+				'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//,
324
+				'multipages'=> $multipage,
325
+				'post_content'=>$post_content,
326
+				'post_excerpt'=>$post_excerpt,
327
+				'supCustTaxo' => $support_custom_taxonomy == 'on',
328
+				'oldWPimg'=> $use_old_wpimg =='on',
329
+				'useWPImgBlk'=> $use_wpimgblock,
330
+				'prefixHTTP'=> $link_prefix_http =='on'
331 331
 			);
332 332
 
333 333
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			
336 336
 			
337 337
 			if (!$using_restapiv2) {
338
-               // enqueue REST API V1
338
+			   // enqueue REST API V1
339 339
 			   wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true );
340 340
 			   $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) );
341 341
 			   wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings );
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			if ($show_color) {
352 352
 				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true);
353 353
 			} else {
354
-			    wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
354
+				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
355 355
 			}
356 356
 			wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) );
357 357
 
@@ -360,44 +360,44 @@  discard block
 block discarded – undo
360 360
 
361 361
 	}
362 362
     
363
-    function gutenberg_active() {
363
+	function gutenberg_active() {
364 364
         
365
-        // Gutenberg plugin is installed and activated.
366
-        $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
367
-
368
-        // Block editor since 5.0.
369
-        $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
370
-
371
-        if ( ! $gutenberg && ! $block_editor ) {
372
-            return false;
373
-        }
374
-
375
-        if ( self::is_classic_editor_plugin_active() ) {
376
-            $editor_option       = get_option( 'classic-editor-replace' );
377
-            $block_editor_active = array( 'no-replace', 'block' );
378
-
379
-            return in_array( $editor_option, $block_editor_active, true );
380
-        }
381
-
382
-        return true;
383
-    }
384
-
385
-    /**
386
-     * Check if Classic Editor plugin is active.
387
-     *
388
-     * @return bool
389
-     */
390
-    function is_classic_editor_plugin_active() {
391
-        if ( ! function_exists( 'is_plugin_active' ) ) {
392
-            include_once ABSPATH . 'wp-admin/includes/plugin.php';
393
-        }
394
-
395
-        if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
396
-            return true;
397
-        }
398
-
399
-        return false;
400
-    }
365
+		// Gutenberg plugin is installed and activated.
366
+		$gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
367
+
368
+		// Block editor since 5.0.
369
+		$block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
370
+
371
+		if ( ! $gutenberg && ! $block_editor ) {
372
+			return false;
373
+		}
374
+
375
+		if ( self::is_classic_editor_plugin_active() ) {
376
+			$editor_option       = get_option( 'classic-editor-replace' );
377
+			$block_editor_active = array( 'no-replace', 'block' );
378
+
379
+			return in_array( $editor_option, $block_editor_active, true );
380
+		}
381
+
382
+		return true;
383
+	}
384
+
385
+	/**
386
+	 * Check if Classic Editor plugin is active.
387
+	 *
388
+	 * @return bool
389
+	 */
390
+	function is_classic_editor_plugin_active() {
391
+		if ( ! function_exists( 'is_plugin_active' ) ) {
392
+			include_once ABSPATH . 'wp-admin/includes/plugin.php';
393
+		}
394
+
395
+		if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
396
+			return true;
397
+		}
398
+
399
+		return false;
400
+	}
401 401
 
402 402
 }
403 403
 
Please login to merge, or discard this patch.
lasso.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
57 57
 		}
58 58
 	}
59 59
  
60
-    return $args;
60
+	return $args;
61 61
 }
62 62
 
63 63
 
@@ -106,25 +106,25 @@  discard block
 block discarded – undo
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>
@@ -134,31 +134,31 @@  discard block
 block discarded – undo
134 134
           <li data-action="deltable"><?php echo __('Delete Table','lasso')?></li
135 135
         </ul>
136 136
     <?php
137
-    }
137
+	}
138 138
     
139 139
     
140
-    function editus_html_table()
141
-    {   
142
-        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><p><br></p>';
143
-    }
140
+	function editus_html_table()
141
+	{   
142
+		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><p><br></p>';
143
+	}
144 144
 
145 145
 
146
-    function editus_components_add_table( $array ){
147
-        $custom = array(
148
-               'htmltable' => array(
149
-                         'name'    => __('HTML Table','lasso'),
150
-                          'content' => self::editus_html_table(),
151
-                )
152
-        );
153
-        return array_merge( $array, $custom );
154
-    }
146
+	function editus_components_add_table( $array ){
147
+		$custom = array(
148
+			   'htmltable' => array(
149
+						 'name'    => __('HTML Table','lasso'),
150
+						  'content' => self::editus_html_table(),
151
+				)
152
+		);
153
+		return array_merge( $array, $custom );
154
+	}
155 155
 
156 156
 
157
-    function editus_toolbar_components_add_table( ) {
158
-          ?>
157
+	function editus_toolbar_components_add_table( ) {
158
+		  ?>
159 159
           <li data-type="htmltable" title="<?php esc_attr_e( 'HTML Table', 'lasso' );?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li>
160 160
           <?php
161
-    }
161
+	}
162 162
 }
163 163
 
164 164
 
@@ -169,37 +169,37 @@  discard block
 block discarded – undo
169 169
 //table codes to be added
170 170
 class editus_paragraph {
171 171
     
172
-    public function __construct(){
173
-        add_action('wp_enqueue_scripts', array($this,'scripts'));
172
+	public function __construct(){
173
+		add_action('wp_enqueue_scripts', array($this,'scripts'));
174 174
 	}
175 175
     
176
-    function scripts()
177
-    {
178
-            add_action('lasso_editor_controls_after_outside', array($this,'editus_paragraph_style'));
179
-            add_filter('lasso_components',array($this,'editus_components_add_paragraph'),10,1);
180
-            add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_paragraph'), 10 );
181
-            //wp_enqueue_style( 'editus-table-style', LASSO_URL.  '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true );
182
-            //wp_enqueue_script( 'editus_table',  LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true );
183
-    }
176
+	function scripts()
177
+	{
178
+			add_action('lasso_editor_controls_after_outside', array($this,'editus_paragraph_style'));
179
+			add_filter('lasso_components',array($this,'editus_components_add_paragraph'),10,1);
180
+			add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_paragraph'), 10 );
181
+			//wp_enqueue_style( 'editus-table-style', LASSO_URL.  '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true );
182
+			//wp_enqueue_script( 'editus_table',  LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true );
183
+	}
184 184
    
185
-    function editus_components_add_paragraph( $array ){
186
-        $custom = array(
187
-               'htmlparagraph' => array(
188
-                         'name'    => __('HTML Paragraph','lasso'),
189
-                          'content' => self::editus_html_paragraph(),
190
-                )
191
-        );
192
-        return array_merge( $array, $custom );
193
-    }
185
+	function editus_components_add_paragraph( $array ){
186
+		$custom = array(
187
+			   'htmlparagraph' => array(
188
+						 'name'    => __('HTML Paragraph','lasso'),
189
+						  'content' => self::editus_html_paragraph(),
190
+				)
191
+		);
192
+		return array_merge( $array, $custom );
193
+	}
194 194
     
195 195
     
196
-    function editus_html_paragraph()
197
-    {   
198
-        return '<p contenteditable="true"><br></p>';
199
-    }
196
+	function editus_html_paragraph()
197
+	{   
198
+		return '<p contenteditable="true"><br></p>';
199
+	}
200 200
 
201
-    function editus_paragraph_style()
202
-    { ?>
201
+	function editus_paragraph_style()
202
+	{ ?>
203 203
         <style>
204 204
         #lasso-toolbar--components__list .lasso-toolbar--component__htmlparagraph:before
205 205
         { 
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
         }
209 209
         </style>
210 210
     <?php
211
-    }
211
+	}
212 212
     
213 213
 
214
-    function editus_toolbar_components_add_paragraph( ) {
215
-          ?>
214
+	function editus_toolbar_components_add_paragraph( ) {
215
+		  ?>
216 216
           <li data-type="htmlparagraph" title="<?php esc_attr_e( 'HTML Paragraph', 'lasso' );?>" class="quote lasso-toolbar--component__htmlparagraph dashicons dashicons-editor-paragraph"></li>
217 217
           <?php
218
-    }
218
+	}
219 219
 }
220 220
 
221 221
 //Disable
Please login to merge, or discard this patch.
admin/includes/menus/settings.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,10 +147,10 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.