Passed
Branch master (8f0f5b)
by Chris
04:16
created
classes/class-sharing.php 2 patches
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -14,114 +14,114 @@
 block discarded – undo
14 14
 class Sharing {
15 15
 
16 16
 
17
-    /**
18
-     * Holds class instance
19
-     *
20
-     * @since 1.0.0
21
-     *
22
-     * @var object \lsx\search\Sharing()
23
-     */
24
-    protected static $instance = null;
17
+	/**
18
+	 * Holds class instance
19
+	 *
20
+	 * @since 1.0.0
21
+	 *
22
+	 * @var object \lsx\search\Sharing()
23
+	 */
24
+	protected static $instance = null;
25 25
 
26
-    /**
27
-     * Holds class instance
28
-     *
29
-     * @since 1.0.0
30
-     *
31
-     * @var object \lsx\search\classes\Admin()
32
-     */
33
-    public $admin = false;
26
+	/**
27
+	 * Holds class instance
28
+	 *
29
+	 * @since 1.0.0
30
+	 *
31
+	 * @var object \lsx\search\classes\Admin()
32
+	 */
33
+	public $admin = false;
34 34
 
35
-    /**
36
-     * If we are using the new options or not.
37
-     *
38
-     * @var boolean
39
-     */
40
-    public $is_new_options = false;
35
+	/**
36
+	 * If we are using the new options or not.
37
+	 *
38
+	 * @var boolean
39
+	 */
40
+	public $is_new_options = false;
41 41
 
42
-    /**
43
-     * The options for the plugin.
44
-     *
45
-     * @var array
46
-     */
47
-    public $options = array();
42
+	/**
43
+	 * The options for the plugin.
44
+	 *
45
+	 * @var array
46
+	 */
47
+	public $options = array();
48 48
 
49
-    /**
50
-     * Constructor.
51
-     */
52
-    public function __construct() {
53
-         add_action('init', array( $this, 'set_options' ), 50);
54
-        $this->load_vendors();
55
-        $this->load_includes();
56
-        $this->load_classes();
57
-    }
49
+	/**
50
+	 * Constructor.
51
+	 */
52
+	public function __construct() {
53
+		 add_action('init', array( $this, 'set_options' ), 50);
54
+		$this->load_vendors();
55
+		$this->load_includes();
56
+		$this->load_classes();
57
+	}
58 58
 
59
-    /**
60
-     * Return an instance of this class.
61
-     *
62
-     * @since 1.0.0
63
-     *
64
-     * @return object \lsx\member_directory\search\Admin()    A single instance of this class.
65
-     */
66
-    public static function get_instance() {
67
-         // If the single instance hasn't been set, set it now.
68
-        if ( null === self::$instance ) {
69
-            self::$instance = new self();
70
-        }
71
-        return self::$instance;
72
-    }
59
+	/**
60
+	 * Return an instance of this class.
61
+	 *
62
+	 * @since 1.0.0
63
+	 *
64
+	 * @return object \lsx\member_directory\search\Admin()    A single instance of this class.
65
+	 */
66
+	public static function get_instance() {
67
+		 // If the single instance hasn't been set, set it now.
68
+		if ( null === self::$instance ) {
69
+			self::$instance = new self();
70
+		}
71
+		return self::$instance;
72
+	}
73 73
 
74
-    /**
75
-     * Loads the plugin functions.
76
-     */
77
-    private function load_vendors() {
78
-         // Configure custom fields.
79
-        if ( ! class_exists('CMB2') ) {
80
-            include_once LSX_SHARING_PATH . 'vendor/CMB2/init.php';
81
-        }
82
-    }
83
-    /**
84
-     * Loads the plugin functions.
85
-     */
86
-    private function load_includes() {
87
-         include_once LSX_SHARING_PATH . '/includes/functions.php';
88
-    }
89
-    /**
90
-     * Loads the plugin functions.
91
-     */
92
-    private function load_classes() {
93
-         include_once LSX_SHARING_PATH . '/classes/class-admin.php';
94
-        global $lsx_sharing_admin;
95
-        $this->admin = \lsx\sharing\classes\Admin::get_instance();
96
-        $lsx_sharing_admin;
74
+	/**
75
+	 * Loads the plugin functions.
76
+	 */
77
+	private function load_vendors() {
78
+		 // Configure custom fields.
79
+		if ( ! class_exists('CMB2') ) {
80
+			include_once LSX_SHARING_PATH . 'vendor/CMB2/init.php';
81
+		}
82
+	}
83
+	/**
84
+	 * Loads the plugin functions.
85
+	 */
86
+	private function load_includes() {
87
+		 include_once LSX_SHARING_PATH . '/includes/functions.php';
88
+	}
89
+	/**
90
+	 * Loads the plugin functions.
91
+	 */
92
+	private function load_classes() {
93
+		 include_once LSX_SHARING_PATH . '/classes/class-admin.php';
94
+		global $lsx_sharing_admin;
95
+		$this->admin = \lsx\sharing\classes\Admin::get_instance();
96
+		$lsx_sharing_admin;
97 97
 
98
-        include_once LSX_SHARING_PATH . '/classes/class-frontend.php';
99
-        $this->frontend = \lsx\sharing\classes\Frontend::get_instance();
100
-        global $lsx_sharing;
101
-        $lsx_sharing = $this->frontend->output;
98
+		include_once LSX_SHARING_PATH . '/classes/class-frontend.php';
99
+		$this->frontend = \lsx\sharing\classes\Frontend::get_instance();
100
+		global $lsx_sharing;
101
+		$lsx_sharing = $this->frontend->output;
102 102
 
103
-        include_once LSX_SHARING_PATH . '/classes/deprecated/class-lsx-sharing.php';
104
-    }
105
-    /**
106
-     * Set options.
107
-     */
108
-    public function set_options() {
109
-         if ( function_exists('tour_operator') ) {
110
-            $this->options = get_option('_lsx-to_settings', false);
111
-        } else {
112
-            $this->options = get_option('_lsx_settings', false);
103
+		include_once LSX_SHARING_PATH . '/classes/deprecated/class-lsx-sharing.php';
104
+	}
105
+	/**
106
+	 * Set options.
107
+	 */
108
+	public function set_options() {
109
+		 if ( function_exists('tour_operator') ) {
110
+			$this->options = get_option('_lsx-to_settings', false);
111
+		} else {
112
+			$this->options = get_option('_lsx_settings', false);
113 113
 
114
-            if ( false === $this->options ) {
115
-                $this->options = get_option('_lsx_lsx-settings', false);
116
-            }
117
-        }
114
+			if ( false === $this->options ) {
115
+				$this->options = get_option('_lsx_lsx-settings', false);
116
+			}
117
+		}
118 118
 
119
-        $new_options = get_option('lsx-sharing-settings');
120
-        if ( ! empty($new_options) ) {
121
-            if ( '' !== $new_options && false !== $new_options ) {
122
-                $this->is_new_options = true;
123
-                $this->options        = $new_options;
124
-            }
125
-        }
126
-    }
119
+		$new_options = get_option('lsx-sharing-settings');
120
+		if ( ! empty($new_options) ) {
121
+			if ( '' !== $new_options && false !== $new_options ) {
122
+				$this->is_new_options = true;
123
+				$this->options        = $new_options;
124
+			}
125
+		}
126
+	}
127 127
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * Constructor.
51 51
      */
52 52
     public function __construct() {
53
-         add_action('init', array( $this, 'set_options' ), 50);
53
+         add_action('init', array($this, 'set_options'), 50);
54 54
         $this->load_vendors();
55 55
         $this->load_includes();
56 56
         $this->load_classes();
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public static function get_instance() {
67 67
          // If the single instance hasn't been set, set it now.
68
-        if ( null === self::$instance ) {
68
+        if (null === self::$instance) {
69 69
             self::$instance = new self();
70 70
         }
71 71
         return self::$instance;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     private function load_vendors() {
78 78
          // Configure custom fields.
79
-        if ( ! class_exists('CMB2') ) {
79
+        if ( ! class_exists('CMB2')) {
80 80
             include_once LSX_SHARING_PATH . 'vendor/CMB2/init.php';
81 81
         }
82 82
     }
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
      * Set options.
107 107
      */
108 108
     public function set_options() {
109
-         if ( function_exists('tour_operator') ) {
109
+         if (function_exists('tour_operator')) {
110 110
             $this->options = get_option('_lsx-to_settings', false);
111 111
         } else {
112 112
             $this->options = get_option('_lsx_settings', false);
113 113
 
114
-            if ( false === $this->options ) {
114
+            if (false === $this->options) {
115 115
                 $this->options = get_option('_lsx_lsx-settings', false);
116 116
             }
117 117
         }
118 118
 
119 119
         $new_options = get_option('lsx-sharing-settings');
120
-        if ( ! empty($new_options) ) {
121
-            if ( '' !== $new_options && false !== $new_options ) {
120
+        if ( ! empty($new_options)) {
121
+            if ('' !== $new_options && false !== $new_options) {
122 122
                 $this->is_new_options = true;
123 123
                 $this->options        = $new_options;
124 124
             }
Please login to merge, or discard this patch.
classes/frontend/class-button.php 2 patches
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -15,118 +15,118 @@
 block discarded – undo
15 15
 class Button {
16 16
 
17 17
 
18
-    /**
19
-     * Services available.
20
-     *
21
-     * @var array
22
-     */
23
-    public $services = array(
18
+	/**
19
+	 * Services available.
20
+	 *
21
+	 * @var array
22
+	 */
23
+	public $services = array(
24 24
 		'facebook',
25 25
 		'twitter',
26 26
 		'pinterest',
27
-    );
28
-
29
-    /**
30
-     * Current service.
31
-     *
32
-     * @var string
33
-     */
34
-    public $service = '';
35
-
36
-    /**
37
-     * Constructor.
38
-     */
39
-    public function __construct( $service, $options, $prefix = 'sharing' ) {
40
-         $this->options = $options;
41
-        if ( ! in_array($service, $this->services, true) ) {
42
-            return;
43
-        }
44
-        if ( \lsx\sharing\includes\functions\is_button_disabled('global', $service) || \lsx\sharing\includes\functions\is_button_disabled($prefix, $service) ) {
45
-            return '';
46
-        }
47
-        $this->service = $service;
48
-    }
49
-
50
-    /**
51
-     * Get service link to share.
52
-     */
53
-    public function get_link( $post ) {
54
-         if ( empty($post) ) {
55
-            return '';
56
-        }
57
-
58
-        if ( 'email' === $this->service ) {
59
-            return $this->get_link_email($post);
60
-        } elseif ( 'facebook' === $this->service ) {
61
-            return $this->get_link_facebook($post);
62
-        } elseif ( 'twitter' === $this->service ) {
63
-            return $this->get_link_twitter($post);
64
-        } elseif ( 'pinterest' === $this->service ) {
65
-            return $this->get_link_pinterest($post);
66
-        }
67
-    }
68
-
69
-    /**
70
-     * Get Facebook link to share.
71
-     */
72
-    public function get_link_facebook( $post ) {
73
-         $permalink = get_permalink($post->ID);
74
-        $permalink = apply_filters('lsx_sharing_facebook_url', $permalink, $post);
75
-        $title     = apply_filters('the_title', $post->post_title);
76
-
77
-        return 'https://www.facebook.com/sharer.php?display=page&u=' . rawurlencode($permalink) . '&t=' . rawurlencode($title);
78
-    }
79
-
80
-    /**
81
-     * Get Twitter link to share.
82
-     */
83
-    public function get_link_twitter( $post ) {
84
-         $permalink = get_permalink($post->ID);
85
-        $permalink = apply_filters('lsx_sharing_twitter_url', $permalink, $post);
86
-        $title     = apply_filters('the_title', $post->post_title);
87
-
88
-        if ( function_exists('mb_stripos') ) {
89
-            $strlen = 'mb_strlen';
90
-            $substr = 'mb_substr';
91
-        } else {
92
-            $strlen = 'strlen';
93
-            $substr = 'substr';
94
-        }
95
-
96
-        $short_url_length = 24;
97
-
98
-        if ( ( $strlen($title) + $short_url_length ) > 140 ) {
99
-            $text = $substr($title, 0, ( 140 - $short_url_length - 1 )) . "\xE2\x80\xA6";
100
-        } else {
101
-            $text = $title;
102
-        }
103
-
104
-        return 'https://twitter.com/intent/tweet?text=' . rawurlencode($text) . '&url=' . rawurlencode($permalink);
105
-    }
106
-
107
-    /**
108
-     * Get Pinterest link to share.
109
-     */
110
-    public function get_link_pinterest( $post ) {
111
-         $permalink = get_permalink($post->ID);
112
-        $permalink = apply_filters('lsx_sharing_pinterest_url', $permalink, $post);
113
-        $title     = apply_filters('the_title', $post->post_title);
114
-
115
-        if ( ! has_post_thumbnail($post) ) {
116
-            if ( class_exists('lsx\legacy\Placeholders') ) {
117
-                $image = \lsx\legacy\Placeholders::placeholder_url(null, $post->post_type);
118
-            } elseif ( class_exists('LSX_Placeholders') ) {
119
-                $image = \LSX_Placeholders::placeholder_url(null, $post->post_type);
120
-            }
121
-        } else {
122
-            $image = get_the_post_thumbnail_url($post->ID, 'large');
123
-        }
124
-
125
-        return 'https://www.pinterest.com/pin/create/button/?url=' . rawurlencode($permalink) . '&media=' . rawurlencode($image) . '&description=' . rawurlencode($title);
126
-    }
127
-
128
-    /**
129
-     * Get Email Link.
130
-     */
131
-    public function get_link_email() {     }
27
+	);
28
+
29
+	/**
30
+	 * Current service.
31
+	 *
32
+	 * @var string
33
+	 */
34
+	public $service = '';
35
+
36
+	/**
37
+	 * Constructor.
38
+	 */
39
+	public function __construct( $service, $options, $prefix = 'sharing' ) {
40
+		 $this->options = $options;
41
+		if ( ! in_array($service, $this->services, true) ) {
42
+			return;
43
+		}
44
+		if ( \lsx\sharing\includes\functions\is_button_disabled('global', $service) || \lsx\sharing\includes\functions\is_button_disabled($prefix, $service) ) {
45
+			return '';
46
+		}
47
+		$this->service = $service;
48
+	}
49
+
50
+	/**
51
+	 * Get service link to share.
52
+	 */
53
+	public function get_link( $post ) {
54
+		 if ( empty($post) ) {
55
+			return '';
56
+		}
57
+
58
+		if ( 'email' === $this->service ) {
59
+			return $this->get_link_email($post);
60
+		} elseif ( 'facebook' === $this->service ) {
61
+			return $this->get_link_facebook($post);
62
+		} elseif ( 'twitter' === $this->service ) {
63
+			return $this->get_link_twitter($post);
64
+		} elseif ( 'pinterest' === $this->service ) {
65
+			return $this->get_link_pinterest($post);
66
+		}
67
+	}
68
+
69
+	/**
70
+	 * Get Facebook link to share.
71
+	 */
72
+	public function get_link_facebook( $post ) {
73
+		 $permalink = get_permalink($post->ID);
74
+		$permalink = apply_filters('lsx_sharing_facebook_url', $permalink, $post);
75
+		$title     = apply_filters('the_title', $post->post_title);
76
+
77
+		return 'https://www.facebook.com/sharer.php?display=page&u=' . rawurlencode($permalink) . '&t=' . rawurlencode($title);
78
+	}
79
+
80
+	/**
81
+	 * Get Twitter link to share.
82
+	 */
83
+	public function get_link_twitter( $post ) {
84
+		 $permalink = get_permalink($post->ID);
85
+		$permalink = apply_filters('lsx_sharing_twitter_url', $permalink, $post);
86
+		$title     = apply_filters('the_title', $post->post_title);
87
+
88
+		if ( function_exists('mb_stripos') ) {
89
+			$strlen = 'mb_strlen';
90
+			$substr = 'mb_substr';
91
+		} else {
92
+			$strlen = 'strlen';
93
+			$substr = 'substr';
94
+		}
95
+
96
+		$short_url_length = 24;
97
+
98
+		if ( ( $strlen($title) + $short_url_length ) > 140 ) {
99
+			$text = $substr($title, 0, ( 140 - $short_url_length - 1 )) . "\xE2\x80\xA6";
100
+		} else {
101
+			$text = $title;
102
+		}
103
+
104
+		return 'https://twitter.com/intent/tweet?text=' . rawurlencode($text) . '&url=' . rawurlencode($permalink);
105
+	}
106
+
107
+	/**
108
+	 * Get Pinterest link to share.
109
+	 */
110
+	public function get_link_pinterest( $post ) {
111
+		 $permalink = get_permalink($post->ID);
112
+		$permalink = apply_filters('lsx_sharing_pinterest_url', $permalink, $post);
113
+		$title     = apply_filters('the_title', $post->post_title);
114
+
115
+		if ( ! has_post_thumbnail($post) ) {
116
+			if ( class_exists('lsx\legacy\Placeholders') ) {
117
+				$image = \lsx\legacy\Placeholders::placeholder_url(null, $post->post_type);
118
+			} elseif ( class_exists('LSX_Placeholders') ) {
119
+				$image = \LSX_Placeholders::placeholder_url(null, $post->post_type);
120
+			}
121
+		} else {
122
+			$image = get_the_post_thumbnail_url($post->ID, 'large');
123
+		}
124
+
125
+		return 'https://www.pinterest.com/pin/create/button/?url=' . rawurlencode($permalink) . '&media=' . rawurlencode($image) . '&description=' . rawurlencode($title);
126
+	}
127
+
128
+	/**
129
+	 * Get Email Link.
130
+	 */
131
+	public function get_link_email() {     }
132 132
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
     /**
37 37
      * Constructor.
38 38
      */
39
-    public function __construct( $service, $options, $prefix = 'sharing' ) {
39
+    public function __construct($service, $options, $prefix = 'sharing') {
40 40
          $this->options = $options;
41
-        if ( ! in_array($service, $this->services, true) ) {
41
+        if ( ! in_array($service, $this->services, true)) {
42 42
             return;
43 43
         }
44
-        if ( \lsx\sharing\includes\functions\is_button_disabled('global', $service) || \lsx\sharing\includes\functions\is_button_disabled($prefix, $service) ) {
44
+        if (\lsx\sharing\includes\functions\is_button_disabled('global', $service) || \lsx\sharing\includes\functions\is_button_disabled($prefix, $service)) {
45 45
             return '';
46 46
         }
47 47
         $this->service = $service;
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
     /**
51 51
      * Get service link to share.
52 52
      */
53
-    public function get_link( $post ) {
54
-         if ( empty($post) ) {
53
+    public function get_link($post) {
54
+         if (empty($post)) {
55 55
             return '';
56 56
         }
57 57
 
58
-        if ( 'email' === $this->service ) {
58
+        if ('email' === $this->service) {
59 59
             return $this->get_link_email($post);
60
-        } elseif ( 'facebook' === $this->service ) {
60
+        } elseif ('facebook' === $this->service) {
61 61
             return $this->get_link_facebook($post);
62
-        } elseif ( 'twitter' === $this->service ) {
62
+        } elseif ('twitter' === $this->service) {
63 63
             return $this->get_link_twitter($post);
64
-        } elseif ( 'pinterest' === $this->service ) {
64
+        } elseif ('pinterest' === $this->service) {
65 65
             return $this->get_link_pinterest($post);
66 66
         }
67 67
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * Get Facebook link to share.
71 71
      */
72
-    public function get_link_facebook( $post ) {
72
+    public function get_link_facebook($post) {
73 73
          $permalink = get_permalink($post->ID);
74 74
         $permalink = apply_filters('lsx_sharing_facebook_url', $permalink, $post);
75 75
         $title     = apply_filters('the_title', $post->post_title);
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
     /**
81 81
      * Get Twitter link to share.
82 82
      */
83
-    public function get_link_twitter( $post ) {
83
+    public function get_link_twitter($post) {
84 84
          $permalink = get_permalink($post->ID);
85 85
         $permalink = apply_filters('lsx_sharing_twitter_url', $permalink, $post);
86 86
         $title     = apply_filters('the_title', $post->post_title);
87 87
 
88
-        if ( function_exists('mb_stripos') ) {
88
+        if (function_exists('mb_stripos')) {
89 89
             $strlen = 'mb_strlen';
90 90
             $substr = 'mb_substr';
91 91
         } else {
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 
96 96
         $short_url_length = 24;
97 97
 
98
-        if ( ( $strlen($title) + $short_url_length ) > 140 ) {
99
-            $text = $substr($title, 0, ( 140 - $short_url_length - 1 )) . "\xE2\x80\xA6";
98
+        if (($strlen($title) + $short_url_length) > 140) {
99
+            $text = $substr($title, 0, (140 - $short_url_length - 1)) . "\xE2\x80\xA6";
100 100
         } else {
101 101
             $text = $title;
102 102
         }
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
     /**
108 108
      * Get Pinterest link to share.
109 109
      */
110
-    public function get_link_pinterest( $post ) {
110
+    public function get_link_pinterest($post) {
111 111
          $permalink = get_permalink($post->ID);
112 112
         $permalink = apply_filters('lsx_sharing_pinterest_url', $permalink, $post);
113 113
         $title     = apply_filters('the_title', $post->post_title);
114 114
 
115
-        if ( ! has_post_thumbnail($post) ) {
116
-            if ( class_exists('lsx\legacy\Placeholders') ) {
115
+        if ( ! has_post_thumbnail($post)) {
116
+            if (class_exists('lsx\legacy\Placeholders')) {
117 117
                 $image = \lsx\legacy\Placeholders::placeholder_url(null, $post->post_type);
118
-            } elseif ( class_exists('LSX_Placeholders') ) {
118
+            } elseif (class_exists('LSX_Placeholders')) {
119 119
                 $image = \LSX_Placeholders::placeholder_url(null, $post->post_type);
120 120
             }
121 121
         } else {
Please login to merge, or discard this patch.
classes/frontend/class-output.php 2 patches
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -9,223 +9,223 @@
 block discarded – undo
9 9
 class Output {
10 10
 
11 11
 
12
-    /**
13
-     * Holds class instance
14
-     *
15
-     * @since 1.0.0
16
-     *
17
-     * @var object \lsx\sharing\classes\frontend\Output()
18
-     */
19
-    protected static $instance = null;
20
-
21
-    /**
22
-     * Contructor
23
-     */
24
-    public function __construct() {
25
-         add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5);
26
-        add_filter('wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2);
27
-        add_shortcode('lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' ));
28
-        // Storefront (storefront_loop_post, storefront_single_post).
29
-        add_action('storefront_post_content_before', array( $this, 'sharing_buttons_template' ), 20);
30
-        // WooCommerce.
31
-        add_action('woocommerce_share', array( $this, 'sharing_buttons_template' ));
32
-
33
-        // General Post Types.
34
-        add_action('lsx_entry_after', array( $this, 'output_sharing' ));
35
-
36
-        // Tribe Events.
37
-        add_filter('tribe_events_ical_single_event_links', array( $this, 'output_event_sharing' ), 10, 1);
38
-
39
-        // Sensei Integration.
40
-        add_action('sensei_pagination', array( $this, 'output_sharing' ), 20);
41
-    }
42
-
43
-    /**
44
-     * Return an instance of this class.
45
-     *
46
-     * @since 1.0.0
47
-     *
48
-     * @return object \lsx\sharing\classes\frontend\Output()    A single instance of this class.
49
-     */
50
-    public static function get_instance() {
51
-         // If the single instance hasn't been set, set it now.
52
-        if ( null == self::$instance ) {
53
-            self::$instance = new self();
54
-        }
55
-        return self::$instance;
56
-    }
57
-
58
-    /**
59
-     * Enques the assets.
60
-     */
61
-    public function assets() {
62
-         if ( defined('WP_DEBUG') && true === WP_DEBUG ) {
63
-            $min = '';
64
-        } else {
65
-            $min = '.min';
66
-        }
67
-        /* Remove assets completely if all sharing options are off */
68
-
69
-        if ( \lsx\sharing\includes\functions\is_disabled() ) {
70
-            return '';
71
-        }
72
-
73
-        // Set our variables.
74
-        $post_type = get_post_type();
75
-
76
-        /* Only show the assets if the post type sharing option is on */
77
-        if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) {
78
-
79
-            wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true);
80
-
81
-            $params = apply_filters(
82
-                'lsx_sharing_js_params', array(
12
+	/**
13
+	 * Holds class instance
14
+	 *
15
+	 * @since 1.0.0
16
+	 *
17
+	 * @var object \lsx\sharing\classes\frontend\Output()
18
+	 */
19
+	protected static $instance = null;
20
+
21
+	/**
22
+	 * Contructor
23
+	 */
24
+	public function __construct() {
25
+		 add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5);
26
+		add_filter('wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2);
27
+		add_shortcode('lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' ));
28
+		// Storefront (storefront_loop_post, storefront_single_post).
29
+		add_action('storefront_post_content_before', array( $this, 'sharing_buttons_template' ), 20);
30
+		// WooCommerce.
31
+		add_action('woocommerce_share', array( $this, 'sharing_buttons_template' ));
32
+
33
+		// General Post Types.
34
+		add_action('lsx_entry_after', array( $this, 'output_sharing' ));
35
+
36
+		// Tribe Events.
37
+		add_filter('tribe_events_ical_single_event_links', array( $this, 'output_event_sharing' ), 10, 1);
38
+
39
+		// Sensei Integration.
40
+		add_action('sensei_pagination', array( $this, 'output_sharing' ), 20);
41
+	}
42
+
43
+	/**
44
+	 * Return an instance of this class.
45
+	 *
46
+	 * @since 1.0.0
47
+	 *
48
+	 * @return object \lsx\sharing\classes\frontend\Output()    A single instance of this class.
49
+	 */
50
+	public static function get_instance() {
51
+		 // If the single instance hasn't been set, set it now.
52
+		if ( null == self::$instance ) {
53
+			self::$instance = new self();
54
+		}
55
+		return self::$instance;
56
+	}
57
+
58
+	/**
59
+	 * Enques the assets.
60
+	 */
61
+	public function assets() {
62
+		 if ( defined('WP_DEBUG') && true === WP_DEBUG ) {
63
+			$min = '';
64
+		} else {
65
+			$min = '.min';
66
+		}
67
+		/* Remove assets completely if all sharing options are off */
68
+
69
+		if ( \lsx\sharing\includes\functions\is_disabled() ) {
70
+			return '';
71
+		}
72
+
73
+		// Set our variables.
74
+		$post_type = get_post_type();
75
+
76
+		/* Only show the assets if the post type sharing option is on */
77
+		if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) {
78
+
79
+			wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true);
80
+
81
+			$params = apply_filters(
82
+				'lsx_sharing_js_params', array(
83 83
 					'ajax_url' => admin_url('admin-ajax.php'),
84
-                )
85
-            );
86
-
87
-            wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params);
88
-
89
-            wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER);
90
-            wp_style_add_data('lsx-sharing', 'rtl', 'replace');
91
-        }
92
-    }
93
-
94
-    /**
95
-     * Display/return sharing buttons.
96
-     */
97
-    public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
98
-         $sharing_content = '';
99
-
100
-        if ( ( is_preview() || is_admin() ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) {
101
-            return '';
102
-        }
103
-
104
-        if ( empty($this->options) ) {
105
-            $this->options = array();
106
-        }
107
-
108
-        //Set our variables
109
-        global $post;
110
-        $share_post = $post;
111
-        if ( false !== $post_id ) {
112
-            $share_post = get_post($post_id);
113
-            $post_type = get_post_type($post_id);
114
-        } else {
115
-            $post_type = get_post_type();
116
-        }
117
-
118
-        if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) {
119
-            return '';
120
-        }
121
-
122
-        if ( ( is_array($buttons) && count($buttons) > 0 ) ) {
123
-            $sharing_content .= '<div class="lsx-sharing-content"><p>';
124
-
125
-            $sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type);
126
-            if ( '' !== $sharing_text ) {
127
-                $sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>';
128
-            }
129
-
130
-            foreach ( $buttons as $id => $button ) {
131
-                $button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type);
132
-
133
-                if ( ! empty($button_obj) ) {
134
-                    $url = $button_obj->get_link($share_post);
135
-
136
-                    if ( ! empty($url) ) {
137
-                        if ( 'email' === $button ) {
138
-                            if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id']) ) {
139
-                                continue;
140
-                            }
141
-                            $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>';
142
-                        } else {
143
-                            $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>';
144
-                        }
145
-                    }
146
-                }
147
-            }
148
-            $sharing_content .= '</p></div>';
149
-        }
150
-
151
-        if ( $echo ) {
152
-            echo wp_kses_post($sharing_content);
153
-        } else {
154
-            return $sharing_content;
155
-        }
156
-    }
157
-
158
-    /**
159
-     * Sharing buttons shortcode.
160
-     */
161
-    public function sharing_buttons_shortcode( $atts ) {
162
-         $atts = shortcode_atts(
163
-            array(
84
+				)
85
+			);
86
+
87
+			wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params);
88
+
89
+			wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER);
90
+			wp_style_add_data('lsx-sharing', 'rtl', 'replace');
91
+		}
92
+	}
93
+
94
+	/**
95
+	 * Display/return sharing buttons.
96
+	 */
97
+	public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
98
+		 $sharing_content = '';
99
+
100
+		if ( ( is_preview() || is_admin() ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) {
101
+			return '';
102
+		}
103
+
104
+		if ( empty($this->options) ) {
105
+			$this->options = array();
106
+		}
107
+
108
+		//Set our variables
109
+		global $post;
110
+		$share_post = $post;
111
+		if ( false !== $post_id ) {
112
+			$share_post = get_post($post_id);
113
+			$post_type = get_post_type($post_id);
114
+		} else {
115
+			$post_type = get_post_type();
116
+		}
117
+
118
+		if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) {
119
+			return '';
120
+		}
121
+
122
+		if ( ( is_array($buttons) && count($buttons) > 0 ) ) {
123
+			$sharing_content .= '<div class="lsx-sharing-content"><p>';
124
+
125
+			$sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type);
126
+			if ( '' !== $sharing_text ) {
127
+				$sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>';
128
+			}
129
+
130
+			foreach ( $buttons as $id => $button ) {
131
+				$button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type);
132
+
133
+				if ( ! empty($button_obj) ) {
134
+					$url = $button_obj->get_link($share_post);
135
+
136
+					if ( ! empty($url) ) {
137
+						if ( 'email' === $button ) {
138
+							if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id']) ) {
139
+								continue;
140
+							}
141
+							$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>';
142
+						} else {
143
+							$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>';
144
+						}
145
+					}
146
+				}
147
+			}
148
+			$sharing_content .= '</p></div>';
149
+		}
150
+
151
+		if ( $echo ) {
152
+			echo wp_kses_post($sharing_content);
153
+		} else {
154
+			return $sharing_content;
155
+		}
156
+	}
157
+
158
+	/**
159
+	 * Sharing buttons shortcode.
160
+	 */
161
+	public function sharing_buttons_shortcode( $atts ) {
162
+		 $atts = shortcode_atts(
163
+			array(
164 164
 				'buttons' => '',
165
-            ), $atts, 'lsx_sharing_buttons' 
166
-        );
167
-
168
-        if ( empty($atts['buttons']) ) {
169
-            return '';
170
-        }
171
-
172
-        $no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING));
173
-        $buttons        = explode(',', $no_whitespaces);
174
-
175
-        if ( is_array($buttons) && count($buttons) > 0 ) {
176
-            return $this->sharing_buttons($buttons);
177
-        }
178
-    }
179
-
180
-    /**
181
-     * Display buttons (template hook).
182
-     */
183
-    public function sharing_buttons_template() {
184
-         echo wp_kses_post($this->sharing_buttons());
185
-    }
186
-
187
-    /**
188
-     * Allow data params for Bootstrap modal.
189
-     */
190
-    public function wp_kses_allowed_html( $allowedtags, $context ) {
191
-         $allowedtags['a']['data-toggle'] = true;
192
-        $allowedtags['a']['data-link']   = true;
193
-        return $allowedtags;
194
-    }
195
-
196
-    /**
197
-     * Outputs the sharing to the templates.
198
-     *
199
-     * @return void
200
-     */
201
-    public function output_sharing() {
202
-         if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) {
203
-
204
-            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()) ) {
205
-                return '';
206
-            }
207
-            ?>
165
+			), $atts, 'lsx_sharing_buttons' 
166
+		);
167
+
168
+		if ( empty($atts['buttons']) ) {
169
+			return '';
170
+		}
171
+
172
+		$no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING));
173
+		$buttons        = explode(',', $no_whitespaces);
174
+
175
+		if ( is_array($buttons) && count($buttons) > 0 ) {
176
+			return $this->sharing_buttons($buttons);
177
+		}
178
+	}
179
+
180
+	/**
181
+	 * Display buttons (template hook).
182
+	 */
183
+	public function sharing_buttons_template() {
184
+		 echo wp_kses_post($this->sharing_buttons());
185
+	}
186
+
187
+	/**
188
+	 * Allow data params for Bootstrap modal.
189
+	 */
190
+	public function wp_kses_allowed_html( $allowedtags, $context ) {
191
+		 $allowedtags['a']['data-toggle'] = true;
192
+		$allowedtags['a']['data-link']   = true;
193
+		return $allowedtags;
194
+	}
195
+
196
+	/**
197
+	 * Outputs the sharing to the templates.
198
+	 *
199
+	 * @return void
200
+	 */
201
+	public function output_sharing() {
202
+		 if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) {
203
+
204
+			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()) ) {
205
+				return '';
206
+			}
207
+			?>
208 208
             <footer class="lsx-sharing-wrapper footer-meta clearfix">
209 209
                 <div class="post-tags-wrapper">
210 210
             <?php $this->sharing_buttons_template(); ?>
211 211
                 </div>
212 212
             </footer><!-- .footer-meta -->
213 213
             <?php
214
-        }
215
-    }
216
-
217
-    /**
218
-     * Outputs the sharing below the events.
219
-     *
220
-     * @param  string $ical_links
221
-     * @return string
222
-     */
223
-    public function output_event_sharing( $ical_links = '' ) {
224
-         if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) {
225
-            return '';
226
-        } else {
227
-            $ical_links .= $this->sharing_buttons();
228
-        }
229
-        return $ical_links;
230
-    }
214
+		}
215
+	}
216
+
217
+	/**
218
+	 * Outputs the sharing below the events.
219
+	 *
220
+	 * @param  string $ical_links
221
+	 * @return string
222
+	 */
223
+	public function output_event_sharing( $ical_links = '' ) {
224
+		 if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) {
225
+			return '';
226
+		} else {
227
+			$ical_links .= $this->sharing_buttons();
228
+		}
229
+		return $ical_links;
230
+	}
231 231
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -22,22 +22,22 @@  discard block
 block discarded – undo
22 22
      * Contructor
23 23
      */
24 24
     public function __construct() {
25
-         add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5);
26
-        add_filter('wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2);
27
-        add_shortcode('lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' ));
25
+         add_action('wp_enqueue_scripts', array($this, 'assets'), 5);
26
+        add_filter('wp_kses_allowed_html', array($this, 'wp_kses_allowed_html'), 10, 2);
27
+        add_shortcode('lsx_sharing_buttons', array($this, 'sharing_buttons_shortcode'));
28 28
         // Storefront (storefront_loop_post, storefront_single_post).
29
-        add_action('storefront_post_content_before', array( $this, 'sharing_buttons_template' ), 20);
29
+        add_action('storefront_post_content_before', array($this, 'sharing_buttons_template'), 20);
30 30
         // WooCommerce.
31
-        add_action('woocommerce_share', array( $this, 'sharing_buttons_template' ));
31
+        add_action('woocommerce_share', array($this, 'sharing_buttons_template'));
32 32
 
33 33
         // General Post Types.
34
-        add_action('lsx_entry_after', array( $this, 'output_sharing' ));
34
+        add_action('lsx_entry_after', array($this, 'output_sharing'));
35 35
 
36 36
         // Tribe Events.
37
-        add_filter('tribe_events_ical_single_event_links', array( $this, 'output_event_sharing' ), 10, 1);
37
+        add_filter('tribe_events_ical_single_event_links', array($this, 'output_event_sharing'), 10, 1);
38 38
 
39 39
         // Sensei Integration.
40
-        add_action('sensei_pagination', array( $this, 'output_sharing' ), 20);
40
+        add_action('sensei_pagination', array($this, 'output_sharing'), 20);
41 41
     }
42 42
 
43 43
     /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public static function get_instance() {
51 51
          // If the single instance hasn't been set, set it now.
52
-        if ( null == self::$instance ) {
52
+        if (null == self::$instance) {
53 53
             self::$instance = new self();
54 54
         }
55 55
         return self::$instance;
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
      * Enques the assets.
60 60
      */
61 61
     public function assets() {
62
-         if ( defined('WP_DEBUG') && true === WP_DEBUG ) {
62
+         if (defined('WP_DEBUG') && true === WP_DEBUG) {
63 63
             $min = '';
64 64
         } else {
65 65
             $min = '.min';
66 66
         }
67 67
         /* Remove assets completely if all sharing options are off */
68 68
 
69
-        if ( \lsx\sharing\includes\functions\is_disabled() ) {
69
+        if (\lsx\sharing\includes\functions\is_disabled()) {
70 70
             return '';
71 71
         }
72 72
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
         $post_type = get_post_type();
75 75
 
76 76
         /* Only show the assets if the post type sharing option is on */
77
-        if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) {
77
+        if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type)) {
78 78
 
79
-            wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true);
79
+            wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array('jquery'), LSX_SHARING_VER, true);
80 80
 
81 81
             $params = apply_filters(
82 82
                 'lsx_sharing_js_params', array(
@@ -94,48 +94,48 @@  discard block
 block discarded – undo
94 94
     /**
95 95
      * Display/return sharing buttons.
96 96
      */
97
-    public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
97
+    public function sharing_buttons($buttons = array('facebook', 'twitter', 'pinterest'), $echo = false, $post_id = false) {
98 98
          $sharing_content = '';
99 99
 
100
-        if ( ( is_preview() || is_admin() ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) {
100
+        if ((is_preview() || is_admin()) && ! (defined('DOING_AJAX') && DOING_AJAX)) {
101 101
             return '';
102 102
         }
103 103
 
104
-        if ( empty($this->options) ) {
104
+        if (empty($this->options)) {
105 105
             $this->options = array();
106 106
         }
107 107
 
108 108
         //Set our variables
109 109
         global $post;
110 110
         $share_post = $post;
111
-        if ( false !== $post_id ) {
111
+        if (false !== $post_id) {
112 112
             $share_post = get_post($post_id);
113 113
             $post_type = get_post_type($post_id);
114 114
         } else {
115 115
             $post_type = get_post_type();
116 116
         }
117 117
 
118
-        if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) {
118
+        if (\lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type)) {
119 119
             return '';
120 120
         }
121 121
 
122
-        if ( ( is_array($buttons) && count($buttons) > 0 ) ) {
122
+        if ((is_array($buttons) && count($buttons) > 0)) {
123 123
             $sharing_content .= '<div class="lsx-sharing-content"><p>';
124 124
 
125 125
             $sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type);
126
-            if ( '' !== $sharing_text ) {
126
+            if ('' !== $sharing_text) {
127 127
                 $sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>';
128 128
             }
129 129
 
130
-            foreach ( $buttons as $id => $button ) {
130
+            foreach ($buttons as $id => $button) {
131 131
                 $button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type);
132 132
 
133
-                if ( ! empty($button_obj) ) {
133
+                if ( ! empty($button_obj)) {
134 134
                     $url = $button_obj->get_link($share_post);
135 135
 
136
-                    if ( ! empty($url) ) {
137
-                        if ( 'email' === $button ) {
138
-                            if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id']) ) {
136
+                    if ( ! empty($url)) {
137
+                        if ('email' === $button) {
138
+                            if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id'])) {
139 139
                                 continue;
140 140
                             }
141 141
                             $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>';
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             $sharing_content .= '</p></div>';
149 149
         }
150 150
 
151
-        if ( $echo ) {
151
+        if ($echo) {
152 152
             echo wp_kses_post($sharing_content);
153 153
         } else {
154 154
             return $sharing_content;
@@ -158,21 +158,21 @@  discard block
 block discarded – undo
158 158
     /**
159 159
      * Sharing buttons shortcode.
160 160
      */
161
-    public function sharing_buttons_shortcode( $atts ) {
161
+    public function sharing_buttons_shortcode($atts) {
162 162
          $atts = shortcode_atts(
163 163
             array(
164 164
 				'buttons' => '',
165 165
             ), $atts, 'lsx_sharing_buttons' 
166 166
         );
167 167
 
168
-        if ( empty($atts['buttons']) ) {
168
+        if (empty($atts['buttons'])) {
169 169
             return '';
170 170
         }
171 171
 
172 172
         $no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING));
173 173
         $buttons        = explode(',', $no_whitespaces);
174 174
 
175
-        if ( is_array($buttons) && count($buttons) > 0 ) {
175
+        if (is_array($buttons) && count($buttons) > 0) {
176 176
             return $this->sharing_buttons($buttons);
177 177
         }
178 178
     }
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     /**
188 188
      * Allow data params for Bootstrap modal.
189 189
      */
190
-    public function wp_kses_allowed_html( $allowedtags, $context ) {
190
+    public function wp_kses_allowed_html($allowedtags, $context) {
191 191
          $allowedtags['a']['data-toggle'] = true;
192
-        $allowedtags['a']['data-link']   = true;
192
+        $allowedtags['a']['data-link'] = true;
193 193
         return $allowedtags;
194 194
     }
195 195
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
      * @return void
200 200
      */
201 201
     public function output_sharing() {
202
-         if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) {
202
+         if (is_main_query() && is_single() && ! is_singular(array('post', 'page', 'product'))) {
203 203
 
204
-            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()) ) {
204
+            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())) {
205 205
                 return '';
206 206
             }
207 207
             ?>
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
      * @param  string $ical_links
221 221
      * @return string
222 222
      */
223
-    public function output_event_sharing( $ical_links = '' ) {
224
-         if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) {
223
+    public function output_event_sharing($ical_links = '') {
224
+         if (\lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type())) {
225 225
             return '';
226 226
         } else {
227 227
             $ical_links .= $this->sharing_buttons();
Please login to merge, or discard this patch.
classes/class-frontend.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -15,59 +15,59 @@
 block discarded – undo
15 15
 class Frontend {
16 16
 
17 17
 
18
-    /**
19
-     * Holds class instance
20
-     *
21
-     * @since 1.0.0
22
-     *
23
-     * @var object \lsx\sharing\classes\Frontend()
24
-     */
25
-    protected static $instance = null;
18
+	/**
19
+	 * Holds class instance
20
+	 *
21
+	 * @since 1.0.0
22
+	 *
23
+	 * @var object \lsx\sharing\classes\Frontend()
24
+	 */
25
+	protected static $instance = null;
26 26
 
27
-    /**
28
-     * Holds the output class.
29
-     *
30
-     * @var object \lsx\sharing\classes\frontend\Output()
31
-     */
32
-    public $output = null;
27
+	/**
28
+	 * Holds the output class.
29
+	 *
30
+	 * @var object \lsx\sharing\classes\frontend\Output()
31
+	 */
32
+	public $output = null;
33 33
 
34
-    /**
35
-     * Constructor.
36
-     */
37
-    public function __construct() {
38
-         $this->load_classes();
34
+	/**
35
+	 * Constructor.
36
+	 */
37
+	public function __construct() {
38
+		 $this->load_classes();
39 39
 
40
-    }
40
+	}
41 41
 
42
-    /**
43
-     * Return an instance of this class.
44
-     *
45
-     * @since 1.0.0
46
-     *
47
-     * @return object \lsx\sharing\classes\Frontend()    A single instance of this class.
48
-     */
49
-    public static function get_instance() {
50
-         // If the single instance hasn't been set, set it now.
51
-        if ( null == self::$instance ) {
52
-            self::$instance = new self();
53
-        }
54
-        return self::$instance;
55
-    }
42
+	/**
43
+	 * Return an instance of this class.
44
+	 *
45
+	 * @since 1.0.0
46
+	 *
47
+	 * @return object \lsx\sharing\classes\Frontend()    A single instance of this class.
48
+	 */
49
+	public static function get_instance() {
50
+		 // If the single instance hasn't been set, set it now.
51
+		if ( null == self::$instance ) {
52
+			self::$instance = new self();
53
+		}
54
+		return self::$instance;
55
+	}
56 56
 
57
-    /**
58
-     * Loads the plugin functions.
59
-     */
60
-    private function load_classes() {
61
-         include_once LSX_SHARING_PATH . '/classes/frontend/class-button.php';
62
-        include_once LSX_SHARING_PATH . '/classes/frontend/class-output.php';
63
-        $this->output = \lsx\sharing\classes\frontend\Output::get_instance();
64
-    }
57
+	/**
58
+	 * Loads the plugin functions.
59
+	 */
60
+	private function load_classes() {
61
+		 include_once LSX_SHARING_PATH . '/classes/frontend/class-button.php';
62
+		include_once LSX_SHARING_PATH . '/classes/frontend/class-output.php';
63
+		$this->output = \lsx\sharing\classes\frontend\Output::get_instance();
64
+	}
65 65
 
66
-    /**
67
-     * Backwards compatabile function for the sharing buttons.
68
-     */
69
-    public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
70
-         wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()');
71
-        $this->output->sharing_buttons($buttons, $echo, $post_id);
72
-    }
66
+	/**
67
+	 * Backwards compatabile function for the sharing buttons.
68
+	 */
69
+	public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
70
+		 wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()');
71
+		$this->output->sharing_buttons($buttons, $echo, $post_id);
72
+	}
73 73
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -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;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     /**
67 67
      * Backwards compatabile function for the sharing buttons.
68 68
      */
69
-    public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
69
+    public function sharing_buttons($buttons = array('facebook', 'twitter', 'pinterest'), $echo = false, $post_id = false) {
70 70
          wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()');
71 71
         $this->output->sharing_buttons($buttons, $echo, $post_id);
72 72
     }
Please login to merge, or discard this patch.
classes/deprecated/class-lsx-sharing.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
  */
11 11
 class LSX_Sharing {
12 12
 
13
-    /**
14
-     * Constructor.
15
-     */
16
-    public function __construct() {
17
-         return lsx_sharing();
18
-    }
13
+	/**
14
+	 * Constructor.
15
+	 */
16
+	public function __construct() {
17
+		 return lsx_sharing();
18
+	}
19 19
 }
Please login to merge, or discard this patch.
classes/class-admin.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -15,56 +15,56 @@
 block discarded – undo
15 15
 class Admin {
16 16
 
17 17
 
18
-    /**
19
-     * Holds class instance.
20
-     *
21
-     * @var object \lsx\sharing\classes\Admin()
22
-     */
23
-    protected static $instance = null;
18
+	/**
19
+	 * Holds class instance.
20
+	 *
21
+	 * @var object \lsx\sharing\classes\Admin()
22
+	 */
23
+	protected static $instance = null;
24 24
 
25
-    /**
26
-     * Holds Settings Theme Instance
27
-     *
28
-     * @var object \lsx\sharing\classes\admin\Settings_Theme()
29
-     */
30
-    public $settings_theme = false;
25
+	/**
26
+	 * Holds Settings Theme Instance
27
+	 *
28
+	 * @var object \lsx\sharing\classes\admin\Settings_Theme()
29
+	 */
30
+	public $settings_theme = false;
31 31
 
32
-    /**
33
-     * Holds Settings Instance
34
-     *
35
-     * @var object \lsx\sharing\classes\admin\Settings()
36
-     */
37
-    public $settings = false;
32
+	/**
33
+	 * Holds Settings Instance
34
+	 *
35
+	 * @var object \lsx\sharing\classes\admin\Settings()
36
+	 */
37
+	public $settings = false;
38 38
 
39
-    /**
40
-     * Constructor.
41
-     */
42
-    public function __construct() {
43
-         $this->load_classes();
44
-    }
39
+	/**
40
+	 * Constructor.
41
+	 */
42
+	public function __construct() {
43
+		 $this->load_classes();
44
+	}
45 45
 
46
-    /**
47
-     * Return an instance of this class.
48
-     *
49
-     * @since 1.0.0
50
-     *
51
-     * @return object \lsx\sharing\Admin()    A single instance of this class.
52
-     */
53
-    public static function get_instance() {
54
-         // If the single instance hasn't been set, set it now.
55
-        if ( null === self::$instance ) {
56
-            self::$instance = new self();
57
-        }
58
-        return self::$instance;
59
-    }
46
+	/**
47
+	 * Return an instance of this class.
48
+	 *
49
+	 * @since 1.0.0
50
+	 *
51
+	 * @return object \lsx\sharing\Admin()    A single instance of this class.
52
+	 */
53
+	public static function get_instance() {
54
+		 // If the single instance hasn't been set, set it now.
55
+		if ( null === self::$instance ) {
56
+			self::$instance = new self();
57
+		}
58
+		return self::$instance;
59
+	}
60 60
 
61
-    /**
62
-     * Loads the plugin functions.
63
-     */
64
-    private function load_classes() {
65
-         include_once LSX_SHARING_PATH . '/classes/admin/class-settings-theme.php';
66
-        $this->settings_theme = \lsx\sharing\classes\admin\Settings_Theme::get_instance();
67
-        include_once LSX_SHARING_PATH . '/classes/admin/class-settings.php';
68
-        $this->settings = \lsx\sharing\classes\admin\Settings::get_instance();
69
-    }
61
+	/**
62
+	 * Loads the plugin functions.
63
+	 */
64
+	private function load_classes() {
65
+		 include_once LSX_SHARING_PATH . '/classes/admin/class-settings-theme.php';
66
+		$this->settings_theme = \lsx\sharing\classes\admin\Settings_Theme::get_instance();
67
+		include_once LSX_SHARING_PATH . '/classes/admin/class-settings.php';
68
+		$this->settings = \lsx\sharing\classes\admin\Settings::get_instance();
69
+	}
70 70
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      */
53 53
     public static function get_instance() {
54 54
          // If the single instance hasn't been set, set it now.
55
-        if ( null === self::$instance ) {
55
+        if (null === self::$instance) {
56 56
             self::$instance = new self();
57 57
         }
58 58
         return self::$instance;
Please login to merge, or discard this patch.
classes/admin/class-settings.php 3 patches
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -9,47 +9,47 @@  discard block
 block discarded – undo
9 9
 class Settings {
10 10
 
11 11
 
12
-    /**
13
-     * Holds class instance
14
-     *
15
-     * @since 1.0.0
16
-     *
17
-     * @var object \lsx\sharing\classes\admin\Settings()
18
-     */
19
-    protected static $instance = null;
12
+	/**
13
+	 * Holds class instance
14
+	 *
15
+	 * @since 1.0.0
16
+	 *
17
+	 * @var object \lsx\sharing\classes\admin\Settings()
18
+	 */
19
+	protected static $instance = null;
20 20
 
21
-    /**
22
-     * Contructor
23
-     */
24
-    public function __construct() {
25
-         add_action('cmb2_admin_init', array( $this, 'register_settings_page' ));
26
-        add_action('lsx_sharing_settings_page', array( $this, 'configure_general_fields' ), 15, 1);
27
-        add_action('lsx_sharing_settings_page', array( $this, 'configure_archive_fields' ), 15, 1);
28
-        add_action('admin_enqueue_scripts', array( $this, 'assets' ));
29
-    }
21
+	/**
22
+	 * Contructor
23
+	 */
24
+	public function __construct() {
25
+		 add_action('cmb2_admin_init', array( $this, 'register_settings_page' ));
26
+		add_action('lsx_sharing_settings_page', array( $this, 'configure_general_fields' ), 15, 1);
27
+		add_action('lsx_sharing_settings_page', array( $this, 'configure_archive_fields' ), 15, 1);
28
+		add_action('admin_enqueue_scripts', array( $this, 'assets' ));
29
+	}
30 30
 
31
-    /**
32
-     * Return an instance of this class.
33
-     *
34
-     * @since 1.0.0
35
-     *
36
-     * @return object \lsx\sharing\classes\admin\Settings()    A single instance of this class.
37
-     */
38
-    public static function get_instance() {
39
-         // If the single instance hasn't been set, set it now.
40
-        if ( null == self::$instance ) {
41
-            self::$instance = new self();
42
-        }
43
-        return self::$instance;
44
-    }
31
+	/**
32
+	 * Return an instance of this class.
33
+	 *
34
+	 * @since 1.0.0
35
+	 *
36
+	 * @return object \lsx\sharing\classes\admin\Settings()    A single instance of this class.
37
+	 */
38
+	public static function get_instance() {
39
+		 // If the single instance hasn't been set, set it now.
40
+		if ( null == self::$instance ) {
41
+			self::$instance = new self();
42
+		}
43
+		return self::$instance;
44
+	}
45 45
 
46
-    /**
47
-     * Configure fields for the Settings page.
48
-     *
49
-     * @return void
50
-     */
51
-    public function register_settings_page() {
52
-         $args = array(
46
+	/**
47
+	 * Configure fields for the Settings page.
48
+	 *
49
+	 * @return void
50
+	 */
51
+	public function register_settings_page() {
52
+		 $args = array(
53 53
 			 'id'           => 'lsx_sharing_settings',
54 54
 			 'title'        => '<h1>' . esc_html__('LSX Sharing Settings', 'lsx-search') . ' <span class="version">' . LSX_SHARING_VER . '</span></h1>',
55 55
 			 'menu_title'   => esc_html__('LSX Sharing', 'search'), // Falls back to 'title' (above).
@@ -58,201 +58,201 @@  discard block
 block discarded – undo
58 58
 			 'parent_slug'  => 'options-general.php',
59 59
 			 'capability'   => 'manage_options', // Cap required to view options-page.
60 60
 		 );
61
-        $cmb  = new_cmb2_box($args);
62
-        do_action('lsx_sharing_settings_page', $cmb);
63
-    }
61
+		$cmb  = new_cmb2_box($args);
62
+		do_action('lsx_sharing_settings_page', $cmb);
63
+	}
64 64
 
65
-    /**
66
-     * Enqueue JS and CSS.
67
-     */
68
-    public function assets( $hook ) {
69
-         wp_enqueue_style('lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER);
70
-    }
65
+	/**
66
+	 * Enqueue JS and CSS.
67
+	 */
68
+	public function assets( $hook ) {
69
+		 wp_enqueue_style('lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER);
70
+	}
71 71
 
72
-    /**
73
-     * Enable Business Directory Search settings only if LSX Search plugin is enabled.
74
-     *
75
-     * @return void
76
-     */
77
-    public function configure_general_fields( $cmb ) {
78
-         $global_args = array(
72
+	/**
73
+	 * Enable Business Directory Search settings only if LSX Search plugin is enabled.
74
+	 *
75
+	 * @return void
76
+	 */
77
+	public function configure_general_fields( $cmb ) {
78
+		 $global_args = array(
79 79
 			 'title' => __('Global', 'lsx-search'),
80 80
 			 'desc'  => esc_html__('Control the sharing WordPress post types.', 'lsx-search'),
81 81
 		 );
82
-        $this->get_fields($cmb, 'global', $global_args);
83
-    }
82
+		$this->get_fields($cmb, 'global', $global_args);
83
+	}
84 84
 
85
-    /**
86
-     * Enable Sharing settings only if LSX Search plugin is enabled.
87
-     *
88
-     * @param  object $cmb      The CMB2() class.
89
-     * @param  string $position either top of bottom.
90
-     * @return void
91
-     */
92
-    public function configure_archive_fields( $cmb ) {
93
-         $archives       = array();
94
-        $post_type_args = array(
85
+	/**
86
+	 * Enable Sharing settings only if LSX Search plugin is enabled.
87
+	 *
88
+	 * @param  object $cmb      The CMB2() class.
89
+	 * @param  string $position either top of bottom.
90
+	 * @return void
91
+	 */
92
+	public function configure_archive_fields( $cmb ) {
93
+		 $archives       = array();
94
+		$post_type_args = array(
95 95
 			'public' => true,
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 ) {
101
-                case 'post':
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);
110
-                        }
111
-                    }
112
-                    $description = sprintf(
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'),
115
-                        $page_url,
116
-                        $page_title
117
-                    );
118
-                    $archives[ $post_type_key ] = array(
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 ) {
101
+				case 'post':
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);
110
+						}
111
+					}
112
+					$description = sprintf(
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'),
115
+						$page_url,
116
+						$page_title
117
+					);
118
+					$archives[ $post_type_key ] = array(
119 119
 						'title' => __('Blog', 'lsx-search'),
120 120
 						'desc'  => $description,
121
-                    );
122
-                        break;
121
+					);
122
+						break;
123 123
 
124
-                case 'product':
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);
131
-                    }
132
-                    $description = sprintf(
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'),
135
-                        $page_url,
136
-                        $page_title
137
-                    );
138
-                    $archives[ $post_type_key ] = array(
124
+				case 'product':
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);
131
+					}
132
+					$description = sprintf(
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'),
135
+						$page_url,
136
+						$page_title
137
+					);
138
+					$archives[ $post_type_key ] = array(
139 139
 						'title' => __('Shop', 'lsx-search'),
140 140
 						'desc'  => $description,
141
-                    );
142
-                        break;
141
+					);
142
+						break;
143 143
 
144
-                default:
145
-                    if ( in_array($post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types()) ) {
146
-                            break;
147
-                    }
148
-                    $temp_post_type = get_post_type_object($post_type_key);
149
-                    if ( ! is_wp_error($temp_post_type) ) {
150
-                        $page_url    = get_post_type_archive_link($temp_post_type->name);
151
-                        $description = sprintf(
152
-                        /* translators: %s: The subscription info */
153
-                            __('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search'),
154
-                            $page_url,
155
-                            $temp_post_type->label
156
-                        );
144
+				default:
145
+					if ( in_array($post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types()) ) {
146
+							break;
147
+					}
148
+					$temp_post_type = get_post_type_object($post_type_key);
149
+					if ( ! is_wp_error($temp_post_type) ) {
150
+						$page_url    = get_post_type_archive_link($temp_post_type->name);
151
+						$description = sprintf(
152
+						/* translators: %s: The subscription info */
153
+							__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search'),
154
+							$page_url,
155
+							$temp_post_type->label
156
+						);
157 157
 
158
-                        $archives[ $post_type_key ] = array(
158
+						$archives[ $post_type_key ] = array(
159 159
 							'title' => $temp_post_type->label,
160 160
 							'desc'  => $description,
161
-                        );
162
-                    }
163
-                        break;
164
-                }
165
-            }
166
-        }
167
-        if ( ! empty($archives) ) {
168
-            foreach ( $archives as $archive_key => $archive_args ) {
169
-                $this->get_fields($cmb, $archive_key, $archive_args);
170
-            }
171
-        }
172
-    }
173
-    /**
174
-     * Gets the sharing fields and loops through them.
175
-     *
176
-     * @param  object $cmb
177
-     * @param  string $section
178
-     * @param  array  $args
179
-     * @return void
180
-     */
181
-    public function get_fields( $cmb, $section, $args ) {
182
-         $cmb->add_field(
183
-            array(
161
+						);
162
+					}
163
+						break;
164
+				}
165
+			}
166
+		}
167
+		if ( ! empty($archives) ) {
168
+			foreach ( $archives as $archive_key => $archive_args ) {
169
+				$this->get_fields($cmb, $archive_key, $archive_args);
170
+			}
171
+		}
172
+	}
173
+	/**
174
+	 * Gets the sharing fields and loops through them.
175
+	 *
176
+	 * @param  object $cmb
177
+	 * @param  string $section
178
+	 * @param  array  $args
179
+	 * @return void
180
+	 */
181
+	public function get_fields( $cmb, $section, $args ) {
182
+		 $cmb->add_field(
183
+			array(
184 184
 				'id'          => 'settings_' . $section . '_sharing',
185 185
 				'type'        => 'title',
186 186
 				'name'        => $args['title'],
187 187
 				'default'     => $args['title'],
188 188
 				'description' => $args['desc'],
189
-            )
190
-        );
191
-        if ( 'global' === $section ) {
192
-            $cmb->add_field(
193
-                array(
189
+			)
190
+		);
191
+		if ( 'global' === $section ) {
192
+			$cmb->add_field(
193
+				array(
194 194
 					'name'        => esc_html__('Disable all', 'lsx-sharing'),
195 195
 					'id'          => $section . '_disable_all',
196 196
 					'description' => esc_html__('Disable all share buttons on the site', 'lsx-sharing'),
197 197
 					'type'        => 'checkbox',
198
-                )
199
-            );
200
-        } else {
201
-            $cmb->add_field(
202
-                array(
198
+				)
199
+			);
200
+		} else {
201
+			$cmb->add_field(
202
+				array(
203 203
 					'name'        => esc_html__('Disable', 'lsx-sharing'),
204 204
 					'id'          => $section . '_disable_pt',
205 205
 					'description' => esc_html__('Disable the share buttons on this post type', 'lsx-sharing'),
206 206
 					'type'        => 'checkbox',
207
-                )
208
-            );
209
-        }
207
+				)
208
+			);
209
+		}
210 210
 
211
-        $cmb->add_field(
212
-            array(
211
+		$cmb->add_field(
212
+			array(
213 213
 				'name'        => esc_html__('Label text', 'lsx-sharing'),
214 214
 				'id'          => $section . '_label_text',
215 215
 				'description' => esc_html__('A default label for the sharing.', 'lsx-sharing'),
216 216
 				'type'        => 'text',
217
-            )
218
-        );
219
-        if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'facebook') ) ) {
220
-            $cmb->add_field(
221
-                array(
217
+			)
218
+		);
219
+		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'facebook') ) ) {
220
+			$cmb->add_field(
221
+				array(
222 222
 					'name'        => esc_html__('Disable Facebook', 'lsx-sharing'),
223 223
 					'id'          => $section . '_disable_facebook',
224 224
 					'description' => esc_html__('Disable Facebook share button.', 'lsx-sharing'),
225 225
 					'type'        => 'checkbox',
226
-                )
227
-            );
228
-        }
229
-        if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'twitter') ) ) {
230
-            $cmb->add_field(
231
-                array(
226
+				)
227
+			);
228
+		}
229
+		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'twitter') ) ) {
230
+			$cmb->add_field(
231
+				array(
232 232
 					'name'        => esc_html__('Disable Twitter', 'lsx-sharing'),
233 233
 					'id'          => $section . '_disable_twitter',
234 234
 					'description' => esc_html__('Disable Twitter share button.', 'lsx-sharing'),
235 235
 					'type'        => 'checkbox',
236
-                )
237
-            );
238
-        }
239
-        if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'pinterest') ) ) {
240
-            $cmb->add_field(
241
-                array(
236
+				)
237
+			);
238
+		}
239
+		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'pinterest') ) ) {
240
+			$cmb->add_field(
241
+				array(
242 242
 					'name'        => esc_html__('Disable Pinterest', 'lsx-sharing'),
243 243
 					'id'          => $section . '_disable_pinterest',
244 244
 					'description' => esc_html__('Disable Pinterest button.', 'lsx-sharing'),
245 245
 					'type'        => 'checkbox',
246
-                )
247
-            );
248
-        }
246
+				)
247
+			);
248
+		}
249 249
 
