Completed
Push — master ( 5586ba...13831d )
by
unknown
02:56
created
public/includes/helpers.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		'public' => true,
243 243
 	), 'objects' );
244 244
 	$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
245
-    unset( $post_types[ 'attachment' ] );
245
+	unset( $post_types[ 'attachment' ] );
246 246
 
247 247
 	/**
248 248
 	 * Set which post types are allowed
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		'public' => true,
268 268
 	), 'names' );
269 269
 	//$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
270
-    unset( $post_types[ 'attachment' ] );
270
+	unset( $post_types[ 'attachment' ] );
271 271
 
272 272
 	/**
273 273
 	 * Set which post types are allowed
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
  */
371 371
 if ( !function_exists( 'lasso_user_can' ) ):
372 372
 	function lasso_user_can( $action = '', $postid = 0 ) {
373
-        $result = false;
373
+		$result = false;
374 374
 		if ( empty( $action ) )
375 375
 			$action = 'edit_posts';
376 376
 
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 			
384 384
 			
385 385
 			
386
-            if (!empty($allowed_post_types) && !empty($postid)) {
386
+			if (!empty($allowed_post_types) && !empty($postid)) {
387 387
 				$type = get_post_type( $postid );
388
-                $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
388
+				$allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
389 389
 				
390
-                if ( in_array( $type, $allowed_post_types ) ) {
390
+				if ( in_array( $type, $allowed_post_types ) ) {
391 391
 				   $result =  true;
392
-			    }
393
-            } else {
392
+				}
393
+			} else {
394 394
 				$result =  true;
395
-        	}
395
+			}
396 396
 		} else {
397 397
 			$result = false;
398 398
 		}
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -12,21 +12,21 @@  discard block
 block discarded – undo
12 12
  * @return the option value
13 13
  * @since 1.0
14 14
  */
