Completed
Push — master ( 9aed0a...23281d )
by
unknown
02:09
created
public/includes/assets.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -15,30 +15,30 @@  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
-        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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
 
11 11
 class assets {
12 12
 
13
-	public function __construct(){
13
+	public function __construct() {
14 14
 
15
-		add_action('wp_enqueue_scripts', array($this,'scripts'));
15
+		add_action('wp_enqueue_scripts', array($this, 'scripts'));
16 16
 	}
17 17
     
18 18
     function is_multipage()
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
         if (!$pos) return -1;
23 23
         
24 24
         global $wp;
25
-        $url =  home_url( $wp->request );
26
-        $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1;
25
+        $url = home_url($wp->request);
26
+        $index = intval(basename($url)) == 0 ? 0 : intval(basename($url)) - 1;
27 27
         echo $index;
28 28
         return $index;        
29 29
     }
30 30
 
31
-	public function scripts(){
31
+	public function scripts() {
32 32
 
33 33
 	
34 34
 		global $post;
35
-		if ( lasso_user_can('edit_posts') 
35
+		if (lasso_user_can('edit_posts') 
36 36
 		     /* uncomment this line to disable Editus on Gutenberg posts*/
37 37
              /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content)  && !is_home()) */              
38 38
              ) {
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 			/**    Returns the time offset from UTC
41 41
 			*/
42 42
 			function get_UTC_offset() {
43
-				$timezone_string = get_option( 'timezone_string' );
44
-				if (empty( $timezone_string ) ) {
45
-					return get_option('gmt_offset')*3600;
43
+				$timezone_string = get_option('timezone_string');
44
+				if (empty($timezone_string)) {
45
+					return get_option('gmt_offset') * 3600;
46 46
 				}
47 47
 				
48 48
 				$origin_dtz = new \DateTimeZone($timezone_string);				
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 			wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true);
55 55
 
56 56
             //don't load autocomplete if it's a stockholm theme
57
-			$themename  	= wp_get_theme()->get('Name');
58
-			if ($themename !='Stockholm' ) {
57
+			$themename = wp_get_theme()->get('Name');
58
+			if ($themename != 'Stockholm') {
59 59
 				wp_enqueue_script('jquery-ui-autocomplete');
60 60
 			}
61 61
 			wp_enqueue_script('jquery-ui-draggable');
@@ -68,28 +68,28 @@  discard block
 block discarded – undo
68 68
 			// url for json api
69 69
 			$home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false;
70 70
 
71
-			$article_object 	= lasso_editor_get_option('article_class','lasso_editor');
71
+			$article_object 	= lasso_editor_get_option('article_class', 'lasso_editor');
72 72
 
73
-			$article_object 	= empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object;
73
+			$article_object 	= empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object;
74 74
 
75
-			$featImgClass 		= lasso_editor_get_option('featimg_class','lasso_editor');
76
-			if (empty( $featImgClass )) {
75
+			$featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor');
76
+			if (empty($featImgClass)) {
77 77
 				$featImgClass = lasso_get_supported_theme_featured_image_class();
78 78
 			}
79
-			$titleClass 		= lasso_editor_get_option('title_class','lasso_editor');
80
-			if (empty( $titleClass )) {
79
+			$titleClass = lasso_editor_get_option('title_class', 'lasso_editor');
80
+			if (empty($titleClass)) {
81 81
 				$titleClass = lasso_get_supported_theme_title_class();
82 82
 			}
83
-			$toolbar_headings  	= lasso_editor_get_option('toolbar_headings', 'lasso_editor');
84
-			$toolbar_headings_h4  	= lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor');
83
+			$toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor');
84
+			$toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor');
85 85
 			$objectsNoSave  	= lasso_editor_get_option('dont_save', 'lasso_editor');
86
-			$objectsNonEditable  	= lasso_editor_get_option('non_editable', 'lasso_editor');
86
+			$objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor');
87 87
 			$disableRESTSave = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor');
88
-			$save_to_post_disabled  = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' );
89
-			$edit_post_disabled  = lasso_editor_get_option( 'post_edit_disabled', 'lasso_editor' );
88
+			$save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor');
89
+			$edit_post_disabled = lasso_editor_get_option('post_edit_disabled', 'lasso_editor');
90 90
 			
91
-			$bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b');
92
-			$i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i');
91
+			$bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor', 'b');
92
+			$i_tag = lasso_editor_get_option('i_tag', 'lasso_editor', 'i');
93 93
 
94 94
 			
95 95
 			//text alignement
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 			
107 107
 			if ($show_color) {
108 108
 				//color picker
109
-				wp_enqueue_style( 'wp-color-picker' );
110
-				wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
109
+				wp_enqueue_style('wp-color-picker');
110
+				wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1);
111 111
 			}
112 112
 			
113 113
 			// click to insert components, not drag and drop
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 			
120 120
 			// custom fields
121 121
 			
122
-			$custom_fields = apply_filters( 'editus_custom_fields', null ); //array('testFieldName' => '#field1');
122
+			$custom_fields = apply_filters('editus_custom_fields', null); //array('testFieldName' => '#field1');
123 123
 
124 124
 
125 125
 
@@ -127,47 +127,47 @@  discard block
 block discarded – undo
127 127
 			$postid 			= get_the_ID();
128 128
 			$tz_offset = get_UTC_offset();
129 129
 			$post_date = get_the_time('U', $postid);
130
-			$time = (time()+$tz_offset);
130
+			$time = (time() + $tz_offset);
131 131
             $delta = $time - $post_date;
132 132
             
133 133
 			$strings = array(
134
-				'save' 				=> __('Save','lasso'),
135
-				'selectText'	  	=> __('Please Select Text First.','lasso'),
136
-				'cancel' 			=> __('Cancel','lasso'),
137
-				'exiteditor' 		=> __('Exit Editor','lasso'),
138
-				'saving' 			=> __('Saving...','lasso'),
139
-				'saved'				=> __('Saved!','lasso'),
140
-				'adding' 			=> __('Adding...','lasso'),
141
-				'added'				=> __('Added!','lasso'),
142
-				'loading' 			=> __('Loading...','lasso'),
143
-				'loadMore'			=> __('Load More','lasso'),
144
-				'close'			=> __('Close','lasso'),
145
-				'noPostsFound'		=> __('No more posts found','lasso'),
146
-				'fetchFail'	    	=> __('Fetching failed.','lasso'),
147
-				'galleryCreated' 	=> __('Gallery Created!','lasso'),
148
-				'galleryUpdated' 	=> __('Gallery Updated!','lasso'),
149
-				'justWrite'			=> __('Just write...','lasso'),
150
-				'chooseImage'		=> __('Choose an image','lasso'),
151
-				'updateImage'		=> __('Update Image','lasso'),
152
-				'insertImage'		=> __('Insert Image','lasso'),
153
-				'selectImage'		=> __('Select Image','lasso'),
154
-				'removeFeatImg'     => __('Remove featured image?','lasso'),
155
-				'updateSelectedImg' => __('Update Selected Image','lasso'),
156
-				'chooseImages'		=> __('Choose images','lasso'),
157
-				'editImage'			=> __('Edit Image','lasso'),
158
-				'addImages'			=> __('Add Images','lasso'),
159
-				'addNewGallery'		=> __('Add New Gallery','lasso'),
160
-				'selectGallery'		=> __('Select Editus Gallery Image','lasso'),
161
-				'useSelectedImages' => __('Use Selected Images','lasso'),
162
-				'publishPost'		=> __('Publish Post?','lasso'),
163
-				'publishYes'		=> __('Yes, publish it!','lasso'),
164
-				'deletePost'		=> __('Trash Post?','lasso'),
165
-				'deleteYes'			=> __('Yes, trash it!','lasso'),
166
-				'warning'			=> __('Oh snap!','laso'),
167
-				'cancelText'		=> __('O.K. got it!','lasso'),
168
-				'missingClass'		=> __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.','lasso'),
134
+				'save' 				=> __('Save', 'lasso'),
135
+				'selectText'	  	=> __('Please Select Text First.', 'lasso'),
136
+				'cancel' 			=> __('Cancel', 'lasso'),
137
+				'exiteditor' 		=> __('Exit Editor', 'lasso'),
138
+				'saving' 			=> __('Saving...', 'lasso'),
139
+				'saved'				=> __('Saved!', 'lasso'),
140
+				'adding' 			=> __('Adding...', 'lasso'),
141
+				'added'				=> __('Added!', 'lasso'),
142
+				'loading' 			=> __('Loading...', 'lasso'),
143
+				'loadMore'			=> __('Load More', 'lasso'),
144
+				'close'			=> __('Close', 'lasso'),
145
+				'noPostsFound'		=> __('No more posts found', 'lasso'),
146
+				'fetchFail'	    	=> __('Fetching failed.', 'lasso'),
147
+				'galleryCreated' 	=> __('Gallery Created!', 'lasso'),
148
+				'galleryUpdated' 	=> __('Gallery Updated!', 'lasso'),
149
+				'justWrite'			=> __('Just write...', 'lasso'),
150
+				'chooseImage'		=> __('Choose an image', 'lasso'),
151
+				'updateImage'		=> __('Update Image', 'lasso'),
152
+				'insertImage'		=> __('Insert Image', 'lasso'),
153
+				'selectImage'		=> __('Select Image', 'lasso'),
154
+				'removeFeatImg'     => __('Remove featured image?', 'lasso'),
155
+				'updateSelectedImg' => __('Update Selected Image', 'lasso'),
156
+				'chooseImages'		=> __('Choose images', 'lasso'),
157
+				'editImage'			=> __('Edit Image', 'lasso'),
158
+				'addImages'			=> __('Add Images', 'lasso'),
159
+				'addNewGallery'		=> __('Add New Gallery', 'lasso'),
160
+				'selectGallery'		=> __('Select Editus Gallery Image', 'lasso'),
161
+				'useSelectedImages' => __('Use Selected Images', 'lasso'),
162
+				'publishPost'		=> __('Publish Post?', 'lasso'),
163
+				'publishYes'		=> __('Yes, publish it!', 'lasso'),
164
+				'deletePost'		=> __('Trash Post?', 'lasso'),
165
+				'deleteYes'			=> __('Yes, trash it!', 'lasso'),
166
+				'warning'			=> __('Oh snap!', 'laso'),
167
+				'cancelText'		=> __('O.K. got it!', 'lasso'),
168
+				'missingClass'		=> __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.', 'lasso'),
169 169
 				'missingConfirm'	=> __('Update Settings', 'lasso'),
170
-				'helperText'		=> __('one more letter','lasso'),
170
+				'helperText'		=> __('one more letter', 'lasso'),
171 171
 				'editingBackup'  	=> __('You are currently editing a backup copy of this post.'),
172 172
 				
173 173
 				'catsPlaceholder'     => __('add categories...'),
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 				
177 177
 			);
178 178
 
179
-			$api_url = trailingslashit( home_url() ) . 'lasso-internal-api';
179
+			$api_url = trailingslashit(home_url()).'lasso-internal-api';
180 180
 
181 181
 			$gallery_class = new gallery();
182 182
 			$gallery_nonce_action = $gallery_class->nonce_action;
183
-			$gallery_nonce = wp_create_nonce( $gallery_nonce_action );
183
+			$gallery_nonce = wp_create_nonce($gallery_nonce_action);
184 184
 			
185 185
 			
186 186
             if ($allow_change_date) {
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
 			  
196 196
 			if (function_exists('rest_url')) {
197 197
 				//$rest_root = esc_url_raw( rest_url());
198
-				$rest_nonce = wp_create_nonce( 'wp_rest' );
199
-				$settings = array( 'root' => $rest_root, 'nonce' => $rest_nonce );
200
-				wp_enqueue_script( 'wp-api', '', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true );
201
-				wp_localize_script( 'wp-api', 'wpApiSettings', $settings );
202
-				wp_localize_script( 'wp-api', 'WP_API_Settings', $settings );
198
+				$rest_nonce = wp_create_nonce('wp_rest');
199
+				$settings = array('root' => $rest_root, 'nonce' => $rest_nonce);
200
+				wp_enqueue_script('wp-api', '', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true);
201
+				wp_localize_script('wp-api', 'wpApiSettings', $settings);
202
+				wp_localize_script('wp-api', 'WP_API_Settings', $settings);
203 203
 				
204
-				if ( class_exists( 'WP_REST_Controller' )) {
204
+				if (class_exists('WP_REST_Controller')) {
205 205
 					// we are using REST API V2
206 206
 					$using_restapiv2 = true;
207 207
 				}
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 
217 217
 			// localized objects
218 218
 			$objects = array(
219
-				'ajaxurl' 			=> esc_url( $api_url ),
220
-				'ajaxurl2' 			=> esc_url( admin_url( 'admin-ajax.php' )),
219
+				'ajaxurl' 			=> esc_url($api_url),
220
+				'ajaxurl2' 			=> esc_url(admin_url('admin-ajax.php')),
221 221
 				'siteUrl'           => site_url(),
222 222
 				'rest_root'         => $rest_root,
223 223
 				'rest_nonce'        => $rest_nonce,
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 				'featImgClass'		=> $featImgClass,
227 227
 				'titleClass'		=> $titleClass,
228 228
 				'strings'			=> $strings,
229
-				'settingsLink'		=> function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ),
230
-				'post_status'		=> get_post_status( $postid ),
229
+				'settingsLink'		=> function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'),
230
+				'post_status'		=> get_post_status($postid),
231 231
 				'postid'			=> $postid,
232 232
 				'permalink'			=> $permalink,
233 233
 				'edit_others_pages'	=> current_user_can('edit_others_pages') ? true : false,
234 234
 				'edit_others_posts'	=> current_user_can('edit_others_posts') ? true : false,
235
-				'userCanEdit'		=> current_user_can('edit_post', $postid ),
235
+				'userCanEdit'		=> current_user_can('edit_post', $postid),
236 236
 				'can_publish'		=> is_page() ? current_user_can('publish_pages') : current_user_can('publish_posts'),
237 237
 				//'can_publish_posts'	=> current_user_can('publish_posts'),
238 238
 				//'can_publish_pages'	=> current_user_can('publish_pages'),
@@ -268,32 +268,32 @@  discard block
 block discarded – undo
268 268
 				'postTags'    		=> lasso_get_objects('tag'),
269 269
 				'noResultsDiv'		=> lasso_editor_empty_results(),
270 270
 				'noRevisionsDiv'	=> lasso_editor_empty_results('revision'),
271
-				'mapTileProvider'   => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false,
272
-				'mapLocations'		=> get_post_meta( $postid, 'ase_map_component_locations' ),
273
-				'mapStart'			=> get_post_meta( $postid, 'ase_map_component_start_point', true ),
274
-				'mapZoom'			=> get_post_meta( $postid, 'ase_map_component_zoom', true ),
271
+				'mapTileProvider'   => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false,
272
+				'mapLocations'		=> get_post_meta($postid, 'ase_map_component_locations'),
273
+				'mapStart'			=> get_post_meta($postid, 'ase_map_component_start_point', true),
274
+				'mapZoom'			=> get_post_meta($postid, 'ase_map_component_zoom', true),
275 275
 				'revisionModal' 	=> lasso_editor_revision_modal(),
276 276
 				'isMobile'          => wp_is_mobile(),
277
-				'enableAutoSave'    => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ),
277
+				'enableAutoSave'    => lasso_editor_get_option('enable_autosave', 'lasso_editor'),
278 278
 				'showColor'         => $show_color,
279 279
 				'showAlignment'     => $show_align,
280 280
 				'showIgnoredItems'  => lasso_editor_get_option('show_ignored_items', 'lasso_editor'),
281 281
 				'restapi2'          => $using_restapiv2,
282 282
 				'saveusingrest'     => $using_restapiv2 && !$disableRESTSave,
283
-				'newObjectContent'  => '<p>'.apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ).'</p>',
283
+				'newObjectContent'  => '<p>'.apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')).'</p>',
284 284
 				'disableSavePost'   => $save_to_post_disabled,
285 285
 				'disableEditPost'   => $edit_post_disabled,
286 286
 				'boldTag'           => $bold_tag,
287 287
 				'iTag'           	=> $i_tag,
288 288
 				'customFields'      => $custom_fields,
289
-				'clickToInsert'     => ($insert_comp_ui =='click'),
290
-				'buttonOnEmptyP'     => ($insert_comp_ui =='mediumcom'),      // auto show a button to insert components on an empty paragraph      
289
+				'clickToInsert'     => ($insert_comp_ui == 'click'),
290
+				'buttonOnEmptyP'     => ($insert_comp_ui == 'mediumcom'), // auto show a button to insert components on an empty paragraph      
291 291
                 'rtl'               => is_rtl(),				
292
-				'skipToEdit'        =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode
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
-				'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)),
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 297
                 'multipages'=> $multipage,
298 298
                 'post_content'=>$post_content
299 299
 			);
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 			
305 305
 			if (!$using_restapiv2) {
306 306
                // enqueue REST API V1
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
-			   $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) );
309
-			   wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings );
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
+			   $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json'));
309
+			   wp_localize_script('wp-api-js', 'WP_API_Settings', $settings);
310 310
 			}
311 311
 			
312 312
 			if ($allow_change_date) {
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 				wp_enqueue_style('jquery-ui');
316 316
 			}
317 317
 
318
-			$postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min';
318
+			$postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min';
319 319
 			if ($show_color) {
320
-				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true);
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
-			wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) );
324
+			wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects));
325 325
 
