PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/nonus/theme/shortcodes/typography/ctIconShortcode.class.php

https://github.com/alniko009/magic
PHP | 59 lines | 25 code | 9 blank | 25 comment | 1 complexity | c046ee9fd7e44b42c4d71a2eccb48d2e MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Icon shortcode
  4. */
  5. class ctIconShortcode extends ctShortcode {
  6. /**
  7. * Returns name
  8. * @return string|void
  9. */
  10. public function getName() {
  11. return 'Icon';
  12. }
  13. /**
  14. * Shortcode name
  15. * @return string
  16. */
  17. public function getShortcodeName() {
  18. return 'icon';
  19. }
  20. /**
  21. * Returns shortcode type
  22. * @return mixed|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. if($awesome){
  36. return '<i class="' . $awesome . '"></i>';
  37. }
  38. return '';
  39. }
  40. /**
  41. * Returns config
  42. * @return null
  43. */
  44. public function getAttributes() {
  45. return array(
  46. 'awesome' => array('label' => __('awesome icon', 'ct_theme'),'type' => "icon", 'default' => '','link'=>CT_THEME_ASSETS.'/shortcode/awesome/index.html'),
  47. );
  48. }
  49. }
  50. new ctIconShortcode();