15
-function lasso_editor_get_option( $option, $section, $default = '' ) {
15
+function lasso_editor_get_option($option, $section, $default = '') {
16 16
 
17
-	if ( empty( $option ) )
17
+	if (empty($option))
18 18
 		return;
19 19
 
20
-	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
20
+	if (function_exists('is_multisite') && is_multisite()) {
21 21
 
22
-		$options = get_site_option( $section );
22
+		$options = get_site_option($section);
23 23
 
24 24
 	} else {
25 25
 
26
-		$options = get_option( $section );
26
+		$options = get_option($section);
27 27
 	}
28 28
 
29
-	if ( isset( $options[$option] ) ) {
29
+	if (isset($options[$option])) {
30 30
 		return $options[$option];
31 31
 	}
32 32
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function lasso_editor_galleries_exist() {
42 42
 
43
-	$q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) );
43
+	$q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish'));
44 44
 
45
-	if ( $q->have_posts() )
45
+	if ($q->have_posts())
46 46
 		return true;
47 47
 	else
48 48
 		return false;
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 function lasso_get_supported_theme_class() {
58 58
 
59 59
 	$name  	= wp_get_theme()->get('Name');
60
-	$slug  	= lasso_clean_string( $name );
60
+	$slug  	= lasso_clean_string($name);
61 61
 
62
-	switch ( $slug ) {
62
+	switch ($slug) {
63 63
 		case 'aesop-story-theme': // aesop
64 64
 			$out = '.aesop-entry-content';
65 65
 			break;
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 
109 109
 	}
110 110
 
111
-	return apply_filters('lasso_content_class', !empty( $out ) ? $out : false);
111
+	return apply_filters('lasso_content_class', !empty($out) ? $out : false);
112 112
 	//return !empty( $out ) ? $out : false;
113 113
 }
114 114
 
115 115
 function lasso_get_supported_theme_title_class() {
116 116
 
117 117
 	$name  	= wp_get_theme()->get('Name');
118
-	$slug  	= lasso_clean_string( $name );
118
+	$slug  	= lasso_clean_string($name);
119 119
 
120
-	switch ( $slug ) {
120
+	switch ($slug) {
121 121
 
122 122
 		case 'aesop-story-theme': // aesop
123 123
 			$out = '.aesop-entry-title';
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
 			break;
146 146
 	}
147 147
 
148
-	return apply_filters('lasso_title_class', !empty( $out ) ? $out : false);
148
+	return apply_filters('lasso_title_class', !empty($out) ? $out : false);
149 149
 }
150 150
 
151 151
 //since 0.9.9.6
152 152
 function lasso_get_supported_theme_featured_image_class() {
153 153
 
154 154
 	$name  	= wp_get_theme()->get('Name');
155
-	$slug  	= lasso_clean_string( $name );
155
+	$slug  	= lasso_clean_string($name);
156 156
 
157
-	return apply_filters('lasso_featured_image_class', !empty( $out ) ? $out : false);
157
+	return apply_filters('lasso_featured_image_class', !empty($out) ? $out : false);
158 158
 }
159 159
 
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 *	@since 0.8.7
166 166
 *	@return string of comma separated classes
167 167
 */
168
-function lasso_supported_no_save(){
168
+function lasso_supported_no_save() {
169 169
 
170 170
 	return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .twitter-tweet, .meta, .edit-link, .ssba, .jp-relatedposts, .fb-comments');
171 171
 }
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return array|mixed|object|string|void
181 181
  */
182
-function lasso_sanitize_data( $data ) {
183
-	return \lasso\sanatize::do_sanitize( $data );
182
+function lasso_sanitize_data($data) {
183
+	return \lasso\sanatize::do_sanitize($data);
184 184
 
185 185
 }
186 186
 
@@ -190,18 +190,18 @@  discard block
 block discarded – undo
190 190
  *	@since 0.9.3
191 191
  *	@return string of comma delimited category slugs
192 192
 */
193
-function lasso_get_post_objects( $postid = '', $taxonomy = 'category') {
193
+function lasso_get_post_objects($postid = '', $taxonomy = 'category') {
194 194
 
195
-	if ( empty( $postid ) )
195
+	if (empty($postid))
196 196
 		$postid = get_the_ID();
197 197
 
198
-	$objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid );
198
+	$objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid);
199 199
 
200
-	if ( empty( $objects) )
200
+	if (empty($objects))
201 201
 		return;
202 202
 
203 203
 	$out = '';
204
-	foreach( $objects as $object ) {
204
+	foreach ($objects as $object) {
205 205
 		$out .= $object->slug.', ';
206 206
 	}
207 207
 
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
  *	@since 0.9.3
216 216
  *	@return array all categoiries
217 217
 */
218
-function lasso_get_objects( $taxonomy = 'category' ) {
218
+function lasso_get_objects($taxonomy = 'category') {
219 219
 
220 220
 	$objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0));
221 221
 
222
-	if ( empty( $objects) )
222
+	if (empty($objects))
223 223
 		return;
224 224
 
225 225
 	$out = array();
226
-	foreach( $objects as $object ) {
226
+	foreach ($objects as $object) {
227 227
 		$out[] = $object->slug;
228 228
 	}
229 229
 
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
  * @since 0.9.4
239 239
  */
240 240
 function lasso_post_types_names() {
241
-	$post_types = get_post_types( array(
241
+	$post_types = get_post_types(array(
242 242
 		'public' => true,
243
-	), 'objects' );
244
-	$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
245
-    unset( $post_types[ 'attachment' ] );
243
+	), 'objects');
244
+	$post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label'));
245
+    unset($post_types['attachment']);
246 246
 
247 247
 	/**
248 248
 	 * Set which post types are allowed
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered.
253 253
 	 */
254
-	$allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') );
255
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
256
-	foreach( $post_types as $name => $label ) {
257
-		if ( ! in_array( $name, $allowed_post_types ) ) {
258
-			unset( $post_types[ $name ] );
254
+	$allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page'));
255
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types);
256
+	foreach ($post_types as $name => $label) {
257
+		if (!in_array($name, $allowed_post_types)) {
258
+			unset($post_types[$name]);
259 259
 		}
260 260
 	}
261 261
 	return $post_types;
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 
264 264
 
265 265
 function lasso_post_types() {
266
-	$post_types = get_post_types( array(
266
+	$post_types = get_post_types(array(
267 267
 		'public' => true,
268
-	), 'names' );
268
+	), 'names');
269 269
 	//$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
270
-    unset( $post_types[ 'attachment' ] );
270
+    unset($post_types['attachment']);
271 271
 
272 272
 	/**
273 273
 	 * Set which post types are allowed
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered.
278 278
 	 */
279
-	$allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') );
280
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
281
-	foreach( $post_types as $name => $label ) {
282
-		if ( ! in_array( $name, $allowed_post_types ) ) {
283
-			unset( $post_types[ $name ] );
279
+	$allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post'));
280
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types);
281
+	foreach ($post_types as $name => $label) {
282
+		if (!in_array($name, $allowed_post_types)) {
283
+			unset($post_types[$name]);
284 284
 		}
285 285
 	}
286 286
 	return $post_types;
@@ -299,22 +299,22 @@  discard block
 block discarded – undo
299 299
 *	@uses lasso_modal_addons()
300 300
 *	@since 0.9.4
301 301
 */
302
-function lasso_modal_addons_content( $tab = '', $type ){
302
+function lasso_modal_addons_content($tab = '', $type) {
303 303
 
304
-	$name = lasso_clean_string( $tab['name'] );
304
+	$name = lasso_clean_string($tab['name']);
305 305
 
306
-	if ( 'tab' == $type ) {
306
+	if ('tab' == $type) {
307 307
 
308
-		$out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] );
308
+		$out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']);
309 309
 
310
-	} else if ( 'content' == $type ){
310
+	} else if ('content' == $type) {
311 311
 
312
-		$content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false;
313
-		$options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false;
312
+		$content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false;
313
+		$options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false;
314 314
 
315
-		$out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s">
315
+		$out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s">
316 316
 			%s%s
317
-			</div>', $name, $content, lasso_option_form( $name, $options ) );
317
+			</div>', $name, $content, lasso_option_form($name, $options));
318 318
 
319 319
 	}
320 320
 
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 *
330 330
 * @return void|string
331 331
 */
332
-function lasso_clean_string( $string = '' ) {
332
+function lasso_clean_string($string = '') {
333 333
 
334
-	if ( empty( $string ) )
334
+	if (empty($string))
335 335
 		return;
336 336
 
337
-	return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) );
337
+	return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string)));
338 338
 }
339 339
 
340 340
 /**
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
  *
348 348
  * @return void|string
349 349
  */
350
-function lasso_unclean_string( $string = '' ) {
350
+function lasso_unclean_string($string = '') {
351 351
 
352
-	if ( empty( $string ) ) {
352
+	if (empty($string)) {
353 353
 		return;
354 354
 	}
355 355
 
356
-	return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) );
356
+	return sanitize_text_field(strtolower(str_replace('-', '_', $string)));
357 357
 }
358 358
 
359 359
 
@@ -368,36 +368,36 @@  discard block
 block discarded – undo
368 368
  * @param unknown $postid int the id of the post object to check against
369 369
  * @since 0.9.9.7 added filter 'lasso_user_can_filter'
370 370
  */
371
-if ( !function_exists( 'lasso_user_can' ) ):
372
-	function lasso_user_can( $action = '', $postid = 0 ) {
371
+if (!function_exists('lasso_user_can')):
372
+	function lasso_user_can($action = '', $postid = 0) {
373 373
         $result = false;
374
-		if ( empty( $action ) )
374
+		if (empty($action))
375 375
 			$action = 'edit_posts';
376 376
 
377
-		if ( empty( $postid ) )
377
+		if (empty($postid))
378 378
 			$postid = get_the_ID();
379 379
 
380
-		if ( is_user_logged_in() && current_user_can( $action, $postid ) ) {
380
+		if (is_user_logged_in() && current_user_can($action, $postid)) {
381 381
 			// check against post types:
382
-			$allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') );
382
+			$allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page'));
383 383
 			
384 384
 			
385 385
 			
386 386
             if (!empty($allowed_post_types) && !empty($postid)) {
387
-				$type = get_post_type( $postid );
388
-                $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
387
+				$type = get_post_type($postid);
388
+                $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types);
389 389
 				
390
-                if ( in_array( $type, $allowed_post_types ) ) {
391
-				   $result =  true;
390
+                if (in_array($type, $allowed_post_types)) {
391
+				   $result = true;
392 392
 			    }
393 393
             } else {
394
-				$result =  true;
394
+				$result = true;
395 395
         	}
396 396
 		} else {
397 397
 			$result = false;
398 398
 		}
399 399
 		
400
-		return apply_filters( 'lasso_user_can_filter', $result,  $action, $postid);
400
+		return apply_filters('lasso_user_can_filter', $result, $action, $postid);
401 401
 	}
402 402
 endif;
403 403
 
@@ -406,25 +406,25 @@  discard block
 block discarded – undo
406 406
 *
407 407
 *	@since 0.9.5
408 408
 */
409
-if ( !function_exists('lasso_editor_empty_results') ):
409
+if (!function_exists('lasso_editor_empty_results')):
410 410
 
411
-	function lasso_editor_empty_results( $type = 'posts' ){
411
+	function lasso_editor_empty_results($type = 'posts') {
412 412
 
413
-		if ( 'posts' == $type ) {
413
+		if ('posts' == $type) {
414 414
 
415
-			$string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') );
415
+			$string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso'));
416 416
 			$icon = 'lasso-icon-file-text2';
417 417
 			$button = false;
418 418
 
419
-		} elseif ( 'revision' == $type ) {
419
+		} elseif ('revision' == $type) {
420 420
 
421
-			$string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') );
421
+			$string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso'));
422 422
 			$icon = 'lasso-icon-history';
423
-			$button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') );
423
+			$button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso'));
424 424
 
425 425
 		}
426 426
 
427
-		return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button );
427
+		return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button);
428 428
 	}
429 429
 
430 430
 endif;
Please login to merge, or discard this patch.