PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 3.4.2
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v3.4.2
4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / src / data / utils / wizard / wizard-items / class-wizard-item.php
superb-blocks / src / data / utils / wizard / wizard-items Last commit date
class-wizard-item-extensions.php 1 year ago class-wizard-item.php 1 year ago
class-wizard-item.php
89 lines
1 <?php
2
3 namespace SuperbAddons\Data\Utils\Wizard;
4
5 use SuperbAddons\Admin\Controllers\Wizard\WizardTemplatePreviewController;
6
7 defined('ABSPATH') || exit();
8
9 class WizardItem
10 {
11 public $id;
12 private $slug;
13 public $type;
14 public $datatype;
15 public $title;
16 public $permalink;
17 public $no_reload;
18 public $is_premium;
19 public $is_file_template;
20 public $is_restoration_point;
21 public $use_custom_page_template_preview;
22 public $plugin_update_required;
23 public $external_plugin_required;
24 public $required_plugin_names;
25
26 public function __construct($template)
27 {
28 $this->id = isset($template->id) ? $template->id : false;
29 $this->slug = isset($template->slug) ? $template->slug : $this->id;
30 $this->type = isset($template->type) ? $template->type : false;
31 $this->datatype = isset($template->datatype) ? $template->datatype : $this->type;
32 if ($this->slug === 'front-page') {
33 $this->datatype = 'front-page';
34 }
35 $this->title = isset($template->title) ? $template->title : false;
36 $this->permalink = isset($template->permalink) ? $template->permalink : get_home_url();
37 $this->no_reload = isset($template->no_reload) ? $template->no_reload : false;
38 $this->is_premium = isset($template->is_premium) ? $template->is_premium : false;
39 $this->plugin_update_required = isset($template->plugin_update_required) && $template->plugin_update_required;
40 $this->external_plugin_required = isset($template->external_plugin_required) && $template->external_plugin_required;
41 $this->required_plugin_names = isset($template->required_plugin_names) ? $template->required_plugin_names : array();
42 $this->is_file_template = false;
43 $this->is_restoration_point = false;
44 $this->use_custom_page_template_preview = isset($template->use_custom_page_template_preview) ? $template->use_custom_page_template_preview : 0;
45 }
46
47 public function GetId()
48 {
49 if ($this->is_file_template) {
50 return $this->id . WizardItemIdAffix::FILE_TEMPLATE;
51 }
52 if ($this->is_restoration_point) {
53 return $this->id . WizardItemIdAffix::RESTORATION_POINT;
54 }
55 return $this->id;
56 }
57
58 public function GetSlug()
59 {
60 if ($this->is_file_template) {
61 return $this->slug . WizardItemIdAffix::FILE_TEMPLATE;
62 }
63 if ($this->is_restoration_point) {
64 return $this->GetId();
65 }
66 return $this->slug;
67 }
68
69 public function GetBaseSlug()
70 {
71 return $this->slug;
72 }
73
74 public function SetSlug($slug)
75 {
76 $this->slug = $slug;
77 }
78
79 public function IsPattern()
80 {
81 return $this->type === WizardItemTypes::PATTERN || $this->type === WizardItemTypes::WP_TEMPLATE_PART;
82 }
83
84 public function GetPreviewURL()
85 {
86 return add_query_arg(array(WizardTemplatePreviewController::TEMPLATE_PREVIEW_KEY => $this->GetId(), WizardTemplatePreviewController::TEMPLATE_TYPE_KEY => $this->type, WizardTemplatePreviewController::USE_PAGE_TEMPLATE_KEY => $this->use_custom_page_template_preview, 'superb-preview-time' => time()), $this->permalink);
87 }
88 }
89