| @@ -1,0 +1,120 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Extension Abstract | |
| 5 | + * | |
| 6 | + * @package NotificationX\Extensions | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace NotificationX\Types; | |
| 10 | + | |
| 11 | +use NotificationX\Modules; | |
| 12 | +use NotificationX\Core\Themes; | |
| 13 | +use NotificationX\Extensions\GlobalFields; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Extension Abstract for all Types. | |
| 17 | + */ | |
| 18 | +abstract class Types { | |
| 19 | + | |
| 20 | + public $id; | |
| 21 | + public $title; | |
| 22 | + public $dashboard_title; | |
| 23 | + public $is_pro = false; | |
| 24 | + public $themes = []; | |
| 25 | + public $res_themes = []; | |
| 26 | + public $module = []; | |
| 27 | + public $templates = []; | |
| 28 | + public $mobile_templates = []; | |
| 29 | + public $default_source = ''; | |
| 30 | + public $default_theme = ''; | |
| 31 | + public $default_res_theme = ''; | |
| 32 | + public $popup = null; | |
| 33 | + public $link_type = 'none'; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * Initially Invoked when initialized. | |
| 37 | + */ | |
| 38 | + public function __construct() { | |
| 39 | + add_action('init', [$this, 'init']); | |
| 40 | + add_action('nx_before_metabox_load', [$this, 'init_fields']); | |
| 41 | + add_filter('nx_type_trigger', [$this, 'type_trigger']); | |
| 42 | + if(method_exists($this, 'preview_entry')){ | |
| 43 | + add_filter("nx_preview_entry_{$this->id}", array($this, 'preview_entry'), 10, 2); | |
| 44 | + } | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * admin int hook. | |
| 49 | + * | |
| 50 | + * | |
| 51 | + * @return void | |
| 52 | + */ | |
| 53 | + public function init(){ | |
| 54 | + | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * admin int hook. | |
| 59 | + * | |
| 60 | + * | |
| 61 | + * @return void | |
| 62 | + */ | |
| 63 | + public function init_fields(){ | |
| 64 | + | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Get themes for the extension. | |
| 69 | + * | |
| 70 | + * | |
| 71 | + * @param array $args Settings arguments. | |
| 72 | + * @return mixed | |
| 73 | + */ | |
| 74 | + public function type_trigger($triggers){ | |
| 75 | + $triggers[$this->id] = "@source:{$this->default_source}"; | |
| 76 | + return $triggers; | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Get themes for the extension. | |
| 81 | + * | |
| 82 | + * | |
| 83 | + * @param array $args Settings arguments. | |
| 84 | + * @return mixed | |
| 85 | + */ | |
| 86 | + public function get_themes(){ | |
| 87 | + return $this->themes; | |
| 88 | + } | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * Get responsive themes for the extension. | |
| 92 | + * | |
| 93 | + * | |
| 94 | + * @param array $args Settings arguments. | |
| 95 | + * @return mixed | |
| 96 | + */ | |
| 97 | + public function get_res_themes(){ | |
| 98 | + return $this->res_themes; | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * Get templates for the extension. | |
| 103 | + * | |
| 104 | + * | |
| 105 | + * @return array | |
| 106 | + */ | |
| 107 | + public function get_templates(){ | |
| 108 | + return $this->templates; | |
| 109 | + } | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * Get mobile templates for the extension. | |
| 113 | + * | |
| 114 | + * | |
| 115 | + * @return array | |
| 116 | + */ | |
| 117 | + public function get_mobile_templates(){ | |
| 118 | + return $this->mobile_templates; | |
| 119 | + } | |
| 120 | +} | |