@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * Get an array of addon data for the settings modal |
| 44 | 44 | * @since 0.9.4 |
| 45 | 45 | */ |
| 46 | -function lasso_get_modal_tabs(){ |
|
| 46 | +function lasso_get_modal_tabs() { |
|
| 47 | 47 | |
| 48 | 48 | $tabs = array(); |
| 49 | 49 | |
@@ -60,34 +60,34 @@ discard block |
||
| 60 | 60 | * @uses lasso_modal_addons_content() |
| 61 | 61 | * @since 0.9.4 |
| 62 | 62 | */ |
| 63 | -function lasso_modal_addons( $type = 'tab' ){ |
|
| 63 | +function lasso_modal_addons($type = 'tab') { |
|
| 64 | 64 | |
| 65 | 65 | $tabs = lasso_get_modal_tabs(); |
| 66 | 66 | $out = ''; |
| 67 | 67 | |
| 68 | - if ( $tabs ): |
|
| 68 | + if ($tabs): |
|
| 69 | 69 | |
| 70 | - if ( 'tab' == $type ) { |
|
| 70 | + if ('tab' == $type) { |
|
| 71 | 71 | |
| 72 | 72 | $out = '<ul class="lasso--modal__tabs">'; |
| 73 | 73 | |
| 74 | 74 | $out .= '<li class="active-tab" data-addon-name="core">Editus</li>'; |
| 75 | 75 | |
| 76 | - foreach ( $tabs as $tab ) { |
|
| 76 | + foreach ($tabs as $tab) { |
|
| 77 | 77 | |
| 78 | - if ( isset( $tab ) ) { |
|
| 78 | + if (isset($tab)) { |
|
| 79 | 79 | |
| 80 | - $out .= lasso_modal_addons_content( $tab, $type ); |
|
| 80 | + $out .= lasso_modal_addons_content($tab, $type); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $out .= '</ul>'; |
| 85 | 85 | |
| 86 | - } elseif ( 'content' == $type ) { |
|
| 87 | - foreach ( $tabs as $tab ) { |
|
| 86 | + } elseif ('content' == $type) { |
|
| 87 | + foreach ($tabs as $tab) { |
|
| 88 | 88 | |
| 89 | - if ( isset( $tab ) ) { |
|
| 90 | - $out .= lasso_modal_addons_content( $tab , $type ); |
|
| 89 | + if (isset($tab)) { |
|
| 90 | + $out .= lasso_modal_addons_content($tab, $type); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | endif; |
| 97 | 97 | |
| 98 | - return !empty( $out ) ? $out : false; |
|
| 98 | + return !empty($out) ? $out : false; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -115,26 +115,26 @@ discard block |
||
| 115 | 115 | * @since 0.9.5 |
| 116 | 116 | * @subpackage lasso_modal_addons_content |
| 117 | 117 | */ |
| 118 | -function lasso_option_form( $name = '', $options = array() ){ |
|
| 118 | +function lasso_option_form($name = '', $options = array()) { |
|
| 119 | 119 | |
| 120 | 120 | ob_start(); |
| 121 | 121 | |
| 122 | - if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) |
|
| 122 | + if (empty($name) || empty($options) || !is_array($options)) |
|
| 123 | 123 | return; |
| 124 | 124 | |
| 125 | 125 | $nonce = wp_create_nonce('lasso-process-post-meta'); |
| 126 | - $key = sprintf('_lasso_%s_settings', $name ); |
|
| 126 | + $key = sprintf('_lasso_%s_settings', $name); |
|
| 127 | 127 | |
| 128 | - $out = sprintf('<form id="lasso--custom-field-form" class="lasso--post-form">' ); |
|
| 128 | + $out = sprintf('<form id="lasso--custom-field-form" class="lasso--post-form">'); |
|
| 129 | 129 | |
| 130 | - $out .= lasso_option_fields( $name, $options ); |
|
| 131 | - $out .='<div class="form--bottom">'; |
|
| 132 | - $out .='<input type="submit" value="'.__( 'Save', 'lasso' ).'">'; |
|
| 133 | - $out .='<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
| 134 | - $out .='<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
| 135 | - $out .='<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
| 136 | - $out .='<input type="hidden" name="action" value="process_meta_update">'; |
|
| 137 | - $out .='</div>'; |
|
| 130 | + $out .= lasso_option_fields($name, $options); |
|
| 131 | + $out .= '<div class="form--bottom">'; |
|
| 132 | + $out .= '<input type="submit" value="'.__('Save', 'lasso').'">'; |
|
| 133 | + $out .= '<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
| 134 | + $out .= '<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
| 135 | + $out .= '<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
| 136 | + $out .= '<input type="hidden" name="action" value="process_meta_update">'; |
|
| 137 | + $out .= '</div>'; |
|
| 138 | 138 | |
| 139 | 139 | $out .= '</form>'; |
| 140 | 140 | |
@@ -192,20 +192,20 @@ discard block |
||
| 192 | 192 | * @since 0.9.5 |
| 193 | 193 | * @subpackage lasso_modal_addons_content |
| 194 | 194 | */ |
| 195 | -function lasso_option_fields( $name = '', $options = array() ){ |
|
| 195 | +function lasso_option_fields($name = '', $options = array()) { |
|
| 196 | 196 | |
| 197 | - $out = ''; |
|
| 197 | + $out = ''; |
|
| 198 | 198 | $before = '<div class="lasso--postsettings__option">'; |
| 199 | 199 | $after = '</div>'; |
| 200 | 200 | |
| 201 | - if ( empty( $name ) || empty( $options ) ) |
|
| 201 | + if (empty($name) || empty($options)) |
|
| 202 | 202 | return; |
| 203 | 203 | |
| 204 | - foreach ( (array) $options as $option ) { |
|
| 204 | + foreach ((array) $options as $option) { |
|
| 205 | 205 | |
| 206 | - $type = isset( $option['type'] ) ? $option['type'] : 'text'; |
|
| 206 | + $type = isset($option['type']) ? $option['type'] : 'text'; |
|
| 207 | 207 | |
| 208 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,$type ), $after ); |
|
| 208 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, $type), $after); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | |
@@ -223,44 +223,44 @@ discard block |
||
| 223 | 223 | * @param $type string text, textarea, checkbox, color |
| 224 | 224 | * @since 5.0 |
| 225 | 225 | */ |
| 226 | -function lasso_option_engine_option( $name = '', $option = '', $type = '') { |
|
| 226 | +function lasso_option_engine_option($name = '', $option = '', $type = '') { |
|
| 227 | 227 | |
| 228 | - if ( empty( $type ) || empty( $option ) ) |
|
| 228 | + if (empty($type) || empty($option)) |
|
| 229 | 229 | return; |
| 230 | 230 | |
| 231 | - $id = isset( $option['id'] ) ? $option['id'] : false; |
|
| 231 | + $id = isset($option['id']) ? $option['id'] : false; |
|
| 232 | 232 | //$id = $id ? lasso_clean_string( $id ) : false; |
| 233 | 233 | |
| 234 | - $desc = isset( $option['desc'] ) ? $option['desc'] : false; |
|
| 234 | + $desc = isset($option['desc']) ? $option['desc'] : false; |
|
| 235 | 235 | |
| 236 | - $value = get_post_meta( get_the_id(), $option[ 'id' ], true ); |
|
| 236 | + $value = get_post_meta(get_the_id(), $option['id'], true); |
|
| 237 | 237 | |
| 238 | - switch ( $type ) { |
|
| 238 | + switch ($type) { |
|
| 239 | 239 | case 'text': |
| 240 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">',$id, esc_html( $desc ), $id, $id, $value ); |
|
| 240 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">', $id, esc_html($desc), $id, $id, $value); |
|
| 241 | 241 | break; |
| 242 | 242 | case 'textarea': |
| 243 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>',$id, esc_html( $desc ), $id, $id, $value ); |
|
| 243 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>', $id, esc_html($desc), $id, $id, $value); |
|
| 244 | 244 | break; |
| 245 | 245 | case 'imgurl': |
| 246 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image" class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div><div title="Remove Image" class="editus-customtab-image-remove" style="float:left;"><i class="lasso-icon-bin2" style="font-size:20px;padding:5px;"></i></div>',$id, esc_html( $desc ), $value, $id, $id, $value ); |
|
| 246 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image" class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div><div title="Remove Image" class="editus-customtab-image-remove" style="float:left;"><i class="lasso-icon-bin2" style="font-size:20px;padding:5px;"></i></div>', $id, esc_html($desc), $value, $id, $id, $value); |
|
| 247 | 247 | break; |
| 248 | 248 | case 'checkbox': |
| 249 | - $out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s',$id, $id, $id ,esc_html( $desc ) ); |
|
| 249 | + $out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s', $id, $id, $id, esc_html($desc)); |
|
| 250 | 250 | break; |
| 251 | 251 | case 'dropdown': |
| 252 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><select id="lasso--post-option-%s" name="%s">',$id, esc_html( $desc ), $id, $id); |
|
| 252 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><select id="lasso--post-option-%s" name="%s">', $id, esc_html($desc), $id, $id); |
|
| 253 | 253 | $options = explode(";", $option['options']); |
| 254 | 254 | foreach ($options as &$opt) { |
| 255 | 255 | $opts = explode(":", $opt); |
| 256 | 256 | if ($opts[0] == $value) { |
| 257 | - $out .= sprintf('<option value = "%s" selected>%s</option>',$opts[0], $opts[1]); |
|
| 257 | + $out .= sprintf('<option value = "%s" selected>%s</option>', $opts[0], $opts[1]); |
|
| 258 | 258 | } else { |
| 259 | - $out .= sprintf('<option value = "%s">%s</option>',$opts[0], $opts[1]); |
|
| 259 | + $out .= sprintf('<option value = "%s">%s</option>', $opts[0], $opts[1]); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $out .='</select>'; |
|
| 263 | + $out .= '</select>'; |
|
| 264 | 264 | break; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | global $post; |
| 22 | 22 | if ( lasso_user_can('edit_posts') && |
| 23 | - !( function_exists( 'is_gutenberg_page' ) && has_blocks( $post->post_content) )) {// bail if the post has Gutenberg bloc |
|
| 23 | + !( function_exists( 'is_gutenberg_page' ) && has_blocks( $post->post_content) )) {// 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( 'is_gutenberg_page' ) && has_blocks( $post->post_content) )) {// bail if the post has Gutenberg bloc |
|
| 22 | + if (lasso_user_can('edit_posts') && |
|
| 23 | + !(function_exists('is_gutenberg_page') && has_blocks($post->post_content))) {// 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 | } |