@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | if ( !is_user_logged_in() ) |
| 99 | 99 | return; |
| 100 | 100 | |
| 101 | - // check for lasso story engine and add a class doniting this |
|
| 102 | - $ase_status = class_exists( 'Aesop_Core' ) || defined( 'LASSO_CUSTOM' ) ? 'ase-active' : 'ase-not-active'; |
|
| 101 | + // check for lasso story engine and add a class doniting this |
|
| 102 | + $ase_status = class_exists( 'Aesop_Core' ) || defined( 'LASSO_CUSTOM' ) ? 'ase-active' : 'ase-not-active'; |
|
| 103 | 103 | |
| 104 | 104 | $article_object = lasso_editor_get_option( 'article_class', 'lasso_editor' ); |
| 105 | 105 | $featImgClass = lasso_editor_get_option( 'featimg_class', 'lasso_editor' ); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $edit_post_disabled = lasso_editor_get_option( 'post_edit_disabled', 'lasso_editor' ); |
| 111 | 111 | $post_settings_disabled = lasso_editor_get_option( 'post_settings_disabled', 'lasso_editor' ); |
| 112 | 112 | $allow_change_date = lasso_editor_get_option( 'allow_change_date', 'lasso_editor' ); |
| 113 | - $allow_edit_excerpt = lasso_editor_get_option( 'allow_edit_excerpt', 'lasso_editor' ); |
|
| 113 | + $allow_edit_excerpt = lasso_editor_get_option( 'allow_edit_excerpt', 'lasso_editor' ); |
|
| 114 | 114 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
| 115 | 115 | $shortcodify_disabled = lasso_editor_get_option( 'shortcodify_disabled', 'lasso_editor' ); |
| 116 | 116 | $enable_autosave = lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $toolbar_show_color = lasso_editor_get_option( 'toolbar_show_color', 'lasso_editor' ); |
| 125 | 125 | $toolbar_show_alignment = lasso_editor_get_option( 'toolbar_show_alignment', 'lasso_editor' ); |
| 126 | 126 | |
| 127 | - $text_select_popup = lasso_editor_get_option('text_select_popup', 'lasso_editor', false); |
|
| 127 | + $text_select_popup = lasso_editor_get_option('text_select_popup', 'lasso_editor', false); |
|
| 128 | 128 | |
| 129 | 129 | $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
| 130 | 130 | $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | $bold_tag = lasso_editor_get_option( 'bold_tag', 'lasso_editor', "b"); |
| 140 | 140 | $i_tag = lasso_editor_get_option( 'i_tag', 'lasso_editor', "i"); |
| 141 | 141 | |
| 142 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 143 | - $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
| 142 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 143 | + $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
| 144 | 144 | |
| 145 | 145 | // do we support pending status |
| 146 | 146 | $no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor'); |
@@ -152,17 +152,17 @@ discard block |
||
| 152 | 152 | $insert_comp_ui = 'drag'; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor'); |
|
| 155 | + $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor'); |
|
| 156 | 156 | $inherit_categories = lasso_editor_get_option('inherit_categories', 'lasso_editor'); |
| 157 | 157 | |
| 158 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 159 | - $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 158 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 159 | + $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 160 | 160 | |
| 161 | 161 | $support_custom_taxonomy = lasso_editor_get_option( 'support_custom_taxonomy', 'lasso_editor' ); |
| 162 | 162 | |
| 163 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 163 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 164 | 164 | |
| 165 | - $no_wrap_shortcode = lasso_editor_get_option( 'no_wrap_shortcode', 'lasso_editor'); |
|
| 165 | + $no_wrap_shortcode = lasso_editor_get_option( 'no_wrap_shortcode', 'lasso_editor'); |
|
| 166 | 166 | |
| 167 | 167 | ?> |
| 168 | 168 | <div class="wrap"> |
@@ -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,13 +90,13 @@ 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 | - $use_wpimgblock = false; |
|
| 95 | + $use_wpimgblock = false; |
|
| 96 | 96 | |
| 97 | - $text_select_popup = lasso_editor_get_option('text_select_popup', 'lasso_editor', false); |
|
| 97 | + $text_select_popup = lasso_editor_get_option('text_select_popup', 'lasso_editor', false); |
|
| 98 | 98 | |
| 99 | - $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor', 'off'); |
|
| 99 | + $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor', 'off'); |
|
| 100 | 100 | $inherit_categories = lasso_editor_get_option('inherit_categories', 'lasso_editor', 'off'); |
| 101 | 101 | |
| 102 | 102 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | //disable shortcode editing |
| 116 | 116 | $disable_shortcode_editing = lasso_editor_get_option('disable_shortcode_editing', 'lasso_editor'); |
| 117 | 117 | |
| 118 | - // support custom taxonomy |
|
| 118 | + // support custom taxonomy |
|
| 119 | 119 | $support_custom_taxonomy = lasso_editor_get_option('support_custom_taxonomy', 'lasso_editor'); |
| 120 | 120 | |
| 121 | 121 | if ($show_color) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $tz_offset = get_UTC_offset(); |
| 142 | 142 | $post_date = get_the_time('U', $postid); |
| 143 | 143 | $time = (time()+$tz_offset); |
| 144 | - $delta = $time - $post_date; |
|
| 144 | + $delta = $time - $post_date; |
|
| 145 | 145 | |
| 146 | 146 | $strings = array( |
| 147 | 147 | 'save' => __('Save','lasso'), |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | 'catsPlaceholder' => __('add categories...'), |
| 187 | 187 | 'tagsPlaceholder' => __('add tags...'), |
| 188 | - 'taxoPlaceholder' => __('add taxonomy terms...'), |
|
| 188 | + 'taxoPlaceholder' => __('add taxonomy terms...'), |
|
| 189 | 189 | 'editShortcode' => __('Edit Shortcode'), |
| 190 | 190 | |
| 191 | 191 | |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
| 199 | 199 | |
| 200 | 200 | |
| 201 | - if ($allow_change_date) { |
|
| 202 | - $permalink = get_site_url().'/?p='.$postid; |
|
| 203 | - } else { |
|
| 204 | - $permalink = get_permalink($postid); |
|
| 205 | - } |
|
| 201 | + if ($allow_change_date) { |
|
| 202 | + $permalink = get_site_url().'/?p='.$postid; |
|
| 203 | + } else { |
|
| 204 | + $permalink = get_permalink($postid); |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | 207 | // rest api |
| 208 | 208 | $rest_nonce = ''; |
@@ -222,17 +222,17 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - //excerpt |
|
| 226 | - $post_excerpt = ""; |
|
| 227 | - $post_excerpt = wp_strip_all_tags($post->post_excerpt,true); |
|
| 225 | + //excerpt |
|
| 226 | + $post_excerpt = ""; |
|
| 227 | + $post_excerpt = wp_strip_all_tags($post->post_excerpt,true); |
|
| 228 | 228 | |
| 229 | - //find if this is multi page. -1 if not |
|
| 230 | - $multipage = self::is_multipage(); |
|
| 231 | - $post_content = ""; |
|
| 232 | - //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 233 | - //if ($multipage != -1) { |
|
| 234 | - $post_content = $post->post_content; |
|
| 235 | - //} |
|
| 229 | + //find if this is multi page. -1 if not |
|
| 230 | + $multipage = self::is_multipage(); |
|
| 231 | + $post_content = ""; |
|
| 232 | + //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 233 | + //if ($multipage != -1) { |
|
| 234 | + $post_content = $post->post_content; |
|
| 235 | + //} |
|
| 236 | 236 | |
| 237 | 237 | //get custom taxonomy |
| 238 | 238 | $custom_taxonomies = array_diff(get_object_taxonomies( get_post_type( $postid ), 'names' ), ['category','post_tag','post_format']); |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | $existing_taxo_arr[$taxonomy] = lasso_get_objects( $taxonomy ); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 249 | - $new_post_text = !empty($new_post_text) ? $new_post_text : wp_strip_all_tags(apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso'))); |
|
| 248 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 249 | + $new_post_text = !empty($new_post_text) ? $new_post_text : wp_strip_all_tags(apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso'))); |
|
| 250 | 250 | |
| 251 | 251 | wp_reset_query(); |
| 252 | 252 | $cat_new_post = ($inherit_categories =='on' && !is_home() && !is_page()) ? get_the_category() : null; |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | 'nonce' => wp_create_nonce('lasso_editor'), |
| 279 | 279 | 'handle' => lasso_editor_settings_toolbar(), |
| 280 | 280 | 'toolbar' => lasso_editor_text_toolbar(), |
| 281 | - 'toolbarPopup' => $text_select_popup ? lasso_editor_selected_text_toolbar(): false, |
|
| 281 | + 'toolbarPopup' => $text_select_popup ? lasso_editor_selected_text_toolbar(): false, |
|
| 282 | 282 | 'toolbarHeadings' => $toolbar_headings, |
| 283 | 283 | 'toolbarHeadingsH4' => $toolbar_headings_h4, |
| 284 | 284 | 'component_modal' => lasso_editor_component_modal(), |
@@ -331,19 +331,19 @@ discard block |
||
| 331 | 331 | 'customFields' => $custom_fields, |
| 332 | 332 | 'clickToInsert' => ($insert_comp_ui =='click'), |
| 333 | 333 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
| 334 | - 'rtl' => is_rtl(), |
|
| 334 | + 'rtl' => is_rtl(), |
|
| 335 | 335 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
| 336 | 336 | 'linksEditable' => $links_editable, |
| 337 | 337 | 'supportPendingStatus' => !$no_pending_status, |
| 338 | 338 | '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>'), |
| 339 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 340 | - 'multipages'=> $multipage, |
|
| 341 | - 'post_content'=>$post_content, |
|
| 342 | - 'post_excerpt'=>$post_excerpt, |
|
| 343 | - 'supCustTaxo' => $support_custom_taxonomy == 'on', |
|
| 344 | - 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 345 | - 'useWPImgBlk'=> $use_wpimgblock, |
|
| 346 | - 'prefixHTTP'=> $link_prefix_http =='on', |
|
| 339 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 340 | + 'multipages'=> $multipage, |
|
| 341 | + 'post_content'=>$post_content, |
|
| 342 | + 'post_excerpt'=>$post_excerpt, |
|
| 343 | + 'supCustTaxo' => $support_custom_taxonomy == 'on', |
|
| 344 | + 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 345 | + 'useWPImgBlk'=> $use_wpimgblock, |
|
| 346 | + 'prefixHTTP'=> $link_prefix_http =='on', |
|
| 347 | 347 | 'currCat'=> $cat_new_post |
| 348 | 348 | ); |
| 349 | 349 | |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | |
| 354 | 354 | if (!$using_restapiv2) { |
| 355 | - // enqueue REST API V1 |
|
| 355 | + // enqueue REST API V1 |
|
| 356 | 356 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
| 357 | 357 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
| 358 | 358 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | if ($show_color) { |
| 369 | 369 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
| 370 | 370 | } else { |
| 371 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 371 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 372 | 372 | } |
| 373 | 373 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
| 374 | 374 | |
@@ -377,44 +377,44 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - function gutenberg_active() { |
|
| 380 | + function gutenberg_active() { |
|
| 381 | 381 | |
| 382 | - // Gutenberg plugin is installed and activated. |
|
| 383 | - $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 384 | - |
|
| 385 | - // Block editor since 5.0. |
|
| 386 | - $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 387 | - |
|
| 388 | - if ( ! $gutenberg && ! $block_editor ) { |
|
| 389 | - return false; |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - if ( self::is_classic_editor_plugin_active() ) { |
|
| 393 | - $editor_option = get_option( 'classic-editor-replace' ); |
|
| 394 | - $block_editor_active = array( 'no-replace', 'block' ); |
|
| 395 | - |
|
| 396 | - return in_array( $editor_option, $block_editor_active, true ); |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - return true; |
|
| 400 | - } |
|
| 401 | - |
|
| 402 | - /** |
|
| 403 | - * Check if Classic Editor plugin is active. |
|
| 404 | - * |
|
| 405 | - * @return bool |
|
| 406 | - */ |
|
| 407 | - function is_classic_editor_plugin_active() { |
|
| 408 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 409 | - include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 410 | - } |
|
| 411 | - |
|
| 412 | - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 413 | - return true; |
|
| 414 | - } |
|
| 415 | - |
|
| 416 | - return false; |
|
| 417 | - } |
|
| 382 | + // Gutenberg plugin is installed and activated. |
|
| 383 | + $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 384 | + |
|
| 385 | + // Block editor since 5.0. |
|
| 386 | + $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 387 | + |
|
| 388 | + if ( ! $gutenberg && ! $block_editor ) { |
|
| 389 | + return false; |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + if ( self::is_classic_editor_plugin_active() ) { |
|
| 393 | + $editor_option = get_option( 'classic-editor-replace' ); |
|
| 394 | + $block_editor_active = array( 'no-replace', 'block' ); |
|
| 395 | + |
|
| 396 | + return in_array( $editor_option, $block_editor_active, true ); |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + return true; |
|
| 400 | + } |
|
| 401 | + |
|
| 402 | + /** |
|
| 403 | + * Check if Classic Editor plugin is active. |
|
| 404 | + * |
|
| 405 | + * @return bool |
|
| 406 | + */ |
|
| 407 | + function is_classic_editor_plugin_active() { |
|
| 408 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 409 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 410 | + } |
|
| 411 | + |
|
| 412 | + if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 413 | + return true; |
|
| 414 | + } |
|
| 415 | + |
|
| 416 | + return false; |
|
| 417 | + } |
|
| 418 | 418 | |
| 419 | 419 | } |
| 420 | 420 | |