250
-        do_action('lsx_sharing_settings_section', $cmb, $section);
251
-        $cmb->add_field(
252
-            array(
250
+		do_action('lsx_sharing_settings_section', $cmb, $section);
251
+		$cmb->add_field(
252
+			array(
253 253
 				'id'   => $section . '_title_closing',
254 254
 				'type' => 'tab_closing',
255
-            )
256
-        );
257
-    }
255
+			)
256
+		);
257
+	}
258 258
 }
Please login to merge, or discard this patch.
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -98,69 +98,69 @@
 block discarded – undo
98 98
         if ( ! empty($post_types) ) {
99 99
             foreach ( $post_types as $post_type_key => $post_type_value ) {
100 100
                 switch ( $post_type_key ) {
101
-                case 'post':
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);
110
-                        }
111
-                    }
112
-                    $description = sprintf(
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'),
115
-                        $page_url,
116
-                        $page_title
117
-                    );
118
-                    $archives[ $post_type_key ] = array(
119
-						'title' => __('Blog', 'lsx-search'),
120
-						'desc'  => $description,
121
-                    );
122
-                        break;
101
+                	case 'post':
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);
110
+                        	}
111
+                    	}
112
+                    	$description = sprintf(
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'),
115
+                        	$page_url,
116
+                        	$page_title
117
+                    	);
118
+                    	$archives[ $post_type_key ] = array(
119
+							'title' => __('Blog', 'lsx-search'),
120
+							'desc'  => $description,
121
+                    	);
122
+                        	break;
123 123
 
