Completed
Push — master ( 605b3f...454469 )
by
unknown
01:28
created
admin/includes/load_admin.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 
100 100
 		foreach ( $pages as $page ) {
101 101
 			wp_enqueue_media();
102
-            wp_enqueue_style( 'wp-color-picker');
103
-            wp_enqueue_script( 'wp-color-picker');
102
+			wp_enqueue_style( 'wp-color-picker');
103
+			wp_enqueue_script( 'wp-color-picker');
104 104
 		
105 105
 			wp_enqueue_script( 'lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array( 'jquery','wp-color-picker' ), LASSO_VERSION, true );
106 106
 			wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION );
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 
133 133
 	/**
134
-	*	Adds an admin notice reminding the user if their license key has not been saved
135
-	*
136
-	*	@since 0.9.7
137
-	*	@todo make dismissible
138
-	*/
134
+	 *	Adds an admin notice reminding the user if their license key has not been saved
135
+	 *
136
+	 *	@since 0.9.7
137
+	 *	@todo make dismissible
138
+	 */
139 139
 	public function license_nag(){
140 140
 
141 141
 		$screen 	= get_current_screen();
@@ -156,26 +156,26 @@  discard block
 block discarded – undo
156 156
 
157 157
 			if ( empty( $license ) ) {
158 158
 
159
-        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link );
159
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link );
160 160
 
161
-        	} else if ( 'invalid' == $status ){ // license key entered wrong or something
161
+			} else if ( 'invalid' == $status ){ // license key entered wrong or something
162 162
 
163 163
 				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link );
164 164
 
165
-        	} else if ( empty( $status ) ){ // license key saved but not activated
165
+			} else if ( empty( $status ) ){ // license key saved but not activated
166 166
 
167 167
 				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link );
168 168
 
169
-        	}
169
+			}
170 170
 		}
171 171
 
172 172
 	}
173 173
 
174 174
 	/**
175
-	*  Process hiding the dimiss
176
-	*
177
-	* @since 0.9.7
178
-	*/
175
+	 *  Process hiding the dimiss
176
+	 *
177
+	 * @since 0.9.7
178
+	 */
179 179
 	public function dismiss_nag() {
180 180
 
181 181
 		if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) {
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 		$plugin = lasso::get_instance();
44 44
 		$this->plugin_slug = $plugin->get_plugin_slug();
45 45
 
46
-		add_action( 'admin_head',  			array( $this, 'admin_assets' ) );
47
-		add_action( 'admin_notices', 		array( $this, 'license_nag' ) );
48
-		add_action( 'admin_head', 			array( $this, 'dismiss_nag' ) );
49
-		add_filter( 'plugin_row_meta',    	array( $this, 'plugin_meta' ), 10, 2 );
46
+		add_action('admin_head', array($this, 'admin_assets'));
47
+		add_action('admin_notices', array($this, 'license_nag'));
48
+		add_action('admin_head', array($this, 'dismiss_nag'));
49
+		add_filter('plugin_row_meta', array($this, 'plugin_meta'), 10, 2);
50 50
 
51
-		if ( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
51
+		if (!class_exists('EDD_SL_Plugin_Updater')) {
52 52
 			include LASSO_DIR.'admin/includes/EDD_SL_Plugin_Updater.php';
53 53
 		}
54 54
 
55
-		if ( !class_exists( 'TGM_Plugin_Activation' ) ) {
55
+		if (!class_exists('TGM_Plugin_Activation')) {
56 56
 			include LASSO_DIR.'admin/includes/class-tgm-plugin-activation.php';
57 57
 		}
58 58
 
59 59
 		new menus\welcome();
60 60
 		new menus\settings();
61 61
 
62
-		if ( !defined( 'LASSO_AGENCY_MODE' ) ) {
62
+		if (!defined('LASSO_AGENCY_MODE')) {
63 63
 			new menus\license();
64 64
 		}
65 65
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	public static function get_instance() {
76 76
 
77 77
 		// If the single instance hasn't been set, set it now.
78
-		if ( null == self::$instance ) {
78
+		if (null == self::$instance) {
79 79
 			self::$instance = new self;
80 80
 		}
81 81
 
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 			'dashboard_page_lasso-welcome-screen'
98 98
 		);
99 99
 
100
-		foreach ( $pages as $page ) {
100
+		foreach ($pages as $page) {
101 101
 			wp_enqueue_media();
102
-            wp_enqueue_style( 'wp-color-picker');
103
-            wp_enqueue_script( 'wp-color-picker');
102
+            wp_enqueue_style('wp-color-picker');
103
+            wp_enqueue_script('wp-color-picker');
104 104
 		
105
-			wp_enqueue_script( 'lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array( 'jquery','wp-color-picker' ), LASSO_VERSION, true );
106
-			wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION );
105
+			wp_enqueue_script('lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array('jquery', 'wp-color-picker'), LASSO_VERSION, true);
106
+			wp_enqueue_style('lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION);
107 107
 		}
108 108
 	}
109 109
 
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return array new array of links for our plugin listing on plugins.php
118 118
 	 */
119
-	public function plugin_meta( $links, $file ) {
119
+	public function plugin_meta($links, $file) {
120 120
 
121
-		if ( strpos( $file, 'lasso.php' ) !== false && !defined( 'LASSO_AGENCY_MODE' ) ) {
121
+		if (strpos($file, 'lasso.php') !== false && !defined('LASSO_AGENCY_MODE')) {
122 122
 
123 123
 			$new_links = array(
124 124
 				'<a href="http://edituswp.com/help" target="_blank">Help</a>'
125 125
 			);
126 126
 
127
-			$links = array_merge( $links, $new_links );
127
+			$links = array_merge($links, $new_links);
128 128
 		}
129 129
 
130 130
 		return $links;
@@ -136,35 +136,35 @@  discard block
 block discarded – undo
136 136
 	*	@since 0.9.7
137 137
 	*	@todo make dismissible
138 138
 	*/
139
-	public function license_nag(){
139
+	public function license_nag() {
140 140
 
141
-		$screen 	= get_current_screen();
142
-		$welcome    = 'toplevel_page_lasso-editor' == $screen->id;
143
-		$license  	= get_option( 'lasso_license_key' );
144
-		$status   	= get_option( 'lasso_license_status' );
141
+		$screen = get_current_screen();
142
+		$welcome = 'toplevel_page_lasso-editor' == $screen->id;
143
+		$license  	= get_option('lasso_license_key');
144
+		$status   	= get_option('lasso_license_status');
145 145
 
146
-		$message_empty    = apply_filters('lasso_empty_license_message','Your license key for support and automatic updates for Editus is missing!');
147
-		$message_invalid  = apply_filters('lasso_invalid_license_message','Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.');
148
-		$message_inactive  = apply_filters('lasso_inactive_license_message','It looks like your license key has not yet been activated.');
146
+		$message_empty    = apply_filters('lasso_empty_license_message', 'Your license key for support and automatic updates for Editus is missing!');
147
+		$message_invalid  = apply_filters('lasso_invalid_license_message', 'Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.');
148
+		$message_inactive = apply_filters('lasso_inactive_license_message', 'It looks like your license key has not yet been activated.');
149 149
 
150
-		$license_link 	  = sprintf('<a href="%s">Update License</a>', esc_url( add_query_arg( array( 'page' => 'lasso-license' ), admin_url('admin.php') ) ) );
151
-		$dismiss_link     = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url( add_query_arg( 'lasso-notice', 'dismiss' ) ), __('Dismiss this notice.','lasso') );
150
+		$license_link = sprintf('<a href="%s">Update License</a>', esc_url(add_query_arg(array('page' => 'lasso-license'), admin_url('admin.php'))));
151
+		$dismiss_link     = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url(add_query_arg('lasso-notice', 'dismiss')), __('Dismiss this notice.', 'lasso'));
152 152
 
153
-		$not_hidden       = get_user_meta( get_current_user_ID(), 'lasso_license_nag_dismissed', true );
153
+		$not_hidden       = get_user_meta(get_current_user_ID(), 'lasso_license_nag_dismissed', true);
154 154
 
155
-		if ( current_user_can('manage_options') && !$welcome && !defined( 'LASSO_AGENCY_MODE') && !$not_hidden ) {
155
+		if (current_user_can('manage_options') && !$welcome && !defined('LASSO_AGENCY_MODE') && !$not_hidden) {
156 156
 
157
-			if ( empty( $license ) ) {
157
+			if (empty($license)) {
158 158
 
159
-        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link );
159
+        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link);
160 160
 
161
-        	} else if ( 'invalid' == $status ){ // license key entered wrong or something
161
+        	} else if ('invalid' == $status) { // license key entered wrong or something
162 162
 
163
-				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link );
163
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link, $dismiss_link);
164 164
 
165
-        	} else if ( empty( $status ) ){ // license key saved but not activated
165
+        	} else if (empty($status)) { // license key saved but not activated
166 166
 
167
-				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link );
167
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link);
168 168
 
169 169
         	}
170 170
 		}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	*/
179 179
 	public function dismiss_nag() {
180 180
 
181
-		if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) {
182
-			update_user_meta( get_current_user_id(), 'lasso_license_nag_dismissed', 1 );
181
+		if (isset($_GET['lasso-notice']) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options')) {
182
+			update_user_meta(get_current_user_id(), 'lasso_license_nag_dismissed', 1);
183 183
 		}
184 184
 	}
185 185
 }
Please login to merge, or discard this patch.
public/includes/lasso.php 4 patches
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @since    0.0.1
82 82
 	 *
83
-	 * @return    Plugin slug variable.
83
+	 * @return    string slug variable.
84 84
 	 */
85 85
 	public function get_plugin_slug() {
86 86
 		return $this->plugin_slug;
@@ -338,6 +338,9 @@  discard block
 block discarded – undo
338 338
 		exit;
339 339
 	}
340 340
 	
341
+	/**
342
+	 * @param string $type
343
+	 */
341 344
 	public static function enable_metasave($type)
342 345
 	{
343 346
 		register_rest_field( $type, 'metadata', array(
@@ -526,6 +529,9 @@  discard block
 block discarded – undo
526 529
 		return self::$revisions;
527 530
 	}*/
528 531
 	
532
+	/**
533
+	 * @param string $taxonomy
534
+	 */
529 535
 	public function set_post_terms( $postid, $value, $taxonomy ) {
530 536
 		if( $value ) {
531 537
 			$value = explode( ',', $value );
Please login to merge, or discard this patch.
Braces   +23 added lines, -31 removed lines patch added patch discarded remove patch
@@ -412,44 +412,34 @@  discard block
 block discarded – undo
412 412
 		if ($code == "aesop_video") {
413 413
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
414 414
 		    echo aesop_video_shortcode($atts);
415
-		}
416
-		else if ($code == "aesop_image") {
415
+		} else if ($code == "aesop_image") {
417 416
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
418 417
 		    echo aesop_image_shortcode($atts);
419
-		}
420
-		else if ($code == "aesop_quote") {
418
+		} else if ($code == "aesop_quote") {
421 419
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
422 420
 		    echo aesop_quote_shortcode($atts);
423
-		}
424
-		else if ($code == "aesop_parallax") {
421
+		} else if ($code == "aesop_parallax") {
425 422
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
426 423
 		    echo aesop_parallax_shortcode($atts);
427
-		}
428
-		else if ($code == "aesop_character") {
424
+		} else if ($code == "aesop_character") {
429 425
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
430 426
 		    echo aesop_character_shortcode($atts);
431
-		}
432
-		else if ($code == "aesop_collection") {
427
+		} else if ($code == "aesop_collection") {
433 428
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
434 429
 		    echo aesop_collection_shortcode($atts);
435
-		}
436
-		else if ($code == "aesop_chapter") {
430
+		} else if ($code == "aesop_chapter") {
437 431
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
438 432
 		    echo aesop_chapter_shortcode($atts);
439
-		}
440
-		else if ($code == "aesop_content") {
433
+		} else if ($code == "aesop_content") {
441 434
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
442 435
 		    echo aesop_content_shortcode($atts, $atts['content_data']);
443
-		}
444
-		else if ($code == "aesop_gallery") {
436
+		} else if ($code == "aesop_gallery") {
445 437
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
446 438
 		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
447
-		}
448
-		else if ($code == "aesop_audio") {
439
+		} else if ($code == "aesop_audio") {
449 440
 		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
450 441
 		    echo aesop_audio_shortcode($atts);
451
-		}
452
-		else {
442
+		} else {
453 443
 			$code = '['.$code.' ';
454 444
 			foreach ($atts as $key => $value) {
455 445
 			    $code = ''.$key.'="'.$value.'" ';
@@ -477,8 +467,9 @@  discard block
 block discarded – undo
477 467
 		$postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
478 468
 
479 469
 		// bail out if the current user can't publish posts
480
-		if ( !lasso_user_can( 'delete_post', $postid ) )
481
-			return;
470
+		if ( !lasso_user_can( 'delete_post', $postid ) ) {
471
+					return;
472
+		}
482 473
 		
483 474
 		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_delete_post' )) {
484 475
 			wp_send_json_error();
@@ -574,15 +565,14 @@  discard block
 block discarded – undo
574 565
 			}
575 566
 	
576 567
 			$result = wp_set_object_terms( $postid, $value, $taxonomy );
577
-		}
578
-		else  {
568
+		} else  {
579 569
 			//remove all terms from post
580 570
 			$result = wp_set_object_terms( $postid, null, $taxonomy );
581 571
 		}
582 572
 
583 573
 		if ( ! is_wp_error( $result ) ) {
584 574
 			return true;
585
-		}else{
575
+		} else{
586 576
 			return false;
587 577
 		}
588 578
 	}
@@ -652,9 +642,9 @@  discard block
 block discarded – undo
652 642
 		$gallery_ids  = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false;
653 643
 		if ( $_POST[ 'gallery_type' ] ) {
654 644
 			$type = $_POST[ 'gallery_type' ];
655
-		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
645
+		} elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
656 646
 			$type = $options[ 'galleryType' ];
657
-		}else{
647
+		} else{
658 648
 			$type = false;
659 649
 		}
660 650
 
@@ -733,13 +723,15 @@  discard block
 block discarded – undo
733 723
 
734 724
 		  $month_numbers = range(1,12);
735 725
 
736
-		  foreach($month_numbers as $month)
737
-			$english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011));
726
+		  foreach($month_numbers as $month) {
727
+		  			$english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011));
728
+		  }
738 729
 
739 730
 		  setlocale(LC_ALL, get_locale());
740 731
 
741
-		  foreach($month_numbers as $month)
742
-			$foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011)));
732
+		  foreach($month_numbers as $month) {
733
+		  			$foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011)));
734
+		  }
743 735
 
