Passed
Push — master ( c22f16...2bd650 )
by Warwick
01:53
created
classes/frontend/class-output.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -21,22 +21,22 @@  discard block
 block discarded – undo
21 21
 	 * Contructor
22 22
 	 */
23 23
 	public function __construct() {
24
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
25
-		add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 );
26
-		add_shortcode( 'lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' ) );
24
+		add_action('wp_enqueue_scripts', array($this, 'assets'), 5);
25
+		add_filter('wp_kses_allowed_html', array($this, 'wp_kses_allowed_html'), 10, 2);
26
+		add_shortcode('lsx_sharing_buttons', array($this, 'sharing_buttons_shortcode'));
27 27
 		// Storefront (storefront_loop_post, storefront_single_post).
28
-		add_action( 'storefront_post_content_before', array( $this, 'sharing_buttons_template' ), 20 );
28
+		add_action('storefront_post_content_before', array($this, 'sharing_buttons_template'), 20);
29 29
 		// WooCommerce.
30
-		add_action( 'woocommerce_share', array( $this, 'sharing_buttons_template' ) );
30
+		add_action('woocommerce_share', array($this, 'sharing_buttons_template'));
31 31
 
32 32
 		// General Post Types.
33
-		add_action( 'lsx_entry_after', array( $this, 'output_sharing' ) );
33
+		add_action('lsx_entry_after', array($this, 'output_sharing'));
34 34
 
35 35
 		// Tribe Events.
36
-		add_filter( 'tribe_events_ical_single_event_links', array( $this, 'output_event_sharing' ), 10, 1 );
36
+		add_filter('tribe_events_ical_single_event_links', array($this, 'output_event_sharing'), 10, 1);
37 37
 
38 38
 		// Sensei Integration.
39
-		add_action( 'sensei_pagination', array( $this, 'output_sharing' ), 20 );
39
+		add_action('sensei_pagination', array($this, 'output_sharing'), 20);
40 40
 	}
41 41
 
