Completed
Push — master ( 76c660...cbd312 )
by
unknown
01:39
created
lasso.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 // If this file is called directly, abort.
21
-if ( ! defined( 'WPINC' ) ) {
21
+if (!defined('WPINC')) {
22 22
 	die;
23 23
 }
24 24
 
25 25
 // Set some constants
26
-define( 'LASSO_VERSION', '1.0.9.1' );
27
-define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) );
28
-define( 'LASSO_URL', plugins_url( '', __FILE__ ) );
29
-define( 'LASSO_FILE', __FILE__ );
26
+define('LASSO_VERSION', '1.0.9.1');
27
+define('LASSO_DIR', plugin_dir_path(__FILE__));
28
+define('LASSO_URL', plugins_url('', __FILE__));
29
+define('LASSO_FILE', __FILE__);
30 30
 
31 31
 /**
32 32
  * Load plugin if PHP version is 5.4 or later.
33 33
  */
34
-if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
34
+if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
35 35
 
36
-	include_once( LASSO_DIR . '/bootstrap.php' );
36
+	include_once(LASSO_DIR.'/bootstrap.php');
37 37
 
38 38
 } else {
39 39
 
40 40
 	add_action('admin_head', 'lasso_fail_notice');
41
-	function lasso_fail_notice(){
41
+	function lasso_fail_notice() {
42 42
 
43 43
 		printf('<div class="error"><p>Editus requires PHP 5.4 or higher.</p></div>');
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2);
49
-function lasso_show_in_rest($args, $post_type){
49
+function lasso_show_in_rest($args, $post_type) {
50 50
  
51
-    $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) );
52
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
53
-	if (in_array( $post_type,$allowed_post_types)) {
51
+    $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array( ));
52
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types);
53
+	if (in_array($post_type, $allowed_post_types)) {
54 54
 		$args['show_in_rest'] = true;
55 55
 		if ($post_type != 'post' && $post_type != 'page') {
56 56
 			$args['rest_base'] = $post_type;
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 ));
68 68
 
69 69
 // Gutenberg
70
-if( function_exists( 'is_gutenberg_page' ) ) {
71
-	function add_raw_to_post( $response, $post, $request ) {
70
+if (function_exists('is_gutenberg_page')) {
71
+	function add_raw_to_post($response, $post, $request) {
72 72
 		$response_data = $response->get_data();
73
-		if ( is_array( $response_data['content'] )) {
74
-			$response_data['content']['raw'] =  $post->post_content ;
75
-			$response->set_data( $response_data );
73
+		if (is_array($response_data['content'])) {
74
+			$response_data['content']['raw'] = $post->post_content;
75
+			$response->set_data($response_data);
76 76
 		}
77 77
 
78 78
 		return $response;
79 79
 	}
80
-	add_filter( "rest_prepare_post", 'add_raw_to_post', 10, 3 );
80
+	add_filter("rest_prepare_post", 'add_raw_to_post', 10, 3);
81 81
 }
82 82
 
Please login to merge, or discard this patch.
public/includes/lasso.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -52,21 +52,21 @@  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 71
 		// enable saving custom fields through REST API
72 72
 		self::enable_metasave('post');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	public static function get_instance() {
98 98
 
99 99
 		// If the single instance hasn't been set, set it now.
100
-		if ( null == self::$instance ) {
100
+		if (null == self::$instance) {
101 101
 			self::$instance = new self;
102 102
 		}
103 103
 
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
 	 *                                       WPMU is disabled or plugin is
115 115
 	 *                                       activated on an individual blog.
116 116
 	 */
117
-	public static function activate( $network_wide ) {
117
+	public static function activate($network_wide) {
118 118
 
119
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
119
+		if (function_exists('is_multisite') && is_multisite()) {
120 120
 
121
-			if ( $network_wide  ) {
121
+			if ($network_wide) {
122 122
 
123 123
 				// Get all blog ids
124 124
 				$blog_ids = self::get_blog_ids();
125 125
 
126
-				foreach ( $blog_ids as $blog_id ) {
126
+				foreach ($blog_ids as $blog_id) {
127 127
 
128
-					switch_to_blog( $blog_id );
128
+					switch_to_blog($blog_id);
129 129
 					self::single_activate();
130 130
 				}
131 131
 
@@ -151,18 +151,18 @@  discard block
 block discarded – undo
151 151
 	 *                                       WPMU is disabled or plugin is
152 152
 	 *                                       deactivated on an individual blog.
153 153
 	 */
154
-	public static function deactivate( $network_wide ) {
154
+	public static function deactivate($network_wide) {
155 155
 
156
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
156
+		if (function_exists('is_multisite') && is_multisite()) {
157 157
 
158
-			if ( $network_wide ) {
158
+			if ($network_wide) {
159 159
 
160 160
 				// Get all blog ids
161 161
 				$blog_ids = self::get_blog_ids();
162 162
 
163
-				foreach ( $blog_ids as $blog_id ) {
163
+				foreach ($blog_ids as $blog_id) {
164 164
 
165
-					switch_to_blog( $blog_id );
165
+					switch_to_blog($blog_id);
166 166
 					self::single_deactivate();
167 167
 
168 168
 				}
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @param int     $blog_id ID of the new blog.
188 188
 	 */
189
-	public function activate_new_site( $blog_id ) {
189
+	public function activate_new_site($blog_id) {
190 190
 
191
-		if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
191
+		if (1 !== did_action('wpmu_new_blog')) {
192 192
 			return;
193 193
 		}
194 194
 
195
-		switch_to_blog( $blog_id );
195
+		switch_to_blog($blog_id);
196 196
 		self::single_activate();
197 197
 		restore_current_blog();
198 198
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			WHERE archived = '0' AND spam = '0'
218 218
 			AND deleted = '0'";
219 219
 
220
-		return $wpdb->get_col( $sql );
220
+		return $wpdb->get_col($sql);
221 221
 
222 222
 	}
223 223
 
@@ -228,18 +228,18 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	private static function single_activate() {
230 230
 
231
-		$curr_version = get_option( 'lasso_version' );
231
+		$curr_version = get_option('lasso_version');
232 232
 
233 233
 		// update upgraded from
234
-		if ( $curr_version ) {
235
-			update_option( 'lasso_updated_from', $curr_version );
234
+		if ($curr_version) {
235
+			update_option('lasso_updated_from', $curr_version);
236 236
 		}
237 237
 
238 238
 		// update lasso version option
239
-		update_option( 'lasso_version', LASSO_VERSION );
239
+		update_option('lasso_version', LASSO_VERSION);
240 240
 
241 241
 		// set transietn for activation welcome
242
-		set_transient( '_lasso_welcome_redirect', true, 30 );
242
+		set_transient('_lasso_welcome_redirect', true, 30);
243 243
 
244 244
 
245 245
 	}
@@ -261,15 +261,15 @@  discard block
 block discarded – undo
261 261
 	public function load_plugin_textdomain() {
262 262
 
263 263
 		$domain = $this->plugin_slug;
264
-		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
264
+		$locale = apply_filters('plugin_locale', get_locale(), $domain);
265 265
 
266
-		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
266
+		$out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo');
267 267
 	}
268 268
 	
269 269
     // new ajax function to lock post for editing
270 270
 	public function editus_lock_post()
271 271
 	{
272
-		$post_id= $_POST["postid"];
272
+		$post_id = $_POST["postid"];
273 273
 		$locked = wp_check_post_lock($post_id);
274 274
 		
275 275
 		if (!$locked) {
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
 			echo "true";
278 278
 		} else {
279 279
 			$user_info = get_userdata($locked);
280
-			echo "Post opened by ".$user_info->first_name .  " " . $user_info->last_name;
280
+			echo "Post opened by ".$user_info->first_name." ".$user_info->last_name;
281 281
 		}
282 282
 		exit;
283 283
 	}
284 284
 	
285 285
 	public function editus_unlock_post()
286 286
 	{
287
-		$post_id= $_POST["postid"];
287
+		$post_id = $_POST["postid"];
288 288
 		$locked = wp_check_post_lock($post_id);
289
-		delete_post_meta( $post_id, '_edit_lock');
289
+		delete_post_meta($post_id, '_edit_lock');
290 290
 		echo "true";
291 291
 		
292 292
 		exit;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	{
298 298
 		$user_id = get_current_user_ID();
299 299
 				
300
-		update_user_meta( $user_id, 'lasso_hide_tour', true );
300
+		update_user_meta($user_id, 'lasso_hide_tour', true);
301 301
 		exit;
302 302
 	}
303 303
 	
@@ -308,14 +308,14 @@  discard block
 block discarded – undo
308 308
 		$data = array();
309 309
 		parse_str($_POST['data'], $data);
310 310
 		
311
-		if (!wp_verify_nonce( $data[ 'nonce' ], 'lasso-update-post-settings' )) {
311
+		if (!wp_verify_nonce($data['nonce'], 'lasso-update-post-settings')) {
312 312
 			wp_send_json_error();
313 313
 			exit;
314 314
 		}
315 315
 		
316
-		$status = isset( $data['status'] ) ? $data['status'] : false;
317
-		$postid = isset( $data['postid'] ) ? $data['postid'] : false;
318
-		$slug   = isset( $data['story_slug'] ) ? $data['story_slug'] : false;
316
+		$status = isset($data['status']) ? $data['status'] : false;
317
+		$postid = isset($data['postid']) ? $data['postid'] : false;
318
+		$slug   = isset($data['story_slug']) ? $data['story_slug'] : false;
319 319
 	
320 320
 
321 321
 		$args = array(
@@ -326,24 +326,24 @@  discard block
 block discarded – undo
326 326
 		
327 327
 		
328 328
 
329
-		wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) );
329
+		wp_update_post(apply_filters('lasso_object_status_update_args', $args));
330 330
 		
331 331
 		// update categories
332
-		$cats  = isset( $data['story_cats'] ) ? $data['story_cats'] : false;
332
+		$cats = isset($data['story_cats']) ? $data['story_cats'] : false;
333 333
 		
334
-		self::set_post_terms( $postid, $cats, 'category' );
334
+		self::set_post_terms($postid, $cats, 'category');
335 335
 		
336 336
 		// update tags
337
-		$tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false;
338
-		self::set_post_terms( $postid, $tags, 'post_tag' );
337
+		$tags = isset($data['story_tags']) ? $data['story_tags'] : false;
338
+		self::set_post_terms($postid, $tags, 'post_tag');
339 339
 		
340 340
 		//update date
341
-		$date  = isset( $data['post_date'] ) ? $data['post_date'] : false;
342
-		self::set_date( $postid, $date );
341
+		$date = isset($data['post_date']) ? $data['post_date'] : false;
342
+		self::set_date($postid, $date);
343 343
 		
344
-		do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() );
345
-		$response= array(
346
-			'link'   => get_permalink($postid). (($status=='publish') ? '' : '&preview=true')
344
+		do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID());
345
+		$response = array(
346
+			'link'   => get_permalink($postid).(($status == 'publish') ? '' : '&preview=true')
347 347
 		);
348 348
 		wp_send_json_success($response);
349 349
 		exit;
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 	
352 352
 	public static function enable_metasave($type)
353 353
 	{
354
-		register_rest_field( $type, 'metadata', array(
355
-			'get_callback' => function ( $data ) {
356
-				return get_post_meta( $data['id']);//, '', '' );
354
+		register_rest_field($type, 'metadata', array(
355
+			'get_callback' => function($data) {
356
+				return get_post_meta($data['id']); //, '', '' );
357 357
 			}, 
358
-			'update_callback' => function( $data, $post ) {
358
+			'update_callback' => function($data, $post) {
359 359
 				foreach ($data as $key => $value) {
360 360
 					update_post_meta($post->ID, $key, $value);
361 361
 				}
@@ -367,13 +367,13 @@  discard block
 block discarded – undo
367 367
 	public function editus_do_shortcode()
368 368
 	{
369 369
 		
370
-		$code= $_POST["code"];
370
+		$code = $_POST["code"];
371 371
 		$code = str_replace('\"', '"', $code);
372 372
 		
373
-		$code_wrapped = lasso_wrap_shortcodes( $code);
374
-		$out =  do_shortcode($code);
373
+		$code_wrapped = lasso_wrap_shortcodes($code);
374
+		$out = do_shortcode($code);
375 375
 		if ($out != '') {
376
-			$out =  do_shortcode($code_wrapped);
376
+			$out = do_shortcode($code_wrapped);
377 377
 			echo $out;
378 378
 			exit;
379 379
 		}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		/** @var \WP_Embed $wp_embed */
384 384
 		global $wp_embed;
385 385
 		$wp_embed->post_ID = $_POST["ID"];
386
-		$out =$wp_embed->run_shortcode( $code_wrapped );
386
+		$out = $wp_embed->run_shortcode($code_wrapped);
387 387
 		
388 388
 		echo $out;
389 389
 		exit;
@@ -393,53 +393,53 @@  discard block
 block discarded – undo
393 393
 	{
394 394
 		
395 395
 		
396
-		$code= $_POST["code"];
396
+		$code = $_POST["code"];
397 397
 		$atts = array(
398 398
 		 );
399 399
 		foreach ($_POST as $key => $value) {
400
-			if ($key !="code" && $key !="action") {
400
+			if ($key != "code" && $key != "action") {
401 401
 			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
402 402
 				$atts[$key] = $value;
403 403
 			}
404 404
 		}
405 405
 		if ($code == "aesop_video") {
406
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
406
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
407 407
 		    echo aesop_video_shortcode($atts);
408 408
 		}
409 409
 		else if ($code == "aesop_image") {
410
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
410
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
411 411
 		    echo aesop_image_shortcode($atts);
412 412
 		}
413 413
 		else if ($code == "aesop_quote") {
414
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
414
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
415 415
 		    echo aesop_quote_shortcode($atts);
416 416
 		}
417 417
 		else if ($code == "aesop_parallax") {
418
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
418
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
419 419
 		    echo aesop_parallax_shortcode($atts);
420 420
 		}
421 421
 		else if ($code == "aesop_character") {
422
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
422
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
423 423
 		    echo aesop_character_shortcode($atts);
424 424
 		}
425 425
 		else if ($code == "aesop_collection") {
426
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
426
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
427 427
 		    echo aesop_collection_shortcode($atts);
428 428
 		}
429 429
 		else if ($code == "aesop_chapter") {
430
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
430
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
431 431
 		    echo aesop_chapter_shortcode($atts);
432 432
 		}
433 433
 		else if ($code == "aesop_content") {
434
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
434
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
435 435
 		    echo aesop_content_shortcode($atts, $atts['content_data']);
436 436
 		}
437 437
 		else if ($code == "aesop_gallery") {
438
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
439
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
438
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
439
+		    echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]');
440 440
 		}
441 441
 		else if ($code == "aesop_audio") {
442
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
442
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
443 443
 		    echo aesop_audio_shortcode($atts);
444 444
 		}
445 445
 		else {
@@ -460,20 +460,20 @@  discard block
 block discarded – undo
460 460
 	public function get_ase_options()
461 461
 	{
462 462
 		$blob = lasso_editor_options_blob();
463
-		$code= $_POST["component"];
463
+		$code = $_POST["component"];
464 464
 		echo $blob[$code];
465 465
 		exit; 
466 466
 	}
467 467
 	
468 468
 	public function delete_post( ) {
469 469
 
470
-		$postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
470
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
471 471
 
472 472
 		// bail out if teh current user can't publish posts
473
-		if ( !lasso_user_can( 'delete_post', $postid ) )
473
+		if (!lasso_user_can('delete_post', $postid))
474 474
 			return;
475 475
 		
476
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_delete_post' )) {
476
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_delete_post')) {
477 477
 			wp_send_json_error();
478 478
 			exit;
479 479
 		}
@@ -483,40 +483,40 @@  discard block
 block discarded – undo
483 483
 			'post_status' 	=> 'trash'
484 484
 		);
485 485
 
486
-		wp_update_post( apply_filters( 'lasso_object_deleted_args', $args ) );
486
+		wp_update_post(apply_filters('lasso_object_deleted_args', $args));
487 487
 
488
-		do_action( 'lasso_object_deleted', $postid, get_current_user_ID() );
488
+		do_action('lasso_object_deleted', $postid, get_current_user_ID());
489 489
 
490 490
 		exit;
491 491
 	}
492 492
 	
493 493
 	public function set_featured_img( ) {
494 494
 
495
-		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
496
-		$image_id  	= isset( $_POST['image_id'] ) ? absint( $_POST['image_id'] ) : false;
497
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
495
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
496
+		$image_id = isset($_POST['image_id']) ? absint($_POST['image_id']) : false;
497
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
498 498
 			wp_send_json_error();
499 499
 			exit;
500 500
 		}	
501 501
 
502
-		set_post_thumbnail( $postid, $image_id );
502
+		set_post_thumbnail($postid, $image_id);
503 503
 
504
-		do_action( 'lasso_featured_image_set', $postid, $image_id, get_current_user_ID() );
504
+		do_action('lasso_featured_image_set', $postid, $image_id, get_current_user_ID());
505 505
 
506 506
 		exit;
507 507
 	}
508 508
 	
509 509
 	public function del_featured_img( ) {
510 510
 
511
-		$postid  = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
512
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
511
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
512
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
513 513
 			wp_send_json_error();
514 514
 			exit;
515 515
 		}	
516 516
 
517
-		delete_post_thumbnail( $postid );
517
+		delete_post_thumbnail($postid);
518 518
 
519
-		do_action( 'lasso_featured_image_deleted', $postid, get_current_user_ID() );
519
+		do_action('lasso_featured_image_deleted', $postid, get_current_user_ID());
520 520
 
521 521
 		exit;
522 522
 	}
@@ -537,17 +537,17 @@  discard block
 block discarded – undo
537 537
 		return self::$revisions;
538 538
 	}*/
539 539
 	
540
-	public function set_post_terms( $postid, $value, $taxonomy ) {
541
-		if( $value ) {
542
-			$value = explode( ',', $value );
543
-			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
540
+	public function set_post_terms($postid, $value, $taxonomy) {
541
+		if ($value) {
542
+			$value = explode(',', $value);
543
+			$allow_new_category = lasso_editor_get_option('allow_new_category', 'lasso_editor');
544 544
 			
545
-			if ($taxonomy =='category') {
545
+			if ($taxonomy == 'category') {
546 546
                 // convert from names to category ids
547 547
 				$cats = array();
548 548
 				foreach ($value as $cat) {
549 549
 					$cat_id = get_cat_ID($cat);
550
-					if ($cat_id !=0) {
550
+					if ($cat_id != 0) {
551 551
 						$cats [] = $cat_id;
552 552
 					} else if ($allow_new_category) {
553 553
 					    $cats [] = wp_create_category($cat);
@@ -556,47 +556,47 @@  discard block
 block discarded – undo
556 556
 				$value = $cats;
557 557
 			}
558 558
 	
559
-			$result = wp_set_object_terms( $postid, $value, $taxonomy );
559
+			$result = wp_set_object_terms($postid, $value, $taxonomy);
560 560
 		}
561
-		else  {
561
+		else {
562 562
 			//remove all terms from post
563
-			$result = wp_set_object_terms( $postid, null, $taxonomy );
563
+			$result = wp_set_object_terms($postid, null, $taxonomy);
564 564
 		}
565 565
 
566
-		if ( ! is_wp_error( $result ) ) {
566
+		if (!is_wp_error($result)) {
567 567
 			return true;
568
-		}else{
568
+		} else {
569 569
 			return false;
570 570
 		}
571 571
 	}
572 572
 	
573
-	function getEnglishMonthName($foreignMonthName){
573
+	function getEnglishMonthName($foreignMonthName) {
574 574
 
575 575
 		  setlocale(LC_ALL, 'en_US');
576 576
 
577
-		  $month_numbers = range(1,12);
577
+		  $month_numbers = range(1, 12);
578 578
 
579
-		  foreach($month_numbers as $month)
580
-			$english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011));
579
+		  foreach ($month_numbers as $month)
580
+			$english_months[] = strftime('%B', mktime(0, 0, 0, $month, 1, 2011));
581 581
 
582 582
 		  setlocale(LC_ALL, get_locale());
583 583
 
584
-		  foreach($month_numbers as $month)
585
-			$foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011)));
584
+		  foreach ($month_numbers as $month)
585
+			$foreign_months[] = utf8_encode(strftime('%B', mktime(0, 0, 0, $month, 1, 2011)));
586 586
 
587 587
 		  return str_replace($foreign_months, $english_months, $foreignMonthName);
588 588
 	}
589 589
 
590 590
 
591 591
 	
592
-	public function set_date( $postid, $value) {
593
-		if( $value ) {
594
-			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 ));
592
+	public function set_date($postid, $value) {
593
+		if ($value) {
594
+			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time('timestamp', 1));
595 595
             wp_update_post(
596
-				array (
596
+				array(
597 597
 					'ID'            => $postid, // ID of the post to update
598
-					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
599
-					'post_date_gmt'     => gmdate( 'Y-m-d H:i:s',  strtotime($value) ),
598
+					'post_date'     => date('Y-m-d H:i:s', strtotime($value)),
599
+					'post_date_gmt'     => gmdate('Y-m-d H:i:s', strtotime($value)),
600 600
 				)
601 601
 			);
602 602
 		}
Please login to merge, or discard this patch.