@@ -18,27 +18,27 @@ discard block |
||
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.1.5' ); |
|
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.1.5'); |
|
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 |
||
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 |
||
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 |
||
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 |
@@ -10,30 +10,30 @@ discard block |
||
10 | 10 | |
11 | 11 | function __construct() { |
12 | 12 | |
13 | - add_action( 'admin_init', array( $this, 'redirect' ) ); |
|
14 | - add_action( 'admin_menu', array( $this, 'lasso_welcome' ) ); |
|
15 | - add_action( 'network_admin_menu', array( $this, 'lasso_welcome' ) ); // CHANGED Added hook. |
|
13 | + add_action('admin_init', array($this, 'redirect')); |
|
14 | + add_action('admin_menu', array($this, 'lasso_welcome')); |
|
15 | + add_action('network_admin_menu', array($this, 'lasso_welcome')); // CHANGED Added hook. |
|
16 | 16 | |
17 | - add_action( 'tgmpa_register', array( $this,'required_plugins' )); |
|
17 | + add_action('tgmpa_register', array($this, 'required_plugins')); |
|
18 | 18 | |
19 | 19 | } |
20 | 20 | |
21 | 21 | function redirect() { |
22 | 22 | |
23 | 23 | // Bail if no activation redirect |
24 | - if ( !get_transient( '_lasso_welcome_redirect' ) ) { |
|
24 | + if (!get_transient('_lasso_welcome_redirect')) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | // Delete the redirect transient |
29 | - delete_transient( '_lasso_welcome_redirect' ); |
|
29 | + delete_transient('_lasso_welcome_redirect'); |
|
30 | 30 | |
31 | 31 | // Bail if activating from network, or bulk |
32 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
32 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - wp_safe_redirect( esc_url_raw( add_query_arg( array( 'page' => 'lasso-editor' ), admin_url( 'admin.php' ) ) ) ); |
|
36 | + wp_safe_redirect(esc_url_raw(add_query_arg(array('page' => 'lasso-editor'), admin_url('admin.php')))); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | function lasso_welcome() { |
46 | 46 | |
47 | 47 | // CHANGED Removed condition. |
48 | - add_menu_page( __( 'Editus', 'lasso' ), __( 'Editus', 'lasso' ), 'manage_options', 'lasso-editor', '', LASSO_URL.'/admin/assets/img/menu-icon.png' ); |
|
49 | - add_submenu_page( 'lasso-editor', __( 'Welcome', 'lasso' ), __( 'Status', 'lasso' ), 'manage_options', 'lasso-editor', array( $this, 'welcome' ) ); |
|
48 | + add_menu_page(__('Editus', 'lasso'), __('Editus', 'lasso'), 'manage_options', 'lasso-editor', '', LASSO_URL.'/admin/assets/img/menu-icon.png'); |
|
49 | + add_submenu_page('lasso-editor', __('Welcome', 'lasso'), __('Status', 'lasso'), 'manage_options', 'lasso-editor', array($this, 'welcome')); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | ?> |
61 | 61 | <div class="wrap lasso--welcome"> |
62 | 62 | |
63 | - <?php self::header();?> |
|
63 | + <?php self::header(); ?> |
|
64 | 64 | |
65 | 65 | <ul class="lasso--welcome__steps"> |
66 | 66 | |
67 | 67 | <?php // CHANGED Added the is_network_admin condition. ?> |
68 | - <?php if ( is_network_admin() ) : ?> |
|
68 | + <?php if (is_network_admin()) : ?> |
|
69 | 69 | |
70 | 70 | <li> |
71 | - <p><?php _e( 'We will check the current theme on every site in your network and give you a quick status feedback here. You can see the status by visiting the Editus menu on each site.', 'lasso' );?></p> |
|
71 | + <p><?php _e('We will check the current theme on every site in your network and give you a quick status feedback here. You can see the status by visiting the Editus menu on each site.', 'lasso'); ?></p> |
|
72 | 72 | </li> |
73 | 73 | |
74 | 74 | <?php else : |
75 | 75 | |
76 | 76 | $checks = self::lasso_preflight_check(); |
77 | 77 | |
78 | - if ( $checks && !defined( 'LASSO_AGENCY_MODE' ) ): |
|
78 | + if ($checks && !defined('LASSO_AGENCY_MODE')): |
|
79 | 79 | |
80 | - foreach ( (array) $checks as $key => $check ) { |
|
80 | + foreach ((array) $checks as $key => $check) { |
|
81 | 81 | |
82 | 82 | echo $check; |
83 | 83 | } |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | // pre-flight is go for flight |
88 | 88 | ?> |
89 | 89 | <li class="success"> |
90 | - <h3><?php _e( 'You\'re Ready to Rock!', 'lasso' );?></h3> |
|
91 | - <?php if ( lasso_get_supported_theme_class() ) { ?> |
|
92 | - <p><?php _e( 'Your theme is automatically supported. No additional setup is needed.', 'lasso' );?></p> |
|
90 | + <h3><?php _e('You\'re Ready to Rock!', 'lasso'); ?></h3> |
|
91 | + <?php if (lasso_get_supported_theme_class()) { ?> |
|
92 | + <p><?php _e('Your theme is automatically supported. No additional setup is needed.', 'lasso'); ?></p> |
|
93 | 93 | <?php } ?> |
94 | - <p><?php _e( 'Editus will place a small menu on the bottom of your site. While on a single post or page, click the "pen" icon to go into edit mode. Press escape to get out of edit mode.', 'lasso' );?></p> |
|
94 | + <p><?php _e('Editus will place a small menu on the bottom of your site. While on a single post or page, click the "pen" icon to go into edit mode. Press escape to get out of edit mode.', 'lasso'); ?></p> |
|
95 | 95 | </li> |
96 | 96 | <?php |
97 | 97 | endif; |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | |
114 | 114 | <div class="lasso--welcome__top"> |
115 | 115 | |
116 | - <img style="width:125px;" src="<?php echo LASSO_URL.'/admin/assets/img/logo.png';?>"> |
|
117 | - <h1><?php _e( 'Welcome to Editus', 'lasso' );?></h1> |
|
118 | - <p><?php _e( 'Version', 'lasso' );echo '<span> '.LASSO_VERSION.'</span>';?></p> |
|
116 | + <img style="width:125px;" src="<?php echo LASSO_URL.'/admin/assets/img/logo.png'; ?>"> |
|
117 | + <h1><?php _e('Welcome to Editus', 'lasso'); ?></h1> |
|
118 | + <p><?php _e('Version', 'lasso'); echo '<span> '.LASSO_VERSION.'</span>'; ?></p> |
|
119 | 119 | |
120 | - <?php if ( !defined( 'LASSO_AGENCY_MODE' ) ): ?> |
|
120 | + <?php if (!defined('LASSO_AGENCY_MODE')): ?> |
|
121 | 121 | |
122 | 122 | <ul class="lasso--welcome__social"> |
123 | - <li><a href="https://edituswp.com/help" target="_blank"><i class="dashicons dashicons-sos"></i> <?php _e( 'Help', 'lasso' );?></a></li> |
|
124 | - <li><a href="http://twitter.com/aesopinteractiv" target="_blank"><i class="dashicons dashicons-twitter"></i> <?php _e( 'Twitter', 'lasso' );?></a></li> |
|
125 | - <li><a href="http://facebook.com/aesopinteractive" target="_blank"><i class="dashicons dashicons-facebook"></i> <?php _e( 'Facebook', 'lasso' );?></a></li> |
|
123 | + <li><a href="https://edituswp.com/help" target="_blank"><i class="dashicons dashicons-sos"></i> <?php _e('Help', 'lasso'); ?></a></li> |
|
124 | + <li><a href="http://twitter.com/aesopinteractiv" target="_blank"><i class="dashicons dashicons-twitter"></i> <?php _e('Twitter', 'lasso'); ?></a></li> |
|
125 | + <li><a href="http://facebook.com/aesopinteractive" target="_blank"><i class="dashicons dashicons-facebook"></i> <?php _e('Facebook', 'lasso'); ?></a></li> |
|
126 | 126 | </ul> |
127 | 127 | |
128 | 128 | <?php endif; ?> |
@@ -139,68 +139,68 @@ discard block |
||
139 | 139 | */ |
140 | 140 | function lasso_preflight_check() { |
141 | 141 | |
142 | - $notices = array(); |
|
142 | + $notices = array(); |
|
143 | 143 | |
144 | - $article_object = lasso_editor_get_option( 'article_class', 'lasso_editor' ); |
|
144 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
145 | 145 | |
146 | - $theme_name = wp_get_theme()->get('Name'); |
|
147 | - $theme_class = lasso_get_supported_theme_class(); |
|
146 | + $theme_name = wp_get_theme()->get('Name'); |
|
147 | + $theme_class = lasso_get_supported_theme_class(); |
|
148 | 148 | |
149 | - $license = get_option( 'lasso_license_key' ); |
|
150 | - $status = get_option( 'lasso_license_status' ); |
|
149 | + $license = get_option('lasso_license_key'); |
|
150 | + $status = get_option('lasso_license_status'); |
|
151 | 151 | |
152 | 152 | // Gutenberg Not Supported |
153 | - if( function_exists( 'is_gutenberg_page' ) || function_exists( 'use_block_editor_for_post') ) { |
|
153 | + if (function_exists('is_gutenberg_page') || function_exists('use_block_editor_for_post')) { |
|
154 | 154 | $notices[] = '<li class="info"><h3>Gutenberg Not Supported.</h3> |
155 | - <p>'.__( 'Currently Editus does not support Gutenberg. It will be disabled on Gutenberg enabled posts.', 'lasso' ).'</p> |
|
155 | + <p>'.__('Currently Editus does not support Gutenberg. It will be disabled on Gutenberg enabled posts.', 'lasso').'</p> |
|
156 | 156 | </li>'; |
157 | 157 | } |
158 | 158 | |
159 | 159 | // if the required CSS class has not been saved and we're not a supported theme |
160 | - if ( empty( $article_object ) && false == $theme_class ) { |
|
160 | + if (empty($article_object) && false == $theme_class) { |
|
161 | 161 | |
162 | 162 | // we dont automatically support this theme so show them otherwise |
163 | 163 | $notices[] = sprintf('<li class="error"> |
164 | - <h3>'.__( 'Article CSS Class Needed!', 'lasso' ).'</h3> |
|
165 | - <p>'.__( 'Before using Editus,', 'lasso' ).' <a href="%s">'.__( 'enter and save', 'lasso' ).'</a> '.__( 'the CSS class of the container that holds your post and page content. You can <a href="https://dl.dropboxusercontent.com/u/5594632/lasso-media/doc-movies/using-inspector-lasso.gif" target="_blank">use a tool like inspector</a> in Chrome or Firefox to find this CSS class, or ', 'lasso' ).' <a href="mailto:[email protected]">'.__( 'email us.', 'lasso' ).'</a> '.__( 'with a link to a public URL with the theme and we\'ll find it for you.', 'lasso' ).'</p> |
|
166 | - </li>', admin_url( 'admin.php?page=lasso-editor-settings' ) ); |
|
164 | + <h3>'.__('Article CSS Class Needed!', 'lasso').'</h3> |
|
165 | + <p>'.__('Before using Editus,', 'lasso').' <a href="%s">'.__('enter and save', 'lasso').'</a> '.__('the CSS class of the container that holds your post and page content. You can <a href="https://dl.dropboxusercontent.com/u/5594632/lasso-media/doc-movies/using-inspector-lasso.gif" target="_blank">use a tool like inspector</a> in Chrome or Firefox to find this CSS class, or ', 'lasso').' <a href="mailto:[email protected]">'.__('email us.', 'lasso').'</a> '.__('with a link to a public URL with the theme and we\'ll find it for you.', 'lasso').'</p> |
|
166 | + </li>', admin_url('admin.php?page=lasso-editor-settings')); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // WP REST API not active |
170 | - if ( !function_exists( 'json_get_url_prefix' ) && !function_exists( 'rest_url' )) { |
|
170 | + if (!function_exists('json_get_url_prefix') && !function_exists('rest_url')) { |
|
171 | 171 | $notices[] = '<li class="info"><h3>WP REST API not Activated!</h3> |
172 | - <p>'.__( 'Just a heads up that the WP REST API isn\'t activated. This is required to list the posts and pages on the front-end.', 'lasso' ).'</p> |
|
172 | + <p>'.__('Just a heads up that the WP REST API isn\'t activated. This is required to list the posts and pages on the front-end.', 'lasso').'</p> |
|
173 | 173 | </li>'; |
174 | 174 | } |
175 | 175 | |
176 | 176 | // aesop story engine isnt active |
177 | - if ( !class_exists( 'Aesop_Core' ) ) { |
|
178 | - $notices[] = sprintf( '<li class="info"><h3>Aesop Story Engine not Activated!</h3> |
|
179 | - <p>'.__( 'Just a heads up that ', 'lasso' ).'<a href="%s" target="_blank |
|
180 | - ">'.__( 'Aesop Story Engine', 'lasso' ).'</a> '.__( 'isn\'t activated. It\'s not required to use Editus, but you won\'t get the cool drag and drop components without it activated. It\'s free!', 'lasso' ).'</p> |
|
181 | - </li>', admin_url('plugin-install.php?tab=search&s=aesop+story+engine') ); |
|
177 | + if (!class_exists('Aesop_Core')) { |
|
178 | + $notices[] = sprintf('<li class="info"><h3>Aesop Story Engine not Activated!</h3> |
|
179 | + <p>'.__('Just a heads up that ', 'lasso').'<a href="%s" target="_blank |
|
180 | + ">'.__('Aesop Story Engine', 'lasso').'</a> '.__('isn\'t activated. It\'s not required to use Editus, but you won\'t get the cool drag and drop components without it activated. It\'s free!', 'lasso').'</p> |
|
181 | + </li>', admin_url('plugin-install.php?tab=search&s=aesop+story+engine')); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | // we dont really get along with wp side comments because of the section ids that get applied dynamically. since we save our html, it'll get saved along with the post as HTML |
185 | - if ( class_exists( 'WP_Side_Comments' ) ) { |
|
186 | - $notices[] = '<li class="error"><h3>'.__( 'WP Side Comments Compatibility Warning!', 'lasso' ).'</h3> |
|
187 | - <p>'.__( 'Since Editus saves the HTML of a post, this may cause undesired issues. We\'re working to resolve incompatibilities faster than a jack rabbit in a hot greasy griddle in the middle of August.', 'lasso' ).'</p> |
|
185 | + if (class_exists('WP_Side_Comments')) { |
|
186 | + $notices[] = '<li class="error"><h3>'.__('WP Side Comments Compatibility Warning!', 'lasso').'</h3> |
|
187 | + <p>'.__('Since Editus saves the HTML of a post, this may cause undesired issues. We\'re working to resolve incompatibilities faster than a jack rabbit in a hot greasy griddle in the middle of August.', 'lasso').'</p> |
|
188 | 188 | </li>'; |
189 | 189 | } |
190 | 190 | |
191 | 191 | // if the license key isnt activated |
192 | - if ( empty( $license ) ) { |
|
193 | - $notices[] = '<li class="info"><h3>'.__( 'License Key Not Activated', 'lasso' ).'</h3> |
|
194 | - <p>'.__( 'Just a heads up, your license key isn\'t activated. Enter your license key into the License tab on the left in order to receive plugin update notifications.', 'lasso' ).'</p> |
|
192 | + if (empty($license)) { |
|
193 | + $notices[] = '<li class="info"><h3>'.__('License Key Not Activated', 'lasso').'</h3> |
|
194 | + <p>'.__('Just a heads up, your license key isn\'t activated. Enter your license key into the License tab on the left in order to receive plugin update notifications.', 'lasso').'</p> |
|
195 | 195 | </li>'; |
196 | 196 | } |
197 | - if ( !empty( $license ) && 'invalid' == $status ) { |
|
198 | - $notices[] = '<li class="error"><h3>'.__( 'License Key Invalid', 'lasso' ).'</h3> |
|
199 | - <p>'.__( 'The license key that you entered is ', 'lasso' ).'<strong>'.__( 'invalid', 'lasso' ).'</strong>'.__( '. It may have been entered incorreclty, or may have expired.', 'lasso' ).'</p> |
|
197 | + if (!empty($license) && 'invalid' == $status) { |
|
198 | + $notices[] = '<li class="error"><h3>'.__('License Key Invalid', 'lasso').'</h3> |
|
199 | + <p>'.__('The license key that you entered is ', 'lasso').'<strong>'.__('invalid', 'lasso').'</strong>'.__('. It may have been entered incorreclty, or may have expired.', 'lasso').'</p> |
|
200 | 200 | </li>'; |
201 | 201 | } |
202 | 202 | |
203 | - return apply_filters( 'lasso_preflight_notices', $notices ); |
|
203 | + return apply_filters('lasso_preflight_notices', $notices); |
|
204 | 204 | |
205 | 205 | } |
206 | 206 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $plugins = array( |
215 | 215 | |
216 | 216 | array( |
217 | - 'name' => __('Aesop Story Engine','lasso'), |
|
217 | + 'name' => __('Aesop Story Engine', 'lasso'), |
|
218 | 218 | 'slug' => 'aesop-story-engine', |
219 | 219 | 'required' => false, |
220 | 220 | ), |
@@ -222,38 +222,38 @@ discard block |
||
222 | 222 | ); |
223 | 223 | |
224 | 224 | $config = array( |
225 | - 'default_path' => '', // Default absolute path to pre-packaged plugins. |
|
225 | + 'default_path' => '', // Default absolute path to pre-packaged plugins. |
|
226 | 226 | 'menu' => 'lasso-install-plugins', // Menu slug. |
227 | - 'has_notices' => true, // Show admin notices or not. |
|
228 | - 'dismissable' => true, // If false, a user cannot dismiss the nag message. |
|
229 | - 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. |
|
230 | - 'is_automatic' => false, // Automatically activate plugins after installation or not. |
|
231 | - 'message' => '', // Message to output right before the plugins table. |
|
227 | + 'has_notices' => true, // Show admin notices or not. |
|
228 | + 'dismissable' => true, // If false, a user cannot dismiss the nag message. |
|
229 | + 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. |
|
230 | + 'is_automatic' => false, // Automatically activate plugins after installation or not. |
|
231 | + 'message' => '', // Message to output right before the plugins table. |
|
232 | 232 | 'strings' => array( |
233 | - 'page_title' => __( 'Install Required Plugins', 'lasso' ), |
|
234 | - 'menu_title' => __( 'Install Plugins', 'lasso' ), |
|
235 | - 'installing' => __( 'Installing Plugin: %s', 'lasso' ), // %s = plugin name. |
|
236 | - 'oops' => __( 'Something went wrong with the plugin API.', 'lasso' ), |
|
237 | - 'notice_can_install_required' => _n_noop( 'This plugin requires the following plugin: %1$s.', 'This plugin requires the following plugins: %1$s.' ), // %1$s = plugin name(s). |
|
238 | - 'notice_can_install_recommended' => _n_noop( 'This plugin recommends the following plugin: %1$s.', 'This plugin recommends the following plugins: %1$s.' ), // %1$s = plugin name(s). |
|
239 | - 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s). |
|
240 | - 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s). |
|
241 | - 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s). |
|
242 | - 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s). |
|
243 | - 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this plugin: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this plugin: %1$s.' ), // %1$s = plugin name(s). |
|
244 | - 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s). |
|
245 | - 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ), |
|
246 | - 'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins' ), |
|
247 | - 'return' => __( 'Return to Required Plugins Installer', 'lasso' ), |
|
248 | - 'plugin_activated' => __( 'Plugin activated successfully.', 'lasso' ), |
|
249 | - 'complete' => __( 'All plugins installed and activated successfully. %s', 'lasso' ), // %s = dashboard link. |
|
233 | + 'page_title' => __('Install Required Plugins', 'lasso'), |
|
234 | + 'menu_title' => __('Install Plugins', 'lasso'), |
|
235 | + 'installing' => __('Installing Plugin: %s', 'lasso'), // %s = plugin name. |
|
236 | + 'oops' => __('Something went wrong with the plugin API.', 'lasso'), |
|
237 | + 'notice_can_install_required' => _n_noop('This plugin requires the following plugin: %1$s.', 'This plugin requires the following plugins: %1$s.'), // %1$s = plugin name(s). |
|
238 | + 'notice_can_install_recommended' => _n_noop('This plugin recommends the following plugin: %1$s.', 'This plugin recommends the following plugins: %1$s.'), // %1$s = plugin name(s). |
|
239 | + 'notice_cannot_install' => _n_noop('Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.'), // %1$s = plugin name(s). |
|
240 | + 'notice_can_activate_required' => _n_noop('The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.'), // %1$s = plugin name(s). |
|
241 | + 'notice_can_activate_recommended' => _n_noop('The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.'), // %1$s = plugin name(s). |
|
242 | + 'notice_cannot_activate' => _n_noop('Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.'), // %1$s = plugin name(s). |
|
243 | + 'notice_ask_to_update' => _n_noop('The following plugin needs to be updated to its latest version to ensure maximum compatibility with this plugin: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this plugin: %1$s.'), // %1$s = plugin name(s). |
|
244 | + 'notice_cannot_update' => _n_noop('Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.'), // %1$s = plugin name(s). |
|
245 | + 'install_link' => _n_noop('Begin installing plugin', 'Begin installing plugins'), |
|
246 | + 'activate_link' => _n_noop('Begin activating plugin', 'Begin activating plugins'), |
|
247 | + 'return' => __('Return to Required Plugins Installer', 'lasso'), |
|
248 | + 'plugin_activated' => __('Plugin activated successfully.', 'lasso'), |
|
249 | + 'complete' => __('All plugins installed and activated successfully. %s', 'lasso'), // %s = dashboard link. |
|
250 | 250 | 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'. |
251 | 251 | ) |
252 | 252 | ); |
253 | 253 | |
254 | - $plugins = apply_filters( 'lasso_required_plugins', $plugins ); |
|
254 | + $plugins = apply_filters('lasso_required_plugins', $plugins); |
|
255 | 255 | |
256 | - tgmpa( $plugins, $config ); |
|
256 | + tgmpa($plugins, $config); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | } |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | |
21 | 21 | global $post; |
22 | 22 | if ( lasso_user_can('edit_posts') && |
23 | - !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) ) {// bail if the post has Gutenberg bloc |
|
23 | + !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) ) {// bail if the post has Gutenberg bloc |
|
24 | 24 | |
25 | 25 | /** Returns the time offset from UTC |
26 | - */ |
|
26 | + */ |
|
27 | 27 | function get_UTC_offset() { |
28 | 28 | $timezone_string = get_option( 'timezone_string' ); |
29 | 29 | if (empty( $timezone_string ) ) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
40 | 40 | |
41 | - //don't load autocomplete if it's a stockholm theme |
|
41 | + //don't load autocomplete if it's a stockholm theme |
|
42 | 42 | $themename = wp_get_theme()->get('Name'); |
43 | 43 | if ($themename !='Stockholm' ) { |
44 | 44 | wp_enqueue_script('jquery-ui-autocomplete'); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $tz_offset = get_UTC_offset(); |
114 | 114 | $post_date = get_the_time('U', $postid); |
115 | 115 | $time = (time()+$tz_offset); |
116 | - $delta = $time - $post_date; |
|
116 | + $delta = $time - $post_date; |
|
117 | 117 | |
118 | 118 | $strings = array( |
119 | 119 | 'save' => __('Save','lasso'), |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
169 | 169 | |
170 | 170 | |
171 | - if ($allow_change_date) { |
|
172 | - $permalink = get_site_url().'/?p='.$postid; |
|
173 | - } else { |
|
174 | - $permalink = get_permalink($postid); |
|
175 | - } |
|
171 | + if ($allow_change_date) { |
|
172 | + $permalink = get_site_url().'/?p='.$postid; |
|
173 | + } else { |
|
174 | + $permalink = get_permalink($postid); |
|
175 | + } |
|
176 | 176 | |
177 | 177 | // rest api |
178 | 178 | $rest_nonce = ''; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'customFields' => $custom_fields, |
267 | 267 | 'clickToInsert' => ($insert_comp_ui =='click'), |
268 | 268 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
269 | - 'rtl' => is_rtl(), |
|
269 | + 'rtl' => is_rtl(), |
|
270 | 270 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
271 | 271 | 'linksEditable' => $links_editable, |
272 | 272 | 'supportPendingStatus' => !$no_pending_status, |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | |
280 | 280 | if (!$using_restapiv2) { |
281 | - // enqueue REST API V1 |
|
281 | + // enqueue REST API V1 |
|
282 | 282 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
283 | 283 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
284 | 284 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if ($show_color) { |
295 | 295 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
296 | 296 | } else { |
297 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
297 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
298 | 298 | } |
299 | 299 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
300 | 300 |
@@ -10,24 +10,24 @@ discard block |
||
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 | global $post; |
22 | - if ( lasso_user_can('edit_posts') && |
|
23 | - !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) ) {// bail if the post has Gutenberg bloc |
|
22 | + if (lasso_user_can('edit_posts') && |
|
23 | + !(function_exists('has_blocks') && has_blocks($post->post_content) && !is_home())) {// bail if the post has Gutenberg bloc |
|
24 | 24 | |
25 | 25 | /** Returns the time offset from UTC |
26 | 26 | */ |
27 | 27 | function get_UTC_offset() { |
28 | - $timezone_string = get_option( 'timezone_string' ); |
|
29 | - if (empty( $timezone_string ) ) { |
|
30 | - return get_option('gmt_offset')*3600; |
|
28 | + $timezone_string = get_option('timezone_string'); |
|
29 | + if (empty($timezone_string)) { |
|
30 | + return get_option('gmt_offset') * 3600; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $origin_dtz = new \DateTimeZone($timezone_string); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
40 | 40 | |
41 | 41 | //don't load autocomplete if it's a stockholm theme |
42 | - $themename = wp_get_theme()->get('Name'); |
|
43 | - if ($themename !='Stockholm' ) { |
|
42 | + $themename = wp_get_theme()->get('Name'); |
|
43 | + if ($themename != 'Stockholm') { |
|
44 | 44 | wp_enqueue_script('jquery-ui-autocomplete'); |
45 | 45 | } |
46 | 46 | wp_enqueue_script('jquery-ui-draggable'); |
@@ -53,28 +53,28 @@ discard block |
||
53 | 53 | // url for json api |
54 | 54 | $home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false; |
55 | 55 | |
56 | - $article_object = lasso_editor_get_option('article_class','lasso_editor'); |
|
56 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
57 | 57 | |
58 | - $article_object = empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
58 | + $article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
59 | 59 | |
60 | - $featImgClass = lasso_editor_get_option('featimg_class','lasso_editor'); |
|
61 | - if (empty( $featImgClass )) { |
|
60 | + $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
61 | + if (empty($featImgClass)) { |
|
62 | 62 | $featImgClass = lasso_get_supported_theme_featured_image_class(); |
63 | 63 | } |
64 | - $titleClass = lasso_editor_get_option('title_class','lasso_editor'); |
|
65 | - if (empty( $titleClass )) { |
|
64 | + $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
65 | + if (empty($titleClass)) { |
|
66 | 66 | $titleClass = lasso_get_supported_theme_title_class(); |
67 | 67 | } |
68 | - $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
69 | - $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
68 | + $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
69 | + $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
70 | 70 | $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
71 | - $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
71 | + $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
72 | 72 | $disableRESTSave = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor'); |
73 | - $save_to_post_disabled = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' ); |
|
74 | - $edit_post_disabled = lasso_editor_get_option( 'post_edit_disabled', 'lasso_editor' ); |
|
73 | + $save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor'); |
|
74 | + $edit_post_disabled = lasso_editor_get_option('post_edit_disabled', 'lasso_editor'); |
|
75 | 75 | |
76 | - $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b'); |
|
77 | - $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i'); |
|
76 | + $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor', 'b'); |
|
77 | + $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor', 'i'); |
|
78 | 78 | |
79 | 79 | |
80 | 80 | //text alignement |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | |
92 | 92 | if ($show_color) { |
93 | 93 | //color picker |
94 | - wp_enqueue_style( 'wp-color-picker' ); |
|
95 | - wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); |
|
94 | + wp_enqueue_style('wp-color-picker'); |
|
95 | + wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // click to insert components, not drag and drop |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | // custom fields |
106 | 106 | |
107 | - $custom_fields = apply_filters( 'editus_custom_fields', null ); //array('testFieldName' => '#field1'); |
|
107 | + $custom_fields = apply_filters('editus_custom_fields', null); //array('testFieldName' => '#field1'); |
|
108 | 108 | |
109 | 109 | |
110 | 110 | |
@@ -112,47 +112,47 @@ discard block |
||
112 | 112 | $postid = get_the_ID(); |
113 | 113 | $tz_offset = get_UTC_offset(); |
114 | 114 | $post_date = get_the_time('U', $postid); |
115 | - $time = (time()+$tz_offset); |
|
115 | + $time = (time() + $tz_offset); |
|
116 | 116 | $delta = $time - $post_date; |
117 | 117 | |
118 | 118 | $strings = array( |
119 | - 'save' => __('Save','lasso'), |
|
120 | - 'selectText' => __('Please Select Text First.','lasso'), |
|
121 | - 'cancel' => __('Cancel','lasso'), |
|
122 | - 'exiteditor' => __('Exit Editor','lasso'), |
|
123 | - 'saving' => __('Saving...','lasso'), |
|
124 | - 'saved' => __('Saved!','lasso'), |
|
125 | - 'adding' => __('Adding...','lasso'), |
|
126 | - 'added' => __('Added!','lasso'), |
|
127 | - 'loading' => __('Loading...','lasso'), |
|
128 | - 'loadMore' => __('Load More','lasso'), |
|
129 | - 'close' => __('Close','lasso'), |
|
130 | - 'noPostsFound' => __('No more posts found','lasso'), |
|
131 | - 'fetchFail' => __('Fetching failed.','lasso'), |
|
132 | - 'galleryCreated' => __('Gallery Created!','lasso'), |
|
133 | - 'galleryUpdated' => __('Gallery Updated!','lasso'), |
|
134 | - 'justWrite' => __('Just write...','lasso'), |
|
135 | - 'chooseImage' => __('Choose an image','lasso'), |
|
136 | - 'updateImage' => __('Update Image','lasso'), |
|
137 | - 'insertImage' => __('Insert Image','lasso'), |
|
138 | - 'selectImage' => __('Select Image','lasso'), |
|
139 | - 'removeFeatImg' => __('Remove featured image?','lasso'), |
|
140 | - 'updateSelectedImg' => __('Update Selected Image','lasso'), |
|
141 | - 'chooseImages' => __('Choose images','lasso'), |
|
142 | - 'editImage' => __('Edit Image','lasso'), |
|
143 | - 'addImages' => __('Add Images','lasso'), |
|
144 | - 'addNewGallery' => __('Add New Gallery','lasso'), |
|
145 | - 'selectGallery' => __('Select Editus Gallery Image','lasso'), |
|
146 | - 'useSelectedImages' => __('Use Selected Images','lasso'), |
|
147 | - 'publishPost' => __('Publish Post?','lasso'), |
|
148 | - 'publishYes' => __('Yes, publish it!','lasso'), |
|
149 | - 'deletePost' => __('Trash Post?','lasso'), |
|
150 | - 'deleteYes' => __('Yes, trash it!','lasso'), |
|
151 | - 'warning' => __('Oh snap!','laso'), |
|
152 | - 'cancelText' => __('O.K. got it!','lasso'), |
|
153 | - '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'), |
|
119 | + 'save' => __('Save', 'lasso'), |
|
120 | + 'selectText' => __('Please Select Text First.', 'lasso'), |
|
121 | + 'cancel' => __('Cancel', 'lasso'), |
|
122 | + 'exiteditor' => __('Exit Editor', 'lasso'), |
|
123 | + 'saving' => __('Saving...', 'lasso'), |
|
124 | + 'saved' => __('Saved!', 'lasso'), |
|
125 | + 'adding' => __('Adding...', 'lasso'), |
|
126 | + 'added' => __('Added!', 'lasso'), |
|
127 | + 'loading' => __('Loading...', 'lasso'), |
|
128 | + 'loadMore' => __('Load More', 'lasso'), |
|
129 | + 'close' => __('Close', 'lasso'), |
|
130 | + 'noPostsFound' => __('No more posts found', 'lasso'), |
|
131 | + 'fetchFail' => __('Fetching failed.', 'lasso'), |
|
132 | + 'galleryCreated' => __('Gallery Created!', 'lasso'), |
|
133 | + 'galleryUpdated' => __('Gallery Updated!', 'lasso'), |
|
134 | + 'justWrite' => __('Just write...', 'lasso'), |
|
135 | + 'chooseImage' => __('Choose an image', 'lasso'), |
|
136 | + 'updateImage' => __('Update Image', 'lasso'), |
|
137 | + 'insertImage' => __('Insert Image', 'lasso'), |
|
138 | + 'selectImage' => __('Select Image', 'lasso'), |
|
139 | + 'removeFeatImg' => __('Remove featured image?', 'lasso'), |
|
140 | + 'updateSelectedImg' => __('Update Selected Image', 'lasso'), |
|
141 | + 'chooseImages' => __('Choose images', 'lasso'), |
|
142 | + 'editImage' => __('Edit Image', 'lasso'), |
|
143 | + 'addImages' => __('Add Images', 'lasso'), |
|
144 | + 'addNewGallery' => __('Add New Gallery', 'lasso'), |
|
145 | + 'selectGallery' => __('Select Editus Gallery Image', 'lasso'), |
|
146 | + 'useSelectedImages' => __('Use Selected Images', 'lasso'), |
|
147 | + 'publishPost' => __('Publish Post?', 'lasso'), |
|
148 | + 'publishYes' => __('Yes, publish it!', 'lasso'), |
|
149 | + 'deletePost' => __('Trash Post?', 'lasso'), |
|
150 | + 'deleteYes' => __('Yes, trash it!', 'lasso'), |
|
151 | + 'warning' => __('Oh snap!', 'laso'), |
|
152 | + 'cancelText' => __('O.K. got it!', 'lasso'), |
|
153 | + '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'), |
|
154 | 154 | 'missingConfirm' => __('Update Settings', 'lasso'), |
155 | - 'helperText' => __('one more letter','lasso'), |
|
155 | + 'helperText' => __('one more letter', 'lasso'), |
|
156 | 156 | 'editingBackup' => __('You are currently editing a backup copy of this post.'), |
157 | 157 | |
158 | 158 | 'catsPlaceholder' => __('add categories...'), |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | |
162 | 162 | ); |
163 | 163 | |
164 | - $api_url = trailingslashit( home_url() ) . 'lasso-internal-api'; |
|
164 | + $api_url = trailingslashit(home_url()).'lasso-internal-api'; |
|
165 | 165 | |
166 | 166 | $gallery_class = new gallery(); |
167 | 167 | $gallery_nonce_action = $gallery_class->nonce_action; |
168 | - $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
|
168 | + $gallery_nonce = wp_create_nonce($gallery_nonce_action); |
|
169 | 169 | |
170 | 170 | |
171 | 171 | if ($allow_change_date) { |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | |
181 | 181 | if (function_exists('rest_url')) { |
182 | 182 | //$rest_root = esc_url_raw( rest_url()); |
183 | - $rest_nonce = wp_create_nonce( 'wp_rest' ); |
|
184 | - $settings = array( 'root' => $rest_root, 'nonce' => $rest_nonce ); |
|
185 | - wp_enqueue_script( 'wp-api', '', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
186 | - wp_localize_script( 'wp-api', 'wpApiSettings', $settings ); |
|
187 | - wp_localize_script( 'wp-api', 'WP_API_Settings', $settings ); |
|
183 | + $rest_nonce = wp_create_nonce('wp_rest'); |
|
184 | + $settings = array('root' => $rest_root, 'nonce' => $rest_nonce); |
|
185 | + wp_enqueue_script('wp-api', '', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
186 | + wp_localize_script('wp-api', 'wpApiSettings', $settings); |
|
187 | + wp_localize_script('wp-api', 'WP_API_Settings', $settings); |
|
188 | 188 | |
189 | - if ( class_exists( 'WP_REST_Controller' )) { |
|
189 | + if (class_exists('WP_REST_Controller')) { |
|
190 | 190 | // we are using REST API V2 |
191 | 191 | $using_restapiv2 = true; |
192 | 192 | } |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | |
195 | 195 | // localized objects |
196 | 196 | $objects = array( |
197 | - 'ajaxurl' => esc_url( $api_url ), |
|
198 | - 'ajaxurl2' => esc_url( admin_url( 'admin-ajax.php' )), |
|
197 | + 'ajaxurl' => esc_url($api_url), |
|
198 | + 'ajaxurl2' => esc_url(admin_url('admin-ajax.php')), |
|
199 | 199 | 'siteUrl' => site_url(), |
200 | 200 | 'rest_root' => $rest_root, |
201 | 201 | 'rest_nonce' => $rest_nonce, |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | 'featImgClass' => $featImgClass, |
205 | 205 | 'titleClass' => $titleClass, |
206 | 206 | 'strings' => $strings, |
207 | - 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ), |
|
208 | - 'post_status' => get_post_status( $postid ), |
|
207 | + 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), |
|
208 | + 'post_status' => get_post_status($postid), |
|
209 | 209 | 'postid' => $postid, |
210 | 210 | 'permalink' => $permalink, |
211 | 211 | 'edit_others_pages' => current_user_can('edit_others_pages') ? true : false, |
212 | 212 | 'edit_others_posts' => current_user_can('edit_others_posts') ? true : false, |
213 | - 'userCanEdit' => current_user_can('edit_post', $postid ), |
|
213 | + 'userCanEdit' => current_user_can('edit_post', $postid), |
|
214 | 214 | 'can_publish' => is_page() ? current_user_can('publish_pages') : current_user_can('publish_posts'), |
215 | 215 | //'can_publish_posts' => current_user_can('publish_posts'), |
216 | 216 | //'can_publish_pages' => current_user_can('publish_pages'), |
@@ -246,31 +246,31 @@ discard block |
||
246 | 246 | 'postTags' => lasso_get_objects('tag'), |
247 | 247 | 'noResultsDiv' => lasso_editor_empty_results(), |
248 | 248 | 'noRevisionsDiv' => lasso_editor_empty_results('revision'), |
249 | - 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false, |
|
250 | - 'mapLocations' => get_post_meta( $postid, 'ase_map_component_locations' ), |
|
251 | - 'mapStart' => get_post_meta( $postid, 'ase_map_component_start_point', true ), |
|
252 | - 'mapZoom' => get_post_meta( $postid, 'ase_map_component_zoom', true ), |
|
249 | + 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, |
|
250 | + 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), |
|
251 | + 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), |
|
252 | + 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), |
|
253 | 253 | 'revisionModal' => lasso_editor_revision_modal(), |
254 | 254 | 'isMobile' => wp_is_mobile(), |
255 | - 'enableAutoSave' => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ), |
|
255 | + 'enableAutoSave' => lasso_editor_get_option('enable_autosave', 'lasso_editor'), |
|
256 | 256 | 'showColor' => $show_color, |
257 | 257 | 'showAlignment' => $show_align, |
258 | 258 | 'showIgnoredItems' => lasso_editor_get_option('show_ignored_items', 'lasso_editor'), |
259 | 259 | 'restapi2' => $using_restapiv2, |
260 | 260 | 'saveusingrest' => $using_restapiv2 && !$disableRESTSave, |
261 | - 'newObjectContent' => '<p>'.apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ).'</p>', |
|
261 | + 'newObjectContent' => '<p>'.apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')).'</p>', |
|
262 | 262 | 'disableSavePost' => $save_to_post_disabled, |
263 | 263 | 'disableEditPost' => $edit_post_disabled, |
264 | 264 | 'boldTag' => $bold_tag, |
265 | 265 | 'iTag' => $i_tag, |
266 | 266 | 'customFields' => $custom_fields, |
267 | - 'clickToInsert' => ($insert_comp_ui =='click'), |
|
268 | - 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
|
267 | + 'clickToInsert' => ($insert_comp_ui == 'click'), |
|
268 | + 'buttonOnEmptyP' => ($insert_comp_ui == 'mediumcom'), // auto show a button to insert components on an empty paragraph |
|
269 | 269 | 'rtl' => is_rtl(), |
270 | - 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
|
270 | + 'skipToEdit' =>($delta < 10 && $delta >= 0), // if it's a new post, skip to edit mode |
|
271 | 271 | 'linksEditable' => $links_editable, |
272 | 272 | 'supportPendingStatus' => !$no_pending_status, |
273 | - '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>'), |
|
273 | + '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>'), |
|
274 | 274 | ); |
275 | 275 | |
276 | 276 | |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | |
280 | 280 | if (!$using_restapiv2) { |
281 | 281 | // enqueue REST API V1 |
282 | - wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
283 | - $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
|
284 | - wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
|
282 | + wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
283 | + $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json')); |
|
284 | + wp_localize_script('wp-api-js', 'WP_API_Settings', $settings); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | if ($allow_change_date) { |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | wp_enqueue_style('jquery-ui'); |
291 | 291 | } |
292 | 292 | |
293 | - $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
|
293 | + $postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min'; |
|
294 | 294 | if ($show_color) { |
295 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
|
295 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api', 'iris'), LASSO_VERSION, true); |
|
296 | 296 | } else { |
297 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
297 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
298 | 298 | } |
299 | - wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
|
299 | + wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects)); |
|
300 | 300 | |
301 | 301 | |
302 | 302 | } |