PluginProbe
Property Hive / 2.2.5
Property Hive v2.2.5
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 / bricks-builder-widgets / property-street-view.php

property-street-view.php in Property Hive 2.2.5, at includes/bricks-builder-widgets/property-street-view.php

96 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Bricks Builder Property Street View Widget.
4 *
5 * @since 1.0.0
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10 class Bricks_Builder_Property_Street_View_Widget extends \Bricks\Element {
11
12 // Element properties
13 public $category = 'propertyhive';
14 public $name = 'bricks-builder-property-street-view';
15 public $icon = 'fas fa-street-view';
16 public $scripts = ['initialize_property_street_view'];
17
18 public function get_label()
19 {
20 return esc_html__( 'Street View', 'propertyhive' );
21 }
22
23 // Enqueue element styles and scripts
24 public function enqueue_scripts()
25 {
26 $suffix = '';
27 $assets_path = str_replace( array( 'http:', 'https:' ), '', PH()->plugin_url() ) . '/assets/';
28
29 if ( get_option('propertyhive_maps_provider') == 'osm' )
30 {
31
32 }
33 else
34 {
35 $api_key = get_option('propertyhive_google_maps_api_key');
36 wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3');
37 wp_enqueue_script('googlemaps');
38 }
39 }
40
41 public function set_control_groups()
42 {
43 /*$this->control_groups['form'] = [
44 'title' => esc_html__( 'Form', 'propertyhive' ),
45 'tab' => 'content', // content / style
46 ];*/
47 }
48
49 public function set_controls()
50 {
51 $this->controls['height'] = [
52 'tab' => 'content',
53 //'group' => 'settings',
54 'label' => esc_html__( 'Height', 'propertyhive' ),
55 'type' => 'number',
56 'default' => 400
57 ];
58 }
59
60 public function render()
61 {
62 global $property;
63
64 if ( !isset($property->id) )
65 {
66 return;
67 }
68
69 if ( $property->latitude == '' || $property->longitude == '' || $property->latitude == '0' || $property->longitude == '0' )
70 {
71 return;
72 }
73
74 if ( get_option('propertyhive_maps_provider') == 'osm' )
75 {
76 return;
77 }
78
79 $root_classes[] = $this->name;
80
81 // Add 'class' attribute to element root tag
82 $this->set_attribute( '_root', 'class', $root_classes );
83
84 echo "<div {$this->render_attributes( '_root' )}>";
85
86 $attributes = array();
87 if ( isset($this->settings['height']) && $this->settings['height'] != '' )
88 {
89 $attributes['height'] = $this->settings['height'];
90 }
91
92 get_property_street_view($attributes);
93
94 echo '</div>';
95 }
96 }