|
@@ -10,16 +10,16 @@ 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
|
21
|
// for now editus is disabled for mobile. it will be reenabled when mobile platforms are better supported |
|
22
|
|
- if ( lasso_user_can('edit_posts')) { |
|
|
22
|
+ if (lasso_user_can('edit_posts')) { |
|
23
|
23
|
|
|
24
|
24
|
wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
|
25
|
25
|
|
|
@@ -34,21 +34,21 @@ discard block |
|
|
block discarded – undo |
|
34
|
34
|
// url for json api |
|
35
|
35
|
$home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false; |
|
36
|
36
|
|
|
37
|
|
- $article_object = lasso_editor_get_option('article_class','lasso_editor'); |
|
|
37
|
+ $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
38
|
38
|
|
|
39
|
|
- $article_object = empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
|
39
|
+ $article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
40
|
40
|
|
|
41
|
|
- $featImgClass = lasso_editor_get_option('featimg_class','lasso_editor'); |
|
42
|
|
- if (empty( $featImgClass )) { |
|
|
41
|
+ $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
|
42
|
+ if (empty($featImgClass)) { |
|
43
|
43
|
$featImgClass = lasso_get_supported_theme_featured_image_class(); |
|
44
|
44
|
} |
|
45
|
|
- $titleClass = lasso_editor_get_option('title_class','lasso_editor'); |
|
46
|
|
- if (empty( $titleClass )) { |
|
|
45
|
+ $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
|
46
|
+ if (empty($titleClass)) { |
|
47
|
47
|
$titleClass = lasso_get_supported_theme_title_class(); |
|
48
|
48
|
} |
|
49
|
|
- $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
50
|
|
- $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
51
|
|
- $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
|
49
|
+ $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
|
50
|
+ $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
|
51
|
+ $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
52
|
52
|
|
|
53
|
53
|
|
|
54
|
54
|
//text alignement |
|
@@ -59,74 +59,74 @@ discard block |
|
|
block discarded – undo |
|
59
|
59
|
|
|
60
|
60
|
if ($show_color) { |
|
61
|
61
|
//color picker |
|
62
|
|
- wp_enqueue_style( 'wp-color-picker' ); |
|
63
|
|
- wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); |
|
|
62
|
+ wp_enqueue_style('wp-color-picker'); |
|
|
63
|
+ wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1); |
|
64
|
64
|
} |
|
65
|
65
|
|
|
66
|
66
|
|
|
67
|
67
|
|
|
68
|
68
|
// post id reference |
|
69
|
|
- $postid = get_the_ID(); |
|
|
69
|
+ $postid = get_the_ID(); |
|
70
|
70
|
|
|
71
|
71
|
$strings = array( |
|
72
|
|
- 'save' => __('Save','lasso'), |
|
73
|
|
- 'saving' => __('Saving...','lasso'), |
|
74
|
|
- 'saved' => __('Saved!','lasso'), |
|
75
|
|
- 'adding' => __('Adding...','lasso'), |
|
76
|
|
- 'added' => __('Added!','lasso'), |
|
77
|
|
- 'loading' => __('Loading...','lasso'), |
|
78
|
|
- 'loadMore' => __('Load More','lasso'), |
|
79
|
|
- 'noPostsFound' => __('No more posts found','lasso'), |
|
80
|
|
- 'fetchFail' => __('Fetching failed. REST API plugin may not have been installed or configured correctly.','lasso'), |
|
81
|
|
- 'galleryCreated' => __('Gallery Created!','lasso'), |
|
82
|
|
- 'galleryUpdated' => __('Gallery Updated!','lasso'), |
|
83
|
|
- 'justWrite' => __('Just write...','lasso'), |
|
84
|
|
- 'chooseImage' => __('Choose an image','lasso'), |
|
85
|
|
- 'updateImage' => __('Update Image','lasso'), |
|
86
|
|
- 'insertImage' => __('Insert Image','lasso'), |
|
87
|
|
- 'selectImage' => __('Select Image','lasso'), |
|
88
|
|
- 'removeFeatImg' => __('Remove featured image?','lasso'), |
|
89
|
|
- 'updateSelectedImg' => __('Update Selected Image','lasso'), |
|
90
|
|
- 'chooseImages' => __('Choose images','lasso'), |
|
91
|
|
- 'editImage' => __('Edit Image','lasso'), |
|
92
|
|
- 'addImages' => __('Add Images','lasso'), |
|
93
|
|
- 'addNewGallery' => __('Add New Gallery','lasso'), |
|
94
|
|
- 'selectGallery' => __('Select Lasso Gallery Image','lasso'), |
|
95
|
|
- 'useSelectedImages' => __('Use Selected Images','lasso'), |
|
96
|
|
- 'publishPost' => __('Publish Post?','lasso'), |
|
97
|
|
- 'publishYes' => __('Yes, publish it!','lasso'), |
|
98
|
|
- 'deletePost' => __('Trash Post?','lasso'), |
|
99
|
|
- 'deleteYes' => __('Yes, trash it!','lasso'), |
|
100
|
|
- 'warning' => __('Oh snap!','laso'), |
|
101
|
|
- 'cancelText' => __('O.K. got it!','lasso'), |
|
102
|
|
- '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'), |
|
|
72
|
+ 'save' => __('Save', 'lasso'), |
|
|
73
|
+ 'saving' => __('Saving...', 'lasso'), |
|
|
74
|
+ 'saved' => __('Saved!', 'lasso'), |
|
|
75
|
+ 'adding' => __('Adding...', 'lasso'), |
|
|
76
|
+ 'added' => __('Added!', 'lasso'), |
|
|
77
|
+ 'loading' => __('Loading...', 'lasso'), |
|
|
78
|
+ 'loadMore' => __('Load More', 'lasso'), |
|
|
79
|
+ 'noPostsFound' => __('No more posts found', 'lasso'), |
|
|
80
|
+ 'fetchFail' => __('Fetching failed. REST API plugin may not have been installed or configured correctly.', 'lasso'), |
|
|
81
|
+ 'galleryCreated' => __('Gallery Created!', 'lasso'), |
|
|
82
|
+ 'galleryUpdated' => __('Gallery Updated!', 'lasso'), |
|
|
83
|
+ 'justWrite' => __('Just write...', 'lasso'), |
|
|
84
|
+ 'chooseImage' => __('Choose an image', 'lasso'), |
|
|
85
|
+ 'updateImage' => __('Update Image', 'lasso'), |
|
|
86
|
+ 'insertImage' => __('Insert Image', 'lasso'), |
|
|
87
|
+ 'selectImage' => __('Select Image', 'lasso'), |
|
|
88
|
+ 'removeFeatImg' => __('Remove featured image?', 'lasso'), |
|
|
89
|
+ 'updateSelectedImg' => __('Update Selected Image', 'lasso'), |
|
|
90
|
+ 'chooseImages' => __('Choose images', 'lasso'), |
|
|
91
|
+ 'editImage' => __('Edit Image', 'lasso'), |
|
|
92
|
+ 'addImages' => __('Add Images', 'lasso'), |
|
|
93
|
+ 'addNewGallery' => __('Add New Gallery', 'lasso'), |
|
|
94
|
+ 'selectGallery' => __('Select Lasso Gallery Image', 'lasso'), |
|
|
95
|
+ 'useSelectedImages' => __('Use Selected Images', 'lasso'), |
|
|
96
|
+ 'publishPost' => __('Publish Post?', 'lasso'), |
|
|
97
|
+ 'publishYes' => __('Yes, publish it!', 'lasso'), |
|
|
98
|
+ 'deletePost' => __('Trash Post?', 'lasso'), |
|
|
99
|
+ 'deleteYes' => __('Yes, trash it!', 'lasso'), |
|
|
100
|
+ 'warning' => __('Oh snap!', 'laso'), |
|
|
101
|
+ 'cancelText' => __('O.K. got it!', 'lasso'), |
|
|
102
|
+ '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'), |
|
103
|
103
|
'missingConfirm' => __('Update Settings', 'lasso'), |
|
104
|
|
- 'helperText' => __('one more letter','lasso'), |
|
|
104
|
+ 'helperText' => __('one more letter', 'lasso'), |
|
105
|
105
|
'editingBackup' => __('You are currently editing a backup copy of this post.') |
|
106
|
106
|
); |
|
107
|
107
|
|
|
108
|
|
- $api_url = trailingslashit( home_url() ) . 'lasso-internal-api'; |
|
|
108
|
+ $api_url = trailingslashit(home_url()).'lasso-internal-api'; |
|
109
|
109
|
|
|
110
|
110
|
$gallery_class = new gallery(); |
|
111
|
111
|
$gallery_nonce_action = $gallery_class->nonce_action; |
|
112
|
|
- $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
|
|
112
|
+ $gallery_nonce = wp_create_nonce($gallery_nonce_action); |
|
113
|
113
|
|
|
114
|
114
|
// localized objects |
|
115
|
115
|
$objects = array( |
|
116
|
|
- 'ajaxurl' => esc_url( $api_url ), |
|
117
|
|
- 'ajaxurl2' => esc_url( admin_url( 'admin-ajax.php' )), |
|
|
116
|
+ 'ajaxurl' => esc_url($api_url), |
|
|
117
|
+ 'ajaxurl2' => esc_url(admin_url('admin-ajax.php')), |
|
118
|
118
|
'editor' => 'lasso--content', // ID of editable content (without #) DONT CHANGE |
|
119
|
119
|
'article_object' => $article_object, |
|
120
|
120
|
'featImgClass' => $featImgClass, |
|
121
|
121
|
'titleClass' => $titleClass, |
|
122
|
122
|
'strings' => $strings, |
|
123
|
|
- 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ), |
|
124
|
|
- 'post_status' => get_post_status( $postid ), |
|
|
123
|
+ 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), |
|
|
124
|
+ 'post_status' => get_post_status($postid), |
|
125
|
125
|
'postid' => $postid, |
|
126
|
126
|
'permalink' => get_permalink(), |
|
127
|
127
|
'edit_others_pages' => current_user_can('edit_others_pages') ? true : false, |
|
128
|
128
|
'edit_others_posts' => current_user_can('edit_others_posts') ? true : false, |
|
129
|
|
- 'userCanEdit' => current_user_can('edit_post', $postid ), |
|
|
129
|
+ 'userCanEdit' => current_user_can('edit_post', $postid), |
|
130
|
130
|
'can_publish_posts' => current_user_can('publish_posts'), |
|
131
|
131
|
'can_publish_pages' => current_user_can('publish_pages'), |
|
132
|
132
|
'author' => is_user_logged_in() ? get_current_user_ID() : false, |
|
@@ -160,35 +160,35 @@ discard block |
|
|
block discarded – undo |
|
160
|
160
|
'postTags' => lasso_get_objects('tag'), |
|
161
|
161
|
'noResultsDiv' => lasso_editor_empty_results(), |
|
162
|
162
|
'noRevisionsDiv' => lasso_editor_empty_results('revision'), |
|
163
|
|
- 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false, |
|
164
|
|
- 'mapLocations' => get_post_meta( $postid, 'ase_map_component_locations' ), |
|
165
|
|
- 'mapStart' => get_post_meta( $postid, 'ase_map_component_start_point', true ), |
|
166
|
|
- 'mapZoom' => get_post_meta( $postid, 'ase_map_component_zoom', true ), |
|
|
163
|
+ 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, |
|
|
164
|
+ 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), |
|
|
165
|
+ 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), |
|
|
166
|
+ 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), |
|
167
|
167
|
'revisionModal' => lasso_editor_revision_modal(), |
|
168
|
168
|
'isMobile' => wp_is_mobile(), |
|
169
|
|
- 'enableAutoSave' => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ), |
|
|
169
|
+ 'enableAutoSave' => lasso_editor_get_option('enable_autosave', 'lasso_editor'), |
|
170
|
170
|
'showColor' => $show_color, |
|
171
|
171
|
'showAlignment' => $show_align |
|
172
|
172
|
); |
|
173
|
173
|
|
|
174
|
174
|
|
|
175
|
175
|
// wp api client |
|
176
|
|
- wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
177
|
|
- $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
|
178
|
|
- wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
|
|
176
|
+ wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
|
177
|
+ $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json')); |
|
|
178
|
+ wp_localize_script('wp-api-js', 'WP_API_Settings', $settings); |
|
179
|
179
|
|
|
180
|
|
- $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
|
|
180
|
+ $postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min'; |
|
181
|
181
|
if ($show_color) { |
|
182
|
|
- wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'iris'), LASSO_VERSION, true); |
|
|
182
|
+ wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'iris'), LASSO_VERSION, true); |
|
183
|
183
|
} else { |
|
184
|
|
- wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true); |
|
|
184
|
+ wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true); |
|
185
|
185
|
} |
|
186
|
|
- wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
|
|
186
|
+ wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects)); |
|
187
|
187
|
|
|
188
|
188
|
//enqueue js if tour is not hidden |
|
189
|
|
- $tour_hidden = get_user_meta( get_current_user_ID(), 'lasso_hide_tour', true ); |
|
190
|
|
- if ( lasso_user_can() && !$tour_hidden ){ |
|
191
|
|
- wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/tour.js", array('jquery', 'lasso'), LASSO_VERSION, true); |
|
|
189
|
+ $tour_hidden = get_user_meta(get_current_user_ID(), 'lasso_hide_tour', true); |
|
|
190
|
+ if (lasso_user_can() && !$tour_hidden) { |
|
|
191
|
+ wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/tour.js", array('jquery', 'lasso'), LASSO_VERSION, true); |
|
192
|
192
|
} |
|
193
|
193
|
|
|
194
|
194
|
} |