@@ -6,18 +6,18 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,38 +120,38 @@ discard block |
||
| 120 | 120 | 'height' => 360, |
| 121 | 121 | ), $atts); |
| 122 | 122 | |
| 123 | - if ( empty( $atts['src'] ) ) { |
|
| 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.', 'wp-mautic' ); |
|
| 123 | + if (empty($atts['src'])) { |
|
| 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.', 'wp-mautic'); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if ( empty( $atts['form-id'] ) ) { |
|
| 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.', 'wp-mautic' ); |
|
| 127 | + if (empty($atts['form-id'])) { |
|
| 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.', 'wp-mautic'); |
|
| 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'] ) ) { |
|
| 142 | - return __( 'Please define a valid video type with video-type="#".', 'wp-mautic' ); |
|
| 141 | + if (empty($atts['video-type'])) { |
|
| 142 | + return __('Please define a valid video type with video-type="#".', 'wp-mautic'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | return sprintf( |
| 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,25 +164,25 @@ discard block |
||
| 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="%s" />', |
| 183 | - esc_url( $base_url ), |
|
| 184 | - esc_attr( $atts['values'] ), |
|
| 185 | - esc_attr__( 'Mautic Tags', 'wp-mautic' ) |
|
| 183 | + esc_url($base_url), |
|
| 184 | + esc_attr($atts['values']), |
|
| 185 | + esc_attr__('Mautic Tags', 'wp-mautic') |
|
| 186 | 186 | ); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -194,23 +194,23 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return string |
| 196 | 196 | */ |
| 197 | -function wpmautic_focus_shortcode( $atts ) { |
|
| 198 | - $base_url = wpmautic_option( 'base_url', '' ); |
|
| 199 | - if ( '' === $base_url ) { |
|
| 197 | +function wpmautic_focus_shortcode($atts) { |
|
| 198 | + $base_url = wpmautic_option('base_url', ''); |
|
| 199 | + if ('' === $base_url) { |
|
| 200 | 200 | return false; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $atts = shortcode_atts( array( |
|
| 203 | + $atts = shortcode_atts(array( |
|
| 204 | 204 | 'id' => '', |
| 205 | - ), $atts ); |
|
| 205 | + ), $atts); |
|
| 206 | 206 | |
| 207 | - if ( empty( $atts['id'] ) ) { |
|
| 207 | + if (empty($atts['id'])) { |
|
| 208 | 208 | return false; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | return '<script type="text/javascript" ' . sprintf( |
| 212 | 212 | 'src="%s/focus/%s.js"', |
| 213 | - esc_url( $base_url ), |
|
| 214 | - esc_attr( $atts['id'] ) |
|
| 213 | + esc_url($base_url), |
|
| 214 | + esc_attr($atts['id']) |
|
| 215 | 215 | ) . ' async="async"></script>'; |
| 216 | 216 | } |
@@ -6,8 +6,8 @@ discard block |
||
| 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 | } |
@@ -18,34 +18,34 @@ discard block |
||
| 18 | 18 | function wpmautic_options_page() { |
| 19 | 19 | ?> |
| 20 | 20 | <div> |
| 21 | - <h2><?php esc_html_e( 'WP Mautic', 'wp-mautic' ); ?></h2> |
|
| 22 | - <p><?php esc_html_e( 'Enable Base URL for Mautic Integration.', 'wp-mautic' ); ?></p> |
|
| 21 | + <h2><?php esc_html_e('WP Mautic', 'wp-mautic'); ?></h2> |
|
| 22 | + <p><?php esc_html_e('Enable Base URL for Mautic Integration.', 'wp-mautic'); ?></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 | - <h3><?php esc_html_e( 'Shortcode Examples:', 'wp-mautic' ); ?></h3> |
|
| 28 | + <h3><?php esc_html_e('Shortcode Examples:', 'wp-mautic'); ?></h3> |
|
| 29 | 29 | <ul> |
| 30 | - <li><?php esc_html_e( 'Mautic Form Embed:', 'wp-mautic' ); ?> <code>[mautic type="form" id="1"]</code></li> |
|
| 31 | - <li><?php esc_html_e( 'Mautic Dynamic Content:', 'wp-mautic' ); ?> <code>[mautic type="content" slot="slot_name"]<?php esc_html_e( 'Default Text', 'wp-mautic' ); ?>[/mautic]</code></li> |
|
| 30 | + <li><?php esc_html_e('Mautic Form Embed:', 'wp-mautic'); ?> <code>[mautic type="form" id="1"]</code></li> |
|
| 31 | + <li><?php esc_html_e('Mautic Dynamic Content:', 'wp-mautic'); ?> <code>[mautic type="content" slot="slot_name"]<?php esc_html_e('Default Text', 'wp-mautic'); ?>[/mautic]</code></li> |
|
| 32 | 32 | </ul> |
| 33 | - <h3><?php esc_html_e( 'Quick Links', 'wp-mautic' ); ?></h3> |
|
| 33 | + <h3><?php esc_html_e('Quick Links', 'wp-mautic'); ?></h3> |
|
| 34 | 34 | <ul> |
| 35 | 35 | <li> |
| 36 | - <a href="https://github.com/mautic/mautic-wordpress#mautic-wordpress-plugin" target="_blank"><?php esc_html_e( 'Plugin docs', 'wp-mautic' ); ?></a> |
|
| 36 | + <a href="https://github.com/mautic/mautic-wordpress#mautic-wordpress-plugin" target="_blank"><?php esc_html_e('Plugin docs', 'wp-mautic'); ?></a> |
|
| 37 | 37 | </li> |
| 38 | 38 | <li> |
| 39 | - <a href="https://github.com/mautic/mautic-wordpress/issues" target="_blank"><?php esc_html_e( 'Plugin support', 'wp-mautic' ); ?></a> |
|
| 39 | + <a href="https://github.com/mautic/mautic-wordpress/issues" target="_blank"><?php esc_html_e('Plugin support', 'wp-mautic'); ?></a> |
|
| 40 | 40 | </li> |
| 41 | 41 | <li> |
| 42 | - <a href="https://mautic.org" target="_blank"><?php esc_html_e( 'Mautic project', 'wp-mautic' ); ?></a> |
|
| 42 | + <a href="https://mautic.org" target="_blank"><?php esc_html_e('Mautic project', 'wp-mautic'); ?></a> |
|
| 43 | 43 | </li> |
| 44 | 44 | <li> |
| 45 | - <a href="http://docs.mautic.org/" target="_blank"><?php esc_html_e( 'Mautic docs', 'wp-mautic' ); ?></a> |
|
| 45 | + <a href="http://docs.mautic.org/" target="_blank"><?php esc_html_e('Mautic docs', 'wp-mautic'); ?></a> |
|
| 46 | 46 | </li> |
| 47 | 47 | <li> |
| 48 | - <a href="https://www.mautic.org/community/" target="_blank"><?php esc_html_e( 'Mautic forum', 'wp-mautic' ); ?></a> |
|
| 48 | + <a href="https://www.mautic.org/community/" target="_blank"><?php esc_html_e('Mautic forum', 'wp-mautic'); ?></a> |
|
| 49 | 49 | </li> |
| 50 | 50 | </ul> |
| 51 | 51 | </div> |
@@ -56,38 +56,38 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |