Completed
Push — master ( de0a9e...605b3f )
by
unknown
01:31
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.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 		add_action( 'wp_ajax_editus_featured_img',     array( $this, 'set_featured_img' ) );
69 69
 		add_action( 'wp_ajax_editus_del_featured_img',     array( $this, 'del_featured_img' ) );
70 70
         
71
-        add_action( 'wp_ajax_editus_publish_post',     array( $this, 'on_publish_post' ) );
71
+		add_action( 'wp_ajax_editus_publish_post',     array( $this, 'on_publish_post' ) );
72 72
         
73
-        add_action( 'wp_ajax_editus_create_gallery',     array( $this, 'create_gallery' ) );
74
-        add_action( 'wp_ajax_editus_update_gallery',     array( $this, 'update_gallery' ) );
73
+		add_action( 'wp_ajax_editus_create_gallery',     array( $this, 'create_gallery' ) );
74
+		add_action( 'wp_ajax_editus_update_gallery',     array( $this, 'update_gallery' ) );
75 75
 
76 76
 		// enable saving custom fields through REST API
77 77
 		self::enable_metasave('post');
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
 		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
272 272
 	}
273 273
 	
274
-    // new ajax function to lock post for editing
274
+	// new ajax function to lock post for editing
275 275
 	public function editus_lock_post()
276 276
 	{
277 277
 		$post_id= $_POST["postid"];
278 278
 		$locked = wp_check_post_lock($post_id);
279 279
 		
280 280
 		if (!$locked) {
281
-		    wp_set_post_lock($post_id);
281
+			wp_set_post_lock($post_id);
282 282
 			echo "true";
283 283
 		} else {
284 284
 			$user_info = get_userdata($locked);
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 	{
292 292
 		$post_id= $_POST["postid"];
293 293
 		$locked = wp_check_post_lock($post_id);
294
-        if (!$locked) {
295
-            delete_post_meta( $post_id, '_edit_lock');
296
-        }
294
+		if (!$locked) {
295
+			delete_post_meta( $post_id, '_edit_lock');
296
+		}
297 297
 		echo "true";
298 298
 		
299 299
 		exit;
@@ -405,59 +405,59 @@  discard block
 block discarded – undo
405 405
 		 );
406 406
 		foreach ($_POST as $key => $value) {
407 407
 			if ($key !="code" && $key !="action") {
408
-			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
408
+				//$shortcode = $shortcode.$key.'="'.$value.'" ';
409 409
 				$atts[$key] = $value;
410 410
 			}
411 411
 		}
412 412
 		if ($code == "aesop_video") {
413
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
414
-		    echo aesop_video_shortcode($atts);
413
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
414
+			echo aesop_video_shortcode($atts);
415 415
 		}
416 416
 		else if ($code == "aesop_image") {
417
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
418
-		    echo aesop_image_shortcode($atts);
417
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
418
+			echo aesop_image_shortcode($atts);
419 419
 		}
420 420
 		else if ($code == "aesop_quote") {
421
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
422
-		    echo aesop_quote_shortcode($atts);
421
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
422
+			echo aesop_quote_shortcode($atts);
423 423
 		}
424 424
 		else if ($code == "aesop_parallax") {
425
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
426
-		    echo aesop_parallax_shortcode($atts);
425
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
426
+			echo aesop_parallax_shortcode($atts);
427 427
 		}
428 428
 		else if ($code == "aesop_character") {
429
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
430
-		    echo aesop_character_shortcode($atts);
429
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
430
+			echo aesop_character_shortcode($atts);
431 431
 		}
432 432
 		else if ($code == "aesop_collection") {
433
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
434
-		    echo aesop_collection_shortcode($atts);
433
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
434
+			echo aesop_collection_shortcode($atts);
435 435
 		}
436 436
 		else if ($code == "aesop_chapter") {
437
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
438
-		    echo aesop_chapter_shortcode($atts);
437
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
438
+			echo aesop_chapter_shortcode($atts);
439 439
 		}
440 440
 		else if ($code == "aesop_content") {
441
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
442
-		    echo aesop_content_shortcode($atts, $atts['content_data']);
441
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
442
+			echo aesop_content_shortcode($atts, $atts['content_data']);
443 443
 		}
444 444
 		else if ($code == "aesop_gallery") {
445
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
446
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
445
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
446
+			echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
447 447
 		}
448 448
 		else if ($code == "aesop_audio") {
449
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
450
-		    echo aesop_audio_shortcode($atts);
449
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
450
+			echo aesop_audio_shortcode($atts);
451 451
 		}
452 452
 		else {
453 453
 			$code = '['.$code.' ';
454 454
 			foreach ($atts as $key => $value) {
455
-			    $code = ''.$key.'="'.$value.'" ';
455
+				$code = ''.$key.'="'.$value.'" ';
456 456
 			}
457 457
 			$code = $code.']';
458 458
 			echo do_shortcode($code);
459
-		    //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php');
460
-		    //echo aesop_audio_shortcode($atts);
459
+			//require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php');
460
+			//echo aesop_audio_shortcode($atts);
461 461
 		}
462 462
 		
463 463
 		exit; 
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
 		exit;
498 498
 	}
499 499
     
500
-    /* This function doesn't actually publish post, but should be called when a post is published */
501
-    public function on_publish_post( ) {
500
+	/* This function doesn't actually publish post, but should be called when a post is published */
501
+	public function on_publish_post( ) {
502 502
 
503 503
 		$post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
504 504
         
505
-        do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
505
+		do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
506 506
 
507 507
 		exit;
508 508
 	}
@@ -560,14 +560,14 @@  discard block
 block discarded – undo
560 560
 			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
561 561
 			
562 562
 			if ($taxonomy =='category') {
563
-                // convert from names to category ids
563
+				// convert from names to category ids
564 564
 				$cats = array();
565 565
 				foreach ($value as $cat) {
566 566
 					$cat_id = get_cat_ID($cat);
567 567
 					if ($cat_id !=0) {
568 568
 						$cats [] = $cat_id;
569 569
 					} else if ($allow_new_category) {
570
-					    $cats [] = wp_create_category($cat);
570
+						$cats [] = wp_create_category($cat);
571 571
 					}
572 572
 				}
573 573
 				$value = $cats;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		}
588 588
 	}
589 589
     
590
-    public function create_gallery( ) {
590
+	public function create_gallery( ) {
591 591
 
592 592
 		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
593 593
         
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 			'message' => 'gallery-created',
642 642
 			'id' => $postid)
643 643
 		);
644
-        exit;
644
+		exit;
645 645
 	}
