| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
use EBS\Security\Sanitizer; |
| 6 |
|
| 7 |
/* * ********************************************************* |
| 8 |
* BUTTONS |
| 9 |
* ********************************************************* */ |
| 10 |
|
| 11 |
function osc_theme_oscitasthumbnail( $params, $content = 'Label' ) { |
| 12 |
$atts = shortcode_atts( |
| 13 |
array( |
| 14 |
'src' => '', |
| 15 |
'class' => '', |
| 16 |
'link' => '', |
| 17 |
'border' => '', |
| 18 |
'target' => '_self', |
| 19 |
'alt' => '', |
| 20 |
), |
| 21 |
$params |
| 22 |
); |
| 23 |
|
| 24 |
$out = ''; |
| 25 |
$src = Sanitizer::url( $atts['src'] ); |
| 26 |
$class = Sanitizer::class_list( $atts['class'] ); |
| 27 |
$link = Sanitizer::url( $atts['link'] ); |
| 28 |
$alt = Sanitizer::attr( $atts['alt'] ); |
| 29 |
$target = '_blank' === $atts['target'] ? '_blank' : '_self'; |
| 30 |
|
| 31 |
if ( '' !== $atts['border'] ) { |
| 32 |
$border_class = 'img-thumbnail'; |
| 33 |
} else { |
| 34 |
$border_class = 'img-responsive'; |
| 35 |
} |
| 36 |
|
| 37 |
if ( '' !== $atts['link'] ) { |
| 38 |
$out .= '<a href="' . $link . '" target="' . Sanitizer::attr( $target ) . '">'; |
| 39 |
} |
| 40 |
$out .= '<img src="' . $src . '" class="' . $border_class . EBS_CONTAINER_CLASS . ' oscitas-res-image" alt="' . $alt . '">'; |
| 41 |
if ( '' !== $atts['link'] ) { |
| 42 |
$out .= '</a>'; |
| 43 |
} |
| 44 |
|
| 45 |
return $out; |
| 46 |
} |
| 47 |
|
| 48 |
ebs_backward_compatibility_callback( 'thumbnail', 'osc_theme_oscitasthumbnail' ); |
| 49 |
|