| 1 |
<?php |
| 2 |
/** |
| 3 |
* Widgets |
| 4 |
* |
| 5 |
* @package CartFlows |
| 6 |
*/ |
| 7 |
|
| 8 |
define( 'CARTFLOWS_WIDGETS_DIR', CARTFLOWS_DIR . 'modules/widgets/' ); |
| 9 |
define( 'CARTFLOWS_WIDGETS_URL', CARTFLOWS_URL . 'modules/widgets/' ); |
| 10 |
|
| 11 |
/** |
| 12 |
* Initial Setup |
| 13 |
* |
| 14 |
* @since 1.0.0 |
| 15 |
*/ |
| 16 |
class Cartflows_Widgets { |
| 17 |
|
| 18 |
|
| 19 |
/** |
| 20 |
* Member Variable |
| 21 |
* |
| 22 |
* @var object instance |
| 23 |
*/ |
| 24 |
private static $instance; |
| 25 |
|
| 26 |
/** |
| 27 |
* Initiator |
| 28 |
*/ |
| 29 |
public static function get_instance() { |
| 30 |
if ( ! isset( self::$instance ) ) { |
| 31 |
self::$instance = new self; |
| 32 |
} |
| 33 |
return self::$instance; |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Constructor function that initializes required actions and hooks |
| 38 |
*/ |
| 39 |
public function __construct() { |
| 40 |
|
| 41 |
require_once CARTFLOWS_WIDGETS_DIR . 'class-cartflows-next-step.php'; |
| 42 |
|
| 43 |
// Register and load the widget. |
| 44 |
add_action( 'widgets_init', array( $this, 'register_widgets' ) ); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Register widgets |
| 49 |
*/ |
| 50 |
function register_widgets() { |
| 51 |
register_widget( 'cartflows_next_step' ); |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Kicking this off by calling 'get_instance()' method |
| 57 |
*/ |
| 58 |
Cartflows_Widgets::get_instance(); |
| 59 |
|