744 736
 		  return str_replace($foreign_months, $english_months, $foreignMonthName);
745 737
 	}
Please login to merge, or discard this patch.
Indentation   +47 added lines, -47 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,10 +69,10 @@  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');
@@ -272,14 +272,14 @@  discard block
 block discarded – undo
272 272
 		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
273 273
 	}
274 274
 	
275
-    // new ajax function to lock post for editing
275
+	// new ajax function to lock post for editing
276 276
 	public function editus_lock_post()
277 277
 	{
278 278
 		$post_id= $_POST["postid"];
279 279
 		$locked = wp_check_post_lock($post_id);
280 280
 		
281 281
 		if (!$locked) {
282
-		    wp_set_post_lock($post_id);
282
+			wp_set_post_lock($post_id);
283 283
 			echo "true";
284 284
 		} else {
285 285
 			$user_info = get_userdata($locked);
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	{
293 293
 		$post_id= $_POST["postid"];
294 294
 		$locked = wp_check_post_lock($post_id);
295
-        if (!$locked) {
296
-            delete_post_meta( $post_id, '_edit_lock');
297
-        }
295
+		if (!$locked) {
296
+			delete_post_meta( $post_id, '_edit_lock');
297
+		}
298 298
 		echo "true";
299 299
 		
300 300
 		exit;
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
 		exit;
398 398
 	}
399 399
     
400
-    public function editus_do_block()
400
+	public function editus_do_block()
401 401
 	{
402 402
 		
403 403
 		$code= $_POST["code"];
404 404
 
405
-        $out = do_blocks( $code );
405
+		$out = do_blocks( $code );
406 406
 		
407 407
 		echo $out;
408 408
 		exit;
@@ -417,59 +417,59 @@  discard block
 block discarded – undo
417 417
 		 );
418 418
 		foreach ($_POST as $key => $value) {
419 419
 			if ($key !="code" && $key !="action") {
420
-			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
420
+				//$shortcode = $shortcode.$key.'="'.$value.'" ';
421 421
 				$atts[$key] = $value;
422 422
 			}
423 423
 		}
424 424
 		if ($code == "aesop_video") {
425
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
426
-		    echo aesop_video_shortcode($atts);
425
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
426
+			echo aesop_video_shortcode($atts);
427 427
 		}
428 428
 		else if ($code == "aesop_image") {
429
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
430
-		    echo aesop_image_shortcode($atts);
429
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
430
+			echo aesop_image_shortcode($atts);
431 431
 		}
432 432
 		else if ($code == "aesop_quote") {
433
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
434
-		    echo aesop_quote_shortcode($atts);
433
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
434
+			echo aesop_quote_shortcode($atts);
435 435
 		}
436 436
 		else if ($code == "aesop_parallax") {
437
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
438
-		    echo aesop_parallax_shortcode($atts);
437
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
438
+			echo aesop_parallax_shortcode($atts);
439 439
 		}
440 440
 		else if ($code == "aesop_character") {
441
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
442
-		    echo aesop_character_shortcode($atts);
441
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
442
+			echo aesop_character_shortcode($atts);
443 443
 		}
444 444
 		else if ($code == "aesop_collection") {
445
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
446
-		    echo aesop_collection_shortcode($atts);
445
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
446
+			echo aesop_collection_shortcode($atts);
447 447
 		}
448 448
 		else if ($code == "aesop_chapter") {
449
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
450
-		    echo aesop_chapter_shortcode($atts);
449
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
450
+			echo aesop_chapter_shortcode($atts);
451 451
 		}
452 452
 		else if ($code == "aesop_content") {
453
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
454
-		    echo aesop_content_shortcode($atts, $atts['content_data']);
453
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
454
+			echo aesop_content_shortcode($atts, $atts['content_data']);
455 455
 		}
456 456
 		else if ($code == "aesop_gallery") {
457
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
458
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
457
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
458
+			echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
459 459
 		}
460 460
 		else if ($code == "aesop_audio") {
461
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
462
-		    echo aesop_audio_shortcode($atts);
461
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
462
+			echo aesop_audio_shortcode($atts);
463 463
 		}
464 464
 		else {
465 465
 			$code = '['.$code.' ';
466 466
 			foreach ($atts as $key => $value) {
467
-			    $code = ''.$key.'="'.$value.'" ';
467
+				$code = ''.$key.'="'.$value.'" ';
468 468
 			}
469 469
 			$code = $code.']';
470 470
 			echo do_shortcode($code);
471
-		    //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php');
472
-		    //echo aesop_audio_shortcode($atts);
471
+			//require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php');
472
+			//echo aesop_audio_shortcode($atts);
473 473
 		}
474 474
 		
475 475
 		exit; 
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
 		exit;
510 510
 	}
511 511
     
512
-    /* This function doesn't actually publish post, but should be called when a post is published */
513
-    public function on_publish_post( ) {
512
+	/* This function doesn't actually publish post, but should be called when a post is published */
513
+	public function on_publish_post( ) {
514 514
 
515 515
 		$post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
516 516
         
517
-        do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
517
+		do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
518 518
 
519 519
 		exit;
520 520
 	}
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
573 573
 			
574 574
 			if ($taxonomy =='category') {
575
-                // convert from names to category ids
575
+				// convert from names to category ids
576 576
 				$cats = array();
577 577
 				foreach ($value as $cat) {
578 578
 					$cat_id = get_cat_ID($cat);
579 579
 					if ($cat_id !=0) {
580 580
 						$cats [] = $cat_id;
581 581
 					} else if ($allow_new_category) {
582
-					    $cats [] = wp_create_category($cat);
582
+						$cats [] = wp_create_category($cat);
583 583
 					}
584 584
 				}
585 585
 				$value = $cats;
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 		}
600 600
 	}
601 601
     
602
-    public function create_gallery( ) {
602
+	public function create_gallery( ) {
603 603
 
604 604
 		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
605 605
         
@@ -653,10 +653,10 @@  discard block
 block discarded – undo
653 653
 			'message' => 'gallery-created',
654 654
 			'id' => $postid)
655 655
 		);
656
-        exit;
656
+		exit;
657 657
 	}
658 658
     
