Completed
Push — master ( 448b3d...9aed0a )
by
unknown
01:35
created
public/includes/lasso.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  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, 'publish_post' ) );
71
+		add_action( 'wp_ajax_editus_publish_post',     array( $this, 'publish_post' ) );
72 72
 
73 73
 		// enable saving custom fields through REST API
74 74
 		self::enable_metasave('post');
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
269 269
 	}
270 270
 	
271
-    // new ajax function to lock post for editing
271
+	// new ajax function to lock post for editing
272 272
 	public function editus_lock_post()
273 273
 	{
274 274
 		$post_id= $_POST["postid"];
275 275
 		$locked = wp_check_post_lock($post_id);
276 276
 		
277 277
 		if (!$locked) {
278
-		    wp_set_post_lock($post_id);
278
+			wp_set_post_lock($post_id);
279 279
 			echo "true";
280 280
 		} else {
281 281
 			$user_info = get_userdata($locked);
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 	{
289 289
 		$post_id= $_POST["postid"];
290 290
 		$locked = wp_check_post_lock($post_id);
291
-        if (!$locked) {
292
-            delete_post_meta( $post_id, '_edit_lock');
293
-        }
291
+		if (!$locked) {
292
+			delete_post_meta( $post_id, '_edit_lock');
293
+		}
294 294
 		echo "true";
295 295
 		
296 296
 		exit;
@@ -402,59 +402,59 @@  discard block
 block discarded – undo
402 402
 		 );
403 403
 		foreach ($_POST as $key => $value) {
404 404
 			if ($key !="code" && $key !="action") {
405
-			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
405
+				//$shortcode = $shortcode.$key.'="'.$value.'" ';
406 406
 				$atts[$key] = $value;
407 407
 			}
408 408
 		}
409 409
 		if ($code == "aesop_video") {
410
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
411
-		    echo aesop_video_shortcode($atts);
410
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
411
+			echo aesop_video_shortcode($atts);
412 412
 		}
413 413
 		else if ($code == "aesop_image") {
414
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
415
-		    echo aesop_image_shortcode($atts);
414
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
415
+			echo aesop_image_shortcode($atts);
416 416
 		}
417 417
 		else if ($code == "aesop_quote") {
418
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
419
-		    echo aesop_quote_shortcode($atts);
418
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
419
+			echo aesop_quote_shortcode($atts);
420 420
 		}
421 421
 		else if ($code == "aesop_parallax") {
422
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
423
-		    echo aesop_parallax_shortcode($atts);
422
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
423
+			echo aesop_parallax_shortcode($atts);
424 424
 		}
425 425
 		else if ($code == "aesop_character") {
426
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
427
-		    echo aesop_character_shortcode($atts);
426
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
427
+			echo aesop_character_shortcode($atts);
428 428
 		}
429 429
 		else if ($code == "aesop_collection") {
430
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
431
-		    echo aesop_collection_shortcode($atts);
430
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
431
+			echo aesop_collection_shortcode($atts);
432 432
 		}
433 433
 		else if ($code == "aesop_chapter") {
434
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
435
-		    echo aesop_chapter_shortcode($atts);
434
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
435
+			echo aesop_chapter_shortcode($atts);
436 436
 		}
437 437
 		else if ($code == "aesop_content") {
438
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
439
-		    echo aesop_content_shortcode($atts, $atts['content_data']);
438
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
439
+			echo aesop_content_shortcode($atts, $atts['content_data']);
440 440
 		}
441 441
 		else if ($code == "aesop_gallery") {
442
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
443
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
442
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
443
+			echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
444 444
 		}
445 445
 		else if ($code == "aesop_audio") {
446
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
447
-		    echo aesop_audio_shortcode($atts);
446
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
447
+			echo aesop_audio_shortcode($atts);
448 448
 		}
449 449
 		else {
450 450
 			$code = '['.$code.' ';
451 451
 			foreach ($atts as $key => $value) {
452
-			    $code = ''.$key.'="'.$value.'" ';
452
+				$code = ''.$key.'="'.$value.'" ';
453 453
 			}
454 454
 			$code = $code.']';
455 455
 			echo do_shortcode($code);
456
-		    //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php');
457
-		    //echo aesop_audio_shortcode($atts);
456
+			//require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php');
457
+			//echo aesop_audio_shortcode($atts);
458 458
 		}
459 459
 		
460 460
 		exit; 
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 		exit;
495 495
 	}
496 496
     
497
-    /* This function doesn't actually publish post, but should be called when a post is published */
498
-    public function publish_post( ) {
497
+	/* This function doesn't actually publish post, but should be called when a post is published */
498
+	public function publish_post( ) {
499 499
 
500 500
 		$post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
501 501
         
502
-        do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
502
+		do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
503 503
 
504 504
 		exit;
505 505
 	}
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
 			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
558 558
 			
559 559
 			if ($taxonomy =='category') {
560
-                // convert from names to category ids
560
+				// convert from names to category ids
561 561
 				$cats = array();
562 562
 				foreach ($value as $cat) {
563 563
 					$cat_id = get_cat_ID($cat);
564 564
 					if ($cat_id !=0) {
565 565
 						$cats [] = $cat_id;
566 566
 					} else if ($allow_new_category) {
567
-					    $cats [] = wp_create_category($cat);
567
+						$cats [] = wp_create_category($cat);
568 568
 					}
569 569
 				}
570 570
 				$value = $cats;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	public function set_date( $postid, $value) {
607 607
 		if( $value ) {
608 608
 			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 ));
609
-            wp_update_post(
609
+			wp_update_post(
610 610
 				array (
611 611
 					'ID'            => $postid, // ID of the post to update
612 612
 					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -52,23 +52,23 @@  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, 'publish_post' ) );
71
+        add_action('wp_ajax_editus_publish_post', array($this, 'publish_post'));
72 72
 
73 73
 		// enable saving custom fields through REST API
74 74
 		self::enable_metasave('post');
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	public static function get_instance() {
100 100
 
101 101
 		// If the single instance hasn't been set, set it now.
102
-		if ( null == self::$instance ) {
102
+		if (null == self::$instance) {
103 103
 			self::$instance = new self;
104 104
 		}
105 105
 
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 	 *                                       WPMU is disabled or plugin is
117 117
 	 *                                       activated on an individual blog.
118 118
 	 */
119
-	public static function activate( $network_wide ) {
119
+	public static function activate($network_wide) {
120 120
 
121
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
121
+		if (function_exists('is_multisite') && is_multisite()) {
122 122
 
123
-			if ( $network_wide  ) {
123
+			if ($network_wide) {
124 124
 
125 125
 				// Get all blog ids
126 126
 				$blog_ids = self::get_blog_ids();
127 127
 
128
-				foreach ( $blog_ids as $blog_id ) {
128
+				foreach ($blog_ids as $blog_id) {
129 129
 
130
-					switch_to_blog( $blog_id );
130
+					switch_to_blog($blog_id);
131 131
 					self::single_activate();
132 132
 				}
133 133
 
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
 	 *                                       WPMU is disabled or plugin is
154 154
 	 *                                       deactivated on an individual blog.
155 155
 	 */
156
-	public static function deactivate( $network_wide ) {
156
+	public static function deactivate($network_wide) {
157 157
 
158
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
158
+		if (function_exists('is_multisite') && is_multisite()) {
159 159
 
160
-			if ( $network_wide ) {
160
+			if ($network_wide) {
161 161
 
162 162
 				// Get all blog ids
163 163
 				$blog_ids = self::get_blog_ids();
164 164
 
165
-				foreach ( $blog_ids as $blog_id ) {
165
+				foreach ($blog_ids as $blog_id) {
166 166
 
167
-					switch_to_blog( $blog_id );
167
+					switch_to_blog($blog_id);
168 168
 					self::single_deactivate();
169 169
 
170 170
 				}
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @param int     $blog_id ID of the new blog.
190 190
 	 */
191
-	public function activate_new_site( $blog_id ) {
191
+	public function activate_new_site($blog_id) {
192 192
 
193
-		if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
193
+		if (1 !== did_action('wpmu_new_blog')) {
194 194
 			return;
195 195
 		}
196 196
 
197
-		switch_to_blog( $blog_id );
197
+		switch_to_blog($blog_id);
198 198
 		self::single_activate();
199 199
 		restore_current_blog();
200 200
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			WHERE archived = '0' AND spam = '0'
220 220
 			AND deleted = '0'";
221 221
 
222
-		return $wpdb->get_col( $sql );
222
+		return $wpdb->get_col($sql);
223 223
 
224 224
 	}
225 225
 
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	private static function single_activate() {
232 232
 
233
-		$curr_version = get_option( 'lasso_version' );
233
+		$curr_version = get_option('lasso_version');
234 234
 
235 235
 		// update upgraded from
236
-		if ( $curr_version ) {
237
-			update_option( 'lasso_updated_from', $curr_version );
236
+		if ($curr_version) {
237
+			update_option('lasso_updated_from', $curr_version);
238 238
 		}
239 239
 
240 240
 		// update lasso version option
241
-		update_option( 'lasso_version', LASSO_VERSION );
241
+		update_option('lasso_version', LASSO_VERSION);
242 242
 
243 243
 		// set transietn for activation welcome
244
-		set_transient( '_lasso_welcome_redirect', true, 30 );
244
+		set_transient('_lasso_welcome_redirect', true, 30);
245 245
 
246 246
 
247 247
 	}
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
 	public function load_plugin_textdomain() {
264 264
 
265 265
 		$domain = $this->plugin_slug;
266
-		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
266
+		$locale = apply_filters('plugin_locale', get_locale(), $domain);
267 267
 
268
-		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
268
+		$out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo');
269 269
 	}
270 270
 	
271 271
     // new ajax function to lock post for editing
272 272
 	public function editus_lock_post()
273 273
 	{
274
-		$post_id= $_POST["postid"];
274
+		$post_id = $_POST["postid"];
275 275
 		$locked = wp_check_post_lock($post_id);
276 276
 		
277 277
 		if (!$locked) {
@@ -279,17 +279,17 @@  discard block
 block discarded – undo
279 279
 			echo "true";
280 280
 		} else {
281 281
 			$user_info = get_userdata($locked);
282
-			echo _e( 'Post being edited by ', 'lasso' ).$user_info->first_name .  " " . $user_info->last_name;
282
+			echo _e('Post being edited by ', 'lasso').$user_info->first_name." ".$user_info->last_name;
283 283
 		}
284 284
 		exit;
285 285
 	}
286 286
 	
287 287
 	public function editus_unlock_post()
288 288
 	{
289
-		$post_id= $_POST["postid"];
289
+		$post_id = $_POST["postid"];
290 290
 		$locked = wp_check_post_lock($post_id);
291 291
         if (!$locked) {
292
-            delete_post_meta( $post_id, '_edit_lock');
292
+            delete_post_meta($post_id, '_edit_lock');
293 293
         }
294 294
 		echo "true";
295 295
 		
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	{
302 302
 		$user_id = get_current_user_ID();
303 303
 				
304
-		update_user_meta( $user_id, 'lasso_hide_tour', true );
304
+		update_user_meta($user_id, 'lasso_hide_tour', true);
305 305
 		exit;
306 306
 	}
307 307
 	
@@ -312,14 +312,14 @@  discard block
 block discarded – undo
312 312
 		$data = array();
313 313
 		parse_str($_POST['data'], $data);
314 314
 		
315
-		if (!wp_verify_nonce( $data[ 'nonce' ], 'lasso-update-post-settings' )) {
315
+		if (!wp_verify_nonce($data['nonce'], 'lasso-update-post-settings')) {
316 316
 			wp_send_json_error();
317 317
 			exit;
318 318
 		}
319 319
 		
320
-		$status = isset( $data['status'] ) ? $data['status'] : false;
321
-		$postid = isset( $data['postid'] ) ? $data['postid'] : false;
322
-		$slug   = isset( $data['story_slug'] ) ? $data['story_slug'] : false;
320
+		$status = isset($data['status']) ? $data['status'] : false;
321
+		$postid = isset($data['postid']) ? $data['postid'] : false;
322
+		$slug   = isset($data['story_slug']) ? $data['story_slug'] : false;
323 323
 	
324 324
 
325 325
 		$args = array(
@@ -330,24 +330,24 @@  discard block
 block discarded – undo
330 330
 		
331 331
 		
332 332
 
333
-		wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) );
333
+		wp_update_post(apply_filters('lasso_object_status_update_args', $args));
334 334
 		
335 335
 		// update categories
336
-		$cats  = isset( $data['story_cats'] ) ? $data['story_cats'] : false;
336
+		$cats = isset($data['story_cats']) ? $data['story_cats'] : false;
337 337
 		
338
-		self::set_post_terms( $postid, $cats, 'category' );
338
+		self::set_post_terms($postid, $cats, 'category');
339 339
 		
340 340
 		// update tags
341
-		$tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false;
342
-		self::set_post_terms( $postid, $tags, 'post_tag' );
341
+		$tags = isset($data['story_tags']) ? $data['story_tags'] : false;
342
+		self::set_post_terms($postid, $tags, 'post_tag');
343 343
 		
344 344
 		//update date
345
-		$date  = isset( $data['post_date'] ) ? $data['post_date'] : false;
346
-		self::set_date( $postid, $date );
345
+		$date = isset($data['post_date']) ? $data['post_date'] : false;
346
+		self::set_date($postid, $date);
347 347
 		
348
-		do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() );
349
-		$response= array(
350
-			'link'   => get_permalink($postid). (($status=='publish') ? '' : '&preview=true')
348
+		do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID());
349
+		$response = array(
350
+			'link'   => get_permalink($postid).(($status == 'publish') ? '' : '&preview=true')
351 351
 		);
352 352
 		wp_send_json_success($response);
353 353
 		exit;
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 	
356 356
 	public static function enable_metasave($type)
357 357
 	{
358
-		register_rest_field( $type, 'metadata', array(
359
-			'get_callback' => function ( $data ) {
360
-				return get_post_meta( $data['id']);//, '', '' );
358
+		register_rest_field($type, 'metadata', array(
359
+			'get_callback' => function($data) {
360
+				return get_post_meta($data['id']); //, '', '' );
361 361
 			}, 
362
-			'update_callback' => function( $data, $post ) {
362
+			'update_callback' => function($data, $post) {
363 363
 				foreach ($data as $key => $value) {
364 364
 					update_post_meta($post->ID, $key, $value);
365 365
 				}
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 	public function editus_do_shortcode()
372 372
 	{
373 373
 		
374
-		$code= $_POST["code"];
374
+		$code = $_POST["code"];
375 375
 		$code = str_replace('\"', '"', $code);
376 376
 		
377
-		$code_wrapped = lasso_wrap_shortcodes( $code);
378
-		$out =  do_shortcode($code);
377
+		$code_wrapped = lasso_wrap_shortcodes($code);
378
+		$out = do_shortcode($code);
379 379
 		if ($out != '') {
380
-			$out =  do_shortcode($code_wrapped);
380
+			$out = do_shortcode($code_wrapped);
381 381
 			echo $out;
382 382
 			exit;
383 383
 		}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		/** @var \WP_Embed $wp_embed */
388 388
 		global $wp_embed;
389 389
 		$wp_embed->post_ID = $_POST["ID"];
390
-		$out =$wp_embed->run_shortcode( $code_wrapped );
390
+		$out = $wp_embed->run_shortcode($code_wrapped);
391 391
 		
392 392
 		echo $out;
393 393
 		exit;
@@ -397,53 +397,53 @@  discard block
 block discarded – undo
397 397
 	{
398 398
 		
399 399
 		
400
-		$code= $_POST["code"];
400
+		$code = $_POST["code"];
401 401
 		$atts = array(
402 402
 		 );
403 403
 		foreach ($_POST as $key => $value) {
404
-			if ($key !="code" && $key !="action") {
404
+			if ($key != "code" && $key != "action") {
405 405
 			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
406 406
 				$atts[$key] = $value;
407 407
 			}
408 408
 		}
409 409
 		if ($code == "aesop_video") {
410
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
410
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
411 411
 		    echo aesop_video_shortcode($atts);
412 412
 		}
413 413
 		else if ($code == "aesop_image") {
414
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
414
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
415 415
 		    echo aesop_image_shortcode($atts);
416 416
 		}
417 417
 		else if ($code == "aesop_quote") {
418
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
418
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
419 419
 		    echo aesop_quote_shortcode($atts);
420 420
 		}
421 421
 		else if ($code == "aesop_parallax") {
422
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
422
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
423 423
 		    echo aesop_parallax_shortcode($atts);
424 424
 		}
425 425
 		else if ($code == "aesop_character") {
426
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
426
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
427 427
 		    echo aesop_character_shortcode($atts);
428 428
 		}
429 429
 		else if ($code == "aesop_collection") {
430
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
430
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
431 431
 		    echo aesop_collection_shortcode($atts);
432 432
 		}
433 433
 		else if ($code == "aesop_chapter") {
434
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
434
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
435 435
 		    echo aesop_chapter_shortcode($atts);
436 436
 		}
437 437
 		else if ($code == "aesop_content") {
438
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
438
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
439 439
 		    echo aesop_content_shortcode($atts, $atts['content_data']);
440 440
 		}
441 441
 		else if ($code == "aesop_gallery") {
442
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
443
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
442
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
443
+		    echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]');
444 444
 		}
445 445
 		else if ($code == "aesop_audio") {
446
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
446
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
447 447
 		    echo aesop_audio_shortcode($atts);
448 448
 		}
449 449
 		else {
@@ -464,20 +464,20 @@  discard block
 block discarded – undo
464 464
 	public function get_ase_options()
465 465
 	{
466 466
 		$blob = lasso_editor_options_blob();
467
-		$code= $_POST["component"];
467
+		$code = $_POST["component"];
468 468
 		echo $blob[$code];
469 469
 		exit; 
470 470
 	}
471 471
 	
472 472
 	public function delete_post( ) {
473 473
 
474
-		$postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
474
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
475 475
 
476 476
 		// bail out if the current user can't publish posts
477
-		if ( !lasso_user_can( 'delete_post', $postid ) )
477
+		if (!lasso_user_can('delete_post', $postid))
478 478
 			return;
479 479
 		
480
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_delete_post' )) {
480
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_delete_post')) {
481 481
 			wp_send_json_error();
482 482
 			exit;
483 483
 		}
@@ -487,9 +487,9 @@  discard block
 block discarded – undo
487 487
 			'post_status' 	=> 'trash'
488 488
 		);
489 489
 
490
-		wp_update_post( apply_filters( 'lasso_object_deleted_args', $args ) );
490
+		wp_update_post(apply_filters('lasso_object_deleted_args', $args));
491 491
 
492
-		do_action( 'lasso_object_deleted', $postid, get_current_user_ID() );
492
+		do_action('lasso_object_deleted', $postid, get_current_user_ID());
493 493
 
494 494
 		exit;
495 495
 	}
@@ -497,40 +497,40 @@  discard block
 block discarded – undo
497 497
     /* This function doesn't actually publish post, but should be called when a post is published */
498 498
     public function publish_post( ) {
499 499
 
500
-		$post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
500
+		$post_id = isset($_POST['postid']) ? $_POST['postid'] : false;
501 501
         
502
-        do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) );
502
+        do_action('transition_post_status', 'publish', 'draft', get_post($post_id));
503 503
 
504 504
 		exit;
505 505
 	}
506 506
 	
507 507
 	public function set_featured_img( ) {
508 508
 
509
-		$postid  	= isset( $_POST['postid'] ) ? $_POST['postid'] : false;
510
-		$image_id  	= isset( $_POST['image_id'] ) ? absint( $_POST['image_id'] ) : false;
511
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
509
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
510
+		$image_id = isset($_POST['image_id']) ? absint($_POST['image_id']) : false;
511
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
512 512
 			wp_send_json_error();
513 513
 			exit;
514 514
 		}	
515 515
 
516
-		set_post_thumbnail( $postid, $image_id );
516
+		set_post_thumbnail($postid, $image_id);
517 517
 
518
-		do_action( 'lasso_featured_image_set', $postid, $image_id, get_current_user_ID() );
518
+		do_action('lasso_featured_image_set', $postid, $image_id, get_current_user_ID());
519 519
 
520 520
 		exit;
521 521
 	}
522 522
 	
523 523
 	public function del_featured_img( ) {
524 524
 
525
-		$postid  = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
526
-		if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_gallery' )) {
525
+		$postid = isset($_POST['postid']) ? $_POST['postid'] : false;
526
+		if (!wp_verify_nonce($_POST['nonce'], 'lasso_gallery')) {
527 527
 			wp_send_json_error();
528 528
 			exit;
529 529
 		}	
530 530
 
531
-		delete_post_thumbnail( $postid );
531
+		delete_post_thumbnail($postid);
532 532
 
533
-		do_action( 'lasso_featured_image_deleted', $postid, get_current_user_ID() );
533
+		do_action('lasso_featured_image_deleted', $postid, get_current_user_ID());
534 534
 
535 535
 		exit;
536 536
 	}
@@ -551,17 +551,17 @@  discard block
 block discarded – undo
551 551
 		return self::$revisions;
552 552
 	}*/
553 553
 	
554
-	public function set_post_terms( $postid, $value, $taxonomy ) {
555
-		if( $value ) {
556
-			$value = explode( ',', $value );
557
-			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
554
+	public function set_post_terms($postid, $value, $taxonomy) {
555
+		if ($value) {
556
+			$value = explode(',', $value);
557
+			$allow_new_category = lasso_editor_get_option('allow_new_category', 'lasso_editor');
558 558
 			
559
-			if ($taxonomy =='category') {
559
+			if ($taxonomy == 'category') {
560 560
                 // convert from names to category ids
561 561
 				$cats = array();
562 562
 				foreach ($value as $cat) {
563 563
 					$cat_id = get_cat_ID($cat);
564
-					if ($cat_id !=0) {
564
+					if ($cat_id != 0) {
565 565
 						$cats [] = $cat_id;
566 566
 					} else if ($allow_new_category) {
567 567
 					    $cats [] = wp_create_category($cat);
@@ -570,47 +570,47 @@  discard block
 block discarded – undo
570 570
 				$value = $cats;
571 571
 			}
572 572
 	
573
-			$result = wp_set_object_terms( $postid, $value, $taxonomy );
573
+			$result = wp_set_object_terms($postid, $value, $taxonomy);
574 574
 		}
575
-		else  {
575
+		else {
576 576
 			//remove all terms from post
577
-			$result = wp_set_object_terms( $postid, null, $taxonomy );
577
+			$result = wp_set_object_terms($postid, null, $taxonomy);
578 578
 		}
579 579
 
580
-		if ( ! is_wp_error( $result ) ) {
580
+		if (!is_wp_error($result)) {
581 581
 			return true;
582
-		}else{
582
+		} else {
583 583
 			return false;
584 584
 		}
585 585
 	}
586 586
 	
587
-	function getEnglishMonthName($foreignMonthName){
587
+	function getEnglishMonthName($foreignMonthName) {
588 588
 
589 589
 		  setlocale(LC_ALL, 'en_US');
590 590
 
591
-		  $month_numbers = range(1,12);
591
+		  $month_numbers = range(1, 12);
592 592
 
593
-		  foreach($month_numbers as $month)
594
-			$english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011));
593
+		  foreach ($month_numbers as $month)
594
+			$english_months[] = strftime('%B', mktime(0, 0, 0, $month, 1, 2011));
595 595
 
596 596
 		  setlocale(LC_ALL, get_locale());
597 597
 
598
-		  foreach($month_numbers as $month)
599
-			$foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011)));
598
+		  foreach ($month_numbers as $month)
599
+			$foreign_months[] = utf8_encode(strftime('%B', mktime(0, 0, 0, $month, 1, 2011)));
600 600
 
601 601
 		  return str_replace($foreign_months, $english_months, $foreignMonthName);
602 602
 	}
603 603
 
604 604
 
605 605
 	
606
-	public function set_date( $postid, $value) {
607
-		if( $value ) {
608
-			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 ));
606
+	public function set_date($postid, $value) {
607
+		if ($value) {
608
+			$value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time('timestamp', 1));
609 609
             wp_update_post(
610
-				array (
610
+				array(
611 611
 					'ID'            => $postid, // ID of the post to update
612
-					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
613
-					'post_date_gmt'     => gmdate( 'Y-m-d H:i:s',  strtotime($value) ),
612
+					'post_date'     => date('Y-m-d H:i:s', strtotime($value)),
613
+					'post_date_gmt'     => gmdate('Y-m-d H:i:s', strtotime($value)),
614 614
 				)
615 615
 			);
616 616
 		}
Please login to merge, or discard this patch.
lasso.php 1 patch
Spacing   +24 added lines, -24 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.1.11' );
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.1.11');
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;
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 }
62 62
 
63 63
 
64
-function lasso_editor_get_option( $option, $section, $default = '' ) {
64
+function lasso_editor_get_option($option, $section, $default = '') {
65 65
 
66
-	if ( empty( $option ) )
66
+	if (empty($option))
67 67
 		return;
68 68
 
69
-	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
69
+	if (function_exists('is_multisite') && is_multisite()) {
70 70
 
71
-		$options = get_site_option( $section );
71
+		$options = get_site_option($section);
72 72
 
73 73
 	} else {
74 74
 
75
-		$options = get_option( $section );
75
+		$options = get_option($section);
76 76
 	}
77 77
 
78
-	if ( isset( $options[$option] ) ) {
78
+	if (isset($options[$option])) {
79 79
 		return $options[$option];
80 80
 	}
81 81
 
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
 ));
89 89
 
90 90
 // Gutenberg
91
-if( function_exists( 'is_gutenberg_page' ) ) {
92
-	function add_raw_to_post( $response, $post, $request ) {
91
+if (function_exists('is_gutenberg_page')) {
92
+	function add_raw_to_post($response, $post, $request) {
93 93
 		$response_data = $response->get_data();
94
-		if ( is_array( $response_data['content'] )) {
95
-			$response_data['content']['raw'] =  $post->post_content ;
96
-			$response->set_data( $response_data );
94
+		if (is_array($response_data['content'])) {
95
+			$response_data['content']['raw'] = $post->post_content;
96
+			$response->set_data($response_data);
97 97
 		}
98 98
 
99 99
 		return $response;
100 100
 	}
101
-	add_filter( "rest_prepare_post", 'add_raw_to_post', 10, 3 );
101
+	add_filter("rest_prepare_post", 'add_raw_to_post', 10, 3);
102 102
 }
103 103
 
Please login to merge, or discard this patch.