Completed
Branch add/settings-update (80bb6a)
by Warwick
03:50
created
lsx-sharing.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
  */
14 14
 
15 15
 // If this file is called directly, abort.
16
-if ( ! defined( 'WPINC' ) ) {
16
+if ( ! defined('WPINC')) {
17 17
 	die;
18 18
 }
19 19
 
20
-define( 'LSX_SHARING_PATH', plugin_dir_path( __FILE__ ) );
21
-define( 'LSX_SHARING_CORE', __FILE__ );
22
-define( 'LSX_SHARING_URL', plugin_dir_url( __FILE__ ) );
23
-define( 'LSX_SHARING_VER', '1.2.0' );
20
+define('LSX_SHARING_PATH', plugin_dir_path(__FILE__));
21
+define('LSX_SHARING_CORE', __FILE__);
22
+define('LSX_SHARING_URL', plugin_dir_url(__FILE__));
23
+define('LSX_SHARING_VER', '1.2.0');
24 24
 
25 25
 /* ======================= Below is the Plugin Class init ========================= */
26 26
 require_once LSX_SHARING_PATH . '/classes/class-sharing.php';
Please login to merge, or discard this patch.
includes/functions.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
  *
13 13
  * @return boolean
14 14
  */
15
-function is_button_disabled( $post_type = '' , $service = '' ) {
15
+function is_button_disabled($post_type = '', $service = '') {
16 16
 	$sharing = lsx_sharing();
17 17
 	$option  = false;
18
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_' . $service ] ) ) {
18
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_' . $service])) {
19 19
 		$option = true;
20
-	} elseif ( true === $sharing->is_new_options && ! empty( $sharing->options[ $post_type . '_disable_' . $service ] ) ) {
20
+	} elseif (true === $sharing->is_new_options && ! empty($sharing->options[$post_type . '_disable_' . $service])) {
21 21
 		$option = true;
22 22
 	}
23 23
 	return $option;
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return boolean
30 30
  */
31
-function is_pt_disabled( $post_type = '' ) {
31
+function is_pt_disabled($post_type = '') {
32 32
 	$sharing = lsx_sharing();
33 33
 	$option  = false;
34
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_pt_' . $post_type ] ) ) {
34
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_pt_' . $post_type])) {
35 35
 		$option = true;
36
-	} elseif ( true === $sharing->is_new_options && isset( $sharing->options[ $post_type . '_disable_pt' ] ) ) {
36
+	} elseif (true === $sharing->is_new_options && isset($sharing->options[$post_type . '_disable_pt'])) {
37 37
 		$option = true;
38 38
 	}
39 39
 	return $option;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 function is_disabled() {
48 48
 	$sharing = lsx_sharing();
49 49
 	$option  = false;
50
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_disable_all'] ) ) {
50
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_all'])) {
51 51
 		$option = true;
52
-	} elseif ( true === $sharing->is_new_options && isset( $sharing->options['global_disable_all'] ) ) {
52
+	} elseif (true === $sharing->is_new_options && isset($sharing->options['global_disable_all'])) {
53 53
 		$option = true;
54 54
 	}
55 55
 	return $option;
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string
62 62
  */
63
-function get_sharing_text( $post_type = '' ) {
63
+function get_sharing_text($post_type = '') {
64 64
 	$sharing = lsx_sharing();
65 65
 	$text    = '';
66
-	if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_label_text'] ) ) {
66
+	if (false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_label_text'])) {
67 67
 		$text = $sharing->options['display']['sharing_label_text'];
68
-	} elseif ( true === $sharing->is_new_options ) {
69
-		if ( isset( $sharing->options[ $post_type . '_label_text' ] ) ) {
70
-			$text = $sharing->options[ $post_type . '_label_text' ];
71
-		} elseif ( isset( $sharing->options['global_label_text'] ) ) {
68
+	} elseif (true === $sharing->is_new_options) {
69
+		if (isset($sharing->options[$post_type . '_label_text'])) {
70
+			$text = $sharing->options[$post_type . '_label_text'];
71
+		} elseif (isset($sharing->options['global_label_text'])) {
72 72
 			$text = $sharing->options['global_label_text'];
73 73
 		}
74 74
 	}
Please login to merge, or discard this patch.
classes/class-sharing.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * Constructor.
50 50
 	 */
51 51
 	public function __construct() {
52
-		add_action( 'init', array( $this, 'set_options' ), 50 );
52
+		add_action('init', array($this, 'set_options'), 50);
53 53
 		$this->load_vendors();
54 54
 		$this->load_includes();
55 55
 		$this->load_classes();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public static function get_instance() {
66 66
 		// If the single instance hasn't been set, set it now.
67
-		if ( null === self::$instance ) {
67
+		if (null === self::$instance) {
68 68
 			self::$instance = new self();
69 69
 		}
70 70
 		return self::$instance;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	private function load_vendors() {
77 77
 		// Configure custom fields.
78
-		if ( ! class_exists( 'CMB2' ) ) {
78
+		if ( ! class_exists('CMB2')) {
79 79
 			require_once LSX_SHARING_PATH . 'vendor/CMB2/init.php';
80 80
 		}
81 81
 	}
@@ -103,19 +103,19 @@  discard block
 block discarded – undo
103 103
 	 * Set options.
104 104
 	 */
105 105
 	public function set_options() {
106
-		if ( function_exists( 'tour_operator' ) ) {
107
-			$this->options = get_option( '_lsx-to_settings', false );
106
+		if (function_exists('tour_operator')) {
107
+			$this->options = get_option('_lsx-to_settings', false);
108 108
 		} else {
109
-			$this->options = get_option( '_lsx_settings', false );
109
+			$this->options = get_option('_lsx_settings', false);
110 110
 
111
-			if ( false === $this->options ) {
112
-				$this->options = get_option( '_lsx_lsx-settings', false );
111
+			if (false === $this->options) {
112
+				$this->options = get_option('_lsx_lsx-settings', false);
113 113
 			}
114 114
 		}
115 115
 
116
-		$new_options = get_option( 'lsx-sharing-settings' );
117
-		if ( ! empty( $new_options ) ) {
118
-			if ( '' !== $new_options && false !== $new_options ) {
116
+		$new_options = get_option('lsx-sharing-settings');
117
+		if ( ! empty($new_options)) {
118
+			if ('' !== $new_options && false !== $new_options) {
119 119
 				$this->is_new_options = true;
120 120
 				$this->options        = $new_options;
121 121
 			}
Please login to merge, or discard this patch.
classes/class-frontend.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function get_instance() {
49 49
 		// If the single instance hasn't been set, set it now.
50
-		if ( null == self::$instance ) {
50
+		if (null == self::$instance) {
51 51
 			self::$instance = new self();
52 52
 		}
53 53
 		return self::$instance;
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * Backwards compatabile function for the sharing buttons.
67 67
 	 */
68
-	public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
69
-		wc_deprecated_function( 'LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()' );
70
-		$this->output->sharing_buttons( $buttons, $echo, $post_id );
68
+	public function sharing_buttons($buttons = array('facebook', 'twitter', 'pinterest'), $echo = false, $post_id = false) {
69
+		wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()');
70
+		$this->output->sharing_buttons($buttons, $echo, $post_id);
71 71
 	}
72 72
 }
Please login to merge, or discard this patch.
classes/frontend/class-output.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  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
 
33 33
 	/**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public static function get_instance() {
41 41
 		// If the single instance hasn't been set, set it now.
42
-		if ( null == self::$instance ) {
42
+		if (null == self::$instance) {
43 43
 			self::$instance = new self();
44 44
 		}
45 45
 		return self::$instance;
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 * Enques the assets.
50 50
 	 */
51 51
 	public function assets() {
52
-		if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
52
+		if (defined('WP_DEBUG') && true === WP_DEBUG) {
53 53
 			$min = '';
54 54
 		} else {
55 55
 			$min = '.min';
56 56
 		}
57 57
 		/* Remove assets completely if all sharing options are off */
58 58
 
59
-		if ( \lsx\sharing\includes\functions\is_disabled() ) {
59
+		if (\lsx\sharing\includes\functions\is_disabled()) {
60 60
 			return '';
61 61
 		}
62 62
 
@@ -64,26 +64,26 @@  discard block
 block discarded – undo
64 64
 		global $post;
65 65
 		$post_id    = false;
66 66
 		$share_post = $post;
67
-		if ( false !== $post_id ) {
68
-			$share_post = get_post( $post_id );
69
-			$post_type  = get_post_type( $post_id );
67
+		if (false !== $post_id) {
68
+			$share_post = get_post($post_id);
69
+			$post_type  = get_post_type($post_id);
70 70
 		} else {
71 71
 			$post_type = get_post_type();
72 72
 		}
73 73
 
74 74
 		/* Only show the assets if the post type sharing option is on */
75
-		if ( ! \lsx\sharing\includes\functions\is_pt_disabled( $post_type ) ) {
75
+		if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type)) {
76 76
 
77
-			wp_enqueue_script( 'lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true );
77
+			wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array('jquery'), LSX_SHARING_VER, true);
78 78
 
79
-			$params = apply_filters( 'lsx_sharing_js_params', array(
80
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
79
+			$params = apply_filters('lsx_sharing_js_params', array(
80
+				'ajax_url' => admin_url('admin-ajax.php'),
81 81
 			));
82 82
 
83
-			wp_localize_script( 'lsx-sharing', 'lsx_sharing_params', $params );
83
+			wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params);
84 84
 
85
-			wp_enqueue_style( 'lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER );
86
-			wp_style_add_data( 'lsx-sharing', 'rtl', 'replace' );
85
+			wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER);
86
+			wp_style_add_data('lsx-sharing', 'rtl', 'replace');
87 87
 
88 88
 		}
89 89
 
@@ -92,49 +92,49 @@  discard block
 block discarded – undo
92 92
 	/**
93 93
 	 * Display/return sharing buttons.
94 94
 	 */
95
-	public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
95
+	public function sharing_buttons($buttons = array('facebook', 'twitter', 'pinterest'), $echo = false, $post_id = false) {
96 96
 		$sharing_content = '';
97 97
 
98
-		if ( ( is_preview() || is_admin() ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
98
+		if ((is_preview() || is_admin()) && ! (defined('DOING_AJAX') && DOING_AJAX)) {
99 99
 			return '';
100 100
 		}
101 101
 
102 102
 		//Set our variables
103 103
 		global $post;
104 104
 		$share_post = $post;
105
-		if ( false !== $post_id ) {
106
-			$share_post = get_post( $post_id );
107
-			$post_type = get_post_type( $post_id );
105
+		if (false !== $post_id) {
106
+			$share_post = get_post($post_id);
107
+			$post_type = get_post_type($post_id);
108 108
 		} else {
109 109
 			$post_type = get_post_type();
110 110
 		}
111 111
 
112
-		if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled( $post_type ) ) {
112
+		if (\lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type)) {
113 113
 			return '';
114 114
 		}
115 115
 
116
-		if ( ( is_array( $buttons ) && count( $buttons ) > 0 ) ) {
116
+		if ((is_array($buttons) && count($buttons) > 0)) {
117 117
 			$sharing_content .= '<div class="lsx-sharing-content"><p>';
118 118
 
119
-			$sharing_text = \lsx\sharing\includes\functions\get_sharing_text( $post_type );
120
-			if ( '' !== $sharing_text ) {
119
+			$sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type);
120
+			if ('' !== $sharing_text) {
121 121
 				$sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>';
122 122
 			}
123 123
 
124
-			foreach ( $buttons as $id => $button ) {
125
-				$button_obj = new \lsx\sharing\classes\frontend\Button( $button, $this->options, $post_type );
124
+			foreach ($buttons as $id => $button) {
125
+				$button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type);
126 126
 
127
-				if ( ! empty( $button_obj ) ) {
128
-					$url = $button_obj->get_link( $share_post );
127
+				if ( ! empty($button_obj)) {
128
+					$url = $button_obj->get_link($share_post);
129 129
 
130
-					if ( ! empty( $url ) ) {
131
-						if ( 'email' === $button ) {
132
-							if ( ! isset( $this->options['display'] ) || empty( $this->options['display']['sharing_email_form_id'] ) ) {
130
+					if ( ! empty($url)) {
131
+						if ('email' === $button) {
132
+							if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id'])) {
133 133
 								continue;
134 134
 							}
135
-							$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
+							$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>';
136 136
 						} else {
137
-							$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
+							$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>';
138 138
 						}
139 139
 					}
140 140
 				}
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 			$sharing_content .= '</p></div>';
143 143
 		}
144 144
 
145
-		if ( $echo ) {
146
-			echo wp_kses_post( $sharing_content );
145
+		if ($echo) {
146
+			echo wp_kses_post($sharing_content);
147 147
 		} else {
148 148
 			return $sharing_content;
149 149
 		}
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
 	/**
153 153
 	 * Sharing buttons shortcode.
154 154
 	 */
155
-	public function sharing_buttons_shortcode( $atts ) {
156
-		$atts = shortcode_atts( array(
155
+	public function sharing_buttons_shortcode($atts) {
156
+		$atts = shortcode_atts(array(
157 157
 			'buttons' => '',
158
-		), $atts, 'lsx_sharing_buttons' );
158
+		), $atts, 'lsx_sharing_buttons');
159 159
 
160
-		if ( empty( $atts['buttons'] ) ) {
160
+		if (empty($atts['buttons'])) {
161 161
 			return '';
162 162
 		}
163 163
 
164
-		$no_whitespaces = preg_replace( '/\s*,\s*/', ',', filter_var( $atts['buttons'], FILTER_SANITIZE_STRING ) );
165
-		$buttons        = explode( ',', $no_whitespaces );
164
+		$no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING));
165
+		$buttons        = explode(',', $no_whitespaces);
166 166
 
167
-		if ( is_array( $buttons ) && count( $buttons ) > 0 ) {
168
-			return $this->sharing_buttons( $buttons );
167
+		if (is_array($buttons) && count($buttons) > 0) {
168
+			return $this->sharing_buttons($buttons);
169 169
 		}
170 170
 	}
171 171
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 	 * Display buttons (template hook).
174 174
 	 */
175 175
 	public function sharing_buttons_template() {
176
-		echo wp_kses_post( $this->sharing_buttons() );
176
+		echo wp_kses_post($this->sharing_buttons());
177 177
 	}
178 178
 
179 179
 	/**
180 180
 	 * Allow data params for Bootstrap modal.
181 181
 	 */
182
-	public function wp_kses_allowed_html( $allowedtags, $context ) {
182
+	public function wp_kses_allowed_html($allowedtags, $context) {
183 183
 		$allowedtags['a']['data-toggle'] = true;
184 184
 		$allowedtags['a']['data-link']   = true;
185 185
 		return $allowedtags;
Please login to merge, or discard this patch.
classes/frontend/class-button.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 * Constructor.
37 37
 	 */
38
-	public function __construct( $service, $options, $prefix = 'sharing' ) {
38
+	public function __construct($service, $options, $prefix = 'sharing') {
39 39
 		$this->options = $options;
40
-		if ( ! in_array( $service, $this->services, true ) ) {
40
+		if ( ! in_array($service, $this->services, true)) {
41 41
 			return;
42 42
 		}
43
-		if ( \lsx\sharing\includes\functions\is_button_disabled( 'global', $service ) || \lsx\sharing\includes\functions\is_button_disabled( $prefix, $service ) ) {
43
+		if (\lsx\sharing\includes\functions\is_button_disabled('global', $service) || \lsx\sharing\includes\functions\is_button_disabled($prefix, $service)) {
44 44
 			return '';
45 45
 		}
46 46
 		$this->service = $service;
@@ -49,42 +49,42 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * Get service link to share.
51 51
 	 */
52
-	public function get_link( $post ) {
53
-		if ( empty( $post ) ) {
52
+	public function get_link($post) {
53
+		if (empty($post)) {
54 54
 			return '';
55 55
 		}
56 56
 
57
-		if ( 'email' === $this->service ) {
58
-			return $this->get_link_email( $post );
59
-		} elseif ( 'facebook' === $this->service ) {
60
-			return $this->get_link_facebook( $post );
61
-		} elseif ( 'twitter' === $this->service ) {
62
-			return $this->get_link_twitter( $post );
63
-		} elseif ( 'pinterest' === $this->service ) {
64
-			return $this->get_link_pinterest( $post );
57
+		if ('email' === $this->service) {
58
+			return $this->get_link_email($post);
59
+		} elseif ('facebook' === $this->service) {
60
+			return $this->get_link_facebook($post);
61
+		} elseif ('twitter' === $this->service) {
62
+			return $this->get_link_twitter($post);
63
+		} elseif ('pinterest' === $this->service) {
64
+			return $this->get_link_pinterest($post);
65 65
 		}
66 66
 	}
67 67
 
68 68
 	/**
69 69
 	 * Get Facebook link to share.
70 70
 	 */
71
-	public function get_link_facebook( $post ) {
72
-		$permalink = get_permalink( $post->ID );
73
-		$permalink = apply_filters( 'lsx_sharing_facebook_url', $permalink, $post );
74
-		$title     = apply_filters( 'the_title', $post->post_title );
71
+	public function get_link_facebook($post) {
72
+		$permalink = get_permalink($post->ID);
73
+		$permalink = apply_filters('lsx_sharing_facebook_url', $permalink, $post);
74
+		$title     = apply_filters('the_title', $post->post_title);
75 75
 
76
-		return 'https://www.facebook.com/sharer.php?display=page&u=' . rawurlencode( $permalink ) . '&t=' . rawurlencode( $title );
76
+		return 'https://www.facebook.com/sharer.php?display=page&u=' . rawurlencode($permalink) . '&t=' . rawurlencode($title);
77 77
 	}
78 78
 
79 79
 	/**
80 80
 	 * Get Twitter link to share.
81 81
 	 */
82
-	public function get_link_twitter( $post ) {
83
-		$permalink = get_permalink( $post->ID );
84
-		$permalink = apply_filters( 'lsx_sharing_twitter_url', $permalink, $post );
85
-		$title     = apply_filters( 'the_title', $post->post_title );
82
+	public function get_link_twitter($post) {
83
+		$permalink = get_permalink($post->ID);
84
+		$permalink = apply_filters('lsx_sharing_twitter_url', $permalink, $post);
85
+		$title     = apply_filters('the_title', $post->post_title);
86 86
 
87
-		if ( function_exists( 'mb_stripos' ) ) {
87
+		if (function_exists('mb_stripos')) {
88 88
 			$strlen = 'mb_strlen';
89 89
 			$substr = 'mb_substr';
90 90
 		} else {
@@ -94,34 +94,34 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$short_url_length = 24;
96 96
 
97
-		if ( ( $strlen( $title ) + $short_url_length ) > 140 ) {
98
-			$text = $substr( $title, 0, ( 140 - $short_url_length - 1 ) ) . "\xE2\x80\xA6";
97
+		if (($strlen($title) + $short_url_length) > 140) {
98
+			$text = $substr($title, 0, (140 - $short_url_length - 1)) . "\xE2\x80\xA6";
99 99
 		} else {
100 100
 			$text = $title;
101 101
 		}
102 102
 
103
-		return 'https://twitter.com/intent/tweet?text=' . rawurlencode( $text ) . '&url=' . rawurlencode( $permalink );
103
+		return 'https://twitter.com/intent/tweet?text=' . rawurlencode($text) . '&url=' . rawurlencode($permalink);
104 104
 	}
105 105
 
106 106
 	/**
107 107
 	 * Get Pinterest link to share.
108 108
 	 */
109
-	public function get_link_pinterest( $post ) {
110
-		$permalink = get_permalink( $post->ID );
111
-		$permalink = apply_filters( 'lsx_sharing_pinterest_url', $permalink, $post );
112
-		$title     = apply_filters( 'the_title', $post->post_title );
113
-
114
-		if ( ! has_post_thumbnail( $post ) ) {
115
-			if ( class_exists( 'lsx\legacy\Placeholders' ) ) {
116
-				$image = lsx\legacy\Placeholders::placeholder_url( null, $post->post_type );
117
-			} elseif ( class_exists( 'LSX_Placeholders' ) ) {
118
-				$image = LSX_Placeholders::placeholder_url( null, $post->post_type );
109
+	public function get_link_pinterest($post) {
110
+		$permalink = get_permalink($post->ID);
111
+		$permalink = apply_filters('lsx_sharing_pinterest_url', $permalink, $post);
112
+		$title     = apply_filters('the_title', $post->post_title);
113
+
114
+		if ( ! has_post_thumbnail($post)) {
115
+			if (class_exists('lsx\legacy\Placeholders')) {
116
+				$image = lsx\legacy\Placeholders::placeholder_url(null, $post->post_type);
117
+			} elseif (class_exists('LSX_Placeholders')) {
118
+				$image = LSX_Placeholders::placeholder_url(null, $post->post_type);
119 119
 			}
120 120
 		} else {
121
-			$image = get_the_post_thumbnail_url( $post->ID, 'large' );
121
+			$image = get_the_post_thumbnail_url($post->ID, 'large');
122 122
 		}
123 123
 
124
-		return 'https://www.pinterest.com/pin/create/button/?url=' . rawurlencode( $permalink ) . '&media=' . rawurlencode( $image ) . '&description=' . rawurlencode( $title );
124
+		return 'https://www.pinterest.com/pin/create/button/?url=' . rawurlencode($permalink) . '&media=' . rawurlencode($image) . '&description=' . rawurlencode($title);
125 125
 	}
126 126
 
127 127
 	/**
Please login to merge, or discard this patch.
classes/admin/class-settings-theme.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 * Contructor
38 38
 	 */
39 39
 	public function __construct() {
40
-		add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 );
41
-		add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 );
42
-		add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 );
43
-		add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 );
44
-		add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 );
45
-		add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 );
46
-		add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 );
47
-		add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 );
40
+		add_filter('cmb2_enqueue_css', array($this, 'disable_cmb2_styles'), 1, 1);
41
+		add_action('cmb2_before_form', array($this, 'generate_navigation'), 10, 4);
42
+		add_action('cmb2_before_title_field_row', array($this, 'output_tab_open_div'), 10, 1);
43
+		add_action('cmb2_after_tab_closing_field_row', array($this, 'output_tab_closing_div'), 10, 1);
44
+		add_action('cmb2_render_tab_closing', array($this, 'cmb2_render_callback_for_tab_closing'), 10, 5);
45
+		add_filter('cmb2_sanitize_tab_closing', array($this, 'cmb2_sanitize_tab_closing_callback'), 10, 2);
46
+		add_action('cmb2_after_form', array($this, 'navigation_js'), 10, 4);
47
+		add_filter('cmb2_options_page_redirect_url', array($this, 'add_tab_argument'), 10, 1);
48 48
 	}
49 49
 
50 50
 	/**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function get_instance() {
58 58
 		// If the single instance hasn't been set, set it now.
59
-		if ( null == self::$instance ) {
59
+		if (null == self::$instance) {
60 60
 			self::$instance = new self();
61 61
 		}
62 62
 		return self::$instance;
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return bool $enabled Whether to enable (enqueue) styles.
69 69
 	 */
70
-	public function disable_cmb2_styles( $enabled ) {
71
-		if ( is_admin() ) {
70
+	public function disable_cmb2_styles($enabled) {
71
+		if (is_admin()) {
72 72
 			$current_screen = get_current_screen();
73
-			if ( is_object( $current_screen ) && 'settings_page_lsx-sharing-settings' === $current_screen->id ) {
73
+			if (is_object($current_screen) && 'settings_page_lsx-sharing-settings' === $current_screen->id) {
74 74
 				$enabled = false;
75 75
 			}
76 76
 		}
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 	 * @param object $cmb2_obj
87 87
 	 * @return void
88 88
 	 */
89
-	public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) {
90
-		if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) {
89
+	public function generate_navigation($cmb_id, $object_id, $object_type, $cmb2_obj) {
90
+		if ('lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type) {
91 91
 			$this->navigation      = array();
92 92
 			$this->is_options_page = true;
93
-			if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) {
94
-				foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) {
95
-					if ( 'title' === $field['type'] ) {
96
-						$this->navigation[ $field_index ] = $field['name'];
93
+			if (isset($cmb2_obj->meta_box['fields']) && ! empty($cmb2_obj->meta_box['fields'])) {
94
+				foreach ($cmb2_obj->meta_box['fields'] as $field_index => $field) {
95
+					if ('title' === $field['type']) {
96
+						$this->navigation[$field_index] = $field['name'];
97 97
 					}
98 98
 				}
99 99
 			}
@@ -107,32 +107,32 @@  discard block
 block discarded – undo
107 107
 	 * @return void
108 108
 	 */
109 109
 	public function output_navigation() {
110
-		if ( ! empty( $this->navigation ) ) {
110
+		if ( ! empty($this->navigation)) {
111 111
 			?>
112 112
 			<div class="wp-filter hide-if-no-js">
113 113
 				<ul class="filter-links">
114 114
 					<?php
115 115
 					$first_tab    = true;
116
-					$total        = count( $this->navigation );
116
+					$total        = count($this->navigation);
117 117
 					$count        = 0;
118 118
 					$separator    = ' |';
119 119
 					$selected_tab = '';
120
-					if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) {
121
-						$selected_tab  = sanitize_text_field( $_GET['cmb_tab'] );
120
+					if (isset($_GET['cmb_tab']) && '' !== $_GET['cmb_tab']) {
121
+						$selected_tab  = sanitize_text_field($_GET['cmb_tab']);
122 122
 						$selected_tab  = 'settings_' . $selected_tab;
123 123
 					}
124
-					foreach ( $this->navigation as $key => $label ) {
124
+					foreach ($this->navigation as $key => $label) {
125 125
 						$count++;
126 126
 						$current_css = '';
127
-						if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) {
127
+						if ((true === $first_tab && '' === $selected_tab) || $key === $selected_tab) {
128 128
 							$first_tab   = false;
129 129
 							$current_css = 'current';
130 130
 						}
131
-						if ( $count === $total ) {
131
+						if ($count === $total) {
132 132
 							$separator = '';
133 133
 						}
134 134
 						?>
135
-							<li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li>
135
+							<li><a href="#" class="<?php echo esc_attr($current_css); ?>" data-sort="<?php echo esc_attr($key); ?>_tab"><?php echo esc_attr($label); ?></a><?php echo esc_attr($separator); ?></li>
136 136
 						<?php
137 137
 					}
138 138
 					?>
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	 * @param object $field CMB2_Field();
149 149
 	 * @return void
150 150
 	 */
151
-	public function output_tab_open_div( $field ) {
152
-		if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) {
151
+	public function output_tab_open_div($field) {
152
+		if (true === $this->is_options_page && isset($field->args['type']) && 'title' === $field->args['type']) {
153 153
 			?>
154
-			<div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden">
154
+			<div id="<?php echo esc_attr($field->args['id']); ?>_tab" class="tab tab-nav hidden">
155 155
 			<?php
156 156
 		}
157 157
 	}
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
 	 * @param object $field CMB2_Field();
163 163
 	 * @return void
164 164
 	 */
165
-	public function output_tab_closing_div( $field ) {
166
-		if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) {
165
+	public function output_tab_closing_div($field) {
166
+		if (true === $this->is_options_page && isset($field->args['type']) && 'tab_closing' === $field->args['type']) {
167 167
 			?>
168 168
 			</div>
169 169
 			<?php
170 170
 		}
171 171
 	}
172 172
 
173
-	public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
173
+	public function cmb2_render_callback_for_tab_closing($field, $escaped_value, $object_id, $object_type, $field_type_object) {
174 174
 		return;
175 175
 	}
176 176
 
177
-	public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) {
177
+	public function cmb2_sanitize_tab_closing_callback($override_value, $value) {
178 178
 		return '';
179 179
 	}
180 180
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @param object $cmb2_obj
188 188
 	 * @return void
189 189
 	 */
190
-	public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) {
191
-		if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) {
190
+	public function navigation_js($cmb_id, $object_id, $object_type, $cmb2_obj) {
191
+		if ('lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type) {
192 192
 			?>
193 193
 			<script>
194 194
 				var LSX_SHARING_CMB2 = Object.create( null );
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
 	 * @param string $url
271 271
 	 * @return void
272 272
 	 */
273
-	public function add_tab_argument( $url ) {
274
-		if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine
275
-			$tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine
276
-			$tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine
277
-			if ( 'single' !== $tab_selection ) {
278
-				$url = add_query_arg( 'cmb_tab', $tab_selection, $url );
273
+	public function add_tab_argument($url) {
274
+		if (isset($_POST['cmb_tab']) && '' !== $_POST['cmb_tab']) { // @codingStandardsIgnoreLine
275
+			$tab_selection = sanitize_text_field($_POST['cmb_tab']); // @codingStandardsIgnoreLine
276
+			$tab_selection = str_replace(array('settings_', '_tab'), '', $tab_selection); // @codingStandardsIgnoreLine
277
+			if ('single' !== $tab_selection) {
278
+				$url = add_query_arg('cmb_tab', $tab_selection, $url);
279 279
 			} else {
280
-				$url = remove_query_arg( 'cmb_tab', $url );
280
+				$url = remove_query_arg('cmb_tab', $url);
281 281
 			}
282 282
 		}
283 283
 		return $url;
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,23 +50,23 @@  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_script( 'lsx-sharing-admin', LSX_SHARING_URL . 'assets/js/src/lsx-sharing-admin.js', array( 'jquery' ), LSX_SHARING_VER, true );
69
-		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_script('lsx-sharing-admin', LSX_SHARING_URL . 'assets/js/src/lsx-sharing-admin.js', array('jquery'), LSX_SHARING_VER, true);
69
+		wp_enqueue_style('lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER);
70 70
 	}
71 71
 
72 72
 	/**
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return  void
76 76
 	 */
77
-	public function configure_general_fields( $cmb ) {
77
+	public function configure_general_fields($cmb) {
78 78
 		$global_args = array(
79
-			'title' => __( 'Global', 'lsx-search' ),
80
-			'desc'  => esc_html__( 'Control the sharing WordPress post types.', 'lsx-search' ),
79
+			'title' => __('Global', 'lsx-search'),
80
+			'desc'  => esc_html__('Control the sharing WordPress post types.', 'lsx-search'),
81 81
 		);
82
-		$this->get_fields( $cmb, 'global', $global_args );
82
+		$this->get_fields($cmb, 'global', $global_args);
83 83
 	}
84 84
 
85 85
 	/**
@@ -89,54 +89,54 @@  discard block
 block discarded – undo
89 89
 	 * @param string $position either top of bottom.
90 90
 	 * @return void
91 91
 	 */
92
-	public function configure_archive_fields( $cmb ) {
92
+	public function configure_archive_fields($cmb) {
93 93
 		$archives       = array();
94 94
 		$post_type_args = array(
95 95
 			'public' => true,
96 96
 		);
97
-		$post_types     = get_post_types( $post_type_args );
98
-		if ( ! empty( $post_types ) ) {
99
-			foreach ( $post_types as $post_type_key => $post_type_value ) {
100
-				switch ( $post_type_key ) {
97
+		$post_types     = get_post_types($post_type_args);
98
+		if ( ! empty($post_types)) {
99
+			foreach ($post_types as $post_type_key => $post_type_value) {
100
+				switch ($post_type_key) {
101 101
 					case 'post':
102 102
 						$page_url      = home_url();
103
-						$page_title    = __( 'Home', 'lsx-search' );
104
-						$show_on_front = get_option( 'show_on_front' );
105
-						if ( 'page' === $show_on_front ) {
106
-							$page_for_posts = get_option( 'page_for_posts' );
107
-							if ( '' !== $page_for_posts ) {
108
-								$page_title   = get_the_title( $page_for_posts );
109
-								$page_url     = get_permalink( $page_for_posts );
103
+						$page_title    = __('Home', 'lsx-search');
104
+						$show_on_front = get_option('show_on_front');
105
+						if ('page' === $show_on_front) {
106
+							$page_for_posts = get_option('page_for_posts');
107
+							if ('' !== $page_for_posts) {
108
+								$page_title   = get_the_title($page_for_posts);
109
+								$page_url     = get_permalink($page_for_posts);
110 110
 							}
111 111
 						}
112 112
 						$description = sprintf(
113 113
 							/* translators: %s: The subscription info */
114
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> posts.', 'lsx-search' ),
114
+							__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> posts.', 'lsx-search'),
115 115
 							$page_url,
116 116
 							$page_title
117 117
 						);
118
-						$archives[ $post_type_key ] = array(
119
-							'title' => __( 'Blog', 'lsx-search' ),
118
+						$archives[$post_type_key] = array(
119
+							'title' => __('Blog', 'lsx-search'),
120 120
 							'desc'  => $description,
121 121
 						);
122 122
 						break;
123 123
 
124 124
 					case 'product':
125 125
 						$page_url = home_url();
126
-						$page_title    = __( 'Shop', 'lsx-search' );
127
-						if ( function_exists( 'wc_get_page_id' ) ) {
128
-							$shop_page  = wc_get_page_id( 'shop' );
129
-							$page_url   = get_permalink( $shop_page );
130
-							$page_title = get_the_title( $shop_page );
126
+						$page_title = __('Shop', 'lsx-search');
127
+						if (function_exists('wc_get_page_id')) {
128
+							$shop_page  = wc_get_page_id('shop');
129
+							$page_url   = get_permalink($shop_page);
130
+							$page_title = get_the_title($shop_page);
131 131
 						}
132 132
 						$description = sprintf(
133 133
 							/* translators: %s: The subscription info */
134
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> product pages.', 'lsx-search' ),
134
+							__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> product pages.', 'lsx-search'),
135 135
 							$page_url,
136 136
 							$page_title
137 137
 						);
138
-						$archives[ $post_type_key ] = array(
139
-							'title' => __( 'Shop', 'lsx-search' ),
138
+						$archives[$post_type_key] = array(
139
+							'title' => __('Shop', 'lsx-search'),
140 140
 							'desc'  => $description,
141 141
 						);
142 142
 						break;
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 						break;
147 147
 
148 148
 					default:
149
-						$temp_post_type = get_post_type_object( $post_type_key );
150
-						if ( ! is_wp_error( $temp_post_type ) ) {
151
-							$page_url    = get_post_type_archive_link( $temp_post_type->name );
149
+						$temp_post_type = get_post_type_object($post_type_key);
150
+						if ( ! is_wp_error($temp_post_type)) {
151
+							$page_url    = get_post_type_archive_link($temp_post_type->name);
152 152
 							$description = sprintf(
153 153
 								/* translators: %s: The subscription info */
154
-								__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search' ),
154
+								__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search'),
155 155
 								$page_url,
156 156
 								$temp_post_type->label
157 157
 							);
158 158
 
159
-							$archives[ $post_type_key ] = array(
159
+							$archives[$post_type_key] = array(
160 160
 								'title' => $temp_post_type->label,
161 161
 								'desc'  => $description,
162 162
 							);
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 				}
166 166
 			}
167 167
 		}
168
-		if ( ! empty( $archives ) ) {
169
-			foreach ( $archives as $archive_key => $archive_args ) {
170
-				$this->get_fields( $cmb, $archive_key, $archive_args );
168
+		if ( ! empty($archives)) {
169
+			foreach ($archives as $archive_key => $archive_args) {
170
+				$this->get_fields($cmb, $archive_key, $archive_args);
171 171
 			}
172 172
 		}
173 173
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @param array $args
181 181
 	 * @return void
182 182
 	 */
183
-	public function get_fields( $cmb, $section, $args ) {
183
+	public function get_fields($cmb, $section, $args) {
184 184
 		$cmb->add_field(
185 185
 			array(
186 186
 				'id'          => 'settings_' . $section . '_sharing',
@@ -190,21 +190,21 @@  discard block
 block discarded – undo
190 190
 				'description' => $args['desc'],
191 191
 			)
192 192
 		);
193
-		if ( 'global' === $section ) {
193
+		if ('global' === $section) {
194 194
 			$cmb->add_field(
195 195
 				array(
196
-					'name'        => esc_html__( 'Disable all', 'lsx-sharing' ),
196
+					'name'        => esc_html__('Disable all', 'lsx-sharing'),
197 197
 					'id'          => $section . '_disable_all',
198
-					'description' => esc_html__( 'Disable all share buttons on the site', 'lsx-sharing' ),
198
+					'description' => esc_html__('Disable all share buttons on the site', 'lsx-sharing'),
199 199
 					'type'        => 'checkbox',
200 200
 				)
201 201
 			);
202 202
 		} else {
203 203
 			$cmb->add_field(
204 204
 				array(
205
-					'name'        => esc_html__( 'Disable', 'lsx-sharing' ) . ' ' . $args['title'],
205
+					'name'        => esc_html__('Disable', 'lsx-sharing') . ' ' . $args['title'],
206 206
 					'id'          => $section . '_disable_pt',
207
-					'description' => esc_html__( 'Disable all share buttons on this post type', 'lsx-sharing' ),
207
+					'description' => esc_html__('Disable all share buttons on this post type', 'lsx-sharing'),
208 208
 					'type'        => 'checkbox',
209 209
 				)
210 210
 			);
@@ -212,44 +212,44 @@  discard block
 block discarded – undo
212 212
 
213 213
 		$cmb->add_field(
214 214
 			array(
215
-				'name'        => esc_html__( 'Label text', 'lsx-sharing' ),
215
+				'name'        => esc_html__('Label text', 'lsx-sharing'),
216 216
 				'id'          => $section . '_label_text',
217
-				'description' => esc_html__( 'A default label for the sharing.', 'lsx-sharing' ),
217
+				'description' => esc_html__('A default label for the sharing.', 'lsx-sharing'),
218 218
 				'type'        => 'text',
219 219
 			)
220 220
 		);
221
-		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'facebook' ) ) ) {
221
+		if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'facebook'))) {
222 222
 			$cmb->add_field(
223 223
 				array(
224
-					'name'        => esc_html__( 'Disable Facebook', 'lsx-sharing' ),
224
+					'name'        => esc_html__('Disable Facebook', 'lsx-sharing'),
225 225
 					'id'          => $section . '_disable_facebook',
226
-					'description' => esc_html__( 'Disable Facebook share button.', 'lsx-sharing' ),
226
+					'description' => esc_html__('Disable Facebook share button.', 'lsx-sharing'),
227 227
 					'type'        => 'checkbox',
228 228
 				)
229 229
 			);
230 230
 		}
231
-		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'twitter' ) ) ) {
231
+		if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'twitter'))) {
232 232
 			$cmb->add_field(
233 233
 				array(
234
-					'name'        => esc_html__( 'Disable Twitter', 'lsx-sharing' ),
234
+					'name'        => esc_html__('Disable Twitter', 'lsx-sharing'),
235 235
 					'id'          => $section . '_disable_twitter',
236
-					'description' => esc_html__( 'Disable Twitter share button.', 'lsx-sharing' ),
236
+					'description' => esc_html__('Disable Twitter share button.', 'lsx-sharing'),
237 237
 					'type'        => 'checkbox',
238 238
 				)
239 239
 			);
240 240
 		}
241
-		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'pinterest' ) ) ) {
241
+		if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'pinterest'))) {
242 242
 			$cmb->add_field(
243 243
 				array(
244
-					'name'        => esc_html__( 'Disable Pinterest', 'lsx-sharing' ),
244
+					'name'        => esc_html__('Disable Pinterest', 'lsx-sharing'),
245 245
 					'id'          => $section . '_disable_pinterest',
246
-					'description' => esc_html__( 'Disable Pinterest button.', 'lsx-sharing' ),
246
+					'description' => esc_html__('Disable Pinterest button.', 'lsx-sharing'),
247 247
 					'type'        => 'checkbox',
248 248
 				)
249 249
 			);
250 250
 		}
251 251
 
252
-		do_action( 'lsx_sharing_settings_section', $cmb, $section );
252
+		do_action('lsx_sharing_settings_section', $cmb, $section);
253 253
 		$cmb->add_field(
254 254
 			array(
255 255
 				'id'   => $section . '_title_closing',
Please login to merge, or discard this patch.
classes/class-admin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 	 */
52 52
 	public static function get_instance() {
53 53
 		// If the single instance hasn't been set, set it now.
54
-		if ( null === self::$instance ) {
54
+		if (null === self::$instance) {
55 55
 			self::$instance = new self();
56 56
 		}
57 57
 		return self::$instance;
Please login to merge, or discard this patch.