@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @since 0.0.1 |
| 78 | 78 | * |
| 79 | - * @return Plugin slug variable. |
|
| 79 | + * @return string slug variable. |
|
| 80 | 80 | */ |
| 81 | 81 | public function get_plugin_slug() { |
| 82 | 82 | return $this->plugin_slug; |
@@ -330,6 +330,9 @@ discard block |
||
| 330 | 330 | exit; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | + /** |
|
| 334 | + * @param string $type |
|
| 335 | + */ |
|
| 333 | 336 | public static function enable_metasave($type) |
| 334 | 337 | { |
| 335 | 338 | register_rest_field( $type, 'metadata', array( |
@@ -422,6 +425,10 @@ discard block |
||
| 422 | 425 | |
| 423 | 426 | exit; |
| 424 | 427 | } |
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * @param string $taxonomy |
|
| 431 | + */ |
|
| 425 | 432 | public function set_post_terms( $postid, $value, $taxonomy ) { |
| 426 | 433 | if( $value ) { |
| 427 | 434 | $value = explode( ',', $value ); |
@@ -261,14 +261,14 @@ discard block |
||
| 261 | 261 | $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - // new ajax function to lock post for editing |
|
| 264 | + // new ajax function to lock post for editing |
|
| 265 | 265 | public function editus_lock_post() |
| 266 | 266 | { |
| 267 | 267 | $post_id= $_POST["postid"]; |
| 268 | 268 | $locked = wp_check_post_lock($post_id); |
| 269 | 269 | |
| 270 | 270 | if (!$locked) { |
| 271 | - wp_set_post_lock($post_id); |
|
| 271 | + wp_set_post_lock($post_id); |
|
| 272 | 272 | echo "true"; |
| 273 | 273 | } else { |
| 274 | 274 | $user_info = get_userdata($locked); |
@@ -365,59 +365,59 @@ discard block |
||
| 365 | 365 | ); |
| 366 | 366 | foreach ($_POST as $key => $value) { |
| 367 | 367 | if ($key !="code" && $key !="action") { |
| 368 | - //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
| 368 | + //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
| 369 | 369 | $atts[$key] = $value; |
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | if ($code == "aesop_video") { |
| 373 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 374 | - echo aesop_video_shortcode($atts); |
|
| 373 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 374 | + echo aesop_video_shortcode($atts); |
|
| 375 | 375 | } |
| 376 | 376 | else if ($code == "aesop_image") { |
| 377 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 378 | - echo aesop_image_shortcode($atts); |
|
| 377 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 378 | + echo aesop_image_shortcode($atts); |
|
| 379 | 379 | } |
| 380 | 380 | else if ($code == "aesop_quote") { |
| 381 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 382 | - echo aesop_quote_shortcode($atts); |
|
| 381 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 382 | + echo aesop_quote_shortcode($atts); |
|
| 383 | 383 | } |
| 384 | 384 | else if ($code == "aesop_parallax") { |
| 385 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 386 | - echo aesop_parallax_shortcode($atts); |
|
| 385 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 386 | + echo aesop_parallax_shortcode($atts); |
|
| 387 | 387 | } |
| 388 | 388 | else if ($code == "aesop_character") { |
| 389 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 390 | - echo aesop_character_shortcode($atts); |
|
| 389 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 390 | + echo aesop_character_shortcode($atts); |
|
| 391 | 391 | } |
| 392 | 392 | else if ($code == "aesop_collection") { |
| 393 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 394 | - echo aesop_collection_shortcode($atts); |
|
| 393 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 394 | + echo aesop_collection_shortcode($atts); |
|
| 395 | 395 | } |
| 396 | 396 | else if ($code == "aesop_chapter") { |
| 397 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 398 | - echo aesop_chapter_shortcode($atts); |
|
| 397 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 398 | + echo aesop_chapter_shortcode($atts); |
|
| 399 | 399 | } |
| 400 | 400 | else if ($code == "aesop_content") { |
| 401 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 402 | - echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 401 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 402 | + echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 403 | 403 | } |
| 404 | 404 | else if ($code == "aesop_gallery") { |
| 405 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 406 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 405 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 406 | + echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 407 | 407 | } |
| 408 | 408 | else if ($code == "aesop_audio") { |
| 409 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 410 | - echo aesop_audio_shortcode($atts); |
|
| 409 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 410 | + echo aesop_audio_shortcode($atts); |
|
| 411 | 411 | } |
| 412 | 412 | else { |
| 413 | 413 | $code = '['.$code.' '; |
| 414 | 414 | foreach ($atts as $key => $value) { |
| 415 | - $code = ''.$key.'="'.$value.'" '; |
|
| 415 | + $code = ''.$key.'="'.$value.'" '; |
|
| 416 | 416 | } |
| 417 | 417 | $code = $code.']'; |
| 418 | 418 | echo do_shortcode($code); |
| 419 | - //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php'); |
|
| 420 | - //echo aesop_audio_shortcode($atts); |
|
| 419 | + //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php'); |
|
| 420 | + //echo aesop_audio_shortcode($atts); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | exit; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $value = explode( ',', $value ); |
| 428 | 428 | |
| 429 | 429 | if ($taxonomy =='category') { |
| 430 | - // convert from names to category ids |
|
| 430 | + // convert from names to category ids |
|
| 431 | 431 | $cats = array(); |
| 432 | 432 | foreach ($value as $cat) { |
| 433 | 433 | $cats [] = get_cat_ID($cat); |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | public function set_date( $postid, $value) { |
| 453 | 453 | if( $value ) { |
| 454 | - wp_update_post( |
|
| 454 | + wp_update_post( |
|
| 455 | 455 | array ( |
| 456 | 456 | 'ID' => $postid, // ID of the post to update |
| 457 | 457 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
@@ -52,16 +52,16 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,32 +311,32 @@ discard block |
||
| 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; |
|
| 318 | - self::set_post_terms( $postid, $cats, 'category' ); |
|
| 317 | + $cats = isset($data['story_cats']) ? $data['story_cats'] : false; |
|
| 318 | + self::set_post_terms($postid, $cats, 'category'); |
|
| 319 | 319 | |
| 320 | 320 | // update tags |
| 321 | - $tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false; |
|
| 322 | - self::set_post_terms( $postid, $tags, 'post_tag' ); |
|
| 321 | + $tags = isset($data['story_tags']) ? $data['story_tags'] : false; |
|
| 322 | + self::set_post_terms($postid, $tags, 'post_tag'); |
|
| 323 | 323 | |
| 324 | 324 | //update date |
| 325 | - $date = isset( $data['post_date'] ) ? $data['post_date'] : false; |
|
| 326 | - self::set_date( $postid, $date ); |
|
| 325 | + $date = isset($data['post_date']) ? $data['post_date'] : false; |
|
| 326 | + self::set_date($postid, $date); |
|
| 327 | 327 | |
| 328 | - do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() ); |
|
| 328 | + do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID()); |
|
| 329 | 329 | wp_send_json_success(); |
| 330 | 330 | exit; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | public static function enable_metasave($type) |
| 334 | 334 | { |
| 335 | - register_rest_field( $type, 'metadata', array( |
|
| 336 | - 'get_callback' => function ( $data ) { |
|
| 337 | - return get_post_meta( $data['id']);//, '', '' ); |
|
| 335 | + register_rest_field($type, 'metadata', array( |
|
| 336 | + 'get_callback' => function($data) { |
|
| 337 | + return get_post_meta($data['id']); //, '', '' ); |
|
| 338 | 338 | }, |
| 339 | - 'update_callback' => function( $data, $post ) { |
|
| 339 | + 'update_callback' => function($data, $post) { |
|
| 340 | 340 | foreach ($data as $key => $value) { |
| 341 | 341 | update_post_meta($post->ID, $key, $value); |
| 342 | 342 | } |
@@ -348,10 +348,10 @@ discard block |
||
| 348 | 348 | public function editus_do_shortcode() |
| 349 | 349 | { |
| 350 | 350 | |
| 351 | - $code= $_POST["code"]; |
|
| 351 | + $code = $_POST["code"]; |
|
| 352 | 352 | $code = str_replace('\"', '"', $code); |
| 353 | - $out = lasso_wrap_shortcodes( $code); |
|
| 354 | - $out = do_shortcode($out); |
|
| 353 | + $out = lasso_wrap_shortcodes($code); |
|
| 354 | + $out = do_shortcode($out); |
|
| 355 | 355 | echo $out; |
| 356 | 356 | exit; |
| 357 | 357 | } |
@@ -360,53 +360,53 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | |
| 362 | 362 | |
| 363 | - $code= $_POST["code"]; |
|
| 363 | + $code = $_POST["code"]; |
|
| 364 | 364 | $atts = array( |
| 365 | 365 | ); |
| 366 | 366 | foreach ($_POST as $key => $value) { |
| 367 | - if ($key !="code" && $key !="action") { |
|
| 367 | + if ($key != "code" && $key != "action") { |
|
| 368 | 368 | //$shortcode = $shortcode.$key.'="'.$value.'" '; |
| 369 | 369 | $atts[$key] = $value; |
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | if ($code == "aesop_video") { |
| 373 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 373 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 374 | 374 | echo aesop_video_shortcode($atts); |
| 375 | 375 | } |
| 376 | 376 | else if ($code == "aesop_image") { |
| 377 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 377 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 378 | 378 | echo aesop_image_shortcode($atts); |
| 379 | 379 | } |
| 380 | 380 | else if ($code == "aesop_quote") { |
| 381 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 381 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 382 | 382 | echo aesop_quote_shortcode($atts); |
| 383 | 383 | } |
| 384 | 384 | else if ($code == "aesop_parallax") { |
| 385 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 385 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 386 | 386 | echo aesop_parallax_shortcode($atts); |
| 387 | 387 | } |
| 388 | 388 | else if ($code == "aesop_character") { |
| 389 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 389 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 390 | 390 | echo aesop_character_shortcode($atts); |
| 391 | 391 | } |
| 392 | 392 | else if ($code == "aesop_collection") { |
| 393 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 393 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 394 | 394 | echo aesop_collection_shortcode($atts); |
| 395 | 395 | } |
| 396 | 396 | else if ($code == "aesop_chapter") { |
| 397 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 397 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 398 | 398 | echo aesop_chapter_shortcode($atts); |
| 399 | 399 | } |
| 400 | 400 | else if ($code == "aesop_content") { |
| 401 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 401 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 402 | 402 | echo aesop_content_shortcode($atts, $atts['content_data']); |
| 403 | 403 | } |
| 404 | 404 | else if ($code == "aesop_gallery") { |
| 405 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 406 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 405 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 406 | + echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 407 | 407 | } |
| 408 | 408 | else if ($code == "aesop_audio") { |
| 409 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 409 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 410 | 410 | echo aesop_audio_shortcode($atts); |
| 411 | 411 | } |
| 412 | 412 | else { |
@@ -422,11 +422,11 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | exit; |
| 424 | 424 | } |
| 425 | - public function set_post_terms( $postid, $value, $taxonomy ) { |
|
| 426 | - if( $value ) { |
|
| 427 | - $value = explode( ',', $value ); |
|
| 425 | + public function set_post_terms($postid, $value, $taxonomy) { |
|
| 426 | + if ($value) { |
|
| 427 | + $value = explode(',', $value); |
|
| 428 | 428 | |
| 429 | - if ($taxonomy =='category') { |
|
| 429 | + if ($taxonomy == 'category') { |
|
| 430 | 430 | // convert from names to category ids |
| 431 | 431 | $cats = array(); |
| 432 | 432 | foreach ($value as $cat) { |
@@ -435,27 +435,27 @@ discard block |
||
| 435 | 435 | $value = $cats; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
|
| 438 | + $result = wp_set_object_terms($postid, $value, $taxonomy); |
|
| 439 | 439 | } |
| 440 | - else { |
|
| 440 | + else { |
|
| 441 | 441 | //remove all terms from post |
| 442 | - $result = wp_set_object_terms( $postid, null, $taxonomy ); |
|
| 442 | + $result = wp_set_object_terms($postid, null, $taxonomy); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if ( ! is_wp_error( $result ) ) { |
|
| 445 | + if (!is_wp_error($result)) { |
|
| 446 | 446 | return true; |
| 447 | - }else{ |
|
| 447 | + } else { |
|
| 448 | 448 | return false; |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - public function set_date( $postid, $value) { |
|
| 453 | - if( $value ) { |
|
| 452 | + public function set_date($postid, $value) { |
|
| 453 | + if ($value) { |
|
| 454 | 454 | wp_update_post( |
| 455 | - array ( |
|
| 455 | + array( |
|
| 456 | 456 | 'ID' => $postid, // ID of the post to update |
| 457 | - 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
|
| 458 | - 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime($value) ), |
|
| 457 | + 'post_date' => date('Y-m-d H:i:s', strtotime($value)), |
|
| 458 | + 'post_date_gmt' => gmdate('Y-m-d H:i:s', strtotime($value)), |
|
| 459 | 459 | ) |
| 460 | 460 | ); |
| 461 | 461 | } |
@@ -372,44 +372,34 @@ discard block |
||
| 372 | 372 | if ($code == "aesop_video") { |
| 373 | 373 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
| 374 | 374 | echo aesop_video_shortcode($atts); |
| 375 | - } |
|
| 376 | - else if ($code == "aesop_image") { |
|
| 375 | + } else if ($code == "aesop_image") { |
|
| 377 | 376 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
| 378 | 377 | echo aesop_image_shortcode($atts); |
| 379 | - } |
|
| 380 | - else if ($code == "aesop_quote") { |
|
| 378 | + } else if ($code == "aesop_quote") { |
|
| 381 | 379 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
| 382 | 380 | echo aesop_quote_shortcode($atts); |
| 383 | - } |
|
| 384 | - else if ($code == "aesop_parallax") { |
|
| 381 | + } else if ($code == "aesop_parallax") { |
|
| 385 | 382 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
| 386 | 383 | echo aesop_parallax_shortcode($atts); |
| 387 | - } |
|
| 388 | - else if ($code == "aesop_character") { |
|
| 384 | + } else if ($code == "aesop_character") { |
|
| 389 | 385 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
| 390 | 386 | echo aesop_character_shortcode($atts); |
| 391 | - } |
|
| 392 | - else if ($code == "aesop_collection") { |
|
| 387 | + } else if ($code == "aesop_collection") { |
|
| 393 | 388 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
| 394 | 389 | echo aesop_collection_shortcode($atts); |
| 395 | - } |
|
| 396 | - else if ($code == "aesop_chapter") { |
|
| 390 | + } else if ($code == "aesop_chapter") { |
|
| 397 | 391 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
| 398 | 392 | echo aesop_chapter_shortcode($atts); |
| 399 | - } |
|
| 400 | - else if ($code == "aesop_content") { |
|
| 393 | + } else if ($code == "aesop_content") { |
|
| 401 | 394 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
| 402 | 395 | echo aesop_content_shortcode($atts, $atts['content_data']); |
| 403 | - } |
|
| 404 | - else if ($code == "aesop_gallery") { |
|
| 396 | + } else if ($code == "aesop_gallery") { |
|
| 405 | 397 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
| 406 | 398 | echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
| 407 | - } |
|
| 408 | - else if ($code == "aesop_audio") { |
|
| 399 | + } else if ($code == "aesop_audio") { |
|
| 409 | 400 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
| 410 | 401 | echo aesop_audio_shortcode($atts); |
| 411 | - } |
|
| 412 | - else { |
|
| 402 | + } else { |
|
| 413 | 403 | $code = '['.$code.' '; |
| 414 | 404 | foreach ($atts as $key => $value) { |
| 415 | 405 | $code = ''.$key.'="'.$value.'" '; |
@@ -436,15 +426,14 @@ discard block |
||
| 436 | 426 | } |
| 437 | 427 | |
| 438 | 428 | $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
| 439 | - } |
|
| 440 | - else { |
|
| 429 | + } else { |
|
| 441 | 430 | //remove all terms from post |
| 442 | 431 | $result = wp_set_object_terms( $postid, null, $taxonomy ); |
| 443 | 432 | } |
| 444 | 433 | |
| 445 | 434 | if ( ! is_wp_error( $result ) ) { |
| 446 | 435 | return true; |
| 447 | - }else{ |
|
| 436 | + } else{ |
|
| 448 | 437 | return false; |
| 449 | 438 | } |
| 450 | 439 | } |