Exemplo n.º 1
0
 function st_location_map($attr)
 {
     $return = "<div style='position: relative' id='google-map-tab' data-lat= '" . get_post_meta(get_the_ID(), 'map_lat', true) . "' data-long = '" . get_post_meta(get_the_ID(), 'map_lng', true) . "' >";
     $st_type;
     $number = get_post_meta(get_the_ID(), 'max_post_type_num', true);
     if (!$number) {
         $number = 36;
     }
     $zoom = get_post_meta(get_the_ID(), 'map_zoom', true);
     if (!$zoom) {
         $zoom = 15;
     }
     $map_height = get_post_meta(get_the_ID(), 'map_height', true);
     if (!$map_height) {
         $map_height = 500;
     }
     $map_location_style = get_post_meta(get_the_ID(), 'map_location_style', true);
     if (!$map_location_style) {
         $map_location_style = 'normal';
     }
     $list_post_type = STLocation::get_post_type_list_active();
     $shortcode_string = "";
     if (is_array($list_post_type) and !empty($list_post_type)) {
         foreach ($list_post_type as $key => $value) {
             if (get_post_meta(get_the_ID(), 'tab_enable_' . $value, true) == 'on') {
                 $flag = $value;
             }
             if ($key != 0) {
                 $shortcode_string .= "," . $value;
             } else {
                 $shortcode_string .= $value;
             }
         }
     }
     $show_data_list_map = apply_filters('show_data_list_map', 'no');
     $return .= do_shortcode('[st_list_map 
           st_type= "' . $shortcode_string . '" 
           number="' . $number . '" 
           zoom="' . $zoom . '" 
           height="' . $map_height . '" 
           style_map="' . $map_location_style . '" 
           st_list_location="' . get_the_ID() . '" 
           show_data_list_map = "' . $show_data_list_map . '" 
           show_search_box = "no"]');
     $return .= "</div>";
     return $return;
 }
Exemplo n.º 2
0
             <?php 
 $st_type;
 if (!$number) {
     $number = 36;
 }
 if (!$map_height) {
     $map_height = 500;
 }
 if (!isset($map_location_style)) {
     $map_location_style = 'normal';
 }
 $zoom = get_post_meta(get_the_ID(), 'map_zoom_location', true);
 if (!$zoom) {
     $zoom = 15;
 }
 $list_post_type = STLocation::get_post_type_list_active();
 $shortcode_string = "";
 if (is_array($list_post_type) and !empty($list_post_type)) {
     foreach ($list_post_type as $key => $value) {
         if (get_post_meta(get_the_ID(), 'tab_enable_' . $value, true) == 'on') {
             $flag = $value;
         }
         if ($key != 0) {
             $shortcode_string .= "," . $value;
         } else {
             $shortcode_string .= $value;
         }
     }
 }
 $show_data_list_map = apply_filters('show_data_list_map', 'no');
 echo do_shortcode('[st_list_map 
Exemplo n.º 3
0
    public function form($instance)
    {
        // title
        // list post type checkbox
        // review checkbox
        // location select
        if (isset($instance['title'])) {
            $title = $instance['title'];
        } else {
            $title = __('Title', ST_TEXTDOMAIN);
        }
        if (isset($instance['post_type'])) {
            $post_type = $instance['post_type'];
        }
        if (isset($instance['count_review'])) {
            $count_review = $instance['count_review'];
        }
        ?>
		<div class='location_widget_item'>
			<p>
				<label ><?php 
        echo balancetags("Title", ST_TEXTDOMAIN);
        ?>
</label>
				<input value='<?php 
        echo esc_attr($title);
        ?>
' type='text' name='<?php 
        echo $this->get_field_name('title');
        ?>
'/>
			</p>
			<p>
				<label><?php 
        echo balancetags("Post type select ", ST_TEXTDOMAIN);
        ?>
</label>
				<?php 
        $get_post_type_list_active = STLocation::get_post_type_list_active();
        if (!empty($get_post_type_list_active) and is_array($get_post_type_list_active)) {
            foreach (STLocation::get_post_type_list_active() as $key => $value) {
                ?>
						<br>
						<input <?php 
                if (!empty($post_type) and $post_type and in_array($value, $post_type)) {
                    echo esc_attr('checked');
                }
                ?>
 
						id ='<?php 
                echo esc_attr("st_w_" . $value);
                ?>
'  
						value = '<?php 
                echo esc_attr($value);
                ?>
' 
						type='checkbox' 
						name='<?php 
                echo balancetags($this->get_field_name('post_type'));
                ?>
[]'/> 
						<label ><?php 
                echo esc_attr(STLocation::get_post_type_name($value, true));
                ?>
</label>
						<?php 
            }
        }
        ?>
			</p>
			<p>
				<label><?php 
        echo balancetags("Count Review", ST_TEXTDOMAIN);
        ?>
</label>
				<input <?php 
        if (!empty($count_review) and $count_review == 'on') {
            echo "checked";
        }
        ?>
 type='checkbox' name='<?php 
        echo balancetags($this->get_field_name('count_review'));
        ?>
'/>
			</p>
			<p>
				<label><?php 
        echo esc_attr("Location select", ST_TEXTDOMAIN);
        ?>
</label>
				<?php 
        $list_location = TravelerObject::get_list_location();
        if (!empty($instance['location'])) {
            $old_location = $instance['location'];
        }
        //$old_location = $instance['location'];
        ?>
				<select name="<?php 
        echo balancetags($this->get_field_name('location'));
        ?>
" class="form-control">
			       <option value=""><?php 
        _e('-- Select --', ST_TEXTDOMAIN);
        ?>
</option>
			       <?php 
        foreach ($list_location as $k => $v) {
            ?>
			            <option <?php 
            if (!empty($old_location) and $old_location == $v['id']) {
                echo 'selected';
            }
            ?>
 value="<?php 
            echo esc_html($v['id']);
            ?>
">
			                <?php 
            echo esc_html($v['title']);
            ?>
			            </option>
			       <?php 
        }
        ?>
			   </select>
		   </p>
		</div>
		<?php 
    }