Completed
Push — master ( 87ad6f...c07007 )
by
unknown
40s
created
public/includes/assets.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			//disable shortcode editing
115 115
 			$disable_shortcode_editing = lasso_editor_get_option('disable_shortcode_editing', 'lasso_editor');
116 116
             
117
-            // support custom taxonomy
117
+			// support custom taxonomy
118 118
 			$support_custom_taxonomy = lasso_editor_get_option('support_custom_taxonomy', 'lasso_editor');
119 119
 			
120 120
 			if ($show_color) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			$tz_offset = get_UTC_offset();
141 141
 			$post_date = get_the_time('U', $postid);
142 142
 			$time = (time()+$tz_offset);
143
-            $delta = $time - $post_date;
143
+			$delta = $time - $post_date;
144 144
             
145 145
 			$strings = array(
146 146
 				'save' 				=> __('Save','lasso'),
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				
185 185
 				'catsPlaceholder'     => __('add categories...'),
186 186
 				'tagsPlaceholder'     => __('add tags...'),
187
-                'taxoPlaceholder'     => __('add taxonomy terms...'),
187
+				'taxoPlaceholder'     => __('add taxonomy terms...'),
188 188
 				'editShortcode'     => __('Edit Shortcode'),
189 189
 				
190 190
 				
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 			$gallery_nonce = wp_create_nonce( $gallery_nonce_action );
198 198
 			
199 199
 			
200
-            if ($allow_change_date) {
201
-			    $permalink = get_site_url().'/?p='.$postid;
202
-            } else {
203
-                $permalink = get_permalink($postid);
204
-            }
200
+			if ($allow_change_date) {
201
+				$permalink = get_site_url().'/?p='.$postid;
202
+			} else {
203
+				$permalink = get_permalink($postid);
204
+			}
205 205
 			
206 206
 			// rest api
207 207
 			$rest_nonce = '';
@@ -221,17 +221,17 @@  discard block
 block discarded – undo
221 221
 				}
222 222
 			}
223 223
             
224
-            //excerpt
225
-            $post_excerpt = "";
226
-            $post_excerpt = wp_strip_all_tags($post->post_excerpt,true);
224
+			//excerpt
225
+			$post_excerpt = "";
226
+			$post_excerpt = wp_strip_all_tags($post->post_excerpt,true);
227 227
             
228
-            //find if this is multi page. -1 if not
229
-            $multipage = self::is_multipage();
230
-            $post_content = "";
231
-            //pass post_content if we need to process multipage. In future we may need to pass this for other purposes
232
-            //if ($multipage != -1) {
233
-               $post_content = $post->post_content;
234
-            //}
228
+			//find if this is multi page. -1 if not
229
+			$multipage = self::is_multipage();
230
+			$post_content = "";
231
+			//pass post_content if we need to process multipage. In future we may need to pass this for other purposes
232
+			//if ($multipage != -1) {
233
+			   $post_content = $post->post_content;
234
+			//}
235 235
 			
236 236
 			//get custom taxonomy
237 237
 			$custom_taxonomies         = array_diff(get_object_taxonomies( get_post_type( $postid ), 'names' ), ['category','post_tag','post_format']);
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 				$existing_taxo_arr[$taxonomy] = lasso_get_objects( $taxonomy );
245 245
 			}
246 246
             
247
-            $new_post_text    = lasso_editor_get_option( 'new_post_text', 'lasso_editor' );        
248
-            $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')));
247
+			$new_post_text    = lasso_editor_get_option( 'new_post_text', 'lasso_editor' );        
248
+			$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')));
249 249
 
250 250
 
251 251
 			// localized objects
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				'nonce'				=> wp_create_nonce('lasso_editor'),
275 275
 				'handle'			=> lasso_editor_settings_toolbar(),
276 276
 				'toolbar'			=> lasso_editor_text_toolbar(),
277
-                'toolbarPopup'		=> $text_select_popup ? lasso_editor_selected_text_toolbar(): false,
277
+				'toolbarPopup'		=> $text_select_popup ? lasso_editor_selected_text_toolbar(): false,
278 278
 				'toolbarHeadings'   => $toolbar_headings,
279 279
 				'toolbarHeadingsH4'   => $toolbar_headings_h4,
280 280
 				'component_modal'	=> lasso_editor_component_modal(),
@@ -327,19 +327,19 @@  discard block
 block discarded – undo
