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

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

https://github.com/alniko009/magic
PHP | 61 lines | 25 code | 11 blank | 25 comment | 0 complexity | a66529e17aed7a00dd1f793a245afa9c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Logo Slider item shortcode
  4. */
  5. class ctLogoSliderItemShortcode extends ctShortcode {
  6. /**
  7. * Returns name
  8. * @return string|void
  9. */
  10. public function getName() {
  11. return 'Logo slider item';
  12. }
  13. /**
  14. * Shortcode name
  15. * @return string
  16. */
  17. public function getShortcodeName() {
  18. return 'logo_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. $linkPre = $link ? ('<a href="' . $link . '">') : '';
  29. $linkPost = $link ? '</a>' : '';
  30. return do_shortcode('<li>' . $linkPre . '<img src="' . $imgsrc . '" alt="" >' . $linkPost . '</li>');
  31. }
  32. /**
  33. * Parent shortcode name
  34. * @return null
  35. */
  36. public function getParentShortcodeName() {
  37. return 'logo_slider';
  38. }
  39. /**
  40. * Returns config
  41. * @return null
  42. */
  43. public function getAttributes() {
  44. return array(
  45. 'link' => array('label' => __('link', 'ct_theme'), 'help' => __("ex. http://www.google.com", 'ct_theme')),
  46. 'imgsrc' => array('default' => '', 'type' => 'image', 'label' => __("image source", 'ct_theme')),
  47. );
  48. }
  49. }
  50. new ctLogoSliderItemShortcode();