| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace Jet_Form_Builder\Classes; |
| 5 |
|
| 6 |
|
| 7 |
trait Instance_Trait { |
| 8 |
|
| 9 |
public static $instance; |
| 10 |
|
| 11 |
/** |
| 12 |
* Instance. |
| 13 |
* |
| 14 |
* Ensures only one instance of the plugin class is loaded or can be loaded. |
| 15 |
* |
| 16 |
* @return Instance_Trait An instance of the class. |
| 17 |
* @since 1.0.0 |
| 18 |
* @access public |
| 19 |
* @static |
| 20 |
*/ |
| 21 |
public static function instance() { |
| 22 |
|
| 23 |
if ( is_null( self::$instance ) ) { |
| 24 |
self::$instance = new self(); |
| 25 |
} |
| 26 |
|
| 27 |
return self::$instance; |
| 28 |
} |
| 29 |
|
| 30 |
public static function clear() { |
| 31 |
self::$instance = null; |
| 32 |
} |
| 33 |
} |