@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | function __construct() { |
11 | 11 | |
12 | - add_action( 'admin_menu', array( $this, 'menu' ) ); |
|
13 | - add_action( 'network_admin_menu', array( $this, 'menu' ) ); |
|
14 | - add_action( 'wp_ajax_lasso-editor-settings', array( $this, 'process_settings' ) ); |
|
12 | + add_action('admin_menu', array($this, 'menu')); |
|
13 | + add_action('network_admin_menu', array($this, 'menu')); |
|
14 | + add_action('wp_ajax_lasso-editor-settings', array($this, 'process_settings')); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function menu() { |
24 | 24 | |
25 | 25 | // CHANGED Removed condition. |
26 | - add_submenu_page( 'lasso-editor', __( 'Settings', 'lasso' ), __( 'Settings', 'lasso' ), 'manage_options', 'lasso-editor-settings', array( $this, 'settings' ) ); |
|
26 | + add_submenu_page('lasso-editor', __('Settings', 'lasso'), __('Settings', 'lasso'), 'manage_options', 'lasso-editor-settings', array($this, 'settings')); |
|
27 | 27 | |
28 | 28 | } |
29 | 29 | |
@@ -45,26 +45,26 @@ discard block |
||
45 | 45 | function process_settings() { |
46 | 46 | |
47 | 47 | // bail out if current user isn't and administrator and they are not logged in |
48 | - if ( !current_user_can( 'manage_options' ) || !is_user_logged_in() ) |
|
48 | + if (!current_user_can('manage_options') || !is_user_logged_in()) |
|
49 | 49 | return; |
50 | 50 | |
51 | - if ( isset( $_POST['action'] ) && 'lasso-editor-settings' == $_POST['action'] && check_admin_referer( 'nonce', 'lasso_editor_settings' ) ) { |
|
51 | + if (isset($_POST['action']) && 'lasso-editor-settings' == $_POST['action'] && check_admin_referer('nonce', 'lasso_editor_settings')) { |
|
52 | 52 | |
53 | - $options = isset( $_POST['lasso_editor'] ) ? $_POST['lasso_editor'] : false; |
|
53 | + $options = isset($_POST['lasso_editor']) ? $_POST['lasso_editor'] : false; |
|
54 | 54 | |
55 | 55 | $arr = $options['allowed_post_types']; |
56 | - $options = array_map( 'sanitize_text_field', $options ); |
|
57 | - $options['allowed_post_types'] = array_keys( $arr); |
|
56 | + $options = array_map('sanitize_text_field', $options); |
|
57 | + $options['allowed_post_types'] = array_keys($arr); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
61 | + if (function_exists('is_multisite') && is_multisite()) { |
|
62 | 62 | |
63 | - update_site_option( 'lasso_editor', $options ); |
|
63 | + update_site_option('lasso_editor', $options); |
|
64 | 64 | |
65 | 65 | } else { |
66 | 66 | |
67 | - update_option( 'lasso_editor', $options ); |
|
67 | + update_option('lasso_editor', $options); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | wp_send_json_success(); |
@@ -86,63 +86,63 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function lasso_editor_settings_form() { |
88 | 88 | |
89 | - if ( !is_user_logged_in() ) |
|
89 | + if (!is_user_logged_in()) |
|
90 | 90 | return; |
91 | 91 | |
92 | - $article_object = lasso_editor_get_option( 'article_class', 'lasso_editor' ); |
|
93 | - $featImgClass = lasso_editor_get_option( 'featimg_class', 'lasso_editor' ); |
|
94 | - $titleClass = lasso_editor_get_option( 'title_class', 'lasso_editor' ); |
|
92 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
93 | + $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
94 | + $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
95 | 95 | |
96 | - $post_new_disabled = lasso_editor_get_option( 'post_adding_disabled', 'lasso_editor' ); |
|
97 | - $save_to_post_disabled = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' ); |
|
98 | - $post_settings_disabled = lasso_editor_get_option( 'post_settings_disabled', 'lasso_editor' ); |
|
99 | - $shortcodify_disabled = lasso_editor_get_option( 'shortcodify_disabled', 'lasso_editor' ); |
|
100 | - $enable_autosave = lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ); |
|
96 | + $post_new_disabled = lasso_editor_get_option('post_adding_disabled', 'lasso_editor'); |
|
97 | + $save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor'); |
|
98 | + $post_settings_disabled = lasso_editor_get_option('post_settings_disabled', 'lasso_editor'); |
|
99 | + $shortcodify_disabled = lasso_editor_get_option('shortcodify_disabled', 'lasso_editor'); |
|
100 | + $enable_autosave = lasso_editor_get_option('enable_autosave', 'lasso_editor'); |
|
101 | 101 | |
102 | - $toolbar_headings = lasso_editor_get_option( 'toolbar_headings', 'lasso_editor' ); |
|
103 | - $toolbar_headings_h4 = lasso_editor_get_option( 'toolbar_headings_h4', 'lasso_editor' ); |
|
104 | - $toolbar_show_color = lasso_editor_get_option( 'toolbar_show_color', 'lasso_editor' ); |
|
105 | - $toolbar_show_alignment = lasso_editor_get_option( 'toolbar_show_alignment', 'lasso_editor' ); |
|
102 | + $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
103 | + $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
104 | + $toolbar_show_color = lasso_editor_get_option('toolbar_show_color', 'lasso_editor'); |
|
105 | + $toolbar_show_alignment = lasso_editor_get_option('toolbar_show_alignment', 'lasso_editor'); |
|
106 | 106 | |
107 | - $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
108 | - $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
107 | + $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
108 | + $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
109 | 109 | $disable_tour = lasso_editor_get_option('disable_tour', 'lasso_editor'); |
110 | 110 | $show_ignored_items = lasso_editor_get_option('show_ignored_items', 'lasso_editor'); |
111 | 111 | $save_using_rest_disabled = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor'); |
112 | 112 | |
113 | - $default_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page')); |
|
114 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', $default_post_types); |
|
113 | + $default_post_types = apply_filters('lasso_allowed_post_types', array('post', 'page')); |
|
114 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', $default_post_types); |
|
115 | 115 | |
116 | - $bold_tag = lasso_editor_get_option( 'bold_tag', 'lasso_editor', "b"); |
|
116 | + $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor', "b"); |
|
117 | 117 | |
118 | 118 | ?> |
119 | 119 | <div class="wrap"> |
120 | 120 | |
121 | - <h2><?php _e( 'Editus Settings', 'lasso' );?></h2> |
|
121 | + <h2><?php _e('Editus Settings', 'lasso'); ?></h2> |
|
122 | 122 | |
123 | 123 | <form id="lasso-editor-settings-form" class="lasso--form-settings" method="post" enctype="multipart/form-data"> |
124 | 124 | |
125 | - <?php do_action('lasso_settings_before');?> |
|
125 | + <?php do_action('lasso_settings_before'); ?> |
|
126 | 126 | |
127 | 127 | |
128 | 128 | |
129 | - <h3><?php _e( 'Enable for:', 'lasso' );?></h3> |
|
129 | + <h3><?php _e('Enable for:', 'lasso'); ?></h3> |
|
130 | 130 | <div class="lasso-editor-settings--option-wrap"> |
131 | 131 | <div class="lasso-editor-settings--option-inner"> |
132 | 132 | |
133 | - <span class="lasso--setting-description"><?php _e( 'Enable Editus for the following post types.', 'lasso' );?></span> |
|
133 | + <span class="lasso--setting-description"><?php _e('Enable Editus for the following post types.', 'lasso'); ?></span> |
|
134 | 134 | <?php |
135 | 135 | $args = array( |
136 | 136 | 'public' => true |
137 | 137 | ); |
138 | 138 | |
139 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
140 | - $post_types = get_post_types( $args, 'objects' ); |
|
139 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
140 | + $post_types = get_post_types($args, 'objects'); |
|
141 | 141 | |
142 | - foreach ( $post_types as $post_type ) { |
|
142 | + foreach ($post_types as $post_type) { |
|
143 | 143 | if ($post_type->name == 'attachment') continue; |
144 | - $checked =""; |
|
145 | - if ( in_array( $post_type->name, $allowed_post_types ) ) { |
|
144 | + $checked = ""; |
|
145 | + if (in_array($post_type->name, $allowed_post_types)) { |
|
146 | 146 | $checked = 'checked="checked"'; |
147 | 147 | } |
148 | 148 | echo '<label><input type="checkbox" '.$checked.' name="lasso_editor[allowed_post_types]['.$post_type->name.']" id="lasso_editor[allowed_post_types]['.$post_type->name.']" >'.$post_type->name.'</label>'; |
@@ -152,69 +152,69 @@ discard block |
||
152 | 152 | </div> |
153 | 153 | |
154 | 154 | |
155 | - <h3><?php _e( 'Internal Settings', 'lasso' );?></h3> |
|
155 | + <h3><?php _e('Internal Settings', 'lasso'); ?></h3> |
|
156 | 156 | <div class="lasso-editor-settings--option-wrap"> |
157 | 157 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
158 | - <label><?php _e( 'Article Class', 'lasso' );?></label> |
|
159 | - <span class="lasso--setting-description"><?php _e( 'Provide the CSS class (including the preceding dot) of container that holds the post. This should be the first parent container class that holds the_content.', 'lasso' );?></span> |
|
160 | - <input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr( $article_object );?>" placeholder=".entry-content"> |
|
158 | + <label><?php _e('Article Class', 'lasso'); ?></label> |
|
159 | + <span class="lasso--setting-description"><?php _e('Provide the CSS class (including the preceding dot) of container that holds the post. This should be the first parent container class that holds the_content.', 'lasso'); ?></span> |
|
160 | + <input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr($article_object); ?>" placeholder=".entry-content"> |
|
161 | 161 | </div> |
162 | 162 | |
163 | 163 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
164 | - <label><?php _e( 'Featured Image Class', 'lasso' );?></label> |
|
165 | - <span class="lasso--setting-description"><?php _e( 'Provide the CSS class that uses a featured image as a background image. This currently only supports themes that have the featured image set as background image.', 'lasso' );?></span> |
|
166 | - <input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr( $featImgClass );?>" placeholder=".entry-content"> |
|
164 | + <label><?php _e('Featured Image Class', 'lasso'); ?></label> |
|
165 | + <span class="lasso--setting-description"><?php _e('Provide the CSS class that uses a featured image as a background image. This currently only supports themes that have the featured image set as background image.', 'lasso'); ?></span> |
|
166 | + <input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr($featImgClass); ?>" placeholder=".entry-content"> |
|
167 | 167 | </div> |
168 | 168 | |
169 | 169 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
170 | - <label><?php _e( 'Article Title Class', 'lasso' );?></label> |
|
171 | - <span class="lasso--setting-description"><?php _e( 'Provide the CSS class for the post title. This will enable you to update the title of the post by clicking and typing.', 'lasso' );?></span> |
|
172 | - <input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr( $titleClass );?>" placeholder=".entry-content"> |
|
170 | + <label><?php _e('Article Title Class', 'lasso'); ?></label> |
|
171 | + <span class="lasso--setting-description"><?php _e('Provide the CSS class for the post title. This will enable you to update the title of the post by clicking and typing.', 'lasso'); ?></span> |
|
172 | + <input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr($titleClass); ?>" placeholder=".entry-content"> |
|
173 | 173 | </div> |
174 | 174 | |
175 | 175 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
176 | - <label><?php _e( 'Ignored Items to Save', 'lasso' );?></label> |
|
177 | - <span class="lasso--setting-description"><?php _e( 'If your post container holds additional markup, list the css class names (comma separated, including the dot) of those items. When you enter the editor, Editus will remove (NOT delete) these items so that it does not save them as HTML.', 'lasso' );?></span> |
|
178 | - <textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNoSave );?></textarea> |
|
176 | + <label><?php _e('Ignored Items to Save', 'lasso'); ?></label> |
|
177 | + <span class="lasso--setting-description"><?php _e('If your post container holds additional markup, list the css class names (comma separated, including the dot) of those items. When you enter the editor, Editus will remove (NOT delete) these items so that it does not save them as HTML.', 'lasso'); ?></span> |
|
178 | + <textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNoSave); ?></textarea> |
|
179 | 179 | </div> |
180 | 180 | |
181 | 181 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
182 | - <label><?php _e( 'Read Only Items', 'lasso' );?></label> |
|
183 | - <span class="lasso--setting-description"><?php _e( 'If your post has items that should not be editable, list the css class names (comma separated, including the dot) of those items.', 'lasso' );?></span> |
|
184 | - <textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNonEditable );?></textarea> |
|
182 | + <label><?php _e('Read Only Items', 'lasso'); ?></label> |
|
183 | + <span class="lasso--setting-description"><?php _e('If your post has items that should not be editable, list the css class names (comma separated, including the dot) of those items.', 'lasso'); ?></span> |
|
184 | + <textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNonEditable); ?></textarea> |
|
185 | 185 | </div> |
186 | 186 | |
187 | 187 | <div class="lasso-editor-settings--option-inner" > |
188 | - <input type="checkbox" class="checkbox" name="lasso_editor[show_ignored_items]" id="lasso_editor[show_ignored_items]" <?php echo checked( $show_ignored_items, 'on' );?> > |
|
189 | - <label for="lasso_editor[show_ignored_items]"> <?php _e( 'Show Ignored Items', 'lasso' );?></label> |
|
190 | - <span class="lasso--setting-description"><?php _e( 'By default the ignored items are hidden. Check this to show ignored items while keeping them uneditable.', 'lasso' );?></span> |
|
188 | + <input type="checkbox" class="checkbox" name="lasso_editor[show_ignored_items]" id="lasso_editor[show_ignored_items]" <?php echo checked($show_ignored_items, 'on'); ?> > |
|
189 | + <label for="lasso_editor[show_ignored_items]"> <?php _e('Show Ignored Items', 'lasso'); ?></label> |
|
190 | + <span class="lasso--setting-description"><?php _e('By default the ignored items are hidden. Check this to show ignored items while keeping them uneditable.', 'lasso'); ?></span> |
|
191 | 191 | </div> |
192 | 192 | </div> |
193 | 193 | |
194 | - <h3><?php _e( 'Editor UI', 'lasso' );?></h3> |
|
194 | + <h3><?php _e('Editor UI', 'lasso'); ?></h3> |
|
195 | 195 | <div class="lasso-editor-settings--option-wrap"> |
196 | 196 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
197 | - <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked( $toolbar_headings, 'on' );?> > |
|
198 | - <label for="lasso_editor[toolbar_headings]"><?php _e( 'Enable H2 and H3 Buttons', 'lasso' );?></label> |
|
199 | - <span class="lasso--setting-description"><?php _e( 'Show the buttons to set H2 and H3 settings.', 'lasso' );?></span> |
|
197 | + <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked($toolbar_headings, 'on'); ?> > |
|
198 | + <label for="lasso_editor[toolbar_headings]"><?php _e('Enable H2 and H3 Buttons', 'lasso'); ?></label> |
|
199 | + <span class="lasso--setting-description"><?php _e('Show the buttons to set H2 and H3 settings.', 'lasso'); ?></span> |
|
200 | 200 | |
201 | 201 | </div> |
202 | 202 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
203 | - <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings_h4]" id="lasso_editor[toolbar_headings_h4]" <?php echo checked( $toolbar_headings_h4, 'on' );?> > |
|
204 | - <label for="lasso_editor[toolbar_headings_h4]"><?php _e( 'Enable H4/H5/H6 Buttons', 'lasso' );?></label> |
|
205 | - <span class="lasso--setting-description"><?php _e( 'Show the buttons to set H4/H5/H6 settings.', 'lasso' );?></span> |
|
203 | + <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings_h4]" id="lasso_editor[toolbar_headings_h4]" <?php echo checked($toolbar_headings_h4, 'on'); ?> > |
|
204 | + <label for="lasso_editor[toolbar_headings_h4]"><?php _e('Enable H4/H5/H6 Buttons', 'lasso'); ?></label> |
|
205 | + <span class="lasso--setting-description"><?php _e('Show the buttons to set H4/H5/H6 settings.', 'lasso'); ?></span> |
|
206 | 206 | |
207 | 207 | </div> |
208 | 208 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
209 | - <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked( $toolbar_show_color, 'on' );?> > |
|
210 | - <label for="lasso_editor[toolbar_show_color]"><?php _e( 'Enable Text Color Buttons', 'lasso' );?></label> |
|
211 | - <span class="lasso--setting-description"><?php _e( 'Show the buttons to set text colors.', 'lasso' );?></span> |
|
209 | + <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked($toolbar_show_color, 'on'); ?> > |
|
210 | + <label for="lasso_editor[toolbar_show_color]"><?php _e('Enable Text Color Buttons', 'lasso'); ?></label> |
|
211 | + <span class="lasso--setting-description"><?php _e('Show the buttons to set text colors.', 'lasso'); ?></span> |
|
212 | 212 | |
213 | 213 | </div> |
214 | 214 | <div class="lasso-editor-settings--option-inner"> |
215 | - <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked( $toolbar_show_alignment, 'on' );?> > |
|
216 | - <label for="lasso_editor[toolbar_show_alignment]"><?php _e( 'Enable Text Align Buttons', 'lasso' );?></label> |
|
217 | - <span class="lasso--setting-description"><?php _e( 'Show the buttons to set text alignment.', 'lasso' );?></span> |
|
215 | + <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked($toolbar_show_alignment, 'on'); ?> > |
|
216 | + <label for="lasso_editor[toolbar_show_alignment]"><?php _e('Enable Text Align Buttons', 'lasso'); ?></label> |
|
217 | + <span class="lasso--setting-description"><?php _e('Show the buttons to set text alignment.', 'lasso'); ?></span> |
|
218 | 218 | |
219 | 219 | </div> |
220 | 220 | </div> |
@@ -223,62 +223,62 @@ discard block |
||
223 | 223 | |
224 | 224 | |
225 | 225 | |
226 | - <h3><?php _e( 'Post Settings UI', 'lasso' );?></h3> |
|
226 | + <h3><?php _e('Post Settings UI', 'lasso'); ?></h3> |
|
227 | 227 | <div class="lasso-editor-settings--option-wrap" > |
228 | 228 | <div class="lasso-editor-settings--option-inner" style="border:none"> |
229 | - <input type="checkbox" class="checkbox" name="lasso_editor[post_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked( $post_settings_disabled, 'on' );?> > |
|
230 | - <label for="lasso_editor[post_settings_disabled]"> <?php _e( 'Disable Post Settings', 'lasso' );?></label> |
|
231 | - <span class="lasso--setting-description"><?php _e( 'Check this to disable users from being able to edit post settings from the front-end.', 'lasso' );?></span> |
|
229 | + <input type="checkbox" class="checkbox" name="lasso_editor[post_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked($post_settings_disabled, 'on'); ?> > |
|
230 | + <label for="lasso_editor[post_settings_disabled]"> <?php _e('Disable Post Settings', 'lasso'); ?></label> |
|
231 | + <span class="lasso--setting-description"><?php _e('Check this to disable users from being able to edit post settings from the front-end.', 'lasso'); ?></span> |
|
232 | 232 | </div> |
233 | 233 | |
234 | 234 | <div class="lasso-editor-settings--option-inner" > |
235 | - <input type="checkbox" class="checkbox" name="lasso_editor[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked( $post_new_disabled, 'on' );?> > |
|
236 | - <label for="lasso_editor[post_adding_disabled]"><?php _e( 'Disable Post Adding', 'lasso' );?></label> |
|
237 | - <span class="lasso--setting-description"><?php _e( 'Check this box to disable users from being able to add new posts from the front-end.', 'lasso' );?></span> |
|
235 | + <input type="checkbox" class="checkbox" name="lasso_editor[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked($post_new_disabled, 'on'); ?> > |
|
236 | + <label for="lasso_editor[post_adding_disabled]"><?php _e('Disable Post Adding', 'lasso'); ?></label> |
|
237 | + <span class="lasso--setting-description"><?php _e('Check this box to disable users from being able to add new posts from the front-end.', 'lasso'); ?></span> |
|
238 | 238 | </div> |
239 | 239 | </div> |
240 | 240 | |
241 | - <h3><?php _e( 'Misc', 'lasso' );?></h3> |
|
241 | + <h3><?php _e('Misc', 'lasso'); ?></h3> |
|
242 | 242 | <div class="lasso-editor-settings--option-wrap"> |
243 | 243 | <div class="lasso-editor-settings--option-inner" style="border:none"> |
244 | - <input type="checkbox" class="checkbox" name="lasso_editor[disable_tour]" id="lasso_editor[disable_tour]" <?php echo checked( $disable_tour, 'on' );?> > |
|
245 | - <label for="lasso_editor[disable_tour]"> <?php _e( 'Do Not Show Tour Dialog', 'lasso' );?></label> |
|
246 | - <span class="lasso--setting-description"><?php _e( 'Check this box to disable the tour dialog box for all users.', 'lasso' );?></span> |
|
244 | + <input type="checkbox" class="checkbox" name="lasso_editor[disable_tour]" id="lasso_editor[disable_tour]" <?php echo checked($disable_tour, 'on'); ?> > |
|
245 | + <label for="lasso_editor[disable_tour]"> <?php _e('Do Not Show Tour Dialog', 'lasso'); ?></label> |
|
246 | + <span class="lasso--setting-description"><?php _e('Check this box to disable the tour dialog box for all users.', 'lasso'); ?></span> |
|
247 | 247 | </div> |
248 | 248 | |
249 | 249 | <div class="lasso-editor-settings--option-inner" > |
250 | - <label for="lasso_editor[bold_tag]"> <?php _e( '"Bold" Tag', 'lasso' );?></label> |
|
251 | - <span class="lasso--setting-description"><?php _e( 'Choose the HTML tag used for the "Bold" style.', 'lasso' );?></span> |
|
252 | - <input type="radio" name="lasso_editor[bold_tag]" value='b' <?php echo checked( $bold_tag, 'b' );?>> b |
|
253 | - <input type="radio" name="lasso_editor[bold_tag]" value="strong" <?php echo checked( $bold_tag, 'strong' );?>> strong |
|
250 | + <label for="lasso_editor[bold_tag]"> <?php _e('"Bold" Tag', 'lasso'); ?></label> |
|
251 | + <span class="lasso--setting-description"><?php _e('Choose the HTML tag used for the "Bold" style.', 'lasso'); ?></span> |
|
252 | + <input type="radio" name="lasso_editor[bold_tag]" value='b' <?php echo checked($bold_tag, 'b'); ?>> b |
|
253 | + <input type="radio" name="lasso_editor[bold_tag]" value="strong" <?php echo checked($bold_tag, 'strong'); ?>> strong |
|
254 | 254 | </div> |
255 | 255 | </div> |
256 | 256 | |
257 | - <h3><?php _e( 'Advanced', 'lasso' );?></h3> |
|
257 | + <h3><?php _e('Advanced', 'lasso'); ?></h3> |
|
258 | 258 | <div class="lasso-editor-settings--option-wrap "> |
259 | 259 | <div class="lasso-editor-settings--option-inner" style="border:none"> |
260 | - <input type="checkbox" class="checkbox" name="lasso_editor[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked( $shortcodify_disabled, 'on' );?> > |
|
261 | - <label for="lasso_editor[shortcodify_disabled]"><?php _e( 'Disable Aesop Component Conversion', 'lasso' );?></label> |
|
262 | - <span class="lasso--setting-description"><?php _e( 'Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso' );?></span> |
|
260 | + <input type="checkbox" class="checkbox" name="lasso_editor[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked($shortcodify_disabled, 'on'); ?> > |
|
261 | + <label for="lasso_editor[shortcodify_disabled]"><?php _e('Disable Aesop Component Conversion', 'lasso'); ?></label> |
|
262 | + <span class="lasso--setting-description"><?php _e('Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso'); ?></span> |
|
263 | 263 | </div> |
264 | 264 | |
265 | 265 | <div class="lasso-editor-settings--option-inner" style="border:none"> |
266 | - <input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked( $enable_autosave, 'on' );?> > |
|
267 | - <label for="lasso_editor[enable_autosave]"><?php _e( 'Enable Auto Save', 'lasso' );?></label> |
|
268 | - <span class="lasso--setting-description"><?php _e( 'Check this box to enable auto save.', 'lasso' );?></span> |
|
266 | + <input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked($enable_autosave, 'on'); ?> > |
|
267 | + <label for="lasso_editor[enable_autosave]"><?php _e('Enable Auto Save', 'lasso'); ?></label> |
|
268 | + <span class="lasso--setting-description"><?php _e('Check this box to enable auto save.', 'lasso'); ?></span> |
|
269 | 269 | </div> |
270 | 270 | |
271 | 271 | <div class="lasso-editor-settings--option-inner" style="border:none"> |
272 | - <input type="checkbox" class="checkbox" name="lasso_editor[post_save_disabled]" id="lasso_editor[post_save_disabled]" <?php echo checked( $save_to_post_disabled, 'on' );?> > |
|
273 | - <label for="lasso_editor[post_save_disabled]"><?php _e( 'Disable Post Saving', 'lasso' );?></label> |
|
274 | - <span class="lasso--setting-description"><?php _e( 'By default the editor will update the database with the post or page it is being used on. Check this box to disable this. If you check this box, it is assumed that you will be using the provided filters to save your own content.', 'lasso' );?></span> |
|
272 | + <input type="checkbox" class="checkbox" name="lasso_editor[post_save_disabled]" id="lasso_editor[post_save_disabled]" <?php echo checked($save_to_post_disabled, 'on'); ?> > |
|
273 | + <label for="lasso_editor[post_save_disabled]"><?php _e('Disable Post Saving', 'lasso'); ?></label> |
|
274 | + <span class="lasso--setting-description"><?php _e('By default the editor will update the database with the post or page it is being used on. Check this box to disable this. If you check this box, it is assumed that you will be using the provided filters to save your own content.', 'lasso'); ?></span> |
|
275 | 275 | |
276 | 276 | </div> |
277 | 277 | |
278 | 278 | <div class="lasso-editor-settings--option-inner"> |
279 | - <input type="checkbox" class="checkbox" name="lasso_editor[save_using_rest_disabled]" id="lasso_editor[save_using_rest_disabled]" <?php echo checked( $save_using_rest_disabled, 'on' );?> > |
|
280 | - <label for="lasso_editor[save_using_rest_disabled]"><?php _e( "Don't Use REST API to Save", 'lasso' );?></label> |
|
281 | - <span class="lasso--setting-description"><?php _e( 'By default the editor will use REST API to save posts. Check this box to use custom AJAX calls instead.', 'lasso' );?></span> |
|
279 | + <input type="checkbox" class="checkbox" name="lasso_editor[save_using_rest_disabled]" id="lasso_editor[save_using_rest_disabled]" <?php echo checked($save_using_rest_disabled, 'on'); ?> > |
|
280 | + <label for="lasso_editor[save_using_rest_disabled]"><?php _e("Don't Use REST API to Save", 'lasso'); ?></label> |
|
281 | + <span class="lasso--setting-description"><?php _e('By default the editor will use REST API to save posts. Check this box to use custom AJAX calls instead.', 'lasso'); ?></span> |
|
282 | 282 | |
283 | 283 | </div> |
284 | 284 | </div> |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | |
289 | 289 | <div class="lasso-editor-settings--submit"> |
290 | 290 | <input type="hidden" name="action" value="lasso-editor-settings" /> |
291 | - <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Settings', 'lasso' );?>" /> |
|
292 | - <?php wp_nonce_field( 'nonce', 'lasso_editor_settings' ); ?> |
|
291 | + <input type="submit" class="button-primary" value="<?php esc_attr_e('Save Settings', 'lasso'); ?>" /> |
|
292 | + <?php wp_nonce_field('nonce', 'lasso_editor_settings'); ?> |
|
293 | 293 | </div> |
294 | 294 | |
295 | - <?php do_action('lasso_settings_after');?> |
|
295 | + <?php do_action('lasso_settings_after'); ?> |
|
296 | 296 | </form> |
297 | 297 | |
298 | 298 | </div><?php |
@@ -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.2' ); |
|
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.2'); |
|
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 | |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function lasso_show_in_rest() { |
49 | 49 | global $wp_post_types; |
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 ); |
|
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 | 53 | |
54 | - foreach( $allowed_post_types as $key ) { |
|
54 | + foreach ($allowed_post_types as $key) { |
|
55 | 55 | |
56 | 56 | // If the post type doesn't exist, skip it |
57 | - if( !$wp_post_types[$key] ) |
|
57 | + if (!$wp_post_types[$key]) |
|
58 | 58 | continue; |
59 | 59 | |
60 | 60 | $wp_post_types[$key]->show_in_rest = true; |
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - add_action( 'init', 'lasso_show_in_rest' ); |
|
64 | + add_action('init', 'lasso_show_in_rest'); |
|
65 | 65 |
@@ -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') |
|
389 | + if (empty($postid) && $action != 'edit_posts' && $action != 'publish_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; |