326 326
 
327 327
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
     {
20 20
         global $post;
21 21
         $pos = strpos($post->post_content, "<!--nextpage-->");
22
-        if (!$pos) return -1;
22
+        if (!$pos) {
23
+        	return -1;
24
+        }
23 25
         
24 26
         global $wp;
25 27
         $url =  home_url( $wp->request );
Please login to merge, or discard this patch.
lasso.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 // If this file is called directly, abort.
21
-if ( ! defined( 'WPINC' ) ) {
21
+if (!defined('WPINC')) {
22 22
 	die;
23 23
 }
24 24
 
25 25
 // Set some constants
26
-define( 'LASSO_VERSION', '1.2.0' );
27
-define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) );
28
-define( 'LASSO_URL', plugins_url( '', __FILE__ ) );
29
-define( 'LASSO_FILE', __FILE__ );
26
+define('LASSO_VERSION', '1.2.0');
27
+define('LASSO_DIR', plugin_dir_path(__FILE__));
28
+define('LASSO_URL', plugins_url('', __FILE__));
29
+define('LASSO_FILE', __FILE__);
30 30
 
31 31
 /**
32 32
  * Load plugin if PHP version is 5.4 or later.
33 33
  */
34
-if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
34
+if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
35 35
 
36
-	include_once( LASSO_DIR . '/bootstrap.php' );
36
+	include_once(LASSO_DIR.'/bootstrap.php');
37 37
 
