@@ -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 |
@@ -236,16 +236,16 @@ discard block |
||
| 236 | 236 | if ( !function_exists('lasso_wp_image') ): |
| 237 | 237 | |
| 238 | 238 | function lasso_wp_image(){ |
| 239 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 240 | - $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 241 | - if ($use_wp_block_image == 'on') { |
|
| 242 | - return '<figure class="wp-block-image size-large" data-component-type="wpimg-block"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
|
| 243 | - } |
|
| 244 | - else if ($use_old_wpimg != 'on') { |
|
| 245 | - return '<figure data-component-type="wpimg" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
|
| 246 | - } else { |
|
| 247 | - 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"></figure><p><br></p>'; |
|
| 248 | - } |
|
| 239 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 240 | + $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 241 | + if ($use_wp_block_image == 'on') { |
|
| 242 | + return '<figure class="wp-block-image size-large" data-component-type="wpimg-block"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
|
| 243 | + } |
|
| 244 | + else if ($use_old_wpimg != 'on') { |
|
| 245 | + return '<figure data-component-type="wpimg" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
|
| 246 | + } else { |
|
| 247 | + 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"></figure><p><br></p>'; |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | endif; |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | if ( !function_exists('lasso_wp_image_block') ): |
| 289 | 289 | function lasso_wp_image_block(){ |
| 290 | - return '<figure class="wp-block-image size-large" data-component-type="wpimg-block"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
|
| 290 | + return '<figure class="wp-block-image size-large" data-component-type="wpimg-block"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | endif; |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - do_action( 'editus_after_meta_update', $post_id, $data ); |
|
| 55 | + do_action( 'editus_after_meta_update', $post_id, $data ); |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | return true; |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | if ( empty( $postid ) ) |
| 200 | 200 | $postid = get_the_ID(); |
| 201 | 201 | |
| 202 | - if ('category' == $taxonomy) { |
|
| 203 | - $objects = get_the_category( $postid ); |
|
| 204 | - } else if ('tag' == $taxonomy) { |
|
| 205 | - $objects = get_the_tags( $postid ); |
|
| 206 | - } else { |
|
| 207 | - $objects = get_the_terms( $postid, $taxonomy ); |
|
| 208 | - } |
|
| 202 | + if ('category' == $taxonomy) { |
|
| 203 | + $objects = get_the_category( $postid ); |
|
| 204 | + } else if ('tag' == $taxonomy) { |
|
| 205 | + $objects = get_the_tags( $postid ); |
|
| 206 | + } else { |
|
| 207 | + $objects = get_the_terms( $postid, $taxonomy ); |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | 210 | if ( empty( $objects) ) |
| 211 | 211 | return; |
@@ -227,16 +227,16 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | function lasso_get_objects( $taxonomy = 'category' ) { |
| 229 | 229 | |
| 230 | - if ('category' == $taxonomy) { |
|
| 231 | - $objects = get_categories(array('hide_empty' => 0)); |
|
| 232 | - } else if ('tag' == $taxonomy) { |
|
| 233 | - $objects = get_tags(array('hide_empty' => 0)); |
|
| 234 | - } else { |
|
| 235 | - $objects = get_terms( array( |
|
| 236 | - 'taxonomy' => $taxonomy, |
|
| 237 | - 'hide_empty' => false, |
|
| 238 | - )); |
|
| 239 | - } |
|
| 230 | + if ('category' == $taxonomy) { |
|
| 231 | + $objects = get_categories(array('hide_empty' => 0)); |
|
| 232 | + } else if ('tag' == $taxonomy) { |
|
| 233 | + $objects = get_tags(array('hide_empty' => 0)); |
|
| 234 | + } else { |
|
| 235 | + $objects = get_terms( array( |
|
| 236 | + 'taxonomy' => $taxonomy, |
|
| 237 | + 'hide_empty' => false, |
|
| 238 | + )); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | if ( empty( $objects) ) |
| 242 | 242 | return; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | 'public' => true, |
| 262 | 262 | ), 'objects' ); |
| 263 | 263 | $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
| 264 | - unset( $post_types[ 'attachment' ] ); |
|
| 264 | + unset( $post_types[ 'attachment' ] ); |
|
| 265 | 265 | |
| 266 | 266 | /** |
| 267 | 267 | * Set which post types are allowed |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $post_types = get_post_types( array( |
| 289 | 289 | 'public' => true, |
| 290 | 290 | ), 'names' ); |
| 291 | - unset( $post_types[ 'attachment' ] ); |
|
| 291 | + unset( $post_types[ 'attachment' ] ); |
|
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | 294 | * Set which post types are allowed |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | if ( !function_exists( 'lasso_user_can' ) ): |
| 402 | 402 | function lasso_user_can( $action = '', $postid = 0 ) { |
| 403 | - $result = false; |
|
| 403 | + $result = false; |
|
| 404 | 404 | if ( empty( $action ) ) |
| 405 | 405 | $action = 'edit_posts'; |
| 406 | 406 | |
@@ -415,17 +415,17 @@ discard block |
||
| 415 | 415 | $allowed_post_types = array_diff($allowed_post_types,array('page')); |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if (!empty($allowed_post_types) && !empty($postid)) { |
|
| 418 | + if (!empty($allowed_post_types) && !empty($postid)) { |
|
| 419 | 419 | $type = get_post_type( $postid ); |
| 420 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 420 | + $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 421 | 421 | |
| 422 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
| 422 | + if ( in_array( $type, $allowed_post_types ) ) { |
|
| 423 | 423 | $result = true; |
| 424 | - } |
|
| 425 | - } else { |
|
| 426 | - //we are not checking against a post, return true |
|
| 424 | + } |
|
| 425 | + } else { |
|
| 426 | + //we are not checking against a post, return true |
|
| 427 | 427 | $result = true; |
| 428 | - } |
|
| 428 | + } |
|
| 429 | 429 | } else { |
| 430 | 430 | $result = false; |
| 431 | 431 | } |
@@ -34,8 +34,8 @@ |
||
| 34 | 34 | |
| 35 | 35 | $object = is_null( $data[ 'object'] ) ? false : $data[ 'object' ]; |
| 36 | 36 | |
| 37 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 38 | - $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'))); |
|
| 37 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 38 | + $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'))); |
|
| 39 | 39 | |
| 40 | 40 | // insert a new post |
| 41 | 41 | $args = array( |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | function lasso_wrap_shortcodes( $content ) { |
| 24 | 24 | global $shortcode_tags; |
| 25 | 25 | |
| 26 | - $no_wrap_shortcode = lasso_editor_get_option( 'no_wrap_shortcode', 'lasso_editor'); |
|
| 26 | + $no_wrap_shortcode = lasso_editor_get_option( 'no_wrap_shortcode', 'lasso_editor'); |
|
| 27 | 27 | |
| 28 | - if ($no_wrap_shortcode == 'on') { |
|
| 29 | - return $content; |
|
| 30 | - } |
|
| 28 | + if ($no_wrap_shortcode == 'on') { |
|
| 29 | + return $content; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | if ( false === strpos( $content, '[' ) ) { |
| 33 | 33 | return $content; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | if ( strpos( $m[2],'aesop_' ) === 0 ) { |
| 79 | 79 | // check against the exceptions |
| 80 | 80 | if (strpos_arr($m[2],$exception_arr1)===false) { |
| 81 | - return $m[0]; |
|
| 81 | + return $m[0]; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | if (strpos_arr($m[2],$exception_arr2)!==false) { |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | /* a helper function */ |
| 92 | 92 | function strpos_arr($haystack, $needle) { |
| 93 | - if(!is_array($needle)) $needle = array($needle); |
|
| 94 | - foreach($needle as $what) { |
|
| 95 | - if(($pos = strpos($haystack, $what))!==false) return $pos; |
|
| 96 | - } |
|
| 97 | - return false; |
|
| 93 | + if(!is_array($needle)) $needle = array($needle); |
|
| 94 | + foreach($needle as $what) { |
|
| 95 | + if(($pos = strpos($haystack, $what))!==false) return $pos; |
|
| 96 | + } |
|
| 97 | + return false; |
|
| 98 | 98 | } |
| 99 | 99 | \ No newline at end of file |
@@ -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 | |
| 101 | 101 | |
| 102 | 102 | //text alignement |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // allow change date for post |
| 112 | 112 | $allow_change_date = lasso_editor_get_option('allow_change_date', 'lasso_editor'); |
| 113 | 113 | |
| 114 | - // support custom taxonomy |
|
| 114 | + // support custom taxonomy |
|
| 115 | 115 | $support_custom_taxonomy = lasso_editor_get_option('support_custom_taxonomy', 'lasso_editor'); |
| 116 | 116 | |
| 117 | 117 | if ($show_color) { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $tz_offset = get_UTC_offset(); |
| 138 | 138 | $post_date = get_the_time('U', $postid); |
| 139 | 139 | $time = (time()+$tz_offset); |
| 140 | - $delta = $time - $post_date; |
|
| 140 | + $delta = $time - $post_date; |
|
| 141 | 141 | |
| 142 | 142 | $strings = array( |
| 143 | 143 | 'save' => __('Save','lasso'), |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | 'catsPlaceholder' => __('add categories...'), |
| 183 | 183 | 'tagsPlaceholder' => __('add tags...'), |
| 184 | - 'taxoPlaceholder' => __('add taxonomy terms...'), |
|
| 184 | + 'taxoPlaceholder' => __('add taxonomy terms...'), |
|
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | ); |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
| 194 | 194 | |
| 195 | 195 | |
| 196 | - if ($allow_change_date) { |
|
| 197 | - $permalink = get_site_url().'/?p='.$postid; |
|
| 198 | - } else { |
|
| 199 | - $permalink = get_permalink($postid); |
|
| 200 | - } |
|
| 196 | + if ($allow_change_date) { |
|
| 197 | + $permalink = get_site_url().'/?p='.$postid; |
|
| 198 | + } else { |
|
| 199 | + $permalink = get_permalink($postid); |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | 202 | // rest api |
| 203 | 203 | $rest_nonce = ''; |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - //excerpt |
|
| 221 | - $post_excerpt = ""; |
|
| 222 | - $post_excerpt = wp_strip_all_tags($post->post_excerpt,true); |
|
| 220 | + //excerpt |
|
| 221 | + $post_excerpt = ""; |
|
| 222 | + $post_excerpt = wp_strip_all_tags($post->post_excerpt,true); |
|
| 223 | 223 | |
| 224 | - //find if this is multi page. -1 if not |
|
| 225 | - $multipage = self::is_multipage(); |
|
| 226 | - $post_content = ""; |
|
| 227 | - //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 228 | - //if ($multipage != -1) { |
|
| 229 | - $post_content = $post->post_content; |
|
| 230 | - //} |
|
| 224 | + //find if this is multi page. -1 if not |
|
| 225 | + $multipage = self::is_multipage(); |
|
| 226 | + $post_content = ""; |
|
| 227 | + //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
| 228 | + //if ($multipage != -1) { |
|
| 229 | + $post_content = $post->post_content; |
|
| 230 | + //} |
|
| 231 | 231 | |
| 232 | 232 | //get custom taxonomy |
| 233 | 233 | $custom_taxonomies = array_diff(get_object_taxonomies( get_post_type( $postid ), 'names' ), ['category','post_tag','post_format']); |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | $existing_taxo_arr[$taxonomy] = lasso_get_objects( $taxonomy ); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 244 | - $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'))); |
|
| 243 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 244 | + $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'))); |
|
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | // localized objects |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | 'nonce' => wp_create_nonce('lasso_editor'), |
| 271 | 271 | 'handle' => lasso_editor_settings_toolbar(), |
| 272 | 272 | 'toolbar' => lasso_editor_text_toolbar(), |
| 273 | - 'toolbarPopup' => $text_select_popup ? lasso_editor_selected_text_toolbar(): false, |
|
| 273 | + 'toolbarPopup' => $text_select_popup ? lasso_editor_selected_text_toolbar(): false, |
|
| 274 | 274 | 'toolbarHeadings' => $toolbar_headings, |
| 275 | 275 | 'toolbarHeadingsH4' => $toolbar_headings_h4, |
| 276 | 276 | 'component_modal' => lasso_editor_component_modal(), |
@@ -322,19 +322,19 @@ discard block |
||
| 322 | 322 | 'customFields' => $custom_fields, |
| 323 | 323 | 'clickToInsert' => ($insert_comp_ui =='click'), |
| 324 | 324 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
| 325 | - 'rtl' => is_rtl(), |
|
| 325 | + 'rtl' => is_rtl(), |
|
| 326 | 326 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
| 327 | 327 | 'linksEditable' => $links_editable, |
| 328 | 328 | 'supportPendingStatus' => !$no_pending_status, |
| 329 | 329 | '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>'), |
| 330 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 331 | - 'multipages'=> $multipage, |
|
| 332 | - 'post_content'=>$post_content, |
|
| 333 | - 'post_excerpt'=>$post_excerpt, |
|
| 334 | - 'supCustTaxo' => $support_custom_taxonomy == 'on', |
|
| 335 | - 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 336 | - 'useWPImgBlk'=> $use_wpimgblock, |
|
| 337 | - 'prefixHTTP'=> $link_prefix_http =='on' |
|
| 330 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
| 331 | + 'multipages'=> $multipage, |
|
| 332 | + 'post_content'=>$post_content, |
|
| 333 | + 'post_excerpt'=>$post_excerpt, |
|
| 334 | + 'supCustTaxo' => $support_custom_taxonomy == 'on', |
|
| 335 | + 'oldWPimg'=> $use_old_wpimg =='on', |
|
| 336 | + 'useWPImgBlk'=> $use_wpimgblock, |
|
| 337 | + 'prefixHTTP'=> $link_prefix_http =='on' |
|
| 338 | 338 | ); |
| 339 | 339 | |
| 340 | 340 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | |
| 344 | 344 | if (!$using_restapiv2) { |
| 345 | - // enqueue REST API V1 |
|
| 345 | + // enqueue REST API V1 |
|
| 346 | 346 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
| 347 | 347 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
| 348 | 348 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | if ($show_color) { |
| 359 | 359 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
| 360 | 360 | } else { |
| 361 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 361 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
| 362 | 362 | } |
| 363 | 363 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
| 364 | 364 | |
@@ -367,44 +367,44 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - function gutenberg_active() { |
|
| 370 | + function gutenberg_active() { |
|
| 371 | 371 | |
| 372 | - // Gutenberg plugin is installed and activated. |
|
| 373 | - $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 374 | - |
|
| 375 | - // Block editor since 5.0. |
|
| 376 | - $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 377 | - |
|
| 378 | - if ( ! $gutenberg && ! $block_editor ) { |
|
| 379 | - return false; |
|
| 380 | - } |
|
| 381 | - |
|
| 382 | - if ( self::is_classic_editor_plugin_active() ) { |
|
| 383 | - $editor_option = get_option( 'classic-editor-replace' ); |
|
| 384 | - $block_editor_active = array( 'no-replace', 'block' ); |
|
| 385 | - |
|
| 386 | - return in_array( $editor_option, $block_editor_active, true ); |
|
| 387 | - } |
|
| 388 | - |
|
| 389 | - return true; |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - /** |
|
| 393 | - * Check if Classic Editor plugin is active. |
|
| 394 | - * |
|
| 395 | - * @return bool |
|
| 396 | - */ |
|
| 397 | - function is_classic_editor_plugin_active() { |
|
| 398 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 399 | - include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 400 | - } |
|
| 401 | - |
|
| 402 | - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 403 | - return true; |
|
| 404 | - } |
|
| 405 | - |
|
| 406 | - return false; |
|
| 407 | - } |
|
| 372 | + // Gutenberg plugin is installed and activated. |
|
| 373 | + $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
| 374 | + |
|
| 375 | + // Block editor since 5.0. |
|
| 376 | + $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
| 377 | + |
|
| 378 | + if ( ! $gutenberg && ! $block_editor ) { |
|
| 379 | + return false; |
|
| 380 | + } |
|
| 381 | + |
|
| 382 | + if ( self::is_classic_editor_plugin_active() ) { |
|
| 383 | + $editor_option = get_option( 'classic-editor-replace' ); |
|
| 384 | + $block_editor_active = array( 'no-replace', 'block' ); |
|
| 385 | + |
|
| 386 | + return in_array( $editor_option, $block_editor_active, true ); |
|
| 387 | + } |
|
| 388 | + |
|
| 389 | + return true; |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + /** |
|
| 393 | + * Check if Classic Editor plugin is active. |
|
| 394 | + * |
|
| 395 | + * @return bool |
|
| 396 | + */ |
|
| 397 | + function is_classic_editor_plugin_active() { |
|
| 398 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 399 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 400 | + } |
|
| 401 | + |
|
| 402 | + if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
| 403 | + return true; |
|
| 404 | + } |
|
| 405 | + |
|
| 406 | + return false; |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | 409 | } |
| 410 | 410 | |
@@ -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><br></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><br></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 | |
@@ -169,41 +169,41 @@ discard block |
||
| 169 | 169 | //table codes to be added |
| 170 | 170 | class editus_paragraph { |
| 171 | 171 | |
| 172 | - public function __construct(){ |
|
| 173 | - $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
| 174 | - if ($add_paragraph) { |
|
| 175 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
| 172 | + public function __construct(){ |
|
| 173 | + $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
| 174 | + if ($add_paragraph) { |
|
| 175 | + add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
| 176 | 176 | |
| 177 | - } |
|
| 177 | + } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - function scripts() |
|
| 181 | - { |
|
| 182 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_paragraph_style')); |
|
| 183 | - add_filter('lasso_components',array($this,'editus_components_add_paragraph'),10,1); |
|
| 184 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_paragraph'), 10 ); |
|
| 185 | - //wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
| 186 | - //wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
| 187 | - } |
|
| 180 | + function scripts() |
|
| 181 | + { |
|
| 182 | + add_action('lasso_editor_controls_after_outside', array($this,'editus_paragraph_style')); |
|
| 183 | + add_filter('lasso_components',array($this,'editus_components_add_paragraph'),10,1); |
|
| 184 | + add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_paragraph'), 10 ); |
|
| 185 | + //wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
| 186 | + //wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - function editus_components_add_paragraph( $array ){ |
|
| 190 | - $custom = array( |
|
| 191 | - 'htmlparagraph' => array( |
|
| 192 | - 'name' => __('HTML Paragraph','lasso'), |
|
| 193 | - 'content' => self::editus_html_paragraph(), |
|
| 194 | - ) |
|
| 195 | - ); |
|
| 196 | - return array_merge( $array, $custom ); |
|
| 197 | - } |
|
| 189 | + function editus_components_add_paragraph( $array ){ |
|
| 190 | + $custom = array( |
|
| 191 | + 'htmlparagraph' => array( |
|
| 192 | + 'name' => __('HTML Paragraph','lasso'), |
|
| 193 | + 'content' => self::editus_html_paragraph(), |
|
| 194 | + ) |
|
| 195 | + ); |
|
| 196 | + return array_merge( $array, $custom ); |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | 199 | |
| 200 | - function editus_html_paragraph() |
|
| 201 | - { |
|
| 202 | - return '<p contenteditable="true"><br></p>'; |
|
| 203 | - } |
|
| 200 | + function editus_html_paragraph() |
|
| 201 | + { |
|
| 202 | + return '<p contenteditable="true"><br></p>'; |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - function editus_paragraph_style() |
|
| 206 | - { ?> |
|
| 205 | + function editus_paragraph_style() |
|
| 206 | + { ?> |
|
| 207 | 207 | <style> |
| 208 | 208 | #lasso-toolbar--components__list .lasso-toolbar--component__htmlparagraph:before |
| 209 | 209 | { |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | </style> |
| 214 | 214 | <?php |
| 215 | - } |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | 217 | |
| 218 | - function editus_toolbar_components_add_paragraph( ) { |
|
| 219 | - ?> |
|
| 218 | + function editus_toolbar_components_add_paragraph( ) { |
|
| 219 | + ?> |
|
| 220 | 220 | <li data-type="htmlparagraph" title="<?php esc_attr_e( 'HTML Paragraph', 'lasso' );?>" class="quote lasso-toolbar--component__htmlparagraph dashicons dashicons-editor-paragraph"></li> |
| 221 | 221 | <?php |
| 222 | - } |
|
| 222 | + } |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | new editus_paragraph(); |
@@ -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' ); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $toolbar_show_color = lasso_editor_get_option( 'toolbar_show_color', 'lasso_editor' ); |
| 123 | 123 | $toolbar_show_alignment = lasso_editor_get_option( 'toolbar_show_alignment', 'lasso_editor' ); |
| 124 | 124 | |
| 125 | - $text_select_popup = lasso_editor_get_option('text_select_popup', 'lasso_editor', false); |
|
| 125 | + $text_select_popup = lasso_editor_get_option('text_select_popup', 'lasso_editor', false); |
|
| 126 | 126 | |
| 127 | 127 | $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
| 128 | 128 | $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | $bold_tag = lasso_editor_get_option( 'bold_tag', 'lasso_editor', "b"); |
| 138 | 138 | $i_tag = lasso_editor_get_option( 'i_tag', 'lasso_editor', "i"); |
| 139 | 139 | |
| 140 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 141 | - $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
| 140 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
| 141 | + $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
| 142 | 142 | |
| 143 | 143 | // do we support pending status |
| 144 | 144 | $no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor'); |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | $insert_comp_ui = 'drag'; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor'); |
|
| 153 | + $link_prefix_http = lasso_editor_get_option('link_prefix_http', 'lasso_editor'); |
|
| 154 | 154 | |
| 155 | - $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 156 | - $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 155 | + $use_old_wpimg = lasso_editor_get_option('use_old_wpimg', 'lasso_editor','off'); |
|
| 156 | + $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
|
| 157 | 157 | |
| 158 | 158 | $support_custom_taxonomy = lasso_editor_get_option( 'support_custom_taxonomy', 'lasso_editor' ); |
| 159 | 159 | |
| 160 | - $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 160 | + $new_post_text = lasso_editor_get_option( 'new_post_text', 'lasso_editor' ); |
|
| 161 | 161 | |
| 162 | - $no_wrap_shortcode = lasso_editor_get_option( 'no_wrap_shortcode', 'lasso_editor'); |
|
| 162 | + $no_wrap_shortcode = lasso_editor_get_option( 'no_wrap_shortcode', 'lasso_editor'); |
|
| 163 | 163 | |
| 164 | 164 | ?> |
| 165 | 165 | <div class="wrap"> |