Completed
Push — master ( e64e68...8f4a49 )
by
unknown
01:52
created
public/includes/option-engine.php 1 patch
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">Editus</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.