327 327
 				'customFields'      => $custom_fields,
328 328
 				'clickToInsert'     => ($insert_comp_ui =='click'),
329 329
 				'buttonOnEmptyP'     => ($insert_comp_ui =='mediumcom'),      // auto show a button to insert components on an empty paragraph      
330
-                'rtl'               => is_rtl(),				
330
+				'rtl'               => is_rtl(),				
331 331
 				'skipToEdit'        =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode
332 332
 				'linksEditable'    => $links_editable,
333 333
 				'supportPendingStatus' => !$no_pending_status,
334 334
 				'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>'),
335
-                'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//,
336
-                'multipages'=> $multipage,
337
-                'post_content'=>$post_content,
338
-                'post_excerpt'=>$post_excerpt,
339
-                'supCustTaxo' => $support_custom_taxonomy == 'on',
340
-                'oldWPimg'=> $use_old_wpimg =='on',
341
-                'useWPImgBlk'=> $use_wpimgblock,
342
-                'prefixHTTP'=> $link_prefix_http =='on'
335
+				'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//,
336
+				'multipages'=> $multipage,
337
+				'post_content'=>$post_content,
338
+				'post_excerpt'=>$post_excerpt,
339
+				'supCustTaxo' => $support_custom_taxonomy == 'on',
340
+				'oldWPimg'=> $use_old_wpimg =='on',
341
+				'useWPImgBlk'=> $use_wpimgblock,
342
+				'prefixHTTP'=> $link_prefix_http =='on'
343 343
 			);
344 344
 
345 345
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			
348 348
 			
349 349
 			if (!$using_restapiv2) {
350
-               // enqueue REST API V1
350
+			   // enqueue REST API V1
351 351
 			   wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true );
352 352
 			   $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) );
353 353
 			   wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings );
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			if ($show_color) {
364 364
 				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true);
365 365
 			} else {
366
-			    wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
366
+				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true);
367 367
 			}
368 368
 			wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) );
369 369
 
@@ -372,44 +372,44 @@  discard block
 block discarded – undo
372 372
 
373 373
 	}
374 374
     
375
-    function gutenberg_active() {
375
+	function gutenberg_active() {
376 376
         
377
-        // Gutenberg plugin is installed and activated.
378
-        $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
379
-
380
-        // Block editor since 5.0.
381
-        $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
382
-
383
-        if ( ! $gutenberg && ! $block_editor ) {
384
-            return false;
385
-        }
386
-
387
-        if ( self::is_classic_editor_plugin_active() ) {
388
-            $editor_option       = get_option( 'classic-editor-replace' );
389
-            $block_editor_active = array( 'no-replace', 'block' );
390
-
391
-            return in_array( $editor_option, $block_editor_active, true );
392
-        }
393
-
394
-        return true;
395
-    }
396
-
397
-    /**
398
-     * Check if Classic Editor plugin is active.
399
-     *
400
-     * @return bool
401
-     */
402
-    function is_classic_editor_plugin_active() {
403
-        if ( ! function_exists( 'is_plugin_active' ) ) {
404
-            include_once ABSPATH . 'wp-admin/includes/plugin.php';
405
-        }
406
-
407
-        if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
408
-            return true;
409
-        }
410
-
411
-        return false;
412
-    }
377
+		// Gutenberg plugin is installed and activated.
378
+		$gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
379
+
380
+		// Block editor since 5.0.
381
+		$block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
382
+
383
+		if ( ! $gutenberg && ! $block_editor ) {
384
+			return false;
385
+		}
386
+
387
+		if ( self::is_classic_editor_plugin_active() ) {
388
+			$editor_option       = get_option( 'classic-editor-replace' );
389
+			$block_editor_active = array( 'no-replace', 'block' );
390
+
391
+			return in_array( $editor_option, $block_editor_active, true );
392
+		}
393
+
394
+		return true;
395
+	}
396
+
397
+	/**
398
+	 * Check if Classic Editor plugin is active.
399
+	 *
400
+	 * @return bool
401
+	 */
402
+	function is_classic_editor_plugin_active() {
403
+		if ( ! function_exists( 'is_plugin_active' ) ) {
404
+			include_once ABSPATH . 'wp-admin/includes/plugin.php';
405
+		}
406
+
407
+		if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
408
+			return true;
409
+		}
410
+
411
+		return false;
412
+	}
413 413
 
414 414
 }
415 415
 
Please login to merge, or discard this patch.