124
-                case 'product':
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);
131
-                    }
132
-                    $description = sprintf(
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'),
135
-                        $page_url,
136
-                        $page_title
137
-                    );
138
-                    $archives[ $post_type_key ] = array(
139
-						'title' => __('Shop', 'lsx-search'),
140
-						'desc'  => $description,
141
-                    );
142
-                        break;
124
+                	case 'product':
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);
131
+                    	}
132
+                    	$description = sprintf(
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'),
135
+                        	$page_url,
136
+                        	$page_title
137
+                    	);
138
+                    	$archives[ $post_type_key ] = array(
139
+							'title' => __('Shop', 'lsx-search'),
140
+							'desc'  => $description,
141
+                    	);
142
+                        	break;
143 143
 
144
-                default:
145
-                    if ( in_array($post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types()) ) {
146
-                            break;
147
-                    }
148
-                    $temp_post_type = get_post_type_object($post_type_key);
149
-                    if ( ! is_wp_error($temp_post_type) ) {
150
-                        $page_url    = get_post_type_archive_link($temp_post_type->name);
151
-                        $description = sprintf(
152
-                        /* translators: %s: The subscription info */
153
-                            __('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search'),
154
-                            $page_url,
155
-                            $temp_post_type->label
156
-                        );
144
+                	default:
145
+                    	if ( in_array($post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types()) ) {
146
+                            	break;
147
+                    	}
148
+                    	$temp_post_type = get_post_type_object($post_type_key);
149
+                    	if ( ! is_wp_error($temp_post_type) ) {
150
+                        	$page_url    = get_post_type_archive_link($temp_post_type->name);
151
+                        	$description = sprintf(
152
+                        	/* translators: %s: The subscription info */
153
+                            	__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search'),
154
+                            	$page_url,
155
+                            	$temp_post_type->label
156
+                        	);
157 157
 
158
-                        $archives[ $post_type_key ] = array(
159
-							'title' => $temp_post_type->label,
160
-							'desc'  => $description,
161
-                        );
162
-                    }
163
-                        break;
158
+                        	$archives[ $post_type_key ] = array(
159
+								'title' => $temp_post_type->label,
160
+								'desc'  => $description,
161
+                        	);
162
+                    	}
163
+                        	break;
164 164
                 }
