@@ -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', '0.9.15.3' ); |
|
27 | -define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) ); |
|
28 | -define( 'LASSO_URL', plugins_url( '', __FILE__ ) ); |
|
29 | -define( 'LASSO_FILE', __FILE__ ); |
|
26 | +define('LASSO_VERSION', '0.9.15.3'); |
|
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>Lasso 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; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $postid = get_the_ID(); |
74 | 74 | |
75 | 75 | $post_date = get_the_time('U', $postid); |
76 | - $delta = time() - $post_date; |
|
76 | + $delta = time() - $post_date; |
|
77 | 77 | |
78 | 78 | $strings = array( |
79 | 79 | 'save' => __('Save','lasso'), |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | |
210 | 210 | if (!$using_restapiv2) { |
211 | - // enqueue REST API V1 |
|
211 | + // enqueue REST API V1 |
|
212 | 212 | wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
213 | 213 | $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
214 | 214 | wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if ($show_color) { |
219 | 219 | wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
220 | 220 | } else { |
221 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
221 | + wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
222 | 222 | } |
223 | 223 | wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
224 | 224 |
@@ -10,15 +10,15 @@ 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 | - if ( lasso_user_can('edit_posts')) { |
|
21 | + if (lasso_user_can('edit_posts')) { |
|
22 | 22 | |
23 | 23 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
24 | 24 | |
@@ -33,26 +33,26 @@ discard block |
||
33 | 33 | // url for json api |
34 | 34 | $home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false; |
35 | 35 | |
36 | - $article_object = lasso_editor_get_option('article_class','lasso_editor'); |
|
36 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
37 | 37 | |
38 | - $article_object = empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
38 | + $article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
39 | 39 | |
40 | - $featImgClass = lasso_editor_get_option('featimg_class','lasso_editor'); |
|
41 | - if (empty( $featImgClass )) { |
|
40 | + $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
41 | + if (empty($featImgClass)) { |
|
42 | 42 | $featImgClass = lasso_get_supported_theme_featured_image_class(); |
43 | 43 | } |
44 | - $titleClass = lasso_editor_get_option('title_class','lasso_editor'); |
|
45 | - if (empty( $titleClass )) { |
|
44 | + $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
45 | + if (empty($titleClass)) { |
|
46 | 46 | $titleClass = lasso_get_supported_theme_title_class(); |
47 | 47 | } |
48 | - $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
49 | - $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
48 | + $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
49 | + $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
50 | 50 | $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
51 | - $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
51 | + $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
52 | 52 | $disableRESTSave = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor'); |
53 | 53 | |
54 | - $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b'); |
|
55 | - $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i'); |
|
54 | + $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor', 'b'); |
|
55 | + $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor', 'i'); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | //text alignement |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | |
64 | 64 | if ($show_color) { |
65 | 65 | //color picker |
66 | - wp_enqueue_style( 'wp-color-picker' ); |
|
67 | - wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); |
|
66 | + wp_enqueue_style('wp-color-picker'); |
|
67 | + wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,58 +76,58 @@ discard block |
||
76 | 76 | $delta = time() - $post_date; |
77 | 77 | |
78 | 78 | $strings = array( |
79 | - 'save' => __('Save','lasso'), |
|
80 | - 'saving' => __('Saving...','lasso'), |
|
81 | - 'saved' => __('Saved!','lasso'), |
|
82 | - 'adding' => __('Adding...','lasso'), |
|
83 | - 'added' => __('Added!','lasso'), |
|
84 | - 'loading' => __('Loading...','lasso'), |
|
85 | - 'loadMore' => __('Load More','lasso'), |
|
86 | - 'noPostsFound' => __('No more posts found','lasso'), |
|
87 | - 'fetchFail' => __('Fetching failed.','lasso'), |
|
88 | - 'galleryCreated' => __('Gallery Created!','lasso'), |
|
89 | - 'galleryUpdated' => __('Gallery Updated!','lasso'), |
|
90 | - 'justWrite' => __('Just write...','lasso'), |
|
91 | - 'chooseImage' => __('Choose an image','lasso'), |
|
92 | - 'updateImage' => __('Update Image','lasso'), |
|
93 | - 'insertImage' => __('Insert Image','lasso'), |
|
94 | - 'selectImage' => __('Select Image','lasso'), |
|
95 | - 'removeFeatImg' => __('Remove featured image?','lasso'), |
|
96 | - 'updateSelectedImg' => __('Update Selected Image','lasso'), |
|
97 | - 'chooseImages' => __('Choose images','lasso'), |
|
98 | - 'editImage' => __('Edit Image','lasso'), |
|
99 | - 'addImages' => __('Add Images','lasso'), |
|
100 | - 'addNewGallery' => __('Add New Gallery','lasso'), |
|
101 | - 'selectGallery' => __('Select Lasso Gallery Image','lasso'), |
|
102 | - 'useSelectedImages' => __('Use Selected Images','lasso'), |
|
103 | - 'publishPost' => __('Publish Post?','lasso'), |
|
104 | - 'publishYes' => __('Yes, publish it!','lasso'), |
|
105 | - 'deletePost' => __('Trash Post?','lasso'), |
|
106 | - 'deleteYes' => __('Yes, trash it!','lasso'), |
|
107 | - 'warning' => __('Oh snap!','laso'), |
|
108 | - 'cancelText' => __('O.K. got it!','lasso'), |
|
109 | - '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'), |
|
79 | + 'save' => __('Save', 'lasso'), |
|
80 | + 'saving' => __('Saving...', 'lasso'), |
|
81 | + 'saved' => __('Saved!', 'lasso'), |
|
82 | + 'adding' => __('Adding...', 'lasso'), |
|
83 | + 'added' => __('Added!', 'lasso'), |
|
84 | + 'loading' => __('Loading...', 'lasso'), |
|
85 | + 'loadMore' => __('Load More', 'lasso'), |
|
86 | + 'noPostsFound' => __('No more posts found', 'lasso'), |
|
87 | + 'fetchFail' => __('Fetching failed.', 'lasso'), |
|
88 | + 'galleryCreated' => __('Gallery Created!', 'lasso'), |
|
89 | + 'galleryUpdated' => __('Gallery Updated!', 'lasso'), |
|
90 | + 'justWrite' => __('Just write...', 'lasso'), |
|
91 | + 'chooseImage' => __('Choose an image', 'lasso'), |
|
92 | + 'updateImage' => __('Update Image', 'lasso'), |
|
93 | + 'insertImage' => __('Insert Image', 'lasso'), |
|
94 | + 'selectImage' => __('Select Image', 'lasso'), |
|
95 | + 'removeFeatImg' => __('Remove featured image?', 'lasso'), |
|
96 | + 'updateSelectedImg' => __('Update Selected Image', 'lasso'), |
|
97 | + 'chooseImages' => __('Choose images', 'lasso'), |
|
98 | + 'editImage' => __('Edit Image', 'lasso'), |
|
99 | + 'addImages' => __('Add Images', 'lasso'), |
|
100 | + 'addNewGallery' => __('Add New Gallery', 'lasso'), |
|
101 | + 'selectGallery' => __('Select Lasso Gallery Image', 'lasso'), |
|
102 | + 'useSelectedImages' => __('Use Selected Images', 'lasso'), |
|
103 | + 'publishPost' => __('Publish Post?', 'lasso'), |
|
104 | + 'publishYes' => __('Yes, publish it!', 'lasso'), |
|
105 | + 'deletePost' => __('Trash Post?', 'lasso'), |
|
106 | + 'deleteYes' => __('Yes, trash it!', 'lasso'), |
|
107 | + 'warning' => __('Oh snap!', 'laso'), |
|
108 | + 'cancelText' => __('O.K. got it!', 'lasso'), |
|
109 | + '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'), |
|
110 | 110 | 'missingConfirm' => __('Update Settings', 'lasso'), |
111 | - 'helperText' => __('one more letter','lasso'), |
|
111 | + 'helperText' => __('one more letter', 'lasso'), |
|
112 | 112 | 'editingBackup' => __('You are currently editing a backup copy of this post.'), |
113 | 113 | ); |
114 | 114 | |
115 | - $api_url = trailingslashit( home_url() ) . 'lasso-internal-api'; |
|
115 | + $api_url = trailingslashit(home_url()).'lasso-internal-api'; |
|
116 | 116 | |
117 | 117 | $gallery_class = new gallery(); |
118 | 118 | $gallery_nonce_action = $gallery_class->nonce_action; |
119 | - $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
|
119 | + $gallery_nonce = wp_create_nonce($gallery_nonce_action); |
|
120 | 120 | $rest_nonce = ''; |
121 | - $rest_root =''; |
|
121 | + $rest_root = ''; |
|
122 | 122 | if (function_exists('rest_url')) { |
123 | - $rest_root = esc_url_raw( rest_url()); |
|
124 | - $rest_nonce = wp_create_nonce( 'wp_rest' ); |
|
125 | - $settings = array( 'root' => $rest_root, 'nonce' => $rest_nonce ); |
|
126 | - wp_enqueue_script( 'wp-api', '', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
127 | - wp_localize_script( 'wp-api', 'wpApiSettings', $settings ); |
|
128 | - wp_localize_script( 'wp-api', 'WP_API_Settings', $settings ); |
|
123 | + $rest_root = esc_url_raw(rest_url()); |
|
124 | + $rest_nonce = wp_create_nonce('wp_rest'); |
|
125 | + $settings = array('root' => $rest_root, 'nonce' => $rest_nonce); |
|
126 | + wp_enqueue_script('wp-api', '', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
127 | + wp_localize_script('wp-api', 'wpApiSettings', $settings); |
|
128 | + wp_localize_script('wp-api', 'WP_API_Settings', $settings); |
|
129 | 129 | |
130 | - if ( class_exists( 'WP_REST_Controller' )) { |
|
130 | + if (class_exists('WP_REST_Controller')) { |
|
131 | 131 | // we are using REST API V2 |
132 | 132 | $using_restapiv2 = true; |
133 | 133 | } |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | |
136 | 136 | // localized objects |
137 | 137 | $objects = array( |
138 | - 'ajaxurl' => esc_url( $api_url ), |
|
139 | - 'ajaxurl2' => esc_url( admin_url( 'admin-ajax.php' )), |
|
138 | + 'ajaxurl' => esc_url($api_url), |
|
139 | + 'ajaxurl2' => esc_url(admin_url('admin-ajax.php')), |
|
140 | 140 | 'rest_root' => $rest_root, |
141 | 141 | 'rest_nonce' => $rest_nonce, |
142 | 142 | 'editor' => 'lasso--content', // ID of editable content (without #) DONT CHANGE |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | 'featImgClass' => $featImgClass, |
145 | 145 | 'titleClass' => $titleClass, |
146 | 146 | 'strings' => $strings, |
147 | - 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ), |
|
148 | - 'post_status' => get_post_status( $postid ), |
|
147 | + 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), |
|
148 | + 'post_status' => get_post_status($postid), |
|
149 | 149 | 'postid' => $postid, |
150 | 150 | 'permalink' => get_permalink(), |
151 | 151 | 'edit_others_pages' => current_user_can('edit_others_pages') ? true : false, |
152 | 152 | 'edit_others_posts' => current_user_can('edit_others_posts') ? true : false, |
153 | - 'userCanEdit' => current_user_can('edit_post', $postid ), |
|
153 | + 'userCanEdit' => current_user_can('edit_post', $postid), |
|
154 | 154 | 'can_publish_posts' => current_user_can('publish_posts'), |
155 | 155 | 'can_publish_pages' => current_user_can('publish_pages'), |
156 | 156 | 'author' => is_user_logged_in() ? get_current_user_ID() : false, |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | 'postTags' => lasso_get_objects('tag'), |
186 | 186 | 'noResultsDiv' => lasso_editor_empty_results(), |
187 | 187 | 'noRevisionsDiv' => lasso_editor_empty_results('revision'), |
188 | - 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false, |
|
189 | - 'mapLocations' => get_post_meta( $postid, 'ase_map_component_locations' ), |
|
190 | - 'mapStart' => get_post_meta( $postid, 'ase_map_component_start_point', true ), |
|
191 | - 'mapZoom' => get_post_meta( $postid, 'ase_map_component_zoom', true ), |
|
188 | + 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, |
|
189 | + 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), |
|
190 | + 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), |
|
191 | + 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), |
|
192 | 192 | 'revisionModal' => lasso_editor_revision_modal(), |
193 | 193 | 'isMobile' => wp_is_mobile(), |
194 | - 'enableAutoSave' => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ), |
|
194 | + 'enableAutoSave' => lasso_editor_get_option('enable_autosave', 'lasso_editor'), |
|
195 | 195 | 'showColor' => $show_color, |
196 | 196 | 'showAlignment' => $show_align, |
197 | 197 | 'showIgnoredItems' => lasso_editor_get_option('show_ignored_items', 'lasso_editor'), |
198 | 198 | 'restapi2' => $using_restapiv2, |
199 | 199 | 'saveusingrest' => $using_restapiv2 && !$disableRESTSave, |
200 | - 'newObjectContent' => apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ), |
|
200 | + 'newObjectContent' => apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')), |
|
201 | 201 | 'boldTag' => $bold_tag, |
202 | 202 | 'iTag' => $i_tag, |
203 | - 'skipToEdit' =>( $delta < 30 ) // if it's a new post, skip to edit mode |
|
203 | + 'skipToEdit' =>($delta < 30) // if it's a new post, skip to edit mode |
|
204 | 204 | ); |
205 | 205 | |
206 | 206 | |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | |
210 | 210 | if (!$using_restapiv2) { |
211 | 211 | // enqueue REST API V1 |
212 | - wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
213 | - $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
|
214 | - wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
|
212 | + wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
213 | + $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json')); |
|
214 | + wp_localize_script('wp-api-js', 'WP_API_Settings', $settings); |
|
215 | 215 | } |
216 | 216 | |
217 | - $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
|
217 | + $postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min'; |
|
218 | 218 | if ($show_color) { |
219 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
|
219 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api', 'iris'), LASSO_VERSION, true); |
|
220 | 220 | } else { |
221 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
221 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
222 | 222 | } |
223 | - wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
|
223 | + wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects)); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | } |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | * @return the option value |
13 | 13 | * @since 1.0 |
14 | 14 | */ |
15 | -function lasso_editor_get_option( $option, $section, $default = '' ) { |
|
15 | +function lasso_editor_get_option($option, $section, $default = '') { |
|
16 | 16 | |
17 | - if ( empty( $option ) ) |
|
17 | + if (empty($option)) |
|
18 | 18 | return; |
19 | 19 | |
20 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
20 | + if (function_exists('is_multisite') && is_multisite()) { |
|
21 | 21 | |
22 | - $options = get_site_option( $section ); |
|
22 | + $options = get_site_option($section); |
|
23 | 23 | |
24 | 24 | } else { |
25 | 25 | |
26 | - $options = get_option( $section ); |
|
26 | + $options = get_option($section); |
|
27 | 27 | } |
28 | 28 | |
29 | - if ( isset( $options[$option] ) ) { |
|
29 | + if (isset($options[$option])) { |
|
30 | 30 | return $options[$option]; |
31 | 31 | } |
32 | 32 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function lasso_editor_galleries_exist() { |
42 | 42 | |
43 | - $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
|
43 | + $q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish')); |
|
44 | 44 | |
45 | - if ( $q->have_posts() ) |
|
45 | + if ($q->have_posts()) |
|
46 | 46 | return true; |
47 | 47 | else |
48 | 48 | return false; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | function lasso_get_supported_theme_class() { |
58 | 58 | |
59 | 59 | $name = wp_get_theme()->get('Name'); |
60 | - $slug = lasso_clean_string( $name ); |
|
60 | + $slug = lasso_clean_string($name); |
|
61 | 61 | |
62 | - switch ( $slug ) { |
|
62 | + switch ($slug) { |
|
63 | 63 | case 'aesop-story-theme': // aesop |
64 | 64 | $out = '.aesop-entry-content'; |
65 | 65 | break; |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters('lasso_content_class', !empty( $out ) ? $out : false); |
|
111 | + return apply_filters('lasso_content_class', !empty($out) ? $out : false); |
|
112 | 112 | //return !empty( $out ) ? $out : false; |
113 | 113 | } |
114 | 114 | |
115 | 115 | function lasso_get_supported_theme_title_class() { |
116 | 116 | |
117 | 117 | $name = wp_get_theme()->get('Name'); |
118 | - $slug = lasso_clean_string( $name ); |
|
118 | + $slug = lasso_clean_string($name); |
|
119 | 119 | |
120 | - switch ( $slug ) { |
|
120 | + switch ($slug) { |
|
121 | 121 | |
122 | 122 | case 'aesop-story-theme': // aesop |
123 | 123 | $out = '.aesop-entry-title'; |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | break; |
146 | 146 | } |
147 | 147 | |
148 | - return apply_filters('lasso_title_class', !empty( $out ) ? $out : false); |
|
148 | + return apply_filters('lasso_title_class', !empty($out) ? $out : false); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | //since 0.9.9.6 |
152 | 152 | function lasso_get_supported_theme_featured_image_class() { |
153 | 153 | |
154 | 154 | $name = wp_get_theme()->get('Name'); |
155 | - $slug = lasso_clean_string( $name ); |
|
155 | + $slug = lasso_clean_string($name); |
|
156 | 156 | |
157 | - return apply_filters('lasso_featured_image_class', !empty( $out ) ? $out : false); |
|
157 | + return apply_filters('lasso_featured_image_class', !empty($out) ? $out : false); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @since 0.8.7 |
166 | 166 | * @return string of comma separated classes |
167 | 167 | */ |
168 | -function lasso_supported_no_save(){ |
|
168 | +function lasso_supported_no_save() { |
|
169 | 169 | |
170 | 170 | return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .twitter-tweet, .meta, .edit-link, .ssba, .jp-relatedposts, .fb-comments'); |
171 | 171 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return array|mixed|object|string|void |
181 | 181 | */ |
182 | -function lasso_sanitize_data( $data ) { |
|
183 | - return \lasso\sanatize::do_sanitize( $data ); |
|
182 | +function lasso_sanitize_data($data) { |
|
183 | + return \lasso\sanatize::do_sanitize($data); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | * @since 0.9.3 |
191 | 191 | * @return string of comma delimited category slugs |
192 | 192 | */ |
193 | -function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
|
193 | +function lasso_get_post_objects($postid = '', $taxonomy = 'category') { |
|
194 | 194 | |
195 | - if ( empty( $postid ) ) |
|
195 | + if (empty($postid)) |
|
196 | 196 | $postid = get_the_ID(); |
197 | 197 | |
198 | - $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
|
198 | + $objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid); |
|
199 | 199 | |
200 | - if ( empty( $objects) ) |
|
200 | + if (empty($objects)) |
|
201 | 201 | return; |
202 | 202 | |
203 | 203 | $out = ''; |
204 | - foreach( $objects as $object ) { |
|
204 | + foreach ($objects as $object) { |
|
205 | 205 | //$out .= $object->slug.', '; |
206 | 206 | $out .= $object->name.','; |
207 | 207 | } |
@@ -216,15 +216,15 @@ discard block |
||
216 | 216 | * @since 0.9.3 |
217 | 217 | * @return array all categoiries |
218 | 218 | */ |
219 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
219 | +function lasso_get_objects($taxonomy = 'category') { |
|
220 | 220 | |
221 | 221 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
222 | 222 | |
223 | - if ( empty( $objects) ) |
|
223 | + if (empty($objects)) |
|
224 | 224 | return; |
225 | 225 | |
226 | 226 | $out = ""; |
227 | - foreach( $objects as $object ) { |
|
227 | + foreach ($objects as $object) { |
|
228 | 228 | $out .= $object->name.','; |
229 | 229 | } |
230 | 230 | |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @since 0.9.4 |
240 | 240 | */ |
241 | 241 | function lasso_post_types_names() { |
242 | - $post_types = get_post_types( array( |
|
242 | + $post_types = get_post_types(array( |
|
243 | 243 | 'public' => true, |
244 | - ), 'objects' ); |
|
245 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
246 | - unset( $post_types[ 'attachment' ] ); |
|
244 | + ), 'objects'); |
|
245 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
246 | + unset($post_types['attachment']); |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Set which post types are allowed |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
254 | 254 | */ |
255 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
256 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
255 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
256 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
257 | 257 | if (!current_user_can('edit_pages')) { |
258 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
258 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
259 | 259 | } |
260 | - foreach( $post_types as $name => $label ) { |
|
261 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
262 | - unset( $post_types[ $name ] ); |
|
260 | + foreach ($post_types as $name => $label) { |
|
261 | + if (!in_array($name, $allowed_post_types)) { |
|
262 | + unset($post_types[$name]); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | return $post_types; |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | |
268 | 268 | |
269 | 269 | function lasso_post_types() { |
270 | - $post_types = get_post_types( array( |
|
270 | + $post_types = get_post_types(array( |
|
271 | 271 | 'public' => true, |
272 | - ), 'names' ); |
|
273 | - unset( $post_types[ 'attachment' ] ); |
|
272 | + ), 'names'); |
|
273 | + unset($post_types['attachment']); |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Set which post types are allowed |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
281 | 281 | */ |
282 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') ); |
|
283 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
284 | - foreach( $post_types as $name => $label ) { |
|
285 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
286 | - unset( $post_types[ $name ] ); |
|
282 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post')); |
|
283 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
284 | + foreach ($post_types as $name => $label) { |
|
285 | + if (!in_array($name, $allowed_post_types)) { |
|
286 | + unset($post_types[$name]); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | return $post_types; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | global $wp_post_types; |
294 | 294 | $post_types = lasso_post_types(); |
295 | 295 | $rest_base = array(); |
296 | - foreach ( $post_types as $post_type) { |
|
296 | + foreach ($post_types as $post_type) { |
|
297 | 297 | $rest_base[$post_type] = $wp_post_types[$post_type]->rest_base; |
298 | 298 | } |
299 | 299 | |
@@ -311,22 +311,22 @@ discard block |
||
311 | 311 | * @uses lasso_modal_addons() |
312 | 312 | * @since 0.9.4 |
313 | 313 | */ |
314 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
314 | +function lasso_modal_addons_content($tab = '', $type) { |
|
315 | 315 | |
316 | - $name = lasso_clean_string( $tab['name'] ); |
|
316 | + $name = lasso_clean_string($tab['name']); |
|
317 | 317 | |
318 | - if ( 'tab' == $type ) { |
|
318 | + if ('tab' == $type) { |
|
319 | 319 | |
320 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
320 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
321 | 321 | |
322 | - } else if ( 'content' == $type ){ |
|
322 | + } else if ('content' == $type) { |
|
323 | 323 | |
324 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
325 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
324 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
325 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
326 | 326 | |
327 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
327 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
328 | 328 | %s%s |
329 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
329 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
330 | 330 | |
331 | 331 | } |
332 | 332 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @return void|string |
343 | 343 | */ |
344 | -function lasso_clean_string( $string = '' ) { |
|
344 | +function lasso_clean_string($string = '') { |
|
345 | 345 | |
346 | - if ( empty( $string ) ) |
|
346 | + if (empty($string)) |
|
347 | 347 | return; |
348 | 348 | |
349 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
349 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return void|string |
361 | 361 | */ |
362 | -function lasso_unclean_string( $string = '' ) { |
|
362 | +function lasso_unclean_string($string = '') { |
|
363 | 363 | |
364 | - if ( empty( $string ) ) { |
|
364 | + if (empty($string)) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
368 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
368 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -380,39 +380,39 @@ discard block |
||
380 | 380 | * @param unknown $postid int the id of the post object to check against |
381 | 381 | * @since 0.9.9.7 added filter 'lasso_user_can_filter' |
382 | 382 | */ |
383 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
384 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
383 | +if (!function_exists('lasso_user_can')): |
|
384 | + function lasso_user_can($action = '', $postid = 0) { |
|
385 | 385 | $result = false; |
386 | - if ( empty( $action ) ) |
|
386 | + if (empty($action)) |
|
387 | 387 | $action = 'edit_posts'; |
388 | 388 | |
389 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
389 | + if (empty($postid) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
390 | 390 | $postid = get_the_ID(); |
391 | 391 | |
392 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
392 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
393 | 393 | // check against post types: |
394 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
394 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
395 | 395 | |
396 | 396 | if (!current_user_can('edit_pages')) { |
397 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
397 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | if (!empty($allowed_post_types) && !empty($postid)) { |
401 | - $type = get_post_type( $postid ); |
|
402 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
401 | + $type = get_post_type($postid); |
|
402 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
403 | 403 | |
404 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
405 | - $result = true; |
|
404 | + if (in_array($type, $allowed_post_types)) { |
|
405 | + $result = true; |
|
406 | 406 | } |
407 | 407 | } else { |
408 | 408 | //we are not checking against a post, return true |
409 | - $result = true; |
|
409 | + $result = true; |
|
410 | 410 | } |
411 | 411 | } else { |
412 | 412 | $result = false; |
413 | 413 | } |
414 | 414 | |
415 | - return apply_filters( 'lasso_user_can_filter', $result, $action, $postid); |
|
415 | + return apply_filters('lasso_user_can_filter', $result, $action, $postid); |
|
416 | 416 | } |
417 | 417 | endif; |
418 | 418 | |
@@ -421,25 +421,25 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @since 0.9.5 |
423 | 423 | */ |
424 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
424 | +if (!function_exists('lasso_editor_empty_results')): |
|
425 | 425 | |
426 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
426 | + function lasso_editor_empty_results($type = 'posts') { |
|
427 | 427 | |
428 | - if ( 'posts' == $type ) { |
|
428 | + if ('posts' == $type) { |
|
429 | 429 | |
430 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
430 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
431 | 431 | $icon = 'lasso-icon-file-text2'; |
432 | 432 | $button = false; |
433 | 433 | |
434 | - } elseif ( 'revision' == $type ) { |
|
434 | + } elseif ('revision' == $type) { |
|
435 | 435 | |
436 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
436 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
437 | 437 | $icon = 'lasso-icon-history'; |
438 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
438 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | - return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button ); |
|
442 | + return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | endif; |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
16 | 16 | |
17 | - if ( empty( $option ) ) |
|
18 | - return; |
|
17 | + if ( empty( $option ) ) { |
|
18 | + return; |
|
19 | + } |
|
19 | 20 | |
20 | 21 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
21 | 22 | |
@@ -42,11 +43,12 @@ discard block |
||
42 | 43 | |
43 | 44 | $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
44 | 45 | |
45 | - if ( $q->have_posts() ) |
|
46 | - return true; |
|
47 | - else |
|
48 | - return false; |
|
49 | -} |
|
46 | + if ( $q->have_posts() ) { |
|
47 | + return true; |
|
48 | + } else { |
|
49 | + return false; |
|
50 | + } |
|
51 | + } |
|
50 | 52 | |
51 | 53 | /** |
52 | 54 | * Return a CSS class of an automatically supported theme |
@@ -192,13 +194,15 @@ discard block |
||
192 | 194 | */ |
193 | 195 | function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
194 | 196 | |
195 | - if ( empty( $postid ) ) |
|
196 | - $postid = get_the_ID(); |
|
197 | + if ( empty( $postid ) ) { |
|
198 | + $postid = get_the_ID(); |
|
199 | + } |
|
197 | 200 | |
198 | 201 | $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
199 | 202 | |
200 | - if ( empty( $objects) ) |
|
201 | - return; |
|
203 | + if ( empty( $objects) ) { |
|
204 | + return; |
|
205 | + } |
|
202 | 206 | |
203 | 207 | $out = ''; |
204 | 208 | foreach( $objects as $object ) { |
@@ -220,8 +224,9 @@ discard block |
||
220 | 224 | |
221 | 225 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
222 | 226 | |
223 | - if ( empty( $objects) ) |
|
224 | - return; |
|
227 | + if ( empty( $objects) ) { |
|
228 | + return; |
|
229 | + } |
|
225 | 230 | |
226 | 231 | $out = ""; |
227 | 232 | foreach( $objects as $object ) { |
@@ -343,8 +348,9 @@ discard block |
||
343 | 348 | */ |
344 | 349 | function lasso_clean_string( $string = '' ) { |
345 | 350 | |
346 | - if ( empty( $string ) ) |
|
347 | - return; |
|
351 | + if ( empty( $string ) ) { |
|
352 | + return; |
|
353 | + } |
|
348 | 354 | |
349 | 355 | return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
350 | 356 | } |
@@ -383,11 +389,13 @@ discard block |
||
383 | 389 | if ( !function_exists( 'lasso_user_can' ) ): |
384 | 390 | function lasso_user_can( $action = '', $postid = 0 ) { |
385 | 391 | $result = false; |
386 | - if ( empty( $action ) ) |
|
387 | - $action = 'edit_posts'; |
|
392 | + if ( empty( $action ) ) { |
|
393 | + $action = 'edit_posts'; |
|
394 | + } |
|
388 | 395 | |
389 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
390 | - $postid = get_the_ID(); |
|
396 | + if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') { |
|
397 | + $postid = get_the_ID(); |
|
398 | + } |
|
391 | 399 | |
392 | 400 | if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
393 | 401 | // check against post types: |
@@ -1,28 +1,28 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( !function_exists( 'lasso_backbone_templates' ) ): |
|
3 | +if (!function_exists('lasso_backbone_templates')): |
|
4 | 4 | |
5 | 5 | add_action('wp_footer', 'lasso_backbone_templates'); |
6 | - function lasso_backbone_templates(){ |
|
6 | + function lasso_backbone_templates() { |
|
7 | 7 | |
8 | 8 | $can_delete = lasso_user_can('delete_posts'); |
9 | 9 | $can_delete_class = $can_delete ? false : 'no-delete'; |
10 | 10 | |
11 | 11 | |
12 | 12 | // only run on posts and pages if user is logged in |
13 | - if ( is_user_logged_in() && lasso_user_can('edit_posts') ) { |
|
14 | - if ( !class_exists( 'WP_REST_Controller' ) ) { |
|
13 | + if (is_user_logged_in() && lasso_user_can('edit_posts')) { |
|
14 | + if (!class_exists('WP_REST_Controller')) { |
|
15 | 15 | // using rest api v1 |
16 | 16 | ?> |
17 | 17 | <script type="text/html" id="lasso-tmpl--post"> |
18 | 18 | <li> |
19 | - <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class;?> <%= post.status %>" data-postid="<%= post.ID %>" > |
|
19 | + <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class; ?> <%= post.status %>" data-postid="<%= post.ID %>" > |
|
20 | 20 | <%= post.title %> |
21 | 21 | |
22 | 22 | <div class="lasso--post-list__controls"> |
23 | - <span title="<?php echo esc_attr_e('Edit Post','lasso');?>" id="lasso--post__edit"></span> |
|
24 | - <?php if( $can_delete ): ?> |
|
25 | - <span title="<?php echo esc_attr_e('Delete Post','lasso');?>" id="lasso--post__delete"></span> |
|
23 | + <span title="<?php echo esc_attr_e('Edit Post', 'lasso'); ?>" id="lasso--post__edit"></span> |
|
24 | + <?php if ($can_delete): ?> |
|
25 | + <span title="<?php echo esc_attr_e('Delete Post', 'lasso'); ?>" id="lasso--post__delete"></span> |
|
26 | 26 | <?php endif; ?> |
27 | 27 | </div> |
28 | 28 | </a> |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | ?> |
35 | 35 | <script type="text/html" id="lasso-tmpl--post"> |
36 | 36 | <li> |
37 | - <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class;?> <%= post.status %>" data-postid="<%= post.id %>" > |
|
37 | + <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class; ?> <%= post.status %>" data-postid="<%= post.id %>" > |
|
38 | 38 | <%= post.title.rendered %> |
39 | 39 | |
40 | 40 | <div class="lasso--post-list__controls"> |
41 | - <span title="<?php echo esc_attr_e('Edit Post','lasso');?>" id="lasso--post__edit"></span> |
|
42 | - <?php if( $can_delete ): ?> |
|
43 | - <span title="<?php echo esc_attr_e('Delete Post','lasso');?>" id="lasso--post__delete"></span> |
|
41 | + <span title="<?php echo esc_attr_e('Edit Post', 'lasso'); ?>" id="lasso--post__edit"></span> |
|
42 | + <?php if ($can_delete): ?> |
|
43 | + <span title="<?php echo esc_attr_e('Delete Post', 'lasso'); ?>" id="lasso--post__delete"></span> |
|
44 | 44 | <?php endif; ?> |
45 | 45 | </div> |
46 | 46 | </a> |