646 646
     
647
-    public function update_gallery( ) {
647
+	public function update_gallery( ) {
648 648
         
649 649
 		$options      = isset( $_POST['fields'] ) ? $_POST['fields'] : false;
650 650
         
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
 
661 661
 		self::save_gallery_options( $postid, $gallery_ids, $options, $type );
662 662
 
663
-        echo json_encode( array('message' => 'gallery-updated') );
663
+		echo json_encode( array('message' => 'gallery-updated') );
664 664
 
665
-        exit;
665
+		exit;
666 666
 	}
667 667
     
668
-    public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
668
+	public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
669 669
 
670 670
 		// gallery width
671 671
 		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	public function set_date( $postid, $value) {
750 750
 		if( $value ) {
751 751
 			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 ));
752
-            wp_update_post(
752
+			wp_update_post(
753 753
 				array (
754 754
 					'ID'            => $postid, // ID of the post to update
755 755
 					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
Please login to merge, or discard this patch.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -52,26 +52,26 @@  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_lock_post',     array( $this, 'editus_lock_post' ) );
63
-		add_action( 'wp_ajax_editus_unlock_post',     array( $this, 'editus_unlock_post' ) );
64
-		add_action( 'wp_ajax_editus_hide_tour',     array( $this, 'editus_hide_tour' ) );
65
-		add_action( 'wp_ajax_editus_set_post_setting',     array( $this, 'editus_set_post_setting' ) );
66
-		add_action( 'wp_ajax_editus_get_ase_options',     array( $this, 'get_ase_options' ) );
67
-		add_action( 'wp_ajax_editus_delete_post',     array( $this, 'delete_post' ) );
68
-		add_action( 'wp_ajax_editus_featured_img',     array( $this, 'set_featured_img' ) );
69
-		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_lock_post', array($this, 'editus_lock_post'));
63
+		add_action('wp_ajax_editus_unlock_post', array($this, 'editus_unlock_post'));
64
+		add_action('wp_ajax_editus_hide_tour', array($this, 'editus_hide_tour'));
65
+		add_action('wp_ajax_editus_set_post_setting', array($this, 'editus_set_post_setting'));
66
+		add_action('wp_ajax_editus_get_ase_options', array($this, 'get_ase_options'));
67
+		add_action('wp_ajax_editus_delete_post', array($this, 'delete_post'));
68
+		add_action('wp_ajax_editus_featured_img', array($this, 'set_featured_img'));
69
+		add_action('wp_ajax_editus_del_featured_img', array($this, 'del_featured_img'));
70 70
         
71
-        add_action( 'wp_ajax_editus_publish_post',     array( $this, 'on_publish_post' ) );
71
+        add_action('wp_ajax_editus_publish_post', array($this, 'on_publish_post'));
72 72
         
73
-        add_action( 'wp_ajax_editus_create_gallery',     array( $this, 'create_gallery' ) );
74
-        add_action( 'wp_ajax_editus_update_gallery',     array( $this, 'update_gallery' ) );
73
+        add_action('wp_ajax_editus_create_gallery', array($this, 'create_gallery'));
74
+        add_action('wp_ajax_editus_update_gallery', array($this, 'update_gallery'));
75 75
 
76 76
 		// enable saving custom fields through REST API
77 77
 		self::enable_metasave('post');
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	public static function get_instance() {
103 103
 
104 104
 		// If the single instance hasn't been set, set it now.
105
-		if ( null == self::$instance ) {
105
+		if (null == self::$instance) {
106 106
 			self::$instance = new self;
107 107
 		}
108 108
 
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
 	 *                                       WPMU is disabled or plugin is
120 120
 	 *                                       activated on an individual blog.
121 121
 	 */
122
-	public static function activate( $network_wide ) {
122
+	public static function activate($network_wide) {
123 123
 
124
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
124
+		if (function_exists('is_multisite') && is_multisite()) {
125 125
 
126
-			if ( $network_wide  ) {
126
+			if ($network_wide) {
127 127
 
128 128
 				// Get all blog ids
129 129
 				$blog_ids = self::get_blog_ids();
130 130
 
131
-				foreach ( $blog_ids as $blog_id ) {
131
+				foreach ($blog_ids as $blog_id) {
132 132
 
133
-					switch_to_blog( $blog_id );
133
+					switch_to_blog($blog_id);
134 134
 					self::single_activate();
135 135
 				}
136 136
 
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
 	 *                                       WPMU is disabled or plugin is
157 157
 	 *                                       deactivated on an individual blog.
158 158
 	 */
159
-	public static function deactivate( $network_wide ) {
159
+	public static function deactivate($network_wide) {
160 160
 
161
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
161
+		if (function_exists('is_multisite') && is_multisite()) {
162 162
 
163
-			if ( $network_wide ) {
163
+			if ($network_wide) {
164 164
 
165 165
 				// Get all blog ids
166 166
 				$blog_ids = self::get_blog_ids();
167 167
 
168
-				foreach ( $blog_ids as $blog_id ) {
168
+				foreach ($blog_ids as $blog_id) {
169 169
 
170
-					switch_to_blog( $blog_id );
170
+					switch_to_blog($blog_id);
171 171
 					self::single_deactivate();
172 172
 
173 173
 				}
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @param int     $blog_id ID of the new blog.
193 193
 	 */
194
-	public function activate_new_site( $blog_id ) {
194
+	public function activate_new_site($blog_id) {
195 195
 
196
-		if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
196
+		if (1 !== did_action('wpmu_new_blog')) {
197 197
 			return;
198 198
 		}
199 199
 
200
-		switch_to_blog( $blog_id );
200
+		switch_to_blog($blog_id);
201 201
 		self::single_activate();
202 202
 		restore_current_blog();
203 203
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			WHERE archived = '0' AND spam = '0'
223 223
 			AND deleted = '0'";
224 224
 
225
-		return $wpdb->get_col( $sql );
225
+		return $wpdb->get_col($sql);
226 226
 
227 227
 	}
228 228
 
@@ -233,18 +233,18 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	private static function single_activate() {
235 235
 
236
-		$curr_version = get_option( 'lasso_version' );
236
+		$curr_version = get_option('lasso_version');
237 237
 
238 238
 		// update upgraded from
239
-		if ( $curr_version ) {
240
-			update_option( 'lasso_updated_from', $curr_version );
239
+		if ($curr_version) {
240
+			update_option('lasso_updated_from', $curr_version);
241 241
 		}
242 242
 
243 243
 		// update lasso version option
244
-		update_option( 'lasso_version', LASSO_VERSION );
244
+		update_option('lasso_version', LASSO_VERSION);
245 245
 
246 246
 		// set transietn for activation welcome
247
-		set_transient( '_lasso_welcome_redirect', true, 30 );
247
+		set_transient('_lasso_welcome_redirect', true, 30);
248 248
 
249 249
 
250 250
 	}
@@ -266,15 +266,15 @@  discard block
 block discarded – undo
266 266
 	public function load_plugin_textdomain() {
267 267
 
268 268
 		$domain = $this->plugin_slug;
269
-		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
269
+		$locale = apply_filters('plugin_locale', get_locale(), $domain);
270 270
 
271
-		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
271
+		$out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo');
272 272
 	}
273 273
 	
274 274
     // new ajax function to lock post for editing
275 275
 	public function editus_lock_post()
276 276
 	{
277
-		$post_id= $_POST["postid"];
277
+		$post_id = $_POST["postid"];
278 278
 		$locked = wp_check_post_lock($post_id);
279 279
 		
280 280
 		if (!$locked) {
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
 			echo "true";
283 283
 		} else {
284 284
 			$user_info = get_userdata($locked);
285
-			echo _e( 'Post being edited by ', 'lasso' ).$user_info->first_name .  " " . $user_info->last_name;
285
+			echo _e('Post being edited by ', 'lasso').$user_info->first_name." ".$user_info->last_name;
286 286
 		}
287 287
 		exit;
288 288
 	}
289 289
 	
290 290
 	public function editus_unlock_post()
291 291
 	{
292
-		$post_id= $_POST["postid"];
292
+		$post_id = $_POST["postid"];
293 293
 		$locked = wp_check_post_lock($post_id);
294 294
         if (!$locked) {
295
-            delete_post_meta( $post_id, '_edit_lock');
295
+            delete_post_meta($post_id, '_edit_lock');
296 296
         }
297 297
 		echo "true";
298 298
 		
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	{
305 305
 		$user_id = get_current_user_ID();
306 306
 				
307
-		update_user_meta( $user_id, 'lasso_hide_tour', true );
307
+		update_user_meta($user_id, 'lasso_hide_tour', true);
308 308
 		exit;
309 309
 	}
310 310
 	
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 		$data = array();
316 316
 		parse_str($_POST['data'], $data);
317 317
 		
318
-		if (!wp_verify_nonce( $data[ 'nonce' ], 'lasso-update-post-settings' )) {
318
+		if (!wp_verify_nonce($data['nonce'], 'lasso-update-post-settings')) {
319 319
 			wp_send_json_error();
320 320
 			exit;
321 321
 		}
322 322
 		
323
-		$status = isset( $data['status'] ) ? $data['status'] : false;
324
-		$postid = isset( $data['postid'] ) ? $data['postid'] : false;
325
-		$slug   = isset( $data['story_slug'] ) ? $data['story_slug'] : false;
323
+		$status = isset($data['status']) ? $data['status'] : false;
324
+		$postid = isset($data['postid']) ? $data['postid'] : false;
325
+		$slug   = isset($data['story_slug']) ? $data['story_slug'] : false;
326 326
 	
327 327
 
328 328
 		$args = array(
@@ -333,24 +333,24 @@  discard block
 block discarded – undo
333 333
 		
334 334
 		
335 335
 
336
-		wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) );
336
+		wp_update_post(apply_filters('lasso_object_status_update_args', $args));
337 337
 		
338 338
 		// update categories
339
-		$cats  = isset( $data['story_cats'] ) ? $data['story_cats'] : false;
339
+		$cats = isset($data['story_cats']) ? $data['story_cats'] : false;
340 340
 		
341
-		self::set_post_terms( $postid, $cats, 'category' );
341
+		self::set_post_terms($postid, $cats, 'category');
342 342
 		
343 343
 		// update tags
344
-		$tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false;
345
-		self::set_post_terms( $postid, $tags, 'post_tag' );
344
+		$tags = isset($data['story_tags']) ? $data['story_tags'] : false;
345
+		self::set_post_terms($postid, $tags, 'post_tag');
346 346
 		
347 347
 		//update date
348
-		$date  = isset( $data['post_date'] ) ? $data['post_date'] : false;
349
-		self::set_date( $postid, $date );
348
+		$date = isset($data['post_date']) ? $data['post_date'] : false;
349
+		self::set_date($postid, $date);
350 350
 		
351
-		do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() );
352
-		$response= array(
353
-			'link'   => get_permalink($postid). (($status=='publish') ? '' : '&preview=true')
351
+		do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID());
352
+		$response = array(
353
+			'link'   => get_permalink($postid).(($status == 'publish') ? '' : '&preview=true')
354 354
 		);
355 355
 		wp_send_json_success($response);
356 356
 		exit;
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 	
359 359
 	public static function enable_metasave($type)
360 360
 	{
361
-		register_rest_field( $type, 'metadata', array(
362
-			'get_callback' => function ( $data ) {
363
-				return get_post_meta( $data['id']);//, '', '' );
361
+		register_rest_field($type, 'metadata', array(
362
+			'get_callback' => function($data) {
363
+				return get_post_meta($data['id']); //, '', '' );
364 364
 			}, 
365
-			'update_callback' => function( $data, $post ) {
365
+			'update_callback' => function($data, $post) {
366 366
 				foreach ($data as $key => $value) {
367 367
 					update_post_meta($post->ID, $key, $value);
368 368
 				}
@@ -374,13 +374,13 @@  discard block
 block discarded – undo
374 374
 	public function editus_do_shortcode()
375 375
 	{
376 376
 		
377
-		$code= $_POST["code"];
377
+		$code = $_POST["code"];
378 378
 		$code = str_replace('\"', '"', $code);
379 379
 		
380
-		$code_wrapped = lasso_wrap_shortcodes( $code);
381
-		$out =  do_shortcode($code);
380
+		$code_wrapped = lasso_wrap_shortcodes($code);
381
+		$out = do_shortcode($code);
382 382
 		if ($out != '') {
383
-			$out =  do_shortcode($code_wrapped);
383
+			$out = do_shortcode($code_wrapped);
384 384
 			echo $out;
385 385
 			exit;
386 386
 		}
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 		/** @var \WP_Embed $wp_embed */
391 391
 		global $wp_embed;
392 392
 		$wp_embed->post_ID = $_POST["ID"];
393
-		$out =$wp_embed->run_shortcode( $code_wrapped );
393
+		$out = $wp_embed->run_shortcode($code_wrapped);
394 394
 		
395 395
 		echo $out;
396 396
 		exit;
@@ -400,53 +400,53 @@  discard block
 block discarded – undo
400 400
 	{
401 401
 		
402 402
 		
403
-		$code= $_POST["code"];
403
+		$code = $_POST["code"];
404 404
 		$atts = array(
405 405
 		 );
406 406
 		foreach ($_POST as $key => $value) {
407
-			if ($key !="code" && $key !="action") {
407
+			if ($key != "code" && $key != "action") {
408 408
 			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
409 409
 				$atts[$key] = $value;
410 410
 			}
411 411
 		}
412 412
 		if ($code == "aesop_video") {
413
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
413
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
414 414
 		    echo aesop_video_shortcode($atts);
415 415
 		}
416 416
 		else if ($code == "aesop_image") {
417
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
417
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
418 418
 		    echo aesop_image_shortcode($atts);
419 419
 		}
420 420
 		else if ($code == "aesop_quote") {
421
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
421
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
422 422
 		    echo aesop_quote_shortcode($atts);
423 423
 		}
424 424
 		else if ($code == "aesop_parallax") {
425
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
425
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
426 426
 		    echo aesop_parallax_shortcode($atts);
427 427
 		}
428 428
 		else if ($code == "aesop_character") {
429
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
429
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
430 430
 		    echo aesop_character_shortcode($atts);
431 431
 		}
432 432
 		else if ($code == "aesop_collection") {
433
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
433
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
434 434
 		    echo aesop_collection_shortcode($atts);
435 435
 		}
436 436
 		else if ($code == "aesop_chapter") {
437
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
437
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
438 438
 		    echo aesop_chapter_shortcode($atts);
439 439
 		}
440 440
 		else if ($code == "aesop_content") {
441
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
441
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
442 442
 		    echo aesop_content_shortcode($atts, $atts['content_data']);
443 443
 		}
444 444
 		else if ($code == "aesop_gallery") {
445
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
446
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
445
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
446
+		    echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]');
447 447
 		}
448 448
 		else if ($code == "aesop_audio") {
449
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
449
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
450 450
 		    echo aesop_audio_shortcode($atts);
451 451
 		}
452 452
 		else {
@@ -467,20 +467,20 @@  discard block
 block discarded – undo
467 467
 	public function get_ase_options()
468 468
 	{
469 469
 		$blob = lasso_editor_options_blob();
470
-		$code= $_POST["component"];
470
+		$code = $_POST["component"];
471 471
 		echo $blob[$code];
472 472
 		exit; 
473 473
 	}
474 474
 	
475 475
 	public function delete_post( ) {
476 476
 
477
-		$postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
477
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
478 478
 
479 479
 		// bail out if the current user can't publish posts
480
-		if ( !lasso_user_can( 'delete_post', $postid ) )
480
+		if (!lasso_user_can('delete_post', $postid))
481 481
 			return;
482 482
 		
483
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_delete_post' )) {
483
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_delete_post')) {
484 484
 			wp_send_json_error();
485 485
 			exit;
486 486
 		}
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 			'post_status' 	=> 'trash'
491 491
 		);
492 492
 
493
-		wp_update_post( apply_filters( 'lasso_object_deleted_args', $args ) );
493
+		wp_update_post(apply_filters('lasso_object_deleted_args', $args));
494 494
 
495
-		do_action( 'lasso_object_deleted', $postid, get_current_user_ID() );
495
+		do_action('lasso_object_deleted', $postid, get_current_user_ID());
496 496
 
497 497
 		exit;
498 498
 	}
@@ -500,40 +500,40 @@  discard block
 block discarded – undo
500 500
     /* This function doesn't actually publish post, but should be called when a post is published */
501 501
     public function on_publish_post( ) {
502 502
 
503
-		$post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
503
+		$post_id = isset($_POST['postid']) ? $_POST['postid'] : false;
504 504
         
505
-        do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
505
+        do_action('transition_post_status', 'publish', 'draft', get_post($post_id));
506 506
 
507 507
 		exit;
508 508
 	}
509 509
 	
510 510
 	public function set_featured_img( ) {
511 511
 
512
-		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
513
-		$image_id  	= isset( $_POST['image_id'] ) ? absint( $_POST['image_id'] ) : false;
514
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
512
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
513
+		$image_id = isset($_POST['image_id']) ? absint($_POST['image_id']) : false;
514
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
515 515
 			wp_send_json_error();
516 516
 			exit;
517 517
 		}	
518 518
 
519
-		set_post_thumbnail( $postid, $image_id );
519
+		set_post_thumbnail($postid, $image_id);
520 520
 
521
-		do_action( 'lasso_featured_image_set', $postid, $image_id, get_current_user_ID() );
521
+		do_action('lasso_featured_image_set', $postid, $image_id, get_current_user_ID());
522 522
 
523 523
 		exit;
524 524
 	}
525 525
 	
526 526
 	public function del_featured_img( ) {
527 527
 
528
-		$postid  = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
529
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
528
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
529
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
530 530
 			wp_send_json_error();
531 531
 			exit;
532 532
 		}	
533 533
 
534
-		delete_post_thumbnail( $postid );
534
+		delete_post_thumbnail($postid);
535 535
 
536
-		do_action( 'lasso_featured_image_deleted', $postid, get_current_user_ID() );
536
+		do_action('lasso_featured_image_deleted', $postid, get_current_user_ID());
537 537
 
538 538
 		exit;
539 539
 	}
@@ -554,17 +554,17 @@  discard block
 block discarded – undo
554 554
 		return self::$revisions;
555 555
 	}*/
556 556
 	
557
-	public function set_post_terms( $postid, $value, $taxonomy ) {
558
-		if( $value ) {
559
-			$value = explode( ',', $value );
560
-			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
557
+	public function set_post_terms($postid, $value, $taxonomy) {
558
+		if ($value) {
559
+			$value = explode(',', $value);
560
+			$allow_new_category = lasso_editor_get_option('allow_new_category', 'lasso_editor');
561 561
 			
562
-			if ($taxonomy =='category') {
562
+			if ($taxonomy == 'category') {
563 563
                 // convert from names to category ids
564 564
 				$cats = array();
565 565
 				foreach ($value as $cat) {
566 566
 					$cat_id = get_cat_ID($cat);
567
-					if ($cat_id !=0) {
567
+					if ($cat_id != 0) {
568 568
 						$cats [] = $cat_id;
569 569
 					} else if ($allow_new_category) {
570 570
 					    $cats [] = wp_create_category($cat);
@@ -573,71 +573,71 @@  discard block
 block discarded – undo
573 573
 				$value = $cats;
574 574
 			}
575 575
 	
576
-			$result = wp_set_object_terms( $postid, $value, $taxonomy );
576
+			$result = wp_set_object_terms($postid, $value, $taxonomy);
577 577
 		}
578
-		else  {
578
+		else {
579 579
 			//remove all terms from post
580
-			$result = wp_set_object_terms( $postid, null, $taxonomy );
580
+			$result = wp_set_object_terms($postid, null, $taxonomy);
581 581
 		}
582 582
 
583
-		if ( ! is_wp_error( $result ) ) {
583
+		if (!is_wp_error($result)) {
584 584
 			return true;
585
-		}else{
585
+		} else {
586 586
 			return false;
587 587
 		}
588 588
 	}
589 589
     
590 590
     public function create_gallery( ) {
591 591
 
592
-		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
592
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
593 593
         
594
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
594
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
595 595
 			wp_send_json_error();
596 596
 			exit;
597 597
 		}	
598 598
 
599
-		if (  ! lasso_user_can( 'publish_posts' ) ) {
599
+		if (!lasso_user_can('publish_posts')) {
600 600
 			return false;
601 601
 
602 602
 		}
603 603
 
604
-		$gallery_ids = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false;
604
+		$gallery_ids = isset($_POST['gallery_ids']) ? $_POST['gallery_ids'] : false;
605 605
 
606 606
 		// bail if no gallery ids
607
-		if ( empty( $gallery_ids ) ) {
607
+		if (empty($gallery_ids)) {
608 608
 			return false;
609 609
 		}
610 610
 
611
-		$type   		 = isset( $_POST['gallery_type'] ) ? $_POST['gallery_type'] : false;
612
-		$edgallerytitle	 = isset( $_POST['edgallerytitle'] ) ? $_POST['edgallerytitle'] : $postid.'-'.rand();
611
+		$type = isset($_POST['gallery_type']) ? $_POST['gallery_type'] : false;
612
+		$edgallerytitle = isset($_POST['edgallerytitle']) ? $_POST['edgallerytitle'] : $postid.'-'.rand();
613 613
 
614 614
 		// insert a new gallery
615 615
 		$args = array(
616
-			'post_title'    => $edgallerytitle ,
616
+			'post_title'    => $edgallerytitle,
617 617
 			'post_status'   => 'publish',
618 618
 			'post_type'     => 'ai_galleries'
619 619
 		);
620 620
 
621
-		$postid = wp_insert_post( apply_filters( 'lasso_insert_gallery_args', $args ) );
621
+		$postid = wp_insert_post(apply_filters('lasso_insert_gallery_args', $args));
622 622
 
623 623
 		// update gallery ids
624
-		if ( $gallery_ids ) {
624
+		if ($gallery_ids) {
625 625
 
626
-			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
626
+			update_post_meta($postid, '_ase_gallery_images', $gallery_ids);
627 627
 
628 628
 		}
629 629
 
630 630
 		// update the gallery type
631
-		if ( !empty( $type ) ) {
631
+		if (!empty($type)) {
632 632
 
633
-			update_post_meta( $postid, 'aesop_gallery_type', $type );
633
+			update_post_meta($postid, 'aesop_gallery_type', $type);
634 634
 
635 635
 		}
636 636
 
637
-		do_action( 'lasso_gallery_published', $postid, $gallery_ids, get_current_user_ID() );
637
+		do_action('lasso_gallery_published', $postid, $gallery_ids, get_current_user_ID());
638 638
 
639 639
 
640
-		echo json_encode( array(
640
+		echo json_encode(array(
641 641
 			'message' => 'gallery-created',
642 642
 			'id' => $postid)
643 643
 		);
@@ -646,114 +646,114 @@  discard block
 block discarded – undo
646 646
     
647 647
     public function update_gallery( ) {
648 648
         
649
-		$options      = isset( $_POST['fields'] ) ? $_POST['fields'] : false;
649
+		$options      = isset($_POST['fields']) ? $_POST['fields'] : false;
650 650
         
651
-		$postid   	  = !empty( $options ) ? (int) $options['id'] : false;
652
-		$gallery_ids  = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false;
653
-		if ( $_POST[ 'gallery_type' ] ) {
654
-			$type = $_POST[ 'gallery_type' ];
655
-		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
656
-			$type = $options[ 'galleryType' ];
657
-		}else{
651
+		$postid = !empty($options) ? (int) $options['id'] : false;
652
+		$gallery_ids  = isset($_POST['gallery_ids']) ? $_POST['gallery_ids'] : false;
653
+		if ($_POST['gallery_type']) {
654
+			$type = $_POST['gallery_type'];
655
+		}elseif (!empty($options) && $options['galleryType']) {
656
+			$type = $options['galleryType'];
657
+		} else {
658 658
 			$type = false;
659 659
 		}
660 660
 
661
-		self::save_gallery_options( $postid, $gallery_ids, $options, $type );
661
+		self::save_gallery_options($postid, $gallery_ids, $options, $type);
662 662
 
663
-        echo json_encode( array('message' => 'gallery-updated') );
663
+        echo json_encode(array('message' => 'gallery-updated'));
664 664
 
665 665
         exit;
666 666
 	}
667 667
     
668
-    public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
668
+    public function save_gallery_options($postid, $gallery_ids, $options, $type = false) {
669 669
 
670 670
 		// gallery width
671
-		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
671
+		$gallery_width = isset($options['width']) ? $options['width'] : false;
672 672
 
673 673
 		// gallery grid item width
674
-		$item_width = isset( $options['itemwidth'] ) ? $options['itemwidth'] : false;
674
+		$item_width = isset($options['itemwidth']) ? $options['itemwidth'] : false;
675 675
 
676 676
 		// caption
677
-		$caption = isset( $options['caption'] ) ? $options['caption'] : false;
677
+		$caption = isset($options['caption']) ? $options['caption'] : false;
678 678
 
679 679
 		// gallery transition
680
-		$transition = isset( $options['transition'] ) ? $options['transition'] : false;
680
+		$transition = isset($options['transition']) ? $options['transition'] : false;
681 681
 
682 682
 		// gallery transition speed
683
-		$transitionSpeed = isset( $options['speed'] ) ? $options['speed'] : false;
683
+		$transitionSpeed = isset($options['speed']) ? $options['speed'] : false;
684 684
 
685 685
 		// gallery hide thumbs
686
-		$hideThumbs = isset( $options['hideThumbs'] ) ? $options['hideThumbs'] : false;
686
+		$hideThumbs = isset($options['hideThumbs']) ? $options['hideThumbs'] : false;
687 687
 
688 688
 		// photoset layout hardwired to on for now
689
-		$psLayout = isset( $options['pslayout'] ) ? $options['pslayout'] : false;
689
+		$psLayout = isset($options['pslayout']) ? $options['pslayout'] : false;
690 690
 
691 691
 		// photoset layout
692
-		$psLightbox = 'on';//isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
692
+		$psLightbox = 'on'; //isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
693 693
 		
694 694
 		// hero gallery height
695
-		$gallery_height = isset( $options['height'] ) ? $options['height'] : false;
695
+		$gallery_height = isset($options['height']) ? $options['height'] : false;
696 696
 
697 697
 		// update gallery ids
698
-		if ( !empty( $gallery_ids ) ) {
698
+		if (!empty($gallery_ids)) {
699 699
 
700
-			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
700
+			update_post_meta($postid, '_ase_gallery_images', $gallery_ids);
701 701
 
702 702
 		}
703 703
 
704
-		update_post_meta( $postid, 'aesop_gallery_type', sanitize_text_field( trim( $type ) ) );
704
+		update_post_meta($postid, 'aesop_gallery_type', sanitize_text_field(trim($type)));
705 705
 
706
-		update_post_meta( $postid, 'aesop_gallery_width', sanitize_text_field( trim( $gallery_width ) ) );
706
+		update_post_meta($postid, 'aesop_gallery_width', sanitize_text_field(trim($gallery_width)));
707 707
 
708
-		update_post_meta( $postid, 'aesop_grid_gallery_width', sanitize_text_field( trim( $item_width ) ) );
708
+		update_post_meta($postid, 'aesop_grid_gallery_width', sanitize_text_field(trim($item_width)));
709 709
 
710
-		update_post_meta( $postid, 'aesop_gallery_caption', sanitize_text_field( trim( $caption ) ) );
710
+		update_post_meta($postid, 'aesop_gallery_caption', sanitize_text_field(trim($caption)));
711 711
 
712
-		update_post_meta( $postid, 'aesop_thumb_gallery_transition', sanitize_text_field( trim( $transition ) ) );
712
+		update_post_meta($postid, 'aesop_thumb_gallery_transition', sanitize_text_field(trim($transition)));
713 713
 
714
-		update_post_meta( $postid, 'aesop_thumb_gallery_transition_speed', absint( trim( $transitionSpeed ) ) );
714
+		update_post_meta($postid, 'aesop_thumb_gallery_transition_speed', absint(trim($transitionSpeed)));
715 715
 
716
-		update_post_meta( $postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field( trim( $hideThumbs ) ) );
716
+		update_post_meta($postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field(trim($hideThumbs)));
717 717
 
718
-		update_post_meta( $postid, 'aesop_photoset_gallery_layout', sanitize_text_field( trim( $psLayout ) ) );
718
+		update_post_meta($postid, 'aesop_photoset_gallery_layout', sanitize_text_field(trim($psLayout)));
719 719
 
720
-		update_post_meta( $postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field( trim( $psLightbox ) ) );
720
+		update_post_meta($postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field(trim($psLightbox)));
721 721
 		
722
-		update_post_meta( $postid, 'aesop_hero_gallery_height', sanitize_text_field( trim( $gallery_height ) ) );
722
+		update_post_meta($postid, 'aesop_hero_gallery_height', sanitize_text_field(trim($gallery_height)));
723 723
 		
724 724
 		//hardwired for now
725 725
 		
726
-		update_post_meta( $postid, 'aesop_hero_gallery_transition_speed', 300 );
726
+		update_post_meta($postid, 'aesop_hero_gallery_transition_speed', 300);
727 727
 
728 728
 	}
729 729
 	
730
-	function getEnglishMonthName($foreignMonthName){
730
+	function getEnglishMonthName($foreignMonthName) {
731 731
 
732 732
 		  setlocale(LC_ALL, 'en_US');
733 733
 
734
-		  $month_numbers = range(1,12);
734
+		  $month_numbers = range(1, 12);
735 735
 
736
-		  foreach($month_numbers as $month)
737
-			$english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011));
736
+		  foreach ($month_numbers as $month)
737
+			$english_months[] = strftime('%B', mktime(0, 0, 0, $month, 1, 2011));
738 738
 
739 739
 		  setlocale(LC_ALL, get_locale());
740 740
 
741
-		  foreach($month_numbers as $month)
742
-			$foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011)));
741
+		  foreach ($month_numbers as $month)
742
+			$foreign_months[] = utf8_encode(strftime('%B', mktime(0, 0, 0, $month, 1, 2011)));
743 743
 
744 744
 		  return str_replace($foreign_months, $english_months, $foreignMonthName);
745 745
 	}
746 746
 
747 747
 
748 748
 	
749
-	public function set_date( $postid, $value) {
750
-		if( $value ) {
751
-			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 ));
749
+	public function set_date($postid, $value) {
750
+		if ($value) {
751
+			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time('timestamp', 1));
752 752
             wp_update_post(
753
-				array (
753
+				array(
754 754
 					'ID'            => $postid, // ID of the post to update
755
-					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
756
-					'post_date_gmt'     => gmdate( 'Y-m-d H:i:s',  strtotime($value) ),
755
+					'post_date'     => date('Y-m-d H:i:s', strtotime($value)),
756
+					'post_date_gmt'     => gmdate('Y-m-d H:i:s', strtotime($value)),
757 757
 				)
758 758
 			);
759 759
 		}
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.
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.