PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 3.7.1
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v3.7.1
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 / components / buttons / class-button.php
superb-blocks / src / components / buttons Last commit date
class-button.php 5 months ago class-insert-button.php 5 months ago class-premium-button.php 5 months ago class-preview-button.php 5 months ago
class-button.php
61 lines
1 <?php
2
3 namespace SuperbAddons\Components\Buttons;
4
5 defined('ABSPATH') || exit();
6
7 class Button
8 {
9 private $type;
10 private $text;
11 private $icon;
12 private $url;
13 private $class;
14 private $target;
15 private $id;
16
17 public function __construct($type = ButtonType::Primary, $icon = ButtonIcon::ExternalLink, $options = array())
18 {
19
20 $this->text = isset($options['text']) ? $options['text'] : '';
21 $this->url = isset($options['url']) ? $options['url'] : '';
22 $this->id = isset($options['id']) ? $options['id'] : '';
23 $this->class = isset($options['class']) ? $options['class'] : '';
24 $this->target = isset($options['target']) ? $options['target'] : '';
25 $this->type = $type;
26 $this->icon = $icon;
27
28 $this->Render();
29 }
30
31 private function Render()
32 {
33 ?>
34 <a id="<?php echo esc_attr($this->id); ?>" <?php echo !empty($this->url) ? 'href="' . esc_url($this->url) . '"' : ''; ?> <?php echo !empty($this->target) ? 'target="' . esc_attr($this->target) . '"' : ''; ?> class="superb-addons-template-library-button superb-addons-template-library-button-<?php echo esc_attr($this->type); ?> <?php echo esc_attr($this->class); ?>">
35 <?php if (!empty($this->text)) {
36 echo esc_html($this->text);
37 }
38
39 if (!empty($this->icon)) : ?>
40 <img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/" . esc_attr($this->icon)); ?>" />
41 <?php endif; ?>
42 </a>
43 <?php
44 }
45 }
46
47 class ButtonType
48 {
49 const Primary = 'primary';
50 const Secondary = 'secondary';
51 const Success = 'success';
52 const Danger = 'danger';
53 }
54
55 class ButtonIcon
56 {
57 const Insert = 'plus-circle.svg';
58 const Preview = 'preview.svg';
59 const ExternalLink = 'external-link.svg';
60 }
61