659
-    public function update_gallery( ) {
659
+	public function update_gallery( ) {
660 660
         
661 661
 		$options      = isset( $_POST['fields'] ) ? $_POST['fields'] : false;
662 662
         
@@ -672,12 +672,12 @@  discard block
 block discarded – undo
672 672
 
673 673
 		self::save_gallery_options( $postid, $gallery_ids, $options, $type );
674 674
 
675
-        echo json_encode( array('message' => 'gallery-updated') );
675
+		echo json_encode( array('message' => 'gallery-updated') );
676 676
 
677
-        exit;
677
+		exit;
678 678
 	}
679 679
     
680
-    public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
680
+	public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
681 681
 
682 682
 		// gallery width
683 683
 		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	public function set_date( $postid, $value) {
762 762
 		if( $value ) {
763 763
 			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 ));
764
-            wp_update_post(
764
+			wp_update_post(
765 765
 				array (
766 766
 					'ID'            => $postid, // ID of the post to update
767 767
 					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
Please login to merge, or discard this patch.
Spacing   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -52,27 +52,27 @@  discard block
 block discarded – undo
52 52
 		require_once LASSO_DIR.'/public/includes/wrap-shortcodes.php';
53 53
 
54 54
 		// Activate plugin when new blog is added
55
-		add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
55
+		add_action('wpmu_new_blog', array($this, 'activate_new_site'));
56 56
 
57 57
 		// Load plugin text domain
58
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
58
+		add_action('init', array($this, 'load_plugin_textdomain'));
59 59
 		
60
-		add_action( 'wp_ajax_get_aesop_component',     array( $this, 'get_aesop_component' ) );
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' ) );
63
-		add_action( 'wp_ajax_editus_lock_post',     array( $this, 'editus_lock_post' ) );
64
-		add_action( 'wp_ajax_editus_unlock_post',     array( $this, 'editus_unlock_post' ) );
65
-		add_action( 'wp_ajax_editus_hide_tour',     array( $this, 'editus_hide_tour' ) );
66
-		add_action( 'wp_ajax_editus_set_post_setting',     array( $this, 'editus_set_post_setting' ) );
67
-		add_action( 'wp_ajax_editus_get_ase_options',     array( $this, 'get_ase_options' ) );
68
-		add_action( 'wp_ajax_editus_delete_post',     array( $this, 'delete_post' ) );
69
-		add_action( 'wp_ajax_editus_featured_img',     array( $this, 'set_featured_img' ) );
70
-		add_action( 'wp_ajax_editus_del_featured_img',     array( $this, 'del_featured_img' ) );
60
+		add_action('wp_ajax_get_aesop_component', array($this, 'get_aesop_component'));
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'));
63
+		add_action('wp_ajax_editus_lock_post', array($this, 'editus_lock_post'));
64
+		add_action('wp_ajax_editus_unlock_post', array($this, 'editus_unlock_post'));
65
+		add_action('wp_ajax_editus_hide_tour', array($this, 'editus_hide_tour'));
66
+		add_action('wp_ajax_editus_set_post_setting', array($this, 'editus_set_post_setting'));
67
+		add_action('wp_ajax_editus_get_ase_options', array($this, 'get_ase_options'));
68
+		add_action('wp_ajax_editus_delete_post', array($this, 'delete_post'));
69
+		add_action('wp_ajax_editus_featured_img', array($this, 'set_featured_img'));
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');
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	public static function get_instance() {
104 104
 
105 105
 		// If the single instance hasn't been set, set it now.
106
-		if ( null == self::$instance ) {
106
+		if (null == self::$instance) {
107 107
 			self::$instance = new self;
108 108
 		}
109 109
 
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
 	 *                                       WPMU is disabled or plugin is
121 121
 	 *                                       activated on an individual blog.
122 122
 	 */
123
-	public static function activate( $network_wide ) {
123
+	public static function activate($network_wide) {
124 124
 
125
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
125
+		if (function_exists('is_multisite') && is_multisite()) {
126 126
 
127
-			if ( $network_wide  ) {
127
+			if ($network_wide) {
128 128
 
129 129
 				// Get all blog ids
130 130
 				$blog_ids = self::get_blog_ids();
131 131
 
132
-				foreach ( $blog_ids as $blog_id ) {
132
+				foreach ($blog_ids as $blog_id) {
133 133
 
134
-					switch_to_blog( $blog_id );
134
+					switch_to_blog($blog_id);
135 135
 					self::single_activate();
136 136
 				}
137 137
 
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
 	 *                                       WPMU is disabled or plugin is
158 158
 	 *                                       deactivated on an individual blog.
159 159
 	 */
160
-	public static function deactivate( $network_wide ) {
160
+	public static function deactivate($network_wide) {
161 161
 
162
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
162
+		if (function_exists('is_multisite') && is_multisite()) {
163 163
 
164
-			if ( $network_wide ) {
164
+			if ($network_wide) {
165 165
 
166 166
 				// Get all blog ids
167 167
 				$blog_ids = self::get_blog_ids();
168 168
 
169
-				foreach ( $blog_ids as $blog_id ) {
169
+				foreach ($blog_ids as $blog_id) {
170 170
 
171
-					switch_to_blog( $blog_id );
171
+					switch_to_blog($blog_id);
172 172
 					self::single_deactivate();
173 173
 
174 174
 				}
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param int     $blog_id ID of the new blog.
194 194
 	 */
195
-	public function activate_new_site( $blog_id ) {
195
+	public function activate_new_site($blog_id) {
196 196
 
197
-		if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
197
+		if (1 !== did_action('wpmu_new_blog')) {
198 198
 			return;
199 199
 		}
200 200
 
201
-		switch_to_blog( $blog_id );
201
+		switch_to_blog($blog_id);
202 202
 		self::single_activate();
203 203
 		restore_current_blog();
204 204
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 			WHERE archived = '0' AND spam = '0'
224 224
 			AND deleted = '0'";
225 225
 
226
-		return $wpdb->get_col( $sql );
226
+		return $wpdb->get_col($sql);
227 227
 
228 228
 	}
229 229
 
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	private static function single_activate() {
236 236
 
237
-		$curr_version = get_option( 'lasso_version' );
237
+		$curr_version = get_option('lasso_version');
238 238
 
239 239
 		// update upgraded from
240
-		if ( $curr_version ) {
241
-			update_option( 'lasso_updated_from', $curr_version );
240
+		if ($curr_version) {
241
+			update_option('lasso_updated_from', $curr_version);
242 242
 		}
243 243
 
244 244
 		// update lasso version option
245
-		update_option( 'lasso_version', LASSO_VERSION );
245
+		update_option('lasso_version', LASSO_VERSION);
246 246
 
247 247
 		// set transietn for activation welcome
248
-		set_transient( '_lasso_welcome_redirect', true, 30 );
248
+		set_transient('_lasso_welcome_redirect', true, 30);
249 249
 
250 250
 
251 251
 	}
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
 	public function load_plugin_textdomain() {
268 268
 
269 269
 		$domain = $this->plugin_slug;
270
-		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
270
+		$locale = apply_filters('plugin_locale', get_locale(), $domain);
271 271
 
272
-		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
272
+		$out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo');
273 273
 	}
274 274
 	
275 275
     // new ajax function to lock post for editing
276 276
 	public function editus_lock_post()
277 277
 	{
278
-		$post_id= $_POST["postid"];
278
+		$post_id = $_POST["postid"];
279 279
 		$locked = wp_check_post_lock($post_id);
280 280
 		
281 281
 		if (!$locked) {
@@ -283,17 +283,17 @@  discard block
 block discarded – undo
283 283
 			echo "true";
284 284
 		} else {
285 285
 			$user_info = get_userdata($locked);
286
-			echo _e( 'Post being edited by ', 'lasso' ).$user_info->first_name .  " " . $user_info->last_name;
286
+			echo _e('Post being edited by ', 'lasso').$user_info->first_name." ".$user_info->last_name;
287 287
 		}
288 288
 		exit;
289 289
 	}
290 290
 	
291 291
 	public function editus_unlock_post()
292 292
 	{
293
-		$post_id= $_POST["postid"];
293
+		$post_id = $_POST["postid"];
294 294
 		$locked = wp_check_post_lock($post_id);
295 295
         if (!$locked) {
296
-            delete_post_meta( $post_id, '_edit_lock');
296
+            delete_post_meta($post_id, '_edit_lock');
297 297
         }
298 298
 		echo "true";
299 299
 		
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	{
306 306
 		$user_id = get_current_user_ID();
307 307
 				
308
-		update_user_meta( $user_id, 'lasso_hide_tour', true );
308
+		update_user_meta($user_id, 'lasso_hide_tour', true);
309 309
 		exit;
310 310
 	}
311 311
 	
@@ -316,14 +316,14 @@  discard block
 block discarded – undo
316 316
 		$data = array();
317 317
 		parse_str($_POST['data'], $data);
318 318
 		
319
-		if (!wp_verify_nonce( $data[ 'nonce' ], 'lasso-update-post-settings' )) {
319
+		if (!wp_verify_nonce($data['nonce'], 'lasso-update-post-settings')) {
320 320
 			wp_send_json_error();
321 321
 			exit;
322 322
 		}
323 323
 		
324
-		$status = isset( $data['status'] ) ? $data['status'] : false;
325
-		$postid = isset( $data['postid'] ) ? $data['postid'] : false;
326
-		$slug   = isset( $data['story_slug'] ) ? $data['story_slug'] : false;
324
+		$status = isset($data['status']) ? $data['status'] : false;
325
+		$postid = isset($data['postid']) ? $data['postid'] : false;
326
+		$slug   = isset($data['story_slug']) ? $data['story_slug'] : false;
327 327
 	
328 328
 
329 329
 		$args = array(
@@ -334,24 +334,24 @@  discard block
 block discarded – undo
334 334
 		
335 335
 		
336 336
 
337
-		wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) );
337
+		wp_update_post(apply_filters('lasso_object_status_update_args', $args));
338 338
 		
339 339
 		// update categories
340
-		$cats  = isset( $data['story_cats'] ) ? $data['story_cats'] : false;
340
+		$cats = isset($data['story_cats']) ? $data['story_cats'] : false;
341 341
 		
342
-		self::set_post_terms( $postid, $cats, 'category' );
342
+		self::set_post_terms($postid, $cats, 'category');
343 343
 		
344 344
 		// update tags
345
-		$tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false;
346
-		self::set_post_terms( $postid, $tags, 'post_tag' );
345
+		$tags = isset($data['story_tags']) ? $data['story_tags'] : false;
346
+		self::set_post_terms($postid, $tags, 'post_tag');
347 347
 		
348 348
 		//update date
349
-		$date  = isset( $data['post_date'] ) ? $data['post_date'] : false;
350
-		self::set_date( $postid, $date );
349
+		$date = isset($data['post_date']) ? $data['post_date'] : false;
350
+		self::set_date($postid, $date);
351 351
 		
352
-		do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() );
353
-		$response= array(
354
-			'link'   => get_permalink($postid). (($status=='publish') ? '' : '&preview=true')
352
+		do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID());
353
+		$response = array(
354
+			'link'   => get_permalink($postid).(($status == 'publish') ? '' : '&preview=true')
355 355
 		);
356 356
 		wp_send_json_success($response);
357 357
 		exit;
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 	
360 360
 	public static function enable_metasave($type)
361 361
 	{
362
-		register_rest_field( $type, 'metadata', array(
363
-			'get_callback' => function ( $data ) {
364
-				return get_post_meta( $data['id']);//, '', '' );
362
+		register_rest_field($type, 'metadata', array(
363
+			'get_callback' => function($data) {
364
+				return get_post_meta($data['id']); //, '', '' );
365 365
 			}, 
366
-			'update_callback' => function( $data, $post ) {
366
+			'update_callback' => function($data, $post) {
367 367
 				foreach ($data as $key => $value) {
368 368
 					update_post_meta($post->ID, $key, $value);
369 369
 				}
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
 	public function editus_do_shortcode()
376 376
 	{
377 377
 		
378
-		$code= $_POST["code"];
378
+		$code = $_POST["code"];
379 379
 		$code = str_replace('\"', '"', $code);
380 380
 		
381
-		$code_wrapped = lasso_wrap_shortcodes( $code);
382
-		$out =  do_shortcode($code);
381
+		$code_wrapped = lasso_wrap_shortcodes($code);
382
+		$out = do_shortcode($code);
383 383
 		if ($out != '') {
384
-			$out =  do_shortcode($code_wrapped);
384
+			$out = do_shortcode($code_wrapped);
385 385
 			echo $out;
386 386
 			exit;
387 387
 		}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 		/** @var \WP_Embed $wp_embed */
392 392
 		global $wp_embed;
393 393
 		$wp_embed->post_ID = $_POST["ID"];
394
-		$out =$wp_embed->run_shortcode( $code_wrapped );
394
+		$out = $wp_embed->run_shortcode($code_wrapped);
395 395
 		
396 396
 		echo $out;
397 397
 		exit;
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
     public function editus_do_block()
401 401
 	{
402 402
 		
403
-		$code= $_POST["code"];
403
+		$code = $_POST["code"];
404 404
 
405
-        $out = do_blocks( $code );
405
+        $out = do_blocks($code);
406 406
 		
407 407
 		echo $out;
408 408
 		exit;
@@ -412,53 +412,53 @@  discard block
 block discarded – undo
412 412
 	{
413 413
 		
414 414
 		
415
-		$code= $_POST["code"];
415
+		$code = $_POST["code"];
416 416
 		$atts = array(
417 417
 		 );
418 418
 		foreach ($_POST as $key => $value) {
419
-			if ($key !="code" && $key !="action") {
419
+			if ($key != "code" && $key != "action") {
420 420
 			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
421 421
 				$atts[$key] = $value;
422 422
 			}
423 423
 		}
424 424
 		if ($code == "aesop_video") {
425
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
425
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
426 426
 		    echo aesop_video_shortcode($atts);
427 427
 		}
428 428
 		else if ($code == "aesop_image") {
429
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
429
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
430 430
 		    echo aesop_image_shortcode($atts);
431 431
 		}
432 432
 		else if ($code == "aesop_quote") {
433
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
433
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
434 434
 		    echo aesop_quote_shortcode($atts);
435 435
 		}
436 436
 		else if ($code == "aesop_parallax") {
437
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
437
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
438 438
 		    echo aesop_parallax_shortcode($atts);
439 439
 		}
440 440
 		else if ($code == "aesop_character") {
441
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
441
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
442 442
 		    echo aesop_character_shortcode($atts);
443 443
 		}
444 444
 		else if ($code == "aesop_collection") {
445
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
445
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
446 446
 		    echo aesop_collection_shortcode($atts);
447 447
 		}
448 448
 		else if ($code == "aesop_chapter") {
449
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
449
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
450 450
 		    echo aesop_chapter_shortcode($atts);
451 451
 		}
452 452
 		else if ($code == "aesop_content") {
453
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
453
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
454 454
 		    echo aesop_content_shortcode($atts, $atts['content_data']);
455 455
 		}
456 456
 		else if ($code == "aesop_gallery") {
457
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
458
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
457
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
458
+		    echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]');
459 459
 		}
460 460
 		else if ($code == "aesop_audio") {
461
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
461
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
462 462
 		    echo aesop_audio_shortcode($atts);
463 463
 		}
464 464
 		else {
@@ -479,20 +479,20 @@  discard block
 block discarded – undo
479 479
 	public function get_ase_options()
480 480
 	{
481 481
 		$blob = lasso_editor_options_blob();
482
-		$code= $_POST["component"];
482
+		$code = $_POST["component"];
483 483
 		echo $blob[$code];
484 484
 		exit; 
485 485
 	}
486 486
 	
487 487
 	public function delete_post( ) {
488 488
 
489
-		$postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
489
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
490 490
 
491 491
 		// bail out if the current user can't publish posts
492
-		if ( !lasso_user_can( 'delete_post', $postid ) )
492
+		if (!lasso_user_can('delete_post', $postid))
493 493
 			return;
494 494
 		
495
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_delete_post' )) {
495
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_delete_post')) {
496 496
 			wp_send_json_error();
497 497
 			exit;
498 498
 		}
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 			'post_status' 	=> 'trash'
503 503
 		);
504 504
 
505
-		wp_update_post( apply_filters( 'lasso_object_deleted_args', $args ) );
505
+		wp_update_post(apply_filters('lasso_object_deleted_args', $args));
506 506
 
507
-		do_action( 'lasso_object_deleted', $postid, get_current_user_ID() );
507
+		do_action('lasso_object_deleted', $postid, get_current_user_ID());
508 508
 
509 509
 		exit;
510 510
 	}
@@ -512,40 +512,40 @@  discard block
 block discarded – undo
512 512
     /* This function doesn't actually publish post, but should be called when a post is published */
513 513
     public function on_publish_post( ) {
514 514
 
515
-		$post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
515
+		$post_id = isset($_POST['postid']) ? $_POST['postid'] : false;
516 516
         
517
-        do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
517
+        do_action('transition_post_status', 'publish', 'draft', get_post($post_id));
518 518
 
519 519
 		exit;
520 520
 	}
521 521
 	
522 522
 	public function set_featured_img( ) {
523 523
 
524
-		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
525
-		$image_id  	= isset( $_POST['image_id'] ) ? absint( $_POST['image_id'] ) : false;
526
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
524
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
525
+		$image_id = isset($_POST['image_id']) ? absint($_POST['image_id']) : false;
526
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
527 527
 			wp_send_json_error();
528 528
 			exit;
529 529
 		}	
530 530
 
531
-		set_post_thumbnail( $postid, $image_id );
531
+		set_post_thumbnail($postid, $image_id);
532 532
 
533
-		do_action( 'lasso_featured_image_set', $postid, $image_id, get_current_user_ID() );
533
+		do_action('lasso_featured_image_set', $postid, $image_id, get_current_user_ID());
534 534
 
535 535
 		exit;
536 536
 	}
537 537
 	
538 538
 	public function del_featured_img( ) {
539 539
 
540
-		$postid  = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
541
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
540
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
541
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
542 542
 			wp_send_json_error();
543 543
 			exit;
544 544
 		}	
545 545
 
546
-		delete_post_thumbnail( $postid );
546
+		delete_post_thumbnail($postid);
547 547
 
548
-		do_action( 'lasso_featured_image_deleted', $postid, get_current_user_ID() );
548
+		do_action('lasso_featured_image_deleted', $postid, get_current_user_ID());
549 549
 
550 550
 		exit;
551 551
 	}
@@ -566,17 +566,17 @@  discard block
 block discarded – undo
566 566
 		return self::$revisions;
567 567
 	}*/
568 568
 	
569
-	public function set_post_terms( $postid, $value, $taxonomy ) {
570
-		if( $value ) {
571
-			$value = explode( ',', $value );
572
-			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
569
+	public function set_post_terms($postid, $value, $taxonomy) {
570
+		if ($value) {
571
+			$value = explode(',', $value);
572
+			$allow_new_category = lasso_editor_get_option('allow_new_category', 'lasso_editor');
573 573
 			
574
-			if ($taxonomy =='category') {
574
+			if ($taxonomy == 'category') {
575 575
                 // convert from names to category ids
576 576
 				$cats = array();
577 577
 				foreach ($value as $cat) {
578 578
 					$cat_id = get_cat_ID($cat);
579
-					if ($cat_id !=0) {
579
+					if ($cat_id != 0) {
580 580
 						$cats [] = $cat_id;
581 581
 					} else if ($allow_new_category) {
582 582
 					    $cats [] = wp_create_category($cat);
@@ -585,71 +585,71 @@  discard block
 block discarded – undo
585 585
 				$value = $cats;
586 586
 			}
587 587
 	
588
-			$result = wp_set_object_terms( $postid, $value, $taxonomy );
588
+			$result = wp_set_object_terms($postid, $value, $taxonomy);
589 589
 		}
590
-		else  {
590
+		else {
591 591
 			//remove all terms from post
592
-			$result = wp_set_object_terms( $postid, null, $taxonomy );
592
+			$result = wp_set_object_terms($postid, null, $taxonomy);
593 593
 		}
594 594
 
595
-		if ( ! is_wp_error( $result ) ) {
595
+		if (!is_wp_error($result)) {
596 596
 			return true;
597
-		}else{
597
+		} else {
598 598
 			return false;
599 599
 		}
600 600
 	}
601 601
     
602 602
     public function create_gallery( ) {
603 603
 
604
-		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
604
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
605 605
         
606
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
606
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
607 607
 			wp_send_json_error();
608 608
 			exit;
609 609
 		}	
610 610
 
611
-		if (  ! lasso_user_can( 'publish_posts' ) ) {
611
+		if (!lasso_user_can('publish_posts')) {
612 612
 			return false;
613 613
 
614 614
 		}
615 615
 
616
-		$gallery_ids = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false;
616
+		$gallery_ids = isset($_POST['gallery_ids']) ? $_POST['gallery_ids'] : false;
617 617
 
618 618
 		// bail if no gallery ids
619
-		if ( empty( $gallery_ids ) ) {
619
+		if (empty($gallery_ids)) {
620 620
 			return false;
621 621
 		}
622 622
 
623
-		$type   		 = isset( $_POST['gallery_type'] ) ? $_POST['gallery_type'] : false;
624
-		$edgallerytitle	 = isset( $_POST['edgallerytitle'] ) ? $_POST['edgallerytitle'] : $postid.'-'.rand();
623
+		$type = isset($_POST['gallery_type']) ? $_POST['gallery_type'] : false;
624
+		$edgallerytitle = isset($_POST['edgallerytitle']) ? $_POST['edgallerytitle'] : $postid.'-'.rand();
625 625
 
626 626
 		// insert a new gallery
627 627
 		$args = array(
628
-			'post_title'    => $edgallerytitle ,
628
+			'post_title'    => $edgallerytitle,
629 629
 			'post_status'   => 'publish',
630 630
 			'post_type'     => 'ai_galleries'
631 631
 		);
632 632
 
633
-		$postid = wp_insert_post( apply_filters( 'lasso_insert_gallery_args', $args ) );
633
+		$postid = wp_insert_post(apply_filters('lasso_insert_gallery_args', $args));
634 634
 
635 635
 		// update gallery ids
636
-		if ( $gallery_ids ) {
636
+		if ($gallery_ids) {
637 637
 
638
-			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
638
+			update_post_meta($postid, '_ase_gallery_images', $gallery_ids);
639 639
 
640 640
 		}
641 641
 
642 642
 		// update the gallery type
643
-		if ( !empty( $type ) ) {
643
+		if (!empty($type)) {
644 644
 
645
-			update_post_meta( $postid, 'aesop_gallery_type', $type );
645
+			update_post_meta($postid, 'aesop_gallery_type', $type);
646 646
 
647 647
 		}
648 648
 
649
-		do_action( 'lasso_gallery_published', $postid, $gallery_ids, get_current_user_ID() );
649
+		do_action('lasso_gallery_published', $postid, $gallery_ids, get_current_user_ID());
650 650
 
651 651
 
652
-		echo json_encode( array(
652
+		echo json_encode(array(
653 653
 			'message' => 'gallery-created',
654 654
 			'id' => $postid)
655 655
 		);
@@ -658,114 +658,114 @@  discard block
 block discarded – undo
658 658
     
659 659
     public function update_gallery( ) {
660 660
         
661
-		$options      = isset( $_POST['fields'] ) ? $_POST['fields'] : false;
661
+		$options      = isset($_POST['fields']) ? $_POST['fields'] : false;
662 662
         
663
-		$postid   	  = !empty( $options ) ? (int) $options['id'] : false;
664
-		$gallery_ids  = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false;
665
-		if ( $_POST[ 'gallery_type' ] ) {
666
-			$type = $_POST[ 'gallery_type' ];
667
-		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
668
-			$type = $options[ 'galleryType' ];
669
-		}else{
663
+		$postid = !empty($options) ? (int) $options['id'] : false;
664
+		$gallery_ids  = isset($_POST['gallery_ids']) ? $_POST['gallery_ids'] : false;
665
+		if ($_POST['gallery_type']) {
666
+			$type = $_POST['gallery_type'];
667
+		}elseif (!empty($options) && $options['galleryType']) {
668
+			$type = $options['galleryType'];
669
+		} else {
670 670
 			$type = false;
671 671
 		}
672 672
 
673
-		self::save_gallery_options( $postid, $gallery_ids, $options, $type );
673
+		self::save_gallery_options($postid, $gallery_ids, $options, $type);
674 674
 
675
-        echo json_encode( array('message' => 'gallery-updated') );
675
+        echo json_encode(array('message' => 'gallery-updated'));
676 676
 
677 677
         exit;
678 678
 	}
679 679
     
680
-    public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
680
+    public function save_gallery_options($postid, $gallery_ids, $options, $type = false) {
681 681
 
682 682
 		// gallery width
683
-		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
683
+		$gallery_width = isset($options['width']) ? $options['width'] : false;
684 684
 
685 685
 		// gallery grid item width
686
-		$item_width = isset( $options['itemwidth'] ) ? $options['itemwidth'] : false;
686
+		$item_width = isset($options['itemwidth']) ? $options['itemwidth'] : false;
687 687
 
688 688
 		// caption
689
-		$caption = isset( $options['caption'] ) ? $options['caption'] : false;
689
+		$caption = isset($options['caption']) ? $options['caption'] : false;
690 690
 
691 691
 		// gallery transition
692
-		$transition = isset( $options['transition'] ) ? $options['transition'] : false;
692
+		$transition = isset($options['transition']) ? $options['transition'] : false;
693 693
 
694 694
 		// gallery transition speed
695
-		$transitionSpeed = isset( $options['speed'] ) ? $options['speed'] : false;
695
+		$transitionSpeed = isset($options['speed']) ? $options['speed'] : false;
696 696
 
697 697
 		// gallery hide thumbs
698
-		$hideThumbs = isset( $options['hideThumbs'] ) ? $options['hideThumbs'] : false;
698
+		$hideThumbs = isset($options['hideThumbs']) ? $options['hideThumbs'] : false;
699 699
 
700 700
 		// photoset layout hardwired to on for now
701
-		$psLayout = isset( $options['pslayout'] ) ? $options['pslayout'] : false;
701
+		$psLayout = isset($options['pslayout']) ? $options['pslayout'] : false;
702 702
 
703 703
 		// photoset layout
704
-		$psLightbox = 'on';//isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
704
+		$psLightbox = 'on'; //isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
705 705
 		
706 706
 		// hero gallery height
707
-		$gallery_height = isset( $options['height'] ) ? $options['height'] : false;
707
+		$gallery_height = isset($options['height']) ? $options['height'] : false;
708 708
 
709 709
 		// update gallery ids
710
-		if ( !empty( $gallery_ids ) ) {
710
+		if (!empty($gallery_ids)) {
711 711
 
712
-			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
712
+			update_post_meta($postid, '_ase_gallery_images', $gallery_ids);
713 713
 
714 714
 		}
715 715
 
716
-		update_post_meta( $postid, 'aesop_gallery_type', sanitize_text_field( trim( $type ) ) );
716
+		update_post_meta($postid, 'aesop_gallery_type', sanitize_text_field(trim($type)));
717 717
 
718
-		update_post_meta( $postid, 'aesop_gallery_width', sanitize_text_field( trim( $gallery_width ) ) );
718
+		update_post_meta($postid, 'aesop_gallery_width', sanitize_text_field(trim($gallery_width)));
719 719
 
720
-		update_post_meta( $postid, 'aesop_grid_gallery_width', sanitize_text_field( trim( $item_width ) ) );
720
+		update_post_meta($postid, 'aesop_grid_gallery_width', sanitize_text_field(trim($item_width)));
721 721
 
722
-		update_post_meta( $postid, 'aesop_gallery_caption', sanitize_text_field( trim( $caption ) ) );
722
+		update_post_meta($postid, 'aesop_gallery_caption', sanitize_text_field(trim($caption)));
723 723
 
724
-		update_post_meta( $postid, 'aesop_thumb_gallery_transition', sanitize_text_field( trim( $transition ) ) );
724
+		update_post_meta($postid, 'aesop_thumb_gallery_transition', sanitize_text_field(trim($transition)));
725 725
 
726
-		update_post_meta( $postid, 'aesop_thumb_gallery_transition_speed', absint( trim( $transitionSpeed ) ) );
726
+		update_post_meta($postid, 'aesop_thumb_gallery_transition_speed', absint(trim($transitionSpeed)));
727 727
 
728
-		update_post_meta( $postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field( trim( $hideThumbs ) ) );
728
+		update_post_meta($postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field(trim($hideThumbs)));
729 729
 
730
-		update_post_meta( $postid, 'aesop_photoset_gallery_layout', sanitize_text_field( trim( $psLayout ) ) );
730
+		update_post_meta($postid, 'aesop_photoset_gallery_layout', sanitize_text_field(trim($psLayout)));
731 731
 
732
-		update_post_meta( $postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field( trim( $psLightbox ) ) );
732
+		update_post_meta($postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field(trim($psLightbox)));
733 733
 		
734
-		update_post_meta( $postid, 'aesop_hero_gallery_height', sanitize_text_field( trim( $gallery_height ) ) );
734
+		update_post_meta($postid, 'aesop_hero_gallery_height', sanitize_text_field(trim($gallery_height)));
735 735
 		
736 736
 		//hardwired for now
737 737
 		
738
-		update_post_meta( $postid, 'aesop_hero_gallery_transition_speed', 300 );
738
+		update_post_meta($postid, 'aesop_hero_gallery_transition_speed', 300);
739 739
 
740 740
 	}
741 741
 	
742
-	function getEnglishMonthName($foreignMonthName){
742
+	function getEnglishMonthName($foreignMonthName) {
743 743
 
744 744
 		  setlocale(LC_ALL, 'en_US');
745 745
 
746
-		  $month_numbers = range(1,12);
746
+		  $month_numbers = range(1, 12);
747 747
 
748
-		  foreach($month_numbers as $month)
749
-			$english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011));
748
+		  foreach ($month_numbers as $month)
749
+			$english_months[] = strftime('%B', mktime(0, 0, 0, $month, 1, 2011));
750 750
 
751 751
 		  setlocale(LC_ALL, get_locale());
752 752
 
753
-		  foreach($month_numbers as $month)
754
-			$foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011)));
753
+		  foreach ($month_numbers as $month)
754
+			$foreign_months[] = utf8_encode(strftime('%B', mktime(0, 0, 0, $month, 1, 2011)));
755 755
 
756 756
 		  return str_replace($foreign_months, $english_months, $foreignMonthName);
757 757
 	}
758 758
 
759 759
 
760 760
 	
761
-	public function set_date( $postid, $value) {
762
-		if( $value ) {
763
-			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 ));
761
+	public function set_date($postid, $value) {
762
+		if ($value) {
763
+			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time('timestamp', 1));
764 764
             wp_update_post(
765
-				array (
765
+				array(
766 766
 					'ID'            => $postid, // ID of the post to update
767
-					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
768
-					'post_date_gmt'     => gmdate( 'Y-m-d H:i:s',  strtotime($value) ),
767
+					'post_date'     => date('Y-m-d H:i:s', strtotime($value)),
768
+					'post_date_gmt'     => gmdate('Y-m-d H:i:s', strtotime($value)),
769 769
 				)
770 770
 			);
771 771
 		}
Please login to merge, or discard this patch.
public/includes/register_meta_field.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@
 block discarded – undo
15 15
 	 *
16 16
 	 * @param array $fields
17 17
 	 */
18
-	public function __construct( $fields ) {
18
+	public function __construct($fields) {
19 19
 		$this->fields = $fields;
20
-		add_filter( 'lasso_api_params', function( $params ) {
21
-			foreach( $this->fields as $field => $cbs ) {
20
+		add_filter('lasso_api_params', function($params) {
21
+			foreach ($this->fields as $field => $cbs) {
22 22
 				//$field = lasso_clean_string( $field );
23
-				$params[ 'process_meta_update' ][ $field ] = $cbs;
23
+				$params['process_meta_update'][$field] = $cbs;
24 24
 			}
25 25
 
26 26
 			return $params;
27 27
 
28 28
 		});
29 29
 
30
-		add_filter( 'lasso_meta_fields', function( $allowed ) {
30
+		add_filter('lasso_meta_fields', function($allowed) {
31 31
 
32
-			foreach( array_keys( $this->fields ) as $field  ) {
32
+			foreach (array_keys($this->fields) as $field) {
33 33
 				//$field = lasso_clean_string( $field );
34 34
 				$allowed[] = $field;
35 35
 
Please login to merge, or discard this patch.
public/includes/option-engine.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -119,8 +119,9 @@  discard block
 block discarded – undo
119 119
 
120 120
 	ob_start();
121 121
 
122
-	if ( empty( $name ) || empty( $options ) || !is_array( $options ) )
123
-		return;
122
+	if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) {
123
+			return;
124
+	}
124 125
 
125 126
 	$nonce = wp_create_nonce('lasso-process-post-meta');
126 127
 	$key   = sprintf('_lasso_%s_settings', $name );
@@ -198,8 +199,9 @@  discard block
 block discarded – undo
198 199
 	$before = '<div class="lasso--postsettings__option">';
199 200
 	$after 	= '</div>';
200 201
 
201
-	if ( empty( $name ) || empty( $options ) )
202
-		return;
202
+	if ( empty( $name ) || empty( $options ) ) {
203
+			return;
204
+	}
203 205
 
204 206
 	foreach ( (array) $options as $option ) {
205 207
 
@@ -225,8 +227,9 @@  discard block
 block discarded – undo
225 227
 */
226 228
 function lasso_option_engine_option( $name = '', $option = '', $type = '') {
227 229
 
228
-	if ( empty( $type ) || empty( $option ) )
229
-		return;
230
+	if ( empty( $type ) || empty( $option ) ) {
231
+			return;
232
+	}
230 233
 
231 234
 	$id = isset( $option['id'] ) ? $option['id'] : false;
232 235
 	//$id = $id ? lasso_clean_string( $id ) : false;
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 *	Get an array of addon data for the settings modal
44 44
 *	@since 0.9.4
45 45
 */
46
-function lasso_get_modal_tabs(){
46
+function lasso_get_modal_tabs() {
47 47
 
48 48
 	$tabs = array();
49 49
 
@@ -60,34 +60,34 @@  discard block
 block discarded – undo
60 60
 *	@uses lasso_modal_addons_content()
61 61
 *	@since 0.9.4
62 62
 */
63
-function lasso_modal_addons( $type = 'tab' ){
63
+function lasso_modal_addons($type = 'tab') {
64 64
 
65 65
 	$tabs = lasso_get_modal_tabs();
66 66
 	$out = '';
67 67
 
68
-	if ( $tabs ):
68
+	if ($tabs):
69 69
 
70
-		if ( 'tab' == $type ) {
70
+		if ('tab' == $type) {
71 71
 
72 72
 			$out = '<ul class="lasso--modal__tabs">';
73 73
 
74 74
 				$out .= '<li class="active-tab" data-addon-name="core">Editus</li>';
75 75
 
76
-				foreach ( $tabs as $tab ) {
76
+				foreach ($tabs as $tab) {
77 77
 
78
-					if ( isset( $tab ) ) {
78
+					if (isset($tab)) {
79 79
 
80
-						$out .= lasso_modal_addons_content( $tab, $type );
80
+						$out .= lasso_modal_addons_content($tab, $type);
81 81
 					}
82 82
 				}
83 83
 
84 84
 			$out .= '</ul>';
85 85
 
86
-		} elseif ( 'content' == $type ) {
87
-			foreach ( $tabs as $tab ) {
86
+		} elseif ('content' == $type) {
87
+			foreach ($tabs as $tab) {
88 88
 
89
-				if ( isset( $tab ) ) {
90
-					$out .= lasso_modal_addons_content( $tab , $type );
89
+				if (isset($tab)) {
90
+					$out .= lasso_modal_addons_content($tab, $type);
91 91
 				}
92 92
 			}
93 93
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 	endif;
97 97
 
98
-	return !empty( $out ) ? $out : false;
98
+	return !empty($out) ? $out : false;
99 99
 }
100 100
 
101 101
 /**
@@ -115,26 +115,26 @@  discard block
 block discarded – undo
115 115
 *	@since 0.9.5
116 116
 *	@subpackage lasso_modal_addons_content
117 117
 */
118
-function lasso_option_form( $name = '', $options = array() ){
118
+function lasso_option_form($name = '', $options = array()) {
119 119
 
120 120
 	ob_start();
121 121
 
122
-	if ( empty( $name ) || empty( $options ) || !is_array( $options ) )
122
+	if (empty($name) || empty($options) || !is_array($options))
123 123
 		return;
124 124
 
125 125
 	$nonce = wp_create_nonce('lasso-process-post-meta');
126
-	$key   = sprintf('_lasso_%s_settings', $name );
126
+	$key   = sprintf('_lasso_%s_settings', $name);
127 127
 
128
-	$out = sprintf('<form id="lasso--custom-field-form" class="lasso--post-form">' );
128
+	$out = sprintf('<form id="lasso--custom-field-form" class="lasso--post-form">');
129 129
 
130
-		$out .= lasso_option_fields( $name, $options );
131
-		$out .='<div class="form--bottom">';
132
-			$out .='<input type="submit" value="'.__( 'Save', 'lasso' ).'">';
133
-			$out .='<input type="hidden" name="tab_name" value="'.$key.'">';
134
-			$out .='<input type="hidden" name="post_id" value="'.get_the_ID().'">';
135
-			$out .='<input type="hidden" name="nonce" value="'.$nonce.'">';
136
-			$out .='<input type="hidden" name="action" value="process_meta_update">';
137
-		$out .='</div>';
130
+		$out .= lasso_option_fields($name, $options);
131
+		$out .= '<div class="form--bottom">';
132
+			$out .= '<input type="submit" value="'.__('Save', 'lasso').'">';
133
+			$out .= '<input type="hidden" name="tab_name" value="'.$key.'">';
134
+			$out .= '<input type="hidden" name="post_id" value="'.get_the_ID().'">';
135
+			$out .= '<input type="hidden" name="nonce" value="'.$nonce.'">';
136
+			$out .= '<input type="hidden" name="action" value="process_meta_update">';
137
+		$out .= '</div>';
138 138
 
139 139
 	$out .= '</form>';
140 140
 	
@@ -192,20 +192,20 @@  discard block
 block discarded – undo
192 192
 *	@since 0.9.5
193 193
 *	@subpackage lasso_modal_addons_content
194 194
 */
195
-function lasso_option_fields( $name = '', $options = array() ){
195
+function lasso_option_fields($name = '', $options = array()) {
196 196
 
197
-	$out 	= '';
197
+	$out = '';
198 198
 	$before = '<div class="lasso--postsettings__option">';
199 199
 	$after 	= '</div>';
200 200
 
201
-	if ( empty( $name ) || empty( $options ) )
201
+	if (empty($name) || empty($options))
202 202
 		return;
203 203
 
204
-	foreach ( (array) $options as $option ) {
204
+	foreach ((array) $options as $option) {
205 205
 
206
-		$type = isset( $option['type'] ) ? $option['type'] : 'text';
206
+		$type = isset($option['type']) ? $option['type'] : 'text';
207 207
 		
208
-		$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,$type ), $after );
208
+		$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, $type), $after);
209 209
 
210 210
 	}
211 211
 	
@@ -223,44 +223,44 @@  discard block
 block discarded – undo
223 223
 *	@param $type string text, textarea, checkbox, color
224 224
 *	@since 5.0
225 225
 */
226
-function lasso_option_engine_option( $name = '', $option = '', $type = '') {
226
+function lasso_option_engine_option($name = '', $option = '', $type = '') {
227 227
 
228
-	if ( empty( $type ) || empty( $option ) )
228
+	if (empty($type) || empty($option))
229 229
 		return;
230 230
 
231
-	$id = isset( $option['id'] ) ? $option['id'] : false;
231
+	$id = isset($option['id']) ? $option['id'] : false;
232 232
 	//$id = $id ? lasso_clean_string( $id ) : false;
233 233
 
234
-	$desc = isset( $option['desc'] ) ? $option['desc'] : false;
234
+	$desc = isset($option['desc']) ? $option['desc'] : false;
235 235
 
236
-	$value = get_post_meta( get_the_id(), $option[ 'id' ], true );
236
+	$value = get_post_meta(get_the_id(), $option['id'], true);
237 237
 
238
-	switch ( $type ) {
238
+	switch ($type) {
239 239
 		case 'text':
240
-			$out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">',$id, esc_html( $desc ), $id, $id, $value );
240
+			$out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">', $id, esc_html($desc), $id, $id, $value);
241 241
 			break;
242 242
 		case 'textarea':
243
-			$out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>',$id, esc_html( $desc ), $id, $id, $value );
243
+			$out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>', $id, esc_html($desc), $id, $id, $value);
244 244
 			break;
245 245
 		case 'imgurl':
246
-			$out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image"  class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div><div title="Remove Image"  class="editus-customtab-image-remove" style="float:left;"><i class="lasso-icon-bin2" style="font-size:20px;padding:5px;"></i></div>',$id, esc_html( $desc ), $value, $id, $id,  $value );
246
+			$out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image"  class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div><div title="Remove Image"  class="editus-customtab-image-remove" style="float:left;"><i class="lasso-icon-bin2" style="font-size:20px;padding:5px;"></i></div>', $id, esc_html($desc), $value, $id, $id, $value);
247 247
 			break;
248 248
 		case 'checkbox':
249
-			$out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s',$id, $id, $id ,esc_html( $desc ) );
249
+			$out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s', $id, $id, $id, esc_html($desc));
250 250
 			break;
251 251
 		case 'dropdown':
252
-			$out = sprintf('<label for="lasso--post-option-%s">%s</label><select id="lasso--post-option-%s" name="%s">',$id, esc_html( $desc ), $id, $id);
252
+			$out = sprintf('<label for="lasso--post-option-%s">%s</label><select id="lasso--post-option-%s" name="%s">', $id, esc_html($desc), $id, $id);
253 253
 			$options = explode(";", $option['options']);
254 254
 			foreach ($options as &$opt) {
255 255
 				$opts = explode(":", $opt);
256 256
 				if ($opts[0] == $value) {
257
-					$out .= sprintf('<option value = "%s" selected>%s</option>',$opts[0], $opts[1]);
257
+					$out .= sprintf('<option value = "%s" selected>%s</option>', $opts[0], $opts[1]);
258 258
 				} else {
259
-					$out .= sprintf('<option value = "%s">%s</option>',$opts[0], $opts[1]);
259
+					$out .= sprintf('<option value = "%s">%s</option>', $opts[0], $opts[1]);
260 260
 				}
261 261
 			}
262 262
 			
263
-			$out .='</select>';
263
+			$out .= '</select>';
264 264
 			break;
265 265
 	}
266 266
 
Please login to merge, or discard this patch.
includes/process/meta.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		 */
43 43
 		$allowed_fields = apply_filters( 'lasso_meta_fields', array() );
44 44
         
45
-        file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true));
45
+		file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true));
46 46
         
47 47
 		if ( ! empty( $allowed_fields ) ) {
48 48
 			foreach( $allowed_fields as $field ) {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			}
55 55
 		}
56 56
 
57
-        do_action( 'editus_after_meta_update', $post_id, $data );
57
+		do_action( 'editus_after_meta_update', $post_id, $data );
58 58
 
59 59
 
60 60
 		return true;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return bool Always returns true.
30 30
 	 */
31
-	public function update( $data ) {
31
+	public function update($data) {
32 32
 
33
-		$post_id = isset( $data['post_id'] ) ? $data['post_id'] : false;
33
+		$post_id = isset($data['post_id']) ? $data['post_id'] : false;
34 34
 
35 35
 			
36 36
 		/**
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @param array $allowed_fields The fields
42 42
 		 */
43
-		$allowed_fields = apply_filters( 'lasso_meta_fields', array() );
43
+		$allowed_fields = apply_filters('lasso_meta_fields', array());
44 44
         
45
-        file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true));
45
+        file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data, true));
46 46
         
47
-		if ( ! empty( $allowed_fields ) ) {
48
-			foreach( $allowed_fields as $field ) {
49
-				if ( isset( $data[ $field ] ) ) {
47
+		if (!empty($allowed_fields)) {
48
+			foreach ($allowed_fields as $field) {
49
+				if (isset($data[$field])) {
50 50
 					//this original line changed dash to underscore
51 51
 					//update_post_meta( $post_id, lasso_unclean_string( $field ), $data[ $field ]  );
52
-					update_post_meta( $post_id,  $field, $data[ $field ]  );
52
+					update_post_meta($post_id, $field, $data[$field]);
53 53
 				}
54 54
 			}
55 55
 		}
56 56
 
57
-        do_action( 'editus_after_meta_update', $post_id, $data );
57
+        do_action('editus_after_meta_update', $post_id, $data);
58 58
 
59 59
 
60 60
 		return true;
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @return array Array of keys to pull from $data per action and their sanitization callback
70 70
 	 */
71
-	public static function params(){
72
-		$params[ 'process_meta_update' ] = array(
71
+	public static function params() {
72
+		$params['process_meta_update'] = array(
73 73
 			'post_id' 	=> 'absint',
74 74
 			'tab_name'	=> 'trim'
75 75
 		);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @return array Array of additional functions to use to authorize action.
87 87
 	 */
88 88
 	public static function auth_callbacks() {
89
-		$params[ 'process_meta_update' ] = array(
89
+		$params['process_meta_update'] = array(
90 90
 			'lasso_user_can'
91 91
 		);
92 92
 
Please login to merge, or discard this patch.
includes/process/map.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 			}
46 46
 
47 47
 			// udpate start point
48
-            $point = json_decode( $start_point, true );
48
+			$point = json_decode( $start_point, true );
49 49
 			update_post_meta( $postid, 'ase_map_component_start_point', $point );
50 50
 
51 51
 			// update zoom
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,28 +28,28 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return bool Always returns true.
30 30
 	 */
31
-	public function save( $data ) {
31
+	public function save($data) {
32 32
 
33
-		$postid     	= isset( $data['postid'] ) ? $data['postid'] : false;
34
-		$locations    	= isset( $data['ase-map-component-locations'] ) ? $data['ase-map-component-locations'] : false;
35
-		$start_point    = isset( $data['ase-map-component-start-point'] ) ? $data['ase-map-component-start-point']: false;
36
-		$zoom       	= isset( $data['ase-map-component-zoom'] ) ? $data['ase-map-component-zoom' ] : false;
33
+		$postid     	= isset($data['postid']) ? $data['postid'] : false;
34
+		$locations = isset($data['ase-map-component-locations']) ? $data['ase-map-component-locations'] : false;
35
+		$start_point = isset($data['ase-map-component-start-point']) ? $data['ase-map-component-start-point'] : false;
36
+		$zoom       	= isset($data['ase-map-component-zoom']) ? $data['ase-map-component-zoom'] : false;
37 37
         
38
-		if ( is_array( $locations ) ) {
39
-			delete_post_meta( $postid, 'ase_map_component_locations' );
38
+		if (is_array($locations)) {
39
+			delete_post_meta($postid, 'ase_map_component_locations');
40 40
 
41 41
 			// update locations if set
42
-			foreach ( $locations as $location ) {
43
-				$point = json_decode( urldecode( $location ), true );
44
-				add_post_meta( $postid, 'ase_map_component_locations', $point );
42
+			foreach ($locations as $location) {
43
+				$point = json_decode(urldecode($location), true);
44
+				add_post_meta($postid, 'ase_map_component_locations', $point);
45 45
 			}
46 46
 
47 47
 			// udpate start point
48
-            $point = json_decode( $start_point, true );
49
-			update_post_meta( $postid, 'ase_map_component_start_point', $point );
48
+            $point = json_decode($start_point, true);
49
+			update_post_meta($postid, 'ase_map_component_start_point', $point);
50 50
 
51 51
 			// update zoom
52
-			update_post_meta( $postid, 'ase_map_component_zoom', $zoom );
52
+			update_post_meta($postid, 'ase_map_component_zoom', $zoom);
53 53
 		}
54 54
 
55 55
 		return true;
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return array Array of keys to pull from $_POST per action and their sanitization callback
65 65
 	 */
66
-	public static function params(){
67
-		$params[ 'process_map_save' ] = array(
66
+	public static function params() {
67
+		$params['process_map_save'] = array(
68 68
 			'postid' => 'absint',
69 69
 			'ase-map-component-locations' => 'lasso_sanitize_data',
70 70
 			'ase-map-component-start-point' => array(
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @return array Array of additional functions to use to authorize action.
89 89
 	 */
90 90
 	public static function auth_callbacks() {
91
-		$params[ 'process_map_save' ] = array(
91
+		$params['process_map_save'] = array(
92 92
 			'lasso_user_can'
93 93
 		);
94 94
 
Please login to merge, or discard this patch.
public/includes/assets.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
     {
20 20
         global $post;
21 21
         $pos = strpos($post->post_content, "<!--nextpage-->");
22
-        if (!$pos) return -1;
22
+        if (!$pos) {
23
+        	return -1;
24
+        }
23 25
         
24 26
         global $wp;
25 27
         $url =  home_url( $wp->request );
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 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');
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			$tz_offset = get_UTC_offset();
127 127
 			$post_date = get_the_time('U', $postid);
128 128
 			$time = (time()+$tz_offset);
129
-            $delta = $time - $post_date;
129
+			$delta = $time - $post_date;
130 130
             
131 131
 			$strings = array(
132 132
 				'save' 				=> __('Save','lasso'),
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 			$gallery_nonce = wp_create_nonce( $gallery_nonce_action );
182 182
 			
183 183
 			
184
-            if ($allow_change_date) {
185
-			    $permalink = get_site_url().'/?p='.$postid;
186
-            } else {
187
-                $permalink = get_permalink($postid);
188
-            }
184
+			if ($allow_change_date) {
185
+				$permalink = get_site_url().'/?p='.$postid;
186
+			} else {
187
+				$permalink = get_permalink($postid);
188
+			}
189 189
 			
190 190
 			// rest api
191 191
 			$rest_nonce = '';
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 				}
206 206
 			}
207 207
             
208
-            //find if this is multi page. -1 if not
209
-            $multipage = self::is_multipage();
210
-            $post_content = "";
211
-            //pass post_content if we need to process multipage. In future we may need to pass this for other purposes
212
-            if ($multipage != -1) {
213
-               $post_content = $post->post_content;
214
-            }
208
+			//find if this is multi page. -1 if not
209
+			$multipage = self::is_multipage();
210
+			$post_content = "";
211
+			//pass post_content if we need to process multipage. In future we may need to pass this for other purposes
212
+			if ($multipage != -1) {
213
+			   $post_content = $post->post_content;
214
+			}
215 215
 
216 216
 			// localized objects
217 217
 			$objects = array(
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
 				'customFields'      => $custom_fields,
288 288
 				'clickToInsert'     => ($insert_comp_ui =='click'),
289 289
 				'buttonOnEmptyP'     => ($insert_comp_ui =='mediumcom'),      // auto show a button to insert components on an empty paragraph      
290
-                'rtl'               => is_rtl(),				
290
+				'rtl'               => is_rtl(),				
291 291
 				'skipToEdit'        =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode
292 292
 				'linksEditable'    => $links_editable,
293 293
 				'supportPendingStatus' => !$no_pending_status,
294 294
 				'tableCode' => apply_filters( 'lasso_table_html_code','<table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table>'),
295
-                'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//,
296
-                'multipages'=> $multipage,
297
-                'post_content'=>$post_content
295
+				'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//,
296
+				'multipages'=> $multipage,
297
+				'post_content'=>$post_content
298 298
 			);
299 299
 
300 300
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			
303 303
 			
304 304
 			if (!$using_restapiv2) {
305
-               // enqueue REST API V1
305
+			   // enqueue REST API V1
306 306
 			   wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true );
307 307
 			   $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) );
308 308
 			   wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings );
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			if ($show_color) {
319 319
 				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true);
320 320
 			} else {
321
-			    wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
321
+				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
322 322
 			}
323 323
 			wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) );
324 324
 
@@ -327,44 +327,44 @@  discard block
 block discarded – undo
327 327
 
328 328
 	}
329 329
     
330
-    function gutenberg_active() {
330
+	function gutenberg_active() {
331 331
         
332
-        // Gutenberg plugin is installed and activated.
333
-        $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
334
-
335
-        // Block editor since 5.0.
336
-        $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
337
-
338
-        if ( ! $gutenberg && ! $block_editor ) {
339
-            return false;
340
-        }
341
-
342
-        if ( self::is_classic_editor_plugin_active() ) {
343
-            $editor_option       = get_option( 'classic-editor-replace' );
344
-            $block_editor_active = array( 'no-replace', 'block' );
345
-
346
-            return in_array( $editor_option, $block_editor_active, true );
347
-        }
348
-
349
-        return true;
350
-    }
351
-
352
-    /**
353
-     * Check if Classic Editor plugin is active.
354
-     *
355
-     * @return bool
356
-     */
357
-    function is_classic_editor_plugin_active() {
358
-        if ( ! function_exists( 'is_plugin_active' ) ) {
359
-            include_once ABSPATH . 'wp-admin/includes/plugin.php';
360
-        }
361
-
362
-        if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
363
-            return true;
364
-        }
365
-
366
-        return false;
367
-    }
332
+		// Gutenberg plugin is installed and activated.
333
+		$gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
334
+
335
+		// Block editor since 5.0.
336
+		$block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
337
+
338
+		if ( ! $gutenberg && ! $block_editor ) {
339
+			return false;
340
+		}
341
+
342
+		if ( self::is_classic_editor_plugin_active() ) {
343
+			$editor_option       = get_option( 'classic-editor-replace' );
344
+			$block_editor_active = array( 'no-replace', 'block' );
345
+
346
+			return in_array( $editor_option, $block_editor_active, true );
347
+		}
348
+
349
+		return true;
350
+	}
351
+
352
+	/**
353
+	 * Check if Classic Editor plugin is active.
354
+	 *
355
+	 * @return bool
356
+	 */
357
+	function is_classic_editor_plugin_active() {
358
+		if ( ! function_exists( 'is_plugin_active' ) ) {
359
+			include_once ABSPATH . 'wp-admin/includes/plugin.php';
360
+		}
361
+
362
+		if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
363
+			return true;
364
+		}
365
+
366
+		return false;
367
+	}
368 368
 
369 369
 }
370 370
 
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
 
11 11
 class assets {
12 12
 
13
-	public function __construct(){
13
+	public function __construct() {
14 14
 
15
-		add_action('wp_enqueue_scripts', array($this,'scripts'));
15
+		add_action('wp_enqueue_scripts', array($this, 'scripts'));
16 16
 	}
17 17
     
18 18
     function is_multipage()
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
         if (!$pos) return -1;
23 23
         
24 24
         global $wp;
25
-        $url =  home_url( $wp->request );
26
-        $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1;
25
+        $url = home_url($wp->request);
26
+        $index = intval(basename($url)) == 0 ? 0 : intval(basename($url)) - 1;
27 27
         return $index;        
28 28
     }
29 29
 
30
-	public function scripts(){
30
+	public function scripts() {
31 31
 
32 32
 	
33 33
 		global $post;
34
-		if ( lasso_user_can('edit_posts') 
34
+		if (lasso_user_can('edit_posts') 
35 35
 		     /* uncomment this line to disable Editus on Gutenberg posts*/
36 36
              /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content)  && !is_home()) */              
37 37
              ) {
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 			/**    Returns the time offset from UTC
40 40
 			*/
41 41
 			function get_UTC_offset() {
42
-				$timezone_string = get_option( 'timezone_string' );
43
-				if (empty( $timezone_string ) ) {
44
-					return get_option('gmt_offset')*3600;
42
+				$timezone_string = get_option('timezone_string');
43
+				if (empty($timezone_string)) {
44
+					return get_option('gmt_offset') * 3600;
45 45
 				}
46 46
 				
47 47
 				$origin_dtz = new \DateTimeZone($timezone_string);				
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 			wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true);
54 54
 
55 55
             //don't load autocomplete if it's a stockholm theme
56
-			$themename  	= wp_get_theme()->get('Name');
57
-			if ($themename !='Stockholm' ) {
56
+			$themename = wp_get_theme()->get('Name');
57
+			if ($themename != 'Stockholm') {
58 58
 				wp_enqueue_script('jquery-ui-autocomplete');
59 59
 			}
60 60
 			wp_enqueue_script('jquery-ui-draggable');
@@ -67,28 +67,28 @@  discard block
 block discarded – undo
67 67
 			// url for json api
68 68
 			$home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false;
69 69
 
70
-			$article_object 	= lasso_editor_get_option('article_class','lasso_editor');
70
+			$article_object 	= lasso_editor_get_option('article_class', 'lasso_editor');
71 71
 
72
-			$article_object 	= empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object;
72
+			$article_object 	= empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object;
73 73
 
74
-			$featImgClass 		= lasso_editor_get_option('featimg_class','lasso_editor');
75
-			if (empty( $featImgClass )) {
74
+			$featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor');
75
+			if (empty($featImgClass)) {
76 76
 				$featImgClass = lasso_get_supported_theme_featured_image_class();
77 77
 			}
78
-			$titleClass 		= lasso_editor_get_option('title_class','lasso_editor');
79
-			if (empty( $titleClass )) {
78
+			$titleClass = lasso_editor_get_option('title_class', 'lasso_editor');
79
+			if (empty($titleClass)) {
80 80
 				$titleClass = lasso_get_supported_theme_title_class();
81 81
 			}
82
-			$toolbar_headings  	= lasso_editor_get_option('toolbar_headings', 'lasso_editor');
83
-			$toolbar_headings_h4  	= lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor');
82
+			$toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor');
83
+			$toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor');
84 84
 			$objectsNoSave  	= lasso_editor_get_option('dont_save', 'lasso_editor');
85
-			$objectsNonEditable  	= lasso_editor_get_option('non_editable', 'lasso_editor');
85
+			$objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor');
86 86
 			$disableRESTSave = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor');
87
-			$save_to_post_disabled  = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' );
88
-			$edit_post_disabled  = lasso_editor_get_option( 'post_edit_disabled', 'lasso_editor' );
87
+			$save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor');
88
+			$edit_post_disabled = lasso_editor_get_option('post_edit_disabled', 'lasso_editor');
89 89
 			
90
-			$bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b');
91
-			$i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i');
90
+			$bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor', 'b');
91
+			$i_tag = lasso_editor_get_option('i_tag', 'lasso_editor', 'i');
92 92
 
93 93
 			
94 94
 			//text alignement
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 			
106 106
 			if ($show_color) {
107 107
 				//color picker
108
-				wp_enqueue_style( 'wp-color-picker' );
109
-				wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
108
+				wp_enqueue_style('wp-color-picker');
109
+				wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1);
110 110
 			}
111 111
 			
112 112
 			// click to insert components, not drag and drop
@@ -118,54 +118,54 @@  discard block
 block discarded – undo
118 118
 			
119 119
 			// custom fields
120 120
 			
121
-			$custom_fields = apply_filters( 'editus_custom_fields', null ); 
121
+			$custom_fields = apply_filters('editus_custom_fields', null); 
122 122
 
123 123
 
124 124
 			// post id reference
125 125
 			$postid 			= get_the_ID();
126 126
 			$tz_offset = get_UTC_offset();
127 127
 			$post_date = get_the_time('U', $postid);
128
-			$time = (time()+$tz_offset);
128
+			$time = (time() + $tz_offset);
129 129
             $delta = $time - $post_date;
130 130
             
131 131
 			$strings = array(
132
-				'save' 				=> __('Save','lasso'),
133
-				'selectText'	  	=> __('Please Select Text First.','lasso'),
134
-				'cancel' 			=> __('Cancel','lasso'),
135
-				'exiteditor' 		=> __('Exit Editor','lasso'),
136
-				'saving' 			=> __('Saving...','lasso'),
137
-				'saved'				=> __('Saved!','lasso'),
138
-				'adding' 			=> __('Adding...','lasso'),
139
-				'added'				=> __('Added!','lasso'),
140
-				'loading' 			=> __('Loading...','lasso'),
141
-				'loadMore'			=> __('Load More','lasso'),
142
-				'close'			=> __('Close','lasso'),
143
-				'noPostsFound'		=> __('No more posts found','lasso'),
144
-				'fetchFail'	    	=> __('Fetching failed.','lasso'),
145
-				'galleryCreated' 	=> __('Gallery Created!','lasso'),
146
-				'galleryUpdated' 	=> __('Gallery Updated!','lasso'),
147
-				'justWrite'			=> __('Just write...','lasso'),
148
-				'chooseImage'		=> __('Choose an image','lasso'),
149
-				'updateImage'		=> __('Update Image','lasso'),
150
-				'insertImage'		=> __('Insert Image','lasso'),
151
-				'selectImage'		=> __('Select Image','lasso'),
152
-				'removeFeatImg'     => __('Remove featured image?','lasso'),
153
-				'updateSelectedImg' => __('Update Selected Image','lasso'),
154
-				'chooseImages'		=> __('Choose images','lasso'),
155
-				'editImage'			=> __('Edit Image','lasso'),
156
-				'addImages'			=> __('Add Images','lasso'),
157
-				'addNewGallery'		=> __('Add New Gallery','lasso'),
158
-				'selectGallery'		=> __('Select Editus Gallery Image','lasso'),
159
-				'useSelectedImages' => __('Use Selected Images','lasso'),
160
-				'publishPost'		=> __('Publish Post?','lasso'),
161
-				'publishYes'		=> __('Yes, publish it!','lasso'),
162
-				'deletePost'		=> __('Trash Post?','lasso'),
163
-				'deleteYes'			=> __('Yes, trash it!','lasso'),
164
-				'warning'			=> __('Oh snap!','laso'),
165
-				'cancelText'		=> __('O.K. got it!','lasso'),
166
-				'missingClass'		=> __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.','lasso'),
132
+				'save' 				=> __('Save', 'lasso'),
133
+				'selectText'	  	=> __('Please Select Text First.', 'lasso'),
134
+				'cancel' 			=> __('Cancel', 'lasso'),
135
+				'exiteditor' 		=> __('Exit Editor', 'lasso'),
136
+				'saving' 			=> __('Saving...', 'lasso'),
137
+				'saved'				=> __('Saved!', 'lasso'),
138
+				'adding' 			=> __('Adding...', 'lasso'),
139
+				'added'				=> __('Added!', 'lasso'),
140
+				'loading' 			=> __('Loading...', 'lasso'),
141
+				'loadMore'			=> __('Load More', 'lasso'),
142
+				'close'			=> __('Close', 'lasso'),
143
+				'noPostsFound'		=> __('No more posts found', 'lasso'),
144
+				'fetchFail'	    	=> __('Fetching failed.', 'lasso'),
145
+				'galleryCreated' 	=> __('Gallery Created!', 'lasso'),
146
+				'galleryUpdated' 	=> __('Gallery Updated!', 'lasso'),
147
+				'justWrite'			=> __('Just write...', 'lasso'),
148
+				'chooseImage'		=> __('Choose an image', 'lasso'),
149
+				'updateImage'		=> __('Update Image', 'lasso'),
150
+				'insertImage'		=> __('Insert Image', 'lasso'),
151
+				'selectImage'		=> __('Select Image', 'lasso'),
152
+				'removeFeatImg'     => __('Remove featured image?', 'lasso'),
153
+				'updateSelectedImg' => __('Update Selected Image', 'lasso'),
154
+				'chooseImages'		=> __('Choose images', 'lasso'),
155
+				'editImage'			=> __('Edit Image', 'lasso'),
156
+				'addImages'			=> __('Add Images', 'lasso'),
157
+				'addNewGallery'		=> __('Add New Gallery', 'lasso'),
158
+				'selectGallery'		=> __('Select Editus Gallery Image', 'lasso'),
159
+				'useSelectedImages' => __('Use Selected Images', 'lasso'),
160
+				'publishPost'		=> __('Publish Post?', 'lasso'),
161
+				'publishYes'		=> __('Yes, publish it!', 'lasso'),
162
+				'deletePost'		=> __('Trash Post?', 'lasso'),
163
+				'deleteYes'			=> __('Yes, trash it!', 'lasso'),
164
+				'warning'			=> __('Oh snap!', 'laso'),
165
+				'cancelText'		=> __('O.K. got it!', 'lasso'),
166
+				'missingClass'		=> __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.', 'lasso'),
167 167
 				'missingConfirm'	=> __('Update Settings', 'lasso'),
168
-				'helperText'		=> __('one more letter','lasso'),
168
+				'helperText'		=> __('one more letter', 'lasso'),
169 169
 				'editingBackup'  	=> __('You are currently editing a backup copy of this post.'),
170 170
 				
171 171
 				'catsPlaceholder'     => __('add categories...'),
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 				
175 175
 			);
176 176
 
177
-			$api_url = trailingslashit( home_url() ) . 'lasso-internal-api';
177
+			$api_url = trailingslashit(home_url()).'lasso-internal-api';
178 178
 
179 179
 			$gallery_class = new gallery();
180 180
 			$gallery_nonce_action = $gallery_class->nonce_action;
181
-			$gallery_nonce = wp_create_nonce( $gallery_nonce_action );
181
+			$gallery_nonce = wp_create_nonce($gallery_nonce_action);
182 182
 			
183 183
 			
184 184
             if ($allow_change_date) {
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 			  
194 194
 			if (function_exists('rest_url')) {
195 195
 				//$rest_root = esc_url_raw( rest_url());
196
-				$rest_nonce = wp_create_nonce( 'wp_rest' );
197
-				$settings = array( 'root' => $rest_root, 'nonce' => $rest_nonce );
198
-				wp_enqueue_script( 'wp-api', '', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true );
199
-				wp_localize_script( 'wp-api', 'wpApiSettings', $settings );
200
-				wp_localize_script( 'wp-api', 'WP_API_Settings', $settings );
196
+				$rest_nonce = wp_create_nonce('wp_rest');
197
+				$settings = array('root' => $rest_root, 'nonce' => $rest_nonce);
198
+				wp_enqueue_script('wp-api', '', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true);
199
+				wp_localize_script('wp-api', 'wpApiSettings', $settings);
200
+				wp_localize_script('wp-api', 'WP_API_Settings', $settings);
201 201
 				
202
-				if ( class_exists( 'WP_REST_Controller' )) {
202
+				if (class_exists('WP_REST_Controller')) {
203 203
 					// we are using REST API V2
204 204
 					$using_restapiv2 = true;
205 205
 				}
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 
216 216
 			// localized objects
217 217
 			$objects = array(
218
-				'ajaxurl' 			=> esc_url( $api_url ),
219
-				'ajaxurl2' 			=> esc_url( admin_url( 'admin-ajax.php' )),
218
+				'ajaxurl' 			=> esc_url($api_url),
219
+				'ajaxurl2' 			=> esc_url(admin_url('admin-ajax.php')),
220 220
 				'siteUrl'           => site_url(),
221 221
 				'rest_root'         => $rest_root,
222 222
 				'rest_nonce'        => $rest_nonce,
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 				'featImgClass'		=> $featImgClass,
226 226
 				'titleClass'		=> $titleClass,
227 227
 				'strings'			=> $strings,
228
-				'settingsLink'		=> function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ),
229
-				'post_status'		=> get_post_status( $postid ),
228
+				'settingsLink'		=> function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'),
229
+				'post_status'		=> get_post_status($postid),
230 230
 				'postid'			=> $postid,
231 231
 				'permalink'			=> $permalink,
232 232
 				'edit_others_pages'	=> current_user_can('edit_others_pages') ? true : false,
233 233
 				'edit_others_posts'	=> current_user_can('edit_others_posts') ? true : false,
234
-				'userCanEdit'		=> current_user_can('edit_post', $postid ),
234
+				'userCanEdit'		=> current_user_can('edit_post', $postid),
235 235
 				'can_publish'		=> is_page() ? current_user_can('publish_pages') : current_user_can('publish_posts'),
236 236
 				//'can_publish_posts'	=> current_user_can('publish_posts'),
237 237
 				//'can_publish_pages'	=> current_user_can('publish_pages'),
@@ -267,32 +267,32 @@  discard block
 block discarded – undo
267 267
 				'postTags'    		=> lasso_get_objects('tag'),
268 268
 				'noResultsDiv'		=> lasso_editor_empty_results(),
269 269
 				'noRevisionsDiv'	=> lasso_editor_empty_results('revision'),
270
-				'mapTileProvider'   => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false,
271
-				'mapLocations'		=> get_post_meta( $postid, 'ase_map_component_locations' ),
272
-				'mapStart'			=> get_post_meta( $postid, 'ase_map_component_start_point', true ),
273
-				'mapZoom'			=> get_post_meta( $postid, 'ase_map_component_zoom', true ),
270
+				'mapTileProvider'   => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false,
271
+				'mapLocations'		=> get_post_meta($postid, 'ase_map_component_locations'),
272
+				'mapStart'			=> get_post_meta($postid, 'ase_map_component_start_point', true),
273
+				'mapZoom'			=> get_post_meta($postid, 'ase_map_component_zoom', true),
274 274
 				'revisionModal' 	=> lasso_editor_revision_modal(),
275 275
 				'isMobile'          => wp_is_mobile(),
276
-				'enableAutoSave'    => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ),
276
+				'enableAutoSave'    => lasso_editor_get_option('enable_autosave', 'lasso_editor'),
277 277
 				'showColor'         => $show_color,
278 278
 				'showAlignment'     => $show_align,
279 279
 				'showIgnoredItems'  => lasso_editor_get_option('show_ignored_items', 'lasso_editor'),
280 280
 				'restapi2'          => $using_restapiv2,
281 281
 				'saveusingrest'     => $using_restapiv2 && !$disableRESTSave,
282
-				'newObjectContent'  => '<p>'.apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ).'</p>',
282
+				'newObjectContent'  => '<p>'.apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')).'</p>',
283 283
 				'disableSavePost'   => $save_to_post_disabled,
284 284
 				'disableEditPost'   => $edit_post_disabled,
285 285
 				'boldTag'           => $bold_tag,
286 286
 				'iTag'           	=> $i_tag,
287 287
 				'customFields'      => $custom_fields,
288
-				'clickToInsert'     => ($insert_comp_ui =='click'),
289
-				'buttonOnEmptyP'     => ($insert_comp_ui =='mediumcom'),      // auto show a button to insert components on an empty paragraph      
288
+				'clickToInsert'     => ($insert_comp_ui == 'click'),
289
+				'buttonOnEmptyP'     => ($insert_comp_ui == 'mediumcom'), // auto show a button to insert components on an empty paragraph      
290 290
                 'rtl'               => is_rtl(),				
291
-				'skipToEdit'        =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode
291
+				'skipToEdit'        =>($delta < 10 && $delta >= 0), // if it's a new post, skip to edit mode
292 292
 				'linksEditable'    => $links_editable,
293 293
 				'supportPendingStatus' => !$no_pending_status,
294
-				'tableCode' => apply_filters( 'lasso_table_html_code','<table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table>'),
295
-                'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//,
294
+				'tableCode' => apply_filters('lasso_table_html_code', '<table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table>'),
295
+                'hasGutenberg' => (function_exists('has_blocks') && has_blocks($post->post_content)) || self::gutenberg_active(), //,
296 296
                 'multipages'=> $multipage,
297 297
                 'post_content'=>$post_content
298 298
 			);
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 			
304 304
 			if (!$using_restapiv2) {
305 305
                // enqueue REST API V1
306
-			   wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true );
307
-			   $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) );
308
-			   wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings );
306
+			   wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true);
307
+			   $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json'));
308
+			   wp_localize_script('wp-api-js', 'WP_API_Settings', $settings);
309 309
 			}
310 310
 			
311 311
 			if ($allow_change_date) {
@@ -314,13 +314,13 @@  discard block
 block discarded – undo
314 314
 				wp_enqueue_style('jquery-ui');
315 315
 			}
316 316
 
317
-			$postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min';
317
+			$postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min';
318 318
 			if ($show_color) {
319
-				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true);
319
+				wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api', 'iris'), LASSO_VERSION, true);
320 320
 			} else {
321
-			    wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
321
+			    wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
322 322
 			}
323
-			wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) );
323
+			wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects));
324 324
 
325 325
 
326 326
 		}
@@ -330,20 +330,20 @@  discard block
 block discarded – undo
330 330
     function gutenberg_active() {
331 331
         
332 332
         // Gutenberg plugin is installed and activated.
333
-        $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
333
+        $gutenberg = !(false === has_filter('replace_editor', 'gutenberg_init'));
334 334
 
335 335
         // Block editor since 5.0.
336
-        $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
336
+        $block_editor = version_compare($GLOBALS['wp_version'], '5.0-beta', '>');
337 337
 
338
-        if ( ! $gutenberg && ! $block_editor ) {
338
+        if (!$gutenberg && !$block_editor) {
339 339
             return false;
340 340
         }
341 341
 
342
-        if ( self::is_classic_editor_plugin_active() ) {
343
-            $editor_option       = get_option( 'classic-editor-replace' );
344
-            $block_editor_active = array( 'no-replace', 'block' );
342
+        if (self::is_classic_editor_plugin_active()) {
343
+            $editor_option       = get_option('classic-editor-replace');
344
+            $block_editor_active = array('no-replace', 'block');
345 345
 
346
-            return in_array( $editor_option, $block_editor_active, true );
346
+            return in_array($editor_option, $block_editor_active, true);
347 347
         }
348 348
 
349 349
         return true;
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
      * @return bool
356 356
      */
357 357
     function is_classic_editor_plugin_active() {
358
-        if ( ! function_exists( 'is_plugin_active' ) ) {
359
-            include_once ABSPATH . 'wp-admin/includes/plugin.php';
358
+        if (!function_exists('is_plugin_active')) {
359
+            include_once ABSPATH.'wp-admin/includes/plugin.php';
360 360
         }
361 361
 
362
-        if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
362
+        if (is_plugin_active('classic-editor/classic-editor.php')) {
363 363
             return true;
364 364
         }
365 365
 
Please login to merge, or discard this patch.
public/includes/editor-modules--gallery.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 
12 12
 	ob_start();
13 13
 
14
-	if ( $galleries ) { ?>
14
+	if ($galleries) { ?>
15 15
 	
16
-		<?php if ( lasso_user_can( 'publish_posts' ) ): ?>
16
+		<?php if (lasso_user_can('publish_posts')): ?>
17 17
 			<div class="ase-gallery-opts ase-gallery-opts--create-gallery" style="display:inline !important; postion:relative !important;left:12px !important">
18 18
 				<div class="ase-gallery-opts--single lasso-option">
19
-				<a href="#" class="editor-btn-secondary" id="lasso--gallery__create"><?php _e( 'Create gallery', 'lasso' );?></a>
19
+				<a href="#" class="editor-btn-secondary" id="lasso--gallery__create"><?php _e('Create gallery', 'lasso'); ?></a>
20 20
 				</div>
21 21
 			</div>
22 22
 		<?php endif; ?>
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 		<div class="ase-gallery-opts ase-gallery-opts--edit-gallery" >
25 25
 			<div class="ase-gallery-opts--single lasso-option">
26 26
 
27
-				<label><?php _e( 'Manage Images', 'lasso' );?>
28
-					<a href="#" id="ase-gallery-add-image" class="lasso-editor-tiny-btn" title="<?php esc_attr_e( 'Add Images', 'lasso' );?>"><i class="lasso-icon-pencil"></i></a>
27
+				<label><?php _e('Manage Images', 'lasso'); ?>
28
+					<a href="#" id="ase-gallery-add-image" class="lasso-editor-tiny-btn" title="<?php esc_attr_e('Add Images', 'lasso'); ?>"><i class="lasso-icon-pencil"></i></a>
29 29
 
30 30
 				</label>
31
-				<small class="lasso-option-desc"><?php _e( 'Rearrange or edit the images in this gallery.', 'lasso' );?></small>
31
+				<small class="lasso-option-desc"><?php _e('Rearrange or edit the images in this gallery.', 'lasso'); ?></small>
32 32
 
33 33
 				<div id="lasso--gallery__images"><span class="lasso-icon-spinner6"></span></div>
34 34
 
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 
39 39
 	<?php }
40 40
 
41
-	if ( lasso_user_can( 'publish_posts' ) ): ?>
41
+	if (lasso_user_can('publish_posts')): ?>
42 42
 
43 43
 		<div class="ase-gallery-opts ase-gallery-opts--create-gallery2" style="display:none;">
44 44
 
45 45
 			<div class="ase-gallery-opts--single lasso-option">
46 46
 
47
-				<label><?php _e( 'Create a Gallery', 'lasso' );?></label>
47
+				<label><?php _e('Create a Gallery', 'lasso'); ?></label>
48 48
 				<small class="lasso-option-desc">Gallery Name:</small>
49 49
                 <input type="text" id="lasso--gallery__galleryname" value="New Gallery"><br>
50 50
 				
51
-				<small class="lasso-option-desc"><?php _e( 'Select images to create a gallery.', 'lasso' );?></small>
52
-				<a href="#" class="editor-btn-secondary" id="lasso--gallery__selectImages"><?php _e( 'Select Images', 'lasso' );?></a>
51
+				<small class="lasso-option-desc"><?php _e('Select images to create a gallery.', 'lasso'); ?></small>
52
+				<a href="#" class="editor-btn-secondary" id="lasso--gallery__selectImages"><?php _e('Select Images', 'lasso'); ?></a>
53 53
 
54 54
 				<div id="ase-gallery-images"></div>
55 55
 
56
-				<a style="display:none;" class="editor-btn-secondary" data-post-title="<?php echo esc_attr( strtolower( the_title_attribute() ) );?>" id="lasso--gallery__save" href="#"><?php _e( 'Create Gallery', 'lasso' );?></a>
56
+				<a style="display:none;" class="editor-btn-secondary" data-post-title="<?php echo esc_attr(strtolower(the_title_attribute())); ?>" id="lasso--gallery__save" href="#"><?php _e('Create Gallery', 'lasso'); ?></a>
57 57
 
58 58
 			</div>
59 59
 
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	<!-- Gallery Layout/Type Chooser -->
65 65
 	<div class="ase-gallery-opts ase-gallery-opts--type" >
66 66
 		<div data-option="gallery-type" class="ase-gallery-opts--single lasso-option">
67
-			<label><?php _e( 'Gallery Type', 'lasso' );?></label>
68
-			<small class="lasso-option-desc"><?php _e( 'Select the type of gallery.', 'lasso' );?></small>
67
+			<label><?php _e('Gallery Type', 'lasso'); ?></label>
68
+			<small class="lasso-option-desc"><?php _e('Select the type of gallery.', 'lasso'); ?></small>
69 69
 			<fieldset>
70
-	      		<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="grid"><?php _e( 'Grid', 'lasso' );?></label>
71
-	        	<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="thumbnail"><?php _e( 'Thumbnail', 'lasso' );?></label>
70
+	      		<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="grid"><?php _e('Grid', 'lasso'); ?></label>
71
+	        	<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="thumbnail"><?php _e('Thumbnail', 'lasso'); ?></label>
72 72
 				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="sequence">Sequence</label>
73
-				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="photoset"><?php _e( 'Photoset', 'lasso' );?></label>
74
-				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="stacked"><?php _e( 'Parallax', 'lasso' );?></label>
73
+				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="photoset"><?php _e('Photoset', 'lasso'); ?></label>
74
+				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="stacked"><?php _e('Parallax', 'lasso'); ?></label>
75 75
 				<label for="lasso_gallery_type" class="ase-gallery-layout-label"><input class="lasso-generator-attr ase-gallery-type-radio" type="radio" name="lasso_gallery_type" value="hero">Hero</label>
76 76
 			</fieldset>
77 77
 		</div>
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	<div class="ase-gallery-opts ase-gallery-opts--grid" style="display:none;">
82 82
 
83 83
 		<div data-option="itemwidth" class="ase-gallery-opts--single lasso-option">
84
-			<label for="lasso_grid_gallery_width"><?php _e( 'Grid Item Width', 'lasso' );?></label>
85
-			<small class="lasso-option-desc"><?php _e( 'Adjust the width of the individual grid items, only if using Grid gallery style. Default is 400.', 'lasso' );?></small>
84
+			<label for="lasso_grid_gallery_width"><?php _e('Grid Item Width', 'lasso'); ?></label>
85
+			<small class="lasso-option-desc"><?php _e('Adjust the width of the individual grid items, only if using Grid gallery style. Default is 400.', 'lasso'); ?></small>
86 86
 			<input type="text_small" class="lasso-generator-attr" name="lasso_grid_gallery_width" value="">
87 87
 		</div>
88 88
 
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 	<div class="ase-gallery-opts ase-gallery-opts--thumb" style="display:none;">
93 93
 
94 94
 		<div data-option="transition" class="ase-gallery-opts--single lasso-option">
95
-			<label for="lasso_thumb_gallery_transition"><?php _e( 'Gallery Transition', 'lasso' );?></label>
96
-			<small class="lasso-option-desc"><?php _e( 'Adjust the transition effect for the Thumbnail gallery. Default is slide.', 'lasso' );?></small>
95
+			<label for="lasso_thumb_gallery_transition"><?php _e('Gallery Transition', 'lasso'); ?></label>
96
+			<small class="lasso-option-desc"><?php _e('Adjust the transition effect for the Thumbnail gallery. Default is slide.', 'lasso'); ?></small>
97 97
 		   	<select name="lasso_thumb_gallery_transition" class="lasso-generator-attr">
98
-		      <option value="crossfade"><?php _e( 'Fade', 'lasso' );?></option>
99
-		      <option value="slide"><?php _e( 'Slide', 'lasso' );?></option>
100
-		      <option value="dissolve"><?php _e( 'Dissolve', 'lasso' );?></option>
98
+		      <option value="crossfade"><?php _e('Fade', 'lasso'); ?></option>
99
+		      <option value="slide"><?php _e('Slide', 'lasso'); ?></option>
100
+		      <option value="dissolve"><?php _e('Dissolve', 'lasso'); ?></option>
101 101
 		    </select>
102 102
 		</div>
103 103
 
104 104
 		<div data-option="speed" class="ase-gallery-opts--single lasso-option">
105
-			<label for="lasso_thumb_gallery_transition_speed"><?php _e( 'Gallery Transition Speed', 'lasso' );?></label>
106
-			<small class="lasso-option-desc"><?php _e( 'Activate slideshow by setting a speed for the transition.5000 = 5 seconds.', 'lasso' );?></small>
105
+			<label for="lasso_thumb_gallery_transition_speed"><?php _e('Gallery Transition Speed', 'lasso'); ?></label>
106
+			<small class="lasso-option-desc"><?php _e('Activate slideshow by setting a speed for the transition.5000 = 5 seconds.', 'lasso'); ?></small>
107 107
 			<input type="text" class="lasso-generator-attr" name="lasso_thumb_gallery_transition_speed" value="">
108 108
 		</div>
109 109
 
110 110
 		<div data-option="hide-thumbs" class="ase-gallery-opts--single lasso-option">
111 111
 			<input class="lasso-generator-attr" type="checkbox" name="lasso_thumb_gallery_hide_thumbs">
112
-			<label for="lasso_thumb_gallery_hide_thumbs"><?php _e( 'Hide Gallery Thumbnails', 'lasso' );?></label>
112
+			<label for="lasso_thumb_gallery_hide_thumbs"><?php _e('Hide Gallery Thumbnails', 'lasso'); ?></label>
113 113
 		</div>
114 114
 
115 115
 	</div>
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	<div class="ase-gallery-opts ase-gallery-opts--photoset" style="display:none;">
119 119
 
120 120
 		<div data-option="pslayout" class="ase-gallery-opts--single lasso-option">
121
-			<label for="lasso-photoset-gallery-layout"><?php _e( 'Gallery Layout', 'lasso' );?></label>
122
-			<small class="lasso-option-desc"><?php _e( 'Let\'s say you have 4 images in this gallery. If you enter 121 you will have one image on the top row, two images on the second row, and one image on the third row.', 'lasso' );?></small>
121
+			<label for="lasso-photoset-gallery-layout"><?php _e('Gallery Layout', 'lasso'); ?></label>
122
+			<small class="lasso-option-desc"><?php _e('Let\'s say you have 4 images in this gallery. If you enter 121 you will have one image on the top row, two images on the second row, and one image on the third row.', 'lasso'); ?></small>
123 123
 			<input type="text" class="lasso-generator-attr" name="lasso_photoset_gallery_layout" value="">
124 124
 		</div>
125 125
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	<div class="ase-gallery-opts ase-gallery-opts--hero" style="display:none;">
135 135
 
136 136
 		<div data-option="height" class="ase-gallery-opts--single lasso-option">
137
-			<label for="lasso_gallery_height"><?php _e( 'Main Gallery Height', 'lasso' );?></label>
138
-			<small class="lasso-option-desc"><?php _e( 'Adjust the overall height of the gallery. Acceptable values include 500px or 50% etc.', 'lasso' );?></small>
137
+			<label for="lasso_gallery_height"><?php _e('Main Gallery Height', 'lasso'); ?></label>
138
+			<small class="lasso-option-desc"><?php _e('Adjust the overall height of the gallery. Acceptable values include 500px or 50% etc.', 'lasso'); ?></small>
139 139
 			<input type="text_small" class="lasso-generator-attr" name="lasso_gallery_height" value="">
140 140
 		</div>
141 141
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 	<div class="ase-gallery-opts ase-gallery-opts--global">
146 146
 
147 147
 		<div data-option="width" class="ase-gallery-opts--single lasso-option">
148
-			<label for="lasso_gallery_width"><?php _e( 'Main Gallery Width', 'lasso' );?></label>
149
-			<small class="lasso-option-desc"><?php _e( 'Adjust the overall width of the gallery. Acceptable values include 500px or 50% etc.', 'lasso' );?></small>
148
+			<label for="lasso_gallery_width"><?php _e('Main Gallery Width', 'lasso'); ?></label>
149
+			<small class="lasso-option-desc"><?php _e('Adjust the overall width of the gallery. Acceptable values include 500px or 50% etc.', 'lasso'); ?></small>
150 150
 			<input type="text_small" class="lasso-generator-attr" name="lasso_gallery_width" value="">
151 151
 		</div>
152 152
 		<div data-option="caption" class="ase-gallery-opts--single lasso-option">
153
-			<label for="lasso_gallery_caption"><?php _e( 'Gallery Caption', 'lasso' );?></label>
154
-			<small class="lasso-option-desc"><?php _e( 'Add an optional caption for the gallery.', 'lasso' );?></small>
153
+			<label for="lasso_gallery_caption"><?php _e('Gallery Caption', 'lasso'); ?></label>
154
+			<small class="lasso-option-desc"><?php _e('Add an optional caption for the gallery.', 'lasso'); ?></small>
155 155
 			<textarea name="lasso_gallery_caption" class="lasso-generator-attr"></textarea>
156 156
 		</div>
157 157
 
Please login to merge, or discard this patch.