| 1 |
<?php |
| 2 |
/** |
| 3 |
* The widget model class for ThemeIsle SDK |
| 4 |
* |
| 5 |
* @package ThemeIsleSDK |
| 6 |
* @subpackage Widgets |
| 7 |
* @copyright Copyright (c) 2017, Marius Cristea |
| 8 |
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License |
| 9 |
* @since 1.0.0 |
| 10 |
*/ |
| 11 |
// Exit if accessed directly. |
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
if ( ! class_exists( 'ThemeIsle_SDK_Widget' ) ) : |
| 16 |
/** |
| 17 |
* Widget model for ThemeIsle SDK. |
| 18 |
*/ |
| 19 |
abstract class ThemeIsle_SDK_Widget { |
| 20 |
/** |
| 21 |
* @var ThemeIsle_SDK_Product $product Themeisle Product. |
| 22 |
*/ |
| 23 |
protected $product; |
| 24 |
|
| 25 |
/** |
| 26 |
* ThemeIsle_SDK_Widget constructor. |
| 27 |
* |
| 28 |
* @param ThemeIsle_SDK_Product $product_object Product Object. |
| 29 |
*/ |
| 30 |
public function __construct( $product_object ) { |
| 31 |
if ( $product_object instanceof ThemeIsle_SDK_Product ) { |
| 32 |
$this->product = $product_object; |
| 33 |
} |
| 34 |
$this->setup_hooks(); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Registers the hooks and then delegates to the child |
| 39 |
*/ |
| 40 |
public function setup_hooks() { |
| 41 |
$this->setup_hooks_child(); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Abstract function for delegating to the child |
| 46 |
*/ |
| 47 |
protected abstract function setup_hooks_child(); |
| 48 |
|
| 49 |
} |
| 50 |
endif; |
| 51 |
|