Completed
Push — master ( cafb48...8da93b )
by
unknown
02:28
created
admin/includes/menus/settings.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,22 +45,22 @@  discard block
 block discarded – undo
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
-			$options = array_map( 'sanitize_text_field', $options );
55
+			$options = array_map('sanitize_text_field', $options);
56 56
 
57
-			if ( function_exists( 'is_multisite' ) && is_multisite() ) {
57
+			if (function_exists('is_multisite') && is_multisite()) {
58 58
 
59
-				update_site_option( 'lasso_editor', $options );
59
+				update_site_option('lasso_editor', $options);
60 60
 
61 61
 			} else {
62 62
 
63
-				update_option( 'lasso_editor', $options );
63
+				update_option('lasso_editor', $options);
64 64
 			}
65 65
 
66 66
 			wp_send_json_success();
@@ -82,159 +82,159 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	function lasso_editor_settings_form() {
84 84
 
85
-		if ( !is_user_logged_in() )
85
+		if (!is_user_logged_in())
86 86
 			return;
87 87
 
88
-		$article_object   = lasso_editor_get_option( 'article_class', 'lasso_editor' );
89
-		$featImgClass    = lasso_editor_get_option( 'featimg_class', 'lasso_editor' );
90
-		$titleClass    = lasso_editor_get_option( 'title_class', 'lasso_editor' );
88
+		$article_object = lasso_editor_get_option('article_class', 'lasso_editor');
89
+		$featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor');
90
+		$titleClass = lasso_editor_get_option('title_class', 'lasso_editor');
91 91
 
92
-		$post_new_disabled   = lasso_editor_get_option( 'post_adding_disabled', 'lasso_editor' );
93
-		$save_to_post_disabled  = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' );
94
-		$post_settings_disabled = lasso_editor_get_option( 'post_settings_disabled', 'lasso_editor' );
95
-		$shortcodify_disabled  = lasso_editor_get_option( 'shortcodify_disabled', 'lasso_editor' );
96
-		$enable_autosave  = lasso_editor_get_option( 'enable_autosave', 'lasso_editor' );
92
+		$post_new_disabled = lasso_editor_get_option('post_adding_disabled', 'lasso_editor');
93
+		$save_to_post_disabled  = lasso_editor_get_option('post_save_disabled', 'lasso_editor');
94
+		$post_settings_disabled = lasso_editor_get_option('post_settings_disabled', 'lasso_editor');
95
+		$shortcodify_disabled  = lasso_editor_get_option('shortcodify_disabled', 'lasso_editor');
96
+		$enable_autosave = lasso_editor_get_option('enable_autosave', 'lasso_editor');
97 97
 
98
-		$toolbar_headings      = lasso_editor_get_option( 'toolbar_headings', 'lasso_editor' );
99
-		$toolbar_show_color      = lasso_editor_get_option( 'toolbar_show_color', 'lasso_editor' );
100
-		$toolbar_show_alignment  = lasso_editor_get_option( 'toolbar_show_alignment', 'lasso_editor' );
98
+		$toolbar_headings      = lasso_editor_get_option('toolbar_headings', 'lasso_editor');
99
+		$toolbar_show_color      = lasso_editor_get_option('toolbar_show_color', 'lasso_editor');
100
+		$toolbar_show_alignment  = lasso_editor_get_option('toolbar_show_alignment', 'lasso_editor');
101 101
 		
102
-		$objectsNoSave  	= lasso_editor_get_option('dont_save', 'lasso_editor');
103
-		$objectsNonEditable  	= lasso_editor_get_option('non_editable', 'lasso_editor');
102
+		$objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor');
103
+		$objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor');
104 104
 		$disable_tour = lasso_editor_get_option('disable_tour', 'lasso_editor');
105 105
 
106 106
 ?>
107 107
 		<div class="wrap">
108 108
 
109
-	    	<h2><?php _e( 'Editus Settings', 'lasso' );?></h2>
109
+	    	<h2><?php _e('Editus Settings', 'lasso'); ?></h2>
110 110
 
111 111
 			<form id="lasso-editor-settings-form" class="lasso--form-settings" method="post" enctype="multipart/form-data">
112 112
 
113
-				<?php do_action('lasso_settings_before');?>
113
+				<?php do_action('lasso_settings_before'); ?>
114 114
 
115 115
 				<div class="lasso-editor-settings--option-wrap">
116 116
 					<div class="lasso-editor-settings--option-inner">
117
-						<label><?php _e( 'Article Class', 'lasso' );?></label>
118
-						<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>
119
-						<input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr( $article_object );?>" placeholder=".entry-content">
117
+						<label><?php _e('Article Class', 'lasso'); ?></label>
118
+						<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>
119
+						<input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr($article_object); ?>" placeholder=".entry-content">
120 120
 					</div>
121 121
 				</div>
122 122
 
123 123
 				<div class="lasso-editor-settings--option-wrap">
124 124
 					<div class="lasso-editor-settings--option-inner">
125
-						<label><?php _e( 'Featured Image Class', 'lasso' );?></label>
126
-						<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>
127
-						<input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr( $featImgClass );?>" placeholder=".entry-content">
125
+						<label><?php _e('Featured Image Class', 'lasso'); ?></label>
126
+						<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>
127
+						<input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr($featImgClass); ?>" placeholder=".entry-content">
128 128
 					</div>
129 129
 				</div>
130 130
 
131 131
 				<div class="lasso-editor-settings--option-wrap">
132 132
 					<div class="lasso-editor-settings--option-inner">
133
-						<label><?php _e( 'Article Title Class', 'lasso' );?></label>
134
-						<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>
135
-						<input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr( $titleClass );?>" placeholder=".entry-content">
133
+						<label><?php _e('Article Title Class', 'lasso'); ?></label>
134
+						<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>
135
+						<input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr($titleClass); ?>" placeholder=".entry-content">
136 136
 					</div>
137 137
 				</div>
138 138
 
139 139
 				<!-- Advanced -->
140 140
 				<div class="lasso-editor-settings--option-wrap">
141 141
 					<div class="lasso-editor-settings--option-inner">
142
-						<label><?php _e( 'Ignored Items to Save', 'lasso' );?></label>
143
-						<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>
144
-						<textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNoSave );?></textarea>
142
+						<label><?php _e('Ignored Items to Save', 'lasso'); ?></label>
143
+						<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>
144
+						<textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNoSave); ?></textarea>
145 145
 					</div>
