PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/nonus/theme/shortcodes/boxes/ctIconBoxShortcode.class.php

https://github.com/alniko009/magic
PHP | 62 lines | 28 code | 9 blank | 25 comment | 0 complexity | 9210b95a4b1a05431993d4cdd9f616bc MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Icon Box shortcode
  4. */
  5. class ctIconBoxShortcode extends ctShortcode {
  6. /**
  7. * Returns name
  8. * @return string|void
  9. */
  10. public function getName() {
  11. return 'Icon box';
  12. }
  13. /**
  14. * Shortcode name
  15. * @return string
  16. */
  17. public function getShortcodeName() {
  18. return 'icon_box';
  19. }
  20. /**
  21. * Shortcode type
  22. * @return string
  23. */
  24. public function getShortcodeType() {
  25. return self::TYPE_SHORTCODE_ENCLOSING;
  26. }
  27. /**
  28. * Handles shortcode
  29. * @param $atts
  30. * @param null $content
  31. * @return string
  32. */
  33. public function handle($atts, $content = null) {
  34. extract(shortcode_atts($this->extractShortcodeAttributes($atts), $atts));
  35. return '<div class="icon-box">
  36. <h4><i class="' . $icon . '"></i>' . $header . '</h4>
  37. <p>' . do_shortcode($content) . '</p>
  38. </div>';
  39. }
  40. /**
  41. * Returns config
  42. * @return null
  43. */
  44. public function getAttributes() {
  45. return array(
  46. 'header' => array('label' => __('header', 'ct_theme'), 'default' => '', 'type' => 'input', 'help' => __("Header text", 'ct_theme')),
  47. 'icon' => array('label' => __('icon', 'ct_theme'),'type' => "icon", 'default' => '','link'=>CT_THEME_ASSETS.'/shortcode/awesome/index.html'),
  48. 'content' => array('label' => __('content', 'ct_theme'), 'default' => '', 'type' => "textarea"),
  49. );
  50. }
  51. }
  52. new ctIconBoxShortcode();