Completed
Push — master ( 667657...1db918 )
by
unknown
02:33
created
public/includes/option-engine.php 1 patch
Spacing   +45 added lines, -45 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--post-form" class="lasso--post-form">' );
128
+	$out = sprintf('<form id="lasso--post-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,31 +192,31 @@  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
-		switch ( $type ) {
208
+		switch ($type) {
209 209
 			case 'text':
210
-				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'text' ), $after );
210
+				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'text'), $after);
211 211
 				break;
212 212
 			case 'textarea':
213
-				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'textarea' ), $after );
213
+				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'textarea'), $after);
214 214
 				break;
215 215
 			case 'imgurl':
216
-				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'imgurl' ), $after );
216
+				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'imgurl'), $after);
217 217
 				break;
218 218
 			case 'checkbox':
219
-				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'checkbox' ), $after );
219
+				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'checkbox'), $after);
220 220
 				break;
221 221
 		}
222 222
 
@@ -236,30 +236,30 @@  discard block
 block discarded – undo
236 236
 *	@param $type string text, textarea, checkbox, color
237 237
 *	@since 5.0
238 238
 */
239
-function lasso_option_engine_option( $name = '', $option = '', $type = '') {
239
+function lasso_option_engine_option($name = '', $option = '', $type = '') {
240 240
 
241
-	if ( empty( $type ) || empty( $option ) )
241
+	if (empty($type) || empty($option))
242 242
 		return;
243 243
 
244
-	$id = isset( $option['id'] ) ? $option['id'] : false;
245
-	$id = $id ? lasso_clean_string( $id ) : false;
244
+	$id = isset($option['id']) ? $option['id'] : false;
245
+	$id = $id ? lasso_clean_string($id) : false;
246 246
 
247
-	$desc = isset( $option['desc'] ) ? $option['desc'] : false;
247
+	$desc = isset($option['desc']) ? $option['desc'] : false;
248 248
 
249
-	$value = get_post_meta( get_the_id(), $option[ 'id' ], true );
249
+	$value = get_post_meta(get_the_id(), $option['id'], true);
250 250
 
251
-	switch ( $type ) {
251
+	switch ($type) {
252 252
 		case 'text':
253
-			$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 );
253
+			$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);
254 254
 			break;
255 255
 		case 'textarea':
256
-			$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 );
256
+			$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);
257 257
 			break;
258 258
 		case 'imgurl':
259
-			$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 );
259
+			$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);
260 260
 			break;
261 261
 		case 'checkbox':
262
-			$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 ) );
262
+			$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));
263 263
 			break;
264 264
 	}
265 265
 
Please login to merge, or discard this patch.
public/includes/lasso.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -52,16 +52,16 @@  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_hide_tour',     array( $this, 'editus_hide_tour' ) );
64
-		add_action( 'wp_ajax_editus_set_post_setting',     array( $this, 'editus_set_post_setting' ) );
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_hide_tour', array($this, 'editus_hide_tour'));
64
+		add_action('wp_ajax_editus_set_post_setting', array($this, 'editus_set_post_setting'));
65 65
 
66 66
 		// enable saving custom fields through REST API