146 146
 				</div>
147 147
 				
148 148
 				<div class="lasso-editor-settings--option-wrap">
149 149
 					<div class="lasso-editor-settings--option-inner">
150
-						<label><?php _e( 'Read Only Items', 'lasso' );?></label>
151
-						<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>
152
-						<textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNonEditable );?></textarea>
150
+						<label><?php _e('Read Only Items', 'lasso'); ?></label>
151
+						<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>
152
+						<textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNonEditable); ?></textarea>
153 153
 					</div>
154 154
 				</div>
155 155
 
156 156
 				<div class="lasso-editor-settings--option-wrap">
157 157
 					<div class="lasso-editor-settings--option-inner">
158
-						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked( $toolbar_headings, 'on' );?> >
159
-						<label for="lasso_editor[toolbar_headings]"><?php _e( 'Enable H2 and H3 Buttons', 'lasso' );?></label>
160
-						<span class="lasso--setting-description"><?php _e( 'Show the buttons to set H2 and H3 settings.', 'lasso' );?></span>
158
+						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked($toolbar_headings, 'on'); ?> >
159
+						<label for="lasso_editor[toolbar_headings]"><?php _e('Enable H2 and H3 Buttons', 'lasso'); ?></label>
160
+						<span class="lasso--setting-description"><?php _e('Show the buttons to set H2 and H3 settings.', 'lasso'); ?></span>
161 161
 
