@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @since 0.9.3 |
135 | 135 | * |
136 | 136 | * @param int $postid The current postid |
137 | - * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
137 | + * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
138 | 138 | * @param string $taxonomy The name of the taxonomy to which the term belongs. |
139 | 139 | * |
140 | 140 | * @return bool True if update was successful, false if not. |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | if ($taxonomy =='category') { |
150 | - // convert from names to category ids |
|
150 | + // convert from names to category ids |
|
151 | 151 | $cats = array(); |
152 | 152 | if (is_array($value)) { |
153 | 153 | foreach ($value as $cat) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * |
180 | 180 | * |
181 | 181 | * @param int $postid The current postid |
182 | - * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
182 | + * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
183 | 183 | * The first item is the name of taxonomy |
184 | 184 | * |
185 | 185 | * @return bool True if update was successful, false if not. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $value = explode( ',', $value ); |
193 | 193 | } |
194 | 194 | |
195 | - // Deleting first array item |
|
195 | + // Deleting first array item |
|
196 | 196 | $taxonomy = array_shift($value); |
197 | 197 | $cats = array(); |
198 | 198 | foreach ($value as $cat) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | if( $value ) { |
216 | 216 | $time = current_time('mysql'); |
217 | - wp_update_post( |
|
217 | + wp_update_post( |
|
218 | 218 | array ( |
219 | 219 | 'ID' => $postid, // ID of the post to update |
220 | 220 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | |
100 | 100 | foreach ( $pages as $page ) { |
101 | 101 | wp_enqueue_media(); |
102 | - wp_enqueue_style( 'wp-color-picker'); |
|
103 | - wp_enqueue_script( 'wp-color-picker'); |
|
102 | + wp_enqueue_style( 'wp-color-picker'); |
|
103 | + wp_enqueue_script( 'wp-color-picker'); |
|
104 | 104 | |
105 | 105 | wp_enqueue_script( 'lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array( 'jquery','wp-color-picker' ), LASSO_VERSION, true ); |
106 | 106 | wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION ); |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * Adds an admin notice reminding the user if their license key has not been saved |
|
135 | - * |
|
136 | - * @since 0.9.7 |
|
137 | - * @todo make dismissible |
|
138 | - */ |
|
134 | + * Adds an admin notice reminding the user if their license key has not been saved |
|
135 | + * |
|
136 | + * @since 0.9.7 |
|
137 | + * @todo make dismissible |
|
138 | + */ |
|
139 | 139 | public function license_nag(){ |
140 | 140 | |
141 | 141 | $screen = get_current_screen(); |
@@ -156,26 +156,26 @@ discard block |
||
156 | 156 | |
157 | 157 | if ( empty( $license ) ) { |
158 | 158 | |
159 | - printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link ); |
|
159 | + printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link ); |
|
160 | 160 | |
161 | - } else if ( 'invalid' == $status ){ // license key entered wrong or something |
|
161 | + } else if ( 'invalid' == $status ){ // license key entered wrong or something |
|
162 | 162 | |
163 | 163 | printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link ); |
164 | 164 | |
165 | - } else if ( empty( $status ) ){ // license key saved but not activated |
|
165 | + } else if ( empty( $status ) ){ // license key saved but not activated |
|
166 | 166 | |
167 | 167 | printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link ); |
168 | 168 | |
169 | - } |
|
169 | + } |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
175 | - * Process hiding the dimiss |
|
176 | - * |
|
177 | - * @since 0.9.7 |
|
178 | - */ |
|
175 | + * Process hiding the dimiss |
|
176 | + * |
|
177 | + * @since 0.9.7 |
|
178 | + */ |
|
179 | 179 | public function dismiss_nag() { |
180 | 180 | |
181 | 181 | if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | $allowed_fields = apply_filters( 'lasso_meta_fields', array() ); |
44 | 44 | |
45 | - file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true)); |
|
45 | + file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true)); |
|
46 | 46 | |
47 | 47 | if ( ! empty( $allowed_fields ) ) { |
48 | 48 | foreach( $allowed_fields as $field ) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - do_action( 'editus_after_meta_update', $post_id, $data ); |
|
57 | + do_action( 'editus_after_meta_update', $post_id, $data ); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | return true; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | // udpate start point |
48 | - $point = json_decode( $start_point, true ); |
|
48 | + $point = json_decode( $start_point, true ); |
|
49 | 49 | update_post_meta( $postid, 'ase_map_component_start_point', $point ); |
50 | 50 | |
51 | 51 | // update zoom |
@@ -131,7 +131,7 @@ |
||
131 | 131 | $bold_tag = lasso_editor_get_option( 'bold_tag', 'lasso_editor', "b"); |
132 | 132 | $i_tag = lasso_editor_get_option( 'i_tag', 'lasso_editor', "i"); |
133 | 133 | |
134 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
134 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
135 | 135 | |
136 | 136 | // do we support pending status |
137 | 137 | $no_pending_status = lasso_editor_get_option('no_pending_status', 'lasso_editor'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); |
49 | 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( ) ); |
|
51 | + $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
52 | 52 | $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
53 | 53 | if (in_array( $post_type,$allowed_post_types)) { |
54 | 54 | $args['show_in_rest'] = true; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - return $args; |
|
60 | + return $args; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -106,25 +106,25 @@ discard block |
||
106 | 106 | //table codes to be added |
107 | 107 | class editus_table { |
108 | 108 | |
109 | - public function __construct(){ |
|
110 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
111 | - if ($add_table) { |
|
112 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
109 | + public function __construct(){ |
|
110 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
111 | + if ($add_table) { |
|
112 | + add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
113 | 113 | |
114 | - } |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | |
117 | - function scripts() |
|
118 | - { |
|
119 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
120 | - add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
121 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
122 | - wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
123 | - wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
124 | - } |
|
117 | + function scripts() |
|
118 | + { |
|
119 | + add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
120 | + add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
121 | + add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
122 | + wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
123 | + wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
124 | + } |
|
125 | 125 | |
126 | - function editus_table_edit_menu() |
|
127 | - { ?> |
|
126 | + function editus_table_edit_menu() |
|
127 | + { ?> |
|
128 | 128 | |
129 | 129 | <ul class='editus-table-menu'> |
130 | 130 | <li data-action="insertcol"><?php echo __('Insert Column','lasso')?></li> |
@@ -133,31 +133,31 @@ discard block |
||
133 | 133 | <li data-action="delrow"><?php echo __('Delete Row','lasso')?></li> |
134 | 134 | </ul> |
135 | 135 | <?php |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | 138 | |
139 | - function editus_html_table() |
|
140 | - { |
|
141 | - return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure>'; |
|
142 | - } |
|
139 | + function editus_html_table() |
|
140 | + { |
|
141 | + return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure>'; |
|
142 | + } |
|
143 | 143 | |
144 | 144 | |
145 | - function editus_components_add_table( $array ){ |
|
146 | - $custom = array( |
|
147 | - 'htmltable' => array( |
|
148 | - 'name' => __('HTML Table','lasso'), |
|
149 | - 'content' => self::editus_html_table(), |
|
150 | - ) |
|
151 | - ); |
|
152 | - return array_merge( $array, $custom ); |
|
153 | - } |
|
145 | + function editus_components_add_table( $array ){ |
|
146 | + $custom = array( |
|
147 | + 'htmltable' => array( |
|
148 | + 'name' => __('HTML Table','lasso'), |
|
149 | + 'content' => self::editus_html_table(), |
|
150 | + ) |
|
151 | + ); |
|
152 | + return array_merge( $array, $custom ); |
|
153 | + } |
|
154 | 154 | |
155 | 155 | |
156 | - function editus_toolbar_components_add_table( ) { |
|
157 | - ?> |
|
156 | + function editus_toolbar_components_add_table( ) { |
|
157 | + ?> |
|
158 | 158 | <li data-type="htmltable" title="<?php esc_attr_e( 'HTML Table', 'lasso' );?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li> |
159 | 159 | <?php |
160 | - } |
|
160 | + } |
|
161 | 161 | } |
162 | 162 | |
163 | 163 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | height: 42px; |
115 | 115 | } |
116 | 116 | <?php |
117 | - } |
|
117 | + } |
|
118 | 118 | } else { |
119 | 119 | ?> |
120 | 120 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | <?php |
126 | - } |
|
127 | - ?> |
|
126 | + } |
|
127 | + ?> |
|
128 | 128 | </style> |
129 | 129 | <div id="lasso--controls" class="lasso-post-status--<?php echo sanitize_html_class( $status );?> <?php echo sanitize_html_class( $custom_classes );?>" data-post-id="<?php echo get_the_ID();?>" > |
130 | 130 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $toolbar_class = $toolbar_headings ? 'toolbar-extended' : false; |
234 | 234 | |
235 | 235 | // mobile styles |
236 | - $mobile_class = $is_mobile ? 'lasso-mobile' : false; |
|
236 | + $mobile_class = $is_mobile ? 'lasso-mobile' : false; |
|
237 | 237 | $mobile_style =$is_mobile ? 'style="bottom:0px;"' : null; |
238 | 238 | |
239 | 239 | //show color |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | </div> |
537 | 537 | <?php |
538 | 538 | if ($allow_change_date) { |
539 | - $dateformat = get_option( 'date_format' ); |
|
539 | + $dateformat = get_option( 'date_format' ); |
|
540 | 540 | ?> |
541 | 541 | <label><?php _e( 'Post Date', 'lasso' ); ?></label> |
542 | 542 | <input type="text" class="editus_custom_date" name="post_date" value="<?php echo get_the_time($dateformat, $postid);?>"/> |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | if ( !empty( $types ) ) { |
652 | 652 | // get the first element |
653 | 653 | $keys = array_keys($types); |
654 | - $type =$keys[0]; |
|
654 | + $type =$keys[0]; |
|
655 | 655 | $type = preg_replace( '/s\b/','', $type ); |
656 | 656 | printf( '<input type="hidden" name="object" value="%s">', lcfirst( esc_attr( $type ) ) ); |
657 | 657 | } |
@@ -679,8 +679,8 @@ discard block |
||
679 | 679 | global $post; |
680 | 680 | |
681 | 681 | global $wp_post_types; |
682 | - $labels = &$wp_post_types['post']->labels; |
|
683 | - $labels->name = 'Articles'; |
|
682 | + $labels = &$wp_post_types['post']->labels; |
|
683 | + $labels->name = 'Articles'; |
|
684 | 684 | |
685 | 685 | ob_start(); |
686 | 686 | |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | $return .= '</form>'; |
924 | 924 | |
925 | 925 | // extra JS codes |
926 | - if (isset($shortcode['codes'])) { |
|
927 | - $return .= $shortcode['codes']; |
|
928 | - } |
|
926 | + if (isset($shortcode['codes'])) { |
|
927 | + $return .= $shortcode['codes']; |
|
928 | + } |
|
929 | 929 | $blob[$slug] = $return; |
930 | 930 | } |
931 | 931 | |
@@ -974,23 +974,23 @@ discard block |
||
974 | 974 | * @return string |
975 | 975 | */ |
976 | 976 | function lasso_editor_adjustBrightness($hex, $steps) { |
977 | - $steps = max(-255, min(255, $steps)); |
|
977 | + $steps = max(-255, min(255, $steps)); |
|
978 | 978 | |
979 | - // Normalize into a six character long hex string |
|
980 | - $hex = str_replace('#', '', $hex); |
|
981 | - if (strlen($hex) == 3) { |
|
982 | - $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
983 | - } |
|
979 | + // Normalize into a six character long hex string |
|
980 | + $hex = str_replace('#', '', $hex); |
|
981 | + if (strlen($hex) == 3) { |
|
982 | + $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
|
983 | + } |
|
984 | 984 | |
985 | - // Split into three parts: R, G and B |
|
986 | - $color_parts = str_split($hex, 2); |
|
987 | - $return = '#'; |
|
985 | + // Split into three parts: R, G and B |
|
986 | + $color_parts = str_split($hex, 2); |
|
987 | + $return = '#'; |
|
988 | 988 | |
989 | - foreach ($color_parts as $color) { |
|
990 | - $color = hexdec($color); // Convert to decimal |
|
991 | - $color = max(0,min(255,$color + $steps)); // Adjust color |
|
992 | - $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
993 | - } |
|
989 | + foreach ($color_parts as $color) { |
|
990 | + $color = hexdec($color); // Convert to decimal |
|
991 | + $color = max(0,min(255,$color + $steps)); // Adjust color |
|
992 | + $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
|
993 | + } |
|
994 | 994 | |
995 | - return $return; |
|
995 | + return $return; |
|
996 | 996 | } |
@@ -15,29 +15,29 @@ discard block |
||
15 | 15 | add_action('wp_enqueue_scripts', array($this,'scripts')); |
16 | 16 | } |
17 | 17 | |
18 | - function is_multipage() |
|
19 | - { |
|
20 | - global $post; |
|
21 | - $pos = strpos($post->post_content, "<!--nextpage-->"); |
|
22 | - if (!$pos) return -1; |
|
18 | + function is_multipage() |
|
19 | + { |
|
20 | + global $post; |
|
21 | + $pos = strpos($post->post_content, "<!--nextpage-->"); |
|
22 | + if (!$pos) return -1; |
|
23 | 23 | |
24 | - global $wp; |
|
25 | - $url = home_url( $wp->request ); |
|
26 | - $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1; |
|
27 | - return $index; |
|
28 | - } |
|
24 | + global $wp; |
|
25 | + $url = home_url( $wp->request ); |
|
26 | + $index = intval(basename($url)) == 0 ? 0 : intval(basename($url))-1; |
|
27 | + return $index; |
|
28 | + } |
|
29 | 29 | |
30 | 30 | public function scripts(){ |
31 | 31 | |
32 | 32 | |
33 | 33 | global $post; |
34 | 34 | if ( lasso_user_can('edit_posts') |
35 | - /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
36 | - /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
37 | - ) { |
|
35 | + /* uncomment this line to disable Editus on Gutenberg posts*/ |
|
36 | + /* && !( function_exists( 'has_blocks' ) && has_blocks( $post->post_content) && !is_home()) */ |
|
37 | + ) { |
|
38 | 38 | |
39 | 39 | /** Returns the time offset from UTC |
40 | - */ |
|
40 | + */ |
|
41 | 41 | function get_UTC_offset() { |
42 | 42 | $timezone_string = get_option( 'timezone_string' ); |
43 | 43 | if (empty( $timezone_string ) ) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
54 | 54 | |
55 | - //don't load autocomplete if it's a stockholm theme |
|
55 | + //don't load autocomplete if it's a stockholm theme |
|
56 | 56 | $themename = wp_get_theme()->get('Name'); |
57 | 57 | if ($themename !='Stockholm' ) { |
58 | 58 | wp_enqueue_script('jquery-ui-autocomplete'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $tz_offset = get_UTC_offset(); |
127 | 127 | $post_date = get_the_time('U', $postid); |
128 | 128 | $time = (time()+$tz_offset); |
129 | - $delta = $time - $post_date; |
|
129 | + $delta = $time - $post_date; |
|
130 | 130 | |
131 | 131 | $strings = array( |
132 | 132 | 'save' => __('Save','lasso'), |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
182 | 182 | |
183 | 183 | |
184 | - if ($allow_change_date) { |
|
185 | - $permalink = get_site_url().'/?p='.$postid; |
|
186 | - } else { |
|
187 | - $permalink = get_permalink($postid); |
|
188 | - } |
|
184 | + if ($allow_change_date) { |
|
185 | + $permalink = get_site_url().'/?p='.$postid; |
|
186 | + } else { |
|
187 | + $permalink = get_permalink($postid); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | // rest api |
191 | 191 | $rest_nonce = ''; |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - //find if this is multi page. -1 if not |
|
209 | - $multipage = self::is_multipage(); |
|
210 | - $post_content = ""; |
|
211 | - //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
212 | - if ($multipage != -1) { |
|
213 | - $post_content = $post->post_content; |
|
214 | - } |
|
208 | + //find if this is multi page. -1 if not |
|
209 | + $multipage = self::is_multipage(); |
|
210 | + $post_content = ""; |
|
211 | + //pass post_content if we need to process multipage. In future we may need to pass this for other purposes |
|
212 | + if ($multipage != -1) { |
|
213 | + $post_content = $post->post_content; |
|
214 | + } |
|
215 | 215 | |
216 | 216 | // localized objects |
217 | 217 | $objects = array( |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | 'customFields' => $custom_fields, |
288 | 288 | 'clickToInsert' => ($insert_comp_ui =='click'), |
289 | 289 | 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
290 | - 'rtl' => is_rtl(), |
|
290 | + 'rtl' => is_rtl(), |
|
291 | 291 | 'skipToEdit' =>( $delta < 10 && $delta >=0 ), // if it's a new post, skip to edit mode |
292 | 292 | 'linksEditable' => $links_editable, |
293 | 293 | 'supportPendingStatus' => !$no_pending_status, |
294 | 294 | '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>'), |
295 | - 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
296 | - 'multipages'=> $multipage, |
|
297 | - 'post_content'=>$post_content |
|
295 | + 'hasGutenberg' => (function_exists( 'has_blocks' ) && has_blocks( $post->post_content)) || self::gutenberg_active(),//, |
|
296 | + 'multipages'=> $multipage, |
|
297 | + 'post_content'=>$post_content |
|
298 | 298 | ); |
299 | 299 | |
300 | 300 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | |
304 | 304 | if (!$using_restapiv2) { |
305 | - // enqueue REST API V1 |
|
305 | + // enqueue REST API V1 |
|
306 | 306 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
307 | 307 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
308 | 308 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | if ($show_color) { |
319 | 319 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
320 | 320 | } else { |
321 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
321 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
322 | 322 | } |
323 | 323 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
324 | 324 | |
@@ -327,44 +327,44 @@ discard block |
||
327 | 327 | |
328 | 328 | } |
329 | 329 | |
330 | - function gutenberg_active() { |
|
330 | + function gutenberg_active() { |
|
331 | 331 | |
332 | - // Gutenberg plugin is installed and activated. |
|
333 | - $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
334 | - |
|
335 | - // Block editor since 5.0. |
|
336 | - $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
337 | - |
|
338 | - if ( ! $gutenberg && ! $block_editor ) { |
|
339 | - return false; |
|
340 | - } |
|
341 | - |
|
342 | - if ( self::is_classic_editor_plugin_active() ) { |
|
343 | - $editor_option = get_option( 'classic-editor-replace' ); |
|
344 | - $block_editor_active = array( 'no-replace', 'block' ); |
|
345 | - |
|
346 | - return in_array( $editor_option, $block_editor_active, true ); |
|
347 | - } |
|
348 | - |
|
349 | - return true; |
|
350 | - } |
|
351 | - |
|
352 | - /** |
|
353 | - * Check if Classic Editor plugin is active. |
|
354 | - * |
|
355 | - * @return bool |
|
356 | - */ |
|
357 | - function is_classic_editor_plugin_active() { |
|
358 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
359 | - include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
360 | - } |
|
361 | - |
|
362 | - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
363 | - return true; |
|
364 | - } |
|
365 | - |
|
366 | - return false; |
|
367 | - } |
|
332 | + // Gutenberg plugin is installed and activated. |
|
333 | + $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); |
|
334 | + |
|
335 | + // Block editor since 5.0. |
|
336 | + $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); |
|
337 | + |
|
338 | + if ( ! $gutenberg && ! $block_editor ) { |
|
339 | + return false; |
|
340 | + } |
|
341 | + |
|
342 | + if ( self::is_classic_editor_plugin_active() ) { |
|
343 | + $editor_option = get_option( 'classic-editor-replace' ); |
|
344 | + $block_editor_active = array( 'no-replace', 'block' ); |
|
345 | + |
|
346 | + return in_array( $editor_option, $block_editor_active, true ); |
|
347 | + } |
|
348 | + |
|
349 | + return true; |
|
350 | + } |
|
351 | + |
|
352 | + /** |
|
353 | + * Check if Classic Editor plugin is active. |
|
354 | + * |
|
355 | + * @return bool |
|
356 | + */ |
|
357 | + function is_classic_editor_plugin_active() { |
|
358 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
359 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
360 | + } |
|
361 | + |
|
362 | + if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
|
363 | + return true; |
|
364 | + } |
|
365 | + |
|
366 | + return false; |
|
367 | + } |
|
368 | 368 | |
369 | 369 | } |
370 | 370 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | add_action( 'wp_ajax_get_aesop_component', array( $this, 'get_aesop_component' ) ); |
61 | 61 | add_action( 'wp_ajax_editus_do_shortcode', array( $this, 'editus_do_shortcode' ) ); |
62 | - add_action( 'wp_ajax_editus_do_block', array( $this, 'editus_do_block' ) ); |
|
62 | + add_action( 'wp_ajax_editus_do_block', array( $this, 'editus_do_block' ) ); |
|
63 | 63 | add_action( 'wp_ajax_editus_lock_post', array( $this, 'editus_lock_post' ) ); |
64 | 64 | add_action( 'wp_ajax_editus_unlock_post', array( $this, 'editus_unlock_post' ) ); |
65 | 65 | add_action( 'wp_ajax_editus_hide_tour', array( $this, 'editus_hide_tour' ) ); |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | add_action( 'wp_ajax_editus_featured_img', array( $this, 'set_featured_img' ) ); |
70 | 70 | add_action( 'wp_ajax_editus_del_featured_img', array( $this, 'del_featured_img' ) ); |
71 | 71 | |
72 | - add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
72 | + add_action( 'wp_ajax_editus_publish_post', array( $this, 'on_publish_post' ) ); |
|
73 | 73 | |
74 | - add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
75 | - add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
74 | + add_action( 'wp_ajax_editus_create_gallery', array( $this, 'create_gallery' ) ); |
|
75 | + add_action( 'wp_ajax_editus_update_gallery', array( $this, 'update_gallery' ) ); |
|
76 | 76 | |
77 | 77 | // enable saving custom fields through REST API |
78 | 78 | self::enable_metasave('post'); |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
273 | 273 | } |
274 | 274 | |
275 | - // new ajax function to lock post for editing |
|
275 | + // new ajax function to lock post for editing |
|
276 | 276 | public function editus_lock_post() |
277 | 277 | { |
278 | 278 | $post_id= $_POST["postid"]; |
279 | 279 | $locked = wp_check_post_lock($post_id); |
280 | 280 | |
281 | 281 | if (!$locked) { |
282 | - wp_set_post_lock($post_id); |
|
282 | + wp_set_post_lock($post_id); |
|
283 | 283 | echo "true"; |
284 | 284 | } else { |
285 | 285 | $user_info = get_userdata($locked); |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | { |
293 | 293 | $post_id= $_POST["postid"]; |
294 | 294 | $locked = wp_check_post_lock($post_id); |
295 | - if (!$locked) { |
|
296 | - delete_post_meta( $post_id, '_edit_lock'); |
|
297 | - } |
|
295 | + if (!$locked) { |
|
296 | + delete_post_meta( $post_id, '_edit_lock'); |
|
297 | + } |
|
298 | 298 | echo "true"; |
299 | 299 | |
300 | 300 | exit; |
@@ -397,12 +397,12 @@ discard block |
||
397 | 397 | exit; |
398 | 398 | } |
399 | 399 | |
400 | - public function editus_do_block() |
|
400 | + public function editus_do_block() |
|
401 | 401 | { |
402 | 402 | |
403 | 403 | $code= $_POST["code"]; |
404 | 404 | |
405 | - $out = do_blocks( $code ); |
|
405 | + $out = do_blocks( $code ); |
|
406 | 406 | |
407 | 407 | echo $out; |
408 | 408 | exit; |
@@ -417,59 +417,59 @@ discard block |
||
417 | 417 | ); |
418 | 418 | foreach ($_POST as $key => $value) { |
419 | 419 | if ($key !="code" && $key !="action") { |
420 | - //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
420 | + //$shortcode = $shortcode.$key.'="'.$value.'" '; |
|
421 | 421 | $atts[$key] = $value; |
422 | 422 | } |
423 | 423 | } |
424 | 424 | if ($code == "aesop_video") { |
425 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
426 | - echo aesop_video_shortcode($atts); |
|
425 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
426 | + echo aesop_video_shortcode($atts); |
|
427 | 427 | } |
428 | 428 | else if ($code == "aesop_image") { |
429 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
430 | - echo aesop_image_shortcode($atts); |
|
429 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
430 | + echo aesop_image_shortcode($atts); |
|
431 | 431 | } |
432 | 432 | else if ($code == "aesop_quote") { |
433 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
434 | - echo aesop_quote_shortcode($atts); |
|
433 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
434 | + echo aesop_quote_shortcode($atts); |
|
435 | 435 | } |
436 | 436 | else if ($code == "aesop_parallax") { |
437 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
438 | - echo aesop_parallax_shortcode($atts); |
|
437 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
438 | + echo aesop_parallax_shortcode($atts); |
|
439 | 439 | } |
440 | 440 | else if ($code == "aesop_character") { |
441 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
442 | - echo aesop_character_shortcode($atts); |
|
441 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
442 | + echo aesop_character_shortcode($atts); |
|
443 | 443 | } |
444 | 444 | else if ($code == "aesop_collection") { |
445 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
446 | - echo aesop_collection_shortcode($atts); |
|
445 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
446 | + echo aesop_collection_shortcode($atts); |
|
447 | 447 | } |
448 | 448 | else if ($code == "aesop_chapter") { |
449 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
450 | - echo aesop_chapter_shortcode($atts); |
|
449 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
450 | + echo aesop_chapter_shortcode($atts); |
|
451 | 451 | } |
452 | 452 | else if ($code == "aesop_content") { |
453 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
454 | - echo aesop_content_shortcode($atts, $atts['content_data']); |
|
453 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
454 | + echo aesop_content_shortcode($atts, $atts['content_data']); |
|
455 | 455 | } |
456 | 456 | else if ($code == "aesop_gallery") { |
457 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
458 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
457 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
458 | + echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
459 | 459 | } |
460 | 460 | else if ($code == "aesop_audio") { |
461 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
462 | - echo aesop_audio_shortcode($atts); |
|
461 | + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
462 | + echo aesop_audio_shortcode($atts); |
|
463 | 463 | } |
464 | 464 | else { |
465 | 465 | $code = '['.$code.' '; |
466 | 466 | foreach ($atts as $key => $value) { |
467 | - $code = ''.$key.'="'.$value.'" '; |
|
467 | + $code = ''.$key.'="'.$value.'" '; |
|
468 | 468 | } |
469 | 469 | $code = $code.']'; |
470 | 470 | echo do_shortcode($code); |
471 | - //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php'); |
|
472 | - //echo aesop_audio_shortcode($atts); |
|
471 | + //require_once( ABSPATH . '/wp-content/plugins/aesop-events/public/includes/shortcode.php'); |
|
472 | + //echo aesop_audio_shortcode($atts); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | exit; |
@@ -509,12 +509,12 @@ discard block |
||
509 | 509 | exit; |
510 | 510 | } |
511 | 511 | |
512 | - /* This function doesn't actually publish post, but should be called when a post is published */ |
|
513 | - public function on_publish_post( ) { |
|
512 | + /* This function doesn't actually publish post, but should be called when a post is published */ |
|
513 | + public function on_publish_post( ) { |
|
514 | 514 | |
515 | 515 | $post_id = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
516 | 516 | |
517 | - do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
517 | + do_action( 'transition_post_status', 'publish', 'draft', get_post( $post_id ) ); |
|
518 | 518 | |
519 | 519 | exit; |
520 | 520 | } |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
573 | 573 | |
574 | 574 | if ($taxonomy =='category') { |
575 | - // convert from names to category ids |
|
575 | + // convert from names to category ids |
|
576 | 576 | $cats = array(); |
577 | 577 | foreach ($value as $cat) { |
578 | 578 | $cat_id = get_cat_ID($cat); |
579 | 579 | if ($cat_id !=0) { |
580 | 580 | $cats [] = $cat_id; |
581 | 581 | } else if ($allow_new_category) { |
582 | - $cats [] = wp_create_category($cat); |
|
582 | + $cats [] = wp_create_category($cat); |
|
583 | 583 | } |
584 | 584 | } |
585 | 585 | $value = $cats; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | } |
600 | 600 | } |
601 | 601 | |
602 | - public function create_gallery( ) { |
|
602 | + public function create_gallery( ) { |
|
603 | 603 | |
604 | 604 | $postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
605 | 605 | |
@@ -653,10 +653,10 @@ discard block |
||
653 | 653 | 'message' => 'gallery-created', |
654 | 654 | 'id' => $postid) |
655 | 655 | ); |
656 | - exit; |
|
656 | + exit; |
|
657 | 657 | } |
658 | 658 | |
659 | - public function update_gallery( ) { |
|
659 | + public function update_gallery( ) { |
|
660 | 660 | |
661 | 661 | $options = isset( $_POST['fields'] ) ? $_POST['fields'] : false; |
662 | 662 | |
@@ -672,12 +672,12 @@ discard block |
||
672 | 672 | |
673 | 673 | self::save_gallery_options( $postid, $gallery_ids, $options, $type ); |
674 | 674 | |
675 | - echo json_encode( array('message' => 'gallery-updated') ); |
|
675 | + echo json_encode( array('message' => 'gallery-updated') ); |
|
676 | 676 | |
677 | - exit; |
|
677 | + exit; |
|
678 | 678 | } |
679 | 679 | |
680 | - public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
680 | + public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) { |
|
681 | 681 | |
682 | 682 | // gallery width |
683 | 683 | $gallery_width = isset( $options['width'] ) ? $options['width'] : false; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | public function set_date( $postid, $value) { |
762 | 762 | if( $value ) { |
763 | 763 | $value = self::getEnglishMonthName($value)." ".date("H:i:s", current_time( 'timestamp', 1 )); |
764 | - wp_update_post( |
|
764 | + wp_update_post( |
|
765 | 765 | array ( |
766 | 766 | 'ID' => $postid, // ID of the post to update |
767 | 767 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |