Completed
Pull Request — master (#116)
by
unknown
02:26
created
admin/includes/EDD_SL_Plugin_Updater.php 2 patches
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 	 * @param array   $_api_data    Optional data to send with API calls.
27 27
 	 * @return void
28 28
 	 */
29
-	function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
30
-		$this->api_url  = trailingslashit( $_api_url );
29
+	function __construct($_api_url, $_plugin_file, $_api_data = null) {
30
+		$this->api_url  = trailingslashit($_api_url);
31 31
 		$this->api_data = $_api_data;
32
-		$this->name     = plugin_basename( $_plugin_file );
33
-		$this->slug     = basename( $_plugin_file, '.php' );
32
+		$this->name     = plugin_basename($_plugin_file);
33
+		$this->slug     = basename($_plugin_file, '.php');
34 34
 		$this->version  = $_api_data['version'];
35 35
 
36 36
 		// Set up hooks.
37 37
 		$this->init();
38
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
38
+		add_action('admin_init', array($this, 'show_changelog'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function init() {
49 49
 
50
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
51
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
50
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
51
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
52 52
 
53
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
53
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
54 54
 	}
55 55
 
56 56
 	/**
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
 	 * @param array   $_transient_data Update array build by WordPress.
67 67
 	 * @return array Modified update array with custom plugin data.
68 68
 	 */
69
-	function check_update( $_transient_data ) {
69
+	function check_update($_transient_data) {
70 70
 
71 71
 		global $pagenow;
72 72
 
73
-		if ( ! is_object( $_transient_data ) ) {
73
+		if (!is_object($_transient_data)) {
74 74
 			$_transient_data = new stdClass;
75 75
 		}
76 76
 
77
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
77
+		if ('plugins.php' == $pagenow && is_multisite()) {
78 78
 			return $_transient_data;
79 79
 		}
80 80
 
81
-		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
81
+		if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
82 82
 
83
-			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
83
+			$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
84 84
 
85
-			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
85
+			if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
86 86
 
87 87
 				$this->did_check = true;
88 88
 
89
-				if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
89
+				if (version_compare($this->version, $version_info->new_version, '<')) {
90 90
 
91
-					$_transient_data->response[ $this->name ] = $version_info;
91
+					$_transient_data->response[$this->name] = $version_info;
92 92
 
93 93
 				}
94 94
 
95 95
 				$_transient_data->last_checked = time();
96
-				$_transient_data->checked[ $this->name ] = $this->version;
96
+				$_transient_data->checked[$this->name] = $this->version;
97 97
 
98 98
 			}
99 99
 
@@ -108,84 +108,84 @@  discard block
 block discarded – undo
108 108
 	 * @param string  $file
109 109
 	 * @param array   $plugin
110 110
 	 */
111
-	public function show_update_notification( $file, $plugin ) {
111
+	public function show_update_notification($file, $plugin) {
112 112
 
113
-		if ( ! current_user_can( 'update_plugins' ) ) {
113
+		if (!current_user_can('update_plugins')) {
114 114
 			return;
115 115
 		}
116 116
 
117
-		if ( ! is_multisite() ) {
117
+		if (!is_multisite()) {
118 118
 			return;
119 119
 		}
120 120
 
121
-		if ( $this->name != $file ) {
121
+		if ($this->name != $file) {
122 122
 			return;
123 123
 		}
124 124
 
125 125
 		// Remove our filter on the site transient
126
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
126
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
127 127
 
128
-		$update_cache = get_site_transient( 'update_plugins' );
128
+		$update_cache = get_site_transient('update_plugins');
129 129
 
130
-		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
130
+		if (!is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
131 131
 
132
-			$cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
133
-			$version_info = get_transient( $cache_key );
132
+			$cache_key    = md5('edd_plugin_'.sanitize_key($this->name).'_version_info');
133
+			$version_info = get_transient($cache_key);
134 134
 
135
-			if ( false === $version_info ) {
135
+			if (false === $version_info) {
136 136
 
137
-				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
137
+				$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
138 138
 
139
-				set_transient( $cache_key, $version_info, 3600 );
139
+				set_transient($cache_key, $version_info, 3600);
140 140
 			}
141 141
 
142 142
 
143
-			if ( ! is_object( $version_info ) ) {
143
+			if (!is_object($version_info)) {
144 144
 				return;
145 145
 			}
146 146
 
147
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
147
+			if (version_compare($this->version, $version_info->new_version, '<')) {
148 148
 
149
-				$update_cache->response[ $this->name ] = $version_info;
149
+				$update_cache->response[$this->name] = $version_info;
150 150
 
151 151
 			}
152 152
 
153 153
 			$update_cache->last_checked = time();
154
-			$update_cache->checked[ $this->name ] = $this->version;
154
+			$update_cache->checked[$this->name] = $this->version;
155 155
 
156
-			set_site_transient( 'update_plugins', $update_cache );
156
+			set_site_transient('update_plugins', $update_cache);
157 157
 
158 158
 		} else {
159 159
 
160
-			$version_info = $update_cache->response[ $this->name ];
160
+			$version_info = $update_cache->response[$this->name];
161 161
 
162 162
 		}
163 163
 
164 164
 		// Restore our filter
165
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
165
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
166 166
 
167
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
167
+		if (!empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
168 168
 
169 169
 			// build a plugin list row, with update notification
170
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
171
-			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
170
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
171
+			echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
172 172
 
173
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
173
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
174 174
 
175
-			if ( empty( $version_info->download_link ) ) {
175
+			if (empty($version_info->download_link)) {
176 176
 				printf(
177
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'lasso' ),
178
-					esc_html( $version_info->name ),
179
-					esc_url( $changelog_link ),
180
-					esc_html( $version_info->new_version )
177
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'lasso'),
178
+					esc_html($version_info->name),
179
+					esc_url($changelog_link),
180
+					esc_html($version_info->new_version)
181 181
 				);
182 182
 			} else {
183 183
 				printf(
184
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'lasso' ),
185
-					esc_html( $version_info->name ),
186
-					esc_url( $changelog_link ),
187
-					esc_html( $version_info->new_version ),
188
-					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
184
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'lasso'),
185
+					esc_html($version_info->name),
186
+					esc_url($changelog_link),
187
+					esc_html($version_info->new_version),
188
+					esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name))
189 189
 				);
190 190
 			}
191 191
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 	 * @param object  $_args
205 205
 	 * @return object $_data
206 206
 	 */
207
-	function plugins_api_filter( $_data, $_action = '', $_args = null ) {
207
+	function plugins_api_filter($_data, $_action = '', $_args = null) {
208 208
 
209 209
 
210
-		if ( $_action != 'plugin_information' ) {
210
+		if ($_action != 'plugin_information') {
211 211
 
212 212
 			return $_data;
213 213
 
214 214
 		}
215 215
 
216
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
216
+		if (!isset($_args->slug) || ($_args->slug != $this->slug)) {
217 217
 
218 218
 			return $_data;
219 219
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 			)
229 229
 		);
230 230
 
231
-		$api_response = $this->api_request( 'plugin_information', $to_send );
231
+		$api_response = $this->api_request('plugin_information', $to_send);
232 232
 
233
-		if ( false !== $api_response ) {
233
+		if (false !== $api_response) {
234 234
 			$_data = $api_response;
235 235
 		}
236 236
 
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 	 * @param string  $url
246 246
 	 * @return object $array
247 247
 	 */
248
-	function http_request_args( $args, $url ) {
248
+	function http_request_args($args, $url) {
249 249
 		// If it is an https request and we are performing a package download, disable ssl verification
250
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
250
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
251 251
 			$args['sslverify'] = false;
252 252
 		}
253 253
 		return $args;
@@ -264,40 +264,40 @@  discard block
 block discarded – undo
264 264
 	 * @param array   $_data   Parameters for the API action.
265 265
 	 * @return false||object
266 266
 	 */
267
-	private function api_request( $_action, $_data ) {
267
+	private function api_request($_action, $_data) {
268 268
 
269 269
 		global $wp_version;
270 270
 
271
-		$data = array_merge( $this->api_data, $_data );
271
+		$data = array_merge($this->api_data, $_data);
272 272
 
273
-		if ( $data['slug'] != $this->slug )
273
+		if ($data['slug'] != $this->slug)
274 274
 			return;
275 275
 
276
-		if ( empty( $data['license'] ) )
276
+		if (empty($data['license']))
277 277
 			return;
278 278
 
279
-		if ( $this->api_url == home_url() ) {
279
+		if ($this->api_url == home_url()) {
280 280
 			return false; // Don't allow a plugin to ping itself
281 281
 		}
282 282
 
283 283
 		$api_params = array(
284 284
 			'edd_action' => 'get_version',
285 285
 			'license'    => $data['license'],
286
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
287
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
286
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
287
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
288 288
 			'slug'       => $data['slug'],
289 289
 			'author'     => $data['author'],
290 290
 			'url'        => home_url()
291 291
 		);
292 292
 
293
-		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
293
+		$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
294 294
 
295
-		if ( ! is_wp_error( $request ) ) {
296
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
295
+		if (!is_wp_error($request)) {
296
+			$request = json_decode(wp_remote_retrieve_body($request));
297 297
 		}
298 298
 
299
-		if ( $request && isset( $request->sections ) ) {
300
-			$request->sections = maybe_unserialize( $request->sections );
299
+		if ($request && isset($request->sections)) {
300
+			$request->sections = maybe_unserialize($request->sections);
301 301
 		} else {
302 302
 			$request = false;
303 303
 		}
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
 	public function show_changelog() {
309 309
 
310 310
 
311
-		if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
311
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
312 312
 			return;
313 313
 		}
314 314
 
315
-		if ( empty( $_REQUEST['plugin'] ) ) {
315
+		if (empty($_REQUEST['plugin'])) {
316 316
 			return;
317 317
 		}
318 318
 
319
-		if ( empty( $_REQUEST['slug'] ) ) {
319
+		if (empty($_REQUEST['slug'])) {
320 320
 			return;
321 321
 		}
322 322
 
323
-		if ( ! current_user_can( 'update_plugins' ) ) {
324
-			wp_die( __( 'You do not have permission to install plugin updates', 'lasso' ), __( 'Error', 'lasso' ), array( 'response' => 403 ) );
323
+		if (!current_user_can('update_plugins')) {
324
+			wp_die(__('You do not have permission to install plugin updates', 'lasso'), __('Error', 'lasso'), array('response' => 403));
325 325
 		}
326 326
 
327
-		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
327
+		$response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug']));
328 328
 
329
-		if ( $response && isset( $response->sections['changelog'] ) ) {
330
-			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
329
+		if ($response && isset($response->sections['changelog'])) {
330
+			echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
331 331
 		}
332 332
 
333 333
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -270,11 +270,13 @@
 block discarded – undo
270 270
 
271 271
 		$data = array_merge( $this->api_data, $_data );
272 272
 
273
-		if ( $data['slug'] != $this->slug )
274
-			return;
273
+		if ( $data['slug'] != $this->slug ) {
274
+					return;
275
+		}
275 276
 
276
-		if ( empty( $data['license'] ) )
277
-			return;
277
+		if ( empty( $data['license'] ) ) {
278
+					return;
279
+		}
278 280
 
279 281
 		if ( $this->api_url == home_url() ) {
280 282
 			return false; // Don't allow a plugin to ping itself
Please login to merge, or discard this patch.
admin/includes/load_admin.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 		$plugin = lasso::get_instance();
44 44
 		$this->plugin_slug = $plugin->get_plugin_slug();
45 45
 
46
-		add_action( 'admin_head',  			array( $this, 'admin_assets' ) );
47
-		add_action( 'admin_notices', 		array( $this, 'license_nag' ) );
48
-		add_action( 'admin_head', 			array( $this, 'dismiss_nag' ) );
49
-		add_filter( 'plugin_row_meta',    	array( $this, 'plugin_meta' ), 10, 2 );
46
+		add_action('admin_head', array($this, 'admin_assets'));
47
+		add_action('admin_notices', array($this, 'license_nag'));
48
+		add_action('admin_head', array($this, 'dismiss_nag'));
49
+		add_filter('plugin_row_meta', array($this, 'plugin_meta'), 10, 2);
50 50
 
51
-		if ( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
51
+		if (!class_exists('EDD_SL_Plugin_Updater')) {
52 52
 			include LASSO_DIR.'admin/includes/EDD_SL_Plugin_Updater.php';
53 53
 		}
54 54
 
55
-		if ( !class_exists( 'TGM_Plugin_Activation' ) ) {
55
+		if (!class_exists('TGM_Plugin_Activation')) {
56 56
 			include LASSO_DIR.'admin/includes/class-tgm-plugin-activation.php';
57 57
 		}
58 58
 
59 59
 		new menus\welcome();
60 60
 		new menus\settings();
61 61
 
62
-		if ( !defined( 'LASSO_AGENCY_MODE' ) ) {
62
+		if (!defined('LASSO_AGENCY_MODE')) {
63 63
 			new menus\license();
64 64
 		}
65 65
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	public static function get_instance() {
76 76
 
77 77
 		// If the single instance hasn't been set, set it now.
78
-		if ( null == self::$instance ) {
78
+		if (null == self::$instance) {
79 79
 			self::$instance = new self;
80 80
 		}
81 81
 
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 			'dashboard_page_lasso-welcome-screen'
98 98
 		);
99 99
 
100
-		foreach ( $pages as $page ) {
101
-			wp_enqueue_script( 'lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array( 'jquery' ), LASSO_VERSION, true );
102
-			wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION );
100
+		foreach ($pages as $page) {
101
+			wp_enqueue_script('lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array('jquery'), LASSO_VERSION, true);
102
+			wp_enqueue_style('lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION);
103 103
 		}
104 104
 	}
105 105
 
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return array new array of links for our plugin listing on plugins.php
114 114
 	 */
115
-	public function plugin_meta( $links, $file ) {
115
+	public function plugin_meta($links, $file) {
116 116
 
117
-		if ( strpos( $file, 'lasso.php' ) !== false && !defined( 'LASSO_AGENCY_MODE' ) ) {
117
+		if (strpos($file, 'lasso.php') !== false && !defined('LASSO_AGENCY_MODE')) {
118 118
 
119 119
 			$new_links = array(
120 120
 				'<a href="http://edituswp.com/help" target="_blank">Help</a>'
121 121
 			);
122 122
 
123
-			$links = array_merge( $links, $new_links );
123
+			$links = array_merge($links, $new_links);
124 124
 		}
125 125
 
126 126
 		return $links;
@@ -132,35 +132,35 @@  discard block
 block discarded – undo
132 132
 	*	@since 0.9.7
133 133
 	*	@todo make dismissible
134 134
 	*/
135
-	public function license_nag(){
135
+	public function license_nag() {
136 136
 
137
-		$screen 	= get_current_screen();
138
-		$welcome    = 'toplevel_page_lasso-editor' == $screen->id;
139
-		$license  	= get_option( 'lasso_license_key' );
140
-		$status   	= get_option( 'lasso_license_status' );
137
+		$screen = get_current_screen();
138
+		$welcome = 'toplevel_page_lasso-editor' == $screen->id;
139
+		$license  	= get_option('lasso_license_key');
140
+		$status   	= get_option('lasso_license_status');
141 141
 
142
-		$message_empty    = apply_filters('lasso_empty_license_message','Your license key for support and automatic updates for Editus is missing!');
143
-		$message_invalid  = apply_filters('lasso_invalid_license_message','Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.');
144
-		$message_inactive  = apply_filters('lasso_inactive_license_message','It looks like your license key has not yet been activated.');
142
+		$message_empty    = apply_filters('lasso_empty_license_message', 'Your license key for support and automatic updates for Editus is missing!');
143
+		$message_invalid  = apply_filters('lasso_invalid_license_message', 'Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.');
144
+		$message_inactive = apply_filters('lasso_inactive_license_message', 'It looks like your license key has not yet been activated.');
145 145
 
146
-		$license_link 	  = sprintf('<a href="%s">Update License</a>', esc_url( add_query_arg( array( 'page' => 'lasso-license' ), admin_url('admin.php') ) ) );
147
-		$dismiss_link     = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url( add_query_arg( 'lasso-notice', 'dismiss' ) ), __('Dismiss this notice.','lasso') );
146
+		$license_link = sprintf('<a href="%s">Update License</a>', esc_url(add_query_arg(array('page' => 'lasso-license'), admin_url('admin.php'))));
147
+		$dismiss_link     = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url(add_query_arg('lasso-notice', 'dismiss')), __('Dismiss this notice.', 'lasso'));
148 148
 
149
-		$not_hidden       = get_user_meta( get_current_user_ID(), 'lasso_license_nag_dismissed', true );
149
+		$not_hidden       = get_user_meta(get_current_user_ID(), 'lasso_license_nag_dismissed', true);
150 150
 
151
-		if ( current_user_can('manage_options') && !$welcome && !defined( 'LASSO_AGENCY_MODE') && !$not_hidden ) {
151
+		if (current_user_can('manage_options') && !$welcome && !defined('LASSO_AGENCY_MODE') && !$not_hidden) {
152 152
 
153
-			if ( empty( $license ) ) {
153
+			if (empty($license)) {
154 154
 
155
-        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link );
155
+        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link);
156 156
 
157
-        	} else if ( 'invalid' == $status ){ // license key entered wrong or something
157
+        	} else if ('invalid' == $status) { // license key entered wrong or something
158 158
 
159
-				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link );
159
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link, $dismiss_link);
160 160
 
161
-        	} else if ( empty( $status ) ){ // license key saved but not activated
161
+        	} else if (empty($status)) { // license key saved but not activated
162 162
 
163
-				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link );
163
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link);
164 164
 
165 165
         	}
166 166
 		}
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function dismiss_nag() {
176 176
 
177
-		if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) {
178
-			update_user_meta( get_current_user_id(), 'lasso_license_nag_dismissed', 1 );
177
+		if (isset($_GET['lasso-notice']) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options')) {
178
+			update_user_meta(get_current_user_id(), 'lasso_license_nag_dismissed', 1);
179 179
 		}
180 180
 	}
181 181
 }
Please login to merge, or discard this patch.
admin/includes/menus/license.php 2 patches
Braces   +20 added lines, -12 removed lines patch added patch discarded remove patch
@@ -106,8 +106,10 @@  discard block
 block discarded – undo
106 106
 		if ( isset( $_POST['edd_license_activate'] ) ) {
107 107
 
108 108
 			// run a quick security check
109
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
110
-				return; // get out if we didn't click the Activate button
109
+			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) {
110
+							return;
111
+			}
112
+			// get out if we didn't click the Activate button
111 113
 
112 114
 			// retrieve the license from the database
113 115
 			$license = trim( get_option( 'lasso_license_key' ) );
@@ -124,8 +126,9 @@  discard block
 block discarded – undo
124 126
 			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
125 127
 
126 128
 			// make sure the response came back okay
127
-			if ( is_wp_error( $response ) )
128
-				return false;
129
+			if ( is_wp_error( $response ) ) {
130
+							return false;
131
+			}
129 132
 
130 133
 			// decode the license data
131 134
 			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
@@ -143,8 +146,10 @@  discard block
 block discarded – undo
143 146
 		if ( isset( $_POST['edd_license_deactivate'] ) ) {
144 147
 
145 148
 			// run a quick security check
146
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
147
-				return; // get out if we didn't click the Activate button
149
+			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) {
150
+							return;
151
+			}
152
+			// get out if we didn't click the Activate button
148 153
 
149 154
 			// retrieve the license from the database
150 155
 			$license = trim( get_option( 'lasso_license_key' ) );
@@ -162,15 +167,17 @@  discard block
 block discarded – undo
162 167
 			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
163 168
 
164 169
 			// make sure the response came back okay
165
-			if ( is_wp_error( $response ) )
166
-				return false;
170
+			if ( is_wp_error( $response ) ) {
171
+							return false;
172
+			}
167 173
 
168 174
 			// decode the license data
169 175
 			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
170 176
 
171 177
 			// $license_data->license will be either "deactivated" or "failed"
172
-			if ( $license_data->license == 'deactivated' )
173
-				delete_option( 'lasso_license_status' );
178
+			if ( $license_data->license == 'deactivated' ) {
179
+							delete_option( 'lasso_license_status' );
180
+			}
174 181
 
175 182
 		}
176 183
 	}
@@ -192,8 +199,9 @@  discard block
 block discarded – undo
192 199
 		// Call the custom API.
193 200
 		$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
194 201
 
195
-		if ( is_wp_error( $response ) )
196
-			return false;
202
+		if ( is_wp_error( $response ) ) {
203
+					return false;
204
+		}
197 205
 
198 206
 		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
199 207
 
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
 
7 7
 	function __construct() {
8 8
 
9
-		define( 'LASSO_STORE_ITEM_NAME', 'lasso' );
10
-		define( 'LASSO_STORE_URL', 'https://edituswp.com' );
11
-
12
-		add_action( 'admin_init',  array( $this, 'plugin_updater' ), 0 );
13
-		add_action( 'admin_menu',  array( $this, 'license_menu' ) );
14
-		add_action( 'network_admin_menu',  array( $this, 'license_menu' ) ); // CHANGED Added hook.
15
-		add_action( 'admin_init',  array( $this, 'register_option' ) );
16
-		add_action( 'admin_init',  array( $this, 'activate_license' ) );
17
-		add_action( 'admin_init',  array( $this, 'deactivate_license' ) );
9
+		define('LASSO_STORE_ITEM_NAME', 'lasso');
10
+		define('LASSO_STORE_URL', 'https://edituswp.com');
11
+
12
+		add_action('admin_init', array($this, 'plugin_updater'), 0);
13
+		add_action('admin_menu', array($this, 'license_menu'));
14
+		add_action('network_admin_menu', array($this, 'license_menu')); // CHANGED Added hook.
15
+		add_action('admin_init', array($this, 'register_option'));
16
+		add_action('admin_init', array($this, 'activate_license'));
17
+		add_action('admin_init', array($this, 'deactivate_license'));
18 18
 	}
19 19
 
20 20
 	function plugin_updater() {
21 21
 
22 22
 		// retrieve our license key from the DB
23
-		$license_key = trim( get_option( 'lasso_license_key' ) );
23
+		$license_key = trim(get_option('lasso_license_key'));
24 24
 
25 25
 		// setup the updater
26
-		$edd_updater = new \EDD_SL_Plugin_Updater( LASSO_STORE_URL , LASSO_FILE, array(
26
+		$edd_updater = new \EDD_SL_Plugin_Updater(LASSO_STORE_URL, LASSO_FILE, array(
27 27
 				'version'  => LASSO_VERSION,
28 28
 				'license'  => $license_key,
29 29
 				'item_name' => LASSO_STORE_ITEM_NAME,
30
-				'author'  => __( 'Aesopinteractive LLC', 'lasso' )
30
+				'author'  => __('Aesopinteractive LLC', 'lasso')
31 31
 			)
32 32
 		);
33 33
 
@@ -35,51 +35,51 @@  discard block
 block discarded – undo
35 35
 	function license_menu() {
36 36
 
37 37
 		// CHANGED Removed condition.
38
-		add_submenu_page( 'lasso-editor', __( 'License Key', 'lasso' ), __( 'License', 'lasso' ), 'manage_options', 'lasso-license', array( $this, 'license_page' ) );
38
+		add_submenu_page('lasso-editor', __('License Key', 'lasso'), __('License', 'lasso'), 'manage_options', 'lasso-license', array($this, 'license_page'));
39 39
 
40 40
 	}
41 41
 	function license_page() {
42
-		$license  = get_option( 'lasso_license_key' );
43
-		$status  = get_option( 'lasso_license_status' );
42
+		$license = get_option('lasso_license_key');
43
+		$status = get_option('lasso_license_status');
44 44
 
45 45
 ?>
46 46
 		<div class="wrap">
47
-			<h2><?php _e( 'Editus License', 'lasso' ); ?></h2>
48
-			<p><?php _e( 'Input the license key you recieved with your purchase to ensure your version of Editus stays updated.', 'lasso' );?></p>
47
+			<h2><?php _e('Editus License', 'lasso'); ?></h2>
48
+			<p><?php _e('Input the license key you recieved with your purchase to ensure your version of Editus stays updated.', 'lasso'); ?></p>
49 49
 			<form class="lasso--form-settings" method="post" action="options.php">
50 50
 
51
-				<?php settings_fields( 'lasso_license' ); ?>
51
+				<?php settings_fields('lasso_license'); ?>
52 52
 
53 53
 				<table class="form-table">
54 54
 					<tbody>
55 55
 						<tr valign="top">
56 56
 							<th scope="row" valign="top">
57
-								<?php _e( 'License Key', 'lasso' ); ?>
57
+								<?php _e('License Key', 'lasso'); ?>
58 58
 							</th>
59 59
 							<td>
60
-								<input id="lasso_license_key" name="lasso_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" />
60
+								<input id="lasso_license_key" name="lasso_license_key" type="text" class="regular-text" value="<?php esc_attr_e($license); ?>" />
61 61
 							</td>
62 62
 						</tr>
63
-						<?php if ( false !== $license ) { ?>
63
+						<?php if (false !== $license) { ?>
64 64
 							<tr valign="top">
65 65
 								<th scope="row" valign="top">
66
-									<?php _e( 'Activate License', 'lasso' ); ?>
66
+									<?php _e('Activate License', 'lasso'); ?>
67 67
 								</th>
68 68
 								<td>
69
-									<?php if ( $status !== false && $status == 'valid' ) { ?>
70
-										<span style="color:green;"><?php _e( 'active' ); ?></span>
71
-										<?php wp_nonce_field( 'lasso_license_nonce', 'lasso_license_nonce' ); ?>
72
-										<input type="submit" class="button-secondary" name="edd_license_deactivate" value="<?php esc_attr_e( 'Deactivate License', 'lasso' ); ?>"/>
69
+									<?php if ($status !== false && $status == 'valid') { ?>
70
+										<span style="color:green;"><?php _e('active'); ?></span>
71
+										<?php wp_nonce_field('lasso_license_nonce', 'lasso_license_nonce'); ?>
72
+										<input type="submit" class="button-secondary" name="edd_license_deactivate" value="<?php esc_attr_e('Deactivate License', 'lasso'); ?>"/>
73 73
 									<?php } else {
74
-				wp_nonce_field( 'lasso_license_nonce', 'lasso_license_nonce' ); ?>
75
-										<input type="submit" class="button-secondary" name="edd_license_activate" value="<?php esc_attr_e( 'Activate License', 'lasso' ); ?>"/>
74
+				wp_nonce_field('lasso_license_nonce', 'lasso_license_nonce'); ?>
75
+										<input type="submit" class="button-secondary" name="edd_license_activate" value="<?php esc_attr_e('Activate License', 'lasso'); ?>"/>
76 76
 									<?php } ?>
77 77
 								</td>
78 78
 							</tr>
79 79
 						<?php } ?>
80 80
 					</tbody>
81 81
 				</table>
82
-				<?php submit_button( 'Save License' ); ?>
82
+				<?php submit_button('Save License'); ?>
83 83
 
84 84
 			</form>
85 85
 		<?php
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	// register option
89 89
 	function register_option() {
90 90
 
91
-		register_setting( 'lasso_license', 'lasso_license_key', array( $this, 'sanitize_license' ) );
91
+		register_setting('lasso_license', 'lasso_license_key', array($this, 'sanitize_license'));
92 92
 	}
93 93
 
94 94
 	// santize
95
-	function sanitize_license( $new ) {
96
-		$old = get_option( 'lasso_license_key' );
97
-		if ( $old && $old != $new ) {
98
-			delete_option( 'lasso_license_status' ); // new license has been entered, so must reactivate
95
+	function sanitize_license($new) {
96
+		$old = get_option('lasso_license_key');
97
+		if ($old && $old != $new) {
98
+			delete_option('lasso_license_status'); // new license has been entered, so must reactivate
99 99
 		}
100 100
 		return $new;
101 101
 	}
@@ -104,36 +104,36 @@  discard block
 block discarded – undo
104 104
 	function activate_license() {
105 105
 
106 106
 		// listen for our activate button to be clicked
107
-		if ( isset( $_POST['edd_license_activate'] ) ) {
107
+		if (isset($_POST['edd_license_activate'])) {
108 108
 
109 109
 			// run a quick security check
110
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
110
+			if (!check_admin_referer('lasso_license_nonce', 'lasso_license_nonce'))
111 111
 				return; // get out if we didn't click the Activate button
112 112
 
113 113
 			// retrieve the license from the database
114
-			$license = trim( get_option( 'lasso_license_key' ) );
114
+			$license = trim(get_option('lasso_license_key'));
115 115
 
116 116
 			// data to send in our API request
117 117
 			$api_params = array(
118 118
 				'edd_action'=> 'activate_license',
119 119
 				'license'  => $license,
120
-				'item_name' => urlencode( LASSO_STORE_ITEM_NAME ), // the name of our product in EDD
120
+				'item_name' => urlencode(LASSO_STORE_ITEM_NAME), // the name of our product in EDD
121 121
 				'url'       => home_url()
122 122
 			);
123 123
 
124 124
 			// Call the custom API.
125
-			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
125
+			$response = wp_remote_post(LASSO_STORE_URL, array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
126 126
 
127 127
 			// make sure the response came back okay
128
-			if ( is_wp_error( $response ) )
128
+			if (is_wp_error($response))
129 129
 				return false;
130 130
 
131 131
 			// decode the license data
132
-			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
132
+			$license_data = json_decode(wp_remote_retrieve_body($response));
133 133
 
134 134
 			// $license_data->license will be either "valid" or "invalid"
135 135
 
136
-			update_option( 'lasso_license_status', $license_data->license );
136
+			update_option('lasso_license_status', $license_data->license);
137 137
 
138 138
 		}
139 139
 	}
@@ -141,37 +141,37 @@  discard block
 block discarded – undo
141 141
 	function deactivate_license() {
142 142
 
143 143
 		// listen for our activate button to be clicked
144
-		if ( isset( $_POST['edd_license_deactivate'] ) ) {
144
+		if (isset($_POST['edd_license_deactivate'])) {
145 145
 
146 146
 			// run a quick security check
147
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
147
+			if (!check_admin_referer('lasso_license_nonce', 'lasso_license_nonce'))
148 148
 				return; // get out if we didn't click the Activate button
149 149
 
150 150
 			// retrieve the license from the database
151
-			$license = trim( get_option( 'lasso_license_key' ) );
151
+			$license = trim(get_option('lasso_license_key'));
152 152
 
153 153
 
154 154
 			// data to send in our API request
155 155
 			$api_params = array(
156 156
 				'edd_action'=> 'deactivate_license',
157 157
 				'license'  => $license,
158
-				'item_name' => urlencode( LASSO_STORE_ITEM_NAME ), // the name of our product in EDD
158
+				'item_name' => urlencode(LASSO_STORE_ITEM_NAME), // the name of our product in EDD
159 159
 				'url'       => home_url()
160 160
 			);
161 161
 
162 162
 			// Call the custom API.
163
-			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
163
+			$response = wp_remote_post(LASSO_STORE_URL, array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
164 164
 
165 165
 			// make sure the response came back okay
166
-			if ( is_wp_error( $response ) )
166
+			if (is_wp_error($response))
167 167
 				return false;
168 168
 
169 169
 			// decode the license data
170
-			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
170
+			$license_data = json_decode(wp_remote_retrieve_body($response));
171 171
 
172 172
 			// $license_data->license will be either "deactivated" or "failed"
173
-			if ( $license_data->license == 'deactivated' )
174
-				delete_option( 'lasso_license_status' );
173
+			if ($license_data->license == 'deactivated')
174
+				delete_option('lasso_license_status');
175 175
 
176 176
 		}
177 177
 	}
@@ -181,24 +181,24 @@  discard block
 block discarded – undo
181 181
 
182 182
 		global $wp_version;
183 183
 
184
-		$license = trim( get_option( 'lasso_license_key' ) );
184
+		$license = trim(get_option('lasso_license_key'));
185 185
 
186 186
 		$api_params = array(
187 187
 			'edd_action' => 'check_license',
188 188
 			'license' => $license,
189
-			'item_name' => urlencode( LASSO_STORE_ITEM_NAME ),
189
+			'item_name' => urlencode(LASSO_STORE_ITEM_NAME),
190 190
 			'url'       => home_url()
191 191
 		);
192 192
 
193 193
 		// Call the custom API.
194
-		$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
194
+		$response = wp_remote_post(LASSO_STORE_URL, array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
195 195
 
196
-		if ( is_wp_error( $response ) )
196
+		if (is_wp_error($response))
197 197
 			return false;
198 198
 
199
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
199
+		$license_data = json_decode(wp_remote_retrieve_body($response));
200 200
 
201
-		if ( $license_data->license == 'valid' ) {
201
+		if ($license_data->license == 'valid') {
202 202
 			echo 'valid'; exit;
203 203
 			// this license is still valid
204 204
 		} else {
Please login to merge, or discard this patch.
admin/includes/menus/settings.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
 	function process_settings() {
52 52
 
53 53
 		// bail out if current user isn't and administrator and they are not logged in
54
-		if ( !current_user_can( 'manage_options' ) || !is_user_logged_in() )
55
-			return;
54
+		if ( !current_user_can( 'manage_options' ) || !is_user_logged_in() ) {
55
+					return;
56
+		}
56 57
 
57 58
 		if ( isset( $_POST['action'] ) && 'lasso-editor-settings' == $_POST['action'] && check_admin_referer( 'nonce', 'lasso_editor_settings' ) ) {
58 59
 
@@ -88,8 +89,9 @@  discard block
 block discarded – undo
88 89
 	 */
89 90
 	function lasso_editor_settings_form() {
90 91
 
91
-		if ( !is_user_logged_in() )
92
-			return;
92
+		if ( !is_user_logged_in() ) {
93
+					return;
94
+		}
93 95
 
94 96
 		$article_object   = lasso_editor_get_option( 'article_class', 'lasso_editor' );
95 97
 		$featImgClass    = lasso_editor_get_option( 'featimg_class', 'lasso_editor' );
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 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,150 +82,150 @@  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
 
105 105
 ?>
106 106
 		<div class="wrap">
107 107
 
108
-	    	<h2><?php _e( 'Editus Settings', 'lasso' );?></h2>
108
+	    	<h2><?php _e('Editus Settings', 'lasso'); ?></h2>
109 109
 
110 110
 			<form id="lasso-editor-settings-form" class="lasso--form-settings" method="post" enctype="multipart/form-data">
111 111
 
112
-				<?php do_action('lasso_settings_before');?>
112
+				<?php do_action('lasso_settings_before'); ?>
113 113
 
114 114
 				<div class="lasso-editor-settings--option-wrap">
115 115
 					<div class="lasso-editor-settings--option-inner">
116
-						<label><?php _e( 'Article Class', 'lasso' );?></label>
117
-						<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>
118
-						<input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr( $article_object );?>" placeholder=".entry-content">
116
+						<label><?php _e('Article Class', 'lasso'); ?></label>
117
+						<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>
118
+						<input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr($article_object); ?>" placeholder=".entry-content">
119 119
 					</div>
120 120
 				</div>
121 121
 
122 122
 				<div class="lasso-editor-settings--option-wrap">
123 123
 					<div class="lasso-editor-settings--option-inner">
124
-						<label><?php _e( 'Featured Image Class', 'lasso' );?></label>
125
-						<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>
126
-						<input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr( $featImgClass );?>" placeholder=".entry-content">
124
+						<label><?php _e('Featured Image Class', 'lasso'); ?></label>
125
+						<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>
126
+						<input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr($featImgClass); ?>" placeholder=".entry-content">
127 127
 					</div>
128 128
 				</div>
129 129
 
130 130
 				<div class="lasso-editor-settings--option-wrap">
131 131
 					<div class="lasso-editor-settings--option-inner">
132
-						<label><?php _e( 'Article Title Class', 'lasso' );?></label>
133
-						<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>
134
-						<input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr( $titleClass );?>" placeholder=".entry-content">
132
+						<label><?php _e('Article Title Class', 'lasso'); ?></label>
133
+						<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>
134
+						<input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr($titleClass); ?>" placeholder=".entry-content">
135 135
 					</div>
136 136
 				</div>
137 137
 
138 138
 				<!-- Advanced -->
139 139
 				<div class="lasso-editor-settings--option-wrap">
140 140
 					<div class="lasso-editor-settings--option-inner">
141
-						<label><?php _e( 'Ignored Items to Save', 'lasso' );?></label>
142
-						<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>
143
-						<textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNoSave );?></textarea>
141
+						<label><?php _e('Ignored Items to Save', 'lasso'); ?></label>
142
+						<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>
143
+						<textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNoSave); ?></textarea>
144 144
 					</div>
145 145
 				</div>
146 146
 				
147 147
 				<div class="lasso-editor-settings--option-wrap">
148 148
 					<div class="lasso-editor-settings--option-inner">
149
-						<label><?php _e( 'Read Only Items', 'lasso' );?></label>
150
-						<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>
151
-						<textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNonEditable );?></textarea>
149
+						<label><?php _e('Read Only Items', 'lasso'); ?></label>
150
+						<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>
151
+						<textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNonEditable); ?></textarea>
152 152
 					</div>
153 153
 				</div>
154 154
 
155 155
 				<div class="lasso-editor-settings--option-wrap">
156 156
 					<div class="lasso-editor-settings--option-inner">
157
-						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked( $toolbar_headings, 'on' );?> >
158
-						<label for="lasso_editor[toolbar_headings]"><?php _e( 'Enable H2 and H3 Buttons', 'lasso' );?></label>
159
-						<span class="lasso--setting-description"><?php _e( 'Show the buttons to set H2 and H3 settings.', 'lasso' );?></span>
157
+						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked($toolbar_headings, 'on'); ?> >
158
+						<label for="lasso_editor[toolbar_headings]"><?php _e('Enable H2 and H3 Buttons', 'lasso'); ?></label>
159
+						<span class="lasso--setting-description"><?php _e('Show the buttons to set H2 and H3 settings.', 'lasso'); ?></span>
160 160
 
161 161
 					</div>
162 162
 				</div>
163 163
 				
164 164
 				<div class="lasso-editor-settings--option-wrap">
165 165
 					<div class="lasso-editor-settings--option-inner">
166
-						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked( $toolbar_show_color, 'on' );?> >
167
-						<label for="lasso_editor[toolbar_show_color]"><?php _e( 'Enable Text Color Buttons', 'lasso' );?></label>
168
-						<span class="lasso--setting-description"><?php _e( 'Show the buttons to set text colors.', 'lasso' );?></span>
166
+						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked($toolbar_show_color, 'on'); ?> >
167
+						<label for="lasso_editor[toolbar_show_color]"><?php _e('Enable Text Color Buttons', 'lasso'); ?></label>
168
+						<span class="lasso--setting-description"><?php _e('Show the buttons to set text colors.', 'lasso'); ?></span>
169 169
 
170 170
 					</div>
171 171
 				</div>
172 172
 				
173 173
 				<div class="lasso-editor-settings--option-wrap">
174 174
 					<div class="lasso-editor-settings--option-inner">
175
-						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked( $toolbar_show_alignment, 'on' );?> >
176
-						<label for="lasso_editor[toolbar_show_alignment]"><?php _e( 'Enable Text Align Buttons', 'lasso' );?></label>
177
-						<span class="lasso--setting-description"><?php _e( 'Show the buttons to set text alignment.', 'lasso' );?></span>
175
+						<input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked($toolbar_show_alignment, 'on'); ?> >
176
+						<label for="lasso_editor[toolbar_show_alignment]"><?php _e('Enable Text Align Buttons', 'lasso'); ?></label>
177
+						<span class="lasso--setting-description"><?php _e('Show the buttons to set text alignment.', 'lasso'); ?></span>
178 178
 
179 179
 					</div>
180 180
 				</div>
181 181
 
182 182
 				<div class="lasso-editor-settings--option-wrap">
183 183
 					<div class="lasso-editor-settings--option-inner">
184
-						<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' );?> >
185
-						<label for="lasso_editor[post_save_disabled]"><?php _e( 'Disable Post Saving', 'lasso' );?></label>
186
-						<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>
184
+						<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'); ?> >
185
+						<label for="lasso_editor[post_save_disabled]"><?php _e('Disable Post Saving', 'lasso'); ?></label>
186
+						<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>
187 187
 
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_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked( $post_settings_disabled, 'on' );?> >
194
-						<label for="lasso_editor[post_settings_disabled]"> <?php _e( 'Disable Post Settings', 'lasso' );?></label>
195
-						<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>
193
+						<input type="checkbox" class="checkbox" name="lasso_editor[post_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked($post_settings_disabled, 'on'); ?> >
194
+						<label for="lasso_editor[post_settings_disabled]"> <?php _e('Disable Post Settings', 'lasso'); ?></label>
195
+						<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>
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[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked( $post_new_disabled, 'on' );?> >
202
-						<label for="lasso_editor[post_adding_disabled]"><?php _e( 'Disable Post Adding', 'lasso' );?></label>
203
-						<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>
201
+						<input type="checkbox" class="checkbox" name="lasso_editor[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked($post_new_disabled, 'on'); ?> >
202
+						<label for="lasso_editor[post_adding_disabled]"><?php _e('Disable Post Adding', 'lasso'); ?></label>
203
+						<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>
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[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked( $shortcodify_disabled, 'on' );?> >
210
-						<label for="lasso_editor[shortcodify_disabled]"><?php _e( 'Disable Aesop Component Conversion', 'lasso' );?></label>
211
-						<span class="lasso--setting-description"><?php _e( 'Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso' );?></span>
209
+						<input type="checkbox" class="checkbox" name="lasso_editor[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked($shortcodify_disabled, 'on'); ?> >
210
+						<label for="lasso_editor[shortcodify_disabled]"><?php _e('Disable Aesop Component Conversion', 'lasso'); ?></label>
211
+						<span class="lasso--setting-description"><?php _e('Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso'); ?></span>
212 212
 					</div>
213 213
 				</div>
214 214
 				
215 215
 				<div class="lasso-editor-settings--option-wrap last">
216 216
 					<div class="lasso-editor-settings--option-inner">
217
-						<input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked( $enable_autosave, 'on' );?> >
218
-						<label for="lasso_editor[enable_autosave]"><?php _e( 'Enable Auto Save', 'lasso' );?></label>
219
-						<span class="lasso--setting-description"><?php _e( 'Check this box to enable auto save.', 'lasso' );?></span>
217
+						<input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked($enable_autosave, 'on'); ?> >
218
+						<label for="lasso_editor[enable_autosave]"><?php _e('Enable Auto Save', 'lasso'); ?></label>
219
+						<span class="lasso--setting-description"><?php _e('Check this box to enable auto save.', 'lasso'); ?></span>
220 220
 					</div>
221 221
 				</div>
222 222
 
223
-				<?php do_action('lasso_settings_after');?>
223
+				<?php do_action('lasso_settings_after'); ?>
224 224
 
225 225
 				<div class="lasso-editor-settings--submit">
226 226
 				    <input type="hidden" name="action" value="lasso-editor-settings" />
227
-				    <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Settings', 'lasso' );?>" />
228
-					<?php wp_nonce_field( 'nonce', 'lasso_editor_settings' ); ?>
227
+				    <input type="submit" class="button-primary" value="<?php esc_attr_e('Save Settings', 'lasso'); ?>" />
228
+					<?php wp_nonce_field('nonce', 'lasso_editor_settings'); ?>
229 229
 				</div>
230 230
 			</form>
231 231
 
Please login to merge, or discard this patch.
bootstrap.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 /*----------------------------------------------------------------------------*
10 10
  * Register Autoloader
11 11
  *----------------------------------------------------------------------------*/
12
-include_once( LASSO_DIR . '/includes/lasso_autoloader.php' );
12
+include_once(LASSO_DIR.'/includes/lasso_autoloader.php');
13 13
 $loader = new lasso_autoloader();
14 14
 
15 15
 $loader->register();
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
  *----------------------------------------------------------------------------*/
20 20
 //require_once plugin_dir_path( __FILE__ ) . 'public/class-lasso.php';
21 21
 
22
-$loader->addNamespace('lasso', LASSO_DIR . 'includes' );
23
-$loader->addNamespace('lasso_public_facing', LASSO_DIR . 'public/includes' );
24
-$loader->addNamespace('lasso\internal_api', LASSO_DIR . 'internal-api' );
22
+$loader->addNamespace('lasso', LASSO_DIR.'includes');
23
+$loader->addNamespace('lasso_public_facing', LASSO_DIR.'public/includes');
24
+$loader->addNamespace('lasso\internal_api', LASSO_DIR.'internal-api');
25 25
 new lasso\internal_api\end_points();
26 26
 
27
-register_activation_hook( __FILE__, array( 'lasso_public_facing\lasso', 'activate' ) );
28
-register_deactivation_hook( __FILE__, array( 'lasso_public_facing\lasso', 'deactivate' ) );
27
+register_activation_hook(__FILE__, array('lasso_public_facing\lasso', 'activate'));
28
+register_deactivation_hook(__FILE__, array('lasso_public_facing\lasso', 'deactivate'));
29 29
 
30
-add_action( 'plugins_loaded', array( 'lasso_public_facing\lasso', 'get_instance' ) );
30
+add_action('plugins_loaded', array('lasso_public_facing\lasso', 'get_instance'));
31 31
 
32 32
 //load tour
33
-add_action(  'init', function() {
34
-	if (! is_admin() && is_user_logged_in() ) {
33
+add_action('init', function() {
34
+	if (!is_admin() && is_user_logged_in()) {
35 35
 		new \lasso_public_facing\tour();
36 36
 	}
37 37
 });
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  * Dashboard and Administrative Functionality
42 42
  *----------------------------------------------------------------------------*/
43 43
 
44
-if ( is_admin() ) {
45
-	$loader->addNamespace('lasso_admin', LASSO_DIR . 'admin/includes' );
46
-	add_action( 'plugins_loaded', array( 'lasso_admin\load_admin', 'get_instance' ) );
44
+if (is_admin()) {
45
+	$loader->addNamespace('lasso_admin', LASSO_DIR.'admin/includes');
46
+	add_action('plugins_loaded', array('lasso_admin\load_admin', 'get_instance'));
47 47
 
48 48
 }
Please login to merge, or discard this patch.
includes/lasso_autoloader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@
 block discarded – undo
40 40
 	 */
41 41
 	public function addNamespace($prefix, $base_dir, $prepend = false) {
42 42
 		// normalize namespace prefix
43
-		$prefix = trim($prefix, '\\') . '\\';
43
+		$prefix = trim($prefix, '\\').'\\';
44 44
 
45 45
 		// normalize the base directory with a trailing separator
46
-		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
46
+		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/';
47 47
 
48 48
 		// initialize the namespace prefix array
49 49
 		if (isset($this->prefixes[$prefix]) === false) {
Please login to merge, or discard this patch.
includes/process/delete.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @since 1.0
27 27
 	 */
28
-	public function post( $data ) {
28
+	public function post($data) {
29 29
 
30
-		$postid = isset( $data['postid'] ) ? $data['postid'] : false;
30
+		$postid = isset($data['postid']) ? $data['postid'] : false;
31 31
 
32 32
 		// bail out if teh current user can't publish posts
33
-		if ( !lasso_user_can( 'delete_post', $postid ) )
33
+		if (!lasso_user_can('delete_post', $postid))
34 34
 			return;
35 35
 
36 36
 		$args = array(
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 			'post_status' 	=> 'trash'
39 39
 		);
40 40
 
41
-		wp_update_post( apply_filters( 'lasso_object_deleted_args', $args ) );
41
+		wp_update_post(apply_filters('lasso_object_deleted_args', $args));
42 42
 
43
-		do_action( 'lasso_object_deleted', $postid, get_current_user_ID() );
43
+		do_action('lasso_object_deleted', $postid, get_current_user_ID());
44 44
 
45 45
 		return true;
46 46
 	}
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return array Array of keys to pull from $_POST per action and their sanitization callback
54 54
 	 */
55
-	public static function params(){
56
-		$params[ 'process_delete_post' ] = array(
55
+	public static function params() {
56
+		$params['process_delete_post'] = array(
57 57
 			'postid' => 'absint',
58 58
 		);
59 59
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return array Array of additional functions to use to authorize action.
69 69
 	 */
70 70
 	public static function auth_callbacks() {
71
-		$params[ 'process_delete_post' ] = array(
71
+		$params['process_delete_post'] = array(
72 72
 			'lasso_user_can'
73 73
 		);
74 74
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@
 block discarded – undo
30 30
 		$postid = isset( $data['postid'] ) ? $data['postid'] : false;
31 31
 
32 32
 		// bail out if teh current user can't publish posts
33
-		if ( !lasso_user_can( 'delete_post', $postid ) )
34
-			return;
33
+		if ( !lasso_user_can( 'delete_post', $postid ) ) {
34
+					return;
35
+		}
35 36
 
36 37
 		$args = array(
37 38
 			'ID'   			=> (int) $postid,
Please login to merge, or discard this patch.
includes/process/gallery.php 2 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 		$gallery_ids  = isset( $data['gallery_ids'] ) ? $data['gallery_ids'] : false;
120 120
 		if ( ! empty( $data ) && $data[ 'gallery_type' ] ) {
121 121
 			$type = $data[ 'gallery_type' ];
122
-		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
122
+		} elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
123 123
 			$type = $options[ 'galleryType' ];
124
-		}else{
124
+		} else{
125 125
 			$type = false;
126 126
 		}
127 127
 
@@ -173,8 +173,9 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	private function get_the_images( $image_ids = '' ) {
175 175
 
176
-		if ( empty( $image_ids ) )
177
-			return;
176
+		if ( empty( $image_ids ) ) {
177
+					return;
178
+		}
178 179
 
179 180
 		$image_ids  = array_map( 'intval', explode( ',', $image_ids ) );
180 181
 
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @return array Key "markup" has the HTML.
31 31
 	 */
32
-	public function swap( $data ) {
32
+	public function swap($data) {
33 33
 
34 34
 
35
-		$id = $data[ 'gallery_id' ];
36
-		if ( is_null( $id ) ) {
35
+		$id = $data['gallery_id'];
36
+		if (is_null($id)) {
37 37
 			$id = false;
38 38
 		}
39 39
 
40
-		$markup = sprintf( '<div contenteditable="false" class="lasso--empty-component aesop-component aesop-gallery-component" data-component-type="gallery" data-id="%s">%s</div>', $id, __( 'Save and refresh to view gallery.','lasso' ) );
40
+		$markup = sprintf('<div contenteditable="false" class="lasso--empty-component aesop-component aesop-gallery-component" data-component-type="gallery" data-id="%s">%s</div>', $id, __('Save and refresh to view gallery.', 'lasso'));
41 41
 
42 42
 		return array(
43 43
 			'gallery' => $markup
@@ -54,49 +54,49 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return array|bool On success an array containing "message" or on failure false.
56 56
 	 */
57
-	public function create( $data ) {
57
+	public function create($data) {
58 58
 
59 59
 		//@todo adapt auth callbacks to work with args.
60
-		if (  ! lasso_user_can( 'publish_posts' ) ) {
60
+		if (!lasso_user_can('publish_posts')) {
61 61
 			return false;
62 62
 
63 63
 		}
64 64
 
65
-		$gallery_ids = isset( $data['gallery_ids'] ) ? $data['gallery_ids'] : false;
65
+		$gallery_ids = isset($data['gallery_ids']) ? $data['gallery_ids'] : false;
66 66
 
67 67
 		// bail if no gallery ids
68
-		if ( empty( $gallery_ids ) ) {
68
+		if (empty($gallery_ids)) {
69 69
 			return false;
70 70
 		}
71 71
 
72
-		$postid   		 = isset( $data['postid'] ) ? (int) $data['postid'] : false;
73
-		$type   		 = isset( $data['gallery_type'] ) ? $data['gallery_type'] : false;
74
-		$edgallerytitle	 = isset( $data['edgallerytitle'] ) ? $data['edgallerytitle'] : $postid.'-'.rand();
72
+		$postid = isset($data['postid']) ? (int) $data['postid'] : false;
73
+		$type = isset($data['gallery_type']) ? $data['gallery_type'] : false;
74
+		$edgallerytitle = isset($data['edgallerytitle']) ? $data['edgallerytitle'] : $postid.'-'.rand();
75 75
 
76 76
 		// insert a new gallery
77 77
 		$args = array(
78
-			'post_title'    => $edgallerytitle ,
78
+			'post_title'    => $edgallerytitle,
79 79
 			'post_status'   => 'publish',
80 80
 			'post_type'     => 'ai_galleries'
81 81
 		);
82 82
 
83
-		$postid = wp_insert_post( apply_filters( 'lasso_insert_gallery_args', $args ) );
83
+		$postid = wp_insert_post(apply_filters('lasso_insert_gallery_args', $args));
84 84
 
85 85
 		// update gallery ids
86
-		if ( $gallery_ids ) {
86
+		if ($gallery_ids) {
87 87
 
88
-			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
88
+			update_post_meta($postid, '_ase_gallery_images', $gallery_ids);
89 89
 
90 90
 		}
91 91
 
92 92
 		// update the gallery type
93
-		if ( !empty( $type ) ) {
93
+		if (!empty($type)) {
94 94
 
95
-			update_post_meta( $postid, 'aesop_gallery_type', $type );
95
+			update_post_meta($postid, 'aesop_gallery_type', $type);
96 96
 
97 97
 		}
98 98
 
99
-		do_action( 'lasso_gallery_published', $postid, $gallery_ids, get_current_user_ID() );
99
+		do_action('lasso_gallery_published', $postid, $gallery_ids, get_current_user_ID());
100 100
 
101 101
 		return array(
102 102
 			'message' => 'gallery-created',
@@ -114,20 +114,20 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return array "message" key has the message.
116 116
 	 */
117
-	public function update( $data ) {
118
-
119
-		$options      = isset( $data['fields'] ) ? $data['fields'] : false;
120
-		$postid   	  = !empty( $options ) ? (int) $options['id'] : false;
121
-		$gallery_ids  = isset( $data['gallery_ids'] ) ? $data['gallery_ids'] : false;
122
-		if ( ! empty( $data ) && $data[ 'gallery_type' ] ) {
123
-			$type = $data[ 'gallery_type' ];
124
-		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
125
-			$type = $options[ 'galleryType' ];
126
-		}else{
117
+	public function update($data) {
118
+
119
+		$options      = isset($data['fields']) ? $data['fields'] : false;
120
+		$postid = !empty($options) ? (int) $options['id'] : false;
121
+		$gallery_ids  = isset($data['gallery_ids']) ? $data['gallery_ids'] : false;
122
+		if (!empty($data) && $data['gallery_type']) {
123
+			$type = $data['gallery_type'];
124
+		}elseif (!empty($options) && $options['galleryType']) {
125
+			$type = $options['galleryType'];
126
+		} else {
127 127
 			$type = false;
128 128
 		}
129 129
 
130
-		save_gallery::save_gallery_options( $postid, $gallery_ids, $options, $type );
130
+		save_gallery::save_gallery_options($postid, $gallery_ids, $options, $type);
131 131
 
132 132
 		return array(
133 133
 			'message' => 'gallery-updated'
@@ -145,25 +145,25 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @return bool
147 147
 	 */
148
-	public function get_images( $data ) {
148
+	public function get_images($data) {
149 149
 
150 150
 		//check caps
151
-		if ( !current_user_can( 'edit_posts' ) ) {
151
+		if (!current_user_can('edit_posts')) {
152 152
 			return false;
153 153
 		}
154 154
 
155 155
 		// bail if no id specified like on new galleries
156
-		if ( is_null( $data['post_id'] ) || empty( $data['post_id'] ) ) {
156
+		if (is_null($data['post_id']) || empty($data['post_id'])) {
157 157
 			return false;
158 158
 		}
159 159
 
160
-		$postid  = isset( $data['post_id'] ) ? $data['post_id'] : false;
160
+		$postid = isset($data['post_id']) ? $data['post_id'] : false;
161 161
 
162 162
 		// fetch image ids from cache
163
-		$image_ids  = get_post_meta( $postid, '_ase_gallery_images', true );
163
+		$image_ids = get_post_meta($postid, '_ase_gallery_images', true);
164 164
 
165 165
 		// send ids to return images
166
-		return self::get_the_images( $image_ids );
166
+		return self::get_the_images($image_ids);
167 167
 
168 168
 	}
169 169
 
@@ -173,32 +173,32 @@  discard block
 block discarded – undo
173 173
 	 * @param $image_ids array array of image ids
174 174
 	 * @since 0.1
175 175
 	 */
176
-	private function get_the_images( $image_ids = '' ) {
176
+	private function get_the_images($image_ids = '') {
177 177
 
178
-		if ( empty( $image_ids ) )
178
+		if (empty($image_ids))
179 179
 			return;
180 180
 
181
-		$image_ids  = array_map( 'intval', explode( ',', $image_ids ) );
181
+		$image_ids = array_map('intval', explode(',', $image_ids));
182 182
 
183 183
 		$out[] = '<ul id="ase-gallery-images">';
184 184
 
185
-		if ( !empty( $image_ids ) ):
185
+		if (!empty($image_ids)):
186 186
 
187
-			foreach ( $image_ids as $image_id ) {
187
+			foreach ($image_ids as $image_id) {
188 188
 
189
-				$image    =  wp_get_attachment_image_src( $image_id, 'thumbnail', false );
189
+				$image = wp_get_attachment_image_src($image_id, 'thumbnail', false);
190 190
 
191
-				$out[] = sprintf( '
191
+				$out[] = sprintf('
192 192
 		        <li id="%1s" class="ase-gallery-image">
193 193
 		        	<i class="dashicons dashicons-no-alt" title="%2s"></i>
194 194
 		        	<i class="dashicons dashicons-edit" title="%3s"></i>
195 195
 		           	<img src="%4s">
196 196
 		        </li>
197 197
 		       ',
198
-					absint( $image_id ),
199
-					__( 'Delete From Gallery', 'lasso' ),
200
-					__( 'Edit Image Caption', 'lasso' ),
201
-					esc_url( $image[0] )
198
+					absint($image_id),
199
+					__('Delete From Gallery', 'lasso'),
200
+					__('Edit Image Caption', 'lasso'),
201
+					esc_url($image[0])
202 202
 				);
203 203
 
204 204
 			}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$out[] = '</ul>';
209 209
 
210
-		return array( 'html' => implode( '', $out ) );
210
+		return array('html' => implode('', $out));
211 211
 
212 212
 	}
213 213
 
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
 	 *
220 220
 	 * @return array Array of keys to pull from $data per action and their sanitization callback
221 221
 	 */
222
-	public static function params(){
223
-		$params[ 'process_gallery_swap' ] = array(
222
+	public static function params() {
223
+		$params['process_gallery_swap'] = array(
224 224
 			'gallery_id' => 'absint',
225 225
 
226 226
 		);
227 227
 
228
-		$params[ 'process_gallery_create' ] = array(
228
+		$params['process_gallery_create'] = array(
229 229
 			'postid'   => 'absint',
230 230
 			'content'   => 'wp_kses_post',
231 231
 			'edgallerytitle' =>'sanitize_text_field',
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 		);
239 239
 
240
-		$params[ 'process_gallery_update' ] = array(
240
+		$params['process_gallery_update'] = array(
241 241
 			'postid'        => 'absint',
242 242
 			'gallery_ids'   => 'lasso_sanitize_data',
243 243
 			'fields'        => 'lasso_sanitize_data',
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			)
248 248
 		);
249 249
 
250
-		$params[ 'process_gallery_get_images' ] = array(
250
+		$params['process_gallery_get_images'] = array(
251 251
 			'post_id'       => 'absint'
252 252
 		);
253 253
 
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
 	 * @return array Array of additional functions to use to authorize action.
264 264
 	 */
265 265
 	public static function auth_callbacks() {
266
-		$params[ 'process_gallery_swap' ] = array(
266
+		$params['process_gallery_swap'] = array(
267 267
 			'lasso_user_can'
268 268
 		);
269 269
 
270
-		$params[ 'process_gallery_create' ] = array(
270
+		$params['process_gallery_create'] = array(
271 271
 			'is_user_logged_in'
272 272
 		);
273 273
 
274
-		$params[ 'process_gallery_update' ] = array(
274
+		$params['process_gallery_update'] = array(
275 275
 			'lasso_user_can'
276 276
 		);
277 277
 
278
-		$params[ 'process_gallery_get_images' ] = array();
278
+		$params['process_gallery_get_images'] = array();
279 279
 
280 280
 		return $params;
281 281
 
Please login to merge, or discard this patch.
includes/process/map.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return bool Always returns true.
30 30
 	 */
31
-	public function save( $data ) {
31
+	public function save($data) {
32 32
 
33
-		$postid     	= isset( $data['postid'] ) ? $data['postid'] : false;
34
-		$locations    	= isset( $data['ase-map-component-locations'] ) ? $data['ase-map-component-locations'] : false;
35
-		$start_point    = isset( $data['ase-map-component-start-point'] ) ? $data['ase-map-component-start-point']: false;
36
-		$zoom       	= isset( $data['ase-map-component-zoom'] ) ? $data['ase-map-component-zoom' ] : false;
33
+		$postid     	= isset($data['postid']) ? $data['postid'] : false;
34
+		$locations = isset($data['ase-map-component-locations']) ? $data['ase-map-component-locations'] : false;
35
+		$start_point = isset($data['ase-map-component-start-point']) ? $data['ase-map-component-start-point'] : false;
36
+		$zoom       	= isset($data['ase-map-component-zoom']) ? $data['ase-map-component-zoom'] : false;
37 37
 
38
-		if ( is_array( $locations ) ) {
39
-			delete_post_meta( $postid, 'ase_map_component_locations' );
38
+		if (is_array($locations)) {
39
+			delete_post_meta($postid, 'ase_map_component_locations');
40 40
 
41 41
 			// update locations if set
42
-			foreach ( $locations as $location ) {
43
-				$point = json_decode( urldecode( $location ), true );
44
-				add_post_meta( $postid, 'ase_map_component_locations', $point );
42
+			foreach ($locations as $location) {
43
+				$point = json_decode(urldecode($location), true);
44
+				add_post_meta($postid, 'ase_map_component_locations', $point);
45 45
 			}
46 46
 
47 47
 			// udpate start point
48
-			update_post_meta( $postid, 'ase_map_component_start_point', $start_point );
48
+			update_post_meta($postid, 'ase_map_component_start_point', $start_point);
49 49
 
50 50
 			// update zoom
51
-			update_post_meta( $postid, 'ase_map_component_zoom', $zoom );
51
+			update_post_meta($postid, 'ase_map_component_zoom', $zoom);
52 52
 		}
53 53
 
54 54
 		return true;
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return array Array of keys to pull from $_POST per action and their sanitization callback
64 64
 	 */
65
-	public static function params(){
66
-		$params[ 'process_map_save' ] = array(
65
+	public static function params() {
66
+		$params['process_map_save'] = array(
67 67
 			'postid' => 'absint',
68 68
 			'ase-map-component-locations' => 'lasso_sanitize_data',
69 69
 			'ase-map-component-start-point' => array(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return array Array of additional functions to use to authorize action.
88 88
 	 */
89 89
 	public static function auth_callbacks() {
90
-		$params[ 'process_map_save' ] = array(
90
+		$params['process_map_save'] = array(
91 91
 			'lasso_user_can'
92 92
 		);
93 93
 
Please login to merge, or discard this patch.