162 162
 					</div>
163 163
 				</div>
164 164
 				
165 165
 				<div class="lasso-editor-settings--option-wrap">
166 166
 					<div class="lasso-editor-settings--option-inner">
167
-						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked( $toolbar_show_color, 'on' );?> >
168
-						<label for="lasso_editor[toolbar_show_color]"><?php _e( 'Enable Text Color Buttons', 'lasso' );?></label>
169
-						<span class="lasso--setting-description"><?php _e( 'Show the buttons to set text colors.', 'lasso' );?></span>
167
+						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked($toolbar_show_color, 'on'); ?> >
168
+						<label for="lasso_editor[toolbar_show_color]"><?php _e('Enable Text Color Buttons', 'lasso'); ?></label>
169
+						<span class="lasso--setting-description"><?php _e('Show the buttons to set text colors.', 'lasso'); ?></span>
170 170
 
171 171
 					</div>
172 172
 				</div>
173 173
 				
174 174
 				<div class="lasso-editor-settings--option-wrap">
175 175
 					<div class="lasso-editor-settings--option-inner">
176
-						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked( $toolbar_show_alignment, 'on' );?> >
177
-						<label for="lasso_editor[toolbar_show_alignment]"><?php _e( 'Enable Text Align Buttons', 'lasso' );?></label>
178
-						<span class="lasso--setting-description"><?php _e( 'Show the buttons to set text alignment.', 'lasso' );?></span>
176
+						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked($toolbar_show_alignment, 'on'); ?> >
177
+						<label for="lasso_editor[toolbar_show_alignment]"><?php _e('Enable Text Align Buttons', 'lasso'); ?></label>
178
+						<span class="lasso--setting-description"><?php _e('Show the buttons to set text alignment.', 'lasso'); ?></span>
179 179
 
180 180
 					</div>
181 181
 				</div>
182 182
 
183 183
 				<div class="lasso-editor-settings--option-wrap">
184 184
 					<div class="lasso-editor-settings--option-inner">
185
-						<input type="checkbox" class="checkbox" name="lasso_editor[post_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked( $post_settings_disabled, 'on' );?> >
186
-						<label for="lasso_editor[post_settings_disabled]"> <?php _e( 'Disable Post Settings', 'lasso' );?></label>
187
-						<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>
185
+						<input type="checkbox" class="checkbox" name="lasso_editor[post_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked($post_settings_disabled, 'on'); ?> >
186
+						<label for="lasso_editor[post_settings_disabled]"> <?php _e('Disable Post Settings', 'lasso'); ?></label>
187
+						<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>
188 188
 					</div>
189 189
 				</div>
190 190
 
191 191
 				<div class="lasso-editor-settings--option-wrap">
192 192
 					<div class="lasso-editor-settings--option-inner">
193
-						<input type="checkbox" class="checkbox" name="lasso_editor[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked( $post_new_disabled, 'on' );?> >
194
-						<label for="lasso_editor[post_adding_disabled]"><?php _e( 'Disable Post Adding', 'lasso' );?></label>
195
-						<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>
193
+						<input type="checkbox" class="checkbox" name="lasso_editor[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked($post_new_disabled, 'on'); ?> >
194
+						<label for="lasso_editor[post_adding_disabled]"><?php _e('Disable Post Adding', 'lasso'); ?></label>
195
+						<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>
196 196
 					</div>
197 197
 				</div>
198 198
 
199 199
 				<div class="lasso-editor-settings--option-wrap">
200 200
 					<div class="lasso-editor-settings--option-inner">
