Пример #1
0
 function __construct($atts = null)
 {
     parent::__construct($atts);
     // Set the options; they may be passed as individual parameters or an 'options' array
     $this->options = Mappress_Options::get();
     if (isset($atts['options'])) {
         $this->options->update($atts['options']);
     } else {
         $this->options->update($atts);
     }
     // Set language
     if (!$this->options->language) {
         $this->options->language = Mappress::get_language();
     }
     // Convert POIs from arrays to objects if needed
     foreach ((array) $this->pois as $index => $poi) {
         if (is_array($poi)) {
             $this->pois[$index] = new Mappress_Poi($poi);
         }
     }
     // Set default size if no width/height specified
     if (!$this->width || !$this->height) {
         $i = (int) $this->options->size;
         if (isset(Mappress::$options->sizes[$i])) {
             $size = Mappress::$options->sizes[$i];
             $this->width = $this->width ? $this->width : $size['width'];
             $this->height = $this->height ? $this->height : $size['height'];
         }
     }
 }
Пример #2
0
 function __construct()
 {
     self::$options = Mappress_Options::get();
     self::$basename = plugin_basename(__FILE__);
     self::$baseurl = plugins_url('', __FILE__);
     self::$basedir = dirname(__FILE__);
     $this->debugging();
     // Initialize Pro classes
     if (class_exists('Mappress_Pro')) {
         self::$geocoders = new Mappress_Geocoders();
         self::$updater = new Mappress_Updater(self::$basename);
     }
     add_action('admin_menu', array($this, 'admin_menu'));
     add_action('init', array($this, 'init'));
     add_shortcode('mappress', array($this, 'shortcode_map'));
     add_action('admin_notices', array($this, 'admin_notices'));
     // Post hooks
     add_action('deleted_post', array($this, 'deleted_post'));
     // Filter to automatically add maps to post/page content
     add_filter('the_content', array($this, 'the_content'), 2);
     // Scripts and stylesheets
     add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'));
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     // Frontend: output map in footer or header
     if (self::$options->footer) {
         add_action('wp_print_footer_scripts', array($this, 'print_maps'));
     }
     // Admin: output in footer only
     add_action('admin_print_footer_scripts', array($this, 'print_maps'));
     // Slow heartbeat
     if (self::$debug) {
         add_filter('heartbeat_settings', array($this, 'heartbeat_settings'));
     }
 }
Пример #3
0
 function __construct()
 {
     self::$options = Mappress_Options::get();
     self::$basename = plugin_basename(__FILE__);
     self::$baseurl = plugins_url('', __FILE__);
     self::$basedir = dirname(__FILE__);
     $this->debugging();
     if (self::$remote) {
         self::$js = 'http://localhost/dev/wp-content/plugins/mappress-google-maps-for-wordpress/src';
     } elseif (defined('MAPPRESS_DEBUG')) {
         self::$js = self::$baseurl . '/src';
     } else {
         self::$js = self::$baseurl . '/js';
     }
     // Initialize Pro classes
     if (class_exists('Mappress_Pro')) {
         $icons = new Mappress_Icons();
         self::$geocoders = new Mappress_Geocoders();
         self::$updater = new Mappress_Updater(self::$basename);
     }
     add_action('admin_menu', array(&$this, 'admin_menu'));
     add_action('init', array(&$this, 'init'));
     add_shortcode('mappress', array(&$this, 'shortcode_map'));
     add_action('admin_notices', array(&$this, 'admin_notices'));
     // Post hooks
     add_action('deleted_post', array(&$this, 'deleted_post'));
     // Filter to automatically add maps to post/page content
     add_filter('the_content', array(&$this, 'the_content'), 2);
     // Scripts and stylesheets
     add_action('wp_enqueue_scripts', array(&$this, 'wp_enqueue_scripts'));
     add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
     // Output map data in footer
     add_action('wp_print_footer_scripts', array(&$this, 'print_maps'));
     add_action('admin_print_footer_scripts', array(&$this, 'print_maps'));
 }
Пример #4
0
 function __construct()
 {
     $this->options = Mappress_Options::get();
     add_action('admin_init', array(&$this, 'admin_init'));
 }
