PluginProbe
Property Hive / 2.2.4
Property Hive v2.2.4
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / includes / salient-widgets / property-epcs-html.php

property-epcs-html.php in Property Hive 2.2.4, at includes/salient-widgets/property-epcs-html.php

65 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 extract(shortcode_atts(array(
6 "show_title" => "yes",
7 ), $atts));
8
9 global $property;
10
11 if ( !isset($property->id) ) {
12 return;
13 }
14
15 if ( isset($atts['show_title']) && $atts['show_title'] != 'yes' )
16 {
17 ?>
18 <style type="text/css">
19 .epcs h4 { display:none; }
20 </style>
21 <?php
22 }
23
24 if ( get_option('propertyhive_epcs_stored_as', '') == 'urls' )
25 {
26 $epc_urls = $property->_epc_urls;
27 if ( is_array($epc_urls) && !empty( $epc_urls ) )
28 {
29 echo '<div class="epcs">';
30
31 echo '<h4>' . esc_html(__( 'EPCs', 'propertyhive' )) . '</h4>';
32
33 foreach ($epc_urls as $epc)
34 {
35 echo '<a href="' . esc_url($epc['url']) . '" data-fancybox="epcs" rel="nofollow"><img src="' . esc_url($epc['url']) . '" alt=""></a>';
36 }
37
38 echo '</div>';
39 }
40 }
41 else
42 {
43 $epc_attachment_ids = $property->get_epc_attachment_ids();
44
45 if ( !empty($epc_attachment_ids) )
46 {
47 echo '<div class="epcs">';
48
49 echo '<h4>' . esc_html(__( 'EPCs', 'propertyhive' )) . '</h4>';
50
51 foreach ( $epc_attachment_ids as $attachment_id )
52 {
53 if ( wp_attachment_is_image($attachment_id) )
54 {
55 echo '<a href="' . esc_url(wp_get_attachment_url($attachment_id)) . '" data-fancybox="epcs" rel="nofollow"><img src="' . esc_url(wp_get_attachment_url($attachment_id)) . '" alt=""></a>';
56 }
57 else
58 {
59 echo '<a href="' . esc_url(wp_get_attachment_url($attachment_id)) . '" target="_blank" rel="nofollow">' . esc_html(__( 'View EPC', 'propertyhive' )) . '</a>';
60 }
61 }
62
63 echo '</div>';
64 }
65 }