| @@ -1,54 +1,61 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * | |
| 4 | - */ | |
| 5 | - | |
| 6 | -namespace RadiusTheme\SB\Traits; | |
| 7 | - | |
| 8 | -// Do not allow directly accessing this file. | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | - exit( 'This script cannot be accessed directly.' ); | |
| 11 | -} | |
| 12 | - | |
| 13 | -trait SingletonTrait { | |
| 14 | - /** | |
| 15 | - * The single instance of the class. | |
| 16 | - * | |
| 17 | - * @var object | |
| 18 | - */ | |
| 19 | - protected static $instance = null; | |
| 20 | - | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * Constructor | |
| 24 | - * | |
| 25 | - * @return void | |
| 26 | - */ | |
| 27 | - // public function __construct() {} | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * @return self | |
| 31 | - */ | |
| 32 | - final public static function instance() { | |
| 33 | - if ( null === self::$instance ) { | |
| 34 | - self::$instance = new self(); | |
| 35 | - } | |
| 36 | - | |
| 37 | - return self::$instance; | |
| 38 | - } | |
| 39 | - | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * Prevent cloning. | |
| 43 | - */ | |
| 44 | - final public function __clone() { | |
| 45 | - } | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * Prevent unserializing. | |
| 49 | - */ | |
| 50 | - final public function __wakeup() { | |
| 51 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'shopbuilder' ), '1.0' ); | |
| 52 | - die(); | |
| 53 | - } | |
| 54 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * | |
| 4 | + */ | |
| 5 | + | |
| 6 | +namespace RadiusTheme\SB\Traits; | |
| 7 | + | |
| 8 | +// Do not allow directly accessing this file. | |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | + exit( 'This script cannot be accessed directly.' ); | |
| 11 | +} | |
| 12 | + | |
| 13 | +trait SingletonTrait { | |
| 14 | + /** | |
| 15 | + * The single instance of the class. | |
| 16 | + * | |
| 17 | + * @var object | |
| 18 | + */ | |
| 19 | + protected static $instance = null; | |
| 20 | + | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * Constructor | |
| 24 | + * | |
| 25 | + * @return void | |
| 26 | + */ | |
| 27 | + // public function __construct() {} | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * @return self | |
| 31 | + */ | |
| 32 | + final public static function instance() { | |
| 33 | + if ( null === self::$instance ) { | |
| 34 | + self::$instance = new self(); | |
| 35 | + } | |
| 36 | + | |
| 37 | + return self::$instance; | |
| 38 | + } | |
| 39 | + | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * Prevent cloning. | |
| 43 | + */ | |
| 44 | + final public function __clone() { | |
| 45 | + } | |
| 46 | + | |
| 47 | + // Prevent serialization of the instance | |
| 48 | + public function __sleep() { | |
| 49 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'shopbuilder' ), '1.0' ); | |
| 50 | + die(); | |
| 51 | + } | |
| 52 | + | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Prevent unserializing. | |
| 56 | + */ | |
| 57 | + final public function __wakeup() { | |
| 58 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'shopbuilder' ), '1.0' ); | |
| 59 | + die(); | |
| 60 | + } | |
| 61 | +} | |