Completed
Branch add/settings-update (80bb6a)
by Warwick
03:50
created

Frontend   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 56
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A sharing_buttons() 0 3 1
A get_instance() 0 6 2
A load_classes() 0 4 1
A __construct() 0 2 1
1
<?php
2
/**
3
 * LSX_Sharing_Frontend
4
 *
5
 * @package lsx-sharing
6
 */
7
8
namespace lsx\sharing\classes;
9
10
/**
11
 * LSX Sharing front-end class.
12
 *
13
 * @package lsx-sharing
14
 */
15
class Frontend {
16
17
	/**
18
	 * Holds class instance
19
	 *
20
	 * @since 1.0.0
21
	 *
22
	 * @var      object \lsx\sharing\classes\Frontend()
23
	 */
24
	protected static $instance = null;
25
26
	/**
27
	 * Holds the output class.
28
	 *
29
	 * @var object \lsx\sharing\classes\frontend\Output()
30
	 */
31
	public $output = null;
32
33
	/**
34
	 * Constructor.
35
	 */
36
	public function __construct() {
37
		$this->load_classes();
38
39
	}
40
41
	/**
42
	 * Return an instance of this class.
43
	 *
44
	 * @since 1.0.0
45
	 *
46
	 * @return    object \lsx\sharing\classes\Frontend()    A single instance of this class.
47
	 */
48
	public static function get_instance() {
49
		// If the single instance hasn't been set, set it now.
50
		if ( null == self::$instance ) {
51
			self::$instance = new self();
52
		}
53
		return self::$instance;
54
	}
55
56
	/**
57
	 * Loads the plugin functions.
58
	 */
59
	private function load_classes() {
60
		require_once LSX_SHARING_PATH . '/classes/frontend/class-button.php';
61
		require_once LSX_SHARING_PATH . '/classes/frontend/class-output.php';
62
		$this->output = \lsx\sharing\classes\frontend\Output::get_instance();
63
	}
64
65
	/**
66
	 * Backwards compatabile function for the sharing buttons.
67
	 */
68
	public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) {
69
		wc_deprecated_function( 'LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()' );
0 ignored issues
show
Bug introduced by
The function wc_deprecated_function was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

69
		/** @scrutinizer ignore-call */ 
70
  wc_deprecated_function( 'LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()' );
Loading history...
70
		$this->output->sharing_buttons( $buttons, $echo, $post_id );
71
	}
72
}
73