PageRenderTime 31ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/alniko009/magic
PHP | 63 lines | 29 code | 9 blank | 25 comment | 0 complexity | 0d863ac23922c8677f26cb3b641f2e60 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Button Box shortcode
  4. */
  5. class ctButtonBoxShortcode extends ctShortcode {
  6. /**
  7. * Returns name
  8. * @return string|void
  9. */
  10. public function getName() {
  11. return 'Button box';
  12. }
  13. /**
  14. * Shortcode name
  15. * @return string
  16. */
  17. public function getShortcodeName() {
  18. return 'button_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="button-box">
  36. <p class="span9">
  37. ' . do_shortcode($content) . '
  38. </p>
  39. <a href="' . $link . '" class="btn btn-default pull-right span3">' . $buttontext . '</a>
  40. </div>';
  41. }
  42. /**
  43. * Returns config
  44. * @return null
  45. */
  46. public function getAttributes() {
  47. return array(
  48. 'buttontext' => array('label' => __('button text', 'ct_theme'), 'default' => '', 'type' => 'input', 'help' => __("Button text", 'ct_theme')),
  49. 'link' => array('label' => __('link', 'ct_theme'), 'default' => '', 'type' => 'input', 'help' => __("Button link", 'ct_theme')),
  50. 'content' => array('label' => __('content', 'ct_theme'), 'default' => '', 'type' => "textarea"),
  51. );
  52. }
  53. }
  54. new ctButtonBoxShortcode();