Metabox
1 month ago
views
1 month ago
FSIE.php
1 month ago
FSPro.php
1 month ago
FSWalkthrough.php
1 month ago
FSWalkthroughPL.php
1 month ago
Metabox.php
1 month ago
Video.php
1 month ago
WooCommerceABC.php
1 month ago
WooCommerceABCPL.php
1 month ago
Metabox.php
116 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Info Metabox. |
| 4 | * |
| 5 | * @package WPDesk\FS\Info |
| 6 | */ |
| 7 | |
| 8 | namespace WPDesk\FS\Info; |
| 9 | |
| 10 | /** |
| 11 | * Metabox in FS Info. |
| 12 | */ |
| 13 | class Metabox { |
| 14 | |
| 15 | /** |
| 16 | * @var string |
| 17 | */ |
| 18 | private $id; |
| 19 | |
| 20 | /** |
| 21 | * @var string |
| 22 | */ |
| 23 | private $title; |
| 24 | |
| 25 | /** |
| 26 | * @var string |
| 27 | */ |
| 28 | private $body; |
| 29 | |
| 30 | /** |
| 31 | * @var string |
| 32 | */ |
| 33 | private $footer; |
| 34 | |
| 35 | /** |
| 36 | * Metabox constructor. |
| 37 | * |
| 38 | * @param string $id . |
| 39 | * @param string $title . |
| 40 | * @param string $body . |
| 41 | * @param string $footer . |
| 42 | */ |
| 43 | public function __construct( $id, $title, $body = '', $footer = '' ) { |
| 44 | $this->id = $id; |
| 45 | $this->title = $title; |
| 46 | $this->body = $body; |
| 47 | $this->footer = $footer; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @return string |
| 52 | */ |
| 53 | public function get_id() { |
| 54 | return $this->id; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @return string |
| 59 | */ |
| 60 | public function get_title() { |
| 61 | return $this->title; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @return string |
| 66 | */ |
| 67 | public function get_body() { |
| 68 | return $this->body; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @return string |
| 73 | */ |
| 74 | public function get_footer() { |
| 75 | return $this->footer; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @return bool |
| 80 | */ |
| 81 | public function has_title() { |
| 82 | return strlen( $this->title ) > 0; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @return bool |
| 87 | */ |
| 88 | public function has_body() { |
| 89 | return strlen( $this->body ) > 0; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * @return bool |
| 94 | */ |
| 95 | public function has_footer() { |
| 96 | return strlen( $this->footer ) > 0; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * @return string |
| 101 | */ |
| 102 | public function get_classes() { |
| 103 | $classes = array( 'fs-info-metabox' ); |
| 104 | |
| 105 | if ( $this->has_title() ) { |
| 106 | $classes[] = 'has-title'; |
| 107 | } |
| 108 | |
| 109 | if ( $this->has_footer() ) { |
| 110 | $classes[] = 'has-footer'; |
| 111 | } |
| 112 | |
| 113 | return implode( ' ', $classes ); |
| 114 | } |
| 115 | } |
| 116 |