Changeset 548366
- Timestamp:
- 05/24/2012 03:54:42 AM (14 years ago)
- Location:
- welocally-places/trunk
- Files:
-
- 23 edited
-
WelocallyWPPagination.class.php (modified) (1 diff)
-
help/options-general-help.php (modified) (1 diff)
-
menu.php (modified) (3 diffs)
-
options/about.php (modified) (1 diff)
-
options/options-general.php (modified) (3 diffs)
-
options/options-infobar.php (modified) (2 diffs)
-
options/places-manager.php (modified) (2 diffs)
-
quickhelp.html (modified) (6 diffs)
-
quickhelp.pdf (modified) (previous)
-
readme.txt (modified) (7 diffs)
-
resources/javascripts/wl_addplace_wp.js (modified) (4 diffs)
-
resources/javascripts/wl_pager_wp.js (modified) (2 diffs)
-
resources/javascripts/wl_placemgr.js (modified) (3 diffs)
-
resources/stylesheets/ie/wl_places_admin.css (modified) (2 diffs)
-
resources/stylesheets/wl_places_admin.css (modified) (5 diffs)
-
template-tags.php (modified) (4 diffs)
-
views/category-map-content-template.php (modified) (1 diff)
-
views/place-content-template.php (modified) (1 diff)
-
views/welocally-places-map-widget-display.php (modified) (1 diff)
-
welocally-places-map-widget.class.php (modified) (2 diffs)
-
welocally-places-tag-processor.class.php (modified) (3 diffs)
-
welocally-places.class.php (modified) (29 diffs)
-
welocally-places.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
welocally-places/trunk/WelocallyWPPagination.class.php
r544331 r548366 272 272 foreach($fields as $field){ 273 273 $field = trim($field); 274 $content = str_replace("%$field%", $row[$field], $content); 274 275 276 if($field == "place"){ 277 $val = str_replace("'", "\'", $row[$field]); 278 $content = str_replace("%$field%", "'".$val."'", $content); 279 } else { 280 $content = str_replace("%$field%", $row[$field], $content); 281 } 282 283 275 284 } 276 285 return $content; -
welocally-places/trunk/help/options-general-help.php
r544571 r548366 1 <h1>Welocally Places BasicFor Wordpress Guide</h1>1 <h1>Welocally Places Core For Wordpress Guide</h1> 2 2 <a title="welocally places wordpress" href="http://wordpress.org/extend/plugins/welocally-places/">Welocally Places Plugin</a> for wordpress is intended to help site authors link real places to their content quickly, and then help their readers find those places quickly. This document is intended to help the blog owner or wordpress developer install, configure and use the plugin. It is structured by the administrative and user components associated with the plugin. 3 3 -
welocally-places/trunk/menu.php
r543560 r548366 1 1 <?php 2 /** 3 * this stuff should all be moved into the class. 4 * 5 */ 6 2 7 function wl_menu_initialise() { 8 9 //jquery ui 10 wp_register_style( 'jquery-ui-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css' ); 3 11 4 12 $main_slug = add_menu_page( 'Welocally Places Options', 'Welocally Places', 'manage_options', 'welocally-places-general', 'wl_general_options', WP_PLUGIN_URL . '/welocally-places/resources/images/welocally_places_button_color.png' ); … … 6 14 add_contextual_help( $main_slug, __( $main_content ) ); 7 15 8 wl_add_submenu( 'Welocally Places About', 'About', 'welocally-places-about', 'wl_support_about' );9 wl_add_submenu( 'Welocally Places Manager', 'Places Manager', 'welocally-places-manager', 'wl_places_manager' );16 $about_slug = wl_add_submenu( 'Welocally Places About', 'About', 'welocally-places-about', 'wl_support_about' ); 17 $placesmgr_slug = wl_add_submenu( 'Welocally Places Manager', 'Places Manager', 'welocally-places-manager', 'wl_places_manager' ); 10 18 11 19 add_filter( 'plugin_action_links', 'wl_places_add_settings_link', 10, 2 ); 20 21 //hook so only the admin placemgr screen get jquery ui, conflicts were occurring 22 add_action( 'admin_print_styles-' . $placesmgr_slug, 'wl_placesmgr_plugin_admin_styles' ); 12 23 13 24 } 25 14 26 add_action( 'admin_menu','wl_menu_initialise' ); 15 27 add_filter( 'plugin_row_meta', 'wl_set_plugin_meta', 10, 2 ); 16 28 29 function wl_placesmgr_plugin_admin_styles() { 30 wp_enqueue_style( 'jquery-ui-style' ); 31 } 17 32 18 33 function wl_general_options() { … … 96 111 add_contextual_help( $profile_slug, __( $help_text ) ); 97 112 98 return ;113 return $profile_slug; 99 114 } 100 115 -
welocally-places/trunk/options/about.php
r544331 r548366 13 13 <h2>Welocally Places About</h2> 14 14 <div style="margin-top:20px;"> 15 <table class=" form-table">15 <table class="wl-form-table"> 16 16 <tr valign="top"> 17 17 <th scope="row"><?php _e( 'Version' ); ?></th> -
welocally-places/trunk/options/options-general.php
r544331 r548366 26 26 $options['show_letters'] = 'off'; 27 27 } 28 $options[ 'widget_post_type' ] = $_POST[ 'welocally_widget_post_type' ]; 28 29 29 30 //welocally_show_letters … … 74 75 75 76 <form method="post" action="<?php echo bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=welocally-places-general' ?>"> 76 <table class=" form-table" style="margin-top:20px;">77 <table class="wl-form-table" style="margin-top:20px;"> 77 78 <tr valign="top"> 78 79 <th scope="row"><?php _e('General Map Options' ); ?></th> … … 90 91 <li><input type="checkbox" id="welocally_show_selection" name="welocally_show_selection" <?php if($options[ 'show_selection' ]=='on') { echo 'checked'; } ?>>Show Selection Item List</li> 91 92 <li>Selection Item Style<br /><input style="width:400px" type="text" id="welocally_widget_selection_style" name="welocally_widget_selection_style" value="<?php echo $options[ 'widget_selection_style' ];?>"></li> 93 <li>Post Types (comma separated) <br /><input style="width:400px" type="text" id="welocally_widget_post_type" name="welocally_widget_post_type" value="<?php echo $options[ 'widget_post_type' ];?>"></li> 92 94 </ul> 93 95 </td> -
welocally-places/trunk/options/options-infobar.php
r543527 r548366 3 3 $options = $wlPlaces->getOptions(); 4 4 ?> 5 <div id=" action_bar">5 <div id="wl_action_bar"> 6 6 <div class="rollover" id="btn_support"> 7 7 <a href="http://support.welocally.com/categories/welocally-places-wp-basic" target="_new"> … … 23 23 </div> 24 24 </div> 25 <?php 26 $reqsMissing = $wlPlaces->databaseRequirementsMissing(); 27 if (count($reqsMissing)>0) { 28 $showReqsMissing = print_r($reqsMissing,true); 29 echo ('<div id="wl_info_bar"><div class="wl_error" style="margin 10px;">Reactivation is required to properly support required database changes for version '.WelocallyPlaces::VERSION.'. Please deactivate and re-activate now. '.$showReqsMissing.'</div></div>'); 30 } 31 ?> -
welocally-places/trunk/options/places-manager.php
r544331 r548366 1 1 <?php 2 global $wlPlaces ;2 global $wlPlaces,$wpdb; 3 3 $places = $wlPlaces->getPlacesNew(); 4 4 ?> 5 5 <script type="text/javascript"> 6 7 8 function setPlaceRow(i, place){ 6 function setPlaceRow(i, placeJSON){ 7 var place = jQuery.parseJSON(placeJSON); 9 8 window.wlPlacesManager.setPlaceRow(i, place, jQuery('#wl_placemgr_place_'+i)); 10 9 } 11 12 10 </script> 13 11 <?php … … 54 52 new WELOCALLY_PlaceManager(); 55 53 window.wlPlacesManager.initCfg(cfg); 56 jQuery('#wl_places_mgr_wrapper' ).html(window.wlPlacesManager.makeWrapper()); 57 54 jQuery('#wl_places_mgr_wrapper' ).html(window.wlPlacesManager.makeWrapper()); 58 55 59 56 </script> -
welocally-places/trunk/quickhelp.html
r544571 r548366 5 5 <head> 6 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <title>Welocally Places BasicQuick Help</title>7 <title>Welocally Places Core Quick Help</title> 8 8 <meta name="author" content="Welocally"> 9 9 <link rel="stylesheet" href="css/wl_pager_admin.css" media="all"> … … 18 18 <div class="wrap wl_pager_admin"> 19 19 <div class="header section"> 20 <div class="header-title">Welocally Places BasicQuick Help</div>20 <div class="header-title">Welocally Places Core For Wordpress Quick Help</div> 21 21 <div class="header-subtitle">Quick Help Guide</div> 22 <div>version 1.2. 19</div>23 <div>Last Updated May 7, 2012</div>22 <div>version 1.2.22</div> 23 <div>Last Updated May 21, 2012</div> 24 24 </div> 25 <h1>Welocally Places BasicFor Wordpress Guide</h1>25 <h1>Welocally Places Core For Wordpress Guide</h1> 26 26 <a title="welocally places wordpress" href="http://wordpress.org/extend/plugins/welocally-places/">Welocally Places Plugin</a> for wordpress is intended to help site authors link real places to their content quickly, and then help their readers find those places quickly. This document is intended to help the blog owner or wordpress developer install, configure and use the plugin. It is structured by the administrative and user components associated with the plugin. 27 27 … … 60 60 </li> 61 61 </ol> 62 <h3>Manual Upgrading</h3> 63 If you are upgrading and an install this manually make sure to re-activate the plugin, activation does important database updates. 64 62 65 <h2><a name="User_Components"></a>User Components</h2> 63 66 <h3>Basics</h3> … … 71 74 72 75 It acts identically like the Category Tag Map by making a map with selectable markers and a list which can also be selected. When a user selects either a marker or a list item an infobox will pop up at the location of the selected item on the map. 73 74 <span style="font-size: 15px; font-weight: bold; clear: both;">Category Map Tag</span> 75 76 <a href="http://welocally.com/wp-content/uploads/2011/07/Screen-Shot-2012-04-09-at-4.06.56-PM.png"><img class="alignleft size-full wp-image-1029" style="margin-top: 10px;" title="Screen Shot 2012-04-09 at 4.06.56 PM" src="http://welocally.com/wp-content/uploads/2011/07/Screen-Shot-2012-04-09-at-4.06.56-PM.png" alt="" width="207" height="354" /></a> 76 <div style="clear: both;"> </div> 77 <h4>Category Map Tag</h4> 77 78 The category map allows your users to filter the posts associated with specific categories on a single map, just like the Map Widget. This is helpful if you want to segment different places by type and show them to your readers on a page. making a directory? Just insert the tag "Shopping" or "Bars & Pubs" on a page and you have a simple map for a shopping guide of all the places you have written about. 79 <div style="clear: both;"> </div> 80 <p style="text-align: center;"><a href="http://welocally.com/wp-content/uploads/2011/07/Screen-Shot-2012-04-09-at-4.06.56-PM.png"><img class="aligncenter size-full wp-image-1029" style="margin-top: 10px;" title="Screen Shot 2012-04-09 at 4.06.56 PM" src="http://welocally.com/wp-content/uploads/2011/07/Screen-Shot-2012-04-09-at-4.06.56-PM.png" alt="" width="207" height="354" /></a></p> 78 81 <p style="text-align: center;"><a href="http://welocally.com/wp-content/uploads/2012/04/Screen-Shot-2012-04-09-at-5.37.34-PM.png"><img class="aligncenter size-full wp-image-1064" title="Screen Shot 2012-04-09 at 5.37.34 PM" src="http://welocally.com/wp-content/uploads/2012/04/Screen-Shot-2012-04-09-at-5.37.34-PM.png" alt="" width="354" height="24" /></a></p> 79 82 For example; if you had a pizza blog you might assign The Ugly Duck Pizza with the "Thin Cust" and "Rustic Wood Oven" categories. When your reader was looking for the pizzas of the New York Style only the pizza restaurants that had thin crust pizzas would show as ordered markers, and it would link the places back to the posts where you wrote about them. When a user selects a specific post excerpt, an info box identifying that place on the map will appear. … … 90 93 <p style="text-align: center;"><a href="http://welocally.com/wp-content/uploads/2011/09/Screen-Shot-2012-05-12-at-11.52.38-AM.png"><img class="aligncenter size-full wp-image-1263" title="Screen Shot 2012-05-12 at 11.52.38 AM" src="http://welocally.com/wp-content/uploads/2011/09/Screen-Shot-2012-05-12-at-11.52.38-AM.png" alt="" width="482" height="43" /></a></p> 91 94 95 <h4>Custom Post Types</h4> 96 <p>Many wordpress themes such as <a href="http://themeforest.net/item/swagmag-wordpress-magazinereview-theme/1576310">SwagMag - WordPress Magazine/Review Theme</a> use the concept of custom post types to manage an maintain posts. Welocally Places supports one or many custom post types, but you must use the post type name in the database for it to work properly. <strong>Multiple custom post types are supported byt they must be comma delimitated no spaces.</strong></p> 97 <p><a href="http://welocally.com/wp-content/uploads/2011/09/tag_custom_post.png"><img class="aligncenter size-full wp-image-1323" title="tag_custom_post" src="http://welocally.com/wp-content/uploads/2011/09/tag_custom_post.png" alt="" width="500" height="30" /></a></p> 98 <p style="text-align: left;">You can configure the widget to use custom post types in the same way using the options.</p> 99 <p style="text-align: center;"><img class="aligncenter size-full wp-image-1324" title="Screen Shot 2012-05-23 at 7.13.51 PM" src="http://welocally.com/wp-content/uploads/2011/09/Screen-Shot-2012-05-23-at-7.13.51-PM.png" alt="" width="618" height="344" /></p> 100 101 92 102 <h2>Administration</h2> 93 103 Options allow you to control the plugin, and we have created a custom option. We have a custom sidebar options tab, so in setting up welocally places just select the side tab item. … … 101 111 </ul> 102 112 <h3><strong>Welocally Places General Options</strong></h3> 103 <p style="text-align: center;">< a href="http://welocally.com/wp-content/uploads/2011/09/Screen-Shot-2012-05-12-at-11.33.10-AM.png"><img class="aligncenter size-full wp-image-1259" title="Screen Shot 2012-05-12 at 11.33.10 AM" src="http://welocally.com/wp-content/uploads/2011/09/Screen-Shot-2012-05-12-at-11.33.10-AM.png" alt="" width="602" height="255" /></a></p>113 <p style="text-align: center;"><img class="aligncenter size-full wp-image-1324" title="Screen Shot 2012-05-23 at 7.13.51 PM" src="http://welocally.com/wp-content/uploads/2011/09/Screen-Shot-2012-05-23-at-7.13.51-PM.png" alt="" width="618" height="344" /></p> 104 114 105 115 <h4 style="text-align: left;">General Map Options, Infobox Place Links</h4> -
welocally-places/trunk/readme.txt
r544571 r548366 1 === Welocally Places Basic===1 === Welocally Places Core === 2 2 Contributors: claytantor 3 3 Tags: hyperlocal, geocoding, places, maps, foodie, travel, real estate, business directories … … 7 7 License: GPL v2 (GNU General Public License v2) 8 8 9 The Welocally Places Basicplugin lets easily associate places with rich maps and place info with your wordpress content.9 The Welocally Places Core plugin lets easily associate places with rich maps and place info with your wordpress content. 10 10 11 11 == Description == … … 20 20 * Integrated driving directions 21 21 * Category based map tags help you make directories quickly 22 * Support for custom post types 22 23 23 24 Product Overview: http://welocally.com/?page_id=2 … … 35 36 36 37 Q:What Browsers Do You Support? 37 A:For Publishers we have tested creating places for and recommend versions starting at least Chrome 17.0.963.56, Safari Version 5.1.2 and Firefox 10.0.2. We *do not* rec comend the use of IE for site owners using welocally places, but we have tested site vistors successfully using Welocally Places with IE 5.3.2 or greater.38 A:For Publishers we have tested creating places for and recommend versions starting at least Chrome 17.0.963.56, Safari Version 5.1.2 and Firefox 10.0.2. We *do not* recommend the use of IE for site owners using welocally places, but we have tested site vistors successfully using Welocally Places with IE 5.3.2 or greater. 38 39 39 40 Q:What is a POI? … … 51 52 52 53 == Changelog == 54 1.2.22 55 222 Add activation notice if missing 1.2.22 fields 56 221 jQuery UI override 57 220 Change Name To Welocally Places Core 58 219 Support for Multiple Custom Post Types 59 218 Edit broken 60 217 Apostrophe in place json causes places manager to fail. 61 213 Refactor shortcode handler 62 209 Custom post types 63 208 University Offices, Wellington Square, Oxford, OX1 2JD, United Kingdom 64 206 Places manager breaks on null place 65 53 66 1.2.21 54 67 203 Update documentation to include proper version requirements … … 62 75 63 76 1.2.19 64 196 FeatureRemove Registration Requirement65 195 FeatureRemove any CURL Concepts66 194 FeaturePagination67 192 FeatureLocal Category Tag68 191 FeatureLocal Place Tag69 190 FeatureNo key geocoding70 189 FeatureLocal Database71 186 BugRefactor options72 185 BugCategory and fields showing on add place.77 196 Remove Registration Requirement 78 195 Remove any CURL Concepts 79 194 Pagination 80 192 Local Category Tag 81 191 Local Place Tag 82 190 No key geocoding 83 189 Local Database 84 186 Refactor options 85 185 Category and fields showing on add place. 73 86 74 87 1.1.18 75 Feature #56: Welocally Namespace Javascript Refactoring76 Feature #87: Widgetize Place Finder77 Feature #100: Refactor wp_postmeta to remove obsolete concepts78 Feature #128: Category Map Tag Support79 Feature #140: API Keys incorporated into web services80 Feature #152: Widgetize Places81 Feature #154: Remove Font Customization82 Feature #156: Support for post links as title anchors83 Feature #160: Multi widget support for style overrides84 Feature #161: Use sprited markers85 Feature #169: Widgetize Registration86 Feature #170: Multisite licensing87 Feature #171: Map selector improvements88 Feature #174: Catgerory map widget should be context aware88 56: Welocally Namespace Javascript Refactoring 89 87: Widgetize Place Finder 90 100: Refactor wp_postmeta to remove obsolete concepts 91 128: Category Map Tag Support 92 140: API Keys incorporated into web services 93 152: Widgetize Places 94 154: Remove Font Customization 95 156: Support for post links as title anchors 96 160: Multi widget support for style overrides 97 161: Use sprited markers 98 169: Widgetize Registration 99 170: Multisite licensing 100 171: Map selector improvements 101 174: Catgerory map widget should be context aware 89 102 90 103 1.1.17 … … 92 105 93 106 1.1.16 94 99 "Places DB Tool In Options" 95 94 "Place Finder for Pages" 96 71 "Share Tag Support" 97 54 "Refactor Metadata Approach for Place Persistence" 98 53 "Extended Tag Support" 99 43 "Places Support On Pages" 100 42 "Transform Post Save Approach to Tags and Place Metadata" 101 41 "Custom Theme Support For List Widget" 102 40 "Custom Theme Support For Map Widget" 103 38 "Add Custom Theme Options Settings" 104 36 "iFeature Theme Support" 105 34 "zBench Theme Support" 106 21 "Add Change Login/Key Support" 107 10 "Theme Support for Delicate " 108 3 "Integrate New Add Place Workflow" 109 110 1.0.13 111 361 Options settings to suppress the display of the the "sele... 112 360 Infobox close deselects peer infoboxes. 113 363 Support Thumbnails in Map Infobox 114 364 Sight Theme Support 115 116 1.0.12 117 354 critical P1 Archive summaries are showing javascript for theme. 118 353 critical P1 Setting "Yes" to place with no selection should not persist on Update 119 352 enhancement P1 Picman still broken in some themes 120 351 enhancement P2 Improve theme support in About options 121 122 1.0.11 123 349 maj P1 Map is Showing Up On Category Archive 1.0.11 124 346 maj P2 Add Place Appends Extra to website prefix --- 125 344 cri P1 Place Name Links To Incorrect Post 1.0.11 126 343 enh P1 Bypass Filter When No Category Hits 1.0.11 127 341 enh P2 Some theme img css effects map tiles 1.0.11 128 129 1.0.10 130 333 FIXE 1.0.9 Need to quote templated javascript 131 334 FIXE 1.0.9 Where marker not showing up on non custom maps 132 336 FIXE 1.0.9 HTTPS support for all ajax calls 133 337 FIXE 1.0.9 Url and Website Confusion 134 338 WORK 1.0.9 Cannot exit add place mode 135 340 FIXE 1.0.9 Plugin causes problem when inserting images 136 137 1.0.9 138 332 FIXE 1.0.8 Jquery version < 1.4 is not parsing JSON 139 304 WONT 1.0.7 Seachability for Simple Geo Store 140 327 FIXE 1.0.7 Improve subscription prompting and workflow 141 331 LATE 1.0.8 Post excerpts are not full text 142 143 1.0.8 144 320 FIXE Post map not showing up on new posts 145 321 FIXE Infobox missing URL link for places 146 327 FIXE Improve subscription prompting and workflow 147 148 1.0.7 Initial version. Includes: Places List Widget, Places Map Widget and 149 Category Browser for supported themes 107 99 Places DB Tool In Options 108 94 Place Finder for Pages 109 71 Share Tag Support 110 54 Refactor Metadata Approach for Place Persistence 111 53 Extended Tag Support 112 43 Places Support On Pages 113 42 Transform Post Save Approach to Tags and Place Metadata 114 41 Custom Theme Support For List Widget 115 40 Custom Theme Support For Map Widget 116 38 Add Custom Theme Options Settings 117 36 iFeature Theme Support 118 34 zBench Theme Support 119 21 Add Change Login/Key Support 120 10 Theme Support for Delicate 121 3 Integrate New Add Place Workflow 150 122 151 123 == Upgrade Notice == 152 No notices at this time. 124 If you are upgrading and an install this manually make sure to re-activate the plugin, activation does important database updates. 153 125 154 126 == Screenshots == -
welocally-places/trunk/resources/javascripts/wl_addplace_wp.js
r544331 r548366 531 531 type: 'POST', 532 532 url: ajaxurl, 533 datatype: 'json', 533 534 data: data, 534 535 beforeSend: function(jqXHR){ … … 540 541 } 541 542 }, 542 success : function(data, textStatus, jqXHR ) {543 success : function(data, textStatus, jqXHR, dataType) { 543 544 if(data != null && data.errors != null) { 544 545 _instance.setStatus(_instance.statusArea,'ERROR:'+WELOCALLY.util.getErrorString(data.errors), 'wl_error', false); … … 546 547 _instance.setStatus(_instance.statusArea,'Could not save place:'+WELOCALLY.util.getErrorString(data.errors), 'wl_error', false); 547 548 } else { 548 var response = jQuery.parseJSON(data); 549 var tag = '[welocally id="'+response.id+'"/]'; 550 551 _instance.setStatus(_instance.statusArea,'Your place has been saved! <br/><span class="wl_placemgr_place_tag">'+tag+'</span>', 'wl_message', false); 552 _instance.savedPlace = selectedPlace; 549 try{ 550 var response = jQuery.parseJSON(data); 551 var tag = '[welocally id="'+response.id+'"/]'; 552 _instance.setStatus(_instance.statusArea,'Your place has been saved! <br/><span class="wl_placemgr_place_tag">'+tag+'</span>', 'wl_message', false); 553 _instance.savedPlace = selectedPlace; 554 } catch(e) { 555 _instance.setStatus(_instance.statusArea,'ERROR: Can Not Parse Response.'+data, 'wl_error', false); 556 } 557 558 559 553 560 } 554 561 } … … 626 633 627 634 var hasAll = _instance.hasType("country", geocode.address_components); 628 hasAll = hasAll && _instance.hasType("street_number", geocode.address_components);629 635 hasAll = hasAll && _instance.hasType("route", geocode.address_components); 630 636 hasAll = hasAll && _instance.hasType("locality", geocode.address_components); -
welocally-places/trunk/resources/javascripts/wl_pager_wp.js
r543528 r548366 268 268 content: _instance.cfg.content 269 269 }; 270 270 271 jQuery(_instance.wrapper).show(); 272 271 273 _instance.jqxhr = jQuery.ajax({ 272 274 type: 'POST', … … 285 287 _instance.setStatus(_instance.statusArea,'', 'wl_message', false); 286 288 jQuery(_instance.wrapper).find('.wl_pager_content').html(res); 287 jQuery(_instance.wrapper).show();288 289 } 289 290 }); -
welocally-places/trunk/resources/javascripts/wl_placemgr.js
r544331 r548366 84 84 WELOCALLY_PlaceManager.prototype.setPlaceRow = function(i, place, row) { 85 85 86 jQuery(this.wrapper).find('#wl_placesmgr_searchterm').show(); 87 88 89 var placeRowContent = jQuery('<div></div>'); 90 jQuery(placeRowContent).append('<div class="wl_placemgr_place_tag">[welocally id="'+place._id+'" /]</div>'); 91 92 var placeInfo = jQuery('<div class="wl_placemgr_place_info"></div>'); 93 94 jQuery(placeInfo).append('<div class="place_field">'+place.properties.name+'</div>'); 95 jQuery(placeInfo).append('<div class="place_field">'+place.properties.address+'</div>'); 96 jQuery(placeInfo).append('<div class="place_field">'+place.properties.city+'</div>'); 97 jQuery(placeInfo).append('<div class="place_field">'+place.properties.province+'</div>'); 98 jQuery(placeInfo).append('<div class="place_field">'+place.properties.postcode+'</div>'); 99 if(place.properties.website) 100 jQuery(placeInfo).append('<div class="place_field">'+place.properties.website+'</div>'); 101 if(place.properties.phone) 102 jQuery(placeInfo).append('<div class="place_field">'+place.properties.phone+'</div>'); 103 jQuery(placeRowContent).append(placeInfo); 104 105 var actions = jQuery('<div class="wl_placemgr_actions"></div>'); 106 var btnEdit = jQuery('<a class="wl_placemgr_button" href="#">edit</a>'); 107 jQuery(btnEdit).bind('click',{instance: this, place: place, index: i, row: row}, this.editHandler); 108 109 var btnDelete = jQuery('<a class="wl_placemgr_button" href="#">delete</a>'); 110 111 jQuery(btnDelete).bind('click',{instance: this, place: place, index: i, row: row}, this.deleteDialogHandler); 112 113 jQuery(actions).append(btnEdit); 114 jQuery(actions).append(btnDelete); 115 jQuery(placeRowContent).append(actions); 116 117 jQuery(row).html(placeRowContent); 86 if(place){ 87 jQuery(this.wrapper).find('#wl_placesmgr_searchterm').show(); 88 89 90 var placeRowContent = jQuery('<div></div>'); 91 jQuery(placeRowContent).append('<div class="wl_placemgr_place_tag">[welocally id="'+place._id+'" /]</div>'); 92 93 var placeInfo = jQuery('<div class="wl_placemgr_place_info"></div>'); 94 95 jQuery(placeInfo).append('<div class="place_field">'+place.properties.name+'</div>'); 96 jQuery(placeInfo).append('<div class="place_field">'+place.properties.address+'</div>'); 97 jQuery(placeInfo).append('<div class="place_field">'+place.properties.city+'</div>'); 98 jQuery(placeInfo).append('<div class="place_field">'+place.properties.province+'</div>'); 99 jQuery(placeInfo).append('<div class="place_field">'+place.properties.postcode+'</div>'); 100 if(place.properties.website) 101 jQuery(placeInfo).append('<div class="place_field">'+place.properties.website+'</div>'); 102 if(place.properties.phone) 103 jQuery(placeInfo).append('<div class="place_field">'+place.properties.phone+'</div>'); 104 jQuery(placeRowContent).append(placeInfo); 105 106 var actions = jQuery('<div class="wl_placemgr_actions"></div>'); 107 var btnEdit = jQuery('<a class="wl_placemgr_button" href="#">edit</a>'); 108 jQuery(btnEdit).bind('click',{instance: this, place: place, index: i, row: row}, this.editHandler); 109 110 var btnDelete = jQuery('<a class="wl_placemgr_button" href="#">delete</a>'); 111 112 jQuery(btnDelete).bind('click',{instance: this, place: place, index: i, row: row}, this.deleteDialogHandler); 113 114 jQuery(actions).append(btnEdit); 115 jQuery(actions).append(btnDelete); 116 jQuery(placeRowContent).append(actions); 117 118 jQuery(row).html(placeRowContent); 119 } else { 120 121 jQuery(this.wrapper).find('#wl_placesmgr_searchterm').show(); 122 123 124 var placeRowContent = jQuery('<div></div>'); 125 126 var placeInfo = jQuery('<div class="wl_placemgr_place_info">PLACE EMPTY PLEASE DELETE AND ADD A NEW ONE</div>'); 127 jQuery(placeRowContent).append(placeInfo); 128 129 var actions = jQuery('<div class="wl_placemgr_actions"></div>'); 130 var btnDelete = jQuery('<a class="wl_placemgr_button" href="#">delete</a>'); 131 132 jQuery(btnDelete).bind('click',{instance: this, place: place, index: i, row: row}, this.deleteDialogHandler); 133 134 jQuery(actions).append(btnDelete); 135 jQuery(placeRowContent).append(actions); 136 137 jQuery(row).html(placeRowContent); 138 } 139 118 140 }; 119 141 … … 192 214 event.data, 193 215 _instance.deleteHandler); 194 jQuery( _instance.deleteDialog).html('Please confirm that you would like to delete '+ 195 event.data.place.properties.name+' at '+event.data.place.properties.address+ 196 '. <strong>This action can not be undone.</strong> You will also need to delete the tag from your post.'); 216 var title = 'Delete Place?'; 217 if(event.data.place) { 218 jQuery( _instance.deleteDialog).html('Please confirm that you would like to delete '+ 219 event.data.place.properties.name+' at '+event.data.place.properties.address+ 220 '. <strong>This action can not be undone.</strong> You will also need to delete the tag from your post.'); 221 title = 'Delete '+event.data.place.properties.name+'?' 222 } else { 223 jQuery( _instance.deleteDialog).html('The place is missing from this record, you should go ahead and delete it and add a new place'); 224 } 225 197 226 jQuery( _instance.deleteDialog).dialog({ 198 227 resizable: false, 199 title: 'Delete '+event.data.place.properties.name+'?',228 title: title, 200 229 width: 400, 201 230 height:200, … … 224 253 var data = { 225 254 action: 'delete_place', 226 id: event.data.index, 227 wl_id: event.data.place._id 255 id: event.data.index 228 256 }; 229 257 -
welocally-places/trunk/resources/stylesheets/ie/wl_places_admin.css
r543527 r548366 5 5 text-transform:uppercase} 6 6 7 . form-table {7 .wl-form-table { 8 8 border-collapse: separate; 9 9 -webkit-border-radius: 4px; … … 24 24 } 25 25 26 #action_bar { width:100%; text-align:right; } 26 #wl_action_bar { width:100%; text-align:right; } 27 #wl_info_bar { width:95%; text-align:center; padding:10px; } 27 28 28 29 #btn_support a{ -
welocally-places/trunk/resources/stylesheets/wl_places_admin.css
r543527 r548366 7 7 text-transform:uppercase} 8 8 9 . form-table {9 .wl-form-table { 10 10 border-collapse: separate; 11 11 -webkit-border-radius: 4px; … … 16 16 border: 1px solid #034D96; 17 17 background: #DFEFF2; padding: 5px; } 18 18 19 table.wl-form-table tr > td { 20 padding-bottom: 1.2em; 21 } 22 23 table.wl-form-table tr > th { 24 vertical-align: top; 25 text-align: right; 26 padding-right: 5px; 27 width: 250px; 28 } 29 30 19 31 .rollover { 20 32 display: inline-block; … … 26 38 } 27 39 28 #action_bar { width:100%; text-align:right; } 40 #wl_action_bar { width:100%; text-align:right; } 41 #wl_info_bar { width:95%; text-align:center; padding:10px; } 29 42 30 43 #btn_support a{ … … 166 179 text-transform:uppercase} 167 180 168 .form-table {169 border-collapse: separate;170 -webkit-border-radius: 4px;171 -moz-border-radius: 4px;172 border-radius: 4px;173 padding: 4px;174 width:98%; margin-bottom:10px;175 border: 1px solid #034D96;176 background: #DFEFF2; padding: 5px; }177 181 178 182 .rollover { … … 185 189 } 186 190 187 #action_bar { width:100%; text-align:right; } 188 191 189 192 #btn_support a{ 190 193 width: 80px; height: 30px; -
welocally-places/trunk/template-tags.php
r543814 r548366 19 19 $wlPlaces->saveOptions($options); 20 20 21 //update places22 if ( array_key_exists( 'update_places', $options )) {23 update_places();24 }25 21 } 26 22 … … 83 79 84 80 85 function update_places(){ 86 global $wlPlaces; 87 $cat_ID = $wlPlaces->placeCategory(); 88 $places_in_category_posts = $wlPlaces->getPlacePostsInCategory($cat_ID, null); 89 90 $index = 0; 91 foreach( $places_in_category_posts as $post ) { 92 93 94 $placeJsonRaw = str_replace( 95 "\'", "", 96 get_post_meta( $post->ID, '_PlaceSelected', true )); 97 98 $placeJson = 99 json_decode($placeJsonRaw, true); 100 101 $pname = str_replace("\\'", "'", $placeJson{'name'}); 102 103 if($pname != null){ 104 $newPlaceJson = convert_legacy_place($placeJsonRaw); 105 update_post_meta( $post->ID, '_PlaceSelected', $newPlaceJson); 106 } 107 108 } 109 110 } 81 111 82 112 83 /** … … 235 206 return $wlPlaces->getPlacePostsInCategory($categoryId, 'post'); 236 207 } 237 238 239 /*function get_places_for_category($categoryId){ 240 global $wlPlaces; 241 $options = $wlPlaces->getOptions(); 242 $result = array(); 243 $places_in_category_posts = $wlPlaces->getPlacePostsInCategory($categoryId, 'post'); 244 foreach( $places_in_category_posts as $post ){ 245 $places = get_post_places($post->ID); 246 foreach ($places as $place){ 247 if($options['infobox_title_link']=='on'){ 248 $place->properties->titlelink=get_permalink( $post->ID ) ; 249 } 250 array_push($result, $place); 251 } 252 } 253 return json_encode($result); 254 }*/ 255 256 208 257 209 function get_legacy_place_by_post_id( $postId = null) { 258 210 global $wpdb; … … 289 241 } 290 242 291 292 /*function wl_get_post_excerpt( $postId = null) {293 global $wpdb;294 295 $query = "296 SELECT $wpdb->posts.*297 FROM $wpdb->posts298 WHERE $wpdb->posts.post_status = 'publish'299 AND $wpdb->posts.ID = $postId300 GROUP BY $wpdb->posts.ID LIMIT 1";301 302 $queryResult = $wpdb->get_results($query, OBJECT);303 304 $excerpt = wl_trim_excerpt($queryResult[0]->post_content, $queryResult[0]->post_excerpt);305 $excerpt = WelocallyPlaces_Tag::searchAndReplace($excerpt, create_function('$tag,$tag_str', 'return "";'));306 $excerpt = str_replace( '\'', '', $excerpt );307 $excerpt = trim( preg_replace( '/\s+/', ' ', $excerpt ) );308 309 return $excerpt;310 }*/311 312 /*function wl_trim_excerpt($text, $excerpt)313 {314 if ($excerpt) return $excerpt;315 316 $text = strip_shortcodes( $text );317 318 $text = str_replace(']]>', ']]>', $text);319 $text = strip_tags($text);320 $excerpt_length = apply_filters('excerpt_length', 55);321 $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');322 $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);323 if ( count($words) > $excerpt_length ) {324 array_pop($words);325 $text = implode(' ', $words);326 $text = $text . $excerpt_more;327 } else {328 $text = implode(' ', $words);329 }330 331 return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);332 }*/333 334 243 function places_get_mapview_link( ) { 335 244 global $wlPlaces; -
welocally-places/trunk/views/category-map-content-template.php
r544571 r548366 5 5 <div class="wl_category_container_tag"> 6 6 <div id="wl_category_map"> 7 <script type="text/javascript"> 8 //<![CDATA[ 9 10 var placeSelected = new WELOCALLY_PlaceWidget({hidePlaceSectionMap: true}).init(); 11 var cfg = { 12 id:'multi_<?php echo $t->uid; ?>', 13 hideDistance: true, 14 <?php if($options['show_letters_tag']=='on'):?> showLetters: true,<?php else: ?>showLetters: false,<?php endif;?> 15 <?php if(!empty($options['tag_selection_style'])):?> overrideSelectableStyle:<?php echo('\''.$options['tag_selection_style'].'\''.',');?><?php else: ?>overrideSelectableStyle: 'margin: 3px; padding: 2px; float: left; width: 150px; height: 60px;',<?php endif;?> 16 imagePath:'<?php echo($marker_image_path); ?>', 17 endpoint:'<?php echo($endpoint); ?>', 18 <?php if($options['show_selection_tag']=='on'):?>showSelection: true,<?php else: ?>showSelection: false,<?php endif;?> 19 observers:[placeSelected], 20 <?php if(isset($custom_style)):?> styles:<?php echo($custom_style.','); endif;?> 21 places: <?php echo json_encode($t->places); ?> 22 }; 23 var placesMulti = 24 new WELOCALLY_PlacesMultiWidget(cfg) 25 .init(); 26 27 //now register the display for the place 28 placeSelected.initCfg(cfg); 29 placesMulti.getSelectedArea().append(placeSelected.makeWrapper()); 30 31 //]]> 32 </script> 7 <script type="text/javascript"> 8 var placeSelected = new WELOCALLY_PlaceWidget({hidePlaceSectionMap: true}).init(); 9 var cfg = { 10 id:'multi_<?php echo $t->uid; ?>', 11 hideDistance: true, 12 <?php if($options['show_letters_tag']=='on'):?> showLetters: true,<?php else: ?>showLetters: false,<?php endif;?> 13 <?php if(!empty($options['tag_selection_style'])):?> overrideSelectableStyle:<?php echo('\''.$options['tag_selection_style'].'\''.',');?><?php else: ?>overrideSelectableStyle: 'margin: 3px; padding: 2px; float: left; width: 150px; height: 60px;',<?php endif;?> 14 imagePath:'<?php echo($marker_image_path); ?>', 15 endpoint:'<?php echo($endpoint); ?>', 16 <?php if($options['show_selection_tag']=='on'):?>showSelection: true,<?php else: ?>showSelection: false,<?php endif;?> 17 observers:[placeSelected], 18 <?php if(isset($custom_style)):?> styles:<?php echo($custom_style.','); endif;?> 19 places: <?php echo json_encode($t->places); ?> 20 }; 21 var placesMulti = 22 new WELOCALLY_PlacesMultiWidget(cfg) 23 .init(); 24 placeSelected.initCfg(cfg); 25 placesMulti.getSelectedArea().append(placeSelected.makeWrapper()); 26 </script> 33 27 </div> 34 28 </div> -
welocally-places/trunk/views/place-content-template.php
r543527 r548366 20 20 21 21 ?> 22 23 <script type="text/javascript">24 jQuery(document).ready(function() {25 26 27 });28 </script>29 30 22 <div id="wl-place-content-<?php echo $t->uid; ?>" class="wl-place-content"> 31 23 <div class="template-wrapper"> 32 24 <div> 33 <script type="text/javascript" charset="utf-8"> 34 var place<?php echo $t->uid; ?> = <?php echo $t->placeJSON; ?>; 35 var cfg = { 36 id: place<?php echo $t->uid; ?>._id, 37 imagePath:'<?php echo($marker_image_path); ?>', 38 endpoint:'<?php echo($endpoint); ?>', 39 <?php if(isset($custom_style)):?> styles:<?php echo($custom_style.','); endif;?> 40 showShare: false, 41 placehoundPath: 'http://placehound.com' 42 }; 43 44 var placeWidget<?php echo $t->uid; ?> = 45 new WELOCALLY_PlaceWidget(cfg) 46 .init(); 47 48 placeWidget<?php echo $t->uid; ?>.load(place<?php echo $t->uid; ?>); 49 50 </script> 25 <script type="text/javascript" charset="utf-8"> 26 var place<?php echo $t->uid; ?> = <?php echo $t->placeJSON; ?>; 27 var cfg = { 28 id: place<?php echo $t->uid; ?>._id, 29 imagePath:'<?php echo($marker_image_path); ?>', 30 endpoint:'<?php echo($endpoint); ?>', 31 <?php if(isset($custom_style)):?> styles:<?php echo($custom_style.','); endif;?> 32 showShare: false, 33 placehoundPath: 'http://placehound.com' 34 }; 35 var placeWidget<?php echo $t->uid; ?> = 36 new WELOCALLY_PlaceWidget(cfg) 37 .init(); 38 placeWidget<?php echo $t->uid; ?>.load(place<?php echo $t->uid; ?>); 39 </script> 51 40 </div> 52 41 </div> -
welocally-places/trunk/views/welocally-places-map-widget-display.php
r544571 r548366 6 6 <div class="wl_category_container_widget"> 7 7 <div id="main"> 8 <script type="text/javascript"> 9 //<![CDATA[ 10 11 var placeSelected = new WELOCALLY_PlaceWidget({hidePlaceSectionMap: true}).init(); 12 var cfg = { 13 id:'multi_<?php echo $t->uid; ?>', 14 <?php if($options['show_letters']=='on'):?> showLetters: true,<?php else: ?>showLetters: false,<?php endif;?> 15 <?php if(!empty($options['widget_selection_style'])):?> overrideSelectableStyle:<?php echo('\''.$options['widget_selection_style'].'\''.',');?><?php else: ?>overrideSelectableStyle: 'width:98%;',<?php endif;?> 16 imagePath:'<?php echo($marker_image_path); ?>', 17 endpoint:'<?php echo($endpoint); ?>', 18 <?php if($options['show_selection']=='on'):?>showSelection: true,<?php else: ?>showSelection: false,<?php endif;?> 19 observers:[placeSelected], 20 <?php if(isset($custom_style)):?> styles:<?php echo($custom_style.','); endif;?> 21 places: <?php echo json_encode($t->places); ?> 22 }; 23 24 var placesMulti = 25 new WELOCALLY_PlacesMultiWidget(cfg) 26 .init(); 27 28 //now register the display for the place 29 placeSelected.initCfg(cfg); 30 placesMulti.getSelectedArea().append(placeSelected.makeWrapper()); 31 32 //]]> 33 </script> 8 <script type="text/javascript"> 9 var placeSelected = new WELOCALLY_PlaceWidget({hidePlaceSectionMap: true}).init(); 10 var cfg = { 11 id:'multi_<?php echo $t->uid; ?>', 12 <?php if($options['show_letters']=='on'):?> showLetters: true,<?php else: ?>showLetters: false,<?php endif;?> 13 <?php if(!empty($options['widget_selection_style'])):?> overrideSelectableStyle:<?php echo('\''.$options['widget_selection_style'].'\''.',');?><?php else: ?>overrideSelectableStyle: 'width:98%;',<?php endif;?> 14 imagePath:'<?php echo($marker_image_path); ?>', 15 endpoint:'<?php echo($endpoint); ?>', 16 <?php if($options['show_selection']=='on'):?>showSelection: true,<?php else: ?>showSelection: false,<?php endif;?> 17 observers:[placeSelected], 18 <?php if(isset($custom_style)):?> styles:<?php echo($custom_style.','); endif;?> 19 places: <?php echo json_encode($t->places); ?> 20 }; 21 var placesMulti = 22 new WELOCALLY_PlacesMultiWidget(cfg) 23 .init(); 24 placeSelected.initCfg(cfg); 25 placesMulti.getSelectedArea().append(placeSelected.makeWrapper()); 26 </script> 34 27 </div> 35 28 </div> -
welocally-places/trunk/welocally-places-map-widget.class.php
r529351 r548366 25 25 } 26 26 27 28 /** 29 * needs to be refactored 30 * 31 */ 27 32 function widget( $args, $instance ) { 28 global $wp_query,$wlPlaces; 33 34 global $wlPlaces; 29 35 $options = $wlPlaces->getOptions(); 30 36 extract( $args ); 31 37 32 /* User-selected settings. */ 33 $title = $instance['title']; 34 $limit = $instance['limit']; 38 39 $post_type = $options['widget_post_type']; 35 40 36 if( function_exists( 'get_places' ) ) { 37 $old_display = $wp_query->get('placeMapDisplay'); 38 $wp_query->set('placeMapDisplay', 'places'); 39 $posts = get_places($limit, null, null); 40 } 41 $cat = $wlPlaces->placeCategory(); 41 42 42 if( $posts ) { 43 /* Display list of places. */ 44 if( function_exists( 'get_places' ) ) { 45 //$templateLoc = apply_filters('map_widget_template',''); 46 //view 47 //include( $templateLoc ); 48 49 $currentCat = get_query_var( 'cat' ); 50 51 if(!$currentCat){ 52 $currentCat = $wlPlaces->placeCategory(); 43 $cat_var = get_query_var('cat'); 44 45 46 if (!empty($cat_var) && !(is_home() || is_front_page())) { 47 $cat = get_category(intval($cat_var)); 48 } 49 elseif (isset($post) && !(is_home() || is_front_page())){ 50 //try to get category for post if possible 51 $post_categories = wp_get_post_categories( $post->ID ); 52 if($post_categories){ 53 foreach ($post_categories as $postCatId) { 54 $catObj = get_category( $postCatId ); 55 if($catObj->name != 'Uncategorized' && $catObj->name != 'Place'){ 56 $cat = $postCatId; 53 57 } 54 echo($wlPlaces->getCategoryMapMarkup(55 $currentCat,56 dirname( __FILE__ ).'/views/welocally-places-map-widget-display.php',57 true));58 59 60 61 $wp_query->set('placeMapDisplay', $old_display);62 58 } 59 } 60 } 63 61 64 65 } else if( !$posts ) _e('There are no places.', $this->pluginDomain); 66 62 63 if(!isset($post_type)) 64 $post_type = 'post'; 65 66 //add support for custom post type 67 echo $wlPlaces->getCategoryMapMarkup( 68 $cat, 69 dirname( __FILE__ ).'/views/welocally-places-map-widget-display.php', 70 true, 71 25, 72 $post_type); 67 73 68 74 } 69 75 70 76 function update( $new_instance, $old_instance ) { 71 $instance = $old_instance; 72 73 /* Strip tags (if needed) and update the widget settings. */ 74 $instance['title'] = strip_tags( $new_instance['title'] ); 75 $instance['limit'] = strip_tags( $new_instance['limit'] ); 76 /*if(eval($instance['limit'])>25) 77 $instance['limit'] = '25';*/ 78 79 77 $instance = $old_instance; 80 78 return $instance; 81 79 } … … 83 81 function form( $instance ) { 84 82 /* Set up default widget settings. */ 85 $defaults = array( 'style'=>'aside', 'title' => 'Published Places', 'limit' => '25' );83 $defaults = array( 'style'=>'aside', 'title' => 'Published Places', 'limit' => '25', 'post_type'=>'post'); 86 84 $instance = wp_parse_args( (array) $instance, $defaults ); 87 85 include( dirname( __FILE__ ) . '/views/welocally-places-map-widget-admin.php' ); -
welocally-places/trunk/welocally-places-tag-processor.class.php
r543527 r548366 7 7 } 8 8 9 private function queryPlace($tag) {10 if (!$tag->id)11 return false;12 13 // $response = json_decode($json_response);14 // return $response[0];15 }16 17 9 public function processTag($tag, $postId=0) { 18 10 … … 20 12 global $wlPlaces; 21 13 22 23 if (!$tag->id || $tag->type != 'post')24 return false;25 26 14 $postId = intval($postId); 27 15 28 16 $place = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wl_places WHERE wl_id = %s", $tag->id)); 29 17 30 31 if ($place == null) { 32 $place_info = $this->queryPlace($tag); 33 34 if ($wpdb->insert("{$wpdb->prefix}wl_places", array('wl_id' => $tag->id, 35 'place' => json_encode($place_info))) ) { 36 37 $place = $wpdb->get_row( 38 $wpdb->prepare("SELECT * FROM {$wpdb->prefix}wl_places WHERE wl_id = %s", $tag->id) ); 39 } 40 41 } 42 43 if (!$place) 44 return false; 45 46 if ($postId) { 18 if ($place && $postId) { 47 19 $wpdb->insert("{$wpdb->prefix}wl_places_posts", array('place_id' => $place->id, 48 20 'post_id' => $postId)); 49 //make sure its categorized as place no matter what 21 22 //make sure its categorized as place no matter what 50 23 $postCategories = wp_get_post_categories($postId); 51 24 $customCategories = array(); … … 61 34 $newCategories = array_merge($postCategories, $customCategories); 62 35 wp_set_post_categories($postId, $newCategories); 63 64 update_post_meta($this->postId, '_isWLPlace', true);65 66 // delete post metadata from previous versions of the plugin67 delete_post_meta($postId, '_PlaceSelected');68 delete_post_meta($postId, '_WLPlaces');69 } else {70 71 }72 36 73 return $place; 74 37 } 38 39 40 75 41 } 76 42 -
welocally-places/trunk/welocally-places.class.php
r544571 r548366 9 9 class WelocallyPlaces { 10 10 11 const VERSION = '1.2.2 1';11 const VERSION = '1.2.22'; 12 12 const DB_VERSION = '2.0'; 13 13 const WLERROROPT = '_welocally_errors'; … … 24 24 public $pluginUrl; 25 25 public $pluginDomain = 'welocallyPlaces'; 26 27 public $metaTags = array(28 '_isWLPlace',29 '_PlaceSelected',30 '_ShowPlaceAddress',31 self::WLERROROPT32 );33 34 26 35 27 /** … … 62 54 add_action( 'admin_enqueue_scripts', array( $this, 'loadAdminDomainStylesScripts' ) ); 63 55 add_action( 'admin_menu', array( $this, 'addPlaceBox' ) ); 64 add_action( 'save_post', array( $this, ' tagHandling'));56 add_action( 'save_post', array( $this, 'handlePublish')); 65 57 66 58 add_action( 'sp_places_post_errors', array( 'WLPLACES_Post_Exception', 'displayMessage' ) ); 67 59 add_action( 'sp_places_options_top', array( 'WLPLACES_Options_Exception', 'displayMessage') ); 68 60 69 add_ filter( 'the_content', array( $this, 'replaceTagsInContent'));61 add_shortcode('welocally', array ($this,'handleWelocallyPlacesShortcode')); 70 62 71 72 63 73 64 } 74 65 … … 80 71 function wl_admin_message($message='empty message', $error = false) { 81 72 echo '<div class="updated fade"><p>'.$message.'</p></div>'; 82 83 } 84 85 73 } 74 86 75 /** 87 76 * @return 88 77 */ 89 public function in_category() { 90 78 public function in_category() { 91 79 $cat_id = get_query_var( 'cat' ); 92 80 … … 94 82 return true; 95 83 } 96 97 84 } 98 85 … … 129 116 wp_enqueue_script( 'jquery' ); 130 117 wp_enqueue_script('jquery-ui-all' , 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'); 131 132 133 //jquery ui 134 wp_register_style( 'jquery-ui-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css' ); 135 wp_enqueue_style( 'jquery-ui-style' ); 136 118 137 119 //welocally 138 120 wp_enqueue_script('wl_base_script', WP_PLUGIN_URL.'/welocally-places/resources/javascripts/wl_base.js', array('jquery'), WelocallyPlaces::VERSION); … … 176 158 wp_enqueue_script('jquery-ui-all' , 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'); 177 159 178 //jquery ui 179 wp_register_style( 'jquery-ui-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css' ); 180 wp_enqueue_style( 'jquery-ui-style' ); 181 182 160 183 161 wp_enqueue_script('media-upload'); 184 162 wp_enqueue_script('thickbox'); … … 192 170 //add places 193 171 wp_enqueue_style( 'wl_places_addplace_style',WP_PLUGIN_URL.'/welocally-places/resources/stylesheets/wl_places_addplace.css',array(), WelocallyPlaces::VERSION, 'screen' ); 194 195 172 196 173 global $wp_styles; 197 174 … … 218 195 219 196 } 197 198 public function handleWelocallyPlacesShortcode($attrs,$content = null) { 199 200 global $post; 201 202 extract(shortcode_atts(array ( 203 'categories' => null, 204 'category' => null, 205 'id' => null, 206 'post_type'=> null 207 ), $attrs)); 208 209 //strip paragragh tags if exists this is required 210 if ( '</p>' == substr( $content, 0, 4 ) 211 and '<p>' == substr( $content, strlen( $content ) - 3 ) ) 212 $content = substr( $content, 4, strlen( $content ) - 7 ); 213 214 //template for javscript 215 $t = new StdClass(); 216 $t->uid = uniqid(); 217 218 if(!empty($id)) { 219 //this is a place 220 $t->wl_id = $id; 221 222 $this->processPlaceTag($t, $post->ID); 223 224 if(isset($t->place)){ 225 ob_start(); 226 include(dirname(__FILE__) . '/views/place-content-template.php'); 227 $resultContent = ob_get_contents(); 228 ob_end_clean(); 229 $t = null; 230 return $resultContent; 231 } else { 232 return false; 233 } 234 } 235 236 //right now only one is supported 237 $catsSlug = array(); 238 if(!empty($categories)) 239 $catsSlug = explode(",", $categories); 240 else if(!empty($category)) 241 $catsSlug = explode(",", $category); 242 243 $string = preg_replace('/&(?!amp;)/', '&', $catsSlug[0]); 244 $string = preg_replace('/#038;/', '', $string); 245 246 $term = get_term_by('name',$string,'category'); 247 if(!isset($post_type)) 248 $post_type = 'post'; 249 250 return $this->getCategoryMapMarkup($term->term_id, null, null, 25, $post_type); 251 252 } 253 254 255 public function processPlaceTag($tag, $postId=0) { 256 257 global $wpdb; 258 global $wlPlaces; 259 260 if (!$tag->wl_id) 261 return false; 262 263 $postId = intval($postId); 264 265 $place = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wl_places WHERE wl_id = %s", $tag->wl_id)); 266 267 //there is a problem 268 if (!$place) 269 return false; 270 else { 271 $tag->place = $place; 272 $tag->placeJSON = $place->place; 273 274 } 275 276 return $place; 277 278 } 220 279 221 280 public function makeUniqueGoogleFontList($fontList){ … … 253 312 254 313 /** 255 * Creates the category and sets up the theme resource folder with sample config files. Calls updateMapPostMeta(). 314 * Creates the category and sets up the theme resource folder with sample 315 * config files. Calls updateMapPostMeta(). Does all the hard work of figuring out 316 * what the database should look like. 256 317 * 257 318 * @return void … … 263 324 $firstTime = $now - ($now % 66400); 264 325 $this->create_category_if_not_exists( ); 265 266 // create places table 267 $db_version = get_option('Welocally_DBVersion'); 268 269 if ($db_version != self::DB_VERSION) { 270 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 326 327 328 //never created before 329 if (!$this->tableExists($wpdb->prefix.'wl_places')) { 330 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 271 331 272 332 $sql = "CREATE TABLE {$wpdb->prefix}wl_places ( 273 333 id INT PRIMARY KEY AUTO_INCREMENT, 274 334 wl_id VARCHAR(255) NOT NULL, 275 place TEXT NULL, 335 place TEXT NULL, " . 336 "likes INT NULL DEFAULT 0, ". 337 "lat DOUBLE NULL, " . 338 "lng DOUBLE NULL, 276 339 created DATETIME NOT NULL 277 340 );"; 278 dbDelta($sql); 279 341 dbDelta($sql); 342 } 343 344 if (!$this->tableExists($wpdb->prefix.'wl_places_posts')) { 345 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 346 280 347 $sql = "CREATE TABLE {$wpdb->prefix}wl_places_posts ( 281 348 id INT PRIMARY KEY AUTO_INCREMENT, … … 284 351 created DATETIME NOT NULL 285 352 );"; 286 dbDelta($sql); 287 } 288 289 update_option('Welocally_DBVersion', self::DB_VERSION); 290 291 353 dbDelta($sql); 354 } 355 356 //version 1.2.21 and earler had places table but not geo 357 if (!$this->columnExists($wpdb->prefix.'wl_places', 'likes')) { 358 359 $sql = "ALTER TABLE {$wpdb->prefix}wl_places ". 360 "ADD COLUMN likes INT NULL DEFAULT 0 AFTER place"; 361 362 $wpdb->query($sql); 363 } 364 365 $upgrade_g1 = false; 366 if (!$this->columnExists($wpdb->prefix.'wl_places', 'lat')) { 367 $upgrade_g1 = true; 368 369 $sql = "ALTER TABLE {$wpdb->prefix}wl_places " . 370 "ADD COLUMN lat DOUBLE NULL AFTER likes"; 371 $wpdb->query($sql); 372 } 373 374 if (!$this->columnExists($wpdb->prefix.'wl_places', 'lng')) { 375 376 $upgrade_g1 = true; 377 378 $sql = "ALTER TABLE {$wpdb->prefix}wl_places " . 379 "ADD COLUMN lng DOUBLE NULL AFTER lat"; 380 381 $wpdb->query($sql); 382 } 383 384 //put the latlng for all the places in the table 385 if(true){ 386 $query = "SELECT id,place FROM {$wpdb->prefix}wl_places"; 387 $results = $wpdb->get_results($query, ARRAY_A); 388 $count = count($results); 389 for ($i = 0; $i < $count; $i++) { 390 $row = $results[$i]; 391 $place = json_decode($row['place']); 392 393 $lat = $place->geometry->coordinates[1]; 394 $lng = $place->geometry->coordinates[0]; 395 396 //update row 397 $wpdb->update( 398 $wpdb->prefix.'wl_places', 399 array( 400 'lat' => $lat, // float 401 'lng' => $lng // float 402 ), 403 array( 'id' => $row['id'] ), 404 array( 405 '%s', // value1 406 '%s' // value2 407 ), 408 array( '%d' ) 409 ); 410 411 } 412 } 413 414 } 415 416 //checks all schema changes and makes sure all is ok. 417 public function databaseRequirementsMissing(){ 418 global $wpdb; 419 $reqs = array(); 420 if(!$this->tableExists($wpdb->prefix.'wl_places')) 421 array_push($reqs,'table missing '.$wpdb->prefix.'wl_places'); 422 if(!$this->tableExists($wpdb->prefix.'wl_places_posts')) 423 array_push($reqs,'table missing '.$wpdb->prefix.'wl_places_posts'); 424 if(!$this->columnExists($wpdb->prefix.'wl_places', 'likes')) 425 array_push($reqs,'column missing '.$wpdb->prefix.'wl_places.likes'); 426 if(!$this->columnExists($wpdb->prefix.'wl_places', 'lat')) 427 array_push($reqs,'column missing '.$wpdb->prefix.'wl_places.lat'); 428 if(!$this->columnExists($wpdb->prefix.'wl_places', 'lng')) 429 array_push($reqs,'column missing '.$wpdb->prefix.'wl_places.lng'); 430 431 432 return $reqs; 433 434 } 435 436 function showTables() { 437 global $wpdb; 438 $return = $wpdb->get_results("show tables", ARRAY_A); 439 foreach ( $return as $row ) { 440 echo("<div><pre>"); 441 echo($row["Tables_in_wordpress"]); 442 echo("</pre></div>"); 443 } 444 return $return; 445 } 446 447 function describeTable($table_name) { 448 global $wpdb; 449 $return = $wpdb->get_results(sprintf("describe %s",$table_name), ARRAY_A); 450 foreach ( $return as $row ) { 451 echo("<div><pre>"); 452 echo($row["Field"]); 453 echo("\t"); 454 echo($row["Type"]); 455 echo("</pre></div>"); 456 } 457 return $return; 458 } 459 460 public function tableExists($tableName){ 461 global $wpdb; 462 $query = sprintf("SHOW TABLES LIKE '%s' ",$tableName); 463 $result = $wpdb->get_var( $wpdb->prepare( $query ) ); 464 465 if($result == $tableName){ 466 return true; 467 } else { 468 return false; 469 } 470 } 471 472 public function columnExists($tableName, $columnName){ 473 474 global $wpdb; 475 $query = sprintf("SHOW COLUMNS FROM %s LIKE '%s'",$tableName, $columnName); 476 $result = $wpdb->get_var( $wpdb->prepare( $query ) ); 477 if($result == $columnName){ 478 return true; 479 } else { 480 return false; 481 } 292 482 } 293 483 … … 320 510 public function addPlaceMetaBox() { 321 511 global $post; 322 323 $options = '';324 $style = '';325 $postId = $post->ID;326 foreach ( $this->metaTags as $tag ) {327 if ( $postId ) {328 $$tag = get_post_meta( $postId, $tag, true );329 } else {330 $$tag = '';331 }332 }333 334 $isWLPlace = get_post_meta( $postId, '_isWLPlace', true );335 $ShowPlaceAddress = get_post_meta( $postId, '_ShowPlaceAddress', true );336 337 $isPlaceChecked = ( $isWLPlace == 'true' ) ? 'checked' : '';338 $isNotPlaceChecked = ( $isWLPlace == 'false' || $isWLPlace == '' || is_null( $isWLPlace ) ) ? 'checked' : '';339 $PlaceSelected = get_post_meta( $postId, '_PlaceSelected', true );340 341 512 include( dirname( __FILE__ ) . '/views/addplace-meta-box.php' ); 342 513 } 343 514 344 public function replaceTagsInContent($content) {345 return WelocallyPlaces_Tag::searchAndReplace($content, array($this, 'addTagMarkup'));346 }347 348 public function addTagMarkup($tag, $str) {349 switch ($tag->type) {350 case 'post':351 default:352 /* handle [welocally id="..." /] tags */353 if (!$tag->id) return $str;354 355 return $this->getPlaceMapMarkup($tag);356 break;357 case 'category':358 /* handle [welocally categories="..." /] tag */359 360 $categoryIds = array();361 362 if (!$tag->categories):363 $categoryIds = array(get_query_var('cat')); // fetch category from request364 else:365 $newcats = array();366 //required for special chars367 foreach ( $tag->categories as $cat ) {368 369 //this seems rediculous to have to do370 $string = preg_replace('/&(?!amp;)/', '&', $cat);371 $string = preg_replace('/#038;/', '', $string);372 373 array_push($categoryIds, get_cat_ID($string));374 }375 376 endif;377 378 if (!$categoryIds) return $str;379 380 $html = '';381 foreach ($categoryIds as $cat)382 $html .= $this->getCategoryMapMarkup(383 $cat,384 dirname(__FILE__) . '/views/category-map-content-template.php',385 false,386 25387 );388 389 return $html;390 391 break;392 }393 }394 515 395 516 /** … … 402 523 global $wpdb; 403 524 static $placecount = 0; 404 405 //$place = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wl_places WHERE wl_id = %s", $tag->id)); 406 525 407 526 //changing this to join so it actually must be in post places, someone please 408 527 //use your sprintf magic! … … 473 592 return $result; 474 593 475 // $places = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT place FROM {$wpdb->prefix}wl_places p")); 476 // 477 // if ($places) 478 // return array_map('json_decode', $places); 479 480 481 } 482 483 public function getPlaces($cat=null, $maxElements=25, $filter=true) { 594 } 595 596 597 /** 598 * this takes the category name, consider consolidating getplacesnew and this 599 */ 600 public function getPlaces($cat=null, $maxElements=25, $filter=true, $post_type='post') { 601 484 602 485 603 global $post; … … 494 612 //try to get category for post if possible 495 613 $post_categories = wp_get_post_categories( $post->ID ); 496 if($post_categories){ 497 614 if($post_categories){ 498 615 foreach ($post_categories as $postCatId) { 499 616 $catObj = get_category( $postCatId ); … … 504 621 } 505 622 } 506 507 $posts = $this->getPlacePostsInCategory($cat );623 624 $posts = $this->getPlacePostsInCategory($cat,$post_type); 508 625 509 626 $t = new StdClass(); … … 522 639 523 640 foreach ($post_places as $place) { 641 524 642 525 643 //determin if we are filtering … … 543 661 } 544 662 } 545 663 546 664 return $t; 547 665 } … … 553 671 */ 554 672 public function getCategoryMapMarkup( 555 $cat=null, $template=null, $showIfEmpty=null, $maxElements=25) { 556 557 558 $t = $this->getPlaces($cat, $maxElements); 673 $cat=null, $template=null, $showIfEmpty=null, $maxElements=25, $post_type='post') { 674 675 676 $t = $this->getPlaces($cat, $maxElements, true, $post_type); 677 559 678 560 679 //setup options … … 583 702 //this is being done so we can show all places if none are found in the cat 584 703 if($showIfEmpty && ($cat != $this->placeCategory())){ 585 return $this->getCategoryMapMarkup($this->placeCategory(), $template, false );704 return $this->getCategoryMapMarkup($this->placeCategory(), $template, false, $post_type); 586 705 } else { 587 706 include(dirname(__FILE__) . '/views/category-map-content-empty.php'); … … 683 802 } 684 803 685 686 } 687 688 public function tagHandling($post_id) { 804 } 805 806 /** 807 * we do this instead of using the shortcode handler because if we didnt 808 * we would have an extra database call on every tag hit 809 */ 810 public function handlePublish($post_id) { 689 811 if (!wp_is_post_revision($post_id)) { 690 812 $post = get_post($post_id); … … 696 818 } 697 819 } 820 698 821 699 822 … … 721 844 722 845 $default_marker_icon = plugins_url() . "/welocally-places/resources/images/marker_all_base.png"; 723 $default_update_places = 'off';724 846 725 847 $default_show_letters = 'on'; … … 733 855 $default_show_selection_tag = 'on'; 734 856 $default_infobox_title_link_tag = 'on'; 857 858 $default_widget_post_type = 'post'; 859 735 860 736 861 // Set current version level. Because this can be used to detect version changes (and to what extent), this … … 745 870 if ( !array_key_exists( 'show_selection', $options ) ) { $options[ 'show_selection' ] = $default_show_selection; $changed = true; } 746 871 if ( !array_key_exists( 'infobox_title_link', $options ) ) { $options[ 'infobox_title_link' ] = $default_infobox_title_link; $changed = true; } 872 if ( !array_key_exists( 'widget_post_type', $options ) ) { $options[ 'widget_post_type' ] = $default_widget_post_type; $changed = true; } 747 873 748 874 //tag … … 944 1070 global $wpdb, $wlPlaces; 945 1071 $wlPlaces->setOptions(); 1072 1073 $post_type = explode(",",$post_type); 946 1074 947 1075 $post_type_and = '1=1'; … … 965 1093 ON $wpdb->posts.ID = {$wpdb->prefix}wl_places_posts.post_id 966 1094 GROUP BY $wpdb->posts.ID)"; 1095 967 1096 968 1097 $return = $wpdb->get_results($categories_query, OBJECT); … … 971 1100 972 1101 public function generatePlaceId($lat,$lng) { 973 //WL_10RyqzlSSjAd gMCImmeXYj_37.801379_-122.263600@1303263345974 1102 $guid = substr(uniqid().uniqid(), 0, 22); 975 1103 $parts = explode(" ", microtime()); -
welocally-places/trunk/welocally-places.php
r544571 r548366 2 2 3 3 /* 4 Plugin Name: Welocally Places Basic4 Plugin Name: Welocally Places Core 5 5 Plugin URI: http://www.welocally.com/wordpress/?page_id=2 6 Description: Great maps that link to your content. The Welocally Places plugin lets easily associate places to your content without manual geocoding. Add any place to your database and link it to your posts and categories with simple shortcodes. The map widget makes it easy for your users to find the places your are writing about on a map and is smart enough to automatically relate places by category. 7 Version: 1.2.2 16 Description: Great maps that link to your content. The Welocally Places plugin lets easily associate places to your content without manual geocoding. Add any place to your database and link it to your posts and categories with simple shortcodes. The map widget makes it easy for your users to find the places your are writing about on a map and is smart enough to automatically relate places by category. If you are upgrading and an install this manually make sure to re-activate the plugin, activation does important database updates. 7 Version: 1.2.22 8 8 Author: Welocally 9 9 Author URI: http://welocally.com … … 68 68 } 69 69 70 /** 71 * consider moving core impl to the class 72 */ 70 73 function welocally_save_place() { 71 74 … … 82 85 $mysqldate = date( 'Y-m-d H:i:s', time() ); 83 86 $placeToSave['_id'] = $wlPlaces->generatePlaceId($placeToSave['geometry']['coordinates'][1],$placeToSave['geometry']['coordinates'][0]); 84 87 85 88 //save to places table 86 89 if ($wpdb->insert("{$wpdb->prefix}wl_places", 87 array('wl_id' => $placeToSave['_id'], 'place' => json_encode($placeToSave), ' created' =>$mysqldate )) ) {90 array('wl_id' => $placeToSave['_id'], 'place' => json_encode($placeToSave), 'lat' => $placeToSave['geometry']['coordinates'][1], 'lng' => $placeToSave['geometry']['coordinates'][0], 'created' =>$mysqldate )) ) { 88 91 $place = $wpdb->get_row( 89 92 $wpdb->prepare("SELECT * FROM {$wpdb->prefix}wl_places WHERE wl_id = %s", $placeToSave['_id']) ); … … 95 98 96 99 $placeId = $placeToSave['_id']; 97 $statement = "UPDATE {$wpdb->prefix}wl_places SET place='".json_encode($placeToSave)."' WHERE wl_id = '".$placeId."'"; 100 $placeJSON = addslashes(json_encode($placeToSave)); 101 102 $statement = "UPDATE {$wpdb->prefix}wl_places SET place='".$placeJSON."' WHERE wl_id = '".$placeId."'"; 98 103 $wpdb->query($wpdb->prepare($statement)); 104 105 echo '{ "id": "'.$placeToSave['_id'].'"}'; 99 106 } 100 107 … … 157 164 global $wpdb, $wlPlaces; 158 165 159 $placeId = $_POST['wl_id'];166 //$placeId = $_POST['wl_id']; 160 167 $recordId = $_POST['id']; 161 $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}wl_places WHERE wl_id = %s", $placeId));168 $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}wl_places WHERE id = %d", $recordId)); 162 169 163 170 echo '{ "id":'.$recordId.',"status": "SUCCEED", "action": "DELETE" }';
Note: See TracChangeset
for help on using the changeset viewer.