165 165
             }
166 166
         }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
      * Contructor
23 23
      */
24 24
     public function __construct() {
25
-         add_action('cmb2_admin_init', array( $this, 'register_settings_page' ));
26
-        add_action('lsx_sharing_settings_page', array( $this, 'configure_general_fields' ), 15, 1);
27
-        add_action('lsx_sharing_settings_page', array( $this, 'configure_archive_fields' ), 15, 1);
28
-        add_action('admin_enqueue_scripts', array( $this, 'assets' ));
25
+         add_action('cmb2_admin_init', array($this, 'register_settings_page'));
26
+        add_action('lsx_sharing_settings_page', array($this, 'configure_general_fields'), 15, 1);
27
+        add_action('lsx_sharing_settings_page', array($this, 'configure_archive_fields'), 15, 1);
28
+        add_action('admin_enqueue_scripts', array($this, 'assets'));
29 29
     }
30 30
 
31 31
     /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public static function get_instance() {
39 39
          // If the single instance hasn't been set, set it now.
40
-        if ( null == self::$instance ) {
40
+        if (null == self::$instance) {
41 41
             self::$instance = new self();
42 42
         }
43 43
         return self::$instance;
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 			 'id'           => 'lsx_sharing_settings',
54 54
 			 'title'        => '<h1>' . esc_html__('LSX Sharing Settings', 'lsx-search') . ' <span class="version">' . LSX_SHARING_VER . '</span></h1>',
55 55
 			 'menu_title'   => esc_html__('LSX Sharing', 'search'), // Falls back to 'title' (above).
56
-			 'object_types' => array( 'options-page' ),
56
+			 'object_types' => array('options-page'),
57 57
 			 'option_key'   => 'lsx-sharing-settings', // The option key and admin menu page slug.
58 58
 			 'parent_slug'  => 'options-general.php',
59 59
 			 'capability'   => 'manage_options', // Cap required to view options-page.
60 60
 		 );
61
-        $cmb  = new_cmb2_box($args);
61
+        $cmb = new_cmb2_box($args);
62 62
         do_action('lsx_sharing_settings_page', $cmb);
63 63
     }