42 42
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public static function get_instance() {
50 50
 		// If the single instance hasn't been set, set it now.
51
-		if ( null == self::$instance ) {
51
+		if (null == self::$instance) {
52 52
 			self::$instance = new self();
53 53
 		}
54 54
 		return self::$instance;
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 	 * Enques the assets.
59 59
 	 */
60 60
 	public function assets() {
61
-		if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
61
+		if (defined('WP_DEBUG') && true === WP_DEBUG) {
62 62
 			$min = '';
63 63
 		} else {
64 64
 			$min = '.min';
65 65
 		}
66 66
 		/* Remove assets completely if all sharing options are off */
67 67
 
68
-		if ( \lsx\sharing\includes\functions\is_disabled() ) {
68
+		if (\lsx\sharing\includes\functions\is_disabled()) {
69 69
 			return '';
70 70
 		}
71 71
 
@@ -73,67 +73,67 @@  discard block
 block discarded – undo
73 73
 		$post_type = get_post_type();
74 74
 
75 75
 		/* Only show the assets if the post type sharing option is on */
76
-		if ( ! \lsx\sharing\includes\functions\is_pt_disabled( $post_type ) ) {
76
+		if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type)) {
77 77
 
78
-			wp_enqueue_script( 'lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true );
78
+			wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array('jquery'), LSX_SHARING_VER, true);
79 79
 
80
-			$params = apply_filters( 'lsx_sharing_js_params', array(
81
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
80
+			$params = apply_filters('lsx_sharing_js_params', array(
81
+				'ajax_url' => admin_url('admin-ajax.php'),
82 82
 			));
83 83
 
84
-			wp_localize_script( 'lsx-sharing', 'lsx_sharing_params', $params );
84
+			wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params);
85 85
 
86
-			wp_enqueue_style( 'lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER );
87
-			wp_style_add_data( 'lsx-sharing', 'rtl', 'replace' );
86
+			wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER);
87
+			wp_style_add_data('lsx-sharing', 'rtl', 'replace');
88 88
 		}
89 89
 	}
90 90
 
91 91
 	/**
92 92
 	 * Display/return sharing buttons.
93 93
 	 */
94
-	public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
94
+	public function sharing_buttons($buttons = array('facebook', 'twitter', 'pinterest'), $echo = false, $post_id = false) {
95 95
 		$sharing_content = '';
96 96
 
97
-		if ( ( is_preview() || is_admin() ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
97
+		if ((is_preview() || is_admin()) && ! (defined('DOING_AJAX') && DOING_AJAX)) {
98 98
 			return '';
99 99
 		}
100 100
 
101 101
 		//Set our variables
102 102
 		global $post;
103 103
 		$share_post = $post;
104
-		if ( false !== $post_id ) {
105
-			$share_post = get_post( $post_id );
106
-			$post_type = get_post_type( $post_id );
104
+		if (false !== $post_id) {
105
+			$share_post = get_post($post_id);
106
+			$post_type = get_post_type($post_id);
107 107
 		} else {
108 108
 			$post_type = get_post_type();
109 109
 		}
110 110
 
111
-		if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled( $post_type ) ) {
111
+		if (\lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type)) {
112 112
 			return '';
113 113
 		}
114 114
 
115
-		if ( ( is_array( $buttons ) && count( $buttons ) > 0 ) ) {
115
+		if ((is_array($buttons) && count($buttons) > 0)) {
116 116
 			$sharing_content .= '<div class="lsx-sharing-content"><p>';
117 117
 
118
-			$sharing_text = \lsx\sharing\includes\functions\get_sharing_text( $post_type );
119
-			if ( '' !== $sharing_text ) {
118
+			$sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type);
119
+			if ('' !== $sharing_text) {
120 120
 				$sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>';
121 121
 			}
122 122
 
123
-			foreach ( $buttons as $id => $button ) {
124
-				$button_obj = new \lsx\sharing\classes\frontend\Button( $button, $this->options, $post_type );
123
+			foreach ($buttons as $id => $button) {
124
+				$button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type);
125 125
 
126
-				if ( ! empty( $button_obj ) ) {
127
-					$url = $button_obj->get_link( $share_post );
126
+				if ( ! empty($button_obj)) {
127
+					$url = $button_obj->get_link($share_post);
128 128
 
129
-					if ( ! empty( $url ) ) {
130
-						if ( 'email' === $button ) {
131
-							if ( ! isset( $this->options['display'] ) || empty( $this->options['display']['sharing_email_form_id'] ) ) {
129
+					if ( ! empty($url)) {
130
+						if ('email' === $button) {
131
+							if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id'])) {
132 132
 								continue;
133 133
 							}
134
-							$sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr( $button ) . '"><a href="#lsx-sharing-email" data-toggle="modal" data-link="' . esc_url( $url ) . '"><span class="fa" aria-hidden="true"></span></a></span>';
134
+							$sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="#lsx-sharing-email" data-toggle="modal" data-link="' . esc_url($url) . '"><span class="fa" aria-hidden="true"></span></a></span>';
135 135
 						} else {
136
-							$sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr( $button ) . '"><a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer"><span class="fa" aria-hidden="true"></span></a></span>';
136
+							$sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="' . esc_url($url) . '" target="_blank" rel="noopener noreferrer"><span class="fa" aria-hidden="true"></span></a></span>';
137 137
 						}
138 138
 					}
139 139
 				}
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 			$sharing_content .= '</p></div>';
142 142
 		}
143 143
 
144
-		if ( $echo ) {
145
-			echo wp_kses_post( $sharing_content );
144
+		if ($echo) {
145
+			echo wp_kses_post($sharing_content);
146 146
 		} else {
147 147
 			return $sharing_content;
148 148
 		}
@@ -151,20 +151,20 @@  discard block
 block discarded – undo
151 151
 	/**
152 152
 	 * Sharing buttons shortcode.
153 153
 	 */
154
-	public function sharing_buttons_shortcode( $atts ) {
155
-		$atts = shortcode_atts( array(
154
+	public function sharing_buttons_shortcode($atts) {
155
+		$atts = shortcode_atts(array(
156 156
 			'buttons' => '',
157
-		), $atts, 'lsx_sharing_buttons' );
157
+		), $atts, 'lsx_sharing_buttons');
158 158
 
159
-		if ( empty( $atts['buttons'] ) ) {
159
+		if (empty($atts['buttons'])) {
160 160
 			return '';
161 161
 		}
162 162
 
163
-		$no_whitespaces = preg_replace( '/\s*,\s*/', ',', filter_var( $atts['buttons'], FILTER_SANITIZE_STRING ) );
164
-		$buttons        = explode( ',', $no_whitespaces );
163
+		$no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING));
164
+		$buttons        = explode(',', $no_whitespaces);
165 165
 
166
-		if ( is_array( $buttons ) && count( $buttons ) > 0 ) {
167
-			return $this->sharing_buttons( $buttons );
166
+		if (is_array($buttons) && count($buttons) > 0) {
167
+			return $this->sharing_buttons($buttons);
168 168
 		}
169 169
 	}
170 170
 
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 	 * Display buttons (template hook).
173 173
 	 */
174 174
 	public function sharing_buttons_template() {
175
-		echo wp_kses_post( $this->sharing_buttons() );
175
+		echo wp_kses_post($this->sharing_buttons());
176 176
 	}
177 177
 
178 178
 	/**
179 179
 	 * Allow data params for Bootstrap modal.
180 180
 	 */
181
-	public function wp_kses_allowed_html( $allowedtags, $context ) {
181
+	public function wp_kses_allowed_html($allowedtags, $context) {
182 182
 		$allowedtags['a']['data-toggle'] = true;
183 183
 		$allowedtags['a']['data-link']   = true;
184 184
 		return $allowedtags;
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 * @return void
191 191
 	 */
192 192
 	public function output_sharing() {
193
-		if ( is_main_query() && is_single() && ! is_singular( array( 'post', 'page', 'product' ) ) ) {
193
+		if (is_main_query() && is_single() && ! is_singular(array('post', 'page', 'product'))) {
194 194
 
195
-			if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled( get_post_type() ) || in_array( get_post_type(), \lsx\sharing\includes\functions\get_restricted_post_types() ) || in_array( get_post_type(), \lsx\sharing\includes\functions\get_to_post_types() ) || in_array( get_post_type(), \lsx\sharing\includes\functions\get_hp_post_types() ) ) {
195
+			if (\lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_restricted_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_to_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_hp_post_types())) {
196 196
 				return '';
197 197
 			}
198 198
 			?>
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 	 * @param string $ical_links
212 212
 	 * @return string
213 213
 	 */
214
-	public function output_event_sharing( $ical_links = '' ) {
215
-		if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled( get_post_type() ) ) {
214
+	public function output_event_sharing($ical_links = '') {
215
+		if (\lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type())) {
216 216
 			return '';
217 217
 		} else {
218 218
 			$ical_links .= $this->sharing_buttons();
Please login to merge, or discard this patch.
classes/admin/class-settings.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 * Contructor
22 22
 	 */
23 23
 	public function __construct() {
24
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
25
-		add_action( 'lsx_sharing_settings_page', array( $this, 'configure_general_fields' ), 15, 1 );
26
-		add_action( 'lsx_sharing_settings_page', array( $this, 'configure_archive_fields' ), 15, 1 );
27
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
24
+		add_action('cmb2_admin_init', array($this, 'register_settings_page'));
25
+		add_action('lsx_sharing_settings_page', array($this, 'configure_general_fields'), 15, 1);
26
+		add_action('lsx_sharing_settings_page', array($this, 'configure_archive_fields'), 15, 1);
27
+		add_action('admin_enqueue_scripts', array($this, 'assets'));
28 28
 	}
29 29
 
30 30
 	/**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public static function get_instance() {
38 38
 		// If the single instance hasn't been set, set it now.
39
-		if ( null == self::$instance ) {
39
+		if (null == self::$instance) {
40 40
 			self::$instance = new self();
41 41
 		}
42 42
 		return self::$instance;
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
 	public function register_settings_page() {
51 51
 		$args = array(
52 52
 			'id'           => 'lsx_sharing_settings',
53
-			'title'        => '<h1>' . esc_html__( 'LSX Sharing Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SHARING_VER . '</span></h1>',
54
-			'menu_title'   => esc_html__( 'LSX Sharing', 'search' ), // Falls back to 'title' (above).
55
-			'object_types' => array( 'options-page' ),
53
+			'title'        => '<h1>' . esc_html__('LSX Sharing Settings', 'lsx-search') . ' <span class="version">' . LSX_SHARING_VER . '</span></h1>',
54
+			'menu_title'   => esc_html__('LSX Sharing', 'search'), // Falls back to 'title' (above).
55
+			'object_types' => array('options-page'),
56 56
 			'option_key'   => 'lsx-sharing-settings', // The option key and admin menu page slug.
57 57
 			'parent_slug'  => 'options-general.php',
58 58
 			'capability'   => 'manage_options', // Cap required to view options-page.
59 59
 		);
60
-		$cmb  = new_cmb2_box( $args );
61
-		do_action( 'lsx_sharing_settings_page', $cmb );
60
+		$cmb = new_cmb2_box($args);
61
+		do_action('lsx_sharing_settings_page', $cmb);
62 62
 	}
63 63
 
64 64
 	/**
65 65
 	 * Enqueue JS and CSS.
66 66
 	 */
67
-	public function assets( $hook ) {
68
-		wp_enqueue_style( 'lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER );
67
+	public function assets($hook) {
68
+		wp_enqueue_style('lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER);
69 69
 	}
70 70
 
71 71
 	/**
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return  void
75 75
 	 */
76
-	public function configure_general_fields( $cmb ) {
76
+	public function configure_general_fields($cmb) {
77 77
 		$global_args = array(
78
-			'title' => __( 'Global', 'lsx-search' ),
79
-			'desc'  => esc_html__( 'Control the sharing WordPress post types.', 'lsx-search' ),
78
+			'title' => __('Global', 'lsx-search'),
79
+			'desc'  => esc_html__('Control the sharing WordPress post types.', 'lsx-search'),
80 80
 		);
81
-		$this->get_fields( $cmb, 'global', $global_args );
81
+		$this->get_fields($cmb, 'global', $global_args);
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,73 +88,73 @@  discard block
 block discarded – undo
88 88
 	 * @param string $position either top of bottom.
89 89
 	 * @return void
90 90
 	 */
91
-	public function configure_archive_fields( $cmb ) {
91
+	public function configure_archive_fields($cmb) {
92 92
 		$archives       = array();
93 93
 		$post_type_args = array(
94 94
 			'public' => true,
95 95
 		);
96
-		$post_types     = get_post_types( $post_type_args );
97
-		if ( ! empty( $post_types ) ) {
98
-			foreach ( $post_types as $post_type_key => $post_type_value ) {
99
-				switch ( $post_type_key ) {
96
+		$post_types     = get_post_types($post_type_args);
97
+		if ( ! empty($post_types)) {
98
+			foreach ($post_types as $post_type_key => $post_type_value) {
99
+				switch ($post_type_key) {
100 100
 					case 'post':
101 101
 						$page_url      = home_url();
102
-						$page_title    = __( 'Home', 'lsx-search' );
103
-						$show_on_front = get_option( 'show_on_front' );
104
-						if ( 'page' === $show_on_front ) {
105
-							$page_for_posts = get_option( 'page_for_posts' );
106
-							if ( '' !== $page_for_posts ) {
107
-								$page_title   = get_the_title( $page_for_posts );
108
-								$page_url     = get_permalink( $page_for_posts );
102
+						$page_title    = __('Home', 'lsx-search');
103
+						$show_on_front = get_option('show_on_front');
104
+						if ('page' === $show_on_front) {
105
+							$page_for_posts = get_option('page_for_posts');
106
+							if ('' !== $page_for_posts) {
107
+								$page_title   = get_the_title($page_for_posts);
108
+								$page_url     = get_permalink($page_for_posts);
109 109
 							}
110 110
 						}
111 111
 						$description = sprintf(
112 112
 							/* translators: %s: The subscription info */
113
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> posts.', 'lsx-search' ),
113
+							__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> posts.', 'lsx-search'),
114 114
 							$page_url,
115 115
 							$page_title
116 116
 						);
117
-						$archives[ $post_type_key ] = array(
118
-							'title' => __( 'Blog', 'lsx-search' ),
117
+						$archives[$post_type_key] = array(
118
+							'title' => __('Blog', 'lsx-search'),
119 119
 							'desc'  => $description,
120 120
 						);
121 121
 						break;
122 122
 
123 123
 					case 'product':
124 124
 						$page_url = home_url();
125
-						$page_title    = __( 'Shop', 'lsx-search' );
126
-						if ( function_exists( 'wc_get_page_id' ) ) {
127
-							$shop_page  = wc_get_page_id( 'shop' );
128
-							$page_url   = get_permalink( $shop_page );
129
-							$page_title = get_the_title( $shop_page );
125
+						$page_title = __('Shop', 'lsx-search');
126
+						if (function_exists('wc_get_page_id')) {
127
+							$shop_page  = wc_get_page_id('shop');
128
+							$page_url   = get_permalink($shop_page);
129
+							$page_title = get_the_title($shop_page);
130 130
 						}
131 131
 						$description = sprintf(
132 132
 							/* translators: %s: The subscription info */
133
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> product pages.', 'lsx-search' ),
133
+							__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> product pages.', 'lsx-search'),
134 134
 							$page_url,
135 135
 							$page_title
136 136
 						);
137
-						$archives[ $post_type_key ] = array(
138
-							'title' => __( 'Shop', 'lsx-search' ),
137
+						$archives[$post_type_key] = array(
138
+							'title' => __('Shop', 'lsx-search'),
139 139
 							'desc'  => $description,
140 140
 						);
141 141
 						break;
142 142
 
143 143
 					default:
144
-						if ( in_array( $post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types() ) ) {
144
+						if (in_array($post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types())) {
145 145
 							break;
146 146
 						}
147
-						$temp_post_type = get_post_type_object( $post_type_key );
148
-						if ( ! is_wp_error( $temp_post_type ) ) {
149
-							$page_url    = get_post_type_archive_link( $temp_post_type->name );
147
+						$temp_post_type = get_post_type_object($post_type_key);
148
+						if ( ! is_wp_error($temp_post_type)) {
149
+							$page_url    = get_post_type_archive_link($temp_post_type->name);
150 150
 							$description = sprintf(
151 151
 								/* translators: %s: The subscription info */
152
-								__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search' ),
152
+								__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search'),
153 153
 								$page_url,
154 154
 								$temp_post_type->label
155 155
 							);
156 156
 
157
-							$archives[ $post_type_key ] = array(
157
+							$archives[$post_type_key] = array(
158 158
 								'title' => $temp_post_type->label,
159 159
 								'desc'  => $description,
160 160
 							);
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 				}
164 164
 			}
165 165
 		}
166
-		if ( ! empty( $archives ) ) {
167
-			foreach ( $archives as $archive_key => $archive_args ) {
168
-				$this->get_fields( $cmb, $archive_key, $archive_args );
166
+		if ( ! empty($archives)) {
167
+			foreach ($archives as $archive_key => $archive_args) {
168
+				$this->get_fields($cmb, $archive_key, $archive_args);
169 169
 			}
170 170
 		}
171 171
 	}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param array $args
178 178
 	 * @return void
179 179
 	 */
180
-	public function get_fields( $cmb, $section, $args ) {
180
+	public function get_fields($cmb, $section, $args) {
181 181
 		$cmb->add_field(
182 182
 			array(
183 183
 				'id'          => 'settings_' . $section . '_sharing',
@@ -187,21 +187,21 @@  discard block
 block discarded – undo
187 187
 				'description' => $args['desc'],
188 188
 			)
189 189
 		);
190
-		if ( 'global' === $section ) {
190
+		if ('global' === $section) {
191 191
 			$cmb->add_field(
192 192
 				array(
193
-					'name'        => esc_html__( 'Disable all', 'lsx-sharing' ),
193
+					'name'        => esc_html__('Disable all', 'lsx-sharing'),
194 194
 					'id'          => $section . '_disable_all',
195
-					'description' => esc_html__( 'Disable all share buttons on the site', 'lsx-sharing' ),
195
+					'description' => esc_html__('Disable all share buttons on the site', 'lsx-sharing'),
196 196
 					'type'        => 'checkbox',
197 197
 				)
198 198
 			);
199 199
 		} else {
200 200
 			$cmb->add_field(
201 201
 				array(
202
-					'name'        => esc_html__( 'Disable', 'lsx-sharing' ),
202
+					'name'        => esc_html__('Disable', 'lsx-sharing'),
203 203
 					'id'          => $section . '_disable_pt',
204
-					'description' => esc_html__( 'Disable the share buttons on this post type', 'lsx-sharing' ),
204
+					'description' => esc_html__('Disable the share buttons on this post type', 'lsx-sharing'),
205 205
 					'type'        => 'checkbox',
206 206
 				)
207 207
 			);
@@ -209,44 +209,44 @@  discard block
 block discarded – undo
209 209
 
210 210
 		$cmb->add_field(
211 211
 			array(
212
-				'name'        => esc_html__( 'Label text', 'lsx-sharing' ),
212
+				'name'        => esc_html__('Label text', 'lsx-sharing'),
213 213
 				'id'          => $section . '_label_text',
214
-				'description' => esc_html__( 'A default label for the sharing.', 'lsx-sharing' ),
214
+				'description' => esc_html__('A default label for the sharing.', 'lsx-sharing'),
215 215
 				'type'        => 'text',
216 216
 			)
217 217
 		);
218
-		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'facebook' ) ) ) {
218
+		if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'facebook'))) {
219 219
 			$cmb->add_field(
220 220
 				array(
221
-					'name'        => esc_html__( 'Disable Facebook', 'lsx-sharing' ),
221
+					'name'        => esc_html__('Disable Facebook', 'lsx-sharing'),
222 222
 					'id'          => $section . '_disable_facebook',
223
-					'description' => esc_html__( 'Disable Facebook share button.', 'lsx-sharing' ),
223
+					'description' => esc_html__('Disable Facebook share button.', 'lsx-sharing'),
224 224
 					'type'        => 'checkbox',
225 225
 				)
226 226
 			);
227 227
 		}
228
-		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'twitter' ) ) ) {
228
+		if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'twitter'))) {
229 229
 			$cmb->add_field(
230 230
 				array(
231
-					'name'        => esc_html__( 'Disable Twitter', 'lsx-sharing' ),
231
+					'name'        => esc_html__('Disable Twitter', 'lsx-sharing'),
232 232
 					'id'          => $section . '_disable_twitter',
233
-					'description' => esc_html__( 'Disable Twitter share button.', 'lsx-sharing' ),
233
+					'description' => esc_html__('Disable Twitter share button.', 'lsx-sharing'),
234 234
 					'type'        => 'checkbox',
235 235
 				)
236 236
 			);
237 237
 		}
238
-		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'pinterest' ) ) ) {
238
+		if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'pinterest'))) {
239 239
 			$cmb->add_field(
240 240
 				array(
241
-					'name'        => esc_html__( 'Disable Pinterest', 'lsx-sharing' ),
241
+					'name'        => esc_html__('Disable Pinterest', 'lsx-sharing'),
242 242
 					'id'          => $section . '_disable_pinterest',
243
-					'description' => esc_html__( 'Disable Pinterest button.', 'lsx-sharing' ),
243
+					'description' => esc_html__('Disable Pinterest button.', 'lsx-sharing'),
244 244
 					'type'        => 'checkbox',
245 245
 				)
246 246
 			);
247 247
 		}
248 248
 
249
-		do_action( 'lsx_sharing_settings_section', $cmb, $section );
249
+		do_action('lsx_sharing_settings_section', $cmb, $section);
250 250
 		$cmb->add_field(
251 251
 			array(
252 252
 				'id'   => $section . '_title_closing',
Please login to merge, or discard this patch.
includes/functions.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		'certificate',
31 31
 		'project',
32 32
 	);
33
-	return apply_filters( 'lsx_sharing_get_restricted_post_types', $post_types );
33
+	return apply_filters('lsx_sharing_get_restricted_post_types', $post_types);
34 34
 }
35 35
 
36 36
 /**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		'vehicle',
49 49
 		'activity',
50 50
 	);
51
-	return apply_filters( 'lsx_sharing_get_to_post_types', $post_types );
51
+	return apply_filters('lsx_sharing_get_to_post_types', $post_types);
52 52
 }
53 53
 
54 54
 /**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		'meal',
65 65
 		'tip',
66 66
 	);
67
-	return apply_filters( 'lsx_sharing_get_hp_post_types', $post_types );
67
+	return apply_filters('lsx_sharing_get_hp_post_types', $post_types);
68 68
 }
69 69
 
70 70
 /**
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
  *
73 73
  * @return boolean
74 74
  */
75
-function is_button_disabled( $post_type = '', $service = '' ) {
75
+function is_button_disabled($post_type = '', $service = '') {
76 76
 	$sharing = lsx_sharing();
77 77
 	$option  = false;
78
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_' . $service ] ) ) {
78
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_' . $service])) {
79 79
 		$option = true;
80
-	} elseif ( true === $sharing->is_new_options && ! empty( $sharing->options[ $post_type . '_disable_' . $service ] ) ) {
80
+	} elseif (true === $sharing->is_new_options && ! empty($sharing->options[$post_type . '_disable_' . $service])) {
81 81
 		$option = true;
82 82
 	}
83 83
 	return $option;
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return boolean
90 90
  */
91
-function is_pt_disabled( $post_type = '' ) {
91
+function is_pt_disabled($post_type = '') {
92 92
 	$sharing = lsx_sharing();
93 93
 	$option  = false;
94
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_pt_' . $post_type ] ) ) {
94
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_pt_' . $post_type])) {
95 95
 		$option = true;
96
-	} elseif ( true === $sharing->is_new_options && isset( $sharing->options[ $post_type . '_disable_pt' ] ) ) {
96
+	} elseif (true === $sharing->is_new_options && isset($sharing->options[$post_type . '_disable_pt'])) {
97 97
 		$option = true;
98 98
 	}
99 99
 	return $option;
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 function is_disabled() {
108 108
 	$sharing = lsx_sharing();
109 109
 	$option  = false;
110
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_disable_all'] ) ) {
110
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_all'])) {
111 111
 		$option = true;
112
-	} elseif ( true === $sharing->is_new_options && isset( $sharing->options['global_disable_all'] ) ) {
112
+	} elseif (true === $sharing->is_new_options && isset($sharing->options['global_disable_all'])) {
113 113
 		$option = true;
114 114
 	}
115 115
 	return $option;
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function get_sharing_text( $post_type = '' ) {
123
+function get_sharing_text($post_type = '') {
124 124
 	$sharing = lsx_sharing();
125 125
 	$text    = '';
126
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_label_text'] ) ) {
126
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_label_text'])) {
127 127
 		$text = $sharing->options['display']['sharing_label_text'];
128
-	} elseif ( true === $sharing->is_new_options ) {
129
-		if ( isset( $sharing->options[ $post_type . '_label_text' ] ) ) {
130
-			$text = $sharing->options[ $post_type . '_label_text' ];
131
-		} elseif ( isset( $sharing->options['global_label_text'] ) ) {
128
+	} elseif (true === $sharing->is_new_options) {
129
+		if (isset($sharing->options[$post_type . '_label_text'])) {
130
+			$text = $sharing->options[$post_type . '_label_text'];
131
+		} elseif (isset($sharing->options['global_label_text'])) {
132 132
 			$text = $sharing->options['global_label_text'];
133 133
 		}
134 134
 	}
Please login to merge, or discard this patch.