コード例 #1
0
ファイル: home_map_widget.php プロジェクト: bangjojo/wp
    /**
     * Back-end home page map widget settings form.
     *
     * @since 1.0.0
     * @since 1.5.1 Declare function public.
     *
     * @param array $instance Previously saved values from database.
     */
    public function form($instance)
    {
        //widgetform in backend
        $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0'));
        $width = strip_tags($instance['width']);
        $heigh = strip_tags($instance['heigh']);
        $maptype = strip_tags($instance['maptype']);
        $zoom = strip_tags($instance['zoom']);
        $autozoom = strip_tags($instance['autozoom']);
        $child_collapse = strip_tags($instance['child_collapse']);
        $scrollwheel = strip_tags($instance['scrollwheel']);
        ?>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('width');
        ?>
"><?php 
        _e('Map Width <small>(Default is : 960px) you can use px or % here</small>', 'geodirectory');
        ?>
                :
                <input class="widefat" id="<?php 
        echo $this->get_field_id('width');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('width');
        ?>
" type="text"
                       value="<?php 
        echo esc_attr($width);
        ?>
"/>
            </label>
        </p>
        <p>
            <label
                for="<?php 
        echo $this->get_field_id('heigh');
        ?>
"><?php 
        _e('Map Height <small>(Default is : 425px) you can use px or vh here</small>', 'geodirectory');
        ?>
                :
                <input class="widefat" id="<?php 
        echo $this->get_field_id('heigh');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('heigh');
        ?>
" type="text"
                       value="<?php 
        echo esc_attr($heigh);
        ?>
"/>
            </label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('maptype');
        ?>
"><?php 
        _e(' Select Map View', 'geodirectory');
        ?>
                :
                <select class="widefat" id="<?php 
        echo $this->get_field_id('maptype');
        ?>
"
                        name="<?php 
        echo $this->get_field_name('maptype');
        ?>
">

                    <option <?php 
        if (isset($maptype) && $maptype == 'ROADMAP') {
            echo 'selected="selected"';
        }
        ?>
 value="ROADMAP"><?php 
        _e('Road Map', 'geodirectory');
        ?>
</option>
                    <option <?php 
        if (isset($maptype) && $maptype == 'SATELLITE') {
            echo 'selected="selected"';
        }
        ?>
 value="SATELLITE"><?php 
        _e('Satellite Map', 'geodirectory');
        ?>
</option>
                    <option <?php 
        if (isset($maptype) && $maptype == 'HYBRID') {
            echo 'selected="selected"';
        }
        ?>
 value="HYBRID"><?php 
        _e('Hybrid Map', 'geodirectory');
        ?>
</option>
					<option <?php 
        selected($maptype, 'TERRAIN');
        ?>
 
							value="TERRAIN"><?php 
        _e('Terrain Map', 'geodirectory');
        ?>
</option>
                </select>
            </label>
        </p>

        <?php 
        $map_zoom_level = geodir_map_zoom_level();
        ?>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('zoom');
        ?>
"><?php 
        _e('Map Zoom level', 'geodirectory');
        ?>
                :
                <select class="widefat" id="<?php 
        echo $this->get_field_id('zoom');
        ?>
"
                        name="<?php 
        echo $this->get_field_name('zoom');
        ?>
"> <?php 
        foreach ($map_zoom_level as $level) {
            $selected = '';
            if ($level == $zoom) {
                $selected = 'selected="selected"';
            }
            echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
        }
        ?>

                </select>
            </label>
        </p>


        <p>
            <label
                for="<?php 
        echo $this->get_field_id('autozoom');
        ?>
"><?php 
        _e('Map Auto Zoom ?', 'geodirectory');
        ?>
                :
                <input type="checkbox" class="checkbox" id="<?php 
        echo $this->get_field_id('autozoom');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('autozoom');
        ?>
"<?php 
        if ($autozoom) {
            echo 'checked="checked"';
        }
        ?>
 /></label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('child_collapse');
        ?>
"><?php 
        _e('Collapse child/sub categories ?', 'geodirectory');
        ?>
                :
                <input id="<?php 
        echo $this->get_field_id('child_collapse');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('child_collapse');
        ?>
" type="checkbox" value="1"
                       <?php 
        if ($child_collapse) {
            ?>
checked="checked" <?php 
        }
        ?>
 />
            </label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('scrollwheel');
        ?>
"><?php 
        _e('Enable mouse scroll zoom ?', 'geodirectory');
        ?>
                :
                <input id="<?php 
        echo $this->get_field_id('scrollwheel');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('scrollwheel');
        ?>
" type="checkbox" value="1"
                       <?php 
        if ($scrollwheel) {
            ?>
checked="checked" <?php 
        }
        ?>
 />
            </label>
        </p>

    <?php 
    }