64 64
 
65 65
     /**
66 66
      * Enqueue JS and CSS.
67 67
      */
68
-    public function assets( $hook ) {
68
+    public function assets($hook) {
69 69
          wp_enqueue_style('lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER);
70 70
     }
71 71
 
@@ -74,7 +74,7 @@  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 79
 			 'title' => __('Global', 'lsx-search'),
80 80
 			 'desc'  => esc_html__('Control the sharing WordPress post types.', 'lsx-search'),
@@ -89,22 +89,22 @@  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 ) {
93
-         $archives       = array();
92
+    public function configure_archive_fields($cmb) {
93
+         $archives = array();
94 94
         $post_type_args = array(
95 95
 			'public' => true,
96 96
         );
97 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 ) {
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 103
                     $page_title    = __('Home', 'lsx-search');
104 104
                     $show_on_front = get_option('show_on_front');
105
-                    if ( 'page' === $show_on_front ) {
105
+                    if ('page' === $show_on_front) {
106 106
                             $page_for_posts = get_option('page_for_posts');
107
-                        if ( '' !== $page_for_posts ) {
107
+                        if ('' !== $page_for_posts) {
108 108
                             $page_title   = get_the_title($page_for_posts);
109 109
                             $page_url     = get_permalink($page_for_posts);
110 110
                         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                         $page_url,
116 116
                         $page_title
117 117
                     );
118
-                    $archives[ $post_type_key ] = array(
118
+                    $archives[$post_type_key] = array(
119 119
 						'title' => __('Blog', 'lsx-search'),
120 120
 						'desc'  => $description,
121 121
                     );
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
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') ) {
126
+                    $page_title = __('Shop', 'lsx-search');
127
+                    if (function_exists('wc_get_page_id')) {
128 128
                         $shop_page  = wc_get_page_id('shop');
129 129
                         $page_url   = get_permalink($shop_page);
130 130
                         $page_title = get_the_title($shop_page);
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
                         $page_url,
136 136
                         $page_title
137 137
                     );
138
-                    $archives[ $post_type_key ] = array(
138
+                    $archives[$post_type_key] = array(
139 139
 						'title' => __('Shop', 'lsx-search'),
140 140
 						'desc'  => $description,
141 141
                     );
142 142
                         break;
143 143
 
144 144
                 default:
145
-                    if ( in_array($post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types()) ) {
145
+                    if (in_array($post_type_key, \lsx\sharing\includes\functions\get_restricted_post_types())) {
146 146
                             break;
147 147
                     }
148 148
                     $temp_post_type = get_post_type_object($post_type_key);
149
-                    if ( ! is_wp_error($temp_post_type) ) {
149
+                    if ( ! is_wp_error($temp_post_type)) {
150 150
                         $page_url    = get_post_type_archive_link($temp_post_type->name);
151 151
                         $description = sprintf(
152 152
                         /* translators: %s: The subscription info */
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                             $temp_post_type->label
156 156
                         );
157 157
 
158
-                        $archives[ $post_type_key ] = array(
158
+                        $archives[$post_type_key] = array(
159 159
 							'title' => $temp_post_type->label,
160 160
 							'desc'  => $description,
161 161
                         );
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
                 }
165 165
             }
166 166
         }
167
-        if ( ! empty($archives) ) {
168
-            foreach ( $archives as $archive_key => $archive_args ) {
167
+        if ( ! empty($archives)) {
168
+            foreach ($archives as $archive_key => $archive_args) {
169 169
                 $this->get_fields($cmb, $archive_key, $archive_args);
170 170
             }
171 171
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param  array  $args
179 179
      * @return void
180 180
      */
181
-    public function get_fields( $cmb, $section, $args ) {
181
+    public function get_fields($cmb, $section, $args) {
182 182
          $cmb->add_field(
183 183
             array(
184 184
 				'id'          => 'settings_' . $section . '_sharing',
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 				'description' => $args['desc'],
189 189
             )
190 190
         );
191
-        if ( 'global' === $section ) {
191
+        if ('global' === $section) {
192 192
             $cmb->add_field(
193 193
                 array(
194 194
 					'name'        => esc_html__('Disable all', 'lsx-sharing'),
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				'type'        => 'text',
217 217
             )
218 218
         );
219
-        if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'facebook') ) ) {
219
+        if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'facebook'))) {
220 220
             $cmb->add_field(
221 221
                 array(
222 222
 					'name'        => esc_html__('Disable Facebook', 'lsx-sharing'),
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                 )
227 227
             );
228 228
         }
229
-        if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'twitter') ) ) {
229
+        if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'twitter'))) {
230 230
             $cmb->add_field(
231 231
                 array(
232 232
 					'name'        => esc_html__('Disable Twitter', 'lsx-sharing'),
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                 )
237 237
             );
238 238
         }
239
-        if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'pinterest') ) ) {
239
+        if ('global' === $section || ('global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'pinterest'))) {
240 240
             $cmb->add_field(
241 241
                 array(
242 242
 					'name'        => esc_html__('Disable Pinterest', 'lsx-sharing'),
Please login to merge, or discard this patch.
includes/settings/display.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@
 block discarded – undo
34 34
             <li><a href="#ui-services" class="<?php echo esc_attr($class); ?>">
35 35
             <?php esc_html_e('Services', 'lsx-sharing'); ?></a></li>
36 36
             <?php 
37
-            $class = ''; 
38
-        } 
39
-        ?>
37
+			$class = ''; 
38
+		} 
39
+		?>
40 40
 
41 41
         <?php if ( class_exists('LSX_Blog_Customizer') ) { ?>
42 42
             <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') ) ? '' : 'active'; ?>
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@  discard block
 block discarded – undo
1 1
 <div class="uix-field-wrapper">
2 2
     <ul class="ui-tab-nav">
3
-        <?php if ( class_exists('LSX_Banners') ) { ?>
3
+        <?php if (class_exists('LSX_Banners')) { ?>
4 4
             <li><a href="#ui-placeholders" class="active"><?php esc_html_e('Placeholders', 'lsx-sharing'); ?></a></li>
5 5
         <?php } ?>
6 6
 
7
-        <?php if ( class_exists('LSX_Currencies') ) { ?>
7
+        <?php if (class_exists('LSX_Currencies')) { ?>
8 8
             <?php $class_active = class_exists('LSX_Banners') ? '' : 'active'; ?>
9 9
             <li><a href="#ui-currencies" class="<?php echo esc_attr($class_active); ?>">
10 10
             <?php esc_html_e('Currencies', 'lsx-sharing'); ?></a></li>
11 11
         <?php } ?>
12 12
 
13
-        <?php if ( class_exists('LSX_Team') ) { ?>
14
-            <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') ) ? '' : 'active'; ?>
13
+        <?php if (class_exists('LSX_Team')) { ?>
14
+            <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies')) ? '' : 'active'; ?>
15 15
             <li><a href="#ui-team" class="<?php echo esc_attr($class_active); ?>">
16 16
             <?php esc_html_e('Team', 'lsx-sharing'); ?></a></li>
17 17
         <?php } ?>
18 18
 
19
-        <?php if ( class_exists('LSX_Testimonials') ) { ?>
20
-            <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') ) ? '' : 'active'; ?>
19
+        <?php if (class_exists('LSX_Testimonials')) { ?>
20
+            <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team')) ? '' : 'active'; ?>
21 21
             <li><a href="#ui-testimonials" class="<?php echo esc_attr($class_active); ?>">
22 22
             <?php esc_html_e('Testimonials', 'lsx-sharing'); ?></a></li>
23 23
         <?php } ?>
24 24
 
25
-        <?php if ( class_exists('LSX_Projects') ) { ?>
26
-            <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') ) ? '' : 'active'; ?>
25
+        <?php if (class_exists('LSX_Projects')) { ?>
26
+            <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials')) ? '' : 'active'; ?>
27 27
             <li><a href="#ui-projects" class="<?php echo esc_attr($class_active); ?>">
28 28
             <?php esc_html_e('Projects', 'lsx-sharing'); ?>
29 29
                 </a></li>
30 30
         <?php } ?>
31 31
 
32
-        <?php if ( class_exists('LSX_Services') ) { ?>
33
-            <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') ) ? '' : 'active'; ?>
32
+        <?php if (class_exists('LSX_Services')) { ?>
33
+            <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects')) ? '' : 'active'; ?>
34 34
             <li><a href="#ui-services" class="<?php echo esc_attr($class); ?>">
35 35
             <?php esc_html_e('Services', 'lsx-sharing'); ?></a></li>
36 36
             <?php 
@@ -38,26 +38,26 @@  discard block
 block discarded – undo
38 38
         } 
39 39
         ?>
40 40
 
41
-        <?php if ( class_exists('LSX_Blog_Customizer') ) { ?>
42
-            <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') ) ? '' : 'active'; ?>
41
+        <?php if (class_exists('LSX_Blog_Customizer')) { ?>
42
+            <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services')) ? '' : 'active'; ?>
43 43
             <li><a href="#ui-blog-customizer" class="<?php echo esc_attr($class_active); ?>">
44 44
             <?php esc_html_e('Blog Customizer (posts widget)', 'lsx-sharing'); ?></a></li>
45 45
         <?php } ?>
46 46
 
47
-        <?php if ( class_exists('LSX_Sharing') ) { ?>
48
-            <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') ) ? '' : 'active'; ?>
47
+        <?php if (class_exists('LSX_Sharing')) { ?>
48
+            <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer')) ? '' : 'active'; ?>
49 49
             <li><a href="#ui-sharing" class="<?php echo esc_attr($class_active); ?>">
50 50
             <?php esc_html_e('Sharing', 'lsx-sharing'); ?></a></li>
51 51
         <?php } ?>
52 52
 
53
-        <?php if ( class_exists('LSX_Videos') ) { ?>
54
-            <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing') ) ? '' : 'active'; ?>
53
+        <?php if (class_exists('LSX_Videos')) { ?>
54
+            <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing')) ? '' : 'active'; ?>
55 55
             <li><a href="#ui-videos" class="<?php echo esc_attr($class_active); ?>">
56 56
             <?php esc_html_e('Videos', 'lsx-sharing'); ?></a></li>
57 57
         <?php } ?>
58 58
     </ul>
59 59
 
60
-    <?php if ( class_exists('LSX_Banners') ) { ?>
60
+    <?php if (class_exists('LSX_Banners')) { ?>
61 61
         <div id="ui-placeholders" class="ui-tab active">
62 62
             <table class="form-table">
63 63
                 <tbody>
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         </div>
68 68
     <?php } ?>
69 69
 
70
-    <?php if ( class_exists('LSX_Currencies') ) { ?>
70
+    <?php if (class_exists('LSX_Currencies')) { ?>
71 71
         <?php $class_active = class_exists('LSX_Banners') ? '' : 'active'; ?>
72 72
         <div id="ui-currencies" class="ui-tab <?php echo esc_attr($class_active); ?>">
73 73
             <table class="form-table">
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
         </div>
79 79
     <?php } ?>
80 80
 
81
-    <?php if ( class_exists('LSX_Team') ) { ?>
82
-        <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') ) ? '' : 'active'; ?>
81
+    <?php if (class_exists('LSX_Team')) { ?>
82
+        <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies')) ? '' : 'active'; ?>
83 83
         <div id="ui-team" class="ui-tab <?php echo esc_attr($class_active); ?>">
84 84
             <table class="form-table">
85 85
                 <tbody>
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
         </div>
90 90
     <?php } ?>
91 91
 
92
-    <?php if ( class_exists('LSX_Testimonials') ) { ?>
93
-        <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') ) ? '' : 'active'; ?>
92
+    <?php if (class_exists('LSX_Testimonials')) { ?>
93
+        <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team')) ? '' : 'active'; ?>
94 94
         <div id="ui-testimonials" class="ui-tab <?php echo esc_attr($class_active); ?>">
95 95
             <table class="form-table">
96 96
                 <tbody>
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
         </div>
101 101
     <?php } ?>
102 102
 
103
-    <?php if ( class_exists('LSX_Projects') ) { ?>
104
-        <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') ) ? '' : 'active'; ?>
103
+    <?php if (class_exists('LSX_Projects')) { ?>
104
+        <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials')) ? '' : 'active'; ?>
105 105
         <div id="ui-projects" class="ui-tab <?php echo esc_attr($class_active); ?>">
106 106
             <table class="form-table">
107 107
                 <tbody>
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         </div>
112 112
     <?php } ?>
113 113
 
114
-    <?php if ( class_exists('LSX_Services') ) { ?>
115
-        <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') ) ? '' : 'active'; ?>
114
+    <?php if (class_exists('LSX_Services')) { ?>
115
+        <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects')) ? '' : 'active'; ?>
116 116
         <div id="ui-services" class="ui-tab <?php echo esc_attr($class_active); ?>">
117 117
             <table class="form-table">
118 118
                 <tbody>
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
         </div>
123 123
     <?php } ?>
124 124
 
125
-    <?php if ( class_exists('LSX_Blog_Customizer') ) { ?>
126
-        <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') ) ? '' : 'active'; ?>
125
+    <?php if (class_exists('LSX_Blog_Customizer')) { ?>
126
+        <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services')) ? '' : 'active'; ?>
127 127
         <div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr($class_active); ?>">
128 128
             <table class="form-table">
129 129
                 <tbody>
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
         </div>
134 134
     <?php } ?>
135 135
 
136
-    <?php if ( class_exists('LSX_Sharing') ) { ?>
137
-        <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') ) ? '' : 'active'; ?>
136
+    <?php if (class_exists('LSX_Sharing')) { ?>
137
+        <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer')) ? '' : 'active'; ?>
138 138
         <div id="ui-sharing" class="ui-tab <?php echo esc_attr($class_active); ?>">
139 139
             <table class="form-table">
140 140
                 <tbody>
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
         </div>
145 145
     <?php } ?>
146 146
 
147
-    <?php if ( class_exists('LSX_Videos') ) { ?>
148
-        <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing') ) ? '' : 'active'; ?>
147
+    <?php if (class_exists('LSX_Videos')) { ?>
148
+        <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing')) ? '' : 'active'; ?>
149 149
         <div id="ui-videos" class="ui-tab <?php echo esc_attr($class_active); ?>">
150 150
             <table class="form-table">
151 151
                 <tbody>
Please login to merge, or discard this patch.
includes/functions.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @return array
14 14
  */
15 15
 function get_restricted_post_types() {
16
-     $post_types = array(
16
+	 $post_types = array(
17 17
 		 'page',
18 18
 		 'attachment',
19 19
 		 'forum',
@@ -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
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @return array
40 40
  */
41 41
 function get_to_post_types() {
42
-     $post_types = array(
42
+	 $post_types = array(
43 43
 		 'accommodation',
44 44
 		 'tour',
45 45
 		 'destination',
@@ -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
 /**
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
  * @return array
58 58
  */
59 59
 function get_hp_post_types() {
60
-     $post_types = array(
60
+	 $post_types = array(
61 61
 		 'workout',
62 62
 		 'exercise',
63 63
 		 'recipe',
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
 /**
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  * @return boolean
74 74
  */
75 75
 function is_button_disabled( $post_type = '', $service = '' ) {
76
-     $sharing = lsx_sharing();
77
-    $option  = false;
78
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_' . $service ]) ) {
79
-        $option = true;
80
-    } elseif ( true === $sharing->is_new_options && ! empty($sharing->options[ $post_type . '_disable_' . $service ]) ) {
81
-        $option = true;
82
-    }
83
-    return $option;
76
+	 $sharing = lsx_sharing();
77
+	$option  = false;
78
+	if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_' . $service ]) ) {
79
+		$option = true;
80
+	} elseif ( true === $sharing->is_new_options && ! empty($sharing->options[ $post_type . '_disable_' . $service ]) ) {
81
+		$option = true;
82
+	}
83
+	return $option;
84 84
 }
85 85
 
86 86
 /**
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
  * @return boolean
90 90
  */
91 91
 function is_pt_disabled( $post_type = '' ) {
92
-     $sharing = lsx_sharing();
93
-    $option  = false;
94
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_pt_' . $post_type ]) ) {
95
-        $option = true;
96
-    } elseif ( true === $sharing->is_new_options && isset($sharing->options[ $post_type . '_disable_pt' ]) ) {
97
-        $option = true;
98
-    }
99
-    return $option;
92
+	 $sharing = lsx_sharing();
93
+	$option  = false;
94
+	if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_pt_' . $post_type ]) ) {
95
+		$option = true;
96
+	} elseif ( true === $sharing->is_new_options && isset($sharing->options[ $post_type . '_disable_pt' ]) ) {
97
+		$option = true;
98
+	}
99
+	return $option;
100 100
 }
101 101
 
102 102
 /**
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
  * @return boolean
106 106
  */
107 107
 function is_disabled() {
108
-     $sharing = lsx_sharing();
109
-    $option  = false;
110
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_all']) ) {
111
-        $option = true;
112
-    } elseif ( true === $sharing->is_new_options && isset($sharing->options['global_disable_all']) ) {
113
-        $option = true;
114
-    }
115
-    return $option;
108
+	 $sharing = lsx_sharing();
109
+	$option  = false;
110
+	if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_all']) ) {
111
+		$option = true;
112
+	} elseif ( true === $sharing->is_new_options && isset($sharing->options['global_disable_all']) ) {
113
+		$option = true;
114
+	}
115
+	return $option;
116 116
 }
117 117
 
118 118
 /**
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
  * @return string
122 122
  */
123 123
 function get_sharing_text( $post_type = '' ) {
124
-     $sharing = lsx_sharing();
125
-    $text    = '';
126
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_label_text']) ) {
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']) ) {
132
-            $text = $sharing->options['global_label_text'];
133
-        }
134
-    }
135
-    return $text;
124
+	 $sharing = lsx_sharing();
125
+	$text    = '';
126
+	if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_label_text']) ) {
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']) ) {
132
+			$text = $sharing->options['global_label_text'];
133
+		}
134
+	}
135
+	return $text;
136 136
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -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
-    $option  = false;
78
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_' . $service ]) ) {
77
+    $option = false;
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
-    $option  = false;
94
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_pt_' . $post_type ]) ) {
93
+    $option = false;
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;
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
  */
107 107
 function is_disabled() {
108 108
      $sharing = lsx_sharing();
109
-    $option  = false;
110
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_all']) ) {
109
+    $option = false;
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
-    $text    = '';
126
-    if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_label_text']) ) {
125
+    $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.