/** * Handles shortcode * @param $atts * @param null $content * @return string */ public function handle($atts, $content = null) { $attributes = shortcode_atts($this->extractShortcodeAttributes($atts), $atts); extract($attributes); $id = $id == '' ? 'gmap' . rand(100, 1000) : $id; //parse shortcode before filters do_shortcode($content); $points = $this->callPreFilter(''); //reference $this->cleanData('google_map_marker'); ctGoogleMapMarkerShortcode::$counter = 0; if (ct_is_browser_type('mobile') == true) { $attributes['disable_auto_pan'] = 'true'; $attributes['map_draggable'] = 'false'; } $this->addInlineJS($this->getInlineJS($attributes, $id, $points)); if (!is_numeric($height)) { $height = '286'; } $mainContainerAtts = array('class' => array('markersGoogleMap', 'googleMap', $class), 'data-height' => $height, 'id' => $id); $titleShortcode = $title ? '[header class="special" level="3" style="' . $title_style . '"]' . $title . '[/header]' : ''; if ($curved_subtitle == 'yes' || $curved_subtitle == 'true') { $curved_subtitle = 'curved="yes" radius="' . $radius . '" direction="' . $direction . '"'; } else { $curved_subtitle = ''; } if ($subtitle) { $overlayHtml = array('start' => '<div class="mapWithOverlay">[header level="4" style="' . $subtitle_style . '" ' . $curved_subtitle . ']' . $subtitle . '[/header]', 'end' => '</div>'); } else { $overlayHtml = array('start' => '', 'end' => ''); } $html = do_shortcode($overlayHtml['start'] . $titleShortcode . '<div ' . $this->buildContainerAttributes($mainContainerAtts, $atts) . '></div>' . $overlayHtml['end']); return $html; }
/** * Handles shortcode * @param $atts * @param null $content * @return string */ public function handle($atts, $content = null) { $attributes = shortcode_atts($this->extractShortcodeAttributes($atts), $atts); extract($attributes); $id = $id == '' ? 'gmap' . rand(100, 1000) : $id; $this->addInlineJS($this->getInlineJS($attributes, $id), true); $savedLocations = get_option('general_locations', array()); //see location.php file for details if ($foodtruck_locator == 'yes' || $foodtruck_locator == 'true') { if ($savedLocations) { $location = ''; $latitude = $savedLocations['lat']; $longitude = $savedLocations['lng']; } } if (!is_numeric($height)) { $height = '286'; } if ($attributes['map_draggable'] == 'yes') { $attributes['map_draggable'] = 'true'; } else { if ($attributes['map_draggable'] == 'no') { $attributes['map_draggable'] = 'false'; } } if (ct_is_browser_type('mobile') == true) { $attributes['map_draggable'] = 'false'; } $mainContainerAtts = array('class' => array('googleMap', $class), 'data-height' => $height, 'data-offset' => $offset, 'data-location' => $location, 'data-text' => strtr($custom_marker, array('%foodtruck_locator_address%' => isset($savedLocations['location']) ? $savedLocations['location'] : '')), 'data-latitude' => $latitude, 'data-longitude' => $longitude, 'data-map_draggable' => $attributes['map_draggable'], 'data-street_view' => $attributes['street_view'], 'data-map_type' => $attributes['map_type'], 'id' => $id); $titleShortcode = $title ? '[header class="special" level="3" style="' . $title_style . '"]' . $title . '[/header]' : ''; if ($curved_subtitle == 'yes' || $curved_subtitle == 'true') { $curved_subtitle = 'curved="yes" radius="' . $radius . '" direction="' . $direction . '"'; } else { $curved_subtitle = ''; } if ($subtitle) { $overlayHtml = array('start' => '<div class="mapWithOverlay">[header level="4" style="' . $subtitle_style . '" ' . $curved_subtitle . ']' . $subtitle . '[/header]', 'end' => '</div>'); } else { $overlayHtml = array('start' => '', 'end' => ''); } $html = do_shortcode($overlayHtml['start'] . $titleShortcode . '<div ' . $this->buildContainerAttributes($mainContainerAtts, $atts) . '></div>' . $overlayHtml['end']); return $html; }