67 67
 		self::enable_metasave('post');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	public static function get_instance() {
93 93
 
94 94
 		// If the single instance hasn't been set, set it now.
95
-		if ( null == self::$instance ) {
95
+		if (null == self::$instance) {
96 96
 			self::$instance = new self;
97 97
 		}
98 98
 
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 	 *                                       WPMU is disabled or plugin is
110 110
 	 *                                       activated on an individual blog.
111 111
 	 */
112
-	public static function activate( $network_wide ) {
112
+	public static function activate($network_wide) {
113 113
 
114
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
114
+		if (function_exists('is_multisite') && is_multisite()) {
115 115
 
116
-			if ( $network_wide  ) {
116
+			if ($network_wide) {
117 117
 
118 118
 				// Get all blog ids
119 119
 				$blog_ids = self::get_blog_ids();
120 120
 
121
-				foreach ( $blog_ids as $blog_id ) {
121
+				foreach ($blog_ids as $blog_id) {
122 122
 
123
-					switch_to_blog( $blog_id );
123
+					switch_to_blog($blog_id);
124 124
 					self::single_activate();
125 125
 				}
126 126
 
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 	 *                                       WPMU is disabled or plugin is
147 147
 	 *                                       deactivated on an individual blog.
148 148
 	 */
149
-	public static function deactivate( $network_wide ) {
149
+	public static function deactivate($network_wide) {
150 150
 
151
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
151
+		if (function_exists('is_multisite') && is_multisite()) {
152 152
 
153
-			if ( $network_wide ) {
153
+			if ($network_wide) {
154 154
 
155 155
 				// Get all blog ids
156 156
 				$blog_ids = self::get_blog_ids();
157 157
 
158
-				foreach ( $blog_ids as $blog_id ) {
158
+				foreach ($blog_ids as $blog_id) {
159 159
 
160
-					switch_to_blog( $blog_id );
160
+					switch_to_blog($blog_id);
161 161
 					self::single_deactivate();
162 162
 
163 163
 				}
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @param int     $blog_id ID of the new blog.
183 183
 	 */
184
-	public function activate_new_site( $blog_id ) {
184
+	public function activate_new_site($blog_id) {
185 185
 
186
-		if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
186
+		if (1 !== did_action('wpmu_new_blog')) {
187 187
 			return;
188 188
 		}
189 189
 
190
-		switch_to_blog( $blog_id );
190
+		switch_to_blog($blog_id);
191 191
 		self::single_activate();
192 192
 		restore_current_blog();
193 193
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 			WHERE archived = '0' AND spam = '0'
213 213
 			AND deleted = '0'";
214 214
 
215
-		return $wpdb->get_col( $sql );
215
+		return $wpdb->get_col($sql);
216 216
 
217 217
 	}
218 218
 
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	private static function single_activate() {
225 225
 
226
-		$curr_version = get_option( 'lasso_version' );
226
+		$curr_version = get_option('lasso_version');
227 227
 
228 228
 		// update upgraded from
229
-		if ( $curr_version ) {
230
-			update_option( 'lasso_updated_from', $curr_version );
229
+		if ($curr_version) {
230
+			update_option('lasso_updated_from', $curr_version);
231 231
 		}
232 232
 
233 233
 		// update lasso version option
234
-		update_option( 'lasso_version', LASSO_VERSION );
234
+		update_option('lasso_version', LASSO_VERSION);
235 235
 
236 236
 		// set transietn for activation welcome
237
-		set_transient( '_lasso_welcome_redirect', true, 30 );
237
+		set_transient('_lasso_welcome_redirect', true, 30);
238 238
 
239 239
 
240 240
 	}
@@ -256,15 +256,15 @@  discard block
 block discarded – undo
256 256
 	public function load_plugin_textdomain() {
257 257
 
258 258
 		$domain = $this->plugin_slug;
259
-		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
259
+		$locale = apply_filters('plugin_locale', get_locale(), $domain);
260 260
 
261
-		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
261
+		$out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo');
262 262
 	}
263 263
 	
264 264
     // new ajax function to lock post for editing
265 265
 	public function editus_lock_post()
266 266
 	{
267
-		$post_id= $_POST["postid"];
267
+		$post_id = $_POST["postid"];
268 268
 		$locked = wp_check_post_lock($post_id);
269 269
 		
270 270
 		if (!$locked) {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			echo "true";
273 273
 		} else {
274 274
 			$user_info = get_userdata($locked);
275
-			echo "Post opened by ".$user_info->first_name .  " " . $user_info->last_name;
275
+			echo "Post opened by ".$user_info->first_name." ".$user_info->last_name;
276 276
 		}
277 277
 		exit;
278 278
 	}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	{
283 283
 		$user_id = get_current_user_ID();
284 284
 				
285
-		update_user_meta( $user_id, 'lasso_hide_tour', true );
285
+		update_user_meta($user_id, 'lasso_hide_tour', true);
286 286
 		exit;
287 287
 	}
288 288
 	
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 		$data = array();
294 294
 		parse_str($_POST['data'], $data);
295 295
 		
296
-		if (!wp_verify_nonce( $data[ 'nonce' ], 'lasso-update-post-settings' )) {
296
+		if (!wp_verify_nonce($data['nonce'], 'lasso-update-post-settings')) {
297 297
 			wp_send_json_error();
298 298
 			exit;
299 299
 		}
300 300
 		
301
-		$status = isset( $data['status'] ) ? $data['status'] : false;
302
-		$postid = isset( $data['postid'] ) ? $data['postid'] : false;
303
-		$slug   = isset( $data['story_slug'] ) ? $data['story_slug'] : false;
301
+		$status = isset($data['status']) ? $data['status'] : false;
302
+		$postid = isset($data['postid']) ? $data['postid'] : false;
303
+		$slug   = isset($data['story_slug']) ? $data['story_slug'] : false;
304 304
 	
305 305
 
306 306
 		$args = array(
@@ -311,24 +311,24 @@  discard block
 block discarded – undo
311 311
 		
312 312
 		
313 313
 
314
-		wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) );
314
+		wp_update_post(apply_filters('lasso_object_status_update_args', $args));
315 315
 		
316 316
 		// update categories
317
-		$cats  = isset( $data['story_cats'] ) ? $data['story_cats'] : false;
317
+		$cats = isset($data['story_cats']) ? $data['story_cats'] : false;
318 318
 		
319
-		self::set_post_terms( $postid, $cats, 'category' );
319
+		self::set_post_terms($postid, $cats, 'category');
320 320
 		
321 321
 		// update tags
322
-		$tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false;
323
-		self::set_post_terms( $postid, $tags, 'post_tag' );
322
+		$tags = isset($data['story_tags']) ? $data['story_tags'] : false;
323
+		self::set_post_terms($postid, $tags, 'post_tag');
324 324
 		
325 325
 		//update date
326
-		$date  = isset( $data['post_date'] ) ? $data['post_date'] : false;
327
-		self::set_date( $postid, $date );
326
+		$date = isset($data['post_date']) ? $data['post_date'] : false;
327
+		self::set_date($postid, $date);
328 328
 		
329
-		do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() );
330
-		$response= array(
331
-			'link'   => get_permalink($postid). (($status=='publish') ? '' : '&preview=true')
329
+		do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID());
330
+		$response = array(
331
+			'link'   => get_permalink($postid).(($status == 'publish') ? '' : '&preview=true')
332 332
 		);
333 333
 		wp_send_json_success($response);
334 334
 		exit;
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 	
337 337
 	public static function enable_metasave($type)
338 338
 	{
339
-		register_rest_field( $type, 'metadata', array(
340
-			'get_callback' => function ( $data ) {
341
-				return get_post_meta( $data['id']);//, '', '' );
339
+		register_rest_field($type, 'metadata', array(
340
+			'get_callback' => function($data) {
341
+				return get_post_meta($data['id']); //, '', '' );
342 342
 			}, 
343
-			'update_callback' => function( $data, $post ) {
343
+			'update_callback' => function($data, $post) {
344 344
 				foreach ($data as $key => $value) {
345 345
 					update_post_meta($post->ID, $key, $value);
346 346
 				}
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
 	public function editus_do_shortcode()
353 353
 	{
354 354
 		
355
-		$code= $_POST["code"];
355
+		$code = $_POST["code"];
356 356
 		$code = str_replace('\"', '"', $code);
357 357
 		
358
-		$code_wrapped = lasso_wrap_shortcodes( $code);
359
-		$out =  do_shortcode($code);
358
+		$code_wrapped = lasso_wrap_shortcodes($code);
359
+		$out = do_shortcode($code);
360 360
 		if ($out != '') {
361
-			$out =  do_shortcode($code_wrapped);
361
+			$out = do_shortcode($code_wrapped);
362 362
 			echo $out;
363 363
 			exit;
364 364
 		}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		/** @var \WP_Embed $wp_embed */
369 369
 		global $wp_embed;
370 370
 		$wp_embed->post_ID = $_POST["ID"];
371
-		$out =$wp_embed->run_shortcode( $code_wrapped );
371
+		$out = $wp_embed->run_shortcode($code_wrapped);
372 372
 		
373 373
 		echo $out;
374 374
 		exit;
@@ -378,53 +378,53 @@  discard block
 block discarded – undo
378 378
 	{
379 379
 		
380 380
 		
381
-		$code= $_POST["code"];
381
+		$code = $_POST["code"];
382 382
 		$atts = array(
383 383
 		 );
384 384
 		foreach ($_POST as $key => $value) {
385
-			if ($key !="code" && $key !="action") {
385
+			if ($key != "code" && $key != "action") {
386 386
 			    //$shortcode = $shortcode.$key.'="'.$value.'" ';
387 387
 				$atts[$key] = $value;
388 388
 			}
389 389
 		}
390 390
 		if ($code == "aesop_video") {
391
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
391
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php');
392 392
 		    echo aesop_video_shortcode($atts);
393 393
 		}
394 394
 		else if ($code == "aesop_image") {
395
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
395
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php');
396 396
 		    echo aesop_image_shortcode($atts);
397 397
 		}
398 398
 		else if ($code == "aesop_quote") {
399
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
399
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php');
400 400
 		    echo aesop_quote_shortcode($atts);
401 401
 		}
402 402
 		else if ($code == "aesop_parallax") {
403
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
403
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php');
404 404
 		    echo aesop_parallax_shortcode($atts);
405 405
 		}
406 406
 		else if ($code == "aesop_character") {
407
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
407
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php');
408 408
 		    echo aesop_character_shortcode($atts);
409 409
 		}
410 410
 		else if ($code == "aesop_collection") {
411
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
411
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php');
412 412
 		    echo aesop_collection_shortcode($atts);
413 413
 		}
414 414
 		else if ($code == "aesop_chapter") {
415
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
415
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php');
416 416
 		    echo aesop_chapter_shortcode($atts);
417 417
 		}
418 418
 		else if ($code == "aesop_content") {
419
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
419
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php');
420 420
 		    echo aesop_content_shortcode($atts, $atts['content_data']);
421 421
 		}
422 422
 		else if ($code == "aesop_gallery") {
423
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
424
-		    echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]');
423
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php');
424
+		    echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]');
425 425
 		}
426 426
 		else if ($code == "aesop_audio") {
427
-		    require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
427
+		    require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php');
428 428
 		    echo aesop_audio_shortcode($atts);
429 429
 		}
430 430
 		else {
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
 		
441 441
 		exit; 
442 442
 	}
443
-	public function set_post_terms( $postid, $value, $taxonomy ) {
444
-		if( $value ) {
445
-			$value = explode( ',', $value );
446
-			$allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' );
443
+	public function set_post_terms($postid, $value, $taxonomy) {
444
+		if ($value) {
445
+			$value = explode(',', $value);
446
+			$allow_new_category = lasso_editor_get_option('allow_new_category', 'lasso_editor');
447 447
 			
448
-			if ($taxonomy =='category') {
448
+			if ($taxonomy == 'category') {
449 449
                 // convert from names to category ids
450 450
 				$cats = array();
451 451
 				foreach ($value as $cat) {
452 452
 					$cat_id = get_cat_ID($cat);
453
-					if ($cat_id !=0) {
453
+					if ($cat_id != 0) {
454 454
 						$cats [] = $cat_id;
455 455
 					} else if ($allow_new_category) {
456 456
 					    $cats [] = wp_create_category($cat);
@@ -459,27 +459,27 @@  discard block
 block discarded – undo
459 459
 				$value = $cats;
460 460
 			}
461 461
 	
462
-			$result = wp_set_object_terms( $postid, $value, $taxonomy );
462
+			$result = wp_set_object_terms($postid, $value, $taxonomy);
463 463
 		}
464
-		else  {
464
+		else {
465 465
 			//remove all terms from post
466
-			$result = wp_set_object_terms( $postid, null, $taxonomy );
466
+			$result = wp_set_object_terms($postid, null, $taxonomy);
467 467
 		}
468 468
 
469
-		if ( ! is_wp_error( $result ) ) {
469
+		if (!is_wp_error($result)) {
470 470
 			return true;
471
-		}else{
471
+		} else {
472 472
 			return false;
473 473
 		}
474 474
 	}
475 475
 	
476
-	public function set_date( $postid, $value) {
477
-		if( $value ) {
476
+	public function set_date($postid, $value) {
477
+		if ($value) {
478 478
             wp_update_post(
479
-				array (
479
+				array(
480 480
 					'ID'            => $postid, // ID of the post to update
481
-					'post_date'     => date( 'Y-m-d H:i:s',  strtotime($value) ),
482
-					'post_date_gmt'     => gmdate( 'Y-m-d H:i:s',  strtotime($value) ),
481
+					'post_date'     => date('Y-m-d H:i:s', strtotime($value)),
482
+					'post_date_gmt'     => gmdate('Y-m-d H:i:s', strtotime($value)),
483 483
 				)
484 484
 			);
485 485
 		}
Please login to merge, or discard this patch.