Changeset 1666055
- Timestamp:
- 05/28/2017 06:14:56 PM (9 years ago)
- Location:
- witty-map/trunk
- Files:
-
- 9 edited
-
admin/class-wittymap-backend.php (modified) (4 diffs)
-
admin/css/witty-map-admin.css (modified) (1 diff)
-
admin/js/witty-map-settings.js (modified) (1 diff)
-
admin/partials/witty-map-option-page.php (modified) (2 diffs)
-
public/class-wittymap-public.php (modified) (3 diffs)
-
public/css/witty-map-base.css (modified) (1 diff)
-
public/js/googlemap.js (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
-
witty-map.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
witty-map/trunk/admin/class-wittymap-backend.php
r1666042 r1666055 5 5 * 6 6 * @class witty_map_backend 7 * @version 1 .0.17 * @version 1 8 8 * @package wittyMap/admin 9 9 * @author Robert John Concepcion … … 63 63 ); 64 64 65 add_meta_box( 'transaction_metabox', //metabox slug66 'Set as Featured Post in Home', //metabox title67 'set_as_featured', //callback function68 'witty-map-settings', //custom post type69 'side', //position70 'default');71 72 65 /** 73 66 * Will not continue if admin menu was not successfully create … … 81 74 public function register_options() { 82 75 83 foreach (self::_opt_ keys() as $opt_key):76 foreach (self::_opt_list() as $opt_key => $opt_arry): 84 77 register_setting( 'witty-map-settings-group', $opt_key ); 85 78 endforeach; … … 94 87 do_settings_sections( 'witty-map-settings-group' ); 95 88 96 $opt_keys = self::_opt_keys(); 97 $opt_keys_values = []; 98 foreach ($opt_keys as $opt_key): 99 $opt_keys_values[$opt_key] = esc_attr( get_option( $opt_key ) ); 89 $key_value = self::_opt_list(); 90 foreach ($key_value as $opt_key => $opt_arry): 91 $key_value[ $opt_key ]['value'] = esc_attr( get_option( $opt_key ) ); 100 92 endforeach; 101 102 103 $support->witty_template( 'admin', 'witty-map-option-page', $opt_keys_values ); 93 $support->witty_template( 'admin', 'witty-map-option-page', [ 'opt_arr' => $key_value ] ); 104 94 } 105 95 106 private function _opt_keys(){ 96 /** 97 * Option page field declaration 98 */ 99 private function _opt_list(){ 107 100 108 101 return [ 109 'googlemapapi_key', 110 'wittymap_loc', 111 'wittymap_def_zoom', 112 'wittymap_marker', 113 'wittymap_draggable', 114 'wittymap_doubleClickZoom', 115 'wittymap_zoomControl', 116 'wittymap_scrollWheel', 117 'wittymap_streetView', 118 'wittymap_markerLabel', 119 'wittymap_labelX', 120 'wittymap_labelY', 102 'googlemapapi_key' => [ 103 'template_name' => "witty-field-common", 104 'type' => "text", 105 'label' => "Google map api key", 106 'desc' => "Witty map plugin required <a href='https://developers.google.com/maps/documentation/javascript/get-api-key' target='_blank'>google map api key</a>.", 107 'attrb' => [ 108 'id' => 'googlemapapi-key', 109 'class' => 'regular-text' 110 ], 111 ], 112 'wittymap_loc' => [ 113 'template_name' => "witty-field-common", 114 'type' => "text", 115 'label' => "Map Center", 116 'desc' => "Set Center of the map. Must be a valid longitude and latitude from google map, format : <b>longitude, latitude</b>", 117 'attrb' => [ 118 'id' => 'wittymap-center', 119 'class' => 'regular-text' 120 ], 121 ], 122 'wittymap_def_zoom' => [ 123 'template_name' => "witty-field-common", 124 'type' => "number", 125 'label' => "Default Map Zoom", 126 'desc' => "Zoom level of the map (the bigger the number the zoom it be). <b>default value : 5, max value : 18</b>", 127 'attrb' => [ 128 'id' => 'wittymap-center', 129 'class' => 'regular-text' 130 ], 131 ], 132 'wittymap_marker' => [ 133 'template_name' => "witty-field-imgbox", 134 'type' => "", 135 'label' => "Map Pointer", 136 'desc' => "Use image as marker of the map.", 137 ], 138 'wittymap_draggable' => [ 139 'template_name' => "witty-field-checkbox", 140 'type' => "", 141 'label' => "Draggable", 142 'desc' => "Map can be drag to check other parts of the map.", 143 ], 144 'wittymap_doubleClickZoom' => [ 145 'template_name' => "witty-field-checkbox", 146 'type' => "", 147 'label' => "Double click will zoom", 148 'desc' => "Enables/disables zoom and center on double click.", 149 ], 150 'wittymap_zoomControl' => [ 151 'template_name' => "witty-field-checkbox", 152 'type' => "", 153 'label' => "Zoom Control", 154 'desc' => "Located at right bottom of the map.", 155 ], 156 'wittymap_scrollWheel' => [ 157 'template_name' => "witty-field-checkbox", 158 'type' => "", 159 'label' => "Scroll Wheel", 160 'desc' => "If checked, disables scrollwheel zooming on the map.", 161 ], 162 'wittymap_streetView' => [ 163 'template_name' => "witty-field-checkbox", 164 'type' => "", 165 'label' => "Street View Control", 166 'desc' => "Located at right bottom of the map", 167 ], 121 168 ]; 122 169 } -
witty-map/trunk/admin/css/witty-map-admin.css
r1666043 r1666055 25 25 box-shadow: 0px 0px 0px 0px #000; 26 26 } 27 28 /**29 * Witty Map Tab30 */31 #witty-map-tabs {32 border-bottom: 2px solid #0073aa;33 }34 #witty-map-tabs li {35 list-style: none;36 display: inline-block;37 margin: 0;38 margin-right: 10px;39 }40 #witty-map-tabs li a {41 text-decoration: none;42 font-size: 14px;43 text-transform: uppercase;44 color: #0073aa;45 padding: 9px 17px;46 display: block;47 outline: none !important;48 background: rgb(183, 211, 224);49 }50 #witty-map-tabs li a:focus,51 #witty-map-tabs li a.active {52 color: #FFF;53 background: #0073aa;54 -webkit-box-shadow: none;55 box-shadow: none;56 }57 58 .witty-tabs-cont {59 display: none;60 }61 .witty-tabs-cont.active {62 display: block;63 } -
witty-map/trunk/admin/js/witty-map-settings.js
r1666043 r1666055 86 86 wittyAdmin.init(); 87 87 88 var wittyAdmin = {89 90 init : function(){91 92 this._registerEvents();93 94 },95 96 97 tabSelector : function( e ){98 99 e.preventDefault();100 101 var ths = $( this );102 103 var wittyTabsVal = $( this ).attr( 'href' );104 105 $( ".witty-tabs-cont" ).hide();106 107 $( "#witty-map-tabs a" ).not( this ).removeClass( 'active' );108 109 $( wittyTabsVal ).show( 0, function(){110 ths.addClass( "active" );111 });112 113 },114 115 _registerEvents : function(){116 117 $( document ).on( 'click', '#witty-map-tabs a', this.tabSelector );118 119 120 }121 122 123 }124 125 wittyAdmin.init();126 127 128 88 })(jQuery); -
witty-map/trunk/admin/partials/witty-map-option-page.php
r1666043 r1666055 3 3 * Main View of witty map settings 4 4 * 5 * @version 1 .0.15 * @version 1 6 6 * @author Robert John Conepcion 7 7 */ 8 8 $support = new witty_support; 9 9 ?> 10 <h1>Witty Map</h1>11 <p class="description">Use <code>[witty-map]</code> in content area or <code>echo do_shortcode("[witty-map]");</code> in your code.</p><br>12 13 14 10 <div class="wrap"> 15 <ul id="witty-map-tabs"> 16 <li><a href="#witty-settings" class="active">Settings</a></li> 17 <li><a href="#witty-marker">Marker</a></li> 18 <li><a href="#witty-ui">Map Interface</a></li> 19 20 </ul> 21 </div> 22 23 24 <div class="wrap"> 25 11 <h1>Witty Map Settings</h1> 26 12 <form method="post" action="options.php"> 27 13 <?php … … 33 19 do_action( "witty_map_after_form" ); 34 20 ?> 35 21 <table class="form-table"> 22 <tr valign="top"> 23 <th scope="row"> 24 <label>Short code</label> 25 </th> 26 <td> 27 <code>[witty-map]</code> 28 <p class="description">Use <code>[witty-map]</code> in content area and <code>echo do_shortcode("[witty-map]");</code> in your code.</p> 29 </td> 30 31 </tr> 36 32 <?php 37 //foreach ($opt_arr as $key => $opt_val):38 //$support->witty_template( 'admin', 'witty-map-option-fields', [39 //'name' => $key,40 //'type' => $opt_val['type'],41 //'value' => $opt_val['value'],42 //'attrb' => $opt_val['attrb'],43 //'template' => $opt_val['template_name'],44 //'label' => _x( $opt_val['label'] ,'witty_map'),45 //'desc' => $opt_val['desc']46 //] );47 //endforeach;33 foreach ($opt_arr as $key => $opt_val): 34 $support->witty_template( 'admin', 'witty-map-option-fields', [ 35 'name' => $key, 36 'type' => $opt_val['type'], 37 'value' => $opt_val['value'], 38 'attrb' => $opt_val['attrb'], 39 'template' => $opt_val['template_name'], 40 'label' => _x( $opt_val['label'] ,'witty_map'), 41 'desc' => $opt_val['desc'] 42 ] ); 43 endforeach; 48 44 ?> 49 50 <div id="witty-settings" class="witty-tabs-cont active"> 51 <table class="form-table"> 52 <tr valign="top"> 53 <th scope="row"> <label>Google map api key</label></th> 54 <td> 55 <?php 56 $support->witty_template( 'inc', 'witty-field-common', [ 57 'type' => 'text', 58 'name' => 'googlemapapi_key', 59 'value' => $googlemapapi_key, 60 'attrb' => [ 61 'id' => 'googlemapapi-key', 62 'class' => 'regular-text' 63 ] 64 ] ); 65 ?> 66 <p class="description">Witty map plugin required <a href='https://developers.google.com/maps/documentation/javascript/get-api-key' target='_blank'>google map api key</a>.</p> 67 </td> 68 </tr> 69 70 <tr valign="top"> 71 <th scope="row"> <label>Map Center</label></th> 72 <td> 73 <?php 74 $support->witty_template( 'inc', 'witty-field-common', [ 75 'type' => 'text', 76 'name' => 'wittymap_loc', 77 'value' => $wittymap_loc, 78 'attrb' => [ 79 'id' => 'wittymap-center', 80 'class' => 'regular-text' 81 ] 82 ] ); 83 ?> 84 <p class="description">Set Center of the map. Must be a valid longitude and latitude from google map, format : <b>longitude, latitude</b></p> 85 </td> 86 </tr> 87 88 <tr valign="top"> 89 <th scope="row"> <label>Default Map Zoom</label></th> 90 <td> 91 <?php 92 $support->witty_template( 'inc', 'witty-field-common', [ 93 'type' => 'number', 94 'name' => 'wittymap_def_zoom', 95 'value' => $wittymap_def_zoom, 96 'attrb' => [ 97 'id' => 'wittymap-center', 98 'class' => 'regular-text' 99 ] 100 ] ); 101 ?> 102 <p class="description">Zoom level of the map (the bigger the number the zoom it be). <b>default value : 5, max value : 18</b></p> 103 </td> 104 </tr> 105 </table> <!-- .form-table --> 106 </div> <!-- #witty-settings --> 107 108 109 <div id="witty-marker" class="witty-tabs-cont"> 110 <table class="form-table"> 111 <tr valign="top"> 112 <th scope="row"> <label>Map Marker</label></th> 113 <td> 114 <?php 115 $support->witty_template( 'inc', 'witty-field-imgbox', [ 116 'name' => 'wittymap_marker', 117 'value' => $wittymap_marker, 118 ] ); 119 ?> 120 <p class="description">Use image as marker of the map.</p> 121 </td> 122 </tr> 123 124 <tr valign="top"> 125 <th scope="row"> <label>Location title</label></th> 126 <td> 127 <?php 128 $support->witty_template( 'inc', 'witty-field-common', [ 129 'type' => 'text', 130 'name' => 'wittymap_markerLabel', 131 'value' => $wittymap_markerLabel, 132 'attrb' => [ 133 'id' => 'wittymap-label', 134 'class' => 'regular-text' 135 ] 136 ] ); 137 ?> 138 <p class="description">Marker Optional Label</p> 139 </td> 140 </tr> 141 142 <tr valign="top"> 143 <th scope="row"> <label>Label X Axis</label></th> 144 <td> 145 <?php 146 $support->witty_template( 'inc', 'witty-field-common', [ 147 'type' => 'number', 148 'name' => 'wittymap_labelX', 149 'value' => $wittymap_labelX 150 ] ); 151 ?> 152 <span class="description">Label X Axis relative to the position of the Marker</span> 153 </td> 154 </tr> 155 156 <tr valign="top"> 157 <th scope="row"> <label>Label Y Axis</label></th> 158 <td> 159 <?php 160 $support->witty_template( 'inc', 'witty-field-common', [ 161 'type' => 'number', 162 'name' => 'wittymap_labelY', 163 'value' => $wittymap_labelY 164 ] ); 165 ?> 166 <span class="description">Label Y Axis relative to the position of the Marker</span> 167 </td> 168 </tr> 169 </table> 170 </div> 171 172 <div id="witty-ui" class="witty-tabs-cont"> 173 <table class="form-table"> 174 <tr valign="top"> 175 <th scope="row"> <label>Draggable</label></th> 176 <td> 177 <?php 178 $support->witty_template( 'inc', 'witty-field-checkbox', [ 179 'name' => 'wittymap_draggable', 180 'value' => $wittymap_draggable, 181 ] ); 182 ?> 183 <span class="description">Map can be drag to check other parts of the map.</span> 184 </td> 185 </tr> 186 187 <tr valign="top"> 188 <th scope="row"> <label>Double click will zoom</label></th> 189 <td> 190 <?php 191 $support->witty_template( 'inc', 'witty-field-checkbox', [ 192 'name' => 'wittymap_doubleClickZoom', 193 'value' => $wittymap_doubleClickZoom, 194 ] ); 195 ?> 196 <span class="description">Enables/disables zoom and center on double click.</span> 197 </td> 198 </tr> 199 200 <tr valign="top"> 201 <th scope="row"> <label>Zoom Control</label></th> 202 <td> 203 <?php 204 $support->witty_template( 'inc', 'witty-field-checkbox', [ 205 'name' => 'wittymap_zoomControl', 206 'value' => $wittymap_zoomControl, 207 ] ); 208 ?> 209 <span class="description">Enables/disables zoom control.</span> 210 </td> 211 </tr> 212 213 <tr valign="top"> 214 <th scope="row"> <label>Scroll Wheel</label></th> 215 <td> 216 <?php 217 $support->witty_template( 'inc', 'witty-field-checkbox', [ 218 'name' => 'wittymap_scrollWheel', 219 'value' => $wittymap_scrollWheel, 220 ] ); 221 ?> 222 <span class="description">If checked, disables scrollwheel zooming on the map.</span> 223 </td> 224 </tr> 225 226 <tr valign="top"> 227 <th scope="row"> <label>Street View Control</label></th> 228 <td> 229 <?php 230 $support->witty_template( 'inc', 'witty-field-checkbox', [ 231 'name' => 'wittymap_streetView', 232 'value' => $wittymap_streetView, 233 ] ); 234 ?> 235 <span class="description">Located at right bottom of the map.</span> 236 </td> 237 </tr> 238 239 </table> 240 </div> 241 242 45 </table> 243 46 <?php submit_button(); ?> 244 47 </form> -
witty-map/trunk/public/class-wittymap-public.php
r1666043 r1666055 29 29 } 30 30 31 /** markerwithlabel.js31 /** 32 32 * Enqueue files 33 33 */ … … 36 36 wp_enqueue_style( 'witty-map', WITTY_DIR_URL . '/public/css/witty-map-base.css' ); 37 37 wp_enqueue_script( 'googlemap-api', 'https://maps.googleapis.com/maps/api/js?key=' . $this->gmap_api, [], '', true ); 38 wp_enqueue_script( 'markerwithlabel', WITTY_DIR_URL . '/public/js/markerwithlabel.js', [], '', true );39 38 wp_enqueue_script( 'witty-map', WITTY_DIR_URL . '/public/js/googlemap.js', [], '', true ); 40 39 wp_localize_script( 'witty-map', 'wm', [ … … 47 46 'wittyMapScrollWheel'=> get_option( 'wittymap_scrollWheel' ), 48 47 'wittyMapStreetView'=> get_option( 'wittymap_streetView' ), 49 'wittyMapLabel'=> get_option( 'wittymap_markerLabel' ),50 'wittyMapLabelX'=> get_option( 'wittymap_labelX' ),51 'wittyMapLabelY'=> get_option( 'wittymap_labelY' ),52 48 ] ); 53 49 } -
witty-map/trunk/public/css/witty-map-base.css
r1666043 r1666055 10 10 background-color: #eaeaea; 11 11 } 12 #witty-map-wrap .witty-label {13 color: #75352d;14 font: 600 14px arial;15 text-align: center;16 width: 160px;17 background-color: rgba(234, 234, 234, 0.7);18 padding: 2px 0px;19 line-height: 1;20 border-radius: 4px;21 } -
witty-map/trunk/public/js/googlemap.js
r1666043 r1666055 4 4 * Renders map in the front end. 5 5 * 6 * @version 1 .016 * @version 1 7 7 * @author Robert John conecpcion 8 8 */ … … 14 14 15 15 var marker; 16 17 var labelX = parseInt(wm.wittyMapLabelX);18 19 var labelY = parseInt(wm.wittyMapLabelY);20 21 var mapLabel = wm.wittyMapLabel ? wm.wittyMapLabel : false;22 16 23 17 var googlemap = { … … 35 29 36 30 this.plotMarker( location ); 31 37 32 }, 38 33 … … 40 35 * Marker of witty map 41 36 */ 42 plotMarker : function( latlng){37 plotMarker : function( latlng ){ 43 38 44 var args ={39 marker = new google.maps.Marker({ 45 40 position: latlng, 46 41 map: map, 42 animation: google.maps.Animation.DROP, 47 43 icon : wm.wittyMapMarker, 48 animation: google.maps.Animation.DROP, 49 } 44 }); 50 45 51 if(mapLabel){52 args['labelContent'] = mapLabel;53 args['labelAnchor'] = new google.maps.Point( labelX, labelY );54 args['labelClass'] = "witty-label";55 }56 57 marker = new MarkerWithLabel( args );58 46 }, 59 47 -
witty-map/trunk/readme.txt
r1666047 r1666055 5 5 Requires at least: 4 6 6 Tested up to: 4.7.4 7 Stable tag: 1.0.17 Stable tag: 0.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 11 11 Witty Map, add google map in content area or in template file (using shortcode). Most important you can customize its view. 12 12 13 == Description==13 == Witty Map has following features == 14 14 15 Witty map can : 16 * Set Marker Label. 17 * Marker Label location ( x and y axis ) 18 * Set center of the map. 19 * Set Zoom level. 20 * Modify default map pointer/marker. 21 * Enable / Disble dragging. 22 * Enable / Disable zoom and center on double click. 23 * Enable / Disable zoom control. 24 * Enable / Disable Scroll wheel. 25 * Enable / Disable street view control. 26 27 28 == Installation == 29 30 Download the witty map then paste it the plugin directory. or download it via plugin menu of admin's backend. 15 * Set center of the map. 16 * Set Zoom level. 17 * Modify default map pointer/marker. 18 * Enable / Disble dragging. 19 * Enable / Disable zoom and center on double click. 20 * Enable / Disable zoom control. 21 * Enable / Disable Scroll wheel. 22 * Enable / Disable street view control. 31 23 32 24 == Frequently Asked Questions == 33 34 = Can I change the style of marker label? =35 Yes, using CSS, just target this class .witty-label.36 37 Example : #witty-map-wrap .witty-label { background-color : #000; color : #FFF; }38 25 39 26 = How to show witty map in content area? = … … 50 37 51 38 add( 'witty_map_after', [your function] ); 52 53 54 == Changelog ==55 56 = 1.0.1 =57 * Improve admin interface58 * Map Marker Label59 * Marker Label location ( x and y axis )60 * Fix errors ( undefined values ) when wp_debug is on61 62 = 0.0.2 =63 * Set center of the map.64 * Set Zoom level.65 * Modify default map pointer/marker.66 * Enable / Disble dragging.67 * Enable / Disable zoom and center on double click.68 * Enable / Disable zoom control.69 * Enable / Disable Scroll wheel.70 * Enable / Disable street view control.71 72 = 0.0.1 =73 * initilize74 75 == Upgrade Notice ==76 77 = 1.0.1 =78 Fix some error, improve admin interface and enabled map marker label feature. -
witty-map/trunk/witty-map.php
r1666043 r1666055 4 4 Plugin URI: 5 5 Description: Witty Map, add google map in content area or in template file (using shortcode). Most important you can customize its view. 6 Version: 1.0.16 Version: 0.0.2 7 7 Author: Robert John Concepcion 8 8 Author URI: https://github.com/robert-john-concepcion … … 59 59 update_option( 'wittymap_scrollWheel', 1 ); 60 60 update_option( 'wittymap_streetView', 1 ); 61 update_option( 'wittymap_labelX', 0 );62 update_option( 'wittymap_labelY', 0 );63 61 64 62 }
Note: See TracChangeset
for help on using the changeset viewer.