PageRenderTime 53ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/nonus/theme/shortcodes/sliders/ctFlexSliderItemShortcode.class.php

https://github.com/alniko009/magic
PHP | 65 lines | 29 code | 11 blank | 25 comment | 0 complexity | 89a7bd300a263d2cd4fea57b78232f06 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Flex Slider Item shortcode
  4. */
  5. class ctFlexSliderItemShortcode extends ctShortcode {
  6. /**
  7. * Returns name
  8. * @return string|void
  9. */
  10. public function getName() {
  11. return 'Flex Slider Item';
  12. }
  13. /**
  14. * Shortcode name
  15. * @return string
  16. */
  17. public function getShortcodeName() {
  18. return 'flex_slider_item';
  19. }
  20. /**
  21. * Handles shortcode
  22. * @param $atts
  23. * @param null $content
  24. * @return string
  25. */
  26. public function handle($atts, $content = null) {
  27. extract(shortcode_atts($this->extractShortcodeAttributes($atts), $atts));
  28. $preLink = $link ? ('<a href="' . $link . '">') : '';
  29. $postLink = $link ? '</a>' : '';
  30. return do_shortcode('<li>
  31. ' . $preLink . '
  32. <img src="' . $imgsrc . '" alt="">
  33. ' . $postLink . '
  34. </li>');
  35. }
  36. /**
  37. * Parent shortcode name
  38. * @return null
  39. */
  40. public function getParentShortcodeName() {
  41. return 'flex_slider';
  42. }
  43. /**
  44. * Returns config
  45. * @return null
  46. */
  47. public function getAttributes() {
  48. return array(
  49. 'imgsrc' => array('label' => __("source", 'ct_theme'), 'default' => '', 'type' => 'image', 'help' => __("Image", 'ct_theme')),
  50. 'link' => array('label' => __('link', 'ct_theme'), 'default' => '', 'type' => 'input', 'help' => __("Link from image", 'ct_theme')),
  51. );
  52. }
  53. }
  54. new ctFlexSliderItemShortcode();