コード例 #2
0
    /**
     * Back-end listing page map widget settings form.
     *
     * @since 1.0.0
     * @since 1.5.1 Declare function public.
     *
     * @param array $instance Previously saved values from database.
     */
    public function form($instance)
    {
        //widgetform in backend
        $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
        $width = strip_tags($instance['width']);
        $heigh = strip_tags($instance['heigh']);
        $maptype = strip_tags($instance['maptype']);
        $zoom = strip_tags($instance['zoom']);
        $autozoom = strip_tags($instance['autozoom']);
        $sticky = strip_tags($instance['sticky']);
        $scrollwheel = strip_tags($instance['scrollwheel']);
        $showall = strip_tags($instance['showall']);
        ?>
        <p>
            <label
                for="<?php 
        echo $this->get_field_id('width');
        ?>
"><?php 
        _e('Map Width <small>(Default is : 294) you can use px or % here</small>', GEODIRECTORY_TEXTDOMAIN);
        ?>
                :
                <input class="widefat" id="<?php 
        echo $this->get_field_id('width');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('width');
        ?>
" type="text"
                       value="<?php 
        echo esc_attr($width);
        ?>
"/>
            </label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('heigh');
        ?>
"><?php 
        _e('Map Height <small>(Default is : 370) you can use px or vh here</small>', GEODIRECTORY_TEXTDOMAIN);
        ?>
                :
                <input class="widefat" id="<?php 
        echo $this->get_field_id('heigh');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('heigh');
        ?>
" type="text"
                       value="<?php 
        echo esc_attr($heigh);
        ?>
"/>
            </label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('maptype');
        ?>
"><?php 
        _e(' Select Map View', GEODIRECTORY_TEXTDOMAIN);
        ?>
                :
                <select class="widefat" id="<?php 
        echo $this->get_field_id('maptype');
        ?>
"
                        name="<?php 
        echo $this->get_field_name('maptype');
        ?>
">

                    <option <?php 
        if (isset($maptype) && $maptype == 'ROADMAP') {
            echo 'selected="selected"';
        }
        ?>
 value="ROADMAP"><?php 
        _e('Road Map', GEODIRECTORY_TEXTDOMAIN);
        ?>
</option>
                    <option <?php 
        if (isset($maptype) && $maptype == 'SATELLITE') {
            echo 'selected="selected"';
        }
        ?>
 value="SATELLITE"><?php 
        _e('Satellite Map', GEODIRECTORY_TEXTDOMAIN);
        ?>
</option>
                    <option <?php 
        if (isset($maptype) && $maptype == 'HYBRID') {
            echo 'selected="selected"';
        }
        ?>
 value="HYBRID"><?php 
        _e('Hybrid Map', GEODIRECTORY_TEXTDOMAIN);
        ?>
</option>

                </select>
            </label>
        </p>

        <?php 
        $map_zoom_level = geodir_map_zoom_level();
        ?>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('zoom');
        ?>
"><?php 
        _e('Map Zoom level', GEODIRECTORY_TEXTDOMAIN);
        ?>
                :

                <select class="widefat" id="<?php 
        echo $this->get_field_id('zoom');
        ?>
"
                        name="<?php 
        echo $this->get_field_name('zoom');
        ?>
"> <?php 
        foreach ($map_zoom_level as $level) {
            $selected = '';
            if ($level == $zoom) {
                $selected = 'selected="selected"';
            }
            echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
        }
        ?>

                </select>

            </label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('autozoom');
        ?>
"><?php 
        _e('Map Auto Zoom ?', GEODIRECTORY_TEXTDOMAIN);
        ?>
                :
                <input type="checkbox" class="checkbox" id="<?php 
        echo $this->get_field_id('autozoom');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('autozoom');
        ?>
"<?php 
        if ($autozoom) {
            echo 'checked="checked"';
        }
        ?>
 /></label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('sticky');
        ?>
"><?php 
        _e('Map Sticky(should stick to the right of screen) ?', GEODIRECTORY_TEXTDOMAIN);
        ?>
                :
                <input type="checkbox" class="checkbox" id="<?php 
        echo $this->get_field_id('sticky');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('sticky');
        ?>
"<?php 
        if ($sticky) {
            echo 'checked="checked"';
        }
        ?>
 /> </label>
        </p>

        <p>
            <label
                for="<?php 
        echo $this->get_field_id('scrollwheel');
        ?>
"><?php 
        _e('Enable mouse scroll zoom ?', GEODIRECTORY_TEXTDOMAIN);
        ?>
                :
                <input id="<?php 
        echo $this->get_field_id('scrollwheel');
        ?>
"
                       name="<?php 
        echo $this->get_field_name('scrollwheel');
        ?>
" type="checkbox" value="1"
                       <?php 
        if ($scrollwheel) {
            ?>
checked="checked" <?php 
        }
        ?>
 />
            </label>
        </p>

        <!-- <p>
      <label for="<?php 
        echo $this->get_field_id('showall');
        ?>
"><?php 
        _e('Show all listings on map? (not just page list)', GEODIRECTORY_TEXTDOMAIN);
        ?>
:
      <input id="<?php 
        echo $this->get_field_id('showall');
        ?>
" name="<?php 
        echo $this->get_field_name('showall');
        ?>
" type="checkbox"  value="1"  <?php 
        if ($showall) {
            ?>
checked="checked" <?php 
        }
        ?>
 />
      </label>
    </p> -->

    <?php 
    }