Пример #5
0
    function edit($maps = null, $postid)
    {
        global $mappress;
        // Set options for editing
        $options = Mappress_Options::get();
        $options->postid = $postid;
        $options->mapName = 'mapp0';
        $options->directions = 'none';
        $options->mapTypeControl = true;
        $options->navigationControlOptions = array('style' => 0);
        $options->initialOpenInfo = false;
        $options->traffic = false;
        $options->editable = true;
        $options->overviewMapControl = true;
        $options->overviewMapControlOptions = array('opened' => false);
        Mappress_Map::_load($options);
        echo "<script type='text/javascript'>" . "/* <![CDATA[ */" . "var mapdata = " . json_encode($maps) . ";" . "var options = " . json_encode($options) . ";" . "var version = '" . $mappress->get_version() . "';" . "var mappEditor = new MappEditor(mapdata, options);" . "/* ]]> */" . "</script>";
        ?>
		<div id='mapp_metabox'>
			<div style='border-bottom:1px solid black; overflow: auto'>
				<div>
					<br/>
					<a target='_blank' style='vertical-align: middle;text-decoration:none'  href='http://wphostreviews.com/mappress'>
						<img alt='MapPress' title='MapPress' src='<?php 
        echo plugins_url('images/mappress_logo_small.png', __FILE__);
        ?>
' />
					</a>
					<?php 
        echo $mappress->get_version();
        ?>
					| <a target='_blank' href='http://wphostreviews.com/mappress/mappress-documentation-144'><?php 
        _e('Documentation', 'mappress');
        ?>
</a>
					| <a target='_blank' href='http://wphostreviews.com/mappress/mappress-faq'><?php 
        _e('FAQ', 'mappress');
        ?>
</a>
					| <a target='_blank' href='http://wphostreviews.com/mappress/chris-contact'><?php 
        _e('Report a bug', 'mappress');
        ?>
</a>

					<?php 
        if (!class_exists('Mappress_Pro')) {
            ?>
							<input id='mapp_paypal' style='vertical-align: middle;width:92px;height:26px' type='image' src='<?php 
            echo plugins_url('images/btn_donate_LG.gif', __FILE__);
            ?>
' name='donate' alt='PayPal - The safer, easier way to pay online!' />
					<?php 
        }
        ?>

				</div>

				<div id='mapp_add_panel' style='visibility:hidden'>
					<p>
						<span class='submit' style='padding: 0; float: none' >
							<input class='button-primary' type='button' id='mapp_add_btn' value='<?php 
        _e('Add', 'mappress');
        ?>
' />
						</span>

						<span  id='mapp_add_address'>
							<b><?php 
        _e('Location', 'mappress');
        ?>
: </b>
							<input size='50' type='text' id='mapp_saddr' />
						</span>

						<br/><span id='mapp_saddr_corrected' class='mapp-address-corrected'></span>
					</p>
				</div>
			</div>

			<table style='width:100%'>
				<tr>
					<td valign="top">
						<div id='mapp_left_panel'>
							<div id='mapp_maplist_panel'>
								<p>
									<b><?php 
        _e('Current Maps', 'mappress');
        ?>
</b>
									<input class='button-primary' type='button' id='mapp_create_btn' value='<?php 
        _e('New Map', 'mappress');
        ?>
' />
								</p>

								<div id='mapp_maplist'></div>
							</div>

							<div id='mapp_adjust_panel' style='display:none'>
								<div id='mapp_adjust'>
									<p>
										<b><?php 
        _e('Map ID', 'mappress');
        ?>
: </b><span id='mapp_mapid'></span>
									</p>
									<p>
										<b><?php 
        _e('Title');
        ?>
: </b><input id='mapp_title' type='text' size='20' />
									</p>
									<p>
										<?php 
        foreach ($options->mapSizes as $i => $size) {
            echo $i > 0 ? " | " : "";
            $wh = $size['width'] . 'x' . $size['height'];
            echo "<a href='#' class='mapp-edit-size' title='{$wh}'>{$wh}</a>";
        }
        ?>
										<br/><input type='text' id='mapp_width' size='2' value='' /> x <input type='text' id='mapp_height' size='2' value='' />
									</p>
									<p class='submit' style='padding: 0; float: none' >
										<input class='button-primary' type='button' id='mapp_save_btn' value='<?php 
        _e('Save', 'mappress');
        ?>
' />
										<input type='button' id='mapp_recenter_btn' value='<?php 
        _e('Center', 'mappress');
        ?>
' />
									</p>
									<hr/>
								</div>
								<div id='<?php 
        echo $options->mapName;
        ?>
_poi_list' class='mapp-edit-poi-list'></div>
							</div>
						</div>
					</td>
					<td id='mapp_preview_panel' valign='top'>
						<div id='<?php 
        echo $options->mapName;
        ?>
' class='mapp-edit-canvas'></div>
					</td>
				</tr>
			</table>
		</div>
		<?php 
    }
Пример #6
0
 function set_georss()
 {
     $options = Mappress_Options::get();
     $checked = $options->geoRSS ? " checked='checked'" : "";
     $georss_title = __('simple GeoRSS', 'mappress');
     $georss_link = "<a href='http://www.georss.org/Main_Page' title='{$georss_title}'>{$georss_title}</a>";
     echo "<input type='checkbox' name='mappress_options[geoRSS]' {$checked} /> ";
     printf(__('Enable %s for your RSS feeds', 'mappress'), $georss_link);
     echo "<i> (beta - see readme.txt)</i>";
 }