| 1 |
<?php |
| 2 |
/** |
| 3 |
* Module carcase |
| 4 |
* |
| 5 |
* @package Powerkit |
| 6 |
* @subpackage Core |
| 7 |
*/ |
| 8 |
|
| 9 |
// If this file is called directly, abort. |
| 10 |
if ( ! defined( 'WPINC' ) ) { |
| 11 |
die; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Module main class. |
| 16 |
*/ |
| 17 |
class Powerkit_Module { |
| 18 |
|
| 19 |
/** |
| 20 |
* The module name. |
| 21 |
* |
| 22 |
* @var string $name The module name. |
| 23 |
*/ |
| 24 |
public $name = null; |
| 25 |
|
| 26 |
/** |
| 27 |
* The module description. |
| 28 |
* |
| 29 |
* @var string $desc The module description. |
| 30 |
*/ |
| 31 |
public $desc = null; |
| 32 |
|
| 33 |
/** |
| 34 |
* The module slug. |
| 35 |
* |
| 36 |
* @var string $slug The module slug. |
| 37 |
*/ |
| 38 |
public $slug = null; // Required. |
| 39 |
|
| 40 |
/** |
| 41 |
* The module category. |
| 42 |
* |
| 43 |
* @var string $category The module category. |
| 44 |
*/ |
| 45 |
public $category = 'basic'; |
| 46 |
|
| 47 |
/** |
| 48 |
* The module priority. |
| 49 |
* |
| 50 |
* @var string $priority The module priority. |
| 51 |
*/ |
| 52 |
public $priority = 9999; |
| 53 |
|
| 54 |
/** |
| 55 |
* The module type. |
| 56 |
* |
| 57 |
* @var string $type The module type. |
| 58 |
*/ |
| 59 |
public $type = 'default'; |
| 60 |
|
| 61 |
/** |
| 62 |
* The module public side of the site. |
| 63 |
* |
| 64 |
* @var string $category The module public side of the site. |
| 65 |
*/ |
| 66 |
public $public = true; |
| 67 |
|
| 68 |
/** |
| 69 |
* The module enabled. |
| 70 |
* |
| 71 |
* @var string $enabled The module enabled. |
| 72 |
*/ |
| 73 |
public $enabled = true; |
| 74 |
|
| 75 |
/** |
| 76 |
* The module badge. |
| 77 |
* |
| 78 |
* @var string $badge The module badge. |
| 79 |
*/ |
| 80 |
public $badge = null; |
| 81 |
|
| 82 |
/** |
| 83 |
* The module load extensions. |
| 84 |
* |
| 85 |
* @var string $load_extensions The module load extensions. |
| 86 |
*/ |
| 87 |
public $load_extensions = array(); |
| 88 |
|
| 89 |
/** |
| 90 |
* The module actions links. |
| 91 |
* |
| 92 |
* @var string $links The module actions links. |
| 93 |
*/ |
| 94 |
public $links = array(); |
| 95 |
|
| 96 |
/** |
| 97 |
* __construct |
| 98 |
* |
| 99 |
* This function will initialize the initialize |
| 100 |
*/ |
| 101 |
public function __construct() { |
| 102 |
|
| 103 |
// Initialize. |
| 104 |
$this->register(); |
| 105 |
|
| 106 |
// Register module info. |
| 107 |
powerkit_register_module_info( array( |
| 108 |
'name' => $this->name, |
| 109 |
'desc' => $this->desc, |
| 110 |
'slug' => $this->slug, |
| 111 |
'type' => $this->type, |
| 112 |
'category' => $this->category, |
| 113 |
'priority' => $this->priority, |
| 114 |
'public' => $this->public, |
| 115 |
'enabled' => $this->enabled, |
| 116 |
'badge' => $this->badge, |
| 117 |
'load_extensions' => $this->load_extensions, |
| 118 |
'links' => $this->links, |
| 119 |
) ); |
| 120 |
|
| 121 |
// Check enabled module. |
| 122 |
if ( ! powerkit_module_enabled( $this->slug ) ) { |
| 123 |
return false; |
| 124 |
} |
| 125 |
|
| 126 |
// Define the functionality of the module. |
| 127 |
$this->initialize(); |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* Register |
| 132 |
* |
| 133 |
* This function will register the module |
| 134 |
*/ |
| 135 |
public function register() { |
| 136 |
|
| 137 |
/* do nothing */ |
| 138 |
} |
| 139 |
|
| 140 |
/** |
| 141 |
* Initialize |
| 142 |
* |
| 143 |
* This function will initialize the module |
| 144 |
*/ |
| 145 |
public function initialize() { |
| 146 |
|
| 147 |
/* do nothing */ |
| 148 |
} |
| 149 |
} |
| 150 |
|