201
-						<input type="checkbox" class="checkbox" name="lasso_editor[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked( $shortcodify_disabled, 'on' );?> >
202
-						<label for="lasso_editor[shortcodify_disabled]"><?php _e( 'Disable Aesop Component Conversion', 'lasso' );?></label>
203
-						<span class="lasso--setting-description"><?php _e( 'Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso' );?></span>
201
+						<input type="checkbox" class="checkbox" name="lasso_editor[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked($shortcodify_disabled, 'on'); ?> >
202
+						<label for="lasso_editor[shortcodify_disabled]"><?php _e('Disable Aesop Component Conversion', 'lasso'); ?></label>
203
+						<span class="lasso--setting-description"><?php _e('Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso'); ?></span>
204 204
 					</div>
205 205
 				</div>
206 206
 				
207 207
 				<div class="lasso-editor-settings--option-wrap">
208 208
 					<div class="lasso-editor-settings--option-inner">
209
-						<input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked( $enable_autosave, 'on' );?> >
210
-						<label for="lasso_editor[enable_autosave]"><?php _e( 'Enable Auto Save', 'lasso' );?></label>
211
-						<span class="lasso--setting-description"><?php _e( 'Check this box to enable auto save.', 'lasso' );?></span>
209
+						<input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked($enable_autosave, 'on'); ?> >
210
+						<label for="lasso_editor[enable_autosave]"><?php _e('Enable Auto Save', 'lasso'); ?></label>
211
+						<span class="lasso--setting-description"><?php _e('Check this box to enable auto save.', 'lasso'); ?></span>
212 212
 					</div>
213 213
 				</div>
214 214
 				
215 215
 				<div class="lasso-editor-settings--option-wrap">
216 216
 					<div class="lasso-editor-settings--option-inner">
217
-						<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' );?> >
218
-						<label for="lasso_editor[post_save_disabled]"><?php _e( 'Disable Post Saving', 'lasso' );?></label>
219
-						<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>
217
+						<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'); ?> >
218
+						<label for="lasso_editor[post_save_disabled]"><?php _e('Disable Post Saving', 'lasso'); ?></label>
219
+						<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>
220 220
 
221 221
 					</div>
222 222
 				</div>
223 223
 				
224 224
 				<div class="lasso-editor-settings--option-wrap last">
225 225
 					<div class="lasso-editor-settings--option-inner">
226
-						<input type="checkbox" class="checkbox" name="lasso_editor[disable_tour]" id="lasso_editor[disable_tour]" <?php echo checked( $disable_tour, 'on' );?> >
227
-						<label for="lasso_editor[disable_tour]"> <?php _e( 'Do Not Show Tour Dialog', 'lasso' );?></label>
228
-						<span class="lasso--setting-description"><?php _e( 'Check this box to disable the tour dialog box for all users.', 'lasso' );?></span>
226
+						<input type="checkbox" class="checkbox" name="lasso_editor[disable_tour]" id="lasso_editor[disable_tour]" <?php echo checked($disable_tour, 'on'); ?> >
227
+						<label for="lasso_editor[disable_tour]"> <?php _e('Do Not Show Tour Dialog', 'lasso'); ?></label>
228
+						<span class="lasso--setting-description"><?php _e('Check this box to disable the tour dialog box for all users.', 'lasso'); ?></span>
229 229
 					</div>
230 230
 				</div>
231 231
 
232
-				<?php do_action('lasso_settings_after');?>
232
+				<?php do_action('lasso_settings_after'); ?>
233 233
 
234 234
 				<div class="lasso-editor-settings--submit">
235 235
 				    <input type="hidden" name="action" value="lasso-editor-settings" />
236
-				    <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Settings', 'lasso' );?>" />
237
-					<?php wp_nonce_field( 'nonce', 'lasso_editor_settings' ); ?>
236
+				    <input type="submit" class="button-primary" value="<?php esc_attr_e('Save Settings', 'lasso'); ?>" />
237
+					<?php wp_nonce_field('nonce', 'lasso_editor_settings'); ?>
238 238
 				</div>
239 239
 			</form>
240 240
 
Please login to merge, or discard this patch.