Completed
Push — master ( c354f8...9f9e0e )
by
unknown
01:50
created
public/includes/lasso.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
 		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
260 260
 	}
261 261
 	
262
-    // new ajax function to lock post for editing
262
+	// new ajax function to lock post for editing
263 263
 	public function editus_lock_post()
264 264
 	{
265 265
 		$post_id= $_POST["postid"];
266 266
 		$locked = wp_check_post_lock($post_id);
267 267
 		
268 268
 		if (!$locked) {
269
-		    wp_set_post_lock($post_id);
269
+			wp_set_post_lock($post_id);
270 270
 			echo "true";
271 271
 		} else {
272 272
 			$user_info = get_userdata($locked);
@@ -309,57 +309,57 @@  discard block
 block discarded – undo
309 309
 		 );
310 310
 		foreach ($_POST as $key => $value) {
311 311
 			if ($key !="code" && $key !="action") {
312
-			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
312
+				//$shortcode = $shortcode.$key.'="'.$value.'" ';
313 313
 				$atts[$key] = $value;
314 314
 			}
315 315
 		}
316 316
 		if ($code == "aesop_video") {
317
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
318
-		    echo aesop_video_shortcode($atts);
317
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
318
+			echo aesop_video_shortcode($atts);
319 319
 		}
320 320
 		
321 321
 		if ($code == "aesop_image") {
322
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
323
-		    echo aesop_image_shortcode($atts);
322
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
323
+			echo aesop_image_shortcode($atts);
324 324
 		}
325 325
 		if ($code == "aesop_quote") {
326
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
327
-		    echo aesop_quote_shortcode($atts);
326
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
327
+			echo aesop_quote_shortcode($atts);
328 328
 		}
329 329
 		
330 330
 		if ($code == "aesop_parallax") {
331
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
332
-		    echo aesop_parallax_shortcode($atts);
331
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
332
+			echo aesop_parallax_shortcode($atts);
333 333
 		}
334 334
 		
335 335
 		if ($code == "aesop_character") {
336
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
337
-		    echo aesop_character_shortcode($atts);
336
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
337
+			echo aesop_character_shortcode($atts);
338 338
 		}
339 339
 		
340 340
 		if ($code == "aesop_collection") {
341
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
342
-		    echo aesop_collection_shortcode($atts);
341
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
342
+			echo aesop_collection_shortcode($atts);
343 343
 		}
344 344
 		
345 345
 		if ($code == "aesop_chapter") {
346
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
347
-		    echo aesop_chapter_shortcode($atts);
346
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
347
+			echo aesop_chapter_shortcode($atts);
348 348
 		}
349 349
 		
350 350
 		if ($code == "aesop_content") {
351
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
352
-		    echo aesop_content_shortcode($atts, $atts['content_data']);
351
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
352
+			echo aesop_content_shortcode($atts, $atts['content_data']);
353 353
 		}
354 354
 		
355 355
 		if ($code == "aesop_gallery") {
356
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
357
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
356
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
357
+			echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
358 358
 		}
359 359
 		
360 360
 		if ($code == "aesop_audio") {
361
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
362
-		    echo aesop_audio_shortcode($atts);
361
+			require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
362
+			echo aesop_audio_shortcode($atts);
363 363
 		}
364 364
 		
365 365
 		exit; 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@  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' ) );
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 63
 
64 64
 		// enable saving custom fields through REST API
65 65
 		self::enable_metasave('post');
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	public static function get_instance() {
91 91
 
92 92
 		// If the single instance hasn't been set, set it now.
93
-		if ( null == self::$instance ) {
93
+		if (null == self::$instance) {
94 94
 			self::$instance = new self;
95 95
 		}
96 96
 
@@ -107,18 +107,18 @@  discard block
 block discarded – undo
107 107
 	 *                                       WPMU is disabled or plugin is
108 108
 	 *                                       activated on an individual blog.
109 109
 	 */
110
-	public static function activate( $network_wide ) {
110
+	public static function activate($network_wide) {
111 111
 
112
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
112
+		if (function_exists('is_multisite') && is_multisite()) {
113 113
 
114
-			if ( $network_wide  ) {
114
+			if ($network_wide) {
115 115
 
116 116
 				// Get all blog ids
117 117
 				$blog_ids = self::get_blog_ids();
118 118
 
119
-				foreach ( $blog_ids as $blog_id ) {
119
+				foreach ($blog_ids as $blog_id) {
120 120
 
121
-					switch_to_blog( $blog_id );
121
+					switch_to_blog($blog_id);
122 122
 					self::single_activate();
123 123
 				}
124 124
 
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
 	 *                                       WPMU is disabled or plugin is
145 145
 	 *                                       deactivated on an individual blog.
146 146
 	 */
147
-	public static function deactivate( $network_wide ) {
147
+	public static function deactivate($network_wide) {
148 148
 
149
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
149
+		if (function_exists('is_multisite') && is_multisite()) {
150 150
 
151
-			if ( $network_wide ) {
151
+			if ($network_wide) {
152 152
 
153 153
 				// Get all blog ids
154 154
 				$blog_ids = self::get_blog_ids();
155 155
 
156
-				foreach ( $blog_ids as $blog_id ) {
156
+				foreach ($blog_ids as $blog_id) {
157 157
 
158
-					switch_to_blog( $blog_id );
158
+					switch_to_blog($blog_id);
159 159
 					self::single_deactivate();
160 160
 
161 161
 				}
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @param int     $blog_id ID of the new blog.
181 181
 	 */
182
-	public function activate_new_site( $blog_id ) {
182
+	public function activate_new_site($blog_id) {
183 183
 
184
-		if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
184
+		if (1 !== did_action('wpmu_new_blog')) {
185 185
 			return;
186 186
 		}
187 187
 
188
-		switch_to_blog( $blog_id );
188
+		switch_to_blog($blog_id);
189 189
 		self::single_activate();
190 190
 		restore_current_blog();
191 191
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			WHERE archived = '0' AND spam = '0'
211 211
 			AND deleted = '0'";
212 212
 
213
-		return $wpdb->get_col( $sql );
213
+		return $wpdb->get_col($sql);
214 214
 
215 215
 	}
216 216
 
@@ -221,18 +221,18 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	private static function single_activate() {
223 223
 
224
-		$curr_version = get_option( 'lasso_version' );
224
+		$curr_version = get_option('lasso_version');
225 225
 
226 226
 		// update upgraded from
227
-		if ( $curr_version ) {
228
-			update_option( 'lasso_updated_from', $curr_version );
227
+		if ($curr_version) {
228
+			update_option('lasso_updated_from', $curr_version);
229 229
 		}
230 230
 
231 231
 		// update lasso version option
232
-		update_option( 'lasso_version', LASSO_VERSION );
232
+		update_option('lasso_version', LASSO_VERSION);
233 233
 
234 234
 		// set transietn for activation welcome
235
-		set_transient( '_lasso_welcome_redirect', true, 30 );
235
+		set_transient('_lasso_welcome_redirect', true, 30);
236 236
 
237 237
 
238 238
 	}
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
 	public function load_plugin_textdomain() {
255 255
 
256 256
 		$domain = $this->plugin_slug;
257
-		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
257
+		$locale = apply_filters('plugin_locale', get_locale(), $domain);
258 258
 
259
-		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
259
+		$out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo');
260 260
 	}
261 261
 	
262 262
     // new ajax function to lock post for editing
263 263
 	public function editus_lock_post()
264 264
 	{
265
-		$post_id= $_POST["postid"];
265
+		$post_id = $_POST["postid"];
266 266
 		$locked = wp_check_post_lock($post_id);
267 267
 		
268 268
 		if (!$locked) {
@@ -270,18 +270,18 @@  discard block
 block discarded – undo
270 270
 			echo "true";
271 271
 		} else {
272 272
 			$user_info = get_userdata($locked);
273
-			echo "Post opened by ".$user_info->first_name .  " " . $user_info->last_name;
273
+			echo "Post opened by ".$user_info->first_name." ".$user_info->last_name;
274 274
 		}
275 275
 		exit;
276 276
 	}
277 277
 	
278 278
 	public static function enable_metasave($type)
279 279
 	{
280
-		register_rest_field( $type, 'metadata', array(
281
-			'get_callback' => function ( $data ) {
282
-				return get_post_meta( $data['id']);//, '', '' );
280
+		register_rest_field($type, 'metadata', array(
281
+			'get_callback' => function($data) {
282
+				return get_post_meta($data['id']); //, '', '' );
283 283
 			}, 
284
-			'update_callback' => function( $data, $post ) {
284
+			'update_callback' => function($data, $post) {
285 285
 				foreach ($data as $key => $value) {
286 286
 					update_post_meta($post->ID, $key, $value);
287 287
 				}
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 	public function editus_do_shortcode()
294 294
 	{
295 295
 		
296
-		$code= $_POST["code"];
296
+		$code = $_POST["code"];
297 297
 		file_put_contents(WP_PLUGIN_DIR."/file10.txt", $code);
298
-		$out = lasso_wrap_shortcodes( $code);
298
+		$out = lasso_wrap_shortcodes($code);
299 299
 		echo do_shortcode($out);
300 300
 		exit;
301 301
 	}
@@ -304,61 +304,61 @@  discard block
 block discarded – undo
304 304
 	{
305 305
 		
306 306
 		
307
-		$code= $_POST["code"];
307
+		$code = $_POST["code"];
308 308
 		$atts = array(
309 309
 		 );
310 310
 		foreach ($_POST as $key => $value) {
311
-			if ($key !="code" && $key !="action") {
311
+			if ($key != "code" && $key != "action") {
312 312
 			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
313 313
 				$atts[$key] = $value;
314 314
 			}
315 315
 		}
316 316
 		if ($code == "aesop_video") {
317
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
317
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
318 318
 		    echo aesop_video_shortcode($atts);
319 319
 		}
320 320
 		
321 321
 		if ($code == "aesop_image") {
322
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
322
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
323 323
 		    echo aesop_image_shortcode($atts);
324 324
 		}
325 325
 		if ($code == "aesop_quote") {
326
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
326
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
327 327
 		    echo aesop_quote_shortcode($atts);
328 328
 		}
329 329
 		
330 330
 		if ($code == "aesop_parallax") {
331
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
331
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
332 332
 		    echo aesop_parallax_shortcode($atts);
333 333
 		}
334 334
 		
335 335
 		if ($code == "aesop_character") {
336
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
336
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
337 337
 		    echo aesop_character_shortcode($atts);
338 338
 		}
339 339
 		
340 340
 		if ($code == "aesop_collection") {
341
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
341
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
342 342
 		    echo aesop_collection_shortcode($atts);
343 343
 		}
344 344
 		
345 345
 		if ($code == "aesop_chapter") {
346
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
346
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
347 347
 		    echo aesop_chapter_shortcode($atts);
348 348
 		}
349 349
 		
350 350
 		if ($code == "aesop_content") {
351
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
351
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
352 352
 		    echo aesop_content_shortcode($atts, $atts['content_data']);
353 353
 		}
354 354
 		
355 355
 		if ($code == "aesop_gallery") {
356
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
357
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
356
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
357
+		    echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]');
358 358
 		}
359 359
 		
360 360
 		if ($code == "aesop_audio") {
361
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
361
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
362 362
 		    echo aesop_audio_shortcode($atts);
363 363
 		}
364 364
 		
Please login to merge, or discard this patch.