@@ -15,30 +15,30 @@ 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 | - echo $index; |
|
28 | - return $index; |
|
29 | - } |
|
24 | + global $wp; |
|
25 | + $url = home_url( $wp->request ); |
|
26 | + $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1; |
|
27 | + echo $index; |
|
28 | + return $index; |
|
29 | + } |
|
30 | 30 | |
31 | 31 | public function scripts(){ |
32 | 32 | |
33 | 33 | |
34 | 34 | global $post; |
35 | 35 | if ( lasso_user_can('edit_posts') |
36 | - /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
37 | - /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
38 | - ) { |
|
36 | + /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
37 | + /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
38 | + ) { |
|
39 | 39 | |
40 | 40 | /** Returns the time offset from UTC |
41 | - */ |
|
41 | + */ |
|
42 | 42 | function get_UTC_offset() { |
43 | 43 | $timezone_string = get_option( 'timezone_string' ); |
44 | 44 | if (empty( $timezone_string ) ) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
55 | 55 | |
56 | - //don't load autocomplete if it's a stockholm theme |
|
56 | + //don't load autocomplete if it's a stockholm theme |
|
57 | 57 | $themename = wp_get_theme()->get('Name'); |
58 | 58 | if ($themename !='Stockholm' ) { |
59 | 59 | wp_enqueue_script('jquery-ui-autocomplete'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $tz_offset = get_UTC_offset(); |
129 | 129 | $post_date = get_the_time('U', $postid); |
130 | 130 | $time = (time()+$tz_offset); |
131 | - $delta = $time - $post_date; |
|
131 | + $delta = $time - $post_date; |
|
132 | 132 | |
133 | 133 | $strings = array( |
134 | 134 | 'save' => __('Save','lasso'), |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
184 | 184 | |
185 | 185 | |
186 | - if ($allow_change_date) { |
|
187 | - $permalink = get_site_url().'/?p='.$postid; |
|
188 | - } else { |
|
189 | - $permalink = get_permalink($postid); |
|
190 | - } |
|
186 | + if ($allow_change_date) { |
|
187 | + $permalink = get_site_url().'/?p='.$postid; |
|
188 | + } else { |
|
189 | + $permalink = get_permalink($postid); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | // rest api |
193 | 193 | $rest_nonce = ''; |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | - //find if this is multi page |
|
211 | - $multipage = self::is_multipage(); |
|
212 | - $post_content = ""; |
|
213 | - if ($linkpages != -1) { |
|
214 | - $post_content = $post->post_content; |
|
215 | - } |
|
210 | + //find if this is multi page |
|
211 | + $multipage = self::is_multipage(); |
|
212 | + $post_content = ""; |
|
213 | + if ($linkpages != -1) { |
|
214 | + $post_content = $post->post_content; |
|
215 | + } |
|
216 | 216 | |
217 | 217 | // localized objects |
218 | 218 | $objects = array( |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | 'customFields' => $custom_fields, |
289 | 289 | 'clickToInsert' => ($insert_comp_ui =='click'), |
290 | 290 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
291 | - 'rtl' => is_rtl(), |
|
291 | + 'rtl' => is_rtl(), |
|
292 | 292 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
293 | 293 | 'linksEditable' => $links_editable, |
294 | 294 | 'supportPendingStatus' => !$no_pending_status, |
295 | 295 | '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>'), |
296 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)), |
|
297 | - 'multipages'=> $multipage, |
|
298 | - 'post_content'=>$post_content |
|
296 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)), |
|
297 | + 'multipages'=> $multipage, |
|
298 | + 'post_content'=>$post_content |
|
299 | 299 | ); |
300 | 300 | |
301 | 301 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | |
305 | 305 | if (!$using_restapiv2) { |
306 | - // enqueue REST API V1 |
|
306 | + // enqueue REST API V1 |
|
307 | 307 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
308 | 308 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
309 | 309 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | if ($show_color) { |
320 | 320 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
321 | 321 | } else { |
322 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
322 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
323 | 323 | } |
324 | 324 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
325 | 325 |