Jetpack_After_The_Deadline   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 59
rs 10
c 0
b 0
f 0
wmc 6
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A instance() 0 6 2
A __construct() 0 5 2
A __clone() 0 3 1
A load() 0 3 1
1
<?php
2
/**
3
 * Black Studio TinyMCE Widget - Compatibility with Jetpack After the deadline plugin
4
 *
5
 * @package Black_Studio_TinyMCE_Widget
6
 */
7
8
namespace Black_Studio_TinyMCE_Widget\Compatibility\Plugin;
9
10
// Exit if accessed directly.
11
if ( ! defined( 'ABSPATH' ) ) {
12
	exit;
13
}
14
15
if ( ! class_exists( 'Black_Studio_TinyMCE_Widget\\Compatibility\\Plugin\\Jetpack_After_The_Deadline', false ) ) {
16
17
	/**
18
	 * Class that provides compatibility code for Jetpack After the deadline
19
	 *
20
	 * @package Black_Studio_TinyMCE_Widget
21
	 * @since 3.0.0
22
	 */
23
	final class Jetpack_After_The_Deadline {
24
25
		/**
26
		 * The single instance of the class
27
		 *
28
		 * @var object
29
		 * @since 3.0.0
30
		 */
31
		protected static $_instance = null;
32
33
		/**
34
		 * Return the single class instance
35
		 *
36
		 * @return object
37
		 * @since 3.0.0
38
		 */
39
		public static function instance() {
40
			if ( is_null( self::$_instance ) ) {
41
				self::$_instance = new self();
42
			}
43
			return self::$_instance;
44
		}
45
46
		/**
47
		 * Class constructor
48
		 *
49
		 * @uses is_admin()
50
		 * @uses add_action()
51
		 *
52
		 * @since 3.0.0
53
		 */
54
		protected function __construct() {
55
			if ( is_admin() ) {
56
				add_action( 'black_studio_tinymce_load', array( $this, 'load' ) );
57
			}
58
		}
59
60
		/**
61
		 * Prevent the class from being cloned
62
		 *
63
		 * @return void
64
		 * @since 3.0.0
65
		 */
66
		protected function __clone() {
67
			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; uh?' ), '3.0' );
68
		}
69
		/**
70
		 * Load Jetpack After the deadline scripts
71
		 *
72
		 * @uses add_filter()
73
		 *
74
		 * @return void
75
		 * @since 3.0.0
76
		 */
77
		public function load() {
78
			add_filter( 'atd_load_scripts', '__return_true' );
79
		}
80
81
	} // END class
82
83
} // END class_exists
84