PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 2.2.2
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v2.2.2
5.5.3 3.1.0 3.2.0 3.2.1 3.3.0 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.6.0 3.7.0 3.8.0 3.8.1 3.8.2 3.8.3 4.0.0 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 All 78 releases
← All changes | classes/class-copy-the-code.php +42 -94 3.8.12.2.2 View file →
@@ -1,6 +1,5 @@
1 1 <?php
2 -
3 2 /**
4 3 * Initialize Plugin
5 4 *
6 5 * @package Copy the Code
@@ -5,104 +4,53 @@
5 4 *
6 5 * @package Copy the Code
7 6 * @since 1.0.0
8 7 */
9 -if ( !class_exists( 'Copy_The_Code' ) ) {
10 - /**
11 - * Copy the Code
12 - *
13 - * @since 1.0.0
14 - */
15 - class Copy_The_Code {
16 - /**
17 - * Instance
18 - *
19 - * @access private
20 - * @var object Class Instance.
21 - * @since 1.0.0
22 - */
23 - private static $instance;
24 8
25 - /**
26 - * Initiator
27 - *
28 - * @since 1.0.0
29 - * @return object initialized object of class.
30 - */
31 - public static function get_instance() {
32 - if ( !isset( self::$instance ) ) {
33 - self::$instance = new self();
34 - }
35 - return self::$instance;
36 - }
9 +if ( ! class_exists( 'Copy_The_Code' ) ) :
37 10
38 - /**
39 - * Constructor
40 - */
41 - public function __construct() {
42 - require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-update.php';
43 - require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-page.php';
44 - require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-dashboard.php';
45 - require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-shortcode.php';
46 - require_once COPY_THE_CODE_DIR . 'classes/opt-in/class-copy-the-code-opt-in.php';
47 - require_once COPY_THE_CODE_DIR . 'classes/elementor/class-blocks.php';
48 - require_once COPY_THE_CODE_DIR . 'classes/gutenberg/class-blocks.php';
49 - require_once COPY_THE_CODE_DIR . 'classes/class-helpers.php';
50 - $this->create_cron_jobs();
51 - if ( $this->is_request( 'cron' ) ) {
52 - require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-analytics.php';
53 - }
54 - add_action( 'plugins_loaded', array($this, 'localization_setup'), 9 );
55 - }
11 + /**
12 + * Copy the Code
13 + *
14 + * @since 1.0.0
15 + */
16 + class Copy_The_Code {
56 17
57 - /**
58 - * Create cron jobs (clear them first).
59 - */
60 - private function create_cron_jobs() {
61 - wp_clear_scheduled_hook( 'copy_the_code_tracker_send_event' );
62 - wp_schedule_event( time() + 10, apply_filters( 'copy_the_code_tracker_event_recurrence', 'weekly' ), 'copy_the_code_tracker_send_event' );
63 - }
18 + /**
19 + * Instance
20 + *
21 + * @access private
22 + * @var object Class Instance.
23 + * @since 1.0.0
24 + */
25 + private static $instance;
64 26
65 - /**
66 - * What type of request is this?
67 - *
68 - * @param string $type admin, ajax, cron or frontend.
69 - * @return bool
70 - */
71 - private function is_request( $type ) {
72 - switch ( $type ) {
73 - case 'admin':
74 - return is_admin();
75 - case 'ajax':
76 - return defined( 'DOING_AJAX' );
77 - case 'cron':
78 - return defined( 'DOING_CRON' );
79 - }
80 - }
27 + /**
28 + * Initiator
29 + *
30 + * @since 1.0.0
31 + * @return object initialized object of class.
32 + */
33 + public static function get_instance() {
34 + if ( ! isset( self::$instance ) ) {
35 + self::$instance = new self;
36 + }
37 + return self::$instance;
38 + }
81 39
82 - /**
83 - * Initialize plugin for localization.
84 - *
85 - * Note: the first-loaded translation file overrides any following ones if the same translation is present.
86 - *
87 - * Locales found in:
88 - * - WP_LANG_DIR/copy-the-code/copy-the-code-LOCALE.mo
89 - * - WP_LANG_DIR/plugins/copy-the-code-LOCALE.mo
90 - */
91 - public function localization_setup() {
92 - $locale = ( is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale() );
93 - $locale = apply_filters( 'plugin_locale', $locale, 'copy-the-code' );
94 - // phpcs:ignore
95 - unload_textdomain( 'copy-the-code' );
96 - if ( false === load_textdomain( 'copy-the-code', WP_LANG_DIR . '/plugins/copy-the-code-' . $locale . '.mo' ) ) {
97 - load_textdomain( 'copy-the-code', WP_LANG_DIR . '/copy-the-code/copy-the-code-' . $locale . '.mo' );
98 - }
99 - load_plugin_textdomain( 'copy-the-code', false, COPY_THE_CODE_DIR . 'languages/' );
100 - }
40 + /**
41 + * Constructor
42 + */
43 + public function __construct() {
44 + require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-update.php';
45 + require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-page.php';
46 + require_once COPY_THE_CODE_DIR . 'classes/class-copy-the-code-shortcode.php';
47 + }
101 48
102 - }
49 + }
103 50
104 - /**
105 - * Kicking this off by calling 'get_instance()' method
106 - */
107 - Copy_The_Code::get_instance();
108 -}
51 + /**
52 + * Kicking this off by calling 'get_instance()' method
53 + */
54 + Copy_The_Code::get_instance();
55 +
56 +endif;