Test Failed
Push — master ( 2b9f8e...a7a52d )
by Stéphane
09:12
created
shortcodes.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Prevent direct access to this file.
9
-if ( ! defined( 'ABSPATH' ) ) {
10
-	header( 'HTTP/1.0 403 Forbidden' );
9
+if ( ! defined('ABSPATH')) {
10
+	header('HTTP/1.0 403 Forbidden');
11 11
 	echo 'This file should not be accessed directly!';
12 12
 	exit; // Exit if accessed directly.
13 13
 }
14 14
 
15
-add_shortcode( 'mautic', 'wpmautic_shortcode' );
16
-add_shortcode( 'mauticcontent', 'wpmautic_dwc_shortcode' );
17
-add_shortcode( 'mauticvideo', 'wpmautic_video_shortcode' );
18
-add_shortcode( 'mauticform', 'wpmautic_form_shortcode' );
19
-add_shortcode( 'mautictags', 'wpmautic_tags_shortcode' );
20
-add_shortcode( 'mauticfocus', 'wpmautic_focus_shortcode' );
15
+add_shortcode('mautic', 'wpmautic_shortcode');
16
+add_shortcode('mauticcontent', 'wpmautic_dwc_shortcode');
17
+add_shortcode('mauticvideo', 'wpmautic_video_shortcode');
18
+add_shortcode('mauticform', 'wpmautic_form_shortcode');
19
+add_shortcode('mautictags', 'wpmautic_tags_shortcode');
20
+add_shortcode('mauticfocus', 'wpmautic_focus_shortcode');
21 21
 
22 22
 /**
23 23
  * Handle mautic shortcode. Must include a type attribute.
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return string
29 29
  */
30
-function wpmautic_shortcode( $atts, $content = null ) {
30
+function wpmautic_shortcode($atts, $content = null) {
31 31
 	$default = shortcode_atts(array(
32 32
 		'type' => null,
33 33
 	), $atts);
34 34
 
35
-	switch ( $default['type'] ) {
35
+	switch ($default['type']) {
36 36
 		case 'form':
37
-			return wpmautic_form_shortcode( $atts );
37
+			return wpmautic_form_shortcode($atts);
38 38
 		case 'content':
39
-			return wpmautic_dwc_shortcode( $atts, $content );
39
+			return wpmautic_dwc_shortcode($atts, $content);
40 40
 		case 'video':
41
-			return wpmautic_video_shortcode( $atts );
41
+			return wpmautic_video_shortcode($atts);
42 42
 		case 'tags':
43
-			return wpmautic_tags_shortcode( $atts );
43
+			return wpmautic_tags_shortcode($atts);
44 44
 		case 'focus':
45
-			return wpmautic_focus_shortcode( $atts );
45
+			return wpmautic_focus_shortcode($atts);
46 46
 	}
47 47
 
48 48
 	return false;
@@ -57,24 +57,24 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return string
59 59
  */
60
-function wpmautic_form_shortcode( $atts ) {
61
-	$base_url = wpmautic_option( 'base_url', '' );
62
-	if ( '' === $base_url ) {
60
+function wpmautic_form_shortcode($atts) {
61
+	$base_url = wpmautic_option('base_url', '');
62
+	if ('' === $base_url) {
63 63
 		return false;
64 64
 	}
65 65
 
66
-	$atts = shortcode_atts( array(
66
+	$atts = shortcode_atts(array(
67 67
 		'id' => '',
68
-	), $atts );
68
+	), $atts);
69 69
 
70
-	if ( empty( $atts['id'] ) ) {
70
+	if (empty($atts['id'])) {
71 71
 		return false;
72 72
 	}
73 73
 
74 74
 	return '<script type="text/javascript" ' . sprintf(
75 75
 		'src="%s/form/generate.js?id=%s"',
76
-		esc_url( $base_url ),
77
-		esc_attr( $atts['id'] )
76
+		esc_url($base_url),
77
+		esc_attr($atts['id'])
78 78
 	) . '></script>';
79 79
 }
80 80
 
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return string
90 90
  */
91
-function wpmautic_dwc_shortcode( $atts, $content = null ) {
92
-	$atts     = shortcode_atts( array(
91
+function wpmautic_dwc_shortcode($atts, $content = null) {
92
+	$atts = shortcode_atts(array(
93 93
 		'slot' => '',
94
-	), $atts, 'mautic' );
94
+	), $atts, 'mautic');
95 95
 
96 96
 	return sprintf(
97 97
 		'<div class="mautic-slot" data-slot-name="%s">%s</div>',
98
-		esc_attr( $atts['slot'] ),
99
-		esc_textarea( $content )
98
+		esc_attr($atts['slot']),
99
+		esc_textarea($content)
100 100
 	);
101 101
 }
102 102
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return string
111 111
  */
112
-function wpmautic_video_shortcode( $atts ) {
112
+function wpmautic_video_shortcode($atts) {
113 113
 	$video_type = '';
114 114
 	$atts = shortcode_atts(array(
115 115
 		'gate-time' => 15,
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
 		'height' => 360,
121 121
 	), $atts);
122 122
 
123
-	if ( empty( $atts['src'] ) ) {
123
+	if (empty($atts['src'])) {
124 124
 		return 'You must provide a video source. Add a src="URL" attribute to your shortcode. Replace URL with the source url for your video.';
125 125
 	}
126 126
 
127
-	if ( empty( $atts['form-id'] ) ) {
127
+	if (empty($atts['form-id'])) {
128 128
 		return 'You must provide a mautic form id. Add a form-id="#" attribute to your shortcode. Replace # with the id of the form you want to use.';
129 129
 	}
130 130
 
131
-	if ( preg_match( '/^.*((youtu.be)|(youtube.com))\/((v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))?\??v?=?([^#\&\?]*).*/', $atts['src'] ) ) {
131
+	if (preg_match('/^.*((youtu.be)|(youtube.com))\/((v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))?\??v?=?([^#\&\?]*).*/', $atts['src'])) {
132 132
 		$atts['video-type'] = 'youtube';
133 133
 	}
134
-	if ( preg_match( '/^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/', $atts['src'] ) ) {
134
+	if (preg_match('/^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/', $atts['src'])) {
135 135
 		$atts['video-type'] = 'vimeo';
136 136
 	}
137
-	if ( strtolower( substr( $atts['src'], -3 ) ) === 'mp4' ) {
137
+	if (strtolower(substr($atts['src'], -3)) === 'mp4') {
138 138
 		$atts['video-type'] = 'mp4';
139 139
 	}
140 140
 
141
-	if ( empty( $atts['video-type'] ) ) {
141
+	if (empty($atts['video-type'])) {
142 142
 		return 'Please define a valid video type with video-type="#".';
143 143
 	}
144 144
 
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 		'<video height="%s" width="%s" data-form-id="%s" data-gate-time="%s">' .
147 147
 			'<source type="video/%s" src="%s" />' .
148 148
 		'</video>',
149
-		esc_attr( $atts['height'] ),
150
-		esc_attr( $atts['width'] ),
151
-		esc_attr( $atts['form-id'] ),
152
-		esc_attr( $atts['gate-time'] ),
153
-		esc_attr( $atts['video-type'] ),
154
-		esc_attr( $atts['src'] )
149
+		esc_attr($atts['height']),
150
+		esc_attr($atts['width']),
151
+		esc_attr($atts['form-id']),
152
+		esc_attr($atts['gate-time']),
153
+		esc_attr($atts['video-type']),
154
+		esc_attr($atts['src'])
155 155
 	);
156 156
 }
157 157
 
@@ -164,24 +164,24 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @return string
166 166
  */
167
-function wpmautic_tags_shortcode( $atts ) {
168
-	$base_url = wpmautic_option( 'base_url', '' );
169
-	if ( '' === $base_url ) {
167
+function wpmautic_tags_shortcode($atts) {
168
+	$base_url = wpmautic_option('base_url', '');
169
+	if ('' === $base_url) {
170 170
 		return false;
171 171
 	}
172 172
 
173
-	$atts = shortcode_atts( array(
173
+	$atts = shortcode_atts(array(
174 174
 		'values' => '',
175
-	), $atts );
175
+	), $atts);
176 176
 
177
-	if ( empty( $atts['values'] ) ) {
177
+	if (empty($atts['values'])) {
178 178
 		return false;
179 179
 	}
180 180
 
181 181
 	return sprintf(
182 182
 		'<img src="%s/mtracking.gif?tags=%s" alt="Mautic Tags" />',
183
-		esc_url( $base_url ),
184
-		esc_attr( $atts['values'] )
183
+		esc_url($base_url),
184
+		esc_attr($atts['values'])
185 185
 	);
186 186
 }
187 187
 
@@ -193,23 +193,23 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string
195 195
  */
196
-function wpmautic_focus_shortcode( $atts ) {
197
-	$base_url = wpmautic_option( 'base_url', '' );
198
-	if ( '' === $base_url ) {
196
+function wpmautic_focus_shortcode($atts) {
197
+	$base_url = wpmautic_option('base_url', '');
198
+	if ('' === $base_url) {
199 199
 		return false;
200 200
 	}
201 201
 
202
-	$atts = shortcode_atts( array(
202
+	$atts = shortcode_atts(array(
203 203
 		'id' => '',
204
-	), $atts );
204
+	), $atts);
205 205
 
206
-	if ( empty( $atts['id'] ) ) {
206
+	if (empty($atts['id'])) {
207 207
 		return false;
208 208
 	}
209 209
 
210 210
 	return '<script type="text/javascript" ' . sprintf(
211 211
 		'src="%s/focus/%s.js"',
212
-		esc_url( $base_url ),
213
-		esc_attr( $atts['id'] )
212
+		esc_url($base_url),
213
+		esc_attr($atts['id'])
214 214
 	) . ' async="async"></script>';
215 215
 }
Please login to merge, or discard this patch.
wpmautic.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -13,31 +13,31 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Prevent direct access to this file.
16
-if ( ! defined( 'ABSPATH' ) ) {
17
-	header( 'HTTP/1.0 403 Forbidden' );
16
+if ( ! defined('ABSPATH')) {
17
+	header('HTTP/1.0 403 Forbidden');
18 18
 	echo 'This file should not be accessed directly!';
19 19
 	exit; // Exit if accessed directly.
20 20
 }
21 21
 
22 22
 // Store plugin directory.
23
-define( 'VPMAUTIC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
23
+define('VPMAUTIC_PLUGIN_DIR', plugin_dir_path(__FILE__));
24 24
 // Store plugin main file path.
25
-define( 'VPMAUTIC_PLUGIN_FILE', __FILE__ );
25
+define('VPMAUTIC_PLUGIN_FILE', __FILE__);
26 26
 
27
-add_action( 'admin_menu', 'wpmautic_settings' );
28
-add_action( 'plugins_loaded', 'wpmautic_injector' );
27
+add_action('admin_menu', 'wpmautic_settings');
28
+add_action('plugins_loaded', 'wpmautic_injector');
29 29
 
30
-include_once( VPMAUTIC_PLUGIN_DIR . '/shortcodes.php' );
30
+include_once(VPMAUTIC_PLUGIN_DIR . '/shortcodes.php');
31 31
 
32 32
 /**
33 33
  * Declare option page
34 34
  */
35 35
 function wpmautic_settings() {
36
-	include_once( VPMAUTIC_PLUGIN_DIR . '/options.php' );
36
+	include_once(VPMAUTIC_PLUGIN_DIR . '/options.php');
37 37
 
38 38
 	add_options_page(
39
-		__( 'WP Mautic Settings', 'wp-mautic' ),
40
-		__( 'WPMautic', 'wp-mautic' ),
39
+		__('WP Mautic Settings', 'wp-mautic'),
40
+		__('WPMautic', 'wp-mautic'),
41 41
 		'manage_options',
42 42
 		'wpmautic',
43 43
 		'wpmautic_options_page'
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return array
54 54
  */
55
-function wpmautic_plugin_actions( $links, $file ) {
56
-	if ( plugin_basename( VPMAUTIC_PLUGIN_FILE ) === $file && function_exists( 'admin_url' ) ) {
55
+function wpmautic_plugin_actions($links, $file) {
56
+	if (plugin_basename(VPMAUTIC_PLUGIN_FILE) === $file && function_exists('admin_url')) {
57 57
 		$settings_link = sprintf(
58 58
 			'<a href="%s">%s</a>',
59
-			admin_url( 'options-general.php?page=wpmautic' ),
60
-			__( 'Settings' )
59
+			admin_url('options-general.php?page=wpmautic'),
60
+			__('Settings')
61 61
 		);
62 62
 		// Add the settings link before other links.
63
-		array_unshift( $links, $settings_link );
63
+		array_unshift($links, $settings_link);
64 64
 	}
65 65
 	return $links;
66 66
 }
67
-add_filter( 'plugin_action_links', 'wpmautic_plugin_actions', 10, 2 );
67
+add_filter('plugin_action_links', 'wpmautic_plugin_actions', 10, 2);
68 68
 
69 69
 /**
70 70
  * Retrieve one of the wpmautic options but sanitized
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
  *
77 77
  * @throws InvalidArgumentException Thrown when the option name is not given.
78 78
  */
79
-function wpmautic_option( $option, $default = null ) {
80
-	$options = get_option( 'wpmautic_options' );
79
+function wpmautic_option($option, $default = null) {
80
+	$options = get_option('wpmautic_options');
81 81
 
82
-	switch ( $option ) {
82
+	switch ($option) {
83 83
 		case 'script_location':
84
-			return ! isset( $options[ $option ] ) ? 'header' : $options[ $option ];
84
+			return ! isset($options[$option]) ? 'header' : $options[$option];
85 85
 		case 'fallback_activated':
86
-			return isset( $options[ $option ] ) ? (bool) $options[ $option ] : true;
86
+			return isset($options[$option]) ? (bool) $options[$option] : true;
87 87
 		default:
88
-			if ( ! isset( $options[ $option ] ) ) {
89
-				if ( isset( $default ) ) {
88
+			if ( ! isset($options[$option])) {
89
+				if (isset($default)) {
90 90
 					return $default;
91 91
 				}
92 92
 
93
-				throw new InvalidArgumentException( 'You must give a valid option name !' );
93
+				throw new InvalidArgumentException('You must give a valid option name !');
94 94
 			}
95 95
 
96
-			return $options[ $option ];
96
+			return $options[$option];
97 97
 	}
98 98
 }
99 99
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
  * @return void
104 104
  */
105 105
 function wpmautic_injector() {
106
-	$script_location = wpmautic_option( 'script_location' );
107
-	if ( 'header' === $script_location ) {
108
-		add_action( 'wp_head', 'wpmautic_inject_script' );
106
+	$script_location = wpmautic_option('script_location');
107
+	if ('header' === $script_location) {
108
+		add_action('wp_head', 'wpmautic_inject_script');
109 109
 	} else {
110
-		add_action( 'wp_footer', 'wpmautic_inject_script' );
110
+		add_action('wp_footer', 'wpmautic_inject_script');
111 111
 	}
112 112
 
113
-	if ( true === wpmautic_option( 'fallback_activated', false ) ) {
114
-		add_action( 'wp_footer', 'wpmautic_inject_noscript' );
113
+	if (true === wpmautic_option('fallback_activated', false)) {
114
+		add_action('wp_footer', 'wpmautic_inject_noscript');
115 115
 	}
116 116
 }
117 117
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
  * @return void
122 122
  */
123 123
 function wpmautic_inject_script() {
124
-	$base_url = wpmautic_option( 'base_url', '' );
125
-	if ( empty( $base_url ) ) {
124
+	$base_url = wpmautic_option('base_url', '');
125
+	if (empty($base_url)) {
126 126
 		return;
127 127
 	}
128 128
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	(function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
131 131
 		w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
132 132
 		m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
133
-	})(window,document,'script','<?php echo esc_url( $base_url ); ?>/mtc.js','mt');
133
+	})(window,document,'script','<?php echo esc_url($base_url); ?>/mtc.js','mt');
134 134
 
135 135
 	mt('send', 'pageview');
136 136
 </script>
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
  * @return void
145 145
  */
146 146
 function wpmautic_inject_noscript() {
147
-	$base_url = wpmautic_option( 'base_url', '' );
148
-	if ( empty( $base_url ) ) {
147
+	$base_url = wpmautic_option('base_url', '');
148
+	if (empty($base_url)) {
149 149
 		return;
150 150
 	}
151 151
 
152 152
 	global $wp;
153 153
 
154 154
 	$url_query = wpmautic_get_url_query();
155
-	$payload = rawurlencode( base64_encode( serialize( $url_query ) ) );
155
+	$payload = rawurlencode(base64_encode(serialize($url_query)));
156 156
 	?>
157 157
 	<noscript>
158
-		<img src="<?php echo esc_url( $base_url ); ?>/mtracking.gif?d=<?php echo esc_attr( $payload ); ?>"  style="display:none;" alt="" />
158
+		<img src="<?php echo esc_url($base_url); ?>/mtracking.gif?d=<?php echo esc_attr($payload); ?>"  style="display:none;" alt="" />
159 159
 	</noscript>
160 160
 	<?php
161 161
 }
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
  */
168 168
 function wpmautic_get_url_query() {
169 169
 	global $wp;
170
-	$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );
170
+	$current_url = add_query_arg($wp->query_string, '', home_url($wp->request));
171 171
 
172 172
 	$attrs = array();
173 173
 	$attrs['page_url']   = $current_url;
174
-	$attrs['page_title'] = function_exists( 'wp_get_document_title' )
174
+	$attrs['page_title'] = function_exists('wp_get_document_title')
175 175
 		? wp_get_document_title()
176
-		: wp_title( '&raquo;', false );
176
+		: wp_title('&raquo;', false);
177 177
 	$attrs['language']   = get_locale();
178
-	$attrs['referrer']   = function_exists( 'wp_get_raw_referer' )
178
+	$attrs['referrer']   = function_exists('wp_get_raw_referer')
179 179
 		? wp_get_raw_referer()
180 180
 		: null;
181
-	if ( false === $attrs['referrer'] ) {
181
+	if (false === $attrs['referrer']) {
182 182
 		$attrs['referrer'] = $current_url;
183 183
 	}
184 184
 
Please login to merge, or discard this patch.
options.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Prevent direct access to this file.
9
-if ( ! defined( 'ABSPATH' ) ) {
10
-	header( 'HTTP/1.0 403 Forbidden' );
9
+if ( ! defined('ABSPATH')) {
10
+	header('HTTP/1.0 403 Forbidden');
11 11
 	echo 'This file should not be accessed directly!';
12 12
 	exit; // Exit if accessed directly.
13 13
 }
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 		<h2>WP Mautic</h2>
22 22
 		<p>Enable Base URL for Mautic Integration.</p>
23 23
 		<form action="options.php" method="post">
24
-			<?php settings_fields( 'wpmautic' ); ?>
25
-			<?php do_settings_sections( 'wpmautic' ); ?>
24
+			<?php settings_fields('wpmautic'); ?>
25
+			<?php do_settings_sections('wpmautic'); ?>
26 26
 			<?php submit_button(); ?>
27 27
 		</form>
28 28
 		<h3>Shortcode Examples:</h3>
@@ -56,38 +56,38 @@  discard block
 block discarded – undo
56 56
  * Define admin_init hook logic
57 57
  */
58 58
 function wpmautic_admin_init() {
59
-	register_setting( 'wpmautic', 'wpmautic_options', 'wpmautic_options_validate' );
59
+	register_setting('wpmautic', 'wpmautic_options', 'wpmautic_options_validate');
60 60
 
61 61
 	add_settings_section(
62 62
 		'wpmautic_main',
63
-		__( 'Main Settings', 'wp-mautic' ),
63
+		__('Main Settings', 'wp-mautic'),
64 64
 		'wpmautic_section_text',
65 65
 		'wpmautic'
66 66
 	);
67 67
 
68 68
 	add_settings_field(
69 69
 		'wpmautic_base_url',
70
-		__( 'Mautic Base URL', 'wp-mautic' ),
70
+		__('Mautic Base URL', 'wp-mautic'),
71 71
 		'wpmautic_base_url',
72 72
 		'wpmautic',
73 73
 		'wpmautic_main'
74 74
 	);
75 75
 	add_settings_field(
76 76
 		'wpmautic_script_location',
77
-		__( 'Tracking script location', 'wp-mautic' ),
77
+		__('Tracking script location', 'wp-mautic'),
78 78
 		'wpmautic_script_location',
79 79
 		'wpmautic',
80 80
 		'wpmautic_main'
81 81
 	);
82 82
 	add_settings_field(
83 83
 		'wpmautic_fallback_activated',
84
-		__( 'Fallback image', 'wp-mautic' ),
84
+		__('Fallback image', 'wp-mautic'),
85 85
 		'wpmautic_fallback_activated',
86 86
 		'wpmautic',
87 87
 		'wpmautic_main'
88 88
 	);
89 89
 }
90
-add_action( 'admin_init', 'wpmautic_admin_init' );
90
+add_action('admin_init', 'wpmautic_admin_init');
91 91
 
92 92
 /**
93 93
  * Section text
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  * Define the input field for Mautic base URL
100 100
  */
101 101
 function wpmautic_base_url() {
102
-	$url = wpmautic_option( 'base_url', '' );
102
+	$url = wpmautic_option('base_url', '');
103 103
 
104 104
 	?>
105 105
 	<input
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		size="40"
109 109
 		type="text"
110 110
 		placeholder="http://..."
111
-		value="<?php echo esc_url_raw( $url, array( 'http', 'https' ) ); ?>"
111
+		value="<?php echo esc_url_raw($url, array('http', 'https')); ?>"
112 112
 	/>
113 113
 	<?php
114 114
 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
  * Define the input field for Mautic script location
118 118
  */
119 119
 function wpmautic_script_location() {
120
-	$position = wpmautic_option( 'script_location', '' );
120
+	$position = wpmautic_option('script_location', '');
121 121
 
122 122
 	?>
123 123
 	<fieldset id="wpmautic_script_location">
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 				type="radio"
127 127
 				name="wpmautic_options[script_location]"
128 128
 				value="header"
129
-				<?php if ( 'footer' !== $position ) : ?>checked<?php endif; ?>
129
+				<?php if ('footer' !== $position) : ?>checked<?php endif; ?>
130 130
 			/>
131
-			<?php esc_html_e( 'Embedded within the `wp_head` hook', 'wp-mautic' ); ?>
131
+			<?php esc_html_e('Embedded within the `wp_head` hook', 'wp-mautic'); ?>
132 132
 		</label>
133 133
 		<br/>
134 134
 		<label>
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 				type="radio"
137 137
 				name="wpmautic_options[script_location]"
138 138
 				value="footer"
139
-				<?php if ( 'footer' === $position ) : ?>checked<?php endif; ?>
139
+				<?php if ('footer' === $position) : ?>checked<?php endif; ?>
140 140
 			/>
141
-			<?php esc_html_e( 'Embedded within the `wp_footer` hook', 'wp-mautic' ); ?>
141
+			<?php esc_html_e('Embedded within the `wp_footer` hook', 'wp-mautic'); ?>
142 142
 		</label>
143 143
 	</fieldset>
144 144
 	<?php
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
  * Define the input field for Mautic fallback flag
149 149
  */
150 150
 function wpmautic_fallback_activated() {
151
-	$flag = wpmautic_option( 'fallback_activated', false );
151
+	$flag = wpmautic_option('fallback_activated', false);
152 152
 
153 153
 	?>
154 154
 	<input
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 		name="wpmautic_options[fallback_activated]"
157 157
 		type="checkbox"
158 158
 		value="1"
159
-		<?php if ( true === $flag ) : ?>checked<?php endif; ?>
159
+		<?php if (true === $flag) : ?>checked<?php endif; ?>
160 160
 	/>
161 161
 	<label for="wpmautic_fallback_activated">
162
-		<?php esc_html_e( 'Activate it when JavaScript is disabled ?', 'wp-mautic' ); ?>
162
+		<?php esc_html_e('Activate it when JavaScript is disabled ?', 'wp-mautic'); ?>
163 163
 	</label>
164 164
 	<?php
165 165
 }
@@ -170,22 +170,22 @@  discard block
 block discarded – undo
170 170
  * @param  array $input Input data.
171 171
  * @return array
172 172
  */
173
-function wpmautic_options_validate( $input ) {
174
-	$options = get_option( 'wpmautic_options' );
173
+function wpmautic_options_validate($input) {
174
+	$options = get_option('wpmautic_options');
175 175
 
176
-	$input['base_url'] = isset( $input['base_url'] )
177
-		? trim( $input['base_url'], " \t\n\r\0\x0B/" )
176
+	$input['base_url'] = isset($input['base_url'])
177
+		? trim($input['base_url'], " \t\n\r\0\x0B/")
178 178
 		: '';
179 179
 
180
-	$options['base_url'] = esc_url_raw( trim( $input['base_url'], " \t\n\r\0\x0B/" ) );
181
-	$options['script_location'] = isset( $input['script_location'] )
182
-		? trim( $input['script_location'] )
180
+	$options['base_url'] = esc_url_raw(trim($input['base_url'], " \t\n\r\0\x0B/"));
181
+	$options['script_location'] = isset($input['script_location'])
182
+		? trim($input['script_location'])
183 183
 		: 'header';
184
-	if ( ! in_array( $options['script_location'], array( 'header', 'footer' ), true ) ) {
184
+	if ( ! in_array($options['script_location'], array('header', 'footer'), true)) {
185 185
 		$options['script_location'] = 'header';
186 186
 	}
187 187
 
188
-	$options['fallback_activated'] = isset( $input['fallback_activated'] ) && '1' === $input['fallback_activated']
188
+	$options['fallback_activated'] = isset($input['fallback_activated']) && '1' === $input['fallback_activated']
189 189
 		? true
190 190
 		: false;
191 191
 
Please login to merge, or discard this patch.