|
@@ -10,21 +10,21 @@ 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
|
|
- public function scripts(){ |
|
|
18
|
+ public function scripts() { |
|
19
|
19
|
|
|
20
|
20
|
|
|
21
|
|
- if ( lasso_user_can('edit_posts')) { |
|
|
21
|
+ if (lasso_user_can('edit_posts')) { |
|
22
|
22
|
|
|
23
|
23
|
wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
|
24
|
24
|
|
|
25
|
25
|
//don't load autocomplete if it's a stockholm theme |
|
26
|
|
- $themename = wp_get_theme()->get('Name'); |
|
27
|
|
- if ($themename !='Stockholm' ) { |
|
|
26
|
+ $themename = wp_get_theme()->get('Name'); |
|
|
27
|
+ if ($themename != 'Stockholm') { |
|
28
|
28
|
wp_enqueue_script('jquery-ui-autocomplete'); |
|
29
|
29
|
} |
|
30
|
30
|
wp_enqueue_script('jquery-ui-draggable'); |
|
@@ -37,27 +37,27 @@ discard block |
|
|
block discarded – undo |
|
37
|
37
|
// url for json api |
|
38
|
38
|
$home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false; |
|
39
|
39
|
|
|
40
|
|
- $article_object = lasso_editor_get_option('article_class','lasso_editor'); |
|
|
40
|
+ $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
41
|
41
|
|
|
42
|
|
- $article_object = empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
|
42
|
+ $article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
43
|
43
|
|
|
44
|
|
- $featImgClass = lasso_editor_get_option('featimg_class','lasso_editor'); |
|
45
|
|
- if (empty( $featImgClass )) { |
|
|
44
|
+ $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
|
45
|
+ if (empty($featImgClass)) { |
|
46
|
46
|
$featImgClass = lasso_get_supported_theme_featured_image_class(); |
|
47
|
47
|
} |
|
48
|
|
- $titleClass = lasso_editor_get_option('title_class','lasso_editor'); |
|
49
|
|
- if (empty( $titleClass )) { |
|
|
48
|
+ $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
|
49
|
+ if (empty($titleClass)) { |
|
50
|
50
|
$titleClass = lasso_get_supported_theme_title_class(); |
|
51
|
51
|
} |
|
52
|
|
- $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
53
|
|
- $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
|
52
|
+ $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
|
53
|
+ $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
54
|
54
|
$objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
55
|
|
- $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
|
55
|
+ $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
56
|
56
|
$disableRESTSave = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor'); |
|
57
|
|
- $save_to_post_disabled = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' ); |
|
|
57
|
+ $save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor'); |
|
58
|
58
|
|
|
59
|
|
- $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b'); |
|
60
|
|
- $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i'); |
|
|
59
|
+ $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor', 'b'); |
|
|
60
|
+ $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor', 'i'); |
|
61
|
61
|
|
|
62
|
62
|
|
|
63
|
63
|
//text alignement |
|
@@ -71,8 +71,8 @@ discard block |
|
|
block discarded – undo |
|
71
|
71
|
|
|
72
|
72
|
if ($show_color) { |
|
73
|
73
|
//color picker |
|
74
|
|
- wp_enqueue_style( 'wp-color-picker' ); |
|
75
|
|
- wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); |
|
|
74
|
+ wp_enqueue_style('wp-color-picker'); |
|
|
75
|
+ wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1); |
|
76
|
76
|
} |
|
77
|
77
|
|
|
78
|
78
|
// click to insert components, not drag and drop |
|
@@ -81,7 +81,7 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
|
|
82
|
82
|
// custom fields |
|
83
|
83
|
|
|
84
|
|
- $custom_fields = apply_filters( 'editus_custom_fields', null ); //array('testFieldName' => '#field1'); |
|
|
84
|
+ $custom_fields = apply_filters('editus_custom_fields', null); //array('testFieldName' => '#field1'); |
|
85
|
85
|
|
|
86
|
86
|
|
|
87
|
87
|
|
|
@@ -92,53 +92,53 @@ discard block |
|
|
block discarded – undo |
|
92
|
92
|
$delta = time() - $post_date; |
|
93
|
93
|
|
|
94
|
94
|
$strings = array( |
|
95
|
|
- 'save' => __('Save','lasso'), |
|
96
|
|
- 'selectText' => __('Please Select Text First.','lasso'), |
|
97
|
|
- 'cancel' => __('Cancel','lasso'), |
|
98
|
|
- 'exiteditor' => __('Exit Editor','lasso'), |
|
99
|
|
- 'saving' => __('Saving...','lasso'), |
|
100
|
|
- 'saved' => __('Saved!','lasso'), |
|
101
|
|
- 'adding' => __('Adding...','lasso'), |
|
102
|
|
- 'added' => __('Added!','lasso'), |
|
103
|
|
- 'loading' => __('Loading...','lasso'), |
|
104
|
|
- 'loadMore' => __('Load More','lasso'), |
|
105
|
|
- 'close' => __('Close','lasso'), |
|
106
|
|
- 'noPostsFound' => __('No more posts found','lasso'), |
|
107
|
|
- 'fetchFail' => __('Fetching failed.','lasso'), |
|
108
|
|
- 'galleryCreated' => __('Gallery Created!','lasso'), |
|
109
|
|
- 'galleryUpdated' => __('Gallery Updated!','lasso'), |
|
110
|
|
- 'justWrite' => __('Just write...','lasso'), |
|
111
|
|
- 'chooseImage' => __('Choose an image','lasso'), |
|
112
|
|
- 'updateImage' => __('Update Image','lasso'), |
|
113
|
|
- 'insertImage' => __('Insert Image','lasso'), |
|
114
|
|
- 'selectImage' => __('Select Image','lasso'), |
|
115
|
|
- 'removeFeatImg' => __('Remove featured image?','lasso'), |
|
116
|
|
- 'updateSelectedImg' => __('Update Selected Image','lasso'), |
|
117
|
|
- 'chooseImages' => __('Choose images','lasso'), |
|
118
|
|
- 'editImage' => __('Edit Image','lasso'), |
|
119
|
|
- 'addImages' => __('Add Images','lasso'), |
|
120
|
|
- 'addNewGallery' => __('Add New Gallery','lasso'), |
|
121
|
|
- 'selectGallery' => __('Select Lasso Gallery Image','lasso'), |
|
122
|
|
- 'useSelectedImages' => __('Use Selected Images','lasso'), |
|
123
|
|
- 'publishPost' => __('Publish Post?','lasso'), |
|
124
|
|
- 'publishYes' => __('Yes, publish it!','lasso'), |
|
125
|
|
- 'deletePost' => __('Trash Post?','lasso'), |
|
126
|
|
- 'deleteYes' => __('Yes, trash it!','lasso'), |
|
127
|
|
- 'warning' => __('Oh snap!','laso'), |
|
128
|
|
- 'cancelText' => __('O.K. got it!','lasso'), |
|
129
|
|
- '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'), |
|
|
95
|
+ 'save' => __('Save', 'lasso'), |
|
|
96
|
+ 'selectText' => __('Please Select Text First.', 'lasso'), |
|
|
97
|
+ 'cancel' => __('Cancel', 'lasso'), |
|
|
98
|
+ 'exiteditor' => __('Exit Editor', 'lasso'), |
|
|
99
|
+ 'saving' => __('Saving...', 'lasso'), |
|
|
100
|
+ 'saved' => __('Saved!', 'lasso'), |
|
|
101
|
+ 'adding' => __('Adding...', 'lasso'), |
|
|
102
|
+ 'added' => __('Added!', 'lasso'), |
|
|
103
|
+ 'loading' => __('Loading...', 'lasso'), |
|
|
104
|
+ 'loadMore' => __('Load More', 'lasso'), |
|
|
105
|
+ 'close' => __('Close', 'lasso'), |
|
|
106
|
+ 'noPostsFound' => __('No more posts found', 'lasso'), |
|
|
107
|
+ 'fetchFail' => __('Fetching failed.', 'lasso'), |
|
|
108
|
+ 'galleryCreated' => __('Gallery Created!', 'lasso'), |
|
|
109
|
+ 'galleryUpdated' => __('Gallery Updated!', 'lasso'), |
|
|
110
|
+ 'justWrite' => __('Just write...', 'lasso'), |
|
|
111
|
+ 'chooseImage' => __('Choose an image', 'lasso'), |
|
|
112
|
+ 'updateImage' => __('Update Image', 'lasso'), |
|
|
113
|
+ 'insertImage' => __('Insert Image', 'lasso'), |
|
|
114
|
+ 'selectImage' => __('Select Image', 'lasso'), |
|
|
115
|
+ 'removeFeatImg' => __('Remove featured image?', 'lasso'), |
|
|
116
|
+ 'updateSelectedImg' => __('Update Selected Image', 'lasso'), |
|
|
117
|
+ 'chooseImages' => __('Choose images', 'lasso'), |
|
|
118
|
+ 'editImage' => __('Edit Image', 'lasso'), |
|
|
119
|
+ 'addImages' => __('Add Images', 'lasso'), |
|
|
120
|
+ 'addNewGallery' => __('Add New Gallery', 'lasso'), |
|
|
121
|
+ 'selectGallery' => __('Select Lasso Gallery Image', 'lasso'), |
|
|
122
|
+ 'useSelectedImages' => __('Use Selected Images', 'lasso'), |
|
|
123
|
+ 'publishPost' => __('Publish Post?', 'lasso'), |
|
|
124
|
+ 'publishYes' => __('Yes, publish it!', 'lasso'), |
|
|
125
|
+ 'deletePost' => __('Trash Post?', 'lasso'), |
|
|
126
|
+ 'deleteYes' => __('Yes, trash it!', 'lasso'), |
|
|
127
|
+ 'warning' => __('Oh snap!', 'laso'), |
|
|
128
|
+ 'cancelText' => __('O.K. got it!', 'lasso'), |
|
|
129
|
+ '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'), |
|
130
|
130
|
'missingConfirm' => __('Update Settings', 'lasso'), |
|
131
|
|
- 'helperText' => __('one more letter','lasso'), |
|
|
131
|
+ 'helperText' => __('one more letter', 'lasso'), |
|
132
|
132
|
'editingBackup' => __('You are currently editing a backup copy of this post.'), |
|
133
|
133
|
|
|
134
|
134
|
|
|
135
|
135
|
); |
|
136
|
136
|
|
|
137
|
|
- $api_url = trailingslashit( home_url() ) . 'lasso-internal-api'; |
|
|
137
|
+ $api_url = trailingslashit(home_url()).'lasso-internal-api'; |
|
138
|
138
|
|
|
139
|
139
|
$gallery_class = new gallery(); |
|
140
|
140
|
$gallery_nonce_action = $gallery_class->nonce_action; |
|
141
|
|
- $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
|
|
141
|
+ $gallery_nonce = wp_create_nonce($gallery_nonce_action); |
|
142
|
142
|
|
|
143
|
143
|
|
|
144
|
144
|
if ($allow_change_date) { |
|
@@ -153,13 +153,13 @@ discard block |
|
|
block discarded – undo |
|
153
|
153
|
|
|
154
|
154
|
if (function_exists('rest_url')) { |
|
155
|
155
|
//$rest_root = esc_url_raw( rest_url()); |
|
156
|
|
- $rest_nonce = wp_create_nonce( 'wp_rest' ); |
|
157
|
|
- $settings = array( 'root' => $rest_root, 'nonce' => $rest_nonce ); |
|
158
|
|
- wp_enqueue_script( 'wp-api', '', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
159
|
|
- wp_localize_script( 'wp-api', 'wpApiSettings', $settings ); |
|
160
|
|
- wp_localize_script( 'wp-api', 'WP_API_Settings', $settings ); |
|
|
156
|
+ $rest_nonce = wp_create_nonce('wp_rest'); |
|
|
157
|
+ $settings = array('root' => $rest_root, 'nonce' => $rest_nonce); |
|
|
158
|
+ wp_enqueue_script('wp-api', '', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
|
159
|
+ wp_localize_script('wp-api', 'wpApiSettings', $settings); |
|
|
160
|
+ wp_localize_script('wp-api', 'WP_API_Settings', $settings); |
|
161
|
161
|
|
|
162
|
|
- if ( class_exists( 'WP_REST_Controller' )) { |
|
|
162
|
+ if (class_exists('WP_REST_Controller')) { |
|
163
|
163
|
// we are using REST API V2 |
|
164
|
164
|
$using_restapiv2 = true; |
|
165
|
165
|
} |
|
@@ -167,8 +167,8 @@ discard block |
|
|
block discarded – undo |
|
167
|
167
|
|
|
168
|
168
|
// localized objects |
|
169
|
169
|
$objects = array( |
|
170
|
|
- 'ajaxurl' => esc_url( $api_url ), |
|
171
|
|
- 'ajaxurl2' => esc_url( admin_url( 'admin-ajax.php' )), |
|
|
170
|
+ 'ajaxurl' => esc_url($api_url), |
|
|
171
|
+ 'ajaxurl2' => esc_url(admin_url('admin-ajax.php')), |
|
172
|
172
|
'rest_root' => $rest_root, |
|
173
|
173
|
'rest_nonce' => $rest_nonce, |
|
174
|
174
|
'editor' => 'lasso--content', // ID of editable content (without #) DONT CHANGE |
|
@@ -176,13 +176,13 @@ discard block |
|
|
block discarded – undo |
|
176
|
176
|
'featImgClass' => $featImgClass, |
|
177
|
177
|
'titleClass' => $titleClass, |
|
178
|
178
|
'strings' => $strings, |
|
179
|
|
- 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ), |
|
180
|
|
- 'post_status' => get_post_status( $postid ), |
|
|
179
|
+ 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), |
|
|
180
|
+ 'post_status' => get_post_status($postid), |
|
181
|
181
|
'postid' => $postid, |
|
182
|
182
|
'permalink' => $permalink, |
|
183
|
183
|
'edit_others_pages' => current_user_can('edit_others_pages') ? true : false, |
|
184
|
184
|
'edit_others_posts' => current_user_can('edit_others_posts') ? true : false, |
|
185
|
|
- 'userCanEdit' => current_user_can('edit_post', $postid ), |
|
|
185
|
+ 'userCanEdit' => current_user_can('edit_post', $postid), |
|
186
|
186
|
'can_publish_posts' => current_user_can('publish_posts'), |
|
187
|
187
|
'can_publish_pages' => current_user_can('publish_pages'), |
|
188
|
188
|
'author' => is_user_logged_in() ? get_current_user_ID() : false, |
|
@@ -217,26 +217,26 @@ discard block |
|
|
block discarded – undo |
|
217
|
217
|
'postTags' => lasso_get_objects('tag'), |
|
218
|
218
|
'noResultsDiv' => lasso_editor_empty_results(), |
|
219
|
219
|
'noRevisionsDiv' => lasso_editor_empty_results('revision'), |
|
220
|
|
- 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false, |
|
221
|
|
- 'mapLocations' => get_post_meta( $postid, 'ase_map_component_locations' ), |
|
222
|
|
- 'mapStart' => get_post_meta( $postid, 'ase_map_component_start_point', true ), |
|
223
|
|
- 'mapZoom' => get_post_meta( $postid, 'ase_map_component_zoom', true ), |
|
|
220
|
+ 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, |
|
|
221
|
+ 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), |
|
|
222
|
+ 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), |
|
|
223
|
+ 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), |
|
224
|
224
|
'revisionModal' => lasso_editor_revision_modal(), |
|
225
|
225
|
'isMobile' => wp_is_mobile(), |
|
226
|
|
- 'enableAutoSave' => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ), |
|
|
226
|
+ 'enableAutoSave' => lasso_editor_get_option('enable_autosave', 'lasso_editor'), |
|
227
|
227
|
'showColor' => $show_color, |
|
228
|
228
|
'showAlignment' => $show_align, |
|
229
|
229
|
'showIgnoredItems' => lasso_editor_get_option('show_ignored_items', 'lasso_editor'), |
|
230
|
230
|
'restapi2' => $using_restapiv2, |
|
231
|
231
|
'saveusingrest' => $using_restapiv2 && !$disableRESTSave, |
|
232
|
|
- 'newObjectContent' => '<p>'.apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ).'</p>', |
|
|
232
|
+ 'newObjectContent' => '<p>'.apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')).'</p>', |
|
233
|
233
|
'disableSavePost' => $save_to_post_disabled, |
|
234
|
234
|
'boldTag' => $bold_tag, |
|
235
|
235
|
'iTag' => $i_tag, |
|
236
|
236
|
'customFields' => $custom_fields, |
|
237
|
|
- 'clickToInsert' => ($insert_comp_ui !='drag'), |
|
238
|
|
- 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
|
239
|
|
- 'skipToEdit' =>( $delta < 10 ) // if it's a new post, skip to edit mode |
|
|
237
|
+ 'clickToInsert' => ($insert_comp_ui != 'drag'), |
|
|
238
|
+ 'buttonOnEmptyP' => ($insert_comp_ui == 'mediumcom'), // auto show a button to insert components on an empty paragraph |
|
|
239
|
+ 'skipToEdit' =>($delta < 10) // if it's a new post, skip to edit mode |
|
240
|
240
|
); |
|
241
|
241
|
|
|
242
|
242
|
|
|
@@ -245,9 +245,9 @@ discard block |
|
|
block discarded – undo |
|
245
|
245
|
|
|
246
|
246
|
if (!$using_restapiv2) { |
|
247
|
247
|
// enqueue REST API V1 |
|
248
|
|
- wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
249
|
|
- $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
|
250
|
|
- wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
|
|
248
|
+ wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
|
249
|
+ $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json')); |
|
|
250
|
+ wp_localize_script('wp-api-js', 'WP_API_Settings', $settings); |
|
251
|
251
|
} |
|
252
|
252
|
|
|
253
|
253
|
if ($allow_change_date) { |
|
@@ -256,13 +256,13 @@ discard block |
|
|
block discarded – undo |
|
256
|
256
|
wp_enqueue_style('jquery-ui'); |
|
257
|
257
|
} |
|
258
|
258
|
|
|
259
|
|
- $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
|
|
259
|
+ $postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min'; |
|
260
|
260
|
if ($show_color) { |
|
261
|
|
- wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
|
|
261
|
+ wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api', 'iris'), LASSO_VERSION, true); |
|
262
|
262
|
} else { |
|
263
|
|
- wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
|
263
|
+ wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
264
|
264
|
} |
|
265
|
|
- wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
|
|
265
|
+ wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects)); |
|
266
|
266
|
|
|
267
|
267
|
|
|
268
|
268
|
} |