@@ -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'); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $tz_offset = get_UTC_offset(); |
| 127 | 127 | $post_date = get_the_time('U', $postid); |
| 128 | 128 | $time = (time()+$tz_offset); |
| 129 | - $delta = $time - $post_date; |
|
| 129 | + $delta = $time - $post_date; |
|
| 130 | 130 | |
| 131 | 131 | $strings = array( |
| 132 | 132 | 'save' => __('Save','lasso'), |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
| 182 | 182 | |
| 183 | 183 | |
| 184 | - if ($allow_change_date) { |
|
| 185 | - $permalink = get_site_url().'/?p='.$postid; |
|
| 186 | - } else { |
|
| 187 | - $permalink = get_permalink($postid); |
|
| 188 | - } |
|
| 184 | + if ($allow_change_date) { |
|
| 185 | + $permalink = get_site_url().'/?p='.$postid; |
|
| 186 | + } else { |
|
| 187 | + $permalink = get_permalink($postid); |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | 190 | // rest api |
| 191 | 191 | $rest_nonce = ''; |
@@ -205,17 +205,17 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - //excerpt |
|
| 209 | - $post_excerpt = ""; |
|
| 210 | - $post_excerpt = $post->post_excerpt; |
|
| 208 | + //excerpt |
|
| 209 | + $post_excerpt = ""; |
|
| 210 | + $post_excerpt = $post->post_excerpt; |
|
| 211 | 211 | |
| 212 | - //find if this is multi page. -1 if not |
|
| 213 | - $multipage = self::is_multipage(); |
|
| 214 | - $post_content = ""; |
|
| 215 | - //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 216 | - if ($multipage != -1) { |
|
| 217 | - $post_content = $post->post_content; |
|
| 218 | - } |
|
| 212 | + //find if this is multi page. -1 if not |
|
| 213 | + $multipage = self::is_multipage(); |
|
| 214 | + $post_content = ""; |
|
| 215 | + //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 216 | + if ($multipage != -1) { |
|
| 217 | + $post_content = $post->post_content; |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | 220 | // localized objects |
| 221 | 221 | $objects = array( |
@@ -291,15 +291,15 @@ discard block |
||
| 291 | 291 | 'customFields' => $custom_fields, |
| 292 | 292 | 'clickToInsert' => ($insert_comp_ui =='click'), |
| 293 | 293 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
| 294 | - 'rtl' => is_rtl(), |
|
| 294 | + 'rtl' => is_rtl(), |
|
| 295 | 295 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
| 296 | 296 | 'linksEditable' => $links_editable, |
| 297 | 297 | 'supportPendingStatus' => !$no_pending_status, |
| 298 | 298 | '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>'), |
| 299 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 300 | - 'multipages'=> $multipage, |
|
| 301 | - 'post_content'=>$post_content, |
|
| 302 | - 'post_excerpt'=>$post_excerpt |
|
| 299 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 300 | + 'multipages'=> $multipage, |
|
| 301 | + 'post_content'=>$post_content, |
|
| 302 | + 'post_excerpt'=>$post_excerpt |
|
| 303 | 303 | ); |
| 304 | 304 | |
| 305 | 305 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | |
| 309 | 309 | if (!$using_restapiv2) { |
| 310 | - // enqueue REST API V1 |
|
| 310 | + // enqueue REST API V1 |
|
| 311 | 311 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
| 312 | 312 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
| 313 | 313 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | if ($show_color) { |
| 324 | 324 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
| 325 | 325 | } else { |
| 326 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 326 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 327 | 327 | } |
| 328 | 328 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
| 329 | 329 | |
@@ -332,44 +332,44 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - function gutenberg_active() { |
|
| 335 | + function gutenberg_active() { |
|
| 336 | 336 | |
| 337 | - // Gutenberg plugin is installed and activated. |
|
| 338 | - $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 339 | - |
|
| 340 | - // Block editor since 5.0. |
|
| 341 | - $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 342 | - |
|
| 343 | - if ( ! $gutenberg && ! $block_editor ) { |
|
| 344 | - return false; |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - if ( self::is_classic_editor_plugin_active() ) { |
|
| 348 | - $editor_option = get_option( 'classic-editor-replace' ); |
|
| 349 | - $block_editor_active = array( 'no-replace', 'block' ); |
|
| 350 | - |
|
| 351 | - return in_array( $editor_option, $block_editor_active, true ); |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - return true; |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - /** |
|
| 358 | - * Check if Classic Editor plugin is active. |
|
| 359 | - * |
|
| 360 | - * @return bool |
|
| 361 | - */ |
|
| 362 | - function is_classic_editor_plugin_active() { |
|
| 363 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 364 | - include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 368 | - return true; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - return false; |
|
| 372 | - } |
|
| 337 | + // Gutenberg plugin is installed and activated. |
|
| 338 | + $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 339 | + |
|
| 340 | + // Block editor since 5.0. |
|
| 341 | + $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 342 | + |
|
| 343 | + if ( ! $gutenberg && ! $block_editor ) { |
|
| 344 | + return false; |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + if ( self::is_classic_editor_plugin_active() ) { |
|
| 348 | + $editor_option = get_option( 'classic-editor-replace' ); |
|
| 349 | + $block_editor_active = array( 'no-replace', 'block' ); |
|
| 350 | + |
|
| 351 | + return in_array( $editor_option, $block_editor_active, true ); |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + return true; |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + /** |
|
| 358 | + * Check if Classic Editor plugin is active. |
|
| 359 | + * |
|
| 360 | + * @return bool |
|
| 361 | + */ |
|
| 362 | + function is_classic_editor_plugin_active() { |
|
| 363 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 364 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 368 | + return true; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + return false; |
|
| 372 | + } |
|
| 373 | 373 | |
| 374 | 374 | } |
| 375 | 375 | |
@@ -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; |
@@ -419,57 +419,57 @@ discard block |
||
| 419 | 419 | ); |
| 420 | 420 | foreach ($_POST as $key => $value) { |
| 421 | 421 | if ($key !="code" && $key !="action") { |
| 422 | - //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
| 422 | + //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
| 423 | 423 | $atts[$key] = $value; |
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | if ($code == "aesop_video") { |
| 427 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 428 | - echo aesop_video_shortcode($atts); |
|
| 427 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 428 | + echo aesop_video_shortcode($atts); |
|
| 429 | 429 | } |
| 430 | 430 | else if ($code == "aesop_image") { |
| 431 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 432 | - echo aesop_image_shortcode($atts); |
|
| 431 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 432 | + echo aesop_image_shortcode($atts); |
|
| 433 | 433 | } |
| 434 | 434 | else if ($code == "aesop_quote") { |
| 435 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 436 | - echo aesop_quote_shortcode($atts); |
|
| 435 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 436 | + echo aesop_quote_shortcode($atts); |
|
| 437 | 437 | } |
| 438 | 438 | else if ($code == "aesop_parallax") { |
| 439 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 440 | - echo aesop_parallax_shortcode($atts); |
|
| 439 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 440 | + echo aesop_parallax_shortcode($atts); |
|
| 441 | 441 | } |
| 442 | 442 | else if ($code == "aesop_character") { |
| 443 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 444 | - echo aesop_character_shortcode($atts); |
|
| 443 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 444 | + echo aesop_character_shortcode($atts); |
|
| 445 | 445 | } |
| 446 | 446 | else if ($code == "aesop_collection") { |
| 447 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 448 | - echo aesop_collection_shortcode($atts); |
|
| 447 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 448 | + echo aesop_collection_shortcode($atts); |
|
| 449 | 449 | } |
| 450 | 450 | else if ($code == "aesop_chapter") { |
| 451 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 452 | - echo aesop_chapter_shortcode($atts); |
|
| 451 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 452 | + echo aesop_chapter_shortcode($atts); |
|
| 453 | 453 | } |
| 454 | 454 | else if ($code == "aesop_content") { |
| 455 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 456 | - echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 455 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 456 | + echo aesop_content_shortcode($atts, $atts['content_data']); |
|
| 457 | 457 | } |
| 458 | 458 | else if ($code == "aesop_gallery") { |
| 459 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 460 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 459 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 460 | + echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 461 | 461 | } |
| 462 | 462 | else if ($code == "aesop_audio") { |
| 463 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 464 | - echo aesop_audio_shortcode($atts); |
|
| 463 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
| 464 | + echo aesop_audio_shortcode($atts); |
|
| 465 | 465 | } |
| 466 | - else if ($code == "aesop_wpimg") { |
|
| 467 | - self::wpimg($atts); |
|
| 466 | + else if ($code == "aesop_wpimg") { |
|
| 467 | + self::wpimg($atts); |
|
| 468 | 468 | } |
| 469 | 469 | else { |
| 470 | 470 | $code = '['.$code.' '; |
| 471 | 471 | foreach ($atts as $key => $value) { |
| 472 | - $code = ''.$key.'="'.$value.'" '; |
|
| 472 | + $code = ''.$key.'="'.$value.'" '; |
|
| 473 | 473 | } |
| 474 | 474 | $code = $code.']'; |
| 475 | 475 | echo do_shortcode($code); |
@@ -478,52 +478,52 @@ discard block |
||
| 478 | 478 | exit; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - public static function wpimg($atts) { |
|
| 481 | + public static function wpimg($atts) { |
|
| 482 | 482 | |
| 483 | - echo '<figure data-component-type="wpimg"'; |
|
| 483 | + echo '<figure data-component-type="wpimg"'; |
|
| 484 | 484 | |
| 485 | - $extra = ""; |
|
| 485 | + $extra = ""; |
|
| 486 | 486 | |
| 487 | - // try to use srcset and sizes on new WP installs |
|
| 487 | + // try to use srcset and sizes on new WP installs |
|
| 488 | 488 | if ( function_exists('wp_get_attachment_image_srcset') && $attachment_id = attachment_url_to_postid( $atts['img'] ) ) { |
| 489 | 489 | $srcset = wp_get_attachment_image_srcset( $attachment_id, 'full' ); |
| 490 | 490 | $sizes = wp_get_attachment_image_sizes( $attachment_id, 'full' ); |
| 491 | - $extra = "srcset='$srcset' sizes='$sizes' "; |
|
| 492 | - } |
|
| 493 | - $extra .= 'style="margin:auto;'; |
|
| 494 | - if ($atts['imgwidth'] || $atts['imgheight']) { |
|
| 495 | - if ($atts['imgwidth']) { |
|
| 496 | - $extra .= 'width:'. $atts['imgwidth'].';'; |
|
| 497 | - } |
|
| 498 | - if ($atts['imgheight']) { |
|
| 499 | - $extra .= 'height:'. $atts['imgheight'].';'; |
|
| 500 | - } |
|
| 491 | + $extra = "srcset='$srcset' sizes='$sizes' "; |
|
| 492 | + } |
|
| 493 | + $extra .= 'style="margin:auto;'; |
|
| 494 | + if ($atts['imgwidth'] || $atts['imgheight']) { |
|
| 495 | + if ($atts['imgwidth']) { |
|
| 496 | + $extra .= 'width:'. $atts['imgwidth'].';'; |
|
| 497 | + } |
|
| 498 | + if ($atts['imgheight']) { |
|
| 499 | + $extra .= 'height:'. $atts['imgheight'].';'; |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | - } |
|
| 503 | - $extra .= '"'; |
|
| 502 | + } |
|
| 503 | + $extra .= '"'; |
|
| 504 | 504 | |
| 505 | - foreach ($atts as $key => $value) { |
|
| 505 | + foreach ($atts as $key => $value) { |
|
| 506 | 506 | echo ' data-'.$key.'="'.$value.'"'; |
| 507 | 507 | } |
| 508 | - //echo ' class="wp-image- lasso--wpimg__wrap lasso-component">'; |
|
| 509 | - echo ' class="wp-image wp-caption lasso-component">'; |
|
| 510 | - if ($atts['link']) |
|
| 511 | - { |
|
| 512 | - echo '<a href="' . $atts['link'] . '">'; |
|
| 513 | - } |
|
| 514 | - echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '" '. $extra. '>'; |
|
| 515 | - if ($atts['link']) |
|
| 516 | - { |
|
| 517 | - echo '</a>'; |
|
| 518 | - } |
|
| 519 | - if ($atts['caption']) |
|
| 520 | - { |
|
| 521 | - echo '<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption>'; |
|
| 522 | - } |
|
| 523 | - echo '</figure>'; |
|
| 524 | - echo '<p> </p>'; |
|
| 525 | - return; |
|
| 526 | - } |
|
| 508 | + //echo ' class="wp-image- lasso--wpimg__wrap lasso-component">'; |
|
| 509 | + echo ' class="wp-image wp-caption lasso-component">'; |
|
| 510 | + if ($atts['link']) |
|
| 511 | + { |
|
| 512 | + echo '<a href="' . $atts['link'] . '">'; |
|
| 513 | + } |
|
| 514 | + echo '<img src="' . $atts['img'] . '" alt="'. $atts['alt'] . '" '. $extra. '>'; |
|
| 515 | + if ($atts['link']) |
|
| 516 | + { |
|
| 517 | + echo '</a>'; |
|
| 518 | + } |
|
| 519 | + if ($atts['caption']) |
|
| 520 | + { |
|
| 521 | + echo '<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption>'; |
|
| 522 | + } |
|
| 523 | + echo '</figure>'; |
|
| 524 | + echo '<p> </p>'; |
|
| 525 | + return; |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | 528 | |
| 529 | 529 | public function get_ase_options() |
@@ -559,12 +559,12 @@ discard block |
||
| 559 | 559 | exit; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - /* This function doesn't actually publish post, but should be called when a post is published */ |
|
| 563 | - public function on_publish_post( ) { |
|
| 562 | + /* This function doesn't actually publish post, but should be called when a post is published */ |
|
| 563 | + public function on_publish_post( ) { |
|
| 564 | 564 | |
| 565 | 565 | $post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
| 566 | 566 | |
| 567 | - do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
| 567 | + do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
| 568 | 568 | |
| 569 | 569 | exit; |
| 570 | 570 | } |
@@ -622,14 +622,14 @@ discard block |
||
| 622 | 622 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
| 623 | 623 | |
| 624 | 624 | if ($taxonomy =='category') { |
| 625 | - // convert from names to category ids |
|
| 625 | + // convert from names to category ids |
|
| 626 | 626 | $cats = array(); |
| 627 | 627 | foreach ($value as $cat) { |
| 628 | 628 | $cat_id = get_cat_ID($cat); |
| 629 | 629 | if ($cat_id !=0) { |
| 630 | 630 | $cats [] = $cat_id; |
| 631 | 631 | } else if ($allow_new_category) { |
| 632 | - $cats [] = wp_create_category($cat); |
|
| 632 | + $cats [] = wp_create_category($cat); |
|
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | $value = $cats; |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - public function create_gallery( ) { |
|
| 652 | + public function create_gallery( ) { |
|
| 653 | 653 | |
| 654 | 654 | $postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
| 655 | 655 | |
@@ -703,10 +703,10 @@ discard block |
||
| 703 | 703 | 'message' => 'gallery-created', |
| 704 | 704 | 'id' => $postid) |
| 705 | 705 | ); |
| 706 | - exit; |
|
| 706 | + exit; |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - public function update_gallery( ) { |
|
| 709 | + public function update_gallery( ) { |
|
| 710 | 710 | |
| 711 | 711 | $options = isset( $_POST['fields'] ) ? $_POST['fields'] : false; |
| 712 | 712 | |
@@ -722,12 +722,12 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | self::save_gallery_options( $postid, $gallery_ids, $options, $type ); |
| 724 | 724 | |
| 725 | - echo json_encode( array('message' => 'gallery-updated') ); |
|
| 725 | + echo json_encode( array('message' => 'gallery-updated') ); |
|
| 726 | 726 | |
| 727 | - exit; |
|
| 727 | + exit; |
|
| 728 | 728 | } |
| 729 | 729 | |
| 730 | - public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
| 730 | + public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
| 731 | 731 | |
| 732 | 732 | // gallery width |
| 733 | 733 | $gallery_width = isset( $options['width'] ) ? $options['width'] : false; |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | public function set_date( $postid, $value) { |
| 812 | 812 | if( $value ) { |
| 813 | 813 | $value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 )); |
| 814 | - wp_update_post( |
|
| 814 | + wp_update_post( |
|
| 815 | 815 | array ( |
| 816 | 816 | 'ID' => $postid, // ID of the post to update |
| 817 | 817 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
@@ -426,47 +426,36 @@ discard block |
||
| 426 | 426 | if ($code == "aesop_video") { |
| 427 | 427 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
| 428 | 428 | echo aesop_video_shortcode($atts); |
| 429 | - } |
|
| 430 | - else if ($code == "aesop_image") { |
|
| 429 | + } else if ($code == "aesop_image") { |
|
| 431 | 430 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
| 432 | 431 | echo aesop_image_shortcode($atts); |
| 433 | - } |
|
| 434 | - else if ($code == "aesop_quote") { |
|
| 432 | + } else if ($code == "aesop_quote") { |
|
| 435 | 433 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
| 436 | 434 | echo aesop_quote_shortcode($atts); |
| 437 | - } |
|
| 438 | - else if ($code == "aesop_parallax") { |
|
| 435 | + } else if ($code == "aesop_parallax") { |
|
| 439 | 436 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
| 440 | 437 | echo aesop_parallax_shortcode($atts); |
| 441 | - } |
|
| 442 | - else if ($code == "aesop_character") { |
|
| 438 | + } else if ($code == "aesop_character") { |
|
| 443 | 439 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
| 444 | 440 | echo aesop_character_shortcode($atts); |
| 445 | - } |
|
| 446 | - else if ($code == "aesop_collection") { |
|
| 441 | + } else if ($code == "aesop_collection") { |
|
| 447 | 442 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
| 448 | 443 | echo aesop_collection_shortcode($atts); |
| 449 | - } |
|
| 450 | - else if ($code == "aesop_chapter") { |
|
| 444 | + } else if ($code == "aesop_chapter") { |
|
| 451 | 445 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
| 452 | 446 | echo aesop_chapter_shortcode($atts); |
| 453 | - } |
|
| 454 | - else if ($code == "aesop_content") { |
|
| 447 | + } else if ($code == "aesop_content") { |
|
| 455 | 448 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
| 456 | 449 | echo aesop_content_shortcode($atts, $atts['content_data']); |
| 457 | - } |
|
| 458 | - else if ($code == "aesop_gallery") { |
|
| 450 | + } else if ($code == "aesop_gallery") { |
|
| 459 | 451 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
| 460 | 452 | echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
| 461 | - } |
|
| 462 | - else if ($code == "aesop_audio") { |
|
| 453 | + } else if ($code == "aesop_audio") { |
|
| 463 | 454 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
| 464 | 455 | echo aesop_audio_shortcode($atts); |
| 465 | - } |
|
| 466 | - else if ($code == "aesop_wpimg") { |
|
| 456 | + } else if ($code == "aesop_wpimg") { |
|
| 467 | 457 | self::wpimg($atts); |
| 468 | - } |
|
| 469 | - else { |
|
| 458 | + } else { |
|
| 470 | 459 | $code = '['.$code.' '; |
| 471 | 460 | foreach ($atts as $key => $value) { |
| 472 | 461 | $code = ''.$key.'="'.$value.'" '; |
@@ -539,8 +528,9 @@ discard block |
||
| 539 | 528 | $postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
| 540 | 529 | |
| 541 | 530 | // bail out if the current user can't publish posts |
| 542 | - if ( !lasso_user_can( 'delete_post', $postid ) ) |
|
| 543 | - return; |
|
| 531 | + if ( !lasso_user_can( 'delete_post', $postid ) ) { |
|
| 532 | + return; |
|
| 533 | + } |
|
| 544 | 534 | |
| 545 | 535 | if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_delete_post' )) { |
| 546 | 536 | wp_send_json_error(); |
@@ -636,15 +626,14 @@ discard block |
||
| 636 | 626 | } |
| 637 | 627 | |
| 638 | 628 | $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
| 639 | - } |
|
| 640 | - else { |
|
| 629 | + } else { |
|
| 641 | 630 | //remove all terms from post |
| 642 | 631 | $result = wp_set_object_terms( $postid, null, $taxonomy ); |
| 643 | 632 | } |
| 644 | 633 | |
| 645 | 634 | if ( ! is_wp_error( $result ) ) { |
| 646 | 635 | return true; |
| 647 | - }else{ |
|
| 636 | + } else{ |
|
| 648 | 637 | return false; |
| 649 | 638 | } |
| 650 | 639 | } |
@@ -714,9 +703,9 @@ discard block |
||
| 714 | 703 | $gallery_ids = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false; |
| 715 | 704 | if ( $_POST[ 'gallery_type' ] ) { |
| 716 | 705 | $type = $_POST[ 'gallery_type' ]; |
| 717 | - }elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { |
|
| 706 | + } elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { |
|
| 718 | 707 | $type = $options[ 'galleryType' ]; |
| 719 | - }else{ |
|
| 708 | + } else{ |
|
| 720 | 709 | $type = false; |
| 721 | 710 | } |
| 722 | 711 | |
@@ -795,13 +784,15 @@ discard block |
||
| 795 | 784 | |
| 796 | 785 | $month_numbers = range(1,12); |
| 797 | 786 | |
| 798 | - foreach($month_numbers as $month) |
|
| 799 | - $english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011)); |
|
| 787 | + foreach($month_numbers as $month) { |
|
| 788 | + $english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011)); |
|
| 789 | + } |
|
| 800 | 790 | |
| 801 | 791 | setlocale(LC_ALL, get_locale()); |
| 802 | 792 | |
| 803 | - foreach($month_numbers as $month) |
|
| 804 | - $foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011))); |
|
| 793 | + foreach($month_numbers as $month) { |
|
| 794 | + $foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011))); |
|
| 795 | + } |
|
| 805 | 796 | |
| 806 | 797 | return str_replace($foreign_months, $english_months, $foreignMonthName); |
| 807 | 798 | } |
@@ -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 | |
@@ -835,8 +835,8 @@ discard block |
||
| 835 | 835 | function lasso_editor_options_blob() { |
| 836 | 836 | |
| 837 | 837 | $codes = function_exists( 'aesop_shortcodes' ) ? aesop_shortcodes() : array(); |
| 838 | - $codes = add_wpimg_options( array() ); |
|
| 839 | - $codes = apply_filters( 'lasso_custom_options', $codes ); |
|
| 838 | + $codes = add_wpimg_options( array() ); |
|
| 839 | + $codes = apply_filters( 'lasso_custom_options', $codes ); |
|
| 840 | 840 | $galleries = function_exists( 'lasso_editor_galleries_exist' ) && lasso_editor_galleries_exist() ? 'has-galleries' : 'creating-gallery'; |
| 841 | 841 | |
| 842 | 842 | $nonce = wp_create_nonce( 'lasso_gallery' ); |
@@ -938,9 +938,9 @@ discard block |
||
| 938 | 938 | $return .= '</form>'; |
| 939 | 939 | |
| 940 | 940 | // extra JS codes |
| 941 | - if (isset($shortcode['codes'])) { |
|
| 942 | - $return .= $shortcode['codes']; |
|
| 943 | - } |
|
| 941 | + if (isset($shortcode['codes'])) { |
|
| 942 | + $return .= $shortcode['codes']; |
|
| 943 | + } |
|
| 944 | 944 | $blob[$slug] = $return; |
| 945 | 945 | } |
| 946 | 946 | |
@@ -950,59 +950,59 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | function add_wpimg_options( $shortcodes ) { |
| 952 | 952 | |
| 953 | - $custom = array( |
|
| 954 | - 'wpimg' => array( |
|
| 955 | - 'name' => __( 'Image', 'lasso' ), |
|
| 956 | - 'type' => 'single', |
|
| 957 | - 'atts' => array( |
|
| 958 | - 'img' => array( |
|
| 959 | - 'type' => 'media_upload', |
|
| 960 | - 'default' => '', |
|
| 961 | - 'desc' => __( 'Image URL', 'lasso' ), |
|
| 962 | - 'tip' => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' ) |
|
| 963 | - ), |
|
| 953 | + $custom = array( |
|
| 954 | + 'wpimg' => array( |
|
| 955 | + 'name' => __( 'Image', 'lasso' ), |
|
| 956 | + 'type' => 'single', |
|
| 957 | + 'atts' => array( |
|
| 958 | + 'img' => array( |
|
| 959 | + 'type' => 'media_upload', |
|
| 960 | + 'default' => '', |
|
| 961 | + 'desc' => __( 'Image URL', 'lasso' ), |
|
| 962 | + 'tip' => __( 'URL for the image. Click <em>Select Media</em> to open the WordPress Media Library.', 'aesop-core' ) |
|
| 963 | + ), |
|
| 964 | 964 | |
| 965 | - 'imgwidth' => array( |
|
| 966 | - 'type' => 'text_small', |
|
| 967 | - 'default' => '300px', |
|
| 968 | - 'desc' => __( 'Image Width', 'lasso' ), |
|
| 969 | - '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' ) |
|
| 970 | - ), |
|
| 971 | - 'imgheight' => array( |
|
| 972 | - 'type' => 'text_small', |
|
| 973 | - 'default' => '', |
|
| 974 | - 'desc' => __( 'Image Height', 'lasso' ), |
|
| 975 | - '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' ) |
|
| 976 | - ), |
|
| 965 | + 'imgwidth' => array( |
|
| 966 | + 'type' => 'text_small', |
|
| 967 | + 'default' => '300px', |
|
| 968 | + 'desc' => __( 'Image Width', 'lasso' ), |
|
| 969 | + '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' ) |
|
| 970 | + ), |
|
| 971 | + 'imgheight' => array( |
|
| 972 | + 'type' => 'text_small', |
|
| 973 | + 'default' => '', |
|
| 974 | + 'desc' => __( 'Image Height', 'lasso' ), |
|
| 975 | + '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' ) |
|
| 976 | + ), |
|
| 977 | 977 | |
| 978 | - 'link' => array( |
|
| 979 | - 'type' => 'text', |
|
| 980 | - 'default' => '', |
|
| 981 | - 'desc' => __( 'Link', 'lasso' ), |
|
| 982 | - 'tip' => __( 'URL link', 'lasso' ) |
|
| 983 | - ), |
|
| 984 | - 'alt' => array( |
|
| 985 | - 'type' => 'text', |
|
| 986 | - 'default' => '', |
|
| 987 | - 'desc' => __( 'Image ALT', 'lasso' ), |
|
| 988 | - 'tip' => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' ) |
|
| 989 | - ), |
|
| 978 | + 'link' => array( |
|
| 979 | + 'type' => 'text', |
|
| 980 | + 'default' => '', |
|
| 981 | + 'desc' => __( 'Link', 'lasso' ), |
|
| 982 | + 'tip' => __( 'URL link', 'lasso' ) |
|
| 983 | + ), |
|
| 984 | + 'alt' => array( |
|
| 985 | + 'type' => 'text', |
|
| 986 | + 'default' => '', |
|
| 987 | + 'desc' => __( 'Image ALT', 'lasso' ), |
|
| 988 | + 'tip' => __( 'ALT tag used for the image. Primarily used for SEO purposes.', 'lasso' ) |
|
| 989 | + ), |
|
| 990 | 990 | |
| 991 | - 'caption' => array( |
|
| 992 | - 'type' => 'text_area', |
|
| 993 | - 'default' => '', |
|
| 994 | - 'desc' => __( 'Caption', 'lasso' ), |
|
| 995 | - 'tip' => __( 'Optional caption for the image.', 'lasso' ) |
|
| 996 | - ), |
|
| 991 | + 'caption' => array( |
|
| 992 | + 'type' => 'text_area', |
|
| 993 | + 'default' => '', |
|
| 994 | + 'desc' => __( 'Caption', 'lasso' ), |
|
| 995 | + 'tip' => __( 'Optional caption for the image.', 'lasso' ) |
|
| 996 | + ), |
|
| 997 | 997 | |
| 998 | 998 | |
| 999 | - ), |
|
| 1000 | - 'desc' => __( 'An image.', 'aesop-core' ), |
|
| 1001 | - 'codes' => '' |
|
| 1002 | - ) |
|
| 1003 | - ); |
|
| 999 | + ), |
|
| 1000 | + 'desc' => __( 'An image.', 'aesop-core' ), |
|
| 1001 | + 'codes' => '' |
|
| 1002 | + ) |
|
| 1003 | + ); |
|
| 1004 | 1004 | |
| 1005 | - return array_merge( $shortcodes, $custom ); |
|
| 1005 | + return array_merge( $shortcodes, $custom ); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | /** |
@@ -1047,23 +1047,23 @@ discard block |
||
| 1047 | 1047 | * @return string |
| 1048 | 1048 | */ |
| 1049 | 1049 | function lasso_editor_adjustBrightness($hex, $steps) { |
| 1050 | - $steps = max(-255, min(255, $steps)); |
|
| 1050 | + $steps = max(-255, min(255, $steps)); |
|
| 1051 | 1051 | |
| 1052 | - // Normalize into a six character long hex string |
|
| 1053 | - $hex = str_replace('#', '', $hex); |
|
| 1054 | - if (strlen($hex) == 3) { |
|
| 1055 | - $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
| 1056 | - } |
|
| 1052 | + // Normalize into a six character long hex string |
|
| 1053 | + $hex = str_replace('#', '', $hex); |
|
| 1054 | + if (strlen($hex) == 3) { |
|
| 1055 | + $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
| 1056 | + } |
|
| 1057 | 1057 | |
| 1058 | - // Split into three parts: R, G and B |
|
| 1059 | - $color_parts = str_split($hex, 2); |
|
| 1060 | - $return = '#'; |
|
| 1058 | + // Split into three parts: R, G and B |
|
| 1059 | + $color_parts = str_split($hex, 2); |
|
| 1060 | + $return = '#'; |
|
| 1061 | 1061 | |
| 1062 | - foreach ($color_parts as $color) { |
|
| 1063 | - $color = hexdec($color); // Convert to decimal |
|
| 1064 | - $color = max(0,min(255,$color + $steps)); // Adjust color |
|
| 1065 | - $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
| 1066 | - } |
|
| 1062 | + foreach ($color_parts as $color) { |
|
| 1063 | + $color = hexdec($color); // Convert to decimal |
|
| 1064 | + $color = max(0,min(255,$color + $steps)); // Adjust color |
|
| 1065 | + $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
| 1066 | + } |
|
| 1067 | 1067 | |
| 1068 | - return $return; |
|
| 1068 | + return $return; |
|
| 1069 | 1069 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $edit_post_disabled = lasso_editor_get_option( 'post_edit_disabled', 'lasso_editor' ); |
| 108 | 108 | $post_settings_disabled = lasso_editor_get_option( 'post_settings_disabled', 'lasso_editor' ); |
| 109 | 109 | $allow_change_date = lasso_editor_get_option( 'allow_change_date', 'lasso_editor' ); |
| 110 | - $allow_edit_excerpt = lasso_editor_get_option( 'allow_edit_excerpt', 'lasso_editor' ); |
|
| 110 | + $allow_edit_excerpt = lasso_editor_get_option( 'allow_edit_excerpt', 'lasso_editor' ); |
|
| 111 | 111 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
| 112 | 112 | $shortcodify_disabled = lasso_editor_get_option( 'shortcodify_disabled', 'lasso_editor' ); |
| 113 | 113 | $enable_autosave = lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $bold_tag = lasso_editor_get_option( 'bold_tag', 'lasso_editor', "b"); |
| 133 | 133 | $i_tag = lasso_editor_get_option( 'i_tag', 'lasso_editor', "i"); |
| 134 | 134 | |
| 135 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 135 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 136 | 136 | |
| 137 | 137 | // do we support pending status |
| 138 | 138 | $no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor'); |
@@ -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> |
@@ -133,31 +133,31 @@ discard block |
||
| 133 | 133 | <li data-action="delrow"><?php echo __('Delete Row','lasso')?></li> |
| 134 | 134 | </ul> |
| 135 | 135 | <?php |
| 136 | - } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | - function editus_html_table() |
|
| 140 | - { |
|
| 141 | - 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>'; |
|
| 142 | - } |
|
| 139 | + function editus_html_table() |
|
| 140 | + { |
|
| 141 | + 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>'; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | 144 | |
| 145 | - function editus_components_add_table( $array ){ |
|
| 146 | - $custom = array( |
|
| 147 | - 'htmltable' => array( |
|
| 148 | - 'name' => __('HTML Table','lasso'), |
|
| 149 | - 'content' => self::editus_html_table(), |
|
| 150 | - ) |
|
| 151 | - ); |
|
| 152 | - return array_merge( $array, $custom ); |
|
| 153 | - } |
|
| 145 | + function editus_components_add_table( $array ){ |
|
| 146 | + $custom = array( |
|
| 147 | + 'htmltable' => array( |
|
| 148 | + 'name' => __('HTML Table','lasso'), |
|
| 149 | + 'content' => self::editus_html_table(), |
|
| 150 | + ) |
|
| 151 | + ); |
|
| 152 | + return array_merge( $array, $custom ); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | - function editus_toolbar_components_add_table( ) { |
|
| 157 | - ?> |
|
| 156 | + function editus_toolbar_components_add_table( ) { |
|
| 157 | + ?> |
|
| 158 | 158 | <li data-type="htmltable" title="<?php esc_attr_e( 'HTML Table', 'lasso' );?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li> |
| 159 | 159 | <?php |
| 160 | - } |
|
| 160 | + } |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |