Completed
Pull Request — master (#117)
by
unknown
03:39 queued 01:12
created
includes/sanatize.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 	 * @since 1.1.10
29 29
 	 *
30 30
 	 */
31
-	public static function do_sanitize( $input, $params = array() ) {
31
+	public static function do_sanitize($input, $params = array()) {
32 32
 
33
-		$input = stripslashes_deep( $input );
33
+		$input = stripslashes_deep($input);
34 34
 
35
-		if ( '' === $input || is_int( $input ) || is_float( $input ) || empty( $input ) ) {
35
+		if ('' === $input || is_int($input) || is_float($input) || empty($input)) {
36 36
 			return $input;
37 37
 		}
38 38
 
@@ -43,45 +43,45 @@  discard block
 block discarded – undo
43 43
 			'type' => null // %s %d %f etc
44 44
 		);
45 45
 
46
-		if ( !is_array( $params ) ) {
47
-			$defaults[ 'type' ] = $params;
46
+		if (!is_array($params)) {
47
+			$defaults['type'] = $params;
48 48
 
49 49
 			$params = $defaults;
50 50
 		}
51 51
 		else {
52
-			$params = array_merge( $defaults, (array) $params );
52
+			$params = array_merge($defaults, (array) $params);
53 53
 		}
54 54
 
55
-		if ( is_object( $input ) ) {
56
-			$input = get_object_vars( $input );
55
+		if (is_object($input)) {
56
+			$input = get_object_vars($input);
57 57
 
58 58
 			$n_params = $params;
59
-			$n_params[ 'nested' ] = true;
59
+			$n_params['nested'] = true;
60 60
 
61
-			foreach ( $input as $key => $val ) {
62
-				$output[ self::do_sanitize( $key ) ] = self::do_sanitize( $val, $n_params );
61
+			foreach ($input as $key => $val) {
62
+				$output[self::do_sanitize($key)] = self::do_sanitize($val, $n_params);
63 63
 			}
64 64
 
65 65
 			$output = (object) $output;
66 66
 		}
67
-		elseif ( is_array( $input ) ) {
67
+		elseif (is_array($input)) {
68 68
 			$n_params = $params;
69
-			$n_params[ 'nested' ] = true;
69
+			$n_params['nested'] = true;
70 70
 
71
-			foreach ( $input as $key => $val ) {
72
-				$output[ self::do_sanitize( $key ) ] = self::do_sanitize( $val, $n_params );
71
+			foreach ($input as $key => $val) {
72
+				$output[self::do_sanitize($key)] = self::do_sanitize($val, $n_params);
73 73
 			}
74 74
 		}
75
-		elseif ( !empty( $params[ 'type' ] ) && false !== strpos( $params[ 'type' ], '%' ) ) {
75
+		elseif (!empty($params['type']) && false !== strpos($params['type'], '%')) {
76 76
 			/**
77 77
 			 * @var $wpdb wpdb
78 78
 			 */
79 79
 			global $wpdb;
80 80
 
81
-			$output = $wpdb->prepare( $params[ 'type' ], $output );
81
+			$output = $wpdb->prepare($params['type'], $output);
82 82
 		}
83 83
 		else {
84
-			$output = wp_slash( $input );
84
+			$output = wp_slash($input);
85 85
 		}
86 86
 
87 87
 		return $output;
@@ -99,38 +99,38 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @see like_escape
101 101
 	 */
102
-	public static function sanitize_like( $input ) {
102
+	public static function sanitize_like($input) {
103 103
 
104
-		if ( '' === $input || is_int( $input ) || is_float( $input ) || empty( $input ) ) {
104
+		if ('' === $input || is_int($input) || is_float($input) || empty($input)) {
105 105
 			return $input;
106 106
 		}
107 107
 
108 108
 		$output = array();
109 109
 
110
-		if ( is_object( $input ) ) {
111
-			$input = get_object_vars( $input );
110
+		if (is_object($input)) {
111
+			$input = get_object_vars($input);
112 112
 
113
-			foreach ( $input as $key => $val ) {
114
-				$output[ $key ] = self::sanitize_like( $val );
113
+			foreach ($input as $key => $val) {
114
+				$output[$key] = self::sanitize_like($val);
115 115
 			}
116 116
 
117 117
 			$output = (object) $output;
118 118
 		}
119
-		elseif ( is_array( $input ) ) {
120
-			foreach ( $input as $key => $val ) {
121
-				$output[ $key ] = self::sanitize_like( $val );
119
+		elseif (is_array($input)) {
120
+			foreach ($input as $key => $val) {
121
+				$output[$key] = self::sanitize_like($val);
122 122
 			}
123 123
 		}
124 124
 		else {
125 125
 			global $wpdb;
126 126
 
127 127
 			//backwords-compat check for pre WP4.0
128
-			if ( method_exists( 'wpdb', 'esc_like' ) ) {
129
-				$output = $wpdb->esc_like( self::do_sanitize( $input ) );
128
+			if (method_exists('wpdb', 'esc_like')) {
129
+				$output = $wpdb->esc_like(self::do_sanitize($input));
130 130
 			}
131 131
 			else {
132 132
 				// like_escape is deprecated in WordPress 4.0
133
-				$output = like_escape( self::do_sanitize( $input ) );
133
+				$output = like_escape(self::do_sanitize($input));
134 134
 			}
135 135
 		}
136 136
 
@@ -150,33 +150,33 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @see wp_unslash
152 152
 	 */
153
-	public static function unslash( $input ) {
153
+	public static function unslash($input) {
154 154
 
155
-		if ( '' === $input || is_int( $input ) || is_float( $input ) || empty( $input ) ) {
155
+		if ('' === $input || is_int($input) || is_float($input) || empty($input)) {
156 156
 			return $input;
157 157
 		}
158 158
 
159 159
 		$output = array();
160 160
 
161
-		if ( empty( $input ) ) {
161
+		if (empty($input)) {
162 162
 			$output = $input;
163 163
 		}
164
-		elseif ( is_object( $input ) ) {
165
-			$input = get_object_vars( $input );
164
+		elseif (is_object($input)) {
165
+			$input = get_object_vars($input);
166 166
 
167
-			foreach ( $input as $key => $val ) {
168
-				$output[ $key ] = self::unslash( $val );
167
+			foreach ($input as $key => $val) {
168
+				$output[$key] = self::unslash($val);
169 169
 			}
170 170
 
171 171
 			$output = (object) $output;
172 172
 		}
173
-		elseif ( is_array( $input ) ) {
174
-			foreach ( $input as $key => $val ) {
175
-				$output[ $key ] = self::unslash( $val );
173
+		elseif (is_array($input)) {
174
+			foreach ($input as $key => $val) {
175
+				$output[$key] = self::unslash($val);
176 176
 			}
177 177
 		}
178 178
 		else {
179
-			$output = wp_unslash( $input );
179
+			$output = wp_unslash($input);
180 180
 
181 181
 		}
182 182
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@  discard block
 block discarded – undo
47 47
 			$defaults[ 'type' ] = $params;
48 48
 
49 49
 			$params = $defaults;
50
-		}
51
-		else {
50
+		} else {
52 51
 			$params = array_merge( $defaults, (array) $params );
53 52
 		}
54 53
 
@@ -63,24 +62,21 @@  discard block
 block discarded – undo
63 62
 			}
64 63
 
65 64
 			$output = (object) $output;
66
-		}
67
-		elseif ( is_array( $input ) ) {
65
+		} elseif ( is_array( $input ) ) {
68 66
 			$n_params = $params;
69 67
 			$n_params[ 'nested' ] = true;
70 68
 
71 69
 			foreach ( $input as $key => $val ) {
72 70
 				$output[ self::do_sanitize( $key ) ] = self::do_sanitize( $val, $n_params );
73 71
 			}
74
-		}
75
-		elseif ( !empty( $params[ 'type' ] ) && false !== strpos( $params[ 'type' ], '%' ) ) {
72
+		} elseif ( !empty( $params[ 'type' ] ) && false !== strpos( $params[ 'type' ], '%' ) ) {
76 73
 			/**
77 74
 			 * @var $wpdb wpdb
78 75
 			 */
79 76
 			global $wpdb;
80 77
 
81 78
 			$output = $wpdb->prepare( $params[ 'type' ], $output );
82
-		}
83
-		else {
79
+		} else {
84 80
 			$output = wp_slash( $input );
85 81
 		}
86 82
 
@@ -115,20 +111,17 @@  discard block
 block discarded – undo
115 111
 			}
116 112
 
117 113
 			$output = (object) $output;
118
-		}
119
-		elseif ( is_array( $input ) ) {
114
+		} elseif ( is_array( $input ) ) {
120 115
 			foreach ( $input as $key => $val ) {
121 116
 				$output[ $key ] = self::sanitize_like( $val );
122 117
 			}
123
-		}
124
-		else {
118
+		} else {
125 119
 			global $wpdb;
126 120
 
127 121
 			//backwords-compat check for pre WP4.0
128 122
 			if ( method_exists( 'wpdb', 'esc_like' ) ) {
129 123
 				$output = $wpdb->esc_like( self::do_sanitize( $input ) );
130
-			}
131
-			else {
124
+			} else {
132 125
 				// like_escape is deprecated in WordPress 4.0
133 126
 				$output = like_escape( self::do_sanitize( $input ) );
134 127
 			}
@@ -160,8 +153,7 @@  discard block
 block discarded – undo
160 153
 
161 154
 		if ( empty( $input ) ) {
162 155
 			$output = $input;
163
-		}
164
-		elseif ( is_object( $input ) ) {
156
+		} elseif ( is_object( $input ) ) {
165 157
 			$input = get_object_vars( $input );
166 158
 
167 159
 			foreach ( $input as $key => $val ) {
@@ -169,13 +161,11 @@  discard block
 block discarded – undo
169 161
 			}
170 162
 
171 163
 			$output = (object) $output;
172
-		}
173
-		elseif ( is_array( $input ) ) {
164
+		} elseif ( is_array( $input ) ) {
174 165
 			foreach ( $input as $key => $val ) {
175 166
 				$output[ $key ] = self::unslash( $val );
176 167
 			}
177
-		}
178
-		else {
168
+		} else {
179 169
 			$output = wp_unslash( $input );
180 170
 
181 171
 		}
Please login to merge, or discard this patch.
includes/save_gallery.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,56 +12,56 @@
 block discarded – undo
12 12
 	/**
13 13
 	 * Update an existing galleries options
14 14
 	 */
15
-	public static function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
15
+	public static function save_gallery_options($postid, $gallery_ids, $options, $type = false) {
16 16
 
17 17
 		// gallery width
18
-		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
18
+		$gallery_width = isset($options['width']) ? $options['width'] : false;
19 19
 
20 20
 		// gallery grid item width
21
-		$item_width = isset( $options['itemwidth'] ) ? $options['itemwidth'] : false;
21
+		$item_width = isset($options['itemwidth']) ? $options['itemwidth'] : false;
22 22
 
23 23
 		// caption
24
-		$caption = isset( $options['caption'] ) ? $options['caption'] : false;
24
+		$caption = isset($options['caption']) ? $options['caption'] : false;
25 25
 
26 26
 		// gallery transition
27
-		$transition = isset( $options['transition'] ) ? $options['transition'] : false;
27
+		$transition = isset($options['transition']) ? $options['transition'] : false;
28 28
 
29 29
 		// gallery transition speed
30
-		$transitionSpeed = isset( $options['speed'] ) ? $options['speed'] : false;
30
+		$transitionSpeed = isset($options['speed']) ? $options['speed'] : false;
31 31
 
32 32
 		// gallery hide thumbs
33
-		$hideThumbs = isset( $options['hideThumbs'] ) ? $options['hideThumbs'] : false;
33
+		$hideThumbs = isset($options['hideThumbs']) ? $options['hideThumbs'] : false;
34 34
 
35 35
 		// photoset layout
36
-		$psLayout = isset( $options['pslayout'] ) ? $options['pslayout'] : false;
36
+		$psLayout = isset($options['pslayout']) ? $options['pslayout'] : false;
37 37
 
38 38
 		// photoset layout
39
-		$psLightbox = isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
39
+		$psLightbox = isset($options['pslightbox']) ? $options['pslightbox'] : false;
40 40
 
41 41
 		// update gallery ids
42
-		if ( !empty( $gallery_ids ) ) {
42
+		if (!empty($gallery_ids)) {
43 43
 
44
-			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
44
+			update_post_meta($postid, '_ase_gallery_images', $gallery_ids);
45 45
 
46 46
 		}
47 47
 
48
-		update_post_meta( $postid, 'aesop_gallery_type', sanitize_text_field( trim( $type ) ) );
48
+		update_post_meta($postid, 'aesop_gallery_type', sanitize_text_field(trim($type)));
49 49
 
50
-		update_post_meta( $postid, 'aesop_gallery_width', sanitize_text_field( trim( $gallery_width ) ) );
50
+		update_post_meta($postid, 'aesop_gallery_width', sanitize_text_field(trim($gallery_width)));
51 51
 
52
-		update_post_meta( $postid, 'aesop_grid_gallery_width', sanitize_text_field( trim( $item_width ) ) );
52
+		update_post_meta($postid, 'aesop_grid_gallery_width', sanitize_text_field(trim($item_width)));
53 53
 
54
-		update_post_meta( $postid, 'aesop_gallery_caption', sanitize_text_field( trim( $caption ) ) );
54
+		update_post_meta($postid, 'aesop_gallery_caption', sanitize_text_field(trim($caption)));
55 55
 
56
-		update_post_meta( $postid, 'aesop_thumb_gallery_transition', sanitize_text_field( trim( $transition ) ) );
56
+		update_post_meta($postid, 'aesop_thumb_gallery_transition', sanitize_text_field(trim($transition)));
57 57
 
58
-		update_post_meta( $postid, 'aesop_thumb_gallery_transition_speed', absint( trim( $transitionSpeed ) ) );
58
+		update_post_meta($postid, 'aesop_thumb_gallery_transition_speed', absint(trim($transitionSpeed)));
59 59
 
60
-		update_post_meta( $postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field( trim( $hideThumbs ) ) );
60
+		update_post_meta($postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field(trim($hideThumbs)));
61 61
 
62
-		update_post_meta( $postid, 'aesop_photoset_gallery_layout', sanitize_text_field( trim( $psLayout ) ) );
62
+		update_post_meta($postid, 'aesop_photoset_gallery_layout', sanitize_text_field(trim($psLayout)));
63 63
 
64
-		update_post_meta( $postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field( trim( $psLightbox ) ) );
64
+		update_post_meta($postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field(trim($psLightbox)));
65 65
 
66 66
 	}
67 67
 
Please login to merge, or discard this patch.
internal-api/end_points.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 	 * Adds our API endpoint and hooks it in at template_redirect
19 19
 	 */
20 20
 	public function __construct() {
21
-		add_action( 'init', array( $this, 'add_endpoints' ) );
22
-		add_action( 'template_redirect', array( route::init(), 'do_api' ) );
21
+		add_action('init', array($this, 'add_endpoints'));
22
+		add_action('template_redirect', array(route::init(), 'do_api'));
23 23
 	}
24 24
 
25 25
 	/**
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function add_endpoints() {
31 31
 		//add "action" as a rewrite tag
32
-		add_rewrite_tag( '%action%', '^[a-z0-9_\-]+$' );
32
+		add_rewrite_tag('%action%', '^[a-z0-9_\-]+$');
33 33
 
34 34
 		//add the endpoint
35
-		add_rewrite_rule( 'lasso-internal-api/^[a-z0-9_\-]+$/?', 'index.php?action=$matches[1]', 'top' );
35
+		add_rewrite_rule('lasso-internal-api/^[a-z0-9_\-]+$/?', 'index.php?action=$matches[1]', 'top');
36 36
 
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
internal-api/find_data.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * @param object $callback_instance Callback class.
30 30
 	 * @param string $action The name of the action we are processing for.
31 31
 	 */
32
-	public function __construct( $callback_instance, $action ) {
33
-		if ( is_object( $callback_instance ) ) {
34
-			$this->get_data( $callback_instance, $action );
32
+	public function __construct($callback_instance, $action) {
33
+		if (is_object($callback_instance)) {
34
+			$this->get_data($callback_instance, $action);
35 35
 		}
36 36
 
37 37
 	}
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param object $callback_instance Callback class.
50 50
 	 * @param string $action The name of the action we are processing for.
51 51
 	 */
52
-	protected function get_data( $callback_instance, $action ) {
52
+	protected function get_data($callback_instance, $action) {
53 53
 		$data = array();
54
-		if ( is_array( $_POST ) ) {
54
+		if (is_array($_POST)) {
55 55
 			$params = $callback_instance::params();
56 56
 
57 57
 			/**
@@ -61,20 +61,20 @@  discard block
 block discarded – undo
61 61
 			 *
62 62
 			 * @param array $params Array of params in form of $params[ 'action_name' ][ 'POST_field' ] = 'callback_function_for_sanatizing' ]
63 63
 			 */
64
-			$params = apply_filters( 'lasso_api_params', $params );
65
-			if ( is_array( $params ) && isset( $params[ $action ] ) && is_array( $params[ $action ] ) ) {
66
-				$params = $params[ $action ];
67
-				foreach( $params as $key => $callback ) {
64
+			$params = apply_filters('lasso_api_params', $params);
65
+			if (is_array($params) && isset($params[$action]) && is_array($params[$action])) {
66
+				$params = $params[$action];
67
+				foreach ($params as $key => $callback) {
68 68
 					$_data = null;
69
-					if ( is_array( $callback ) ) {
70
-						foreach( $callback as $cb ) {
71
-							$_data = $this->sanitize( $key, $cb );
69
+					if (is_array($callback)) {
70
+						foreach ($callback as $cb) {
71
+							$_data = $this->sanitize($key, $cb);
72 72
 						}
73
-					}else{
74
-						$_data = $this->sanitize( $key, $callback );
73
+					} else {
74
+						$_data = $this->sanitize($key, $callback);
75 75
 					}
76 76
 
77
-					$data[ $key ] = $_data;
77
+					$data[$key] = $_data;
78 78
 
79 79
 				}
80 80
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return string|null Sanitized data or null.
100 100
 	 */
101
-	protected function sanitize( $key, $cb ) {
101
+	protected function sanitize($key, $cb) {
102 102
 		$_data = null;
103
-		if ( isset( $_POST[ $key ] ) ) {
104
-			if ( function_exists( $cb ) ) {
105
-				$_data = call_user_func( $cb, $_POST[ $key ] );
103
+		if (isset($_POST[$key])) {
104
+			if (function_exists($cb)) {
105
+				$_data = call_user_func($cb, $_POST[$key]);
106 106
 
107 107
 				return $_data;
108 108
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 						foreach( $callback as $cb ) {
71 71
 							$_data = $this->sanitize( $key, $cb );
72 72
 						}
73
-					}else{
73
+					} else{
74 74
 						$_data = $this->sanitize( $key, $callback );
75 75
 					}
76 76
 
Please login to merge, or discard this patch.
public/includes/helpers.php 4 patches
Braces   +27 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function lasso_editor_get_option( $option, $section, $default = '' ) {
16 16
 
17
-	if ( empty( $option ) )
18
-		return;
17
+	if ( empty( $option ) ) {
18
+			return;
19
+	}
19 20
 
20 21
 	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
21 22
 
@@ -42,11 +43,12 @@  discard block
 block discarded – undo
42 43
 
43 44
 	$q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) );
44 45
 
45
-	if ( $q->have_posts() )
46
-		return true;
47
-	else
48
-		return false;
49
-}
46
+	if ( $q->have_posts() ) {
47
+			return true;
48
+	} else {
49
+			return false;
50
+	}
51
+	}
50 52
 
51 53
 /**
52 54
  * Return a CSS class of an automatically supported theme
@@ -149,13 +151,15 @@  discard block
 block discarded – undo
149 151
 */
150 152
 function lasso_get_post_objects( $postid = '', $taxonomy = 'category') {
151 153
 
152
-	if ( empty( $postid ) )
153
-		$postid = get_the_ID();
154
+	if ( empty( $postid ) ) {
155
+			$postid = get_the_ID();
156
+	}
154 157
 
155 158
 	$objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid );
156 159
 
157
-	if ( empty( $objects) )
158
-		return;
160
+	if ( empty( $objects) ) {
161
+			return;
162
+	}
159 163
 
160 164
 	$out = '';
161 165
 	foreach( $objects as $object ) {
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
 
177 181
 	$objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0));
178 182
 
179
-	if ( empty( $objects) )
180
-		return;
183
+	if ( empty( $objects) ) {
184
+			return;
185
+	}
181 186
 
182 187
 	$out = array();
183 188
 	foreach( $objects as $object ) {
@@ -264,8 +269,9 @@  discard block
 block discarded – undo
264 269
 */
265 270
 function lasso_clean_string( $string = '' ) {
266 271
 
267
-	if ( empty( $string ) )
268
-		return;
272
+	if ( empty( $string ) ) {
273
+			return;
274
+	}
269 275
 
270 276
 	return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) );
271 277
 }
@@ -304,11 +310,13 @@  discard block
 block discarded – undo
304 310
 if ( !function_exists( 'lasso_user_can' ) ):
305 311
 	function lasso_user_can( $action = '', $postid = 0 ) {
306 312
 
307
-		if ( empty( $action ) )
308
-			$action = 'edit_posts';
313
+		if ( empty( $action ) ) {
314
+					$action = 'edit_posts';
315
+		}
309 316
 
310
-		if ( empty( $postid ) )
311
-			$postid = get_the_ID();
317
+		if ( empty( $postid ) ) {
318
+					$postid = get_the_ID();
319
+		}
312 320
 
313 321
 		if ( is_user_logged_in() && current_user_can( $action, $postid ) ) {
314 322
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
  * If we're on multsite we'll grab the site option which is stored in the main blogs site option tables, otherwise
7 7
  * we'll grab the option which is stored on the single blogs option tables
8 8
  *
9
- * @param unknown $option  string name of the option
10
- * @param unknown $section string name of the section
9
+ * @param string $option  string name of the option
10
+ * @param string $section string name of the section
11 11
  * @param unknown $default string/int default option value
12 12
  * @return the option value
13 13
  * @since 1.0
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 *	Used internally as a callback to build a tab or content area for modal addons
275 275
 *
276 276
 *	@param $tab object
277
-*	@param $type string tab or content
277
+*	@param string $type string tab or content
278 278
 *	@uses lasso_modal_addons()
279 279
 *	@since 0.9.4
280 280
 */
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		'public' => true,
246 246
 	), 'objects' );
247 247
 	$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
248
-    unset( $post_types[ 'attachment' ] );
248
+	unset( $post_types[ 'attachment' ] );
249 249
 
250 250
 	/**
251 251
 	 * Set which post types are allowed
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		'public' => true,
270 270
 	), 'names' );
271 271
 	//$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
272
-    unset( $post_types[ 'attachment' ] );
272
+	unset( $post_types[ 'attachment' ] );
273 273
 
274 274
 	/**
275 275
 	 * Set which post types are allowed
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
  */
372 372
 if ( !function_exists( 'lasso_user_can' ) ):
373 373
 	function lasso_user_can( $action = '', $postid = 0 ) {
374
-        $result = false;
374
+		$result = false;
375 375
 		if ( empty( $action ) )
376 376
 			$action = 'edit_posts';
377 377
 
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 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';
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 			break;
149 149
 	}
150 150
 
151
-	return apply_filters('lasso_title_class', !empty( $out ) ? $out : false);
151
+	return apply_filters('lasso_title_class', !empty($out) ? $out : false);
152 152
 }
153 153
 
154 154
 //since 0.9.9.6
155 155
 function lasso_get_supported_theme_featured_image_class() {
156 156
 
157 157
 	$name  	= wp_get_theme()->get('Name');
158
-	$slug  	= lasso_clean_string( $name );
158
+	$slug  	= lasso_clean_string($name);
159 159
 
160
-	return apply_filters('lasso_featured_image_class', !empty( $out ) ? $out : false);
160
+	return apply_filters('lasso_featured_image_class', !empty($out) ? $out : false);
161 161
 }
162 162
 
163 163
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 *	@since 0.8.7
169 169
 *	@return string of comma separated classes
170 170
 */
171
-function lasso_supported_no_save(){
171
+function lasso_supported_no_save() {
172 172
 
173 173
 	return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .twitter-tweet, .meta, .edit-link');
174 174
 }
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
  *
183 183
  * @return array|mixed|object|string|void
184 184
  */
185
-function lasso_sanitize_data( $data ) {
186
-	return \lasso\sanatize::do_sanitize( $data );
185
+function lasso_sanitize_data($data) {
186
+	return \lasso\sanatize::do_sanitize($data);
187 187
 
188 188
 }
189 189
 
@@ -193,18 +193,18 @@  discard block
 block discarded – undo
193 193
  *	@since 0.9.3
194 194
  *	@return string of comma delimited category slugs
195 195
 */
196
-function lasso_get_post_objects( $postid = '', $taxonomy = 'category') {
196
+function lasso_get_post_objects($postid = '', $taxonomy = 'category') {
197 197
 
198
-	if ( empty( $postid ) )
198
+	if (empty($postid))
199 199
 		$postid = get_the_ID();
200 200
 
201
-	$objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid );
201
+	$objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid);
202 202
 
203
-	if ( empty( $objects) )
203
+	if (empty($objects))
204 204
 		return;
205 205
 
206 206
 	$out = '';
207
-	foreach( $objects as $object ) {
207
+	foreach ($objects as $object) {
208 208
 		$out .= $object->slug.', ';
209 209
 	}
210 210
 
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
  *	@since 0.9.3
219 219
  *	@return array all categoiries
220 220
 */
221
-function lasso_get_objects( $taxonomy = 'category' ) {
221
+function lasso_get_objects($taxonomy = 'category') {
222 222
 
223 223
 	$objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0));
224 224
 
225
-	if ( empty( $objects) )
225
+	if (empty($objects))
226 226
 		return;
227 227
 
228 228
 	$out = array();
229
-	foreach( $objects as $object ) {
229
+	foreach ($objects as $object) {
230 230
 		$out[] = $object->slug;
231 231
 	}
232 232
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
  * @since 0.9.4
242 242
  */
243 243
 function lasso_post_types_names() {
244
-	$post_types = get_post_types( array(
244
+	$post_types = get_post_types(array(
245 245
 		'public' => true,
246
-	), 'objects' );
247
-	$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
248
-    unset( $post_types[ 'attachment' ] );
246
+	), 'objects');
247
+	$post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label'));
248
+    unset($post_types['attachment']);
249 249
 
250 250
 	/**
251 251
 	 * Set which post types are allowed
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered.
256 256
 	 */
257
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page') );
258
-	foreach( $post_types as $name => $label ) {
259
-		if ( ! in_array( $name, $allowed_post_types ) ) {
260
-			unset( $post_types[ $name ] );
257
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', array('post', 'page'));
258
+	foreach ($post_types as $name => $label) {
259
+		if (!in_array($name, $allowed_post_types)) {
260
+			unset($post_types[$name]);
261 261
 		}
262 262
 	}
263 263
 	return $post_types;
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 
266 266
 
267 267
 function lasso_post_types() {
268
-	$post_types = get_post_types( array(
268
+	$post_types = get_post_types(array(
269 269
 		'public' => true,
270
-	), 'names' );
270
+	), 'names');
271 271
 	//$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
272
-    unset( $post_types[ 'attachment' ] );
272
+    unset($post_types['attachment']);
273 273
 
274 274
 	/**
275 275
 	 * Set which post types are allowed
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered.
280 280
 	 */
281
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page') );
282
-	foreach( $post_types as $name => $label ) {
283
-		if ( ! in_array( $name, $allowed_post_types ) ) {
284
-			unset( $post_types[ $name ] );
281
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', array('post', 'page'));
282
+	foreach ($post_types as $name => $label) {
283
+		if (!in_array($name, $allowed_post_types)) {
284
+			unset($post_types[$name]);
285 285
 		}
286 286
 	}
287 287
 	return $post_types;
@@ -300,22 +300,22 @@  discard block
 block discarded – undo
300 300
 *	@uses lasso_modal_addons()
301 301
 *	@since 0.9.4
302 302
 */
303
-function lasso_modal_addons_content( $tab = '', $type ){
303
+function lasso_modal_addons_content($tab = '', $type) {
304 304
 
305
-	$name = lasso_clean_string( $tab['name'] );
305
+	$name = lasso_clean_string($tab['name']);
306 306
 
307
-	if ( 'tab' == $type ) {
307
+	if ('tab' == $type) {
308 308
 
309
-		$out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] );
309
+		$out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']);
310 310
 
311
-	} else if ( 'content' == $type ){
311
+	} else if ('content' == $type) {
312 312
 
313
-		$content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false;
314
-		$options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false;
313
+		$content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false;
314
+		$options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false;
315 315
 
316
-		$out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s">
316
+		$out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s">
317 317
 			%s%s
318
-			</div>', $name, $content, lasso_option_form( $name, $options ) );
318
+			</div>', $name, $content, lasso_option_form($name, $options));
319 319
 
320 320
 	}
321 321
 
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 *
331 331
 * @return void|string
332 332
 */
333
-function lasso_clean_string( $string = '' ) {
333
+function lasso_clean_string($string = '') {
334 334
 
335
-	if ( empty( $string ) )
335
+	if (empty($string))
336 336
 		return;
337 337
 
338
-	return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) );
338
+	return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string)));
339 339
 }
340 340
 
341 341
 /**
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
  *
349 349
  * @return void|string
350 350
  */
351
-function lasso_unclean_string( $string = '' ) {
351
+function lasso_unclean_string($string = '') {
352 352
 
353
-	if ( empty( $string ) ) {
353
+	if (empty($string)) {
354 354
 		return;
355 355
 	}
356 356
 
357
-	return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) );
357
+	return sanitize_text_field(strtolower(str_replace('-', '_', $string)));
358 358
 }
359 359
 
360 360
 
@@ -369,22 +369,22 @@  discard block
 block discarded – undo
369 369
  * @param unknown $postid int the id of the post object to check against
370 370
  * @since 0.9.9.7 added filter 'lasso_user_can_filter'
371 371
  */
372
-if ( !function_exists( 'lasso_user_can' ) ):
373
-	function lasso_user_can( $action = '', $postid = 0 ) {
372
+if (!function_exists('lasso_user_can')):
373
+	function lasso_user_can($action = '', $postid = 0) {
374 374
         $result = false;
375
-		if ( empty( $action ) )
375
+		if (empty($action))
376 376
 			$action = 'edit_posts';
377 377
 
378
-		if ( empty( $postid ) )
378
+		if (empty($postid))
379 379
 			$postid = get_the_ID();
380 380
 
381
-		if ( is_user_logged_in() && current_user_can( $action, $postid ) ) {
382
-			$result =  true;
381
+		if (is_user_logged_in() && current_user_can($action, $postid)) {
382
+			$result = true;
383 383
 		} else {
384 384
 			$result = false;
385 385
 		}
386 386
 		
387
-		return apply_filters( 'lasso_user_can_filter', $result,  $action, $postid);
387
+		return apply_filters('lasso_user_can_filter', $result, $action, $postid);
388 388
 	}
389 389
 endif;
390 390
 
@@ -393,25 +393,25 @@  discard block
 block discarded – undo
393 393
 *
394 394
 *	@since 0.9.5
395 395
 */
396
-if ( !function_exists('lasso_editor_empty_results') ):
396
+if (!function_exists('lasso_editor_empty_results')):
397 397
 
398
-	function lasso_editor_empty_results( $type = 'posts' ){
398
+	function lasso_editor_empty_results($type = 'posts') {
399 399
 
400
-		if ( 'posts' == $type ) {
400
+		if ('posts' == $type) {
401 401
 
402
-			$string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') );
402
+			$string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso'));
403 403
 			$icon = 'lasso-icon-file-text2';
404 404
 			$button = false;
405 405
 
406
-		} elseif ( 'revision' == $type ) {
406
+		} elseif ('revision' == $type) {
407 407
 
408
-			$string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') );
408
+			$string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso'));
409 409
 			$icon = 'lasso-icon-history';
410
-			$button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') );
410
+			$button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso'));
411 411
 
412 412
 		}
413 413
 
414
-		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 );
414
+		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);
415 415
 	}
416 416
 
417 417
 endif;
Please login to merge, or discard this patch.
public/includes/option-engine.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 *	Get an array of addon data for the settings modal
44 44
 *	@since 0.9.4
45 45
 */
46
-function lasso_get_modal_tabs(){
46
+function lasso_get_modal_tabs() {
47 47
 
48 48
 	$tabs = array();
49 49
 
@@ -60,36 +60,36 @@  discard block
 block discarded – undo
60 60
 *	@uses lasso_modal_addons_content()
61 61
 *	@since 0.9.4
62 62
 */
63
-function lasso_modal_addons( $type = 'tab' ){
63
+function lasso_modal_addons($type = 'tab') {
64 64
 
65 65
 	$tabs = lasso_get_modal_tabs();
66 66
 	$out = '';
67 67
 
68
-	if ( $tabs ):
68
+	if ($tabs):
69 69
 
70
-		if ( 'tab' == $type ) {
70
+		if ('tab' == $type) {
71 71
 
72 72
 			$out = '<ul class="lasso--modal__tabs">';
73 73
 
74 74
 				$out .= '<li class="active-tab" data-addon-name="core">Lasso</li>';
75 75
 
76
-				foreach ( $tabs as $tab ) {
76
+				foreach ($tabs as $tab) {
77 77
 
78
-					if ( isset( $tab ) ) {
78
+					if (isset($tab)) {
79 79
 
80
-						$out .= lasso_modal_addons_content( $tab, $type );
80
+						$out .= lasso_modal_addons_content($tab, $type);
81 81
 					}
82 82
 				}
83 83
 
84 84
 			$out .= '</ul>';
85 85
 
86
-		} elseif ( 'content' == $type ) {
86
+		} elseif ('content' == $type) {
87 87
 
88 88
 
89
-			foreach ( $tabs as $tab ) {
89
+			foreach ($tabs as $tab) {
90 90
 
91
-				if ( isset( $tab ) ) {
92
-					$out .= lasso_modal_addons_content( $tab , $type );
91
+				if (isset($tab)) {
92
+					$out .= lasso_modal_addons_content($tab, $type);
93 93
 				}
94 94
 			}
95 95
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 	endif;
99 99
 
100
-	return !empty( $out ) ? $out : false;
100
+	return !empty($out) ? $out : false;
101 101
 }
102 102
 
103 103
 /**
@@ -117,26 +117,26 @@  discard block
 block discarded – undo
117 117
 *	@since 0.9.5
118 118
 *	@subpackage lasso_modal_addons_content
119 119
 */
120
-function lasso_option_form( $name = '', $options = array() ){
120
+function lasso_option_form($name = '', $options = array()) {
121 121
 
122 122
 	ob_start();
123 123
 
124
-	if ( empty( $name ) || empty( $options ) || !is_array( $options ) )
124
+	if (empty($name) || empty($options) || !is_array($options))
125 125
 		return;
126 126
 
127 127
 	$nonce = wp_create_nonce('lasso-process-post-meta');
128
-	$key   = sprintf('_lasso_%s_settings', $name );
128
+	$key   = sprintf('_lasso_%s_settings', $name);
129 129
 
130
-	$out = sprintf('<form id="lasso--post-form" class="lasso--post-form">' );
130
+	$out = sprintf('<form id="lasso--post-form" class="lasso--post-form">');
131 131
 
132
-		$out .= lasso_option_fields( $name, $options );
133
-		$out .='<div class="form--bottom">';
134
-			$out .='<input type="submit" value="Save">';
135
-			$out .='<input type="hidden" name="tab_name" value="'.$key.'">';
136
-			$out .='<input type="hidden" name="post_id" value="'.get_the_ID().'">';
137
-			$out .='<input type="hidden" name="nonce" value="'.$nonce.'">';
138
-			$out .='<input type="hidden" name="action" value="process_meta_update">';
139
-		$out .='</div>';
132
+		$out .= lasso_option_fields($name, $options);
133
+		$out .= '<div class="form--bottom">';
134
+			$out .= '<input type="submit" value="Save">';
135
+			$out .= '<input type="hidden" name="tab_name" value="'.$key.'">';
136
+			$out .= '<input type="hidden" name="post_id" value="'.get_the_ID().'">';
137
+			$out .= '<input type="hidden" name="nonce" value="'.$nonce.'">';
138
+			$out .= '<input type="hidden" name="action" value="process_meta_update">';
139
+		$out .= '</div>';
140 140
 
141 141
 	$out .= '</form>';
142 142
 
@@ -154,28 +154,28 @@  discard block
 block discarded – undo
154 154
 *	@since 0.9.5
155 155
 *	@subpackage lasso_modal_addons_content
156 156
 */
157
-function lasso_option_fields( $name = '', $options = array() ){
157
+function lasso_option_fields($name = '', $options = array()) {
158 158
 
159
-	$out 	= '';
159
+	$out = '';
160 160
 	$before = '<div class="lasso--postsettings__option">';
161 161
 	$after 	= '</div>';
162 162
 
163
-	if ( empty( $name ) || empty( $options ) )
163
+	if (empty($name) || empty($options))
164 164
 		return;
165 165
 
166
-	foreach ( (array) $options as $option ) {
166
+	foreach ((array) $options as $option) {
167 167
 
168
-		$type = isset( $option['type'] ) ? $option['type'] : 'text';
168
+		$type = isset($option['type']) ? $option['type'] : 'text';
169 169
 
170
-		switch ( $type ) {
170
+		switch ($type) {
171 171
 			case 'text':
172
-				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'text' ), $after );
172
+				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'text'), $after);
173 173
 				break;
174 174
 			case 'textarea':
175
-				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'textarea' ), $after );
175
+				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'textarea'), $after);
176 176
 				break;
177 177
 			case 'checkbox':
178
-				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'checkbox' ), $after );
178
+				$out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'checkbox'), $after);
179 179
 				break;
180 180
 		}
181 181
 
@@ -193,27 +193,27 @@  discard block
 block discarded – undo
193 193
 *	@param $type string text, textarea, checkbox, color
194 194
 *	@since 5.0
195 195
 */
196
-function lasso_option_engine_option( $name = '', $option = '', $type = '') {
196
+function lasso_option_engine_option($name = '', $option = '', $type = '') {
197 197
 
198
-	if ( empty( $type ) || empty( $option ) )
198
+	if (empty($type) || empty($option))
199 199
 		return;
200 200
 
201
-	$id = isset( $option['id'] ) ? $option['id'] : false;
202
-	$id = $id ? lasso_clean_string( $id ) : false;
201
+	$id = isset($option['id']) ? $option['id'] : false;
202
+	$id = $id ? lasso_clean_string($id) : false;
203 203
 
204
-	$desc = isset( $option['desc'] ) ? $option['desc'] : false;
204
+	$desc = isset($option['desc']) ? $option['desc'] : false;
205 205
 
206
-	$value = get_post_meta( get_the_id(), $option[ 'id' ], true );
206
+	$value = get_post_meta(get_the_id(), $option['id'], true);
207 207
 
208
-	switch ( $type ) {
208
+	switch ($type) {
209 209
 		case 'text':
210
-			$out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" name="%s" type="text" value="%s">',$id, esc_html( $desc ), $id, $id, $value );
210
+			$out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" name="%s" type="text" value="%s">', $id, esc_html($desc), $id, $id, $value);
211 211
 			break;
212 212
 		case 'textarea':
213
-			$out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>',$id, esc_html( $desc ), $id, $id, $value );
213
+			$out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>', $id, esc_html($desc), $id, $id, $value);
214 214
 			break;
215 215
 		case 'checkbox':
216
-			$out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s',$id, $id, $id ,esc_html( $desc ) );
216
+			$out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s', $id, $id, $id, esc_html($desc));
217 217
 			break;
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -121,8 +121,9 @@  discard block
 block discarded – undo
121 121
 
122 122
 	ob_start();
123 123
 
124
-	if ( empty( $name ) || empty( $options ) || !is_array( $options ) )
125
-		return;
124
+	if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) {
125
+			return;
126
+	}
126 127
 
127 128
 	$nonce = wp_create_nonce('lasso-process-post-meta');
128 129
 	$key   = sprintf('_lasso_%s_settings', $name );
@@ -160,8 +161,9 @@  discard block
 block discarded – undo
160 161
 	$before = '<div class="lasso--postsettings__option">';
161 162
 	$after 	= '</div>';
162 163
 
163
-	if ( empty( $name ) || empty( $options ) )
164
-		return;
164
+	if ( empty( $name ) || empty( $options ) ) {
165
+			return;
166
+	}
165 167
 
166 168
 	foreach ( (array) $options as $option ) {
167 169
 
@@ -195,8 +197,9 @@  discard block
 block discarded – undo
195 197
 */
196 198
 function lasso_option_engine_option( $name = '', $option = '', $type = '') {
197 199
 
198
-	if ( empty( $type ) || empty( $option ) )
199
-		return;
200
+	if ( empty( $type ) || empty( $option ) ) {
201
+			return;
202
+	}
200 203
 
201 204
 	$id = isset( $option['id'] ) ? $option['id'] : false;
202 205
 	$id = $id ? lasso_clean_string( $id ) : false;
Please login to merge, or discard this patch.
public/includes/register_meta_field.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@
 block discarded – undo
15 15
 	 *
16 16
 	 * @param array $fields
17 17
 	 */
18
-	public function __construct( $fields ) {
18
+	public function __construct($fields) {
19 19
 		$this->fields = $fields;
20
-		add_filter( 'lasso_api_params', function( $params ) {
21
-			foreach( $this->fields as $field => $cbs ) {
22
-				$field = lasso_clean_string( $field );
23
-				$params[ 'process_meta_update' ][ $field ] = $cbs;
20
+		add_filter('lasso_api_params', function($params) {
21
+			foreach ($this->fields as $field => $cbs) {
22
+				$field = lasso_clean_string($field);
23
+				$params['process_meta_update'][$field] = $cbs;
24 24
 			}
25 25
 
26 26
 			return $params;
27 27
 
28 28
 		});
29 29
 
30
-		add_filter( 'lasso_meta_fields', function( $allowed ) {
30
+		add_filter('lasso_meta_fields', function($allowed) {
31 31
 
32
-			foreach( array_keys( $this->fields ) as $field  ) {
33
-				$field = lasso_clean_string( $field );
32
+			foreach (array_keys($this->fields) as $field) {
33
+				$field = lasso_clean_string($field);
34 34
 				$allowed[] = $field;
35 35
 
36 36
 			}
Please login to merge, or discard this patch.
public/includes/tour.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 	}
17 17
 
18 18
 	/**
19
-	*	Draw the modal used to house the walk through
20
-	*	@since 0.6
21
-	*/
19
+	 *	Draw the modal used to house the walk through
20
+	 *	@since 0.6
21
+	 */
22 22
 	public function draw_tour() {
23 23
 
24 24
 		$tour_hidden = get_user_meta( get_current_user_ID(), 'lasso_hide_tour', true );
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	}
77 77
 
78 78
 	/**
79
-	*	Draw the inner slides for the welcome walkthrough
80
-	*	@since 0.6
81
-	*/
79
+	 *	Draw the inner slides for the welcome walkthrough
80
+	 *	@since 0.6
81
+	 */
82 82
 	public function tour_slides() { ?>
83 83
 
84 84
 		<div id="lasso--loading" class="lasso--loading"><div class="lasso--loader"></div></div>
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 	public function __construct() {
13 13
 
14
-		add_action( 'wp_footer',       array( $this, 'draw_tour' ) );
14
+		add_action('wp_footer', array($this, 'draw_tour'));
15 15
 
16 16
 	}
17 17
 
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
 	*/
22 22
 	public function draw_tour() {
23 23
 
24
-		$tour_hidden = get_user_meta( get_current_user_ID(), 'lasso_hide_tour', true );
24
+		$tour_hidden = get_user_meta(get_current_user_ID(), 'lasso_hide_tour', true);
25 25
 
26
-		if ( lasso_user_can() && !$tour_hidden ) {
26
+		if (lasso_user_can() && !$tour_hidden) {
27 27
 
28 28
 			global $post;
29 29
 
30
-			$nonce = wp_create_nonce( 'lasso-editor-tour' );
30
+			$nonce = wp_create_nonce('lasso-editor-tour');
31 31
 
32 32
 			// let users add custom css classes
33
-			$custom_classes = apply_filters( 'lasso_modal_tour_classes', '' );
33
+			$custom_classes = apply_filters('lasso_modal_tour_classes', '');
34 34
 
35 35
 			?>
36
-			<div id="lasso--tour__modal" class="lasso--modal lasso--tour__modal lasso--modal__checkbox <?php echo sanitize_html_class( $custom_classes );?>">
36
+			<div id="lasso--tour__modal" class="lasso--modal lasso--tour__modal lasso--modal__checkbox <?php echo sanitize_html_class($custom_classes); ?>">
37 37
 				<script>
38 38
 					jQuery(window).ready(function($){
39 39
 
@@ -51,19 +51,19 @@  discard block
 block discarded – undo
51 51
 				</script>
52 52
 				<div class="lasso--modal__inner">
53 53
 
54
-					<?php echo self::tour_slides();?>
54
+					<?php echo self::tour_slides(); ?>
55 55
 
56 56
 					<div class="lasso--postsettings__footer">
57 57
 
58 58
 						<div class="lasso--postsettings__option">
59 59
 							<label for="hide_tour" class="checkbox-control checkbox">
60
-					        	<input type="checkbox" id="hide_tour" name="hide_tour" <?php checked( $tour_hidden, 1 ); ?>>
60
+					        	<input type="checkbox" id="hide_tour" name="hide_tour" <?php checked($tour_hidden, 1); ?>>
61 61
 					        	<span class="control-indicator"></span>
62
-								<?php _e('Don\'t show this again','lasso');?>
62
+								<?php _e('Don\'t show this again', 'lasso'); ?>
63 63
 					        </label>
64 64
 						</div>
65 65
 
66
-						<input type="submit" value="<?php _e( 'Okay, got it!', 'lasso' );?>" data-nonce="<?php echo $nonce;?>" >
66
+						<input type="submit" value="<?php _e('Okay, got it!', 'lasso'); ?>" data-nonce="<?php echo $nonce; ?>" >
67 67
 					</div>
68 68
 
69 69
 				</div>
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
 			<?php
88 88
 
89 89
 			$out = '<ul><li>';
90
-			$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-1.jpg' );
91
-			$out .= '<p>'.__('Access posts by clicking the list icon. Create a new post by clicking the new post icon.','lasso').'</p>';
90
+			$out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-1.jpg');
91
+			$out .= '<p>'.__('Access posts by clicking the list icon. Create a new post by clicking the new post icon.', 'lasso').'</p>';
92 92
 			$out .= '</li><li>';
93
-			$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-2.jpg' );
94
-			$out .= '<p>'.__('While on a single post, edit by clicking the Pen icon. Access post settings with the settings icon. Press escape to exit any modal.','lasso').'</p>';
93
+			$out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-2.jpg');
94
+			$out .= '<p>'.__('While on a single post, edit by clicking the Pen icon. Access post settings with the settings icon. Press escape to exit any modal.', 'lasso').'</p>';
95 95
 			$out .= '</li><li>';
96
-			$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-3.jpg' );
97
-			$out .= '<p>'.__('Highlight a piece of text, and click on a formatting option to style it. Click the Disk icon or CMD-S to save. Click the orange "X" button to exit the editor.','lasso').'</p>';
96
+			$out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-3.jpg');
97
+			$out .= '<p>'.__('Highlight a piece of text, and click on a formatting option to style it. Click the Disk icon or CMD-S to save. Click the orange "X" button to exit the editor.', 'lasso').'</p>';
98 98
 			$out .= '</li><li>';
99
-			$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-4.jpg' );
100
-			$out .= '<p>'.__('Story components can be added by clicking the plus icon, and dragging any component from the component tray into the story.','lasso').'</p>';
99
+			$out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-4.jpg');
100
+			$out .= '<p>'.__('Story components can be added by clicking the plus icon, and dragging any component from the component tray into the story.', 'lasso').'</p>';
101 101
 			$out .= '</li></ul>';
102 102
 
103
-			echo apply_filters( 'lasso_tour_slides', $out );
103
+			echo apply_filters('lasso_tour_slides', $out);
104 104
 
105 105
 		?></div><?php
106 106
 
Please login to merge, or discard this patch.
public/includes/underscore-templates.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( !function_exists( 'lasso_backbone_templates' ) ):
3
+if (!function_exists('lasso_backbone_templates')):
4 4
 
5 5
 	add_action('wp_footer', 'lasso_backbone_templates');
6
-	function lasso_backbone_templates(){
6
+	function lasso_backbone_templates() {
7 7
 
8 8
 		$can_delete = lasso_user_can('delete_others_posts');
9 9
 		$can_delete_class = $can_delete ? false : 'no-delete';
10 10
 
11 11
 		// only run on posts and pages if user is logged in
12
-		if ( is_user_logged_in() && lasso_user_can('edit_posts') ) { ?>
12
+		if (is_user_logged_in() && lasso_user_can('edit_posts')) { ?>
13 13
 			<script type="text/html" id="lasso-tmpl--post">
14 14
 				<li>
15
-					<a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class;?> <%= post.status %>" data-postid="<%= post.ID %>" >
15
+					<a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class; ?> <%= post.status %>" data-postid="<%= post.ID %>" >
16 16
 						<%= post.title %>
17 17
 
18 18
 						<div class="lasso--post-list__controls">
19
-							<span title="<?php echo esc_attr_e('Edit Post','lasso');?>" id="lasso--post__edit"></span>
20
-							<?php if( $can_delete ): ?>
21
-							<span title="<?php echo esc_attr_e('Delete Post','lasso');?>" id="lasso--post__delete"></span>
19
+							<span title="<?php echo esc_attr_e('Edit Post', 'lasso'); ?>" id="lasso--post__edit"></span>
20
+							<?php if ($can_delete): ?>
21
+							<span title="<?php echo esc_attr_e('Delete Post', 'lasso'); ?>" id="lasso--post__delete"></span>
22 22
 							<?php endif; ?>
23 23
 						</div>
24 24
 					</a>
Please login to merge, or discard this patch.