Code Duplication    Length = 20-21 lines in 3 locations

shortcodes.php 3 locations

@@ 64-83 (lines=20) @@
61
 *
62
 * @return string
63
 */
64
function wpmautic_form_shortcode( $atts ) {
65
	$base_url = wpmautic_option( 'base_url', '' );
66
	if ( '' === $base_url ) {
67
		return false;
68
	}
69
70
	$atts = shortcode_atts(
71
		array(
72
			'id' => '',
73
		),
74
		$atts
75
	);
76
77
	if ( empty( $atts['id'] ) ) {
78
		return false;
79
	}
80
81
	return '<script type="text/javascript" ' . sprintf(
82
		'src="%s/form/generate.js?id=%s"',
83
		esc_url( $base_url ),
84
		esc_attr( $atts['id'] )
85
	) . '></script>';
86
}
@@ 179-199 (lines=21) @@
176
 *
177
 * @return string
178
 */
179
function wpmautic_tags_shortcode( $atts ) {
180
	$base_url = wpmautic_option( 'base_url', '' );
181
	if ( '' === $base_url ) {
182
		return false;
183
	}
184
185
	$atts = shortcode_atts(
186
		array(
187
			'values' => '',
188
		),
189
		$atts
190
	);
191
192
	if ( empty( $atts['values'] ) ) {
193
		return false;
194
	}
195
196
	return sprintf(
197
		'<img src="%s/mtracking.gif?tags=%s" alt="%s" style="display:none;" />',
198
		esc_url( $base_url ),
199
		esc_attr( $atts['values'] ),
200
		esc_attr__( 'Mautic Tags', 'wp-mautic' )
201
	);
202
}
@@ 212-231 (lines=20) @@
209
 *
210
 * @return string
211
 */
212
function wpmautic_focus_shortcode( $atts ) {
213
	$base_url = wpmautic_option( 'base_url', '' );
214
	if ( '' === $base_url ) {
215
		return false;
216
	}
217
218
	$atts = shortcode_atts(
219
		array(
220
			'id' => '',
221
		),
222
		$atts
223
	);
224
225
	if ( empty( $atts['id'] ) ) {
226
		return false;
227
	}
228
229
	return '<script type="text/javascript" ' . sprintf(
230
		'src="%s/focus/%s.js"',
231
		esc_url( $base_url ),
232
		esc_attr( $atts['id'] )
233
	) . ' async="async"></script>';
234
}