38 38
 } else {
39 39
 
40 40
 	add_action('admin_head', 'lasso_fail_notice');
41
-	function lasso_fail_notice(){
41
+	function lasso_fail_notice() {
42 42
 
43 43
 		printf('<div class="error"><p>Editus requires PHP 5.4 or higher.</p></div>');
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2);
49
-function lasso_show_in_rest($args, $post_type){
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( ) );
52
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
53
-	if (in_array( $post_type,$allowed_post_types)) {
51
+    $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array( ));
52
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types);
53
+	if (in_array($post_type, $allowed_post_types)) {
54 54
 		$args['show_in_rest'] = true;
55 55
 		if ($post_type != 'post' && $post_type != 'page') {
56 56
 			$args['rest_base'] = $post_type;
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 }
62 62
 
63 63
 
64
-function lasso_editor_get_option( $option, $section, $default = '' ) {
64
+function lasso_editor_get_option($option, $section, $default = '') {
65 65
 
66
-	if ( empty( $option ) )
66
+	if (empty($option))
67 67
 		return;
68 68
 
69
-	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
69
+	if (function_exists('is_multisite') && is_multisite()) {
70 70
 
71
-		$options = get_site_option( $section );
71
+		$options = get_site_option($section);
72 72
 
73 73
 	} else {
74 74
 
75
-		$options = get_option( $section );
75
+		$options = get_option($section);
76 76
 	}
77 77
 
78
-	if ( isset( $options[$option] ) ) {
78
+	if (isset($options[$option])) {
79 79
 		return $options[$option];
80 80
 	}
81 81
 
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
 ));
89 89
 
90 90
 // Gutenberg
91
-if( function_exists( 'is_gutenberg_page' ) ) {
92
-	function add_raw_to_post( $response, $post, $request ) {
91
+if (function_exists('is_gutenberg_page')) {
92
+	function add_raw_to_post($response, $post, $request) {
93 93
 		$response_data = $response->get_data();
94
-		if ( is_array( $response_data['content'] )) {
95
-			$response_data['content']['raw'] =  $post->post_content ;
96
-			$response->set_data( $response_data );
94
+		if (is_array($response_data['content'])) {
95
+			$response_data['content']['raw'] = $post->post_content;
96
+			$response->set_data($response_data);
97 97
 		}
98 98
 
99 99
 		return $response;
100 100
 	}
101
-	add_filter( "rest_prepare_post", 'add_raw_to_post', 10, 3 );
101
+	add_filter("rest_prepare_post", 'add_raw_to_post', 10, 3);
102 102
 }
103 103
 
Please login to merge, or discard this patch.