| 1 | <?php namespace Webwizo\Shortcodes\Compilers; | ||
| 5 | class Shortcode implements Arrayable | ||
| 6 | { | ||
| 7 | /** | ||
| 8 | * Shortcode name | ||
| 9 | * | ||
| 10 | * @var string | ||
| 11 | */ | ||
| 12 | protected $name; | ||
| 13 | |||
| 14 | /** | ||
| 15 | * Shortcode Attributes | ||
| 16 | * | ||
| 17 | * @var array | ||
| 18 | */ | ||
| 19 | protected $attributes = []; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Shortcode content | ||
| 23 | * | ||
| 24 | * @var string | ||
| 25 | */ | ||
| 26 | public $content; | ||
| 27 | |||
| 28 | /** | ||
| 29 | * Constructor | ||
| 30 | * | ||
| 31 | * @param string $name | ||
| 32 | * @param array $attributes | ||
| 33 | * @param string $content | ||
| 34 | */ | ||
| 35 | public function __construct($name, $attributes = [], $content) | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Get html attribute | ||
| 44 | * | ||
| 45 | * @param string $attribute | ||
| 46 | * | ||
| 47 | * @return string|null | ||
| 48 | */ | ||
| 49 | public function get($attribute, $fallback = null) | ||
| 58 | |||
| 59 | /** | ||
| 60 | * Get shortcode name | ||
| 61 | * | ||
| 62 | * @return string | ||
| 63 | */ | ||
| 64 | public function getName() | ||
| 68 | |||
| 69 | /** | ||
| 70 | * Get shortcode attributes | ||
| 71 | * | ||
| 72 | * @return string | ||
| 73 | */ | ||
| 74 | public function getContent() | ||
| 78 | |||
| 79 | /** | ||
| 80 | * Return array of attributes; | ||
| 81 | * | ||
| 82 | * @return array | ||
| 83 | */ | ||
| 84 | public function toArray() | ||
| 88 | |||
| 89 | /** | ||
| 90 | * Dynamically get attributes | ||
| 91 | * | ||
| 92 | * @param string $param | ||
| 93 | * | ||
| 94 | * @return string|null | ||
| 95 | */ | ||
| 96 | public function __get($param) | ||
| 100 | } | ||
| 101 |