Yandex Maps into your blog posts, including large cities. Based on Google Maps for Wordpress Plugin. Requires PHP5. * Version: 1.4.0 * Author: Mykhailo Glubokyi * Author URI: http://meelk.com.ua/ */ /** * Changelog: * 02/02/2012: 1.4.0 * - Fixed bug with extra padding\margins on some themes * 01/05/2009: 1.2.1 * - Fixed bug with edit filter * 28/04/2009: 1.2 * - Fixed bug with nonce * 13/02/2009: 1.1.1 * - Fixed bug with hook naming * 10/02/2009: 1.1.0 * - Added Wordpress MU support * * 10/02/2009: 1.0 * - Original Version */ /** * wpYandexMaps is the class based on Aaron D. Campbell's Google Maps Class. Thanks for great job, Aaron. */ /* Created by Mykhailo Glubokyi (email : contacts@meelk.com.ua) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * wpYandexMaps is the class that handles ALL of the plugin functionality. * It helps us avoid name collisions * http://codex.wordpress.org/Writing_a_Plugin#Avoiding_Function_Name_Collisions */ class wpYandexMaps { /** * We check if there are any maps on the page, and store this as a bool here * * @var bool */ private $isMap; /** * Current map being added to the page. This gives unique ids to each map, * allowing multiple maps per page * * @var int */ private $mapNum = 0; /** * Full url to the yandex Maps JavaScript file (including API key) * * @var string */ private $mapApiUrl; /** * yandex Maps API Key * * @var string */ protected $yandexKey; /** * Gets Yandex API Key, and creates the url to the yandex Maps JavaScript * */ public function __construct() { $this->yandexKey = get_option('wpYandexMaps_api_key'); $this->mapApiUrl = "http://api-maps.yandex.ru/1.0/index.xml?key={$this->yandexKey}"; $jsDir = get_option('siteurl') . '/wp-content/plugins/yandex-maps-for-wordpress/js/'; wp_register_script('yandexMaps', $this->mapApiUrl, false, 2); //wp_register_script('wpYandexMaps', "{$jsDir}wp-yandex-maps.js", array('prototype', 'yandexMaps'), '0.0.1'); wp_register_script('wpYandexMapsAdmin', "{$jsDir}wp-yandex-maps-admin.js", array('jquery'), '0.0.2'); } /** * Add our plugin configuration menu in the admin section * Add boxes to the "edit post" and "edit page" pages */ public function adminMenu() { add_meta_box('wpYandexMaps', 'Yandex Maps for WordPress', array($this, 'insertForm'), 'post', 'normal'); add_meta_box('wpYandexMaps', 'Yandex Maps for WordPress', array($this, 'insertForm'), 'page', 'normal'); if ( function_exists('add_submenu_page') ) { $page = add_submenu_page('plugins.php', __('Yandex Maps'), __('Yandex Maps'), 'manage_options', 'wpYandexMaps-config', array($this, 'configPage')); add_action( 'admin_print_scripts-'.$page, array($this, 'printScripts') ); } } /** * Create the actual plugin configuration page */ public function configPage() { $title = __('Yandex Maps Configuration'); if ($message) { ?>
" .__('Yandex Maps for WordPress is almost ready.')." " .sprintf(__('You must enter your Yandex API key for it to work.'), "plugins.php?page=wpYandexMaps-config") ."
|
|
mapNum++; $mapInfo = $this->getMapDetails($attr, $content); if (function_exists('json_encode')) { $json = json_encode($mapInfo); } else { require_once('json_encode.php'); $json = Zend_Json_Encoder::encode($mapInfo); } if($mapInfo->typecontrol==1) { $buttonsOverlay = " var typeControl = new YMaps.TypeControl(); map.addControl(typeControl); "; } else { $buttonsOverlay = ""; } if($mapInfo->zoompancontrol==1) { $zoomPan = " map.addControl(new YMaps.ToolBar()); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.MiniMap()); map.addControl(new YMaps.ScaleLine()); "; } else { $zoomPan = ""; } return <<