Plugin Directory

Changeset 1144182


Ignore:
Timestamp:
04/24/2015 05:21:00 AM (11 years ago)
Author:
samueljesse
Message:

Minor Fixes and Documentation to create the API Key included

Location:
custom-baidu-maps/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • custom-baidu-maps/trunk/baidu-maps.php

    r797086 r1144182  
    11<?php
    22/*
    3 Plugin Name: Custom Baidu Maps
     3Plugin Name: Baidu Maps Plugin
    44Plugin URI: http://www.digitalcreative.asia/
    55Description: A Wordpress Plugin to easily integrate baidu maps
    6 Version: 1.0
     6Version: 1.1
    77Author: Digital Creative
    88Author URI: http://www.digitalcreative.asia/
    99License:
    1010
    11   Copyright 2013 Samuel Jesse (samueljesse@digitalcreative.asia)
     11  Copyright 2015 Samuel Jesse (samueljesse@digitalcreative.asia)
    1212
    1313  This program is free software; you can redistribute it and/or modify
     
    101101
    102102        // Enqueue Plugin's Frontend Styles
    103         wp_register_style( 'baidu-maps-style-admin', $this->plugin_url . 'css/map.css' );
    104         wp_enqueue_style( 'baidu-maps-style-admin' );
     103        wp_register_style( 'baidu-maps-style-frontend', $this->plugin_url . 'assets/css/frontend.css' );
     104        wp_enqueue_style( 'baidu-maps-style-frontend' );
    105105
    106106        // Enqueue Plugin's Frontend Script
    107         wp_register_script( 'baidu-maps-script-map', $this->plugin_url . 'js/map.js', array( 'jquery' ), false, true );
     107        wp_register_script( 'baidu-maps-script-map', $this->plugin_url . 'assets/js/map.js', array( 'jquery' ), false, true );
    108108        wp_enqueue_script( 'baidu-maps-script-map' );
    109109    }
     
    113113     */
    114114    public function register_admin_scripts() {
     115
    115116        // Enqueue Baidu Maps Script
    116         wp_register_script( 'baidu-maps-script-api', 'http://api.map.baidu.com/api?v=2.0&ak=' . $this->settings['api_key'], false, true );
    117         wp_enqueue_script( 'baidu-maps-script-api' );
    118 
    119         wp_register_style( 'baidu-maps-style-admin', $this->plugin_url . 'css/admin.css' );
    120         wp_enqueue_style( 'baidu-maps-style-admin' );
    121 
    122         wp_register_script( 'baidu-maps-script-admin', $this->plugin_url . 'js/admin.js', array( 'jquery', 'wp-color-picker' ), false, true );
    123         wp_enqueue_script( 'baidu-maps-script-admin' );
    124 
    125         wp_localize_script( 'baidu-maps-script-admin', 'pluginUrl', $this->plugin_url );
    126         wp_localize_script( 'baidu-maps-script-admin', 'ajaxurl', admin_url( 'admin-ajax.php' ) );
    127 
    128         wp_enqueue_script( 'thickbox' );
    129         wp_enqueue_style( 'thickbox' );
    130 
    131         wp_enqueue_script( 'media-upload' );
    132 
    133         wp_enqueue_style( 'wp-color-picker' );
     117        if ( get_post_type( ) == 'bmap' ) {
     118            wp_register_script( 'baidu-maps-script-api', 'http://api.map.baidu.com/api?v=2.0&ak=' . $this->settings['api_key'], false, true );
     119            wp_enqueue_script( 'baidu-maps-script-api' );
     120
     121            wp_register_style( 'baidu-maps-style-admin', $this->plugin_url . 'assets/css/admin.css' );
     122            wp_enqueue_style( 'baidu-maps-style-admin' );
     123
     124            wp_register_script( 'baidu-maps-script-admin', $this->plugin_url . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker' ), false, true );
     125            wp_enqueue_script( 'baidu-maps-script-admin' );
     126
     127            wp_localize_script( 'baidu-maps-script-admin', 'pluginUrl', $this->plugin_url );
     128            wp_localize_script( 'baidu-maps-script-admin', 'ajaxurl', admin_url( 'admin-ajax.php' ) );
     129
     130            wp_enqueue_script( 'thickbox' );
     131            wp_enqueue_style( 'thickbox' );
     132
     133            wp_enqueue_script( 'media-upload' );
     134
     135            wp_enqueue_style( 'wp-color-picker' );
     136        }
    134137    }
    135138
     
    180183    public function makeMapWithID( $id ) {
    181184        $baidu_maps_api = new Baidu_Maps_API();
    182         $map_element    = $baidu_maps_api->createMapWithID( $id, $zoom, $lat, $lng );
     185        $map_element    = $baidu_maps_api->createMapWithID( $id );
    183186
    184187        return $map_element;
  • custom-baidu-maps/trunk/readme.txt

    r1082251 r1144182  
    33Tags: maps, baidu, baidu maps
    44Requires at least: 3.0.1
    5 Tested up to: 3.6
     5Tested up to: 4.2
    66Stable tag: 1.1
    77License: GPLv2 or later
     
    1313== Description ==
    1414
    15 Easily create Custom Baidu Maps to add to any Wordpress post or page. You can create one or multiple maps
     15Easily create Custom Baidu Maps to add to any Wordpress ost or page. You can create one or multiple maps
    1616with our easy to use settings panel, then insert the map using a shortcode.
    1717
    1818With Custom Baidu Maps you can customize each map with multiple locations with options to add/change location
    1919coordinates, add a description, choose background and font colors and upload your own custom marker image.
    20 
    21 
    22 Plugin developed by [Digital Creative](http://www.digitalcreative.asia), Shanghai.
    23 
    24 
    25 
    26 *Baidu API key required. In order to obtain a Baidu API you must have access to a mobile phone number from China.
    27 
    28 == Installation ==
    29 
    30 Follow the steps below for the plugin installation :
    31 
    32 
    33 1. Upload `baidu-maps.zip` to the `/wp-content/plugins/` directory or add the plugin via wordpress plugin repository.
    34 1. Activate the plugin through the 'Plugins' menu in WordPress.
    35 1. Enter your Baidu Developer API key in the settings page.
    3620
    3721
     
    4226with a zoom of '12'
    4327
    44 `[bmap width="500" height="400" lat="39.900" lng="116.403" zoom="12"]`
     28[bmap width="500" height="400" lat="39.900" lng="116.403" zoom="12"]
    4529
    4630Options :
     
    6953
    7054
     55
     56== Installation ==
     57
     58Follow the steps below for the plugin installation :
     59
     60
     611. Upload `baidu-maps.zip` to the `/wp-content/plugins/` directory or add the plugin via wordpress plugin repository.
     621. Activate the plugin through the 'Plugins' menu in WordPress.
     631. Enter your Baidu Developer API key in the settings page.
     64
     65
    7166== Frequently Asked Questions ==
    7267
     
    7469
    7570To use Baidu Maps, you need to have a Baidu Developers API Key.
    76 To obtain the API Key please visit : http://lbsyun.baidu.com/apiconsole/key?application=key
     71To obtain the API Key please visit : http://lbsyun.baidu.com/apiconsole/key
     72
     73A Detailed guide on how to create the API Key is available in the Settings Page
    7774
    7875
     76== Screenshots ==
     77
     78
     79== Changelog ==
     80
     81= 1.1 =
     82
     83PHP warnings fixed
     84Added instructions to create the Baidu Developers API Key
     85
     86
     87== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.