@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @since 0.9.3 |
| 135 | 135 | * |
| 136 | 136 | * @param int $postid The current postid |
| 137 | - * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
| 137 | + * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
| 138 | 138 | * @param string $taxonomy The name of the taxonomy to which the term belongs. |
| 139 | 139 | * |
| 140 | 140 | * @return bool True if update was successful, false if not. |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if ($taxonomy =='category') { |
| 150 | - // convert from names to category ids |
|
| 150 | + // convert from names to category ids |
|
| 151 | 151 | $cats = array(); |
| 152 | 152 | if (is_array($value)) { |
| 153 | 153 | foreach ($value as $cat) { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * |
| 181 | 181 | * @param int $postid The current postid |
| 182 | - * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
| 182 | + * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
| 183 | 183 | * The first item is the name of taxonomy |
| 184 | 184 | * |
| 185 | 185 | * @return bool True if update was successful, false if not. |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $value = explode( ',', $value ); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - // Deleting first array item |
|
| 195 | + // Deleting first array item |
|
| 196 | 196 | $taxonomy = array_shift($value); |
| 197 | 197 | $cats = array(); |
| 198 | 198 | foreach ($value as $cat) { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | if( $value ) { |
| 216 | 216 | $time = current_time('mysql'); |
| 217 | - wp_update_post( |
|
| 217 | + wp_update_post( |
|
| 218 | 218 | array ( |
| 219 | 219 | 'ID' => $postid, // ID of the post to update |
| 220 | 220 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | foreach ( $pages as $page ) { |
| 101 | 101 | wp_enqueue_media(); |
| 102 | - wp_enqueue_style( 'wp-color-picker'); |
|
| 103 | - wp_enqueue_script( 'wp-color-picker'); |
|
| 102 | + wp_enqueue_style( 'wp-color-picker'); |
|
| 103 | + wp_enqueue_script( 'wp-color-picker'); |
|
| 104 | 104 | |
| 105 | 105 | wp_enqueue_script( 'lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array( 'jquery','wp-color-picker' ), LASSO_VERSION, true ); |
| 106 | 106 | wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION ); |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | - * Adds an admin notice reminding the user if their license key has not been saved |
|
| 135 | - * |
|
| 136 | - * @since 0.9.7 |
|
| 137 | - * @todo make dismissible |
|
| 138 | - */ |
|
| 134 | + * Adds an admin notice reminding the user if their license key has not been saved |
|
| 135 | + * |
|
| 136 | + * @since 0.9.7 |
|
| 137 | + * @todo make dismissible |
|
| 138 | + */ |
|
| 139 | 139 | public function license_nag(){ |
| 140 | 140 | |
| 141 | 141 | $screen = get_current_screen(); |
@@ -156,26 +156,26 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | if ( empty( $license ) ) { |
| 158 | 158 | |
| 159 | - printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link ); |
|
| 159 | + printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link ); |
|
| 160 | 160 | |
| 161 | - } else if ( 'invalid' == $status ){ // license key entered wrong or something |
|
| 161 | + } else if ( 'invalid' == $status ){ // license key entered wrong or something |
|
| 162 | 162 | |
| 163 | 163 | printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link ); |
| 164 | 164 | |
| 165 | - } else if ( empty( $status ) ){ // license key saved but not activated |
|
| 165 | + } else if ( empty( $status ) ){ // license key saved but not activated |
|
| 166 | 166 | |
| 167 | 167 | printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link ); |
| 168 | 168 | |
| 169 | - } |
|
| 169 | + } |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | - * Process hiding the dimiss |
|
| 176 | - * |
|
| 177 | - * @since 0.9.7 |
|
| 178 | - */ |
|
| 175 | + * Process hiding the dimiss |
|
| 176 | + * |
|
| 177 | + * @since 0.9.7 |
|
| 178 | + */ |
|
| 179 | 179 | public function dismiss_nag() { |
| 180 | 180 | |
| 181 | 181 | if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | $allowed_fields = apply_filters( 'lasso_meta_fields', array() ); |
| 44 | 44 | |
| 45 | - file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true)); |
|
| 45 | + file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true)); |
|
| 46 | 46 | |
| 47 | 47 | if ( ! empty( $allowed_fields ) ) { |
| 48 | 48 | foreach( $allowed_fields as $field ) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - do_action( 'editus_after_meta_update', $post_id, $data ); |
|
| 57 | + do_action( 'editus_after_meta_update', $post_id, $data ); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | return true; |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // udpate start point |
| 48 | - $point = json_decode( $start_point, true ); |
|
| 48 | + $point = json_decode( $start_point, true ); |
|
| 49 | 49 | update_post_meta( $postid, 'ase_map_component_start_point', $point ); |
| 50 | 50 | |
| 51 | 51 | // update zoom |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | add_action( 'wp_ajax_get_aesop_component', array( $this, 'get_aesop_component' ) ); |
| 61 | 61 | add_action( 'wp_ajax_editus_do_shortcode', array( $this, 'editus_do_shortcode' ) ); |
| 62 | - add_action( 'wp_ajax_editus_do_block', array( $this, 'editus_do_block' ) ); |
|
| 62 | + add_action( 'wp_ajax_editus_do_block', array( $this, 'editus_do_block' ) ); |
|
| 63 | 63 | add_action( 'wp_ajax_editus_lock_post', array( $this, 'editus_lock_post' ) ); |
| 64 | 64 | add_action( 'wp_ajax_editus_unlock_post', array( $this, 'editus_unlock_post' ) ); |
| 65 | 65 | add_action( 'wp_ajax_editus_hide_tour', array( $this, 'editus_hide_tour' ) ); |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | add_action( 'wp_ajax_editus_featured_img', array( $this, 'set_featured_img' ) ); |
| 70 | 70 | add_action( 'wp_ajax_editus_del_featured_img', array( $this, 'del_featured_img' ) ); |
| 71 | 71 | |
| 72 | - add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
| 72 | + add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
| 73 | 73 | |
| 74 | - add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
| 75 | - add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
| 74 | + add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
| 75 | + add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
| 76 | 76 | |
| 77 | 77 | // enable saving custom fields through REST API |
| 78 | 78 | self::enable_metasave('post'); |
@@ -272,14 +272,14 @@ discard block |
||
| 272 | 272 | $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - // new ajax function to lock post for editing |
|
| 275 | + // new ajax function to lock post for editing |
|
| 276 | 276 | public function editus_lock_post() |
| 277 | 277 | { |
| 278 | 278 | $post_id= $_POST["postid"]; |
| 279 | 279 | $locked = wp_check_post_lock($post_id); |
| 280 | 280 | |
| 281 | 281 | if (!$locked) { |
| 282 | - wp_set_post_lock($post_id); |
|
| 282 | + wp_set_post_lock($post_id); |
|
| 283 | 283 | echo "true"; |
| 284 | 284 | } else { |
| 285 | 285 | $user_info = get_userdata($locked); |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | { |
| 293 | 293 | $post_id= $_POST["postid"]; |
| 294 | 294 | $locked = wp_check_post_lock($post_id); |
| 295 | - if (!$locked) { |
|
| 296 | - delete_post_meta( $post_id, '_edit_lock'); |
|
| 297 | - } |
|
| 295 | + if (!$locked) { |
|
| 296 | + delete_post_meta( $post_id, '_edit_lock'); |
|
| 297 | + } |
|
| 298 | 298 | echo "true"; |
| 299 | 299 | |
| 300 | 300 | exit; |
@@ -324,14 +324,14 @@ discard block |
||
| 324 | 324 | $status = isset( $data['status'] ) ? $data['status'] : false; |
| 325 | 325 | $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
| 326 | 326 | $slug = isset( $data['story_slug'] ) ? $data['story_slug'] : false; |
| 327 | - $excerpt = isset( $data['excerpt'] ) ? $data['excerpt'] : false; |
|
| 327 | + $excerpt = isset( $data['excerpt'] ) ? $data['excerpt'] : false; |
|
| 328 | 328 | |
| 329 | 329 | |
| 330 | 330 | $args = array( |
| 331 | 331 | 'ID' => (int) $postid, |
| 332 | 332 | 'post_name' => $slug, |
| 333 | 333 | 'post_status' => $status, |
| 334 | - 'post_excerpt' => $excerpt |
|
| 334 | + 'post_excerpt' => $excerpt |
|
| 335 | 335 | ); |
| 336 | 336 | |
| 337 | 337 | |
@@ -399,12 +399,12 @@ discard block |
||
| 399 | 399 | exit; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - public function editus_do_block() |
|
| 402 | + public function editus_do_block() |
|
| 403 | 403 | { |
| 404 | 404 | |
| 405 | 405 | $code= $_POST["code"]; |
| 406 | 406 | |
| 407 | - $out = do_blocks( $code ); |
|
| 407 | + $out = do_blocks( $code ); |
|
| 408 | 408 | |
| 409 | 409 | echo $out; |
| 410 | 410 | exit; |
@@ -423,60 +423,60 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | if ($code == "aesop_video") { |
| 426 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 427 | - echo aesop_video_shortcode($atts); |
|
| 426 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 427 | + echo aesop_video_shortcode($atts); |
|
| 428 | 428 | } |
| 429 | 429 | else if ($code == "aesop_image") { |
| 430 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 431 | - echo aesop_image_shortcode($atts); |
|
| 430 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 431 | + echo aesop_image_shortcode($atts); |
|
| 432 | 432 | } |
| 433 | 433 | else if ($code == "aesop_quote") { |
| 434 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 435 | - echo aesop_quote_shortcode($atts); |
|
| 434 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 435 | + echo aesop_quote_shortcode($atts); |
|
| 436 | 436 | } |
| 437 | 437 | else if ($code == "aesop_parallax") { |
| 438 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 439 | - echo aesop_parallax_shortcode($atts); |
|
| 438 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 439 | + echo aesop_parallax_shortcode($atts); |
|
| 440 | 440 | } |
| 441 | 441 | else if ($code == "aesop_character") { |
| 442 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 443 | - echo aesop_character_shortcode($atts); |
|
| 442 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 443 | + echo aesop_character_shortcode($atts); |
|
| 444 | 444 | } |
| 445 | 445 | else if ($code == "aesop_collection") { |
| 446 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 447 | - echo aesop_collection_shortcode($atts); |
|
| 446 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 447 | + echo aesop_collection_shortcode($atts); |
|
| 448 | 448 | } |
| 449 | 449 | else if ($code == "aesop_chapter") { |
| 450 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 451 | - echo aesop_chapter_shortcode($atts); |
|
| 450 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 451 | + echo aesop_chapter_shortcode($atts); |
|
| 452 | 452 | } |
| 453 | 453 | else if ($code == "aesop_content") { |
| 454 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 455 | - echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 454 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 455 | + echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 456 | 456 | } |
| 457 | 457 | else if ($code == "aesop_gallery") { |
| 458 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 459 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 458 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 459 | + echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 460 | 460 | } |
| 461 | 461 | else if ($code == "aesop_audio") { |
| 462 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 463 | - echo aesop_audio_shortcode($atts); |
|
| 462 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 463 | + echo aesop_audio_shortcode($atts); |
|
| 464 | 464 | } |
| 465 | 465 | else if ($code == "aesop_document") { |
| 466 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-document.php'); |
|
| 467 | - echo aesop_document_shortcode($atts); |
|
| 466 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-document.php'); |
|
| 467 | + echo aesop_document_shortcode($atts); |
|
| 468 | 468 | } |
| 469 | - /*else if ($code == "aesop_content") { |
|
| 469 | + /*else if ($code == "aesop_content") { |
|
| 470 | 470 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-content.php'); |
| 471 | 471 | echo aesop_content_shortcode($atts); |
| 472 | 472 | }*/ |
| 473 | - else if ($code == "aesop_wpimg") { |
|
| 474 | - self::wpimg($atts); |
|
| 473 | + else if ($code == "aesop_wpimg") { |
|
| 474 | + self::wpimg($atts); |
|
| 475 | 475 | } |
| 476 | 476 | else { |
| 477 | 477 | $code = '['.$code.' '; |
| 478 | 478 | foreach ($atts as $key => $value) { |
| 479 | - $code = ''.$key.'="'.$value.'" '; |
|
| 479 | + $code = ''.$key.'="'.$value.'" '; |
|
| 480 | 480 | } |
| 481 | 481 | $code = $code.']'; |
| 482 | 482 | echo do_shortcode($code); |
@@ -485,63 +485,63 @@ discard block |
||
| 485 | 485 | exit; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - public static function wpimg($atts) { |
|
| 488 | + public static function wpimg($atts) { |
|
| 489 | 489 | |
| 490 | - echo '<figure data-component-type="wpimg"'; |
|
| 490 | + echo '<figure data-component-type="wpimg"'; |
|
| 491 | 491 | |
| 492 | - $extra = ""; |
|
| 492 | + $extra = ""; |
|
| 493 | 493 | |
| 494 | - // try to use srcset and sizes on new WP installs |
|
| 494 | + // try to use srcset and sizes on new WP installs |
|
| 495 | 495 | if ( function_exists('wp_get_attachment_image_srcset') && $attachment_id = attachment_url_to_postid( $atts['img'] ) ) { |
| 496 | 496 | $srcset = wp_get_attachment_image_srcset( $attachment_id, 'full' ); |
| 497 | 497 | $sizes = wp_get_attachment_image_sizes( $attachment_id, 'full' ); |
| 498 | - $extra = "srcset='$srcset' sizes='$sizes' "; |
|
| 499 | - } |
|
| 500 | - if ($atts['align']=="left") { |
|
| 501 | - $extra .= 'class="alignleft'; |
|
| 502 | - } else if ($atts['align']=="right") { |
|
| 503 | - $extra .= 'class="alignright'; |
|
| 504 | - } else { |
|
| 505 | - $extra .= 'class="aligncenter'; |
|
| 506 | - } |
|
| 507 | - if ($atts['imgwidth'] || $atts['imgheight']) { |
|
| 508 | - if ($atts['imgwidth']) { |
|
| 509 | - $extra .= 'width:'. $atts['imgwidth'].';'; |
|
| 510 | - } |
|
| 511 | - if ($atts['imgheight']) { |
|
| 512 | - $extra .= 'height:'. $atts['imgheight'].';'; |
|
| 513 | - } |
|
| 498 | + $extra = "srcset='$srcset' sizes='$sizes' "; |
|
| 499 | + } |
|
| 500 | + if ($atts['align']=="left") { |
|
| 501 | + $extra .= 'class="alignleft'; |
|
| 502 | + } else if ($atts['align']=="right") { |
|
| 503 | + $extra .= 'class="alignright'; |
|
| 504 | + } else { |
|
| 505 | + $extra .= 'class="aligncenter'; |
|
| 506 | + } |
|
| 507 | + if ($atts['imgwidth'] || $atts['imgheight']) { |
|
| 508 | + if ($atts['imgwidth']) { |
|
| 509 | + $extra .= 'width:'. $atts['imgwidth'].';'; |
|
| 510 | + } |
|
| 511 | + if ($atts['imgheight']) { |
|
| 512 | + $extra .= 'height:'. $atts['imgheight'].';'; |
|
| 513 | + } |
|
| 514 | 514 | |
| 515 | - } |
|
| 516 | - $extra .= '"'; |
|
| 515 | + } |
|
| 516 | + $extra .= '"'; |
|
| 517 | 517 | |
| 518 | - foreach ($atts as $key => $value) { |
|
| 518 | + foreach ($atts as $key => $value) { |
|
| 519 | 519 | echo ' data-'.$key.'="'.$value.'"'; |
| 520 | 520 | } |
| 521 | - //echo ' class="wp-image- lasso--wpimg__wrap lasso-component">'; |
|
| 522 | - echo ' class="wp-caption lasso-component">'; |
|
| 523 | - $hrefset = false; |
|
| 524 | - if ($atts['link'] != '' && (!isset($atts['linkoption']) || $atts['linkoption']=="url" )) |
|
| 525 | - { |
|
| 526 | - echo '<a href="' . $atts['link'] . '">'; |
|
| 527 | - $hrefset = true; |
|
| 528 | - } else if (isset($atts['linkoption']) && $atts['linkoption'] == 'img' ) { |
|
| 529 | - echo '<a href="' . $atts['img'] . '">'; |
|
| 530 | - $hrefset = true; |
|
| 531 | - } |
|
| 532 | - echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '" '. $extra. '>'; |
|
| 533 | - if ($hrefset) |
|
| 534 | - { |
|
| 535 | - echo '</a>'; |
|
| 536 | - } |
|
| 537 | - if ($atts['caption']) |
|
| 538 | - { |
|
| 539 | - echo '<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption>'; |
|
| 540 | - } |
|
| 541 | - echo '</figure>'; |
|
| 542 | - echo '<p> </p>'; |
|
| 543 | - return; |
|
| 544 | - } |
|
| 521 | + //echo ' class="wp-image- lasso--wpimg__wrap lasso-component">'; |
|
| 522 | + echo ' class="wp-caption lasso-component">'; |
|
| 523 | + $hrefset = false; |
|
| 524 | + if ($atts['link'] != '' && (!isset($atts['linkoption']) || $atts['linkoption']=="url" )) |
|
| 525 | + { |
|
| 526 | + echo '<a href="' . $atts['link'] . '">'; |
|
| 527 | + $hrefset = true; |
|
| 528 | + } else if (isset($atts['linkoption']) && $atts['linkoption'] == 'img' ) { |
|
| 529 | + echo '<a href="' . $atts['img'] . '">'; |
|
| 530 | + $hrefset = true; |
|
| 531 | + } |
|
| 532 | + echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '" '. $extra. '>'; |
|
| 533 | + if ($hrefset) |
|
| 534 | + { |
|
| 535 | + echo '</a>'; |
|
| 536 | + } |
|
| 537 | + if ($atts['caption']) |
|
| 538 | + { |
|
| 539 | + echo '<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption>'; |
|
| 540 | + } |
|
| 541 | + echo '</figure>'; |
|
| 542 | + echo '<p> </p>'; |
|
| 543 | + return; |
|
| 544 | + } |
|
| 545 | 545 | |
| 546 | 546 | |
| 547 | 547 | public function get_ase_options() |
@@ -577,12 +577,12 @@ discard block |
||
| 577 | 577 | exit; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - /* This function doesn't actually publish post, but should be called when a post is published */ |
|
| 581 | - public function on_publish_post( ) { |
|
| 580 | + /* This function doesn't actually publish post, but should be called when a post is published */ |
|
| 581 | + public function on_publish_post( ) { |
|
| 582 | 582 | |
| 583 | 583 | $post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
| 584 | 584 | |
| 585 | - do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
| 585 | + do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
| 586 | 586 | |
| 587 | 587 | exit; |
| 588 | 588 | } |
@@ -640,14 +640,14 @@ discard block |
||
| 640 | 640 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
| 641 | 641 | |
| 642 | 642 | if ($taxonomy =='category') { |
| 643 | - // convert from names to category ids |
|
| 643 | + // convert from names to category ids |
|
| 644 | 644 | $cats = array(); |
| 645 | 645 | foreach ($value as $cat) { |
| 646 | 646 | $cat_id = get_cat_ID($cat); |
| 647 | 647 | if ($cat_id !=0) { |
| 648 | 648 | $cats [] = $cat_id; |
| 649 | 649 | } else if ($allow_new_category) { |
| 650 | - $cats [] = wp_create_category($cat); |
|
| 650 | + $cats [] = wp_create_category($cat); |
|
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | 653 | $value = $cats; |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | - public function create_gallery( ) { |
|
| 670 | + public function create_gallery( ) { |
|
| 671 | 671 | |
| 672 | 672 | $postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
| 673 | 673 | |
@@ -721,10 +721,10 @@ discard block |
||
| 721 | 721 | 'message' => 'gallery-created', |
| 722 | 722 | 'id' => $postid) |
| 723 | 723 | ); |
| 724 | - exit; |
|
| 724 | + exit; |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | - public function update_gallery( ) { |
|
| 727 | + public function update_gallery( ) { |
|
| 728 | 728 | |
| 729 | 729 | $options = isset( $_POST['fields'] ) ? $_POST['fields'] : false; |
| 730 | 730 | |
@@ -740,12 +740,12 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | self::save_gallery_options( $postid, $gallery_ids, $options, $type ); |
| 742 | 742 | |
| 743 | - echo json_encode( array('message' => 'gallery-updated') ); |
|
| 743 | + echo json_encode( array('message' => 'gallery-updated') ); |
|
| 744 | 744 | |
| 745 | - exit; |
|
| 745 | + exit; |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
| 748 | + public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
| 749 | 749 | |
| 750 | 750 | // gallery width |
| 751 | 751 | $gallery_width = isset( $options['width'] ) ? $options['width'] : false; |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | public function set_date( $postid, $value) { |
| 830 | 830 | if( $value ) { |
| 831 | 831 | $value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 )); |
| 832 | - wp_update_post( |
|
| 832 | + wp_update_post( |
|
| 833 | 833 | array ( |
| 834 | 834 | 'ID' => $postid, // ID of the post to update |
| 835 | 835 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
@@ -15,29 +15,29 @@ discard block |
||
| 15 | 15 | add_action('wp_enqueue_scripts', array($this,'scripts')); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - function is_multipage() |
|
| 19 | - { |
|
| 20 | - global $post; |
|
| 21 | - $pos = strpos($post->post_content, "<!--nextpage-->"); |
|
| 22 | - if (!$pos) return -1; |
|
| 18 | + function is_multipage() |
|
| 19 | + { |
|
| 20 | + global $post; |
|
| 21 | + $pos = strpos($post->post_content, "<!--nextpage-->"); |
|
| 22 | + if (!$pos) return -1; |
|
| 23 | 23 | |
| 24 | - global $wp; |
|
| 25 | - $url = home_url( $wp->request ); |
|
| 26 | - $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1; |
|
| 27 | - return $index; |
|
| 28 | - } |
|
| 24 | + global $wp; |
|
| 25 | + $url = home_url( $wp->request ); |
|
| 26 | + $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1; |
|
| 27 | + return $index; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | public function scripts(){ |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | global $post; |
| 34 | 34 | if ( lasso_user_can('edit_posts') |
| 35 | - /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
| 36 | - /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
| 37 | - ) { |
|
| 35 | + /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
| 36 | + /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
| 37 | + ) { |
|
| 38 | 38 | |
| 39 | 39 | /** Returns the time offset from UTC |
| 40 | - */ |
|
| 40 | + */ |
|
| 41 | 41 | function get_UTC_offset() { |
| 42 | 42 | $timezone_string = get_option( 'timezone_string' ); |
| 43 | 43 | if (empty( $timezone_string ) ) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
| 54 | 54 | |
| 55 | - //don't load autocomplete if it's a stockholm theme |
|
| 55 | + //don't load autocomplete if it's a stockholm theme |
|
| 56 | 56 | $themename = wp_get_theme()->get('Name'); |
| 57 | 57 | if ($themename !='Stockholm' ) { |
| 58 | 58 | wp_enqueue_script('jquery-ui-autocomplete'); |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b'); |
| 91 | 91 | $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i'); |
| 92 | 92 | |
| 93 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 93 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 94 | 94 | |
| 95 | - $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor', 'off'); |
|
| 95 | + $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor', 'off'); |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | //text alignement |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $tz_offset = get_UTC_offset(); |
| 131 | 131 | $post_date = get_the_time('U', $postid); |
| 132 | 132 | $time = (time()+$tz_offset); |
| 133 | - $delta = $time - $post_date; |
|
| 133 | + $delta = $time - $post_date; |
|
| 134 | 134 | |
| 135 | 135 | $strings = array( |
| 136 | 136 | 'save' => __('Save','lasso'), |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
| 186 | 186 | |
| 187 | 187 | |
| 188 | - if ($allow_change_date) { |
|
| 189 | - $permalink = get_site_url().'/?p='.$postid; |
|
| 190 | - } else { |
|
| 191 | - $permalink = get_permalink($postid); |
|
| 192 | - } |
|
| 188 | + if ($allow_change_date) { |
|
| 189 | + $permalink = get_site_url().'/?p='.$postid; |
|
| 190 | + } else { |
|
| 191 | + $permalink = get_permalink($postid); |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | 194 | // rest api |
| 195 | 195 | $rest_nonce = ''; |
@@ -209,17 +209,17 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - //excerpt |
|
| 213 | - $post_excerpt = ""; |
|
| 214 | - $post_excerpt = $post->post_excerpt; |
|
| 212 | + //excerpt |
|
| 213 | + $post_excerpt = ""; |
|
| 214 | + $post_excerpt = $post->post_excerpt; |
|
| 215 | 215 | |
| 216 | - //find if this is multi page. -1 if not |
|
| 217 | - $multipage = self::is_multipage(); |
|
| 218 | - $post_content = ""; |
|
| 219 | - //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 220 | - if ($multipage != -1) { |
|
| 221 | - $post_content = $post->post_content; |
|
| 222 | - } |
|
| 216 | + //find if this is multi page. -1 if not |
|
| 217 | + $multipage = self::is_multipage(); |
|
| 218 | + $post_content = ""; |
|
| 219 | + //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 220 | + if ($multipage != -1) { |
|
| 221 | + $post_content = $post->post_content; |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | 224 | // localized objects |
| 225 | 225 | $objects = array( |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | 'customFields' => $custom_fields, |
| 296 | 296 | 'clickToInsert' => ($insert_comp_ui =='click'), |
| 297 | 297 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
| 298 | - 'rtl' => is_rtl(), |
|
| 298 | + 'rtl' => is_rtl(), |
|
| 299 | 299 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
| 300 | 300 | 'linksEditable' => $links_editable, |
| 301 | 301 | 'supportPendingStatus' => !$no_pending_status, |
| 302 | 302 | 'tableCode' => apply_filters( 'lasso_table_html_code','<table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table><p></p>'), |
| 303 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 304 | - 'multipages'=> $multipage, |
|
| 305 | - 'post_content'=>$post_content, |
|
| 306 | - 'post_excerpt'=>$post_excerpt, |
|
| 307 | - 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 308 | - 'prefixHTTP'=> $link_prefix_http =='on' |
|
| 303 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 304 | + 'multipages'=> $multipage, |
|
| 305 | + 'post_content'=>$post_content, |
|
| 306 | + 'post_excerpt'=>$post_excerpt, |
|
| 307 | + 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 308 | + 'prefixHTTP'=> $link_prefix_http =='on' |
|
| 309 | 309 | ); |
| 310 | 310 | |
| 311 | 311 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | if (!$using_restapiv2) { |
| 316 | - // enqueue REST API V1 |
|
| 316 | + // enqueue REST API V1 |
|
| 317 | 317 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
| 318 | 318 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
| 319 | 319 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | if ($show_color) { |
| 330 | 330 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
| 331 | 331 | } else { |
| 332 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 332 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 333 | 333 | } |
| 334 | 334 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
| 335 | 335 | |
@@ -338,44 +338,44 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - function gutenberg_active() { |
|
| 341 | + function gutenberg_active() { |
|
| 342 | 342 | |
| 343 | - // Gutenberg plugin is installed and activated. |
|
| 344 | - $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 345 | - |
|
| 346 | - // Block editor since 5.0. |
|
| 347 | - $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 348 | - |
|
| 349 | - if ( ! $gutenberg && ! $block_editor ) { |
|
| 350 | - return false; |
|
| 351 | - } |
|
| 352 | - |
|
| 353 | - if ( self::is_classic_editor_plugin_active() ) { |
|
| 354 | - $editor_option = get_option( 'classic-editor-replace' ); |
|
| 355 | - $block_editor_active = array( 'no-replace', 'block' ); |
|
| 356 | - |
|
| 357 | - return in_array( $editor_option, $block_editor_active, true ); |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - return true; |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * Check if Classic Editor plugin is active. |
|
| 365 | - * |
|
| 366 | - * @return bool |
|
| 367 | - */ |
|
| 368 | - function is_classic_editor_plugin_active() { |
|
| 369 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 370 | - include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 374 | - return true; |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - return false; |
|
| 378 | - } |
|
| 343 | + // Gutenberg plugin is installed and activated. |
|
| 344 | + $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 345 | + |
|
| 346 | + // Block editor since 5.0. |
|
| 347 | + $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 348 | + |
|
| 349 | + if ( ! $gutenberg && ! $block_editor ) { |
|
| 350 | + return false; |
|
| 351 | + } |
|
| 352 | + |
|
| 353 | + if ( self::is_classic_editor_plugin_active() ) { |
|
| 354 | + $editor_option = get_option( 'classic-editor-replace' ); |
|
| 355 | + $block_editor_active = array( 'no-replace', 'block' ); |
|
| 356 | + |
|
| 357 | + return in_array( $editor_option, $block_editor_active, true ); |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + return true; |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * Check if Classic Editor plugin is active. |
|
| 365 | + * |
|
| 366 | + * @return bool |
|
| 367 | + */ |
|
| 368 | + function is_classic_editor_plugin_active() { |
|
| 369 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 370 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 374 | + return true; |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + return false; |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | 380 | } |
| 381 | 381 | |
@@ -232,12 +232,12 @@ |
||
| 232 | 232 | if ( !function_exists('lasso_wp_image') ): |
| 233 | 233 | |
| 234 | 234 | function lasso_wp_image(){ |
| 235 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 236 | - if ($use_old_wpimg != 'on') { |
|
| 237 | - return '<figure data-component-type="wpimg" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></div>'; |
|
| 238 | - } else { |
|
| 239 | - return '<figure data-component-type="wpimg" data-linkoption="img" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></div>'; |
|
| 240 | - } |
|
| 235 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 236 | + if ($use_old_wpimg != 'on') { |
|
| 237 | + return '<figure data-component-type="wpimg" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></div>'; |
|
| 238 | + } else { |
|
| 239 | + return '<figure data-component-type="wpimg" data-linkoption="img" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></div>'; |
|
| 240 | + } |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | endif; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | height: 42px; |
| 115 | 115 | } |
| 116 | 116 | <?php |
| 117 | - } |
|
| 117 | + } |
|
| 118 | 118 | } else { |
| 119 | 119 | ?> |
| 120 | 120 | |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | <?php |
| 126 | - } |
|
| 127 | - ?> |
|
| 126 | + } |
|
| 127 | + ?> |
|
| 128 | 128 | </style> |
| 129 | 129 | <div id="lasso--controls" class="lasso-post-status--<?php echo sanitize_html_class( $status );?> <?php echo sanitize_html_class( $custom_classes );?>" data-post-id="<?php echo get_the_ID();?>" > |
| 130 | 130 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $toolbar_class = $toolbar_headings ? 'toolbar-extended' : false; |
| 234 | 234 | |
| 235 | 235 | // mobile styles |
| 236 | - $mobile_class = $is_mobile ? 'lasso-mobile' : false; |
|
| 236 | + $mobile_class = $is_mobile ? 'lasso-mobile' : false; |
|
| 237 | 237 | $mobile_style =$is_mobile ? 'style="bottom:0px;"' : null; |
| 238 | 238 | |
| 239 | 239 | //show color |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | |
| 457 | 457 | //editor options |
| 458 | 458 | $allow_change_date = lasso_editor_get_option('allow_change_date', 'lasso_editor'); |
| 459 | - $allow_edit_excerpt = lasso_editor_get_option('allow_edit_excerpt', 'lasso_editor'); |
|
| 459 | + $allow_edit_excerpt = lasso_editor_get_option('allow_edit_excerpt', 'lasso_editor'); |
|
| 460 | 460 | $no_url_setting = lasso_editor_get_option('no_url_setting', 'lasso_editor'); |
| 461 | 461 | |
| 462 | 462 | // are we singular |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | // do we support pending status |
| 470 | 470 | $no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor'); |
| 471 | 471 | |
| 472 | - $excerpt = $post->post_excerpt; |
|
| 472 | + $excerpt = $post->post_excerpt; |
|
| 473 | 473 | |
| 474 | 474 | ?> |
| 475 | 475 | <div id="lasso--post-settings__modal" class="lasso--modal lassoShowAnimate <?php echo sanitize_html_class( $custom_classes );?>"> |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | }?> |
| 549 | 549 | <?php |
| 550 | 550 | if ($allow_change_date) { |
| 551 | - $dateformat = get_option( 'date_format' ); |
|
| 551 | + $dateformat = get_option( 'date_format' ); |
|
| 552 | 552 | ?> |
| 553 | 553 | <label><?php _e( 'Post Date', 'lasso' ); ?></label> |
| 554 | 554 | <input type="text" class="editus_custom_date" name="post_date" value="<?php echo get_the_time($dateformat, $postid);?>"/> |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | if ( !empty( $types ) ) { |
| 664 | 664 | // get the first element |
| 665 | 665 | $keys = array_keys($types); |
| 666 | - $type =$keys[0]; |
|
| 666 | + $type =$keys[0]; |
|
| 667 | 667 | $type = preg_replace( '/s\b/','', $type ); |
| 668 | 668 | printf( '<input type="hidden" name="object" value="%s">', lcfirst( esc_attr( $type ) ) ); |
| 669 | 669 | } |
@@ -691,8 +691,8 @@ discard block |
||
| 691 | 691 | global $post; |
| 692 | 692 | |
| 693 | 693 | global $wp_post_types; |
| 694 | - $labels = &$wp_post_types['post']->labels; |
|
| 695 | - $labels->name = 'Articles'; |
|
| 694 | + $labels = &$wp_post_types['post']->labels; |
|
| 695 | + $labels->name = 'Articles'; |
|
| 696 | 696 | |
| 697 | 697 | ob_start(); |
| 698 | 698 | |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | ob_start(); |
| 753 | 753 | |
| 754 | 754 | |
| 755 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 755 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 756 | 756 | |
| 757 | 757 | // let users add custom css classes |
| 758 | 758 | $custom_classes = apply_filters( 'lasso_wpimg_classes', '' ); |
@@ -840,8 +840,8 @@ discard block |
||
| 840 | 840 | function lasso_editor_options_blob() { |
| 841 | 841 | |
| 842 | 842 | $codes = function_exists( 'aesop_shortcodes' ) ? aesop_shortcodes() : array(); |
| 843 | - $codes = add_wpimg_options( $codes ); |
|
| 844 | - $codes = apply_filters( 'lasso_custom_options', $codes ); |
|
| 843 | + $codes = add_wpimg_options( $codes ); |
|
| 844 | + $codes = apply_filters( 'lasso_custom_options', $codes ); |
|
| 845 | 845 | $galleries = function_exists( 'lasso_editor_galleries_exist' ) && lasso_editor_galleries_exist() ? 'has-galleries' : 'creating-gallery'; |
| 846 | 846 | |
| 847 | 847 | $nonce = wp_create_nonce( 'lasso_gallery' ); |
@@ -943,9 +943,9 @@ discard block |
||
| 943 | 943 | $return .= '</form>'; |
| 944 | 944 | |
| 945 | 945 | // extra JS codes |
| 946 | - if (isset($shortcode['codes'])) { |
|
| 947 | - $return .= $shortcode['codes']; |
|
| 948 | - } |
|
| 946 | + if (isset($shortcode['codes'])) { |
|
| 947 | + $return .= $shortcode['codes']; |
|
| 948 | + } |
|
| 949 | 949 | $blob[$slug] = $return; |
| 950 | 950 | } |
| 951 | 951 | |
@@ -954,95 +954,95 @@ discard block |
||
| 954 | 954 | |
| 955 | 955 | |
| 956 | 956 | function add_wpimg_options( $shortcodes ) { |
| 957 | - $custom = array( |
|
| 958 | - 'wpimg' => array( |
|
| 959 | - 'name' => __( 'Image', 'lasso' ), |
|
| 960 | - 'type' => 'single', |
|
| 961 | - 'atts' => array( |
|
| 962 | - 'img' => array( |
|
| 963 | - 'type' => 'media_upload', |
|
| 964 | - 'default' => '', |
|
| 965 | - 'desc' => __( 'Image URL', 'lasso' ), |
|
| 966 | - 'tip' => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' ) |
|
| 967 | - ), |
|
| 968 | - 'align' => array( |
|
| 969 | - 'type' => 'select', |
|
| 970 | - 'values' => array( |
|
| 971 | - array( |
|
| 972 | - 'value' => 'center', |
|
| 973 | - 'name' => __( 'Center', 'aesop-core' ) |
|
| 974 | - ), |
|
| 975 | - array( |
|
| 976 | - 'value' => 'left', |
|
| 977 | - 'name' => __( 'Left', 'aesop-core' ) |
|
| 978 | - ), |
|
| 979 | - array( |
|
| 980 | - 'value' => 'right', |
|
| 981 | - 'name' => __( 'Right', 'aesop-core' ) |
|
| 982 | - ), |
|
| 983 | - ), |
|
| 984 | - 'default' => 'center', |
|
| 985 | - 'desc' => __( 'Alignment', 'lasso' ), |
|
| 986 | - 'tip'=>'' |
|
| 987 | - ), |
|
| 957 | + $custom = array( |
|
| 958 | + 'wpimg' => array( |
|
| 959 | + 'name' => __( 'Image', 'lasso' ), |
|
| 960 | + 'type' => 'single', |
|
| 961 | + 'atts' => array( |
|
| 962 | + 'img' => array( |
|
| 963 | + 'type' => 'media_upload', |
|
| 964 | + 'default' => '', |
|
| 965 | + 'desc' => __( 'Image URL', 'lasso' ), |
|
| 966 | + 'tip' => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' ) |
|
| 967 | + ), |
|
| 968 | + 'align' => array( |
|
| 969 | + 'type' => 'select', |
|
| 970 | + 'values' => array( |
|
| 971 | + array( |
|
| 972 | + 'value' => 'center', |
|
| 973 | + 'name' => __( 'Center', 'aesop-core' ) |
|
| 974 | + ), |
|
| 975 | + array( |
|
| 976 | + 'value' => 'left', |
|
| 977 | + 'name' => __( 'Left', 'aesop-core' ) |
|
| 978 | + ), |
|
| 979 | + array( |
|
| 980 | + 'value' => 'right', |
|
| 981 | + 'name' => __( 'Right', 'aesop-core' ) |
|
| 982 | + ), |
|
| 983 | + ), |
|
| 984 | + 'default' => 'center', |
|
| 985 | + 'desc' => __( 'Alignment', 'lasso' ), |
|
| 986 | + 'tip'=>'' |
|
| 987 | + ), |
|
| 988 | 988 | |
| 989 | - 'imgwidth' => array( |
|
| 990 | - 'type' => 'text_small', |
|
| 991 | - 'default' => '300px', |
|
| 992 | - 'desc' => __( 'Image Width', 'lasso' ), |
|
| 993 | - 'tip' => __( 'Width of the image. You can enter the size in pixels or percentage such as <code>40%</code> or <code>500px</code>.', 'aesop-core' ) |
|
| 994 | - ), |
|
| 995 | - 'imgheight' => array( |
|
| 996 | - 'type' => 'text_small', |
|
| 997 | - 'default' => '', |
|
| 998 | - 'desc' => __( 'Image Height', 'lasso' ), |
|
| 999 | - 'tip' => __( 'Used only for the Panorama mode. Can be set using pixel values such as <code>500px</code>. If unspecified, the original height would be used. ', 'aesop-core' ) |
|
| 1000 | - ), |
|
| 1001 | - 'linkoption' => array( |
|
| 1002 | - 'type' => 'select', |
|
| 1003 | - 'values' => array( |
|
| 1004 | - array( |
|
| 1005 | - 'value' => 'none', |
|
| 1006 | - 'name' => __( 'None', 'aesop-core' ) |
|
| 1007 | - ), |
|
| 1008 | - array( |
|
| 1009 | - 'value' => 'img', |
|
| 1010 | - 'name' => __( 'Image', 'aesop-core' ) |
|
| 1011 | - ), |
|
| 1012 | - array( |
|
| 1013 | - 'value' => 'url', |
|
| 1014 | - 'name' => __( 'URL', 'aesop-core' ) |
|
| 1015 | - ), |
|
| 1016 | - ), |
|
| 1017 | - 'default' => 'none', |
|
| 1018 | - 'desc' => __( 'Link', 'lasso' ), |
|
| 1019 | - 'tip' => __( 'Click leads to:', 'lasso' ) |
|
| 1020 | - ), |
|
| 989 | + 'imgwidth' => array( |
|
| 990 | + 'type' => 'text_small', |
|
| 991 | + 'default' => '300px', |
|
| 992 | + 'desc' => __( 'Image Width', 'lasso' ), |
|
| 993 | + 'tip' => __( 'Width of the image. You can enter the size in pixels or percentage such as <code>40%</code> or <code>500px</code>.', 'aesop-core' ) |
|
| 994 | + ), |
|
| 995 | + 'imgheight' => array( |
|
| 996 | + 'type' => 'text_small', |
|
| 997 | + 'default' => '', |
|
| 998 | + 'desc' => __( 'Image Height', 'lasso' ), |
|
| 999 | + 'tip' => __( 'Used only for the Panorama mode. Can be set using pixel values such as <code>500px</code>. If unspecified, the original height would be used. ', 'aesop-core' ) |
|
| 1000 | + ), |
|
| 1001 | + 'linkoption' => array( |
|
| 1002 | + 'type' => 'select', |
|
| 1003 | + 'values' => array( |
|
| 1004 | + array( |
|
| 1005 | + 'value' => 'none', |
|
| 1006 | + 'name' => __( 'None', 'aesop-core' ) |
|
| 1007 | + ), |
|
| 1008 | + array( |
|
| 1009 | + 'value' => 'img', |
|
| 1010 | + 'name' => __( 'Image', 'aesop-core' ) |
|
| 1011 | + ), |
|
| 1012 | + array( |
|
| 1013 | + 'value' => 'url', |
|
| 1014 | + 'name' => __( 'URL', 'aesop-core' ) |
|
| 1015 | + ), |
|
| 1016 | + ), |
|
| 1017 | + 'default' => 'none', |
|
| 1018 | + 'desc' => __( 'Link', 'lasso' ), |
|
| 1019 | + 'tip' => __( 'Click leads to:', 'lasso' ) |
|
| 1020 | + ), |
|
| 1021 | 1021 | |
| 1022 | - 'link' => array( |
|
| 1023 | - 'type' => 'text', |
|
| 1024 | - 'default' => '', |
|
| 1025 | - 'desc' => __( 'URL Link', 'lasso' ), |
|
| 1026 | - 'tip' => __( 'URL link', 'lasso' ) |
|
| 1027 | - ), |
|
| 1028 | - 'alt' => array( |
|
| 1029 | - 'type' => 'text', |
|
| 1030 | - 'default' => '', |
|
| 1031 | - 'desc' => __( 'Image ALT', 'lasso' ), |
|
| 1032 | - 'tip' => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' ) |
|
| 1033 | - ), |
|
| 1022 | + 'link' => array( |
|
| 1023 | + 'type' => 'text', |
|
| 1024 | + 'default' => '', |
|
| 1025 | + 'desc' => __( 'URL Link', 'lasso' ), |
|
| 1026 | + 'tip' => __( 'URL link', 'lasso' ) |
|
| 1027 | + ), |
|
| 1028 | + 'alt' => array( |
|
| 1029 | + 'type' => 'text', |
|
| 1030 | + 'default' => '', |
|
| 1031 | + 'desc' => __( 'Image ALT', 'lasso' ), |
|
| 1032 | + 'tip' => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' ) |
|
| 1033 | + ), |
|
| 1034 | 1034 | |
| 1035 | - 'caption' => array( |
|
| 1036 | - 'type' => 'text_area', |
|
| 1037 | - 'default' => '', |
|
| 1038 | - 'desc' => __( 'Caption', 'lasso' ), |
|
| 1039 | - 'tip' => __( 'Optional caption for the image.', 'lasso' ) |
|
| 1040 | - ), |
|
| 1035 | + 'caption' => array( |
|
| 1036 | + 'type' => 'text_area', |
|
| 1037 | + 'default' => '', |
|
| 1038 | + 'desc' => __( 'Caption', 'lasso' ), |
|
| 1039 | + 'tip' => __( 'Optional caption for the image.', 'lasso' ) |
|
| 1040 | + ), |
|
| 1041 | 1041 | |
| 1042 | 1042 | |
| 1043 | - ), |
|
| 1044 | - 'desc' => __( 'An image.', 'aesop-core' ), |
|
| 1045 | - 'codes' => '<script> |
|
| 1043 | + ), |
|
| 1044 | + 'desc' => __( 'An image.', 'aesop-core' ), |
|
| 1045 | + 'codes' => '<script> |
|
| 1046 | 1046 | jQuery(document).ready(function($){ |
| 1047 | 1047 | function linkSetting(l){ |
| 1048 | 1048 | if ( l=="url") { |
@@ -1062,10 +1062,10 @@ discard block |
||
| 1062 | 1062 | }) |
| 1063 | 1063 | }); |
| 1064 | 1064 | </script>' |
| 1065 | - ) |
|
| 1066 | - ); |
|
| 1065 | + ) |
|
| 1066 | + ); |
|
| 1067 | 1067 | |
| 1068 | - return array_merge( $shortcodes, $custom ); |
|
| 1068 | + return array_merge( $shortcodes, $custom ); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | 1071 | /** |
@@ -1110,23 +1110,23 @@ discard block |
||
| 1110 | 1110 | * @return string |
| 1111 | 1111 | */ |
| 1112 | 1112 | function lasso_editor_adjustBrightness($hex, $steps) { |
| 1113 | - $steps = max(-255, min(255, $steps)); |
|
| 1113 | + $steps = max(-255, min(255, $steps)); |
|
| 1114 | 1114 | |
| 1115 | - // Normalize into a six character long hex string |
|
| 1116 | - $hex = str_replace('#', '', $hex); |
|
| 1117 | - if (strlen($hex) == 3) { |
|
| 1118 | - $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
| 1119 | - } |
|
| 1115 | + // Normalize into a six character long hex string |
|
| 1116 | + $hex = str_replace('#', '', $hex); |
|
| 1117 | + if (strlen($hex) == 3) { |
|
| 1118 | + $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
| 1119 | + } |
|
| 1120 | 1120 | |
| 1121 | - // Split into three parts: R, G and B |
|
| 1122 | - $color_parts = str_split($hex, 2); |
|
| 1123 | - $return = '#'; |
|
| 1121 | + // Split into three parts: R, G and B |
|
| 1122 | + $color_parts = str_split($hex, 2); |
|
| 1123 | + $return = '#'; |
|
| 1124 | 1124 | |
| 1125 | - foreach ($color_parts as $color) { |
|
| 1126 | - $color = hexdec($color); // Convert to decimal |
|
| 1127 | - $color = max(0,min(255,$color + $steps)); // Adjust color |
|
| 1128 | - $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
| 1129 | - } |
|
| 1125 | + foreach ($color_parts as $color) { |
|
| 1126 | + $color = hexdec($color); // Convert to decimal |
|
| 1127 | + $color = max(0,min(255,$color + $steps)); // Adjust color |
|
| 1128 | + $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
| 1129 | + } |
|
| 1130 | 1130 | |
| 1131 | - return $return; |
|
| 1131 | + return $return; |
|
| 1132 | 1132 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); |
| 49 | 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( ) ); |
|
| 51 | + $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
| 52 | 52 | $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
| 53 | 53 | if (in_array( $post_type,$allowed_post_types)) { |
| 54 | 54 | $args['show_in_rest'] = true; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - return $args; |
|
| 60 | + return $args; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
@@ -106,25 +106,25 @@ discard block |
||
| 106 | 106 | //table codes to be added |
| 107 | 107 | class editus_table { |
| 108 | 108 | |
| 109 | - public function __construct(){ |
|
| 110 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 111 | - if ($add_table) { |
|
| 112 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
| 109 | + public function __construct(){ |
|
| 110 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 111 | + if ($add_table) { |
|
| 112 | + add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
| 113 | 113 | |
| 114 | - } |
|
| 114 | + } |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - function scripts() |
|
| 118 | - { |
|
| 119 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
| 120 | - add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
| 121 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
| 122 | - wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
| 123 | - wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
| 124 | - } |
|
| 117 | + function scripts() |
|
| 118 | + { |
|
| 119 | + add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
| 120 | + add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
| 121 | + add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
| 122 | + wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
| 123 | + wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - function editus_table_edit_menu() |
|
| 127 | - { ?> |
|
| 126 | + function editus_table_edit_menu() |
|
| 127 | + { ?> |
|
| 128 | 128 | |
| 129 | 129 | <ul class='editus-table-menu'> |
| 130 | 130 | <li data-action="insertcol"><?php echo __('Insert Column','lasso')?></li> |
@@ -134,31 +134,31 @@ discard block |
||
| 134 | 134 | <li data-action="deltable"><?php echo __('Delete Table','lasso')?></li |
| 135 | 135 | </ul> |
| 136 | 136 | <?php |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | 139 | |
| 140 | - function editus_html_table() |
|
| 141 | - { |
|
| 142 | - return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure><p></p>'; |
|
| 143 | - } |
|
| 140 | + function editus_html_table() |
|
| 141 | + { |
|
| 142 | + return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure><p></p>'; |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | 145 | |
| 146 | - function editus_components_add_table( $array ){ |
|
| 147 | - $custom = array( |
|
| 148 | - 'htmltable' => array( |
|
| 149 | - 'name' => __('HTML Table','lasso'), |
|
| 150 | - 'content' => self::editus_html_table(), |
|
| 151 | - ) |
|
| 152 | - ); |
|
| 153 | - return array_merge( $array, $custom ); |
|
| 154 | - } |
|
| 146 | + function editus_components_add_table( $array ){ |
|
| 147 | + $custom = array( |
|
| 148 | + 'htmltable' => array( |
|
| 149 | + 'name' => __('HTML Table','lasso'), |
|
| 150 | + 'content' => self::editus_html_table(), |
|
| 151 | + ) |
|
| 152 | + ); |
|
| 153 | + return array_merge( $array, $custom ); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | 156 | |
| 157 | - function editus_toolbar_components_add_table( ) { |
|
| 158 | - ?> |
|
| 157 | + function editus_toolbar_components_add_table( ) { |
|
| 158 | + ?> |
|
| 159 | 159 | <li data-type="htmltable" title="<?php esc_attr_e( 'HTML Table', 'lasso' );?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li> |
| 160 | 160 | <?php |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |