| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 4 |
|
| 5 |
$css = ''; |
| 6 |
|
| 7 |
extract(shortcode_atts(array( |
| 8 |
"css" => "", |
| 9 |
"font_container" => "", |
| 10 |
), $atts)); |
| 11 |
|
| 12 |
global $property; |
| 13 |
|
| 14 |
if ( !isset($property->id) ) { |
| 15 |
return; |
| 16 |
} |
| 17 |
|
| 18 |
if ( $property->bathrooms == '' || $property->bathrooms == '0' ) { |
| 19 |
return; |
| 20 |
} |
| 21 |
|
| 22 |
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class( $css, ' ' ), $this->settings['base'], $atts ); |
| 23 |
|
| 24 |
$style = ''; |
| 25 |
if ( ! empty( $atts['font_container'] ) && isset($atts['font_container']) ) |
| 26 |
{ |
| 27 |
$style = ph_extract_font_style_from_salient_font_container( $font_container ); |
| 28 |
} |
| 29 |
|
| 30 |
echo '<div class="' . esc_attr( $css_class ) . '" ' . $style . '>'; |
| 31 |
|
| 32 |
$label = __( 'Brochure', 'propertyhive' ); |
| 33 |
|
| 34 |
if ( get_option('propertyhive_brochures_stored_as', '') == 'urls' ) |
| 35 |
{ |
| 36 |
$brochure_urls = $property->brochure_urls; |
| 37 |
if ( !is_array($brochure_urls) ) { $brochure_urls = array(); } |
| 38 |
|
| 39 |
if ( !empty($brochure_urls) ) |
| 40 |
{ |
| 41 |
foreach ( $brochure_urls as $brochure ) |
| 42 |
{ |
| 43 |
echo '<a href="' . esc_url($brochure['url']) . '" target="_blank" rel="nofollow">' . esc_html($label) . '</a>'; |
| 44 |
} |
| 45 |
} |
| 46 |
} |
| 47 |
else |
| 48 |
{ |
| 49 |
$brochure_attachment_ids = $property->get_brochure_attachment_ids(); |
| 50 |
|
| 51 |
if ( !empty($brochure_attachment_ids) ) |
| 52 |
{ |
| 53 |
foreach ( $brochure_attachment_ids as $attachment_id ) |
| 54 |
{ |
| 55 |
echo '<a href="' . esc_url(wp_get_attachment_url($attachment_id)) . '" target="_blank" rel="nofollow">' . esc_html($label) . '</a>'; |
| 56 |
} |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
echo '</div>'; |