Completed
Push — master ( 81195c...f5de65 )
by
unknown
01:53
created
lasso.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 // If this file is called directly, abort.
21
-if ( ! defined( 'WPINC' ) ) {
21
+if (!defined('WPINC')) {
22 22
 	die;
23 23
 }
24 24
 
25 25
 // Set some constants
26
-define( 'LASSO_VERSION', '0.9.16.4' );
27
-define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) );
28
-define( 'LASSO_URL', plugins_url( '', __FILE__ ) );
29
-define( 'LASSO_FILE', __FILE__ );
26
+define('LASSO_VERSION', '0.9.16.4');
27
+define('LASSO_DIR', plugin_dir_path(__FILE__));
28
+define('LASSO_URL', plugins_url('', __FILE__));
29
+define('LASSO_FILE', __FILE__);
30 30
 
31 31
 /**
32 32
  * Load plugin if PHP version is 5.4 or later.
33 33
  */
34
-if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
34
+if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
35 35
 
36
-	include_once( LASSO_DIR . '/bootstrap.php' );
36
+	include_once(LASSO_DIR.'/bootstrap.php');
37 37
 
38 38
 } else {
39 39
 
40 40
 	add_action('admin_head', 'lasso_fail_notice');
41
-	function lasso_fail_notice(){
41
+	function lasso_fail_notice() {
42 42
 
43 43
 		printf('<div class="error"><p>Lasso requires PHP 5.4 or higher.</p></div>');
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2);
49
-function lasso_show_in_rest($args, $post_type){
49
+function lasso_show_in_rest($args, $post_type) {
50 50
  
51
-    $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) );
52
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types );
53
-	if (in_array( $post_type,$allowed_post_types)) {
51
+    $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array( ));
52
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types);
53
+	if (in_array($post_type, $allowed_post_types)) {
54 54
 		$args['show_in_rest'] = true;
55 55
 		if ($post_type != 'post' && $post_type != 'page') {
56 56
 			$args['rest_base'] = $post_type;
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 }
62 62
 
63 63
 
64
-function lasso_editor_get_option( $option, $section, $default = '' ) {
64
+function lasso_editor_get_option($option, $section, $default = '') {
65 65
 
66
-	if ( empty( $option ) )
66
+	if (empty($option))
67 67
 		return;
68 68
 
69
-	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
69
+	if (function_exists('is_multisite') && is_multisite()) {
70 70
 
71
-		$options = get_site_option( $section );
71
+		$options = get_site_option($section);
72 72
 
73 73
 	} else {
74 74
 
75
-		$options = get_option( $section );
75
+		$options = get_option($section);
76 76
 	}
77 77
 
78
-	if ( isset( $options[$option] ) ) {
78
+	if (isset($options[$option])) {
79 79
 		return $options[$option];
80 80
 	}
81 81
 
Please login to merge, or discard this patch.
public/includes/wrap-shortcodes.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 
7 7
 
8 8
  
9
-if ( lasso_user_can( 'edit_posts' ) && ! is_admin() ) {
10
-	add_filter( 'the_content', 'lasso_wrap_shortcodes', 9 );
9
+if (lasso_user_can('edit_posts') && !is_admin()) {
10
+	add_filter('the_content', 'lasso_wrap_shortcodes', 9);
11 11
 }
12 12
 
13 13
 /**
@@ -20,33 +20,33 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @return string
22 22
  */
23
-function lasso_wrap_shortcodes( $content ) {
23
+function lasso_wrap_shortcodes($content) {
24 24
 	global $shortcode_tags;
25 25
 
26
-	if ( false === strpos( $content, '[' ) ) {
26
+	if (false === strpos($content, '[')) {
27 27
 		return $content;
28 28
 	}
29 29
 
30
-	if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) {
30
+	if (empty($shortcode_tags) || !is_array($shortcode_tags)) {
31 31
 		return $content;
32 32
 	}
33 33
 
34
-	$tagnames  = array_keys( $shortcode_tags );
35
-	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
34
+	$tagnames  = array_keys($shortcode_tags);
35
+	$tagregexp = join('|', array_map('preg_quote', $tagnames));
36 36
 	$pattern   = "/\\[($tagregexp)/s";
37 37
 
38
-	if ( 0 === preg_match( $pattern, $content ) ) {
38
+	if (0 === preg_match($pattern, $content)) {
39 39
 		// Avoids parsing HTML when there are no shortcodes or embeds anyway.
40 40
 		return $content;
41 41
 	}
42 42
 
43
-	$content = do_shortcodes_in_html_tags( $content, true ,$tagnames);
43
+	$content = do_shortcodes_in_html_tags($content, true, $tagnames);
44 44
 
45 45
 	$pattern = get_shortcode_regex();
46
-	$content = preg_replace_callback( "/$pattern/s", 'lasso_wrap_shortcode_tag', $content );
46
+	$content = preg_replace_callback("/$pattern/s", 'lasso_wrap_shortcode_tag', $content);
47 47
 
48 48
 	// Always restore square braces so we don't break things like <!--[if IE ]>
49
-	$content = unescape_invalid_shortcodes( $content );
49
+	$content = unescape_invalid_shortcodes($content);
50 50
 
51 51
 	return $content;
52 52
 }
@@ -60,33 +60,33 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string
62 62
  */
63
-function lasso_wrap_shortcode_tag( $m ) {
63
+function lasso_wrap_shortcode_tag($m) {
64 64
 	// allow [[foo]] syntax for escaping a tag
65
-	if ( $m[1] == '[' && $m[6] == ']' ) {
66
-		return substr( $m[0], 1, - 1 );
65
+	if ($m[1] == '[' && $m[6] == ']') {
66
+		return substr($m[0], 1, - 1);
67 67
 	}
68
-	$exception_arr1 = array('aesop_gallery_pop','aesop_character_carousel');
69
-	$exception_arr2 = array('su_box', 'su_note', 'su_document', 'su_spoiler','av_textblock','av_toggle_container','av_toggle');
70
-	$exception_arr2 = apply_filters('lasso_wrap_shortcode_exceptions',$exception_arr2);
68
+	$exception_arr1 = array('aesop_gallery_pop', 'aesop_character_carousel');
69
+	$exception_arr2 = array('su_box', 'su_note', 'su_document', 'su_spoiler', 'av_textblock', 'av_toggle_container', 'av_toggle');
70
+	$exception_arr2 = apply_filters('lasso_wrap_shortcode_exceptions', $exception_arr2);
71 71
 
72
-	if ( strpos( $m[2],'aesop_'  ) === 0 ) {
72
+	if (strpos($m[2], 'aesop_') === 0) {
73 73
 		// check against the exceptions
74
-		if (strpos_arr($m[2],$exception_arr1)===false) {
74
+		if (strpos_arr($m[2], $exception_arr1) === false) {
75 75
 		    return $m[0];
76 76
 		}
77 77
 	}
78
-	if (strpos_arr($m[2],$exception_arr2)!==false) {
78
+	if (strpos_arr($m[2], $exception_arr2) !== false) {
79 79
 		return $m[0];
80 80
 	}
81 81
 
82
-	return '<!--EDITUS_OTHER_SHORTCODE_START|[' . $m[0] . ']-->' . $m[0] . '<!--EDITUS_OTHER_SHORTCODE_END-->';
82
+	return '<!--EDITUS_OTHER_SHORTCODE_START|['.$m[0].']-->'.$m[0].'<!--EDITUS_OTHER_SHORTCODE_END-->';
83 83
 }
84 84
 
85 85
 /* a helper function */
86 86
 function strpos_arr($haystack, $needle) {
87
-    if(!is_array($needle)) $needle = array($needle);
88
-    foreach($needle as $what) {
89
-        if(($pos = strpos($haystack, $what))!==false) return $pos;
87
+    if (!is_array($needle)) $needle = array($needle);
88
+    foreach ($needle as $what) {
89
+        if (($pos = strpos($haystack, $what)) !== false) return $pos;
90 90
     }
91 91
     return false;
92 92
 }
93 93
\ No newline at end of file
Please login to merge, or discard this patch.