예제 #1
0
 /**
  * Get a link to open a poi and optionally zoom in on it
  *
  * $args:
  *   text - text to print for the link, default is poi title
  *   zoom - false (default) = no zoom | true = zoom in to viewport (ignored for lat/lng pois with no viewport) | number = set zoom (0-15)
  *
  * @param mixed $map - map on which the poi should be opened
  * @param mixed $args
  * @return mixed
  */
 function get_open_link($args = '')
 {
     $map = $this->map();
     extract(wp_parse_args($args, array('title' => $this->get_title(), 'zoom' => null)));
     $i = array_search($this, $map->pois);
     $zoom = Mappress::boolean_to_string($zoom);
     return "<a href='#' onclick='{$map->name}.getPoi({$i}).open({$zoom}); return false;' >{$title}</a>";
 }
예제 #2
0
 static function ajax_delete()
 {
     ob_start();
     $mapid = isset($_POST['mapid']) ? $_POST['mapid'] : null;
     $result = Mappress_Map::delete($mapid);
     if (!$result) {
         Mappress::ajax_response("Internal error when deleting map ID '{$mapid}'!");
     }
     do_action('mappress_map_delete', $mapid);
     // Use for your own developments
     Mappress::ajax_response('OK', array('mapid' => $mapid));
 }
예제 #3
0
 /**
  * Print a single map
  *
  * @param mixed $map
  */
 function get_map($map)
 {
     // For static maps prepare the pois immediately
     if (empty($map->query)) {
         $map->prepare();
     }
     $script = "var mapdata = " . json_encode($map) . ";\r\n" . "window.{$map->name} = new mapp.Map(mapdata); \r\n" . "{$map->name}.display(); ";
     $html = Mappress::script($script);
     if ($map->options->directions == 'inline') {
         $html .= "<div id='{$map->name}_directions_' style='display:none'>";
         $html .= $this->get_template($map->options->templateDirections, array('map' => $map));
         $html .= "</div>";
     }
     return $html;
 }
예제 #4
0
    /**
     * Options page
     *
     */
    function options_page()
    {
        ?>
		<div class="wrap">

			<h2>
				<a target='_blank' href='http://wphostreviews.com/mappress'><img alt='MapPress' title='MapPress' src='<?php 
        echo plugins_url('images/mappress_logo_med.png', __FILE__);
        ?>
'></a>
				<span style='font-size: 12px'><?php 
        echo Mappress::get_support_links();
        ?>
</span>
			</h2>

			<div id="poststuff" class="metabox-holder has-right-sidebar">
				<div id="side-info-column" class="inner-sidebar">
					<?php 
        // Output sidebar metaboxes
        if (!class_exists('Mappress_Pro')) {
            add_meta_box('metabox_like', __('Like this plugin?', 'mappress'), array(&$this, 'metabox_like'), 'mappress_sidebar', 'side', 'core');
        }
        add_meta_box('metabox_demo', __('Sample Map', 'mappress'), array(&$this, 'metabox_demo'), 'mappress_sidebar', 'side', 'core');
        do_meta_boxes('mappress_sidebar', 'side', null);
        ?>
				</div>

				<div id="post-body">
					<div id="post-body-content" class="has-sidebar-content">
						<form action="options.php" method="post">
							<?php 
        // Nonces needed to remember metabox open/closed settings
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
        // Output the option settings as metaboxes
        settings_fields('mappress');
        $this->do_settings_sections('mappress');
        ?>
							<br/>

							<input name='submit' type='submit' class='button-primary' value='<?php 
        _e("Save Changes", 'mappress');
        ?>
' />
							<input name='reset_defaults' type='submit' class='button' value='<?php 
        _e("Reset Defaults", 'mappress');
        ?>
' />
						</form>
					</div>
				</div>
			</div>
		</div>
		<script type='text/javascript'>
			jQuery(document).ready( function() {
				// Initialize metaboxes
				postboxes.add_postbox_toggles('mappress');
			});
		</script>
		<?php 
    }
예제 #5
0
<div class='mapp-m-panel'>
	<div>
		<a target='_blank' style='vertical-align: middle;text-decoration:none'  href='http://wphostreviews.com/mappress'>
			<img alt='MapPress' title='MapPress' src='<?php 
echo Mappress::$baseurl . '/images/mappress_logo_small.png';
?>
' />
		</a>
		<?php 
echo Mappress::get_support_links();
?>
	</div>
	<hr/>

	<div id='mapp_m_list_panel' style='display:none'>
		<b><?php 
_e('Maps for This Post', 'mappress');
?>
</b>
		<input class='button' type='button' id='mapp_m_add_map' value='<?php 
esc_attr_e('New Map', 'mappress');
?>
' />
		<div id='mapp_m_maplist'>
			<?php 
echo Mappress_Map::get_map_list();
?>
		</div>
	</div>

	<div id='mapp_m_edit_panel' style='display:none'>
예제 #6
0
 function print_maps()
 {
     // If queue is empty there's nothing to do
     if (empty($this->queue)) {
         return;
     }
     if (class_exists('Mappress_Pro')) {
         $this->print_map_styles();
     }
     if (isset($this->queue['editor'])) {
         $script = "window.mappEditor = new mapp.Media();";
         echo Mappress::script($script);
         return;
     }
     foreach ($this->queue as $name => $map) {
         $this->print_map($map);
         $script = "var mapdata = " . json_encode($map) . ";\r\n" . "window.{$name} = new mapp.Map(mapdata); \r\n" . "{$name}.display(); ";
         // Workaround for Nextgen plugin, which reverses sequence of wp_enqueue_scripts and wp_print_footer_scripts output
         if (self::$options->onLoad || class_exists('C_Photocrati_Resource_Manager')) {
             $script = "jQuery(document).ready(function () { {$script} });";
         }
         echo Mappress::script($script);
     }
 }