PluginProbe
MarqueeX – Smooth Marquee Slider, News Ticker & Post Marquee for Block Editor & Elementor / 0.6.0
MarqueeX – Smooth Marquee Slider, News Ticker & Post Marquee for Block Editor & Elementor v0.6.0
0.6.0 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.0 0.3.3 0.3.2 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.1.0 0.1.1 0.1.2 0.2.0 0.2.1 0.2.2 0.2.3 0.3.0 0.3.1
marqueex / includes / Traits / Singleton.php

Singleton.php in MarqueeX – Smooth Marquee Slider, News Ticker & Post Marquee for Block Editor & Elementor 0.6.0, at includes/Traits/Singleton.php

53 lines 952 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wpxero\Marqueex\Traits;
4
5 if (!defined('ABSPATH')) {
6 exit; // Exit if accessed directly.
7 }
8
9 /**
10 * Singleton Trait
11 *
12 * Provides singleton functionality to classes
13 */
14 trait Singleton {
15 /**
16 * Instance of this class
17 *
18 * @var static
19 */
20 protected static $instance = null;
21
22 /**
23 * Get instance of this class
24 *
25 * @return static
26 */
27 public static function get_instance() {
28 if (null === static::$instance) {
29 static::$instance = new static();
30 }
31
32 return static::$instance;
33 }
34
35 /**
36 * Prevent cloning of the instance
37 *
38 * @return void
39 */
40 private function __clone() {
41 }
42
43 /**
44 * Prevent unserializing of the instance
45 *
46 * @throws \Exception When attempting to unserialize
47 * @return void
48 */
49 public function __wakeup() {
50 throw new \Exception('Cannot unserialize singleton');
51 }
52 }
53