Ejemplo n.º 1
0
function free_map_plugin_view()
{
    free_map_check_map_exists();
    $options = get_site_option('freehtml5map_options');
    $map_id = isset($_REQUEST['map_id']) ? intval($_REQUEST['map_id']) : array_shift(array_keys($options));
    ?>

    <div style="clear: both"></div>

    <h2>Map Preview</h2>
    
    <script type="text/javascript">
        jQuery(function(){

            jQuery('select[name=map_id]').change(function() {
                location.href='admin.php?page=free-map-plugin-view&map_id='+jQuery(this).val();
            });
    
        });
    </script>

    <span class="title">Map: </span>
    <select name="map_id" style="width: 185px;">
        <?php 
    foreach ($options as $id => $map_data) {
        ?>
            <option value="<?php 
        echo $id;
        ?>
" <?php 
        echo $id == $map_id ? 'selected' : '';
        ?>
><?php 
        echo $map_data['name'];
        ?>
</option>
        <?php 
    }
    ?>
    </select>

    <div style="clear: both; height: 30px;"></div>    
    
<?php 
    echo '<p>Use shortcode <b>[freehtml5map id="' . $map_id . '"]</b> for install this map</p>';
    echo do_shortcode('<div style="width: 99%">[freehtml5map id="' . $map_id . '"]</div>');
}
Ejemplo n.º 2
0
<?php

free_map_check_map_exists();
$options = get_site_option('freehtml5map_options');
$map_id = isset($_REQUEST['map_id']) ? intval($_REQUEST['map_id']) : array_shift(array_keys($options));
if (isset($_POST['act_type']) && $_POST['act_type'] == 'free_map_plugin_main_save' && current_user_can('manage_options')) {
    foreach ($_REQUEST['options'] as $key => $value) {
        $_REQUEST['options'][$key] = sanitize_text_field($value);
    }
    $options[$map_id] = wp_parse_args($_REQUEST['options'], $options[$map_id]);
    update_site_option('freehtml5map_options', $options);
}
echo "<h2>" . __('HTML5 Map Config', 'free-html5-map') . "</h2>";
?>
<script xmlns="http://www.w3.org/1999/html">
    jQuery(function($){
        $('.tipsy-q').tipsy({gravity: 'w'}).css('cursor', 'default');

        $('.color~.colorpicker').each(function(){
            $(this).farbtastic($(this).prev().prev());
            $(this).hide();
            $(this).prev().prev().bind('focus', function(){
                $(this).next().next().fadeIn();
            });
            $(this).prev().prev().bind('blur', function(){
                $(this).next().next().fadeOut();
            });
        });
        
        $('select[name=map_id]').change(function() {
            location.href='admin.php?page=free-map-plugin-options&map_id='+$(this).val();