Changeset 514360
- Timestamp:
- 03/04/2012 11:04:32 PM (14 years ago)
- Location:
- welocally-places/trunk
- Files:
-
- 31 added
- 4 deleted
- 39 edited
-
help/manager-help.php (added)
-
mcebutton.php (modified) (1 diff)
-
menu.php (modified) (4 diffs)
-
options/about.php (modified) (7 diffs)
-
options/options-general.php (modified) (6 diffs)
-
options/options-infobar.php (added)
-
options/places-manager.php (added)
-
options/subscribe.php (modified) (19 diffs)
-
readme.txt (modified) (1 diff)
-
resources/images/buy_action_1.png (added)
-
resources/images/contact_32.png (added)
-
resources/images/free1.png (added)
-
resources/images/help_32.png (added)
-
resources/images/login_home_32.png (added)
-
resources/images/places_powered.png (added)
-
resources/images/subscribe_action_1.png (deleted)
-
resources/images/subscribe_action_2.png (deleted)
-
resources/images/subscribe_action_3.png (deleted)
-
resources/images/subscribe_intro.png (modified) (previous)
-
resources/images/subscribe_process.png (deleted)
-
resources/images/subscribed1.png (added)
-
resources/images/token1.png (added)
-
resources/images/we_16.png (added)
-
resources/mcebutton.js (modified) (2 diffs)
-
resources/places.css (modified) (7 diffs)
-
resources/places.js (modified) (10 diffs)
-
resources/themes.json (modified) (1 diff)
-
resources/upload.js (added)
-
resources/wlplaces.js (added)
-
template-tags.php (modified) (13 diffs)
-
templates (added)
-
templates/newplace-template.json (added)
-
views/includes/category-map-include.php (modified) (9 diffs)
-
views/includes/infobox-map-include.php (modified) (2 diffs)
-
views/includes/places-list-include.php (modified) (2 diffs)
-
views/includes/places-map-include.php (modified) (6 diffs)
-
views/place-content-template.php (modified) (1 diff)
-
views/places-meta-box.php (modified) (11 diffs)
-
views/places-options.php (added)
-
views/themes/chateau/welocally-places-list-widget-display.php (modified) (3 diffs)
-
views/themes/chateau/welocally-places-map-widget-display.php (modified) (1 diff)
-
views/themes/default/category-places-map.php (modified) (1 diff)
-
views/themes/default/welocally-places-list-widget-display.php (modified) (3 diffs)
-
views/themes/default/welocally-places-map-widget-display.php (modified) (2 diffs)
-
views/themes/delicate (added)
-
views/themes/delicate/category-places-map.php (added)
-
views/themes/delicate/welocally-places-list-widget-display.php (added)
-
views/themes/delicate/welocally-places-map-widget-display.php (added)
-
views/themes/ifeature (added)
-
views/themes/ifeature/category-places-map.php (added)
-
views/themes/ifeature/welocally-places-list-widget-display.php (added)
-
views/themes/ifeature/welocally-places-map-widget-display.php (added)
-
views/themes/lightword/welocally-places-list-widget-display.php (modified) (3 diffs)
-
views/themes/lightword/welocally-places-map-widget-display.php (modified) (1 diff)
-
views/themes/sight/welocally-places-list-widget-display.php (modified) (3 diffs)
-
views/themes/sight/welocally-places-map-widget-display.php (modified) (1 diff)
-
views/themes/suffusion/welocally-places-list-widget-display.php (modified) (3 diffs)
-
views/themes/suffusion/welocally-places-map-widget-display.php (modified) (1 diff)
-
views/themes/twentyeleven/category-places-map.php (modified) (1 diff)
-
views/themes/twentyeleven/welocally-places-list-widget-display.php (modified) (3 diffs)
-
views/themes/twentyeleven/welocally-places-map-widget-display.php (modified) (1 diff)
-
views/themes/twentyten/welocally-places-list-widget-display.php (modified) (3 diffs)
-
views/themes/twentyten/welocally-places-map-widget-display.php (modified) (1 diff)
-
views/themes/zbench (added)
-
views/themes/zbench/category-places-map.php (added)
-
views/themes/zbench/welocally-places-list-widget-display.php (added)
-
views/themes/zbench/welocally-places-map-widget-display.php (added)
-
views/welocally-places-list-widget-admin.php (modified) (2 diffs)
-
welocally-places-list-widget.class.php (modified) (2 diffs)
-
welocally-places-map-widget.class.php (modified) (2 diffs)
-
welocally-places-tag-processor.class.php (added)
-
welocally-places-tag.class.php (added)
-
welocally-places.class.php (modified) (21 diffs)
-
welocally-places.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
welocally-places/trunk/mcebutton.php
r451428 r514360 25 25 26 26 27 28 29 27 ?> -
welocally-places/trunk/menu.php
r466267 r514360 6 6 add_contextual_help( $main_slug, __( $main_content ) ); 7 7 8 wl_add_submenu( 'Welocally Places Subscribe', 'Subscribe', 'welocally-places-subscribe', 'wl_places_subscribe' );8 wl_add_submenu( 'Welocally Places Registration', 'Register', 'welocally-places-subscribe', 'wl_places_subscribe' ); 9 9 wl_add_submenu( 'Welocally Places About', 'About', 'welocally-places-about', 'wl_support_about' ); 10 wl_add_submenu( 'Welocally Places Manager', 'Places Manager', 'welocally-places-manager', 'wl_support_manager' ); 10 11 11 12 add_filter( 'plugin_action_links', 'wl_add_settings_link', 10, 2 ); … … 29 30 include_once( WP_PLUGIN_DIR . "/welocally-places/options/about.php" ); 30 31 } 31 32 33 function wl_support_manager() { 34 include_once( WP_PLUGIN_DIR . "/welocally-places/options/places-manager.php" ); 35 } 36 32 37 33 38 function wl_add_settings_link( $links, $file ) { … … 49 54 50 55 if ( strpos( $file, 'welocally-places.php' ) !== false ) { 51 $links = array_merge( $links, array( '<a href="admin.php?page=welocally-places-subscribe">' . __( ' Subscribe' ) . '</a>' ) );56 $links = array_merge( $links, array( '<a href="admin.php?page=welocally-places-subscribe">' . __( 'Register' ) . '</a>' ) ); 52 57 $links = array_merge( $links, array( '<a href="admin.php?page=welocally-places-about">' . __( 'Support' ) . '</a>' ) ); 53 58 } … … 67 72 if ( $menu_slug == "welocally-places-about" ) { $help_text = file_get_contents(dirname( __FILE__ ) . '/help/about-help.php'); } 68 73 74 if ( $menu_slug == "welocally-places-manager" ) { $help_text = file_get_contents(dirname( __FILE__ ) . '/help/manager-help.php'); } 75 69 76 add_contextual_help( $profile_slug, __( $help_text ) ); 70 77 -
welocally-places/trunk/options/about.php
r466267 r514360 1 1 <?php 2 2 global $wlPlaces; 3 4 3 ?> 5 4 <script type="text/javascript"> 6 5 jQuery(document).ready(function() { 6 7 7 //set the endpoint info always 8 8 jQuery("#edit-server-link").click( function () { … … 48 48 49 49 <div class="wrap"> 50 50 51 <div class="icon32"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div> 51 52 <h2>Welocally Places About</h2> 53 <?php 54 $menubar_include = WP_PLUGIN_DIR . '/' .$wlPlaces->pluginDir . '/options/options-infobar.php'; 55 include($menubar_include); 56 ?> 52 57 <?php 53 58 // If options have been updated on screen, update the database 54 55 59 if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'welocally-places-about', 'welocally_places_about_nonce' ) ) ) { 56 60 … … 58 62 59 63 $options[ 'api_endpoint' ] = $_POST[ 'wl_api_endpoint' ]; 64 $options[ 'update_places' ] = $_POST[ 'wl_update_places' ]; 60 65 61 66 wl_save_options($options); … … 69 74 //display error if not subscribed 70 75 if(!is_subscribed()) { 71 echo '<div class="error fade"><p><strong>' . __( 'Please SubscribeTo Activate Welocally Places' ) . "</strong></p></div>\n";76 echo '<div class="error fade"><p><strong>' . __( 'Please Register To Activate Welocally Places' ) . "</strong></p></div>\n"; 72 77 } 73 78 … … 79 84 <tr valign="top"> 80 85 <th scope="row"><?php _e( 'Version' ); ?></th> 81 <td>< ?php echo $wlPlaces->wl_places_version(); ?></td>86 <td><div><?php echo $wlPlaces->wl_places_version(); ?></div></td> 82 87 </tr> 88 <tr valign="top"> 89 <th scope="row"><?php _e( 'Places Version Support' ); ?></th> 90 <td> 91 <?php if(get_places_legacy_count() > 0): ?> 92 <div><img width="48" height="48" src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/Crystal_Clear_cancel.png" alt="" title=""/></div> 93 <div>You have recenty upgraded Welocally Places. <?php echo(get_places_legacy_count()); ?> Legacy Posts were found. You can use the <a href="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=welocally-places-manager' ?>">Place Manager</a> 94 to track your migration, we have also created a <a href="http://welocally.com/?p=780" target="_new">Release Guide</a>. Finally, if you have problems <a href="http://www.welocally.com/?page_id=139" target="_new">email us</a>. 95 <p/><strong>ALWAYS BACKUP PRIOR TO UPGRADE</strong></div> 96 <?php else: ?> 97 <img width="48" height="48" src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/Crystal_Clear_check.png" alt="" title=""/> Your places are up to date. 98 <?php endif; ?> 99 </td> 100 </tr> 83 101 <tr valign="top"> 84 102 <th scope="row"><?php _e( 'Theme Support' ); ?></th> … … 88 106 <?php else: ?> 89 107 <div><img width="48" height="48" src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/Crystal_Clear_cancel.png" alt="" title=""/></div> 90 <div><em>Just because your theme is not supported does not mean that Welocally Places will not work. Give it a try, we have a default themethat will work with most themes. We really want to support your theme so <a href="http://www.welocally.com/wordpress/?page_id=139" target="_new">contact us</a> and we will do our best to support you. <strong>Below is a list of currently supported themes.</strong></em></div>108 <div><em>Just because your theme is not supported does not mean that Welocally Places will not work. Give it a try, we have default settings that will work with most themes. We really want to support your theme so <a href="http://www.welocally.com/wordpress/?page_id=139" target="_new">contact us</a> and we will do our best to support you. <strong>Below is a list of currently supported themes.</strong></em></div> 91 109 <div style="display:inline-block"> 92 110 <?php … … 117 135 <th scope="row"><?php _e( 'API Server' ); ?></th> 118 136 <td> 119 <div id="server-section" >120 <span id="api-endpoint-assigned" class="assigned-field" ><?php echo wl_get_option('api_endpoint',null) ?></span><button id="edit-server-link" href="#">Change</button>121 < div><input type="text" name="wl_api_endpoint" id="wl_api_endpoint" value="<?php echo wl_get_option('api_endpoint',null) ?>" /></div>137 <div id="server-section" class="action"> 138 <span id="api-endpoint-assigned" class="assigned-field" style="margin-right:10px;"><?php echo wl_get_option('api_endpoint',null) ?></span><button id="edit-server-link" href="#">Change</button> 139 <input type="text" name="wl_api_endpoint" id="wl_api_endpoint" value="<?php echo wl_get_option('api_endpoint',null) ?>" /></div> 122 140 </div> 123 141 </td> -
welocally-places/trunk/options/options-general.php
r476641 r514360 1 1 <?php 2 2 global $wlPlaces; 3 3 ?> 4 4 <div class="wrap"> 5 5 <div class="icon32"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div> 6 6 <h2>Welocally Places Options</h2> 7 7 <?php 8 $menubar_include = WP_PLUGIN_DIR . '/' .$wlPlaces->pluginDir . '/options/options-infobar.php'; 9 include($menubar_include); 10 ?> 8 11 <?php 9 12 // If options have been updated on screen, update the database … … 11 14 12 15 if(!is_subscribed()) { 13 echo '<div class="error fade"><p><strong>' . __( 'Please SubscribeTo Activate Welocally Places' ) . "</strong></p></div>\n";16 echo '<div class="error fade"><p><strong>' . __( 'Please Register To Activate Welocally Places' ) . "</strong></p></div>\n"; 14 17 } 15 18 … … 26 29 $options[ 'infobox_thumb_height' ] = $_POST[ 'welocally_infobox_thumb_height' ]; 27 30 28 $options[ 'map_default_marker' ] = $_POST[ 'welocally_map_default_marker' ];29 $options[ 'map_infobox_marker' ] = $_POST[ 'welocally_map_infobox_marker' ];30 $options[ 'map_infobox_close' ] = $_POST[ 'welocally_map_infobox_close' ];31 $options[ 'map_icon_web' ] = $_POST[ 'welocally_map_icon_web' ];32 $options[ 'map_icon_directions' ] = $_POST[ 'welocally_map_icon_directions' ];31 $options[ 'map_default_marker' ] = trim($_POST[ 'welocally_map_default_marker' ])? trim($_POST[ 'welocally_map_default_marker' ]):plugins_url() . "/welocally-places/resources/images/marker_generic_32.png"; 32 $options[ 'map_infobox_marker' ] = trim($_POST[ 'welocally_map_infobox_marker' ])? trim($_POST[ 'welocally_map_infobox_marker' ]):plugins_url() . "/welocally-places/resources/images/tipbox_180.png"; 33 $options[ 'map_infobox_close' ] = trim($_POST[ 'welocally_map_infobox_close' ])? trim($_POST[ 'welocally_map_infobox_close' ]):plugins_url() . "/welocally-places/resources/images/infobox_close_16.png"; 34 $options[ 'map_icon_web' ] = trim($_POST[ 'welocally_map_icon_web' ])?trim($_POST[ 'welocally_map_icon_web' ]):plugins_url() . "/welocally-places/resources/images/mapicons_web.png"; 35 $options[ 'map_icon_directions' ] = trim($_POST[ 'welocally_map_icon_directions' ])? trim($_POST[ 'welocally_map_icon_directions' ]):plugins_url() . "/welocally-places/resources/images/mapicons_car.png"; 33 36 $options[ 'map_custom_style' ] = base64_encode(str_replace( '\"', '"', $_POST[ 'welocally_map_custom_style' ] ) ); 34 37 … … 65 68 66 69 <?php if(is_subscribed()):?> 67 <link type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" rel="stylesheet" />68 70 <style> 69 71 #selectable { list-style-type: none; margin: 0; padding: 0; width: 100%; } … … 86 88 87 89 </style> 88 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>89 90 <script type="text/javascript" charset="utf-8"> 90 91 var wl_options_imgfield = ''; … … 159 160 }); 160 161 </script> 162 163 161 164 <p><?php _e( 'These are the general settings for Welocally Places.' ); ?></p> 162 165 -
welocally-places/trunk/options/subscribe.php
r473697 r514360 1 1 <?php 2 3 2 global $wlPlaces; 3 if ( ( !empty( $_POST ) ) && 4 ( check_admin_referer( 'welocally-places-subscribe', 'welocally_places_subscribe_nonce' ) ) ) { 5 if($_POST[ 'siteName' ]=='delete'){ 6 error_log('delete tokens:'.$_POST[ 'siteName' ]); 7 delete_subscription_options(); 8 } 9 } 4 10 ?> 5 11 <script type="text/javascript"> … … 12 18 13 19 jQuery(document).ready(function() { 14 15 wl_get_subscriber_info(); 16 17 jQuery("#offerCode").change( function () { 18 jQuery("#hosted_button_id").val(jQuery("#offerCode").val()); 19 }); 20 21 20 21 if(jQuery("#registration_result").html() != null){ 22 var keydata = JSON.parse(jQuery("#registration_result").html()); 23 24 set_form_fields( 25 keydata.siteKey, 26 null, 27 keydata.subscriptionStatus); 28 29 } else { 30 wl_get_subscriber_info(); 31 } 32 33 34 jQuery("#edit-form-action").click( function () { 35 jQuery("#siteName").toggle(); 36 jQuery("#name-assigned").toggle(); 37 38 jQuery("#siteHome").toggle(); 39 jQuery("#home-assigned").toggle(); 40 41 jQuery("#siteEmail").toggle(); 42 jQuery("#email-assigned").toggle(); 43 44 jQuery("#siteKey").toggle(); 45 jQuery("#key-assigned").toggle(); 46 47 jQuery("#siteToken").toggle(); 48 jQuery("#token-assigned").toggle(); 49 50 if(jQuery("#siteKey").is(":visible")){ 51 jQuery("#token-section").show(); 52 } 53 54 return false; 55 }); 56 57 jQuery("#siteName").change( function () { 58 jQuery("#name-assigned").html(jQuery("#siteName").val()); 59 }); 60 61 jQuery("#siteHome").change( function () { 62 jQuery("#home-assigned").html(jQuery("#siteName").val()); 63 }); 64 65 jQuery("#siteEmail").change( function () { 66 jQuery("#email-assigned").html(jQuery("#siteEmail").val()); 67 }); 68 69 jQuery("#siteKey").change( function () { 70 jQuery("#key-assigned").html(jQuery("#siteKey").val()); 71 }); 72 73 jQuery("#siteToken").change( function () { 74 jQuery("#token-assigned").html(jQuery("#siteToken").val()); 75 }); 76 22 77 }); 23 78 … … 41 96 }; 42 97 98 data.siteKey = '<?php echo wl_get_option('siteKey',null) ?>' ; 43 99 data.siteHome = jQuery("#siteHome").val(); 44 100 data.siteName = jQuery("#siteName").val(); … … 55 111 jQuery('#wl-options-error').append('<div class="error fade">ERROR 100: '+ 56 112 textStatus+'</div>'); 57 Query("#publisher-status").html('ERROR 100: '+textStatus);113 jQuery("#publisher-status").html('ERROR 100: '+textStatus); 58 114 }, 59 115 success: function(keydata) { 60 116 61 117 if(keydata.key != null){ 62 set_form_fields( keydata.key, keydata.token, null, keydata.subscriptionStatus, keydata.buttonToken, keydata.paypalFormEndpoint);118 set_form_fields( keydata.key, keydata.token, keydata.subscriptionStatus); 63 119 } else { 64 120 jQuery('#wl-options-error').append('<div class="error">ERROR 105: Key could not be created for publisher : '+data.siteName+'</div>'); … … 75 131 76 132 77 function set_form_fields( key, token, serviceEndDateMillis, status, buttonToken, paypalEndpoint) { 78 79 jQuery('#paypal-form').attr( 'action', paypalEndpoint); 80 if(paypalEndpoint == 'https://www.paypal.com/cgi-bin/webscr'){ 81 jQuery('#paypal-subscribe-img').attr( 'src', 'https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif'); 82 jQuery('#paypal-pixel-img').attr( 'src', 'https://www.paypalobjects.com/en_US/i/scr/pixel.gif'); 83 84 } 133 function set_form_fields( key, token, status) { 85 134 86 135 if(key != null) { 87 136 jQuery("#paypal-custom").val(key); 88 137 jQuery("#key-assigned").html(key); 89 //set the form vals 90 jQuery("#siteKey").val(key); 91 138 jQuery("#siteKey").val(key); 92 139 } 93 140 94 141 if(token != null){ 95 142 jQuery("#token-assigned").html(token); 96 //welocally-places-display_token97 143 jQuery("#welocally-places-display_token").val(token); 98 144 jQuery("#siteToken").val(token); 99 //jQuery("#token-section").show(); 100 //jQuery("#save_options_button").show(); 101 } 102 103 var subscribe_process1 = '<div><img src="<?php echo WP_PLUGIN_URL; ?>'+ 104 '/welocally-places/resources/images/subscribe_02.png" alt="" title=""/></div>'; 105 145 } 146 106 147 if(status != null) { 107 148 jQuery("#publisher-status").html(status); 108 149 if(status == 'KEY_ASSIGNED') { 150 151 wl_set_cancelled_state_ajax(); 152 153 jQuery("#token-box").hide(); 154 155 jQuery("#siteToken").val(''); 156 jQuery("#token-assigned").val(''); 157 109 158 jQuery("#key-section").show(); 110 159 111 //the button token 112 if(buttonToken != null) { 113 jQuery("#hosted_button_id").val(buttonToken); 114 } else { 115 jQuery("#hosted_button_id").val('WKLRWF9WC9UZY'); 116 } 117 118 jQuery("#token-section").hide(); 160 119 161 jQuery("#save_options_button").hide(); 120 162 … … 127 169 jQuery("#key-assigned-action").show(); 128 170 129 130 131 132 } else if(status == 'SUBSCRIBER') { 171 var statusimg = '<img width="75" hieght="75" style="float: left; margin-right:5px" class="align-right" src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/free1.png" alt="" title=""/>'+ 172 '<span class="options-text">We have assigned a key to you, but to use or basic service you must register. Go ahead, its easy. Just press the <strong>Register Now</strong> button and we will send you your secret token.</span>'; 173 jQuery("#action-area").html(statusimg); 174 175 jQuery("#primary-action-button").val('Register Now'); 176 177 178 179 180 181 } else if(status == 'REGISTERED') { 182 183 jQuery("#token-box").show(); 184 133 185 jQuery("#key-section").show(); 186 jQuery("#token-section").show(); 187 188 jQuery("#finished-action").hide(); 189 jQuery("#subscribed-action").hide(); 190 jQuery("#key-assigned-action").show(); 191 192 193 var statusimg = '<img width="75" hieght="75" style="float: left; margin-right:5px" class="align-right" src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/token1.png" alt="" title=""/>'+ 194 '<span class="options-text">Great you are almost there! Now look the your inbox for the email address you gave us, and there should be an email with your free token. Enter it in into the Publisher Token field and press the <em>Save Settings</em> button.</span>'; 195 jQuery("#action-area").html(statusimg); 196 197 jQuery("#primary-action-button").val('Save Token'); 198 199 200 } else if(status == 'SUBSCRIBED') { 201 202 jQuery("#token-box").show(); 203 204 jQuery("#key-section").show(); 205 jQuery("#token-section").show(); 206 134 207 jQuery("#paypal-subscribe").hide(); 135 208 jQuery("#action-getkey").show(); 136 209 137 jQuery("#token-section").show();210 138 211 jQuery("#save_options_button").show(); 139 140 141 142 212 143 213 if(!subscribed_saved) { … … 151 221 } 152 222 223 var statusimg = '<img width="75" hieght="75" style="float: left; margin-right:5px" class="align-right" src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/subscribed1.png" alt="" title=""/>'+ 224 '<span class="options-text">You did it! You signed up for our product and now you can use it. You have been given access to our user portal with help, support and a whole bunch of other free welocally resouces. Be sure to <a href="<?php echo wl_server_base().'/admin/home'?>" target="_blank">log into your portal</a> as soon as possible.</span>'; 225 jQuery("#action-area").html(statusimg); 226 227 jQuery("#primary-action-button").val('Save Settings'); 153 228 154 229 155 230 } else if(status == 'CANCELLED') { 231 232 jQuery("#token-box").hide(); 156 233 157 234 //ajax post to admin server … … 159 236 160 237 jQuery("#key-section").show(); 238 jQuery("#token-section").show(); 161 239 162 240 //the button token … … 170 248 jQuery("#paypal-subscribe").show(); 171 249 jQuery("#save_options_button").hide(); 172 jQuery("#token-section").hide(); 173 174 250 175 251 jQuery("#finished-action").hide(); 176 252 jQuery("#subscribed-action").hide(); 177 253 jQuery("#key-assigned-action").show(); 254 255 jQuery("#primary-action-button").val('Save Settings'); 178 256 } 179 257 } … … 214 292 font-weight: bold; 215 293 text-transform: uppercase; 216 width: 380px; 217 218 } 294 width: 95%; 295 296 } 297 298 .basic-frame { 299 display: inline-block; 300 background:#ffffff; 301 margin-top:10px; 302 margin-bottom:10px; 303 border: 2px solid #bbb; 304 -moz-border-radius: 5px; 305 -khtml-border-radius: 5px; 306 -webkit-border-radius: 5px; 307 border-radius: 5px; 308 -moz-box-sizing: content-box; 309 -webkit-box-sizing: content-box; 310 -khtml-box-sizing: content-box; 311 color: #6b6b6b; 312 width: 95%; 313 padding: 5px; 314 315 } 316 317 219 318 220 319 .option-form-label { width: 100px; display: inline-block;} 320 221 321 .options-title2 { 222 322 border-bottom:1px solid #cccccc; padding-bottom:3px; … … 251 351 } 252 352 353 #token-section { 354 display: none; 355 } 356 253 357 #offer-section { 254 358 display: none; … … 267 371 } 268 372 269 #token-section { 270 display: none; 271 } 373 272 374 273 375 #wl_api_endpoint { 274 376 display: none; 275 width: 400px;377 width: 95%; 276 378 } 277 379 … … 280 382 } 281 383 282 #siteToken { 283 width: 400px; 384 385 #form-signup { 386 width: 95%; 284 387 } 285 388 … … 290 393 color: #595959; 291 394 font-family: monospace; 292 width: 400px; 395 width: 95%; 396 height:20px; 293 397 margin-bottom: 10px; 294 398 } 295 296 .option-form-field { width: 300px; } 399 400 label { font-size:1.2em; color: #595959; font-weight:bold; width:400px; margin-top:10px; } 401 402 .option-form-field { 403 width: 95%; 404 height:20px; 405 margin-bottom: 10px; 406 } 297 407 298 408 #plugin-options th { width: 80px; } … … 302 412 303 413 <div class="wrap"> 414 304 415 <div class="icon32"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div> 305 <h2>Welocally Places Subscribe</h2> 306 <?php 416 <h2>Welocally Places Registration</h2> 417 <?php 418 $menubar_include = WP_PLUGIN_DIR . '/' .$wlPlaces->pluginDir . '/options/options-infobar.php'; 419 include($menubar_include); 420 307 421 // If options have been updated on screen, update the database 308 422 … … 311 425 $options = wl_get_options(); 312 426 427 $options[ 'siteName' ] = $_POST[ 'siteName' ]; 428 $options[ 'siteHome' ] = $_POST[ 'siteHome' ]; 429 $options[ 'siteEmail' ] = $_POST[ 'siteEmail' ]; 313 430 $options[ 'siteToken' ] = $_POST[ 'siteToken' ]; 314 431 $options[ 'siteKey' ] = $_POST[ 'siteKey' ]; … … 317 434 318 435 echo '<div class="updated fade"><p><strong>' . __( 'Settings Saved.' ) . "</strong></p></div>\n"; 436 437 $json_register_request = json_encode($_POST); 438 if($_POST[ 'siteName' ]!='delete'){ 439 error_log('register:'.$_POST[ 'siteName' ]); 440 $result = welocally_register($json_register_request); 441 echo '<div style="display:none" id="registration_result">'.$result.'</div>'; 442 $resultJson = json_encode($result); 443 } 444 445 446 319 447 } 320 448 321 449 // Get options 322 450 $options = wl_set_general_defaults(); 323 324 //display error if not subscribed325 if(!is_subscribed()) {326 echo '<div class="error fade"><p><strong>' . __( 'Please Subscribe To Activate Welocally Places' ) . "</strong></p></div>\n";327 }328 329 330 451 ?> 331 332 452 <div class="snp_settings wrap"> 333 453 … … 341 461 <div id="content_col_1"> 342 462 <!-- call to action --> 343 <div class="options-signup-text" id="signup-text"></div> 344 <div id="action-container"> 345 <div id="key-assigned-action" style="display:none;"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/subscribe_action_1.png" alt="" title=""/></div> 346 <div id="subscribed-action" style="display:none;"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/subscribe_action_2.png" alt="" title=""/></div> 347 <div id="finished-action" style="display:none;"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/subscribe_action_3.png" alt="" title=""/></div> 348 </div> 463 <div class="basic-frame" id="action-area" > </div> 464 349 465 <!-- status --> 350 466 <div class="publisher-status"> … … 354 470 <!-- the form --> 355 471 <div id="form-signup"> 472 <div class="action" style="width:100%; text-align:right;"><a id="edit-form-action" href="#">Edit</a></div> 356 473 <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=welocally-places-subscribe' ?>"> 357 474 <fieldset> 358 475 <div> 359 <label for="siteName" class="option-form-label">Site Name:</label> 360 <div id="home-assigned" class="assigned-field"><?php echo wl_get_option('siteName',get_bloginfo('name')); ?></div> 361 <input type="hidden" name="siteName" id="siteName" value="<?php echo wl_get_option('siteName',get_bloginfo('name')); ?>" /> 476 <label for="siteName">Site Name: </label> 477 <div><em>You can name your site anything you want but it has to be unique to our system.</em></div> 478 <div id="name-assigned" class="assigned-field"><?php echo wl_get_option('siteName',get_bloginfo('name')); ?></div> 479 <input class="option-form-field" type="text" style="display:none" name="siteName" id="siteName" value="<?php echo wl_get_option('siteName',get_bloginfo('name')); ?>" /> 362 480 </div> 363 481 <div> 364 <label for="siteHome" class="option-form-label">Site Home:</label> 482 <label for="siteHome" >Site Home:</label> 483 <div><em>This has to be the real base URL for your site, we check this when you make a request. If this site is not on the internet we can't give you a token.</em></div> 365 484 <div id="home-assigned" class="assigned-field"><?php echo wl_get_option('siteHome', get_bloginfo('home')); ?></div> 366 <input type="hidden" name="siteHome" id="siteHome" value="<?php echo wl_get_option('siteHome',get_bloginfo('home')); ?>" />485 <input class="option-form-field" type="text" style="display:none" name="siteHome" id="siteHome" value="<?php echo wl_get_option('siteHome',get_bloginfo('home')); ?>" /> 367 486 </div> 368 487 <div> 369 <label for="siteEmail" class="option-form-label" >E-mail:</label> 488 <label for="siteEmail" >E-mail:</label> 489 <div><em>This needs to be real, we send your token by email.</em></div> 370 490 <div id="email-assigned" class="assigned-field"><?php echo wl_get_option('siteEmail',get_bloginfo('admin_email')); ?></div> 371 <input type="hidden" name="siteEmail" id="siteEmail" value="<?php echo wl_get_option('siteEmail',get_bloginfo('admin_email')); ?>" />491 <input class="option-form-field" type="text" style="display:none" name="siteEmail" id="siteEmail" value="<?php echo wl_get_option('siteEmail',get_bloginfo('admin_email')); ?>" /> 372 492 </div> 373 493 <div id="key-section"> 374 <label for="siteKey" class="option-form-label" >Publisher Key:</label> 494 <label for="siteKey" >Publisher Key:</label> 495 <div><em>We assign this to you, so if you change this you should probably have a good reason like we told you to. Better to leave it alone.</em></div> 375 496 <div id="key-assigned" class="assigned-field"></div> 376 <input type="hidden" name="siteKey" id="siteKey" value="<?php echo wl_get_option('publisherKey',null) ?>" />497 <input class="option-form-field" type="text" style="display:none" name="siteKey" id="siteKey" value="<?php echo wl_get_option('siteKey',null) ?>" /> 377 498 </div> 378 379 <div id="offer-section"> 380 <label for="siteToken" class="option-form-label" >Offer Code:</label> 381 <input type="text" name="offerCode" id="offerCode" /> 382 </div> 383 <div id="token-section"> 384 <label for="siteToken" class="option-form-label" >Publisher Token:</label> 385 <div><input type="text" name="siteToken" id="siteToken" value="<?php echo wl_get_option('publisherToken',null) ?>" /></div> 499 <div id="token-box"> 500 <div id="token-section"> 501 <label for="siteToken" >Publisher Token:</label> 502 <div><em>Please place the token you recieved by email here.</em></div> 503 <div id="token-assigned" class="assigned-field"><?php echo wl_get_option('siteToken','') ?></div> 504 <div><input class="option-form-field" type="text" style="display:none" name="siteToken" id="siteToken" value="<?php echo wl_get_option('siteToken','') ?>" /></div> 505 </div> 386 506 </div> 387 507 </fieldset> 388 508 <?php wp_nonce_field( 'welocally-places-subscribe','welocally_places_subscribe_nonce', true, true ); ?> 389 <div id="save_options_button">390 <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/></p>391 </div>509 510 <p class="submit"><input type="submit" id="primary-action-button" class="button-primary" value="Register Now"/></p> 511 392 512 </form> 393 513 </div> 394 <!-- PAYPAL subscribe form WKLRWF9WC9UZY --> 395 <div id="paypal-subscribe" style="display:none;"> 396 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal-form"> 397 <input type="hidden" name="cmd" value="_s-xclick"> 398 <input type="hidden" name="hosted_button_id" id="hosted_button_id" value="WKLRWF9WC9UZY"> 399 <input type="hidden" name="custom" id="paypal-custom"> 400 <input id="paypal-subscribe-img" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> 401 <img id="paypal-pixel-img" alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> 402 </form> 403 </div> 514 404 515 </div> 405 516 </td> -
welocally-places/trunk/readme.txt
r473697 r514360 17 17 * 2 sidebar widgets, Map Widget and Place List Widget 18 18 * Fully customizable maps 19 * Google fonts integration, no CSS required 19 * Google fonts integration, no CSS required for custom fonts 20 20 * Tested with most of the common themes 21 21 * Rich place information such as phone number, and website -
welocally-places/trunk/resources/mcebutton.js
r473697 r514360 1 1 (function() { 2 3 2 4 3 tinymce.create('tinymce.plugins.welocally', { 5 4 init : function(ed, url) { … … 7 6 title : 'Welocally', 8 7 onclick : function() { 9 ed.selection.setContent('[welocally/]'); 8 if(selectedPlace != null && WELOCALLY.meta.post != null ){ 9 ed.selection.setContent(WELOCALLY.places.tag.makePlaceTag(selectedPlace, WELOCALLY.meta.post)); 10 } 10 11 } 11 12 }); -
welocally-places/trunk/resources/places.css
r466267 r514360 5 5 .text-align-right { text-align:right; } 6 6 7 8 .align-right { float:right; margin: 0 0 10px 10px; } 9 .align-left { float:left; margin: 0 0 10px 10px; } 10 11 12 /*-- jquery --*/ 13 .ui-button-text { 14 color: #505050; 15 } 7 16 8 17 /*--- we locally specific --*/ … … 323 332 324 333 325 #map_canvas_post {display:none; height:250px}326 327 #wl-place-content { list-style-type: none; margin: 0; padding: 0; width: 100%; }328 #wl-place-content ul {margin: 0; padding: 0;}329 #wl-place-content li {334 .map_canvas_post {display:none; height:250px} 335 336 .wl-place-content { list-style-type: none; margin: 0; padding: 3px; width: 100%; } 337 .wl-place-content ul {margin: 0; padding: 0;} 338 .wl-place-content li { 330 339 font-size: 1.0em; 331 340 display:inline-block; … … 339 348 } 340 349 341 #wl-place-content table350 .wl-place-content table 342 351 { 343 352 border-collapse: collapse; … … 345 354 } 346 355 347 #wl-place-content td.wl-place-link-item356 .wl-place-content td.wl-place-link-item 348 357 { 349 358 vertical-align:middle; … … 364 373 .wl_options_heading { margin-top:10px; color: #333333; font-variant: small-caps; font:1.2em Verdana, Arial, Helvetica, sans-serif; text-transform:uppercase} 365 374 366 .form-table { width:98%; margin-bottom:10px; border: 1px solid #888888; background: #eeeeee; padding: 5px; } 375 .form-table { 376 border-collapse: separate; 377 width:98%; margin-bottom:10px; border: 1px solid #888888; background: #f2f2f2; padding: 5px; } 367 378 368 379 #welocally_cat_map_none{ display:inline-block; width: 53px; height:44px; border: 0px solid #888888; background:url('images/layout_selector_none_up.png') no-repeat 0 bottom;} … … 382 393 383 394 .welocally-error { 384 font-size:1.2em; 385 color: #A30F0F; 386 font-variant: small-caps; font:1.2em Verdana, Arial, Helvetica, sans-serif; 395 border: #D12424 1px solid; 396 color: #D12424; 397 font: 1.2em Verdana, Arial, Helvetica, sans-serif; 398 background-color: #EBC7C7; 399 -moz-border-radius:3px; 400 -webkit-border-radius:3px; 401 margin-bottom: 5px; 387 402 } 388 403 389 404 .welocally-update { 390 font-size:1.2em; 391 color: #A38D0F; 392 font-variant: small-caps; font:1.2em Verdana, Arial, Helvetica, sans-serif; 393 } 405 border: #96841A 1px solid; 406 color: #96841A; 407 font: 1.2em Verdana, Arial, Helvetica, sans-serif; 408 background-color: #F5EAAB; 409 -moz-border-radius:3px; 410 -webkit-border-radius:3px; 411 margin-bottom: 5px; 412 } 413 414 .welocally-message { 415 border: #2484BF 1px solid; 416 color: #2484BF; 417 font: 1.2em Verdana, Arial, Helvetica, sans-serif; 418 background-color: #D3E3ED; 419 -moz-border-radius:3px; 420 -webkit-border-radius:3px; 421 margin-bottom: 5px; 422 } 423 394 424 395 425 .welocally-context-help { … … 446 476 } 447 477 448 449 478 #helpbar { 479 width:97%; 480 margin-bottom:10px; 481 margin-top:10px; 482 border: 1px solid #888888; 483 background: #eeeeee; padding: 5px; 484 border-radius:3px; 485 padding: 4px; 486 width:auto; 487 -moz-border-radius:3px; 488 -webkit-border-radius:3px; 489 } 490 491 .options-text { 492 color: #888888; 493 font-style: italic; 494 font-size:1.4em; 495 font: Arial, Helvetica, sans-serif; 496 } 497 498 .button-bar { 499 font-size: 65%; 500 } 501 502 503 /* place tag*/ 504 505 .share-place-tag { 506 margin:0px; 507 width:100%; 508 display:none; 509 } 510 511 .share-place-tag-tagtext { 512 width: 98%; 513 font-family: monospace; 514 margin:2px; 515 } 516 517 .post-place-tag-tagtext { 518 font-family: monospace; 519 margin:2px; 520 } 521 522 .share-place-tag-info { 523 display: inline-block; 524 font-size:0.7em; 525 color: #888888; 526 font-style: italic; 527 font: Arial, Helvetica, sans-serif; 528 width:72%; 529 margin-left: 3px; 530 } 531 532 .tag-powered-by { 533 display:inline-block; 534 text-align:right; 535 font-size:0.7em; 536 width:26%; 537 } 538 539 /*style of the links below a place*/ 540 ul.wl-place-links{ 541 list-style-type:none; 542 margin: 0px; 543 padding: 0px; 544 -webkit-padding-start: 0px; 545 padding-left: 0px; 546 } 547 ul.wl-place-links li{ display:inline-block; margin: 0px 0px 0px 0px; padding: 0px; padding-left: 0px; } 548 549 .share-place-tag { background-color: #f9f9f9; border: 1px solid #e1e1e1; padding: 3px;} 550 551 /*ul.wl-place-links li a{ border-left:8px solid white; text-decoration:none; padding:0; }*/ 552 553 554 555 556 557 .wl-place-widget-links { text-align:right; } 558 559 div.gmap img {max-width:100000px; max-width: none} 560 -
welocally-places/trunk/resources/places.js
r473697 r514360 13 13 * limitations under the License. 14 14 */ 15 16 function preload(arrayOfImages) { 17 jQuery(arrayOfImages).each(function(){ 18 jQuery('<img/>')[0].src = this; 19 // Alternatively you could use: 20 // (new Image()).src = this; 21 }); 22 } 23 24 15 25 function replaceAll(txt, replace, with_this) { 16 26 return txt.replace(new RegExp(replace, 'g'),with_this); … … 19 29 function buildContentForInfoForList(place, index, permalink, webicon, directionsicon) { 20 30 var content= '<div class="wl-place-name wl-place-widget-name" id="plugin-place-name'+index+'"><a href="'+ 21 permalink+'" >'+place. name+'</a></div>'+22 '<div class="wl-place-address wl-place-widget-address">'+place. address+", "+23 place. city+" "+24 place. state+" "+25 place.p ostalCode+'</div>';31 permalink+'" >'+place.properties.name+'</a></div>'+ 32 '<div class="wl-place-address wl-place-widget-address">'+place.properties.address+", "+ 33 place.properties.city+" "+ 34 place.properties.province+" "+ 35 place.properties.postcode+'</div>'; 26 36 27 37 //only add phone if exists 28 if(place.p hone != null) {29 content = content+'<div class="wl-place-widget-phone">'+place.p hone+'</div>';38 if(place.properties.phone != null) { 39 content = content+'<div class="wl-place-widget-phone">'+place.properties.phone+'</div>'; 30 40 } 31 41 32 42 //only add website if it exists 33 43 content = content+'<div class="wl-place-widget-links" id="plugin-place-links'+index+'">'; 34 if(place. website != null && place.website != '') {35 var website = place. website;36 if(place. website.indexOf('http://') == -1) {37 website = 'http://'+place. website;44 if(place.properties.website != null && place.properties.website != '') { 45 var website = place.properties.website; 46 if(place.properties.website.indexOf('http://') == -1) { 47 website = 'http://'+place.properties.website; 38 48 } 39 49 content = content+'<a href="'+ 40 50 website+'" target="_new"><img src="'+webicon+'" border="0" class="wl-link-image"/></a>'; 41 51 42 } else if(place.url != null && place.url != '') { 43 var website = place.url; 44 if(place.url.indexOf('http://') == -1) { 45 website = 'http://'+place.url; 46 } 47 content = content+'<a href="'+ 48 website+'" target="_new"><img src="'+webicon+'" border="0" class="wl-link-image"/></a>'; 49 } 50 51 52 if(place.city != null && place.state != null){ 53 var qS = place.city+" "+place.state; 54 if(place.address != null) 55 qs=place.address+" "+qS; 56 if(place.postalCode != null) 57 qs=qs+" "+place.postalCode; 52 } 53 54 55 if(place.properties.city != null && place.properties.province != null){ 56 var qS = place.properties.city+" "+place.properties.province; 57 if(place.properties.address != null) 58 qs=place.properties.address+" "+qS; 59 if(place.properties.postalcode != null) 60 qs=qs+" "+place.properties.postalcode; 58 61 var qVal = qs.replace(" ","+"); 59 62 content = content+'<a href="http://maps.google.com/maps?f=d&source=s_q&hl=en&geocode=&q='+qVal+ … … 78 81 directionsicon, 79 82 linkedTitle, 80 linkUrl,81 83 showThumb, 82 84 thumbUrl) { 83 85 84 var myLatLng = new google.maps.LatLng(place. latitude, place.longitude);86 var myLatLng = new google.maps.LatLng(place.geometry.coordinates[1], place.geometry.coordinates[0]); 85 87 var mMarker = new google.maps.Marker({ 86 88 container: container, … … 97 99 directionsicon: directionsicon, 98 100 linkedTitle: linkedTitle, 99 linkUrl: linkUrl,100 101 showThumb: showThumb, 101 102 thumbUrl: thumbUrl … … 103 104 104 105 google.maps.event.addListener(mMarker, 'click', function(event) { 105 106 106 var placeSelected = mMarker.place; 107 107 var container = mMarker.container; … … 109 109 var newLocation = 110 110 new google.maps.LatLng( 111 placeSelected. latitude, placeSelected.longitude);111 placeSelected.geometry.coordinates[1], placeSelected.geometry.coordinates[0]); 112 112 113 113 map.panTo(mMarker.position); 114 114 115 boxText.innerHTML = buildContentForInfoWindow( 116 mMarker.place, ', ', mMarker.webicon, mMarker.directionsicon, 117 mMarker.linkedTitle, mMarker.linkUrl, 118 mMarker.showThumb, mMarker.thumbUrl); 119 115 //lets do this the jquery way 116 var contentsBox = jQuery(document.createElement('div')); 117 118 var contents = buildContentForInfoWindow( 119 WELOCALLY.places.map.infobox.baseWidth, 120 mMarker.place, ', ', mMarker.webicon, mMarker.directionsicon, 121 mMarker.linkedTitle, mMarker.link, 122 mMarker.showThumb, mMarker.thumbUrl, 123 WELOCALLY.places.map.infobox.thumbMaxSize); 124 125 126 jQuery(contentsBox).html(contents); 127 128 boxText.innerHTML = contents; 129 130 jQuery(boxText).find('li a img').load(function(){ 131 console.log('image loaded'); 132 jQuery(boxText).find('li a').css('background','none').css('padding','0px'); 133 jQuery(boxText).css('line-height','15px'); 134 jQuery(boxText).find('ul').css('margin','0px'); 135 }); 136 120 137 //if this is the widget show the excerpt 121 138 if(container == 'places-map'){ 122 ib_widget.open(mMarker.map, this); 139 140 WELOCALLY.places.map.infobox.setOffset(contentsBox,ib_widget); 141 ib_widget.open(mMarker.map, this); 142 ib_widget.show(); 143 ib.hide(); 123 144 jQuery('#details-place-name').html('<a href="'+ 124 mMarker.link+'" >'+placeSelected. name+'</a>');145 mMarker.link+'" >'+placeSelected.properties.name+'</a>'); 125 146 jQuery('#details-place-excerpt').html(mMarker.excerpt); 126 147 jQuery('#place-details').show(); 127 148 jQuery('#sp-click-action-call').hide(); 128 } else { 149 150 } else if(container == 'category-map') { 151 152 WELOCALLY.places.map.infobox.setOffset(contentsBox,ib); 129 153 ib.open(mMarker.map, this); 154 ib.show(); 155 ib_widget.hide(); 130 156 } 131 157 jQuery('#info-contents-box ul li a').css('background','none').css('padding','0px'); 132 158 133 159 … … 161 187 162 188 var content= '<div class="wl-infobox-text_scale wl-place-name title-selectable-place wl-infobox-text_scale">'+'<a href="'+ 163 link+'" >'+place. name+'</a>'+'</div>';189 link+'" >'+place.properties.name+'</a>'+'</div>'; 164 190 165 191 if(showExcerpt){ … … 170 196 } 171 197 172 function buildContentForInfoWindow(place, catsDiv, wicon, dicon, 173 linkedTitle, linkUrl, 174 showThumb, thumbUrl) { 198 function buildContentForInfoWindow( 199 baseWidth, 200 place, 201 catsDiv, 202 wicon, 203 dicon, 204 linkedTitle, 205 linkUrl, 206 showThumb, 207 thumbUrl, 208 thumbMax) { 175 209 176 var placeNameTemplate1= '<div class="wl-place-name wl-place-widget-name"><a href="{PLACE_POST_LINK}">{PLACE_NAME}</a></div>'; 177 178 var placeNameTemplate2= '<div class="wl-place-name wl-place-widget-name">{PLACE_NAME}</div>'; 179 180 var webTemplate='<li style="display:inline-block; margin-right:0px"><a href="{WEB_LINK}" target="_blank"><img src="{WEB_ICON}" border="0" class="wl-link-image" border="0"></a><div style="position:relative; display: inline-block; font-size:85%; top: -10px"><a href="{WEB_LINK}" target="_blank">web</a></div></li> '; 181 182 var directionsTemplate='<li style="display:inline-block; margin-right:0px"><a href="{DRIVE_LINK}" target="_blank"><img src="{DRIVE_ICON}" class="wl-link-image"></a><div style="position:relative; display: inline-block; font-size:85%; top: -10px"><a href="{DRIVE_LINK}" target="_blank">directions</a></div></li>'; 183 184 var thumbTemplate1='<a href="{PLACE_POST_LINK}"><img src="{THUMB_IMAGE_URL}" border="0" style="float:left; margin-right:5px; max-width:150px; max-height:150px"></a>'; 185 186 var thumbTemplate2='<img src="{THUMB_IMAGE_URL}" border="0" style="float:left; margin-right:5px; max-width:150px; max-height:150px">'; 187 188 var content='<div id="infobox_content">{THUMB_CONTENT}<div style="margin-left:5px">{PLACE_NAME_CONTENT}<div class="wl-place-address wl-place-widget-address">{PLACE_ADDRESS}</div><div class="wl-place-widget-phone">{PLACE_PHONE}</div><div class="wl-place-widget-links"> <ul style="text-align:left; list-style-type: none; padding: 0px; margin: 0px;">{WEB_CONTENT}{DIRECTIONS_CONTENT}</ul></div></div></div><div style="clear:left; height:1px"> </div>'; 189 190 //thumb 191 if(showThumb){ 192 193 if(linkedTitle){ 194 var thumbContent = thumbTemplate1 195 .replace('{PLACE_POST_LINK}', linkUrl) 196 .replace('{THUMB_IMAGE_URL}',thumbUrl) 197 .replace('{THUMB_IMAGE_URL}',thumbUrl); 198 content = content.replace('{THUMB_CONTENT}',thumbContent); 199 200 } else { 201 var thumbContent = thumbTemplate2 210 //lets do this the jquery way 211 //var baseWidth = 100; 212 213 var contentsBox = jQuery(document.createElement('div')) 214 .attr('id','info-contents-box'); 215 216 if(showThumb){ 217 var size = eval(thumbMax.replace('px',''))+baseWidth; 218 jQuery(contentsBox) 219 .css('width',size+'px') 220 .css('height',size+'px') 221 .append('<img class="infobox-img" src="{THUMB_IMAGE_URL}" border="0" style="float:left; margin-right:5px; max-width:{THUMB_MAX}; max-height:{THUMB_MAX}">' 202 222 .replace('{THUMB_IMAGE_URL}',thumbUrl) 203 .replace('{THUMB_IMAGE_URL}',thumbUrl); 204 content = content.replace('{THUMB_CONTENT}',thumbContent); 205 } 206 207 208 209 } else { 210 content = content.replace('{THUMB_CONTENT}',''); 211 } 212 213 content = content.replace('{THUMB_CONTENT}',''); 214 215 //placename 216 if(linkedTitle){ 217 var placeNameContent = placeNameTemplate1 218 .replace('{PLACE_POST_LINK}', linkUrl) 219 .replace('{PLACE_NAME}', place.name); 220 221 content = content.replace('{PLACE_NAME_CONTENT}',placeNameContent); 222 223 } else { 224 var placeNameContent = placeNameTemplate2 225 .replace('{PLACE_NAME}', place.name); 226 227 content = content.replace('{PLACE_NAME_CONTENT}',placeNameContent); 228 } 229 230 231 232 //address 233 if(place.city != null && place.state != null){ 234 var fullAddress = place.city+" "+place.state; 235 if(place.address != null) 236 fullAddress=place.address+", "+fullAddress; 237 if(place.postalCode != null) 238 fullAddress=fullAddress+" "+place.postalCode; 239 var content= content 240 .replace('{PLACE_ADDRESS}', fullAddress); 241 242 var searchQuery = replaceAll(fullAddress, ',', ''); 243 searchQuery = replaceAll(searchQuery, ' ', '+'); 244 245 var drivingUrl = 'http://maps.google.com/maps?f=d&source=s_q&hl=en&geocode=&q='+searchQuery; 246 247 var directionsContent = 248 replaceAll(directionsTemplate, '{DRIVE_LINK}', drivingUrl); 249 250 directionsContent = directionsContent 251 .replace('{DRIVE_ICON}', dicon); 252 content= content 253 .replace('{DIRECTIONS_CONTENT}', directionsContent); 254 255 256 } else { 257 content= content 258 .replace('{PLACE_ADDRESS}', ''); 259 content= content 260 .replace('{DIRECTIONS_CONTENT}', ''); 261 } 262 263 //phone 264 if(place.phone != null) { 265 content= content 266 .replace('{PLACE_PHONE}', place.phone); 267 } else { 268 content= content 269 .replace('{PLACE_PHONE}', ''); 270 } 271 272 //website 273 if(place.website != null && place.website != '') { 274 275 var webContent = 276 replaceAll(webTemplate, '{WEB_LINK}', place.website ); 277 webContent = 278 replaceAll(webContent, '{WEB_ICON}', wicon ); 279 content= content 280 .replace('{WEB_CONTENT}', webContent); 281 282 283 } else { 284 content= content 285 .replace('{WEB_CONTENT}', ''); 286 } 287 288 return content; 223 .replace('{THUMB_MAX}',thumbMax) 224 .replace('{THUMB_MAX}',thumbMax) 225 ); 226 jQuery(contentsBox).css('height',jQuery('.infobox-img',contentsBox).css('max-height')); 227 } else { 228 jQuery(contentsBox) 229 .css('width',baseWidth+'px'); 230 } 231 232 //place name 233 jQuery(contentsBox).append( 234 '<div class="wl-place-name wl-widget-place-name"><a href="{PLACE_POST_LINK}">{PLACE_NAME}</a></div>' 235 .replace('{PLACE_POST_LINK}',linkUrl) 236 .replace('{PLACE_NAME}',place.properties.name) 237 ); 238 239 //address 240 var fullAddress = ''; 241 242 if(place.properties.city != null && place.properties.province != null){ 243 var fullAddress = place.properties.city+" "+place.properties.province; 244 if(place.properties.address != null) 245 fullAddress=place.properties.address+", "+fullAddress; 246 if(place.properties.postcode != null) 247 fullAddress=fullAddress+" "+place.properties.postcode; 248 } 249 250 jQuery(contentsBox).append( 251 '<div class="wl-place-address wl-place-widget-address">{PLACE_ADDRESS}</div>' 252 .replace('{PLACE_ADDRESS}',fullAddress)); 253 254 //phone 255 if(place.properties.phone != null) { 256 jQuery(contentsBox).append( 257 '<div>{PLACE_PHONE}</div>' 258 .replace('{PLACE_PHONE}',place.properties.phone)); 259 } 260 261 //links 262 var infoBoxLinks = jQuery(document.createElement('ul')).attr('id','info-box-links'); 263 jQuery(infoBoxLinks) 264 .css('display','inline-block') 265 .css('list-style-type:','none'); 266 var linkTemplate = '<li style="display:inline-block;"><a href="{PLACE_LINK_URL}"><img src="{PLACE_LINK_TYPE_IMG}"/></a></li>'; 267 268 if(place.properties.website != null) { 269 jQuery(infoBoxLinks).append( 270 new String(linkTemplate) 271 .replace('{PLACE_LINK_URL}',place.properties.website) 272 .replace('{PLACE_LINK_TYPE_IMG}',wicon) 273 ); 274 275 } 276 277 if(place.properties.city != null && 278 place.properties.province != null && 279 place.properties.postcode != null){ 280 281 var searchQuery = replaceAll(fullAddress, ',', ''); 282 searchQuery = replaceAll(searchQuery, ' ', '+'); 283 var drivingUrl = 'http://maps.google.com/maps?f=d&source=s_q&hl=en&geocode=&q='+searchQuery; 284 285 jQuery(infoBoxLinks).append( 286 new String(linkTemplate) 287 .replace('{PLACE_LINK_URL}',drivingUrl) 288 .replace('{PLACE_LINK_TYPE_IMG}',dicon) 289 ); 290 } 291 292 jQuery(contentsBox).append(infoBoxLinks); 293 294 return jQuery('<div>').append(jQuery(contentsBox).clone()).html(); 295 289 296 } 290 297 … … 468 475 this.style.cursor = "default"; 469 476 }); 477 470 478 } 471 479 … … 1026 1034 1027 1035 1028 //every document 1029 jQuery(document).ready(function(jQuery) { 1030 1031 1032 }); 1036 1037 -
welocally-places/trunk/resources/themes.json
r473697 r514360 23 23 "themeName": "Sight", 24 24 "themeDirectory": "sight" 25 } 25 }, 26 { 27 "themeName": "Delicate", 28 "themeDirectory": "delicate" 29 }, 30 { 31 "themeName": "zBench", 32 "themeDirectory": "zbench" 33 }, 34 { 35 "themeName": "iFeature", 36 "themeDirectory": "ifeature" 37 } 38 26 39 ] -
welocally-places/trunk/template-tags.php
r473697 r514360 50 50 $default_font_color = '000000'; 51 51 $default_font_size = '1.2'; 52 $default_cat_map_layout = ' center';52 $default_cat_map_layout = 'none'; 53 53 $default_cat_map_select_width = '160'; 54 54 $default_cat_map_select_height = '160'; 55 55 $default_api_endpoint = 'https://api.welocally.com'; 56 56 $default_slider_amount = '100' ; 57 $default_update_places = 'off'; 57 58 58 59 $default_infobox_title_link = 'off'; … … 64 65 $default_cat_map_select_title= 'on'; 65 66 $default_cat_map_select_excerpt= 'on'; 67 68 $default_site_name= get_bloginfo('name'); 69 $default_site_home= get_bloginfo('home'); 70 $default_email= get_bloginfo('admin_email'); 66 71 67 72 … … 90 95 if ( !array_key_exists( 'map_icon_web', $options ) ) { $options[ 'map_icon_web' ] = $default_icon_web; $changed = true; } 91 96 if ( !array_key_exists( 'map_custom_style', $options ) ) { $options[ 'map_custom_style' ] = $default_map_style; $changed = true; } 97 98 //site 92 99 if ( !array_key_exists( 'siteKey', $options ) ) { $options[ 'siteKey' ] = $default_map_style; $changed = true; } 93 100 if ( !array_key_exists( 'siteToken', $options ) ) { $options[ 'siteToken' ] = $default_map_style; $changed = true; } 101 if ( !array_key_exists( 'siteName', $options ) ) { $options[ 'siteName' ] = $default_site_name; $changed = true; } 102 if ( !array_key_exists( 'siteHome', $options ) ) { $options[ 'siteHome' ] = $default_site_home; $changed = true; } 103 if ( !array_key_exists( 'siteEmail', $options ) ) { $options[ 'siteEmail' ] = $default_email; $changed = true; } 104 105 94 106 if ( !array_key_exists( 'font_place_name', $options ) ) { $options[ 'font_place_name' ] = $default_font; $changed = true; } 95 107 if ( !array_key_exists( 'color_place_name', $options ) ) { $options[ 'color_place_name' ] = $default_font_color; $changed = true; } … … 107 119 if ( !array_key_exists( 'cat_map_select_width', $options ) ) { $options[ 'cat_map_select_width' ] = $default_cat_map_select_width; $changed = true; } 108 120 if ( !array_key_exists( 'cat_map_select_height', $options ) ) { $options[ 'cat_map_select_height' ] = $default_cat_map_select_height; $changed = true; } 109 if ( !array_key_exists( 'api_endpoint', $options ) ) { $options[ 'api_endpoint' ] = $default_api_endpoint; $changed = true; }110 121 //welocally_cat_map_infobox_text_scale 111 122 if ( !array_key_exists( 'cat_map_infobox_text_scale', $options ) ) { $options[ 'cat_map_infobox_text_scale' ] = $default_slider_amount; $changed = true; } 123 124 //about options 125 if ( !array_key_exists( 'api_endpoint', $options ) ) { $options[ 'api_endpoint' ] = $default_api_endpoint; $changed = true; } 126 if ( !array_key_exists( 'update_places', $options ) ) { $options[ 'update_places' ] = $default_update_places; $changed = true; } 127 128 if ( !array_key_exists( 'update_places', $options ) ) { $options[ 'update_places' ] = $default_update_places; $changed = true; } 129 if ( !array_key_exists( 'update_places', $options ) ) { $options[ 'update_places' ] = $default_update_places; $changed = true; } 130 if ( !array_key_exists( 'update_places', $options ) ) { $options[ 'update_places' ] = $default_update_places; $changed = true; } 112 131 113 132 … … 123 142 124 143 function wl_save_options($options) { 144 145 $options_r = print_r($options, true); 146 //error_log("saving options:".$options_r, 0); 125 147 global $wlPlaces; 126 148 $wlPlaces->saveOptions($options); 149 150 //update places 151 if ( array_key_exists( 'update_places', $options )) { 152 update_places(); 153 } 154 } 155 156 function delete_post_places($post_id=0) { 157 global $wlPlaces; 158 if (!$post_id) $post_id = get_the_ID(); 159 $wlPlaces->deletePostPlaces($post_id); 160 } 161 162 function delete_post_places_meta($post_id=0) { 163 global $wlPlaces; 164 if (!$post_id) $post_id = get_the_ID(); 165 $wlPlaces->deletePostPlacesMeta($post_id); 127 166 } 128 167 … … 144 183 return isset($is_token_valid); 145 184 } 185 186 187 function is_registered(){ 188 $is_token_valid = wl_get_option('siteToken', null); 189 return isset($is_token_valid); 190 } 146 191 147 192 … … 161 206 return false; 162 207 } 208 209 210 function update_places(){ 211 global $wlPlaces; 212 $cat_ID = $wlPlaces->placeCategory(); 213 $places_in_category_posts = get_places_posts_for_category($cat_ID); 214 215 $index = 0; 216 foreach( $places_in_category_posts as $post ) { 217 218 219 $placeJsonRaw = str_replace( 220 "\'", "", 221 get_post_meta( $post->ID, '_PlaceSelected', true )); 222 223 $placeJson = 224 json_decode($placeJsonRaw, true); 225 226 $pname = str_replace("\\'", "'", $placeJson{'name'}); 227 228 if($pname != null){ 229 $newPlaceJson = convert_legacy_place($placeJsonRaw); 230 update_post_meta( $post->ID, '_PlaceSelected', $newPlaceJson); 231 } 232 233 } 234 235 } 236 237 /** 238 * 239 * takes a legacy json string in and returns a json string out 240 */ 241 function convert_legacy_place($legacyPlaceJsonRaw){ 242 $legacyPlaceJson = 243 json_decode($legacyPlaceJsonRaw, true); 244 245 $legacyCategories = $legacyPlaceJson{'categories'}; 246 247 $template = file_get_contents(dirname( __FILE__ ) . '/templates/newplace-template.json'); 248 249 $resultJson = sprintf ( 250 $template, 251 str_replace("SG_", "WL_",$legacyPlaceJson{'externalId'}), //1 252 $legacyPlaceJson{'name'}, //2 253 $legacyPlaceJson{'address'}, //3 254 $legacyPlaceJson{'city'}, //4 255 $legacyPlaceJson{'state'}, //5 256 $legacyPlaceJson{'postalCode'},//6 257 $legacyPlaceJson{'phone'},//7 258 $legacyPlaceJson{'website'}, //8 259 $legacyCategories[0], //9 260 "", //10 261 "",//11 262 $legacyPlaceJson{'latitude'}, //12 263 $legacyPlaceJson{'longitude'} //13 264 ); 265 266 return trim($resultJson ); 267 } 268 269 //select post_id from wp_postmeta where meta_key='_PlaceSelected'; 270 function get_legacy_posts() { 271 global $wpdb; 272 273 $query = "SELECT $wpdb->posts.*, $wpdb->postmeta.meta_value 274 FROM $wpdb->posts,$wpdb->postmeta 275 WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id 276 AND $wpdb->postmeta.meta_key='_PlaceSelected'"; 277 278 279 $metaPlaces = $wpdb->get_results($query, OBJECT); 280 $arr = array(); 281 foreach ($metaPlaces as $post) 282 { 283 $placeJson = 284 json_decode($post->meta_value, true); 285 if(!empty ($placeJson['externalId']) || 286 !empty ($placeJson['simpleGeoId']) ){ 287 array_push($arr, $post); 288 } 289 } 290 return $arr; 291 292 } 293 294 /** 295 * this function is used to determine the number of legacy places that will need to be 296 * converted. 297 * 298 */ 299 function get_places_legacy_count() { 300 global $wpdb; 301 302 $query = "SELECT $wpdb->postmeta.* 303 FROM $wpdb->postmeta 304 WHERE $wpdb->postmeta.meta_key = '_PlaceSelected'"; 305 306 $metaPlaces = $wpdb->get_results($query, OBJECT); 307 $legacyCount = 0; 308 foreach ($metaPlaces as $place) 309 { 310 $placeJson = 311 json_decode($place->meta_value, true); 312 313 if(!empty ($placeJson['externalId']) || 314 !empty ($placeJson['simpleGeoId']) ) 315 { 316 $legacyCount = $legacyCount+1; 317 } 318 } 319 return $legacyCount; 320 321 } 322 323 163 324 164 325 /** … … 219 380 220 381 $categoryPlacesId = $wlPlaces->placeCategory(); 221 382 222 383 $categories_query = "select 223 384 $wpdb->posts.* … … 238 399 AND $wpdb->posts.post_status = 'publish' 239 400 GROUP BY $wpdb->posts.ID)"; 240 401 241 402 $return = $wpdb->get_results($categories_query, OBJECT); 403 242 404 return $return; 243 405 } 244 406 407 408 /** 409 * is this obsolete? 410 */ 245 411 function get_place_post_ids_by_category( $orderBy = null, $orderDir = null, $categoryId = null ) { 246 412 … … 266 432 //iterate through those, we could probably come up with a query here 267 433 //because we are effectively creating a join, but this is already a pretty 268 //complex query, this should probably be improved later 269 270 271 434 //complex query, this should probably be improved later 272 435 $return = $wpdb->get_results($placesQuery, OBJECT); 273 436 return $return; 274 437 } 275 438 276 function get_ place_by_post_id( $postId = null) {439 function get_legacy_place_by_post_id( $postId = null) { 277 440 global $wpdb; 278 441 … … 289 452 290 453 delete_post_meta($postId, '_PlaceSelected'); 291 delete_post_meta($postId, '_PlaceSelected'); 292 454 455 } 456 457 function delete_subscription_options() { 458 459 $options = wl_get_options(); 460 461 $options['siteKey'] = null; 462 $options['siteToken'] = null; 463 464 wl_save_options($options); 465 293 466 } 294 467 … … 307 480 308 481 $excerpt = trim_excerpt($queryResult[0]->post_content, $queryResult[0]->post_excerpt); 309 $excerpt = str_replace( '[welocally/]', '', $excerpt);482 $excerpt = WelocallyPlaces_Tag::searchAndReplace($excerpt, create_function('$tag,$tag_str', 'return "";')); 310 483 $excerpt = str_replace( '\'', '', $excerpt ); 311 484 $excerpt = trim( preg_replace( '/\s+/', ' ', $excerpt ) ); 485 $excerpt = ""; 312 486 313 487 return $excerpt; … … 345 519 } 346 520 347 348 349 521 function get_post_places($post_id=0) { 522 global $wlPlaces; 523 524 if (!$post_id) $post_id = get_the_ID(); 525 526 return $wlPlaces->getPostPlaces($post_id); 527 } 528 529 function get_post_places_meta($post_id=0) { 530 global $wlPlaces; 531 532 if (!$post_id) $post_id = get_the_ID(); 533 534 return $wlPlaces->getPostPlacesMeta($post_id); 535 } 536 537 // functions for get template 538 function wl_places_get_template_map_widget(){ 539 $templateOverride = locate_template( array( 'places/places-map-widget-display.php' ) ); 540 $theme_dir = get_theme_view_dir(); 541 return $templateOverride ? $templateOverride : dirname( __FILE__ ).'/views/themes/'.$theme_dir.'/welocally-places-map-widget-display.php'; 542 } 543 544 function wl_places_get_template_list_widget(){ 545 $templateOverride = locate_template( array( 'places/places-map-widget-display.php' ) ); 546 $theme_dir = get_theme_view_dir(); 547 return $templateOverride ? $templateOverride : dirname( __FILE__ ).'/views/themes/'.$theme_dir.'/welocally-places-list-widget-display.php'; 548 } 549 550 function wl_places_get_template_category(){ 551 global $wlPlaces; 552 $cat_map_layout_type = $wlPlaces->getSingleOption('cat_map_layout'); 553 554 if($cat_map_layout_type == 'none' 555 || is_Feed()) { 556 return; 557 } 558 559 $theme_dir = get_theme_view_dir(); 560 return dirname( __FILE__ ) . '/views/themes/'.$theme_dir.'/category-places-map.php'; 561 } 350 562 } -
welocally-places/trunk/views/includes/category-map-include.php
r476641 r514360 25 25 26 26 #content-body ul, #content-body ol { margin: 0px; } 27 28 27 29 28 #selectable .ui-selecting { background: #C4C4C4; } … … 146 145 directionsicon, 147 146 showLink, 148 link,149 147 showThumb, 150 148 thumbUrl); … … 188 186 <?php if(wl_get_option('map_custom_style') != '') : ?> 189 187 190 var welocallyMapStyle = <?php printf(base64_decode(wl_get_option("map_custom_style"))) ?>; 191 192 // Create a new StyledMapType object, passing it the array of styles, 193 // as well as the name to be displayed on the map type control. 194 var styledMapType = new google.maps.StyledMapType(welocallyMapStyle, {name: "Custom"}); 195 196 var mapOptions = { 197 mapTypeControlOptions: { 198 mapTypeIds: ['welocally_style'] 199 } 200 }; 201 188 var welocallyMapStyle = <?php printf(wl_get_option("map_custom_style")) ?>; 189 190 var mapOptions = { 191 zoom : 16, 192 center : latlng, 193 mapTypeId: google.maps.MapTypeId.ROADMAP, 194 styles: welocallyMapStyle 195 }; 196 202 197 wl_map_main = new google.maps.Map(document.getElementById("map_canvas"), 203 198 mapOptions); 204 199 205 //Associate the styled map with the MapTypeId and set it to display. 206 wl_map_main.mapTypes.set('welocally_style', styledMapType); 207 wl_map_main.setMapTypeId('welocally_style'); 200 WELOCALLY.places.map.setMapEvents(wl_map_main); 201 202 203 204 208 205 209 206 <?php else:?> … … 215 212 wl_map_main = new google.maps.Map(document.getElementById("map_canvas"), 216 213 mapOptions); 217 214 215 WELOCALLY.places.map.setMapEvents(wl_map_main); 216 218 217 219 218 <?php endif; ?> … … 224 223 <?php 225 224 $index = 0; 226 $cat_ID = get_query_var( 'cat' ); 225 $cat_ID = get_query_var( 'cat' ); 227 226 $places_in_category_posts = get_places_posts_for_category($cat_ID); 228 foreach( $places_in_category_posts as $post ) { 227 228 foreach( $places_in_category_posts as $post ): 229 $places = get_post_places($post->ID); 230 231 foreach ($places as $place): 229 232 ?> 230 233 <?php $index=$index+1; ?> … … 243 246 244 247 245 places[<?php echo $index; ?>] = jQuery.parseJSON( '<?php echo $bodytag = str_replace("'", "\'", get_post_meta( $post->ID, '_PlaceSelected', true )); ?>' );246 var latlng = new google.maps.LatLng(places[<?php echo $index; ?>]. latitude, places[<?php echo $index; ?>].longitude);248 places[<?php echo $index; ?>] = <?php echo json_encode($place); ?>; 249 var latlng = new google.maps.LatLng(places[<?php echo $index; ?>].geometry.coordinates[1], places[<?php echo $index; ?>].geometry.coordinates[0]); 247 250 bounds.extend(latlng); 248 251 … … 293 296 294 297 <?php 295 } 298 endforeach; 299 endforeach; 296 300 ?> 297 301 … … 307 311 jQuery( "#selectable" ).selectable({ 308 312 selected: function(event, ui) { 309 console.log("selected");313 310 314 var index = ui.selected.id.replace("item",""); 311 315 var selectedItem = items[index]; 312 var placeLatLng = new google.maps.LatLng(selectedItem.place. latitude, selectedItem.place.longitude);316 var placeLatLng = new google.maps.LatLng(selectedItem.place.geometry.coordinates[1], selectedItem.place.geometry.coordinates[0]); 313 317 wl_map_main.panTo(placeLatLng); 314 315 boxText.innerHTML = 316 buildContentForInfoWindow( 318 319 var contentsBox = jQuery(document.createElement('div')); 320 321 var contents = buildContentForInfoWindow( 322 WELOCALLY.places.map.infobox.baseWidth, 317 323 selectedItem.place, ",", 318 324 selectedItem.marker.webicon, … … 321 327 selectedItem.marker.linkUrl, 322 328 selectedItem.marker.showThumb, 323 selectedItem.marker.thumbUrl); 329 selectedItem.marker.thumbUrl, 330 WELOCALLY.places.map.infobox.thumbMaxSize); 331 332 jQuery(contentsBox).html(contents); 333 334 boxText.innerHTML = contents; 335 336 WELOCALLY.places.map.infobox.setOffset(contentsBox,ib); 337 324 338 ib.open(wl_map_main, selectedItem.marker); 339 ib.show(); 340 ib_widget.hide(); 341 342 jQuery('#info-contents-box ul li a').css('background','none').css('padding','0px'); 343 325 344 lastindex= index; 326 345 }, -
welocally-places/trunk/views/includes/infobox-map-include.php
r473697 r514360 11 11 ,disableAutoPan: false 12 12 ,maxWidth: 0 13 ,pixelOffset: new google.maps.Size( -170, 0)13 ,pixelOffset: new google.maps.Size(0, 0) 14 14 ,zIndex: null 15 15 ,boxStyle: { 16 background: "url('<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/tipbox_340.png') no-repeat",17 16 opacity: 0.85, 18 width:"340px"19 17 } 20 18 ,closeBoxMargin: "10px 2px 2px 2px" … … 32 30 ,disableAutoPan: false 33 31 ,maxWidth: 0 34 ,pixelOffset: new google.maps.Size( -90, 0)32 ,pixelOffset: new google.maps.Size(0, 0) 35 33 ,zIndex: null 36 34 ,boxStyle: { 37 background: "url('<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/tipbox_180.png') no-repeat",38 35 opacity: 0.85, 39 width:"180px"40 36 } 41 37 ,closeBoxMargin: "10px 2px 2px 2px" -
welocally-places/trunk/views/includes/places-list-include.php
r463355 r514360 24 24 <script type="text/javascript" charset="utf-8"> 25 25 26 27 26 jQuery(document).ready(function(jQuery) { 28 29 30 27 31 28 if (typeof(jQuery.fn.parseJSON) == "undefined" || typeof(jQuery.parseJSON) != "function") { 32 29 … … 50 47 }); 51 48 } 52 var placeSelected = jQuery.parseJSON( '<?php echo $bodytag = str_replace("'", "\'", $PlaceSelected); ?>' ); 53 var catsDiv = jQuery('#plugin-place-category<?php echo $post->ID; ?>'); 49 var placeSelected = <?php echo json_encode($PlaceSelected); ?>; 50 51 var catsDiv = jQuery("*[id\^='plugin-place-category<?php echo $index;?>']"); 52 var placeDiv = jQuery("*[id\^='plugin-place<?php echo $index;?>']"); 54 53 55 jQuery( '#plugin-place<?php echo $post->ID; ?>').html(54 jQuery(placeDiv).html( 56 55 buildContentForInfoForList( 57 56 placeSelected, 58 <?php echo $ post->ID; ?>,57 <?php echo $index; ?>, 59 58 '<?php echo get_permalink( $post->ID ); ?>', 60 59 '<?php echo wl_get_option("map_icon_web"); ?>', 61 60 '<?php echo wl_get_option("map_icon_directions"); ?>')); 62 63 jQuery('#plugin-place-links<?php echo $post->ID; ?>').before(catsDiv); 61 62 for (var i=0; i<placeDiv.length; i++) { 63 jQuery(placeDiv[i]).find('#plugin-place-links<?php echo $index; ?>').before(catsDiv[i]); 64 } 64 65 catsDiv.show(); 65 66 -
welocally-places/trunk/views/includes/places-map-include.php
r473697 r514360 45 45 } 46 46 .wl-place-widget-address{ } 47 48 49 50 47 </style> 51 48 … … 54 51 var wl_map_widget; 55 52 53 56 54 jQuery(document).ready(function(jQuery) { 55 57 56 58 57 if (typeof(jQuery.fn.parseJSON) == "undefined" … … 78 77 }); 79 78 } 80 79 80 jQuery('#map_widget_container ul').css('list-style-type','none'); 81 jQuery('#map_widget_container ul').find('*') 82 .css('padding','0x') 83 .css('margin','0x'); 84 jQuery('#info-contents-box').css('line-height','15px'); 85 86 //#sidebar .widget ul li a {background:url(images/ico-meta.gif) no-repeat 0 8px; padding:4px 0 4px 15px; line-height:16px;} 87 81 88 82 89 //setup the bounds 83 90 var bounds = new google.maps.LatLngBounds(); 84 91 85 jQuery('#map_canvas_widget').height( 400 ); 92 //find all map widgets 93 var map_canvas_widgets = jQuery("*[id\^='map_canvas_widget']"); 94 95 jQuery(map_canvas_widgets).height( 400 ); 86 96 jQuery('#map_canvas_widget img').css('max-width' ,'1030px'); 87 97 jQuery('.gmnoprint img').css('max-width' ,'1030px'); … … 90 100 91 101 <?php if(wl_get_option('map_custom_style') != '') : ?> 92 93 var welocallyMapStyle = <?php printf(base64_decode(wl_get_option("map_custom_style"))) ?>; 94 95 // Create a new StyledMapType object, passing it the array of styles, 96 // as well as the name to be displayed on the map type control. 97 var styledMapType = new google.maps.StyledMapType(welocallyMapStyle, {name: "Custom"}); 98 102 //make the style map 103 var welocallyMapStyle = <?php printf(wl_get_option("map_custom_style")) ?>; 104 99 105 var mapOptions = { 100 mapTypeControlOptions: {101 mapTypeIds: ['welocally_style'] 102 } 106 mapTypeId: google.maps.MapTypeId.ROADMAP, 107 styles: welocallyMapStyle, 108 draggableCursor: 'url(http://maps.google.com/mapfiles/openhand.cur)' 103 109 }; 104 110 105 wl_map_widget = new google.maps.Map(document.getElementById("map_canvas_widget"), 106 mapOptions); 107 108 //Associate the styled map with the MapTypeId and set it to display. 109 wl_map_widget.mapTypes.set('welocally_style', styledMapType); 110 wl_map_widget.setMapTypeId('welocally_style'); 111 var wl_map_widget = new Array(); 112 113 for (var i=0; i<map_canvas_widgets.length; i++) { 114 wl_map_widget[i] = new google.maps.Map( 115 map_canvas_widgets[i], 116 mapOptions); 117 118 WELOCALLY.places.map.setMapEvents(wl_map_widget[i]); 119 120 } 121 111 122 112 123 <?php else:?> 113 124 114 125 var mapOptions = { 115 mapTypeId: google.maps.MapTypeId.ROADMAP 126 mapTypeId: google.maps.MapTypeId.ROADMAP, 127 draggableCursor: 'url(http://maps.google.com/mapfiles/openhand.cur), move' 116 128 }; 117 118 wl_map_widget = new google.maps.Map(document.getElementById("map_canvas_widget"), 119 mapOptions); 120 121 129 130 var wl_map_widget = new Array(); 131 132 for (var i=0; i<map_canvas_widgets.length; i++) { 133 134 wl_map_widget[i] = new google.maps.Map( 135 map_canvas_widgets[i], 136 mapOptions); 137 138 WELOCALLY.places.map.setMapEvents(wl_map_widget[i]); 139 140 141 } 122 142 123 143 <?php endif; ?> 124 125 126 144 127 145 var places = new Array(); … … 129 147 <?php 130 148 $index = 0; 131 foreach( $posts as $post ) { ?> 132 places[<?php echo $index; ?>] = 133 jQuery.parseJSON( 134 '<?php echo $bodytag = str_replace("'", "\'", get_post_meta( $post->ID, '_PlaceSelected', true )); ?>' ); 135 136 var latlng = new google.maps.LatLng(places[<?php echo $index; ?>].latitude, places[<?php echo $index; ?>].longitude); 149 foreach( $posts as $post ) { 150 $places = get_post_places($post->ID); 151 152 foreach ($places as $place): 153 ?> 154 places[<?php echo $index; ?>] = <?php echo json_encode($place) ; ?>; 155 156 var latlng = new google.maps.LatLng(places[<?php echo $index; ?>].geometry.coordinates[1], places[<?php echo $index; ?>].geometry.coordinates[0]); 137 157 bounds.extend(latlng); 138 158 … … 148 168 directionsicon 149 169 */ 150 var item<?php echo $index; ?> = addItemMarker(151 'places-map',152 <?php echo $index; ?>,153 places[<?php echo $index; ?>],154 wl_map_widget,155 '<?php echo wl_get_option("map_default_marker") ?>',156 '<?php echo str_replace("'", "\'",$post->post_name);?>',157 '<?php echo get_post_permalink( $post->ID); ?>',158 '<?php echo str_replace("'", "\'",wl_get_post_excerpt( $post->ID )); ?>',159 '<?php echo wl_get_option("map_icon_web"); ?>',160 '<?php echo wl_get_option("map_icon_directions"); ?>',161 false,162 '',163 false,164 ''165 );166 170 for (var i=0; i<wl_map_widget.length; i++) { 171 var item<?php echo $index; ?> = addItemMarker( 172 'places-map', 173 <?php echo $index; ?>, 174 places[<?php echo $index; ?>], 175 wl_map_widget[i], 176 '<?php echo wl_get_option("map_default_marker") ?>', 177 '<?php echo str_replace("'", "\'",$post->post_name); ?>', 178 '<?php echo get_post_permalink( $post->ID ); ?>', 179 '<?php echo str_replace("'", "\'",wl_get_post_excerpt( $post->ID )); ?>', 180 '<?php echo wl_get_option("map_icon_web"); ?>', 181 '<?php echo wl_get_option("map_icon_directions"); ?>', 182 false, 183 false, 184 '' 185 ); 186 } 167 187 <?php 168 188 $index=$index+1; 189 endforeach; 169 190 } 170 191 ?> 171 192 193 for (var i=0; i<wl_map_widget.length; i++) { 172 194 //init map with bounds 173 if(<?php echo $index; ?>==1){ 174 wl_map_widget.setCenter(latlng); 175 wl_map_widget.setZoom(14); 176 } else { 177 wl_map_widget.fitBounds(bounds); 178 } 195 if(<?php echo $index; ?>==1){ 196 wl_map_widget[i].setCenter(latlng); 197 wl_map_widget[i].setZoom(14); 198 } else { 199 wl_map_widget[i].fitBounds(bounds); 200 } 201 } 179 202 180 203 }); -
welocally-places/trunk/views/place-content-template.php
r466267 r514360 1 <script type="text/javascript" charset="utf-8"> 1 <script type="text/javascript"> 2 jQuery(document).ready(function() { 3 jQuery('.place-links-all').find('*') 4 .css('margin','0px') 5 .css('padding','0px'); 6 7 jQuery('.wl-place-content').filter(function(){ 8 jQuery(this).css('width',jQuery(this).parent().width()-5); 9 }); 2 10 3 var map_post = null; 4 jQuery(document).ready(function(jQuery) { 5 6 //themes can screw up google maps 7 jQuery('#map_canvas_post img').css('max-width' ,'1030px'); 8 jQuery('.gmnoprint img').css('max-width' ,'1030px'); 9 10 11 if (typeof(jQuery.fn.parseJSON) == "undefined" || typeof(jQuery.parseJSON) != "function") { 12 13 //extensions, this is because prior to 1.4 there was no parse json function 14 jQuery.extend({ 15 parseJSON: function( data ) { 16 if ( typeof data !== "string" || !data ) { 17 return null; 18 } 19 data = jQuery.trim( data ); 20 if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") 21 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") 22 .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { 23 return window.JSON && window.JSON.parse ? 24 window.JSON.parse( data ) : 25 (new Function("return " + data))(); 26 } else { 27 jQuery.error( "Invalid JSON: " + data ); 28 } 29 } 30 }); 31 } 32 33 var place = jQuery.parseJSON( '%2$s' ); 34 35 var showMap = %3$s; 36 var customStyle = %4$s; 37 38 jQuery('#place-name-%1$d').html(place.name); 39 40 jQuery('#place-address-%1$d').html( 41 place.address+", "+ 42 place.city+" "+ 43 place.state+" "+ 44 place.postalCode); 45 46 if(place.phone != null) { 47 jQuery('#place-phone-%1$d').html(place.phone); 11 }); 12 </script> 13 <style> 14 #place-details { width: 100%; display: none; background-color: #eeeeee; } 15 #sp-click-action-call { width: 100%; background-color: #eeeeee; } 16 .simple_grey_italic { 17 font-size:1.2em; 18 font-style:italic; 19 font-weight:normal; 20 color: #333333; 21 font-family:Adobe Garamond Pro, Garamond, Palatino, Palatino Linotype, Times, Times New Roman, Georgia, serif; 48 22 } 49 23 50 if(place.website != null && place.website != '' ) { 51 var website = place.website; 52 if(place.website.indexOf('http://') == -1) { 53 website = 'http://'+place.website; 54 } 55 jQuery('#place-website-%1$d') 56 .html( 57 '<table><tr><td class="wl-place-link-item"><a href="'+ 58 website+'">'+ 59 '<img src="%6$s" border="0"/></a></td>'+ 60 '<td class="wl-place-link-item"><a href="'+ 61 website+'" target="_new">website</a></td></tr></table>'); 62 } else if(place.url != null && place.url != '') { 63 var website = place.url; 64 if(place.url.indexOf('http://') == -1) { 65 website = 'http://'+place.url; 66 } 67 jQuery('#place-website-%1$d') 68 .html( 69 '<table><tr><td class="wl-place-link-item"><a href="'+ 70 website+'">'+ 71 '<img src="%6$s" border="0"/></a></td>'+ 72 '<td class="wl-place-link-item"><a href="'+ 73 website+'" target="_new">website</a></td></tr></table>'); 24 img.wl-link-image { 25 /*float: right;*/ 26 margin: 4px; 27 border:0px; 74 28 } 75 29 76 if(place.city != null && place.state != null){ 77 var qS = place.city+" "+place.state; 78 if(place.address != null) 79 qs=place.address+" "+qS; 80 if(place.postalCode != null) 81 qs=qs+" "+place.postalCode; 82 var qVal = qs.replace(" ","+"); 30 ul.wl-place-links { padding-left: 0px; } 31 32 #details-place-name{ margin: 3px;} 33 34 #details-place-excerpt{ margin: 3px 3px 10px 3px;} 35 36 .sidebar-item li { 37 list-style: none; 38 } 39 40 /* override the font style */ 41 .content-sidebar ul li a:hover, .content-sidebar .recentcomments a:hover { 42 color: #<?php echo wl_get_option("color_place_name", "000000"); ?>; 43 } 44 .wl-place-name { 45 font-family: <?php echo wl_get_option("font_place_name", "Sorts Mill Goudy"); ?>; 46 color: #<?php echo wl_get_option("color_place_name", "000000"); ?>; 47 } 48 .wl-place-name a { 49 font-family: <?php echo wl_get_option("font_place_name", "Sorts Mill Goudy"); ?>; 50 color: #<?php echo wl_get_option("color_place_name", "000000"); ?>; 51 } 52 53 .wl-place-widget-name{ } 54 .wl-place-address { 55 font-family: <?php echo wl_get_option("font_place_address", "Sorts Mill Goudy"); ?>; 56 color: #<?php echo wl_get_option("color_place_address", "000000"); ?>; 57 } 58 .wl-place-widget-address{ } 59 </style> 60 <div id="wl-place-content-<?php echo $t->uid; ?>" class="wl-place-content"> 61 <div class="map_canvas_post"></div> 62 <div class="wl-place-name" id="place-name-<?php echo $t->uid; ?>"></div> 63 <div class="wl-place-address" id="place-address-<?php echo $t->uid; ?>"></div> 64 <div class="wl-place-phone" id="place-phone-<?php echo $t->uid; ?>"></div> 65 <div class="place-links-all"> 66 <ul class="wl-place-links"> 67 <li class="wl-place-links-lines" > 68 <span class="wl-place-website" id="place-website-<?php echo $t->uid; ?>"></span> 69 </li> 70 <li class="wl-place-links-lines" > 71 <span class="wl-place-driving" id="place-driving-<?php echo $t->uid; ?>"></span> 72 </li> 73 <li class="wl-place-links-lines" id="place-embed"> 74 <table> 75 <tbody> 76 <tr> 77 <td class="wl-place-link-item"> 78 <img width="16" height="16" 79 src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/we_16.png" alt="" title=""/></td> 80 <td class="wl-place-link-item"><a id="share-link-<?php echo $t->uid; ?>" href="#">embed</a></td> 81 </tr> 82 </tbody> 83 </table> 84 <script> 85 jQuery("#share-link-<?php echo $t->uid; ?>").click(function () { 86 jQuery("#place-tag-field-<?php echo $t->uid; ?>").val(WELOCALLY.places.tag.makePlaceTag(<?php echo $t->placeJSON; ?>)); 87 jQuery("#share-tag-<?php echo $t->uid; ?>").toggle(); 88 return false; 89 }); 90 </script> 91 </li> 92 </ul> 93 <div class="share-place-tag" id="share-tag-<?php echo $t->uid; ?>"> 94 <table width="100%"> 95 <tr><td colspan="2"><input class="share-place-tag-tagtext" type="text" id="place-tag-field-<?php echo $t->uid; ?>"></input></td></tr> 96 <tr><td align="left"><div>Place this tag in your own <a href="http://welocally.com/?page_id=2">Welocally Places</a> powered <a href="http://wordpress.org/extend/plugins/welocally-places/">wordpress</a> site.</div></td> 97 <td align="right"><a href="http://welocally.com/?page_id=2"><img width="95" height="20" 98 src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/places_powered.png" 99 alt="" title="Powered by Welocally Places"/></a></td></tr> 100 </table> 83 101 84 jQuery('#place-driving-%1$d') 85 .html( 86 '<table><tr><td class="wl-place-link-item"><a href="http://maps.google.com/maps?f=d&source=s_q&hl=en&geocode=&q='+ 87 qVal+'" target="_new"><img src="%7$s"/></a></td>'+ 88 '<td class="wl-place-link-item"><a href="http://maps.google.com/maps?f=d&source=s_q&hl=en&geocode=&q='+ 89 qVal+'" target="_new">directions</a></td></tr></table>'); 90 } 91 92 if(showMap && customStyle ){ 93 var latlng = new google.maps.LatLng(place.latitude, place.longitude); 94 95 var welocallyMapStyle = %5$s; 96 97 98 // Create a new StyledMapType object, passing it the array of styles, 99 // as well as the name to be displayed on the map type control. 100 var styledMapType = new google.maps.StyledMapType(welocallyMapStyle, 101 {name: "Custom"}); 102 103 104 var mapOptions = { 105 zoom: 16, 106 center: latlng, 107 mapTypeControlOptions: { 108 mapTypeIds: ['welocally_style'] 109 } 110 }; 111 112 map_post = new google.maps.Map(document.getElementById("map_canvas_post"), 113 mapOptions); 114 115 //Associate the styled map with the MapTypeId and set it to display. 116 map_post.mapTypes.set('welocally_style', styledMapType); 117 map_post.setMapTypeId('welocally_style'); 118 119 120 //home location 121 var mMarker = new google.maps.Marker({ 122 position: latlng, 123 map: map_post, 124 icon: '%14$s' 125 }); 126 127 jQuery('#map_canvas_post').show(); 128 129 } else if(showMap && !customStyle ){ 130 var latlng = new google.maps.LatLng(place.latitude, place.longitude); 131 132 var mapOptions = { 133 zoom: 12, 134 center: latlng, 135 mapTypeId: google.maps.MapTypeId.ROADMAP 136 }; 137 138 map_post = new google.maps.Map(document.getElementById("map_canvas_post"), 139 mapOptions); 140 141 //home location 142 var mMarker = new google.maps.Marker({ 143 position: latlng, 144 map: map_post, 145 icon: '%14$s' 146 }); 147 148 jQuery('#map_canvas_post').show(); 149 } 150 151 }); 102 </div> 103 </div> 152 104 105 </div> 106 <script type="text/javascript" charset="utf-8"> 107 WELOCALLY.places.tag.insertPlace('wl-place-content-<?php echo $t->uid; ?>', 108 <?php echo $t->placeJSON; ?>, 109 <?php echo json_encode($t->options); ?>); 153 110 </script> 154 <div id="wl-place-content">155 <div id="map_canvas_post"></div>156 <div class="wl-place-name" id="place-name-%1$d"></div>157 <div class="wl-place-address" id="place-address-%1$d"></div>158 <div class="wl-place-phone" id="place-phone-%1$d"></div>159 160 <ul>161 <li class="wl-place-links-lines" >162 <span id="place-website-%1$d"></span>163 </li>164 <li class="wl-place-links-lines" >165 <span id="place-driving-%1$d"></span>166 </li>167 </li>168 </div> -
welocally-places/trunk/views/places-meta-box.php
r476641 r514360 1 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script> 2 <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/smoothness/jquery-ui.css" type="text/css" /> 3 <script type="text/javascript" charset="utf-8"> 1 <?php global $post; ?> 2 <script type="text/javascript"> 3 if (!window.WELOCALLY) { 4 window.WELOCALLY = { 5 6 }; 7 } 8 9 //this can go farther 10 WELOCALLY.meta = { 11 post: { 12 type: '<?php echo $post->post_type; ?>', 13 id: '<?php echo $post->ID; ?>' 14 } 15 } 16 4 17 var jsonObjFeatures = []; //declare features array 18 var markersArray = []; 5 19 var selectedFeatureIndex = 0; 20 var selectedClassifierLevel=''; 6 21 var selectedCategories=''; 7 var isSelected = false; 8 9 var tags=[<?php $tags = wp_get_post_tags($post->ID); 10 foreach( $tags as $tag ){ 11 echo "'"; 12 print_r(str_replace("'", "\'",$tag->name)); 13 echo "',"; 14 } ?>]; 15 16 17 function getLocationsByAddress(address, keyword, radiusKm) { 18 jQuery('#welocally-post-error').removeClass('welocally-error welocally-update error updated fade'); 19 jQuery('#welocally-post-error').html('<em>Loading Places...</em>'); 22 var map; 23 var selectedGeocode; 24 var selectedPlace = { 25 properties: {}, 26 type: 'Place', 27 classifiers: [ 28 { 29 type: '', 30 category: '', 31 subcategory: '' 32 } 33 ], 34 geometry: { 35 type: "Point", 36 coordinates: [] 37 } 38 }; 39 40 var activityType; 41 42 var jqxhr; 43 44 function setStatus(message, type, showloading){ 45 jQuery('#welocally-post-error').html(''); 46 jQuery("#welocally-post-error").removeClass(); 47 48 if(type=='update'){ 49 jQuery('#welocally-post-error').addClass('welocally-update'); 50 } else if(type=='error'){ 51 jQuery('#welocally-post-error').addClass('welocally-error'); 52 } else if(type=='message'){ 53 jQuery('#welocally-post-error').addClass('welocally-message'); 54 } 55 56 if(showloading){ 57 jQuery('#welocally-post-error').append('<img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/ajax-loading.gif" alt="" title=""/>'); 58 } 59 60 jQuery('#welocally-post-error').append('<em>'+message+'</em>'); 61 62 if(message != ''){ 63 jQuery('#welocally-post-error').show(); 64 } else { 65 jQuery('#welocally-post-error').hide(); 66 } 67 68 } 69 70 function addMarker(map_marker, location) { 71 var marker = new google.maps.Marker({ 72 position: location, 73 map: map_marker 74 }); 75 markersArray.push(marker); 76 } 77 78 // Removes the overlays from the map, but keeps them in the array 79 function clearOverlays() { 80 if (markersArray) { 81 for (i in markersArray) { 82 markersArray[i].setMap(null); 83 } 84 } 85 } 86 87 // Shows any overlays currently in the array 88 function showOverlays() { 89 if (markersArray) { 90 for (i in markersArray) { 91 markersArray[i].setMap(map); 92 } 93 } 94 } 95 96 // Deletes all markers in the array by removing references to them 97 function deleteOverlays() { 98 if (markersArray) { 99 for (i in markersArray) { 100 markersArray[i].setMap(null); 101 } 102 markersArray.length = 0; 103 } 104 } 105 106 107 function searchLocations(location, queryString, radiusKm) { 108 setStatus('Loading Places...', 'message', true); 109 20 110 jQuery('#selectable').empty(); 21 111 jsonObjFeatures = []; 22 23 24 112 113 25 114 var options = { 26 115 action: 'get_places', 27 siteKey : '<?php echo wl_get_option('siteKey',null) ?>', 28 siteToken : '<?php echo wl_get_option('siteToken',null) ?>', 29 baseurl : '<?php echo wl_get_option('siteHome',get_bloginfo('home')); ?>', 30 address : address.replace(/'/g, ''), 31 radius: radiusKm, 32 query : keyword.replace(/'/g, '') 116 q: queryString, 117 loc: location.lat()+'_'+location.lng(), 118 radiusKm: 20 33 119 }; 34 120 35 121 jQuery.ajax({ 36 type: ' POST',122 type: 'GET', 37 123 url: ajaxurl, 38 dataType: 'json',39 124 data: options, 40 error : function(jqXHR, textStatus, errorThrown) { 41 console.error(textStatus); 42 jQuery('#welocally-post-error').html('ERROR : '+textStatus); 43 jQuery('#welocally-post-error').addClass('welocally-error error fade'); 125 dataType : 'json', 126 beforeSend: function(jqXHR){ 127 jqxhr = jqXHR; 128 }, 129 //dont know why success is not working on empty results 130 statusCode: { 131 200: function(data, textStatus, jqXHR) { 132 if(data != null && data.length == 0) { 133 setStatus('Sorry no places were found that match your query.', 'update', false); 134 jQuery('#add-place-section').append(jQuery('#cancel-finder-workflow')); 135 jQuery('#place-selector').append(jQuery('#add-place-section')); 136 jQuery('#add-place-section').show(); 137 138 } 139 } 140 }, 141 error : function(jqXHR, textStatus, errorThrown) { 142 if(textStatus != 'abort'){ 143 setStatus('ERROR : '+textStatus+" there may been a network error or a problem with your settings.", 'error', false); 144 jQuery('#add-place-section').append(jQuery('#cancel-finder-workflow')); 145 jQuery('#place-selector').append(jQuery('#add-place-section')); 146 jQuery('#add-place-section').show(); 147 148 } else { 149 console.log(textStatus); 150 } 44 151 }, 45 152 success : function(data, textStatus, jqXHR) { 46 jQuery('#welocally-post-error').html(''); 47 48 if(data != null && data.places != null && data.places.length == 0) { 49 jQuery('#welocally-post-error').append('<div class="welocally-context-help"><a href="http://www.welocally.com/wordpress/?page_id=104#info_201" target="_new"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/context_help_16.png" alt="" title="Get help" height="16px" width="16px" border="0px"/></a></div>'); 50 jQuery('#welocally-post-error').append('Sorry no places were found that match your query, try again or add this as a new place.'); 51 jQuery('#welocally-post-error').addClass('welocally-update updated fade'); 153 154 setStatus('', 'message', false); 155 156 if(data != null && data.length == 0) { 157 setStatus('Sorry no places were found that match your query.', 'update', false); 158 jQuery('#add-place-section').append(jQuery('#cancel-finder-workflow')); 159 jQuery('#place-selector').append(jQuery('#add-place-section')); 160 jQuery('#add-place-section').show(); 52 161 53 } else if(data != null && data. places != null && data.places.length > 0) {54 jQuery.each(data .places, function(i,item){162 } else if(data != null && data.length > 0) { 163 jQuery.each(data, function(i,item){ 55 164 jsonObjFeatures.push(item); 56 jQuery('#selectable').append(buildListItemForPlace(item,i)); 57 jQuery("#results").show(); 165 jQuery('#selectable').append(buildListItemForPlace(item,i)); 58 166 }); 59 } else if(data != null && data.places == null && data.errors != null) { 167 jQuery('#search-geocoded-section').append(jQuery('#results')); 168 jQuery('#add-place-section').append(jQuery('#cancel-finder-workflow')); 169 jQuery('#results').append(jQuery('#add-place-section')); 170 jQuery("#results").show(); 171 jQuery('#add-place-section').show(); 172 173 } else if(data != null && data.errors != null) { 60 174 61 175 buildErrorMessages(data.errors); 62 176 63 } else if(data == null) { 64 65 var errors = new Array(); 66 var errorEmpty = { 67 errorCode: 108, 68 errorMessage: "Problem connecting to Welocally, please contact us." 69 }; 70 errors.push(errorEmpty); 71 72 buildErrorMessages(errors); 73 177 } else { 178 setStatus('There was a problem, please check your settings and network.', 'error', false); 179 jQuery('#add-place-section').append(jQuery('#cancel-finder-workflow')); 180 jQuery('#place-selector').append(jQuery('#add-place-section')); 181 jQuery('#add-place-section').show(); 74 182 } 75 183 } 76 184 }); 77 78 185 79 186 } 80 187 81 188 function buildListItemForPlace(place,i) { 82 var itemLabel = '<b>'+place.name+'</b>'; 83 if (place.address) { 84 itemLabel += "<br>" + place.address; 189 var itemLabel = '<b>'+place.properties.name+'</b> - '+place.distance.toFixed(2)+' km'; 190 if (place.properties.address) { 191 itemLabel += "<br>" + place.properties.address+" "+ 192 place.properties.city+" "+place.properties.province+" " 193 +place.properties.postcode; 85 194 } 86 195 return '<li class=\"ui-widget-content\" id="f'+i+'" title="select place">'+itemLabel+'</li>'; 87 196 } 88 197 89 function buildSelectedInfoForPlace(place) { 90 var itemLabel = '<b>'+place. name+'</b>';91 if (place. address) {92 itemLabel += "<br>" + place. address;198 function buildSelectedInfoForPlace(place) { 199 var itemLabel = '<b>'+place.properties.name+'</b>'; 200 if (place.properties.address) { 201 itemLabel += "<br>" + place.properties.address; 93 202 } 94 203 return '<div class=\"selected-place-info\">'+itemLabel+'</div>'; … … 96 205 97 206 function buildCategorySelectionsForPlace(place, container) { 207 98 208 container.html(''); 99 209 var index = -1; 100 for (category in place.categories) { 101 index = category; 102 container.append('<li class=\"ui-widget-content\">'+place.categories[category]+'</li>'); 210 211 for (classifier in place.properties.classifiers) { 212 index = classifier; 213 container.append('<li class=\"ui-widget-content\">'+place.properties.classifiers[classifier].category+'</li>'); 214 container.append('<li class=\"ui-widget-content\">'+place.properties.classifiers[classifier].subcategory+'</li>'); 103 215 } 104 105 //show if there are items106 216 if(index != -1){ 107 217 jQuery("#categories-choice").show(); 108 218 } 109 219 110 } 111 112 113 function setSelectedPlaceInfo(selectedItem) { 114 //set selected 115 isSelected=true; 220 221 } 222 223 function setSelectedPlaceInfo(selectedItem, post) { 224 225 //set form fields for save post 226 selectedPlace = selectedItem; 227 228 jQuery('#edit-place-name-selected').html(selectedPlace.properties.name); 229 jQuery('#search-geocoded-address-selected').html(selectedPlace.properties.address+ 230 " "+selectedPlace.properties.city+" "+selectedPlace.properties.province+" "+ 231 selectedPlace.properties.postcode); 232 233 jQuery('#share-meta-tagtext').val(WELOCALLY.places.tag.makePlaceTag(selectedPlace, post)); 234 jQuery('#places-tag-selected').show(); 235 236 var selectedLocation = new google.maps.LatLng(selectedPlace.geometry.coordinates[1], selectedPlace.geometry.coordinates[0]); 237 var myOptions = { 238 center: selectedLocation, 239 zoom: 15, 240 mapTypeId: google.maps.MapTypeId.ROADMAP 241 }; 242 243 if(map==null){ 244 map = new google.maps.Map(document.getElementById("map_canvas"), 245 myOptions); 246 247 //need to add listeners 248 WELOCALLY.places.map.setMapEvents(map); 249 250 } else { 251 map.setCenter(selectedLocation); 252 } 253 254 deleteOverlays(); 255 addMarker(map,selectedLocation); 256 116 257 117 258 //hide the selection area 118 259 jQuery("#place-selector").hide(); 119 jQuery("#add-place-form").hide(); 120 260 jQuery("#edit-place-form").hide(); 121 261 122 262 //set the form value 263 //this is wehere we should build the tag 123 264 jQuery("#place-selected").val(JSON.stringify(selectedItem)); 124 265 125 //show the *selected* area 126 var info = buildSelectedInfoForPlace(selectedItem); 127 jQuery("#selected-place-info").html(info); 128 129 //build the categories 130 buildCategorySelectionsForPlace(selectedItem, jQuery("#selectable-cat")); 131 132 jQuery("#selected-place").show(); 266 jQuery('#edit-place-name-selected') 267 268 //show the *selected* area 269 jQuery("#selected-place-info").html(''); 270 jQuery("#selected-place-info").append(jQuery('#places-tag-selected')); 271 jQuery("#selected-place-info").append(jQuery('#edit-place-name-selected')); 272 jQuery("#selected-place-info").append(jQuery('#search-geocoded-address-selected')); 273 jQuery("#selected-place-info").append(jQuery('#map_canvas')); 274 275 jQuery("#results").hide(); 276 jQuery("#selected-place").show(); 277 278 } 279 280 function validGeocodeForSearch(geocode) { 281 282 var hasAll = hasType("country", geocode.address_components); 283 if(hasAll){ 284 hasAll = hasType("locality", geocode.address_components); 285 } 286 if(hasAll){ 287 hasAll = hasType("administrative_area_level_1", geocode.address_components); 288 } 289 if(hasAll){ 290 hasAll = hasType("postal_code", geocode.address_components); 291 } 292 return hasAll; 293 } 294 295 function findCategory(categoryName){ 296 var cat; 297 jQuery.each(currentCategories, function(key, val) { 298 if(val.name == categoryName) { 299 cat = val; 300 } 301 }); 302 return cat; 303 } 304 305 function getCategories(type, category) { 306 jQuery('#edit-place-categories-selection').hide(); 307 308 setStatus('Loading Categories...','message', true); 309 310 var options = { 311 action: 'get_classifiers_types' 312 }; 313 314 var base; 315 selectedClassifierLevel = 'Type'; 316 317 if(type != null && category == null){ 318 base = type; 319 selectedClassifierLevel = 'Category'; 320 321 options.action='get_classifiers_categories'; 322 options.type = type; 323 324 } else if(type != null && category != null){ 325 base = category; 326 selectedClassifierLevel = 'Subcategory'; 327 328 options.action='get_classifiers_subcategories'; 329 options.type = type; 330 options.category = category; 331 } 332 333 jqxhr = jQuery.ajax({ 334 type: 'GET', 335 url: ajaxurl, 336 data: options, 337 dataType : 'json', 338 beforeSend: function(jqXHR){ 339 jqxhr = jqXHR; 340 }, 341 error : function(jqXHR, textStatus, errorThrown) { 342 if(textStatus != 'abort'){ 343 setStatus('ERROR : '+textStatus, 'error', false); 344 jQuery('#edit-place-categories-selection').append(jQuery('#cancel-finder-workflow')); 345 } else { 346 console.log(textStatus); 347 } 348 }, 349 success : function(data, textStatus, jqXHR) { 350 351 setStatus('', 'message', false); 352 353 jQuery('#edit-place-categories-selection-list').html(''); 354 355 if(base != null && data.length==1){ 356 jQuery('#edit-place-categories-selection-list').append('<li style="display:inline-block;">'+base+'</li>'); 357 } 358 359 if(data != null && data.errors != null) { 360 buildErrorMessages(data.errors); 361 jQuery('#edit-place-categories-selection').append(jQuery('#cancel-finder-workflow')); 362 } else { 363 currentCategories = data; 364 jQuery.each(data, function(key, val) { 365 if(val != null && val != '' ) { 366 jQuery('#edit-place-categories-selection-list').append('<li style="display:inline-block;">'+val+'</li>'); 367 } 368 }); 369 jQuery('#categories-section').show(); 370 jQuery('#edit-place-categories-selection').append(jQuery('#back-action')); 371 jQuery('#edit-place-categories-selection').show(); 372 373 jQuery('#add-place-actions-section').append(jQuery('#cancel-finder-workflow')); 374 jQuery('#cancel-finder-workflow').show(); 375 jQuery('#add-place-actions-section').show(); 376 377 } 378 } 379 }); 380 } 381 382 function getShortNameForType(type_name, address_components){ 383 for (componentIndex in address_components) { 384 var component = address_components[componentIndex]; 385 if(component.types[0] == type_name) 386 return address_components[componentIndex].short_name; 387 } 388 return null; 389 390 } 391 392 function hasType(type_name, address_components){ 393 for (componentIndex in address_components) { 394 var component = address_components[componentIndex]; 395 if(component.types[0] == type_name) 396 return true; 397 } 398 return false; 399 133 400 } 134 401 135 402 function buildErrorMessages(errors) { 136 jQuery('#welocally-post-error').html('');137 jQuery('#welocally-post-error').append('<ul>');403 404 var errorMessageOut = "ERROR: "; 138 405 jQuery.each(errors, function(i,error){ 139 jQuery('#welocally-post-error').append('<li><a href="http://www.welocally.com/wordpress/?page_id=104#error_'+error.errorCode+'" target="_new"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/context_help_16.png" alt="" title="Get help" height="16px" width="16px" border="0px"/></a> ERROR '+error.errorCode+' : '+error.errorMessage+'</li>'); 140 141 }); 142 jQuery('#welocally-post-error').append('</ul>'); 143 jQuery('#welocally-post-error').addClass('welocally-error error fade'); 406 var number = i+1; 407 errorMessageOut = errorMessageOut+number+". "+error.errorMessage; 408 }); 409 setStatus(errorMessageOut,'error', false); 144 410 } 145 411 … … 147 413 jQuery('#welocally-post-error').html(''); 148 414 jQuery('#welocally-post-error').append('<ul>'); 149 jQuery('#welocally-post-error').append('<li> <a href="http://www.welocally.com/wordpress/?page_id=104#error_104" target="_new"><img src="<?php echo WP_PLUGIN_URL; ?>/welocally-places/resources/images/context_help_16.png" alt="" title="Get help" height="16px" width="16px" border="0px"/></a> ERROR 104 : Required field is missing, please check all required fields. Missing fields: - '+fields+'</li>');415 jQuery('#welocally-post-error').append('<li>error '+fields+' missing</li>'); 150 416 jQuery('#welocally-post-error').append('</ul>'); 151 jQuery('#welocally-post-error').addClass('welocally-error error fade'); 152 } 153 154 function autoload(tags) { 155 jQuery.each(tags, function(i,tag){ 156 if(tag != 'Autoload' && isSelected){ 157 jQuery("#place-search").val(convertChars(tag)); 158 jQuery("#welocally_default_search_radius").val(<?php echo wl_get_option('default_search_radius',null) ?>); 159 jQuery("#place-address").val('<?php echo wl_get_option('default_search_addr',null) ?>'); 160 161 getLocationsByAddress('<?php echo wl_get_option('default_search_addr',null) ?>', convertChars(tag), <?php echo wl_get_option('default_search_radius',null) ?>); 162 jQuery("#place-selector").show(); 417 jQuery('#welocally-post-error').addClass('welocally-error error fade'); 418 jQuery('#welocally-post-error').show(); 419 } 420 421 // intercepts a next event and resets everything, but is acting as the first phase 422 function cancelHandler(event) { 423 setStatus('','message', false); 424 425 //reset selected place 426 selectedPlace = { 427 properties: {}, 428 type: "Place", 429 classifiers: [ 430 { 431 type: '', 432 category: '', 433 subcategory: '' 434 } 435 ], 436 geometry: { 437 type: "Point", 438 coordinates: [] 439 } 440 }; 441 442 //wipe clean any input fields 443 jQuery('#place-selector-form input').val(''); 444 445 //all sections hidden 446 jQuery('.resetable').hide(); 447 448 jQuery('#edit-place-form').hide(); 449 jQuery('#place-selector').show(); 450 451 return nextHandler(event); 452 453 } 454 455 function nextHandler(event) { 456 console.log('next phase:'+event.data.phase); 457 setStatus('','message', false); 458 var phase = event.data.phase; 459 var error = false; 460 if(phase=='associate-place-section'){ 461 jQuery('.resetable', jQuery('#search-place-name-section')).show(); 462 jQuery('#cancel-finder-workflow').hide(); 463 var section = jQuery('#search-place-name-section'); 464 jQuery('#back-action' ).hide(); 465 section.append(jQuery('#edit-place-name-title')); 466 section.append(jQuery('#place-name-input')); 467 section.append(jQuery('#place-name-saved')); 468 section.append(jQuery('#back-action')); 469 section.append(jQuery('#next-action')); 470 section.show(); 471 472 jQuery('#place-name-title').html('Search Term: Enter a search term such as the place name or the category ie. "Pizza"'); 473 474 //manage event model 475 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'search-place-name-section' }, nextHandler); 476 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'search-place-name-section' }, backHandler); 477 478 jQuery('#place-selector-form').show(); 479 480 481 } else if(phase=='search-place-name-section'){ 482 if (WELOCALLY.util.trim(jQuery("#edit-place-name").val()) == ''){ 483 setStatus('Search Empty. Please enter a search term or place name.','error', false); 484 error = true; 485 486 } else { 487 selectedPlace.properties.name = jQuery("#edit-place-name").val(); 488 489 jQuery('#edit-place-name-selected').html(selectedPlace.properties.name); 490 jQuery('#place-street-title').html('Location: Choose the location or full address you would like to search from. ie. Oakland, CA 94612'); 491 492 //put the address search in the top 493 jQuery('.resetable', jQuery('#search-place-address-section')).show(); 494 495 var section = jQuery('#search-place-address-section'); 496 section.append(jQuery('#edit-place-name-selected')); 497 section.append(jQuery('#street-name-input')); 498 section.append(jQuery('#street-address-saved')); 499 section.append(jQuery('#back-action')); 500 section.append(jQuery('#next-action')); 501 502 jQuery('#back-action').show(); 503 504 section.show(); 505 506 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'search-place-address-section' }, nextHandler); 507 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'search-place-address-section' }, backHandler); 163 508 } 164 }); 165 166 } 167 168 function convertChars(mystring){ 169 return mystring.replace(/&/g, '&').replace(/>/g, '>' ).replace(/</g, '<' ).replace(/"/g, '\"' ); 170 } 171 509 510 } else if(phase=='search-place-address-section'){ 511 if (WELOCALLY.util.trim(jQuery('#edit-place-street').val()) == ''){ 512 setStatus('Location Empty. Please enter a location to start search from ie Oaklnd CA, 94612.','error', false); 513 error = true; 514 515 } else { 516 517 setStatus('Geocoding...','message', true); 518 519 var address = jQuery('#edit-place-street').val(); 520 521 jQuery('#search-geocoded-section').append(jQuery('#back-action')); 522 523 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'search-place-address-section' }, backHandler); 524 525 geocoder.geocode( { 'address': address}, function(results, status) { 526 if (status == google.maps.GeocoderStatus.OK && validGeocodeForSearch(results[0])) { 527 jQuery('#search-geocoded-name-selected').html(selectedPlace.properties.name); 528 jQuery('#search-geocoded-address-selected').html(results[0].formatted_address); 529 jQuery('#search-geocoded-section').append(jQuery('#search-geocoded-address-selected')); 530 jQuery('#search-geocoded-section').append(jQuery('#map_canvas')); 531 532 //do the map stuff 533 selectedGeocode = results[0]; 534 535 //set the model 536 selectedPlace.properties.address = 537 getShortNameForType("street_number", selectedGeocode.address_components)+' '+ 538 getShortNameForType("route", selectedGeocode.address_components); 539 540 selectedPlace.properties.city = 541 getShortNameForType("locality", selectedGeocode.address_components); 542 543 selectedPlace.properties.province = 544 getShortNameForType("administrative_area_level_1", selectedGeocode.address_components); 545 546 selectedPlace.properties.postcode = 547 getShortNameForType("postal_code", selectedGeocode.address_components); 548 549 selectedPlace.properties.country = 550 getShortNameForType("country", selectedGeocode.address_components); 551 552 selectedPlace.geometry.coordinates = []; 553 selectedPlace.geometry.coordinates.push(selectedGeocode.geometry.location.lng()); 554 selectedPlace.geometry.coordinates.push(selectedGeocode.geometry.location.lat()); 555 556 557 var myOptions = { 558 zoom: 15, 559 mapTypeId: google.maps.MapTypeId.ROADMAP 560 }; 561 562 if(map==null){ 563 map = new google.maps.Map(document.getElementById("map_canvas"), 564 myOptions); 565 } 566 567 deleteOverlays(); 568 map.setCenter(selectedGeocode.geometry.location); 569 addMarker(map,selectedGeocode.geometry.location); 570 571 jQuery('.resetable', jQuery('#search-geocoded-section')).show(); 572 jQuery('#back-action').hide(); 573 jQuery('#search-geocoded-section').show(); 574 575 setStatus('','message', false); 576 577 //ajax call 578 searchLocations(selectedGeocode.geometry.location, selectedPlace.properties.name, 30); 579 580 581 } else { 582 console.log("Geocode was not successful for the following reason: " + status); 583 setStatus('There was a problem geocoding with the specified location,'+ 584 ' please make your search more specific and try again. status:'+ 585 status, 'update', false); 586 587 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'search-place-address-section' }, backHandler); 588 jQuery('#search-place-address-section').append(jQuery('#back-action')); 589 jQuery('#search-place-address-section').append(jQuery('#cancel-finder-workflow')); 590 jQuery('#search-place-address-section').show(); 591 592 } 593 }); 594 595 } 596 597 598 599 } else if(phase=='edit-place-name-section'){ 600 601 602 selectedPlace.properties.name = jQuery("#edit-place-name").val(); 603 jQuery('#edit-place-name-selected').html(selectedPlace.properties.name); 604 605 //put the address search in the top 606 jQuery('#place-street-title').html('Location: Enter full street address where the place is as one line ie. 1714 Franklin Street, Oakland, CA 94612'); 607 608 var section = jQuery('#edit-place-address-section'); 609 section.append(jQuery('#edit-place-name-selected')); 610 section.append(jQuery('#street-name-input')); 611 section.append(jQuery('#street-address-saved')); 612 section.append(jQuery('#back-action')); 613 section.append(jQuery('#next-action')); 614 jQuery('#back-action').show(); 615 section.show(); 616 617 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'edit-place-address-section' }, nextHandler); 618 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'edit-place-address-section' }, backHandler); 619 620 621 } else if(phase=='edit-place-address-section'){ 622 623 setStatus('Geocoding...','message', true); 624 var address = jQuery('#edit-place-street').val(); 625 626 var section = jQuery('#edit-place-address-section'); 627 section.append(jQuery('#back-action')); 628 section.append(jQuery('#next-action')); 629 jQuery('#back-action').show(); 630 section.show(); 631 632 jQuery('#edit-geocoded-section').append(jQuery('#back-action')); 633 634 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'edit-geocoded-section' }, backHandler); 635 636 geocoder.geocode( { 'address': address}, function(results, status) { 637 if (status == google.maps.GeocoderStatus.OK && validGeocodeForSearch(results[0])) { 638 jQuery('#edit-geocoded-name-selected').html(selectedPlace.properties.name); 639 jQuery('#edit-geocoded-address-selected').html(results[0].formatted_address); 640 641 jQuery('#edit-geocoded-section').append(jQuery('#map_canvas')); 642 643 //do the map stuff 644 selectedGeocode = results[0]; 645 646 //set the model 647 selectedPlace.properties.address = 648 getShortNameForType("street_number", selectedGeocode.address_components)+' '+ 649 getShortNameForType("route", selectedGeocode.address_components); 650 651 selectedPlace.properties.city = 652 getShortNameForType("locality", selectedGeocode.address_components); 653 654 selectedPlace.properties.province = 655 getShortNameForType("administrative_area_level_1", selectedGeocode.address_components); 656 657 selectedPlace.properties.postcode = 658 getShortNameForType("postal_code", selectedGeocode.address_components); 659 660 selectedPlace.properties.country = 661 getShortNameForType("country", selectedGeocode.address_components); 662 663 selectedPlace.geometry.coordinates = []; 664 selectedPlace.geometry.coordinates.push(selectedGeocode.geometry.location.lng()); 665 selectedPlace.geometry.coordinates.push(selectedGeocode.geometry.location.lat()); 666 667 var myOptions = { 668 zoom: 15, 669 mapTypeId: google.maps.MapTypeId.ROADMAP 670 }; 671 672 if(map==null){ 673 map = new google.maps.Map(document.getElementById("map_canvas"), 674 myOptions); 675 } 676 677 deleteOverlays(); 678 map.setCenter(selectedGeocode.geometry.location); 679 addMarker(map,selectedGeocode.geometry.location); 680 681 setStatus('','message', false); 682 683 jQuery('.resetable', jQuery('#edit-geocoded-section')).show(); 684 jQuery('#edit-geocoded-section').show(); 685 686 getCategories(null, null); 687 688 689 } else { 690 setStatus('There was a problem geocoding with the specified location,'+ 691 ' please make your search more specific and try again. status:'+ 692 status, 'update', false); 693 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'edit-place-address-section' }, backHandler); 694 jQuery('#edit-place-address-section').append(jQuery('#back-action')); 695 jQuery('#edit-place-address-section').append(jQuery('#cancel-finder-workflow')); 696 jQuery('#edit-place-address-section').show(); 697 } 698 }); 699 } 700 701 if(!error){ 702 jQuery('#'+phase).hide(); 703 } 704 705 return false; 706 } 707 708 function backHandler(event) { 709 console.log('back phase:'+event.data.phase); 710 setStatus('','message', false); 711 var phase = event.data.phase; 712 if(phase=='search-place-name-section'){ 713 jQuery('#place-selector-form').hide(); 714 jQuery('#cancel-finder-workflow').hide(); 715 jQuery('#associate-place-section').append(jQuery('#next-action')); 716 717 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'associate-place-section' }, nextHandler); 718 719 jQuery('#associate-place-section').show(); 720 721 } else if(phase=='search-place-address-section') { 722 var section = jQuery('#search-place-name-section'); 723 section.append(jQuery('#back-action')); 724 section.append(jQuery('#next-action')); 725 726 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'search-place-name-section' }, nextHandler); 727 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'search-place-name-section' }, backHandler); 728 729 jQuery('#search-geocoded-section').hide(); 730 731 section.show(); 732 733 } else if(phase=='search-geocoded-section') { 734 jqxhr.abort(); 735 jQuery('#welocally-post-error').html(''); 736 jQuery('#search-geocoded-section').hide(); 737 jQuery('#search-place-address-section').show(); 738 jQuery("#results").show(); 739 740 } else if (phase =='edit-place-address-section'){ 741 var section = jQuery('#edit-place-name-section'); 742 section.append(jQuery('#back-action')); 743 section.append(jQuery('#next-action')); 744 jQuery('#edit-geocoded-section').hide(); 745 jQuery('#categories-section').hide(); 746 jQuery('#edit-place-optional-section').hide(); 747 748 section.show(); 749 750 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'edit-place-name-section' }, nextHandler); 751 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'edit-place-name-section' }, backHandler); 752 753 } else if (phase =='edit-geocoded-section' || phase=='edit-place-optional-section' ){ 754 755 var section = jQuery('#edit-place-address-section'); 756 757 section.append(jQuery('#back-action')); 758 section.append(jQuery('#next-action')); 759 760 jQuery('#edit-geocoded-section').hide(); 761 jQuery('#categories-section').hide(); 762 763 //reset cat selector type 764 selectedClassifierLevel=''; 765 selectedPlace.classifiers[0].type=''; 766 selectedPlace.classifiers[0].category=''; 767 selectedPlace.classifiers[0].subcategory=''; 768 769 jQuery('#edit-place-categories-selected-list').html(''); 770 771 jQuery('#edit-place-optional-section').hide(); 772 773 section.show(); 774 775 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'edit-place-address-section' }, nextHandler); 776 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'edit-place-address-section' }, backHandler); 777 778 } 779 780 781 782 jQuery('#'+phase).hide(); 783 return false; 784 785 } 172 786 173 787 jQuery(document).ready(function(jQuery) { 174 //is this an autoload? 175 jQuery.each(tags, function(i,tag){ 176 if(tag == 'Autoload'){ 177 jQuery("input[name='isWLPlace']").val('true'); 178 autoload(tags); 179 } 180 }); 181 182 if (typeof(jQuery.fn.parseJSON) == "undefined" || typeof(jQuery.parseJSON) != "function") { 183 184 //extensions, this is because prior to 1.4 there was no parse json function 185 jQuery.extend({ 186 parseJSON: function( data ) { 187 if ( typeof data !== "string" || !data ) { 188 return null; 189 } 190 data = jQuery.trim( data ); 191 if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") 192 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") 193 .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { 194 return window.JSON && window.JSON.parse ? 195 window.JSON.parse( data ) : 196 (new Function("return " + data))(); 197 } else { 198 jQuery.error( "Invalid JSON: " + data ); 199 } 200 } 201 }); 202 } 203 788 789 WELOCALLY.env.initJQuery(); 790 791 //all sections hidden 792 jQuery('.resetable').hide(); 793 794 activityType = 'search'; 795 796 geocoder = new google.maps.Geocoder(); 797 204 798 var selectedPlaceObject = null; 205 799 206 <?php if( $_isWLPlace == 'true') : ?> 207 jQuery("#placeForm").show(); 208 <?php endif; ?> 209 210 <?php if( $_PlaceSelected != '') : ?> 211 selectedPlaceObject = jQuery.parseJSON( '<?php echo $bodytag = str_replace("'", "\'", $_PlaceSelected); ?>' ); 212 setSelectedPlaceInfo(selectedPlaceObject); 213 <?php endif; ?> 214 215 216 jQuery("#welocally_default_search_radius").val('<?php echo wl_get_option('default_search_radius',null) ?>'); 217 218 219 220 jQuery( "#search-places-action" ).click(function() { 221 var missingRequired = false; 222 var fields = ''; 223 if (!jQuery("#place-address").val().match(/\S/)) { 224 missingRequired = true; 225 fields = fields+'Place Address - '; 226 } 227 if (!jQuery("#place-search").val().match(/\S/)) { 228 missingRequired = true; 229 fields = fields+'Search Term - '; 230 } 231 232 233 if(missingRequired){ 234 buildMissingFieldsErrorMessages(fields); 235 return false; 236 } 237 238 getLocationsByAddress( 239 jQuery('#place-address').val(), 240 jQuery('#place-search').val(), 241 jQuery('#welocally_default_search_radius').val()); 242 return false; 243 }); 244 245 jQuery( "#add-place-action" ).click(function() { 246 247 jQuery('#welocally-post-error').removeClass('welocally-error welocally-update error updated fade'); 800 //init buttons 801 jQuery( 'a, input:submit, button','.action' ).button(); 802 jQuery( '#next-action,#cancel-finder-workflow,#btn-new-select,#back-action,#save-place-action' ).button(); 803 804 //resets all and starts over 805 jQuery('#cancel-finder-workflow,#btn-new-select' ).bind('click' , { phase: 'associate-place-section' }, cancelHandler); 806 807 808 jQuery('#next-action' ).bind('click' , { phase: 'associate-place-section' }, nextHandler); 809 810 jQuery('#welocally_default_search_radius').val('8'); 811 812 //startup phase state 813 jQuery('#associate-place-section').append(jQuery('#associate-input')); 814 jQuery('#associate-place-section').append(jQuery('#next-action')); 815 816 817 jQuery( '#add-place-action' ).click(function() { 818 819 //put the fields 820 //put the name search in the top 821 jQuery('#edit-place-name-section').append(jQuery('#place-name-title')); 822 jQuery('#edit-place-name-section').append(jQuery('#place-name-input')); 823 jQuery('#edit-place-name-section').append(jQuery('#place-name-saved')); 824 jQuery('#place-name-saved').hide(); 825 jQuery('#place-name-input').show(); 826 jQuery('#place-name-title').html('Place Name: Enter the <strong>full name</strong> of the place you want to add.'); 827 828 jQuery('#welocally-post-error').removeClass('welocally-error error welocally-update updated fade'); 248 829 jQuery('#welocally-post-error').html(''); 249 250 jQuery("#place-selector").hide(); 251 jQuery("#add-place-form").show(); 252 830 jQuery('#results').hide(); 831 jQuery('#place-selector').hide(); 832 jQuery('#edit-place-form').show(); 833 jQuery('#map_canvas').height( 401 ); 834 jQuery('#map_canvas').width( '100%' ); 835 253 836 return false; 254 837 }); 255 838 256 jQuery( "#cancel-add-link" ).click(function() { 257 jQuery("#add-place-form").hide(); 258 if(selectedPlaceObject == null) { 259 jQuery("#place-selector").show(); 260 } else { 261 jQuery("#place-selector").show(); 262 } 263 return false; 264 }); 265 266 267 jQuery( "#btn-new-select" ).click(function() { 268 isSelected=false; 269 jQuery("#selected-place").hide(); 270 jQuery("#place-selector").show(); 271 return false; 272 }); 273 839 274 840 //saves a new place 275 jQuery( "#save-place-action" ).click(function() { 276 277 jQuery('#welocally-post-error').removeClass('welocally-error welocally-update error updated fade'); 278 jQuery('#welocally-post-error').html('<em>Saving New Place...</em>'); 841 jQuery( '#save-place-action' ).click(function() { 842 843 setStatus('Saving Place...', 'message', true); 844 845 var options = { 846 action: 'save_place' 847 }; 279 848 280 849 var missingRequired = false; 281 850 var fields = ''; 282 if (!jQuery("#add-place-name").val().match(/\S/)) { 283 missingRequired = true; 284 fields = fields+'Place Name - '; 285 } 286 if (!jQuery("#add-place-street").val().match(/\S/)) { 287 missingRequired = true; 288 fields = fields+'Street Address - '; 289 } 290 if (!jQuery("#add-place-city").val().match(/\S/)) { 291 missingRequired = true; 292 fields = fields+'City - '; 293 } 294 if (!jQuery("#add-place-state").val().match(/\S/)) { 295 missingRequired = true; 296 fields = fields+'State or Provence - '; 297 } 298 if (!jQuery("#add-place-zip").val().match(/\S/)) { 299 missingRequired = true; 300 fields = fields+'Postal Code - '; 301 } 302 303 if(missingRequired){ 304 buildMissingFieldsErrorMessages(fields); 305 return false; 851 852 if(jQuery('#edit-place-phone').val() != null){ 853 selectedPlace.properties.phone=jQuery('#edit-place-phone').val(); 306 854 } 307 308 309 var options = { 310 action: 'add_place', 311 siteKey : '<?php echo wl_get_option('siteKey',null) ?>', 312 siteToken : '<?php echo wl_get_option('siteToken',null) ?>', 313 baseurl : '<?php echo wl_get_option('siteHome',get_bloginfo('home')); ?>', 314 placeName: jQuery('#add-place-name').val(), 315 placeStreet: jQuery('#add-place-street').val(), 316 placeCity: jQuery('#add-place-city').val(), 317 placeState: jQuery('#add-place-state').val(), 318 placeZip: jQuery('#add-place-zip').val(), 319 placePhone: jQuery('#add-place-phone').val(), 320 placeWeb: jQuery('#add-place-web').val(), 321 placeCats: jQuery('#add-place-cats').val() 322 323 }; 324 325 326 327 jQuery.ajax({ 328 type: 'POST', 855 856 if(jQuery('#edit-place-web').val() != null){ 857 selectedPlace.properties.website=jQuery('#edit-place-web').val(); 858 } 859 860 //this will get changed to PUT by the ajax admin function 861 options.place = selectedPlace; 862 863 jqxhr = jQuery.ajax({ 864 type: 'POST', 329 865 url: ajaxurl, 330 dataType: 'json',331 866 data: options, 867 dataType : 'json', 868 beforeSend: function(jqXHR){ 869 jqxhr = jqXHR; 870 }, 332 871 error : function(jqXHR, textStatus, errorThrown) { 333 console.error(textStatus); 334 jQuery('#welocally-post-error').html('ERROR : '+textStatus); 335 jQuery('#welocally-post-error').addClass('welocally-error error fade'); 872 if(textStatus != 'abort'){ 873 setStatus('ERROR : '+textStatus, 'error', false); 874 } else { 875 console.log(textStatus); 876 } 336 877 }, 337 878 success : function(data, textStatus, jqXHR) { 338 879 jQuery('#welocally-post-error').html(''); 339 if(data .errors != null) {880 if(data != null && data.errors != null) { 340 881 buildErrorMessages(data.errors); 341 882 } else { 342 setSelectedPlaceInfo(data); 883 selectedPlace._id=data.id; 884 setStatus('Your new place has been added!', 'message', false); 885 setSelectedPlaceInfo(selectedPlace, WELOCALLY.meta.post); 343 886 } 344 887 } … … 348 891 return false; 349 892 }); 350 351 jQuery("input[name='deletePlaceInfo']").change(function(){ 352 353 if(jQuery("input[name='deletePlaceInfo']").is(':checked')){ 354 var radios = jQuery('input:radio[name=isWLPlace]'); 355 jQuery(radios).filter('[value=false]').attr('checked', true); 356 jQuery("#placeForm").hide(); 357 358 } 359 }); 360 361 jQuery("input[name='isWLPlace']").change(function(){ 362 if (jQuery("input[name='isWLPlace']:checked").val() == 'true') { 363 364 365 jQuery("#placeForm").show(); 366 367 //no place has been selected yet 368 if(selectedPlaceObject == null) { 369 jQuery("#place-selector").show(); 370 } 371 372 } else if (jQuery("input[name='isWLPlace']:checked").val() == 'false') { 373 jQuery("#placeForm").hide(); 374 } 375 }); 893 376 894 377 895 jQuery( "#selectable" ).selectable({ 378 896 selected: function(event, ui) { 379 selectedFeatureIndex = jQuery("#scroller-places li").index(ui.selected); 380 setSelectedPlaceInfo(jsonObjFeatures[selectedFeatureIndex] );897 selectedFeatureIndex = jQuery("#scroller-places li").index(ui.selected); 898 setSelectedPlaceInfo(jsonObjFeatures[selectedFeatureIndex], WELOCALLY.meta.post); 381 899 } 382 900 }); … … 384 902 jQuery( "#selectable-cat" ).selectable({ 385 903 selected: function(event, ui) { 386 if(selectedCategories.indexOf(ui.selected.inner Text) == -1) {387 selectedCategories = selectedCategories + ui.selected.inner Text+",";904 if(selectedCategories.indexOf(ui.selected.innerHTML) == -1) { 905 selectedCategories = selectedCategories + ui.selected.innerHTML+","; 388 906 } 389 907 jQuery( "#place-categories-selected" ).val(selectedCategories); … … 398 916 }); 399 917 400 401 <?php if( $isPlaceChecked == 'true') : ?> 402 jQuery("#placeForm").show(); 403 <?php endif; ?> 918 jQuery( "#edit-place-categories-selection-list" ).selectable({ 919 selected: function(event, ui) { 920 921 if(selectedClassifierLevel == 'Type'){ 922 selectedPlace.classifiers[0].type = ui.selected.innerHTML; 923 } else if(selectedClassifierLevel == 'Category'){ 924 selectedPlace.classifiers[0].category = ui.selected.innerHTML; 925 } else if(selectedClassifierLevel == 'Subcategory'){ 926 selectedPlace.classifiers[0].subcategory = ui.selected.innerHTML; 927 } 928 929 jQuery( "#edit-place-categories-selected-list") 930 .append( 931 '<li class="categories-selected-list-item">'+ 932 selectedClassifierLevel+':'+ui.selected.innerHTML+'</li>'); 933 934 if(selectedPlace.classifiers[0].type != '' && 935 selectedPlace.classifiers[0].category != '' && 936 selectedPlace.classifiers[0].subcategory != '') { 937 938 //finished 939 jQuery( '#edit-place-categories-selection').hide(); 940 jQuery( '#save-place-action').show(); 941 jQuery( '#edit-place-optional-section').show(); 942 jQuery('#add-place-actions-section').append(jQuery('#back-action' )); 943 jQuery('#back-action' ).unbind('click').bind('click' , { phase: 'edit-place-optional-section' }, backHandler); 944 945 946 947 } else { 948 var type = null; 949 var category = null; 950 if(selectedPlace.classifiers[0].type != '') 951 type= selectedPlace.classifiers[0].type; 952 if(selectedPlace.classifiers[0].category != '') 953 category= selectedPlace.classifiers[0].category; 954 955 getCategories(type, category); 956 } 957 958 }, 959 unselected: function(event, ui) { 960 961 } 962 }); 963 964 965 jQuery( '#add-new-place-action' ).click(function() { 966 967 setStatus('', 'message', false); 968 969 jQuery("#place-selector").hide(); 970 971 jQuery('#place-name-title').html('Place Name: Enter the common name of the place, ie. "Treehouse Coffee Shop"'); 972 973 var section = jQuery('#edit-place-name-section'); 974 section.append(jQuery('#edit-place-name-title')); 975 section.append(jQuery('#place-name-input')); 976 section.append(jQuery('#place-name-saved')); 977 section.append(jQuery('#next-action')); 978 section.show(); 979 980 jQuery('#next-action' ).unbind('click').bind('click' , { phase: 'edit-place-name-section' }, nextHandler); 981 jQuery('#back-action' ).unbind('click'); 982 983 jQuery("#edit-place-form").show(); 984 985 return false; 986 987 }); 988 989 jQuery( "#selectable-cat" ).selectable({ 990 selected: function(event, ui) { 991 if(selectedCategories.indexOf(ui.selected.innerHTML) == -1) { 992 selectedCategories = selectedCategories + ui.selected.innerHTML+","; 993 } 994 jQuery( "#place-categories-selected" ).val(selectedCategories); 995 }, 996 unselected: function(event, ui) { 997 if(selectedCategories.indexOf(ui.unselected.innerText) != -1) { 998 var replaceText = ui.unselected.innerText+","; 999 selectedCategories = selectedCategories.replace(new RegExp(replaceText, 'g'),""); 1000 jQuery( "#place-categories-selected" ).val(selectedCategories); 1001 } 1002 } 1003 }); 404 1004 405 1005 406 1006 }); 407 408 1007 </script> 409 1008 <style type="text/css"> … … 411 1010 #place-intro { margin-top: 5px; margin-bottom: 5px; } 412 1011 413 #place Form {1012 #place-selector-form { 414 1013 border-color:#dfdfdf; 415 1014 background-color:#F9F9F9; … … 425 1024 border-spacing:0; 426 1025 padding: 10px; 427 display:none;1026 428 1027 } 1028 1029 .welocally-error { 1030 border-color:#996666; 1031 background-color:#F9AAAA; 1032 border-width:1px; 1033 border-style:solid; 1034 -moz-border-radius:3px; 1035 -khtml-border-radius:3px; 1036 -webkit-border-radius:3px; 1037 border-radius:3px; 1038 margin: 0; 1039 width:95%; 1040 border-style:solid; 1041 border-spacing:0; 1042 padding: 10px; 1043 margin-bottom: 5px; 1044 color:#996666; 1045 display:none; 1046 } 1047 1048 .error-txt { 1049 color:#850F00; 1050 font-weight:bold; 1051 font-size:1.0em; 1052 } 1053 1054 1055 .verified-geocode { 1056 border-color:#245E07; 1057 background-color:#B7ED9D; 1058 border-width:2px; 1059 border-style:solid; 1060 -moz-border-radius:3px; 1061 -khtml-border-radius:3px; 1062 -webkit-border-radius:3px; 1063 border-radius:3px; 1064 margin: 0px; 1065 border-style:solid; 1066 border-spacing:0; 1067 padding: 0px; 1068 margin-bottom: 5px; 1069 color:#245E07; 1070 display:inline-block; 1071 } 1072 1073 .error-geocode { 1074 border-color:#8A0E0E; 1075 background-color:#E68C8C; 1076 border-width:2px; 1077 border-style:solid; 1078 -moz-border-radius:3px; 1079 -khtml-border-radius:3px; 1080 -webkit-border-radius:3px; 1081 border-radius:3px; 1082 margin: 0px; 1083 border-style:solid; 1084 border-spacing:0; 1085 padding: 0px; 1086 margin-bottom: 0px; 1087 color:#8A0E0E; 1088 display:inline-block; 1089 } 429 1090 430 1091 #add-span { } … … 443 1104 } 444 1105 445 /* ------- is place */ 446 #all_place_info { width: 100%; } 1106 .field-title{ 1107 font-size:1.2em; 1108 margin-top: 10px; 1109 color: #808080; 1110 } 447 1111 448 1112 /* ------ selection form */ 449 #place-selector { margin-bottom: 10px; display:none;}1113 #place-selector { margin-bottom: 10px;} 450 1114 #scroller-places { height: 240px; width: 100%; overflow-y: scroll;} 451 1115 .search-field { width: 100%; margin-bottom: 10px; } … … 456 1120 #selectable li { margin: 3px 3px 3px 0; padding: 0.2em; cursor: pointer; } 457 1121 #categories-choice { margin-bottom: 10px; display:none; } 1122 458 1123 459 1124 /* ------ selected place */ … … 469 1134 470 1135 /* ------ add new place */ 471 #add-place-form { margin-bottom: 10px; width: 100%; display:none; } 1136 #edit-place-form { margin-bottom: 10px; width: 100%; display:none; } 1137 .edit-field { width: 100%; margin-bottom: 10px; display:inline-block; font-size:1.2em; } 1138 .selected-field { width: 100%; height: 15px; margin-bottom: 5px; display:inline-block; font-size:1.4em; } 1139 1140 .tag-field { width: 100%; height: 15px; margin-bottom: 5px; 1141 display:inline-block; 1142 font-weight:bold;color:#696969; 1143 text-align:left;font-family:courier new, courier, monospace;line-height:1; 1144 font-size:1.0em; } 1145 1146 #edit-place-categories-selection-list .ui-selecting { background: #AAAAAA; color: black; } 1147 #edit-place-categories-selection-list .ui-selected { 1148 background: #7A5207; color: white; 1149 } 1150 #edit-place-categories-selection-list { list-style-type: none; margin: 0; padding: 0; } 1151 #edit-place-categories-selection-list li { 1152 margin: 3px 3px 3px 0; padding: 0.2em; cursor: pointer; 1153 border-color:#4E8727; 1154 background-color:#C4F2A5; 1155 border-width:1px; 1156 border-style:solid; 1157 -moz-border-radius:3px; 1158 -khtml-border-radius:3px; 1159 -webkit-border-radius:3px; 1160 border-radius:3px; 1161 border-style:solid; 1162 border-spacing:0; 1163 color:#4E8727; 1164 display:inline-block; 1165 } 1166 1167 .categories-selected-list-item { 1168 border-color:#737373; 1169 background-color:#505050; 1170 border-width:0px; 1171 border-style:solid; 1172 -moz-border-radius:3px; 1173 -khtml-border-radius:3px; 1174 -webkit-border-radius:3px; 1175 border-radius:3px; 1176 margin: 0px; 1177 border-style:solid; 1178 border-spacing:0; 1179 font-size:1.2em; 1180 padding: 5px; 1181 margin-right: 5px; 1182 color:#FFFFFF; 1183 display:inline-block; 1184 } 472 1185 473 1186 </style> 474 <div id="place-intro"> 475 <div id="welocally-post-error"></div> 476 <?php 477 if(is_subscribed()): 478 479 try { 480 do_action('sp_places_post_errors', $postId ); 481 if( !$this->postExceptionThrown ) delete_post_meta( $postId, self::WLERROROPT ); 482 } catch ( WLPLACES_Post_Exception $e) { 483 $this->postExceptionThrown = true; 484 update_post_meta( $postId, self::WLERROROPT, trim( $e->getMessage() ) ); 485 $e->displayMessage( $postId ); 486 } 487 488 489 ?> 490 <div> 491 <?php _e('Delete place info for this post?',$this->pluginDomain); ?> 492 <label><input type='radio' name='deletePlaceInfo' value='true' /> <b><?php _e('Yes', $this->pluginDomain); ?></b></label> 493 </div> 494 <div> 495 <?php _e('Associate a place with this post?',$this->pluginDomain); ?> 496 <label><input type='radio' name='isWLPlace' value='true' <?php echo $isPlaceChecked; ?> /> <b><?php _e('Yes', $this->pluginDomain); ?></b></label> 497 <label><input type='radio' name='isWLPlace' value='false' <?php echo $isNotPlaceChecked; ?> /> <b><?php _e('No', $this->pluginDomain); ?></b></label> 498 </div> 499 </div> 500 <div id="placeForm"> 501 <input type="hidden" id="place-selected" name="PlaceSelected"> 502 <input type="hidden" id="place-categories-selected" name="PlaceCategoriesSelected"> 503 <div id="all_place_info"> 504 <!-- start place selector --> 505 <div id="place-selector"> 506 <div class="meta-title2">Select Place</div> 507 <div> 508 <div>*<em>Please enter the closest address, this can just be the city and state (ie. Oakland, CA), or the full address...</em> REQUIRED</div> 509 <div style="margin-bottom:5px"> 510 <input type="text" id="place-address" 511 class="search-field" 512 value="<?php echo wl_get_option('default_search_addr',null) ?>"> 513 <select id="welocally_default_search_radius" name="welocally_default_search_radius" > 514 <option value="2">2 km</option> 515 <option value="4">4 km</option> 516 <option value="8">8 km</option> 517 <option value="12">12 km</option> 518 <option value="16">16 km</option> 519 <option value="25">25 km</option> 520 <option value="50">50 km</option> 521 </select> <em>Distance in Km</em> 522 523 </div> 524 <div>*<em>What is the name of the place you are writing about or a simillar keyword...</em> REQUIRED</div> 525 <div><input type="text" id="place-search" class="search-field"></div> 526 <div> 527 <button id="search-places-action">find places</button> 528 <span id="add-span">don't see a match? <button id="add-place-action">add new place</button></span> 529 </div> 530 </div> 531 <div id="results"> 1187 <body> 1188 <div style="display:none"> 1189 1190 <div id="associate-input" class="action" style="display:inline-block" > 1191 <div style="display:inline-block" class="selected-field">Associate a place with this post? </div> 1192 </div> 1193 1194 <div id="place-name-input" class="action" style="display:inline-block"> 1195 <div id="place-name-title" class="field-title">*Place Name: <em>Required</em></div> 1196 <input type="text" id="edit-place-name" name="edit-place-name" class="edit-field"> 1197 <button id="save-place-name-action" href="#" style="display:none">Save</button> 1198 </div> 1199 1200 <div id="street-name-input" class="action" style="display:inline-block"> 1201 <div id="place-street-title" class="field-title">*Full Address: <em>Required</em></div> 1202 <input type="text" id="edit-place-street" name="edit-place-street" class="edit-field"> 1203 </div> 1204 1205 1206 <div class="resetable" id="map_canvas" style="width:100%; height:300px;"></div> 1207 <div class="resetable" id="results"> 532 1208 <div id="scroller-places"> 533 1209 <ol id="selectable"> 534 1210 </ol> 535 1211 </div> 536 </div> 537 </div> 538 <!-- end place selector --> 539 <!-- start place selector --> 540 <div id="selected-place"> 541 <div class="meta-title2">Selected Place</div> 542 <div id="selected-place-info"></div> 543 <div id="categories-choice"> 544 <strong><?php _e('Choose categories for post:',$this->pluginDomain); ?></strong> 545 <ol id="selectable-cat"></ol> 546 </div> 547 <button id="btn-new-select" href="#">new selection</button> 548 </div> 549 <!-- end place selector --> 550 <!-- add place form --> 551 <div id="add-place-form"> 552 <div class="meta-title2">Add New Place</div> 553 Place Name: <em>Required</em></br> 554 <input type="text" id="add-place-name" name="add-place-name" class="search-field"></br> 555 Street Address: <em>Required</em></br> 556 <input type="text" id="add-place-street" name="add-place-street" class="search-field"></br> 557 City: <em>Required</em></br> 558 <input type="text" id="add-place-city" name="add-place-city" class="search-field"></br> 559 State or Provence: <em>Required</em></br> 560 <input type="text" id="add-place-state" name="add-place-state" class="search-field"></br> 561 Zip or Postal Code: <em>Required</em></br> 562 <input type="text" id="add-place-zip" name="add-place-zip" class="search-field"></br> 563 Phone Number: (optional):</br> 564 <input type="text" id="add-place-phone" name="add-place-phone" class="search-field"></br> 565 Website: (optional):</br> 566 <input type="text" id="add-place-web" name="add-place-web" class="search-field"></br> 567 Categories (comma seperated):</br> 568 <input type="text" id="add-place-cats" name="add-place-cats" class="search-field"></br> 569 <button id="cancel-add-link" href="#">Cancel</button> 570 <button id="save-place-action" href="#">Add Place</button> 571 </div> 572 <!-- end add place form --> 573 574 </div> 575 576 <?php else: 577 echo '<div class="error fade"><p><strong>' . __( 'Please Subscribe To Activate Welocally Places' ) . "</strong></p></div>\n"; 578 endif;?> 579 </div> 1212 <div id="add-place-section" class="resetable action" style="margin-top:10px;" > 1213 <div class="selected-field"><em>Can't find the place you are looking for?</em></div> 1214 <button id="add-new-place-action" href="#">Add Place</button> 1215 </div> 1216 </div> 1217 1218 <button id="next-action" href="#">Next</button> 1219 <button id="back-action" href="#">Back</button> 1220 </div> 1221 <div class="container"> 1222 <div class="span-24"> 1223 <div id="welocally-post-error" style="display:none">No Errors...</div> 1224 <div> 1225 <div id="associate-place-section"></div> 1226 </div> 1227 <input type="hidden" id="place-selected" name="PlaceSelected"> 1228 <input type="hidden" id="place-categories-selected" name="PlaceCategoriesSelected"> 1229 1230 <div id="place-selector-form" style="display:none"> 1231 <div id="all_place_info"> 1232 <!-- start place selector --> 1233 <div id="place-selector"> 1234 <div class="meta-title2">Search Places</div> 1235 1236 <div class="resetable" id="search-place-name-section"></div> 1237 1238 <div class="resetable" id="search-place-address-section"> 1239 <div id="edit-place-name-selected" class="selected-field"> </div> 1240 </div> 1241 1242 <div class="resetable" id="search-geocoded-section"> 1243 <div id="search-geocoded-name-selected" class="selected-field"> </div> 1244 <div id="search-geocoded-address-selected" class="selected-field"> </div> 1245 <div id="places-tag-selected" style="display:none; margin-bottom:10px;"> 1246 <div class="tag-line"> 1247 <div><em>Place this tag in your edit area to link to post. Or use the Welocally TinyMCE button to insert.</em></div> 1248 <div><input class="search-field post-place-tag-tagtext" type="text" id="share-meta-tagtext"></input></div> 1249 </div> 1250 </div> 1251 </div> 1252 1253 <div class="resetable" id="place-find-range-section" style="display:none"> 1254 <select id="welocally_default_search_radius" name="welocally_default_search_radius" > 1255 <option value="2">2 km</option> 1256 <option value="4">4 km</option> 1257 <option value="8">8 km</option> 1258 <option value="12">12 km</option> 1259 <option value="16">16 km</option> 1260 <option value="25">25 km</option> 1261 <option value="50">50 km</option> 1262 </select> <em>Distance in Km</em> 1263 </div> 1264 1265 <div class="resetable" id="place-find-query-section" style="display:none"> 1266 <div>*<em>What is the name of the place you are writing about or a simillar keyword...</em> REQUIRED</div> 1267 <div><input type="text" id="place-search" class="class="search-field"" value="foo"></div> 1268 </div> 1269 1270 <div class="resetable" id="place-find-actions" class="action" style="display:none"> 1271 <button id="search-places-action">Find Places</button> 1272 </div> 1273 </div> 1274 1275 </div> 1276 <!-- end place selector --> 1277 <!-- start place selector --> 1278 <div id="selected-place" class="resetable"> 1279 <div class="meta-title2">Selected Place</div> 1280 <div id="selected-place-info"></div> 1281 <div id="categories-choice"> 1282 <div class="meta-title2">Choose categories for post</div> 1283 <ol id="selectable-cat"></ol> 1284 </div> 1285 <div class="action"><button id="btn-new-select" href="#">New Selection</button></div> 1286 </div> 1287 <!-- end place selector --> 1288 1289 <!-- add place form --> 1290 <div id="edit-place-form"> 1291 <div id="place-form-title" class="meta-title2">Add New Place</div> 1292 1293 <div class="resetable" id="edit-place-name-section"></div> 1294 1295 <div class="resetable" id="edit-place-address-section" style="display:none"></div> 1296 1297 <div class="resetable" id="edit-geocoded-section"> 1298 <div id="edit-geocoded-name-selected" class="selected-field"> </div> 1299 <div id="edit-geocoded-address-selected" class="selected-field"> </div> 1300 </div> 1301 1302 <div class="resetable" id="categories-section" style="display:none"> 1303 <div style="margin-top:10px; height:20px;" class="field-title">*Category Info: <em>Required</em></div> 1304 <div id="edit-place-categories-selected"><ul id="edit-place-categories-selected-list"></ul></div> 1305 <div id="edit-place-categories-selection"><ul id="edit-place-categories-selection-list" style="display:inline-block; list-style:none;"></ul></div> 1306 </div> 1307 1308 <div class="resetable" id="edit-place-optional-section" style="display:none"> 1309 <div style="margin-top:10px; margin-bottom:5px;"><em>These fields are optional but it is strongly reccomended that you include the phone number and website.</em></div> 1310 <div id="step-phone"> 1311 Phone Number: (optional):</br> 1312 <input type="text" id="edit-place-phone" name="edit-place-phone" class="edit-field"> 1313 </div> 1314 <div id="step-web"> 1315 Website: (optional):</br> 1316 <input type="text" id="edit-place-web" name="edit-place-web" class="edit-field"> 1317 </div> 1318 </div> 1319 1320 <div class="resetable" id="add-place-actions-section" class="action" style="display:inline-block; margin-top:10px;"> 1321 <button id="cancel-finder-workflow" href="#">Cancel</button> 1322 <button id="save-place-action" href="#" style="display:none">Save</button> 1323 </div> 1324 </div> 1325 <!-- end add place form --> 1326 1327 </div> <!-- end add place form --> 1328 1329 1330 </div> 1331 </div> -
welocally-places/trunk/views/themes/chateau/welocally-places-list-widget-display.php
r466267 r514360 3 3 $index = 0; 4 4 echo '<li class="widget sidebar-item"><h3 class="widget-title">'.$title.'</h3><div><ul class="wl-places-list">'; 5 foreach( $posts as $post ) { ?> 5 6 foreach ($posts as $post): 7 foreach (get_post_places($post) as $place): 8 ?> 6 9 7 10 <?php /** … … 11 14 * @return string 12 15 */ 13 $PlaceSelected = get_post_meta( $post->ID, '_PlaceSelected', true );16 $PlaceSelected = $place; 14 17 15 18 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post') : … … 20 23 21 24 <aside> 22 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $ post->ID; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div>23 <div id="plugin-place<?php echo $ post->ID; ?>"></div>25 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $index; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div> 26 <div id="plugin-place<?php echo $index; ?>"></div> 24 27 </aside> 25 28 <?php endif; ?> 26 29 <?php 27 30 $index=$index+1; 28 } 31 endforeach; 32 endforeach; 29 33 echo "</ul></div></li>"; 30 34 ?> -
welocally-places/trunk/views/themes/chateau/welocally-places-map-widget-display.php
r473697 r514360 30 30 </div> 31 31 </div> 32 < div class="wl-place-widget-website text-align-right">32 <?php /*<div class="wl-place-widget-website text-align-right"> 33 33 <a href="<?php echo places_get_mapview_link(); ?>"> 34 34 <?php _e('view larger', $wlPlaces->pluginDomain)?> 35 35 </a> 36 </div> 36 </div>*/ ?> 37 37 </div> 38 38 </li> -
welocally-places/trunk/views/themes/default/category-places-map.php
r473697 r514360 29 29 $infobox_include = WP_PLUGIN_DIR . '/' .$wlPlaces->pluginDir . '/views/includes/infobox-map-include.php'; 30 30 include($infobox_include); 31 32 33 31 ?> 34 32 -
welocally-places/trunk/views/themes/default/welocally-places-list-widget-display.php
r463355 r514360 2 2 global $wlPlaces; 3 3 $index = 0; 4 echo '<li class="widget sidebar-item"><h3 class="widget-title">'.$title.'</h3><div><ul class="wl-places-list">'; 5 foreach( $posts as $post ) { ?> 4 echo '<aside class="widget sidebar-item"><h3 class="widget-title">'.$title.'</h3><div><ul class="wl-places-list">'; 5 6 foreach ($posts as $post): 7 foreach (get_post_places($post) as $place): 8 ?> 6 9 7 10 <?php /** … … 11 14 * @return string 12 15 */ 13 $PlaceSelected = get_post_meta( $post->ID, '_PlaceSelected', true );16 $PlaceSelected = $place; 14 17 15 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post') : 18 19 //inefficient 20 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post' && $index<$instance['limit'] ) : 16 21 17 22 $places_list_include = WP_PLUGIN_DIR . '/' .$wlPlaces->pluginDir . '/views/includes/places-list-include.php'; … … 20 25 21 26 <aside> 22 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $ post->ID; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div>23 <div id="plugin-place<?php echo $ post->ID; ?>"></div>27 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $index; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div> 28 <div id="plugin-place<?php echo $index; ?>"></div> 24 29 </aside> 25 30 <?php endif; ?> 26 31 <?php 27 32 $index=$index+1; 28 } 29 echo "</ul></div></li>"; 33 endforeach; 34 endforeach; 35 echo "</ul></div></aside>"; 30 36 ?> -
welocally-places/trunk/views/themes/default/welocally-places-map-widget-display.php
r473697 r514360 18 18 19 19 20 < liclass="widget sidebar-item">20 <aside class="widget sidebar-item"> 21 21 <h3 class="widget-title"><?php echo $title; ?></h3> 22 22 <div id="map_widget_container"> … … 29 29 </div> 30 30 </div> 31 <div class="wl-place-widget-website text-align-right"> 32 <a href="<?php echo places_get_mapview_link(); ?>"> 33 <?php _e('view larger', $wlPlaces->pluginDomain)?> 34 </a> 35 </div> 31 36 32 </div> 37 </ li>33 </aside> 38 34 -
welocally-places/trunk/views/themes/lightword/welocally-places-list-widget-display.php
r463355 r514360 3 3 $index = 0; 4 4 echo '<li class="widget sidebar-item"><h3 class="widget-title">'.$title.'</h3><div><ul class="wl-places-list">'; 5 foreach( $posts as $post ) { ?> 5 6 foreach ($posts as $post): 7 foreach (get_post_places($post) as $place): 8 ?> 6 9 7 10 <?php /** … … 11 14 * @return string 12 15 */ 13 $PlaceSelected = get_post_meta( $post->ID, '_PlaceSelected', true );16 $PlaceSelected = $place; 14 17 15 18 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post') : … … 19 22 20 23 <aside> 21 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $ post->ID; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div>22 <div id="plugin-place<?php echo $ post->ID; ?>"></div>24 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $index; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div> 25 <div id="plugin-place<?php echo $index; ?>"></div> 23 26 </aside> 24 27 <?php endif; ?> 25 28 <?php 26 29 $index=$index+1; 27 } 30 endforeach; 31 endforeach; 28 32 echo "</ul></div></li>"; 29 33 ?> -
welocally-places/trunk/views/themes/lightword/welocally-places-map-widget-display.php
r473697 r514360 28 28 </div> 29 29 </div> 30 <div class="wl-place-widget-website text-align-right"> 31 <a href="<?php echo places_get_mapview_link(); ?>"> 32 <?php _e('view larger', $wlPlaces->pluginDomain)?> 33 </a> 34 </div> 30 35 31 </div> 36 32 </li> -
welocally-places/trunk/views/themes/sight/welocally-places-list-widget-display.php
r473697 r514360 3 3 $index = 0; 4 4 echo '<aside class="widget sidebar-item"><h3 class="widget-title">'.$title.'</h3><div class="wl-places-list">'; 5 foreach( $posts as $post ) { ?> 5 6 foreach ($posts as $post): 7 foreach (get_post_places($post) as $place): 8 ?> 6 9 7 10 <?php /** … … 11 14 * @return string 12 15 */ 13 $PlaceSelected = get_post_meta( $post->ID, '_PlaceSelected', true );16 $PlaceSelected = $place; 14 17 15 18 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post') : … … 18 21 include($places_list_include);?> 19 22 20 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $ post->ID; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div>21 <div id="plugin-place<?php echo $ post->ID; ?>"></div>23 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $index; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div> 24 <div id="plugin-place<?php echo $index; ?>"></div> 22 25 <?php endif; ?> 23 26 <?php 24 27 $index=$index+1; 25 } 28 endforeach; 29 endforeach; 26 30 echo "</div></aside>"; 27 31 ?> -
welocally-places/trunk/views/themes/sight/welocally-places-map-widget-display.php
r473697 r514360 26 26 </div> 27 27 </div> 28 <div class="wl-place-widget-website text-align-right"> 29 <a href="<?php echo places_get_mapview_link(); ?>"> 30 <?php _e('view larger', $wlPlaces->pluginDomain)?> 31 </a> 32 </div> 28 33 29 </div> 34 30 </aside> -
welocally-places/trunk/views/themes/suffusion/welocally-places-list-widget-display.php
r466267 r514360 7 7 <div> 8 8 <h3 style="margin-left:5px;"><?php echo $title; ?></h3> 9 <?php foreach( $posts as $post ) { ?> 9 <?php 10 foreach ($posts as $post): 11 foreach (get_post_places($post) as $place): 12 ?> 10 13 11 14 <?php /** … … 15 18 * @return string 16 19 */ 17 $PlaceSelected = get_post_meta( $post->ID, '_PlaceSelected', true );20 $PlaceSelected = $place; 18 21 19 22 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post') : … … 24 27 25 28 <div style="margin-left:5px; margin-right:5px;"> 26 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $ post->ID; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div>27 <div id="plugin-place<?php echo $ post->ID; ?>"></div>29 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $index; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div> 30 <div id="plugin-place<?php echo $index; ?>"></div> 28 31 </div> 29 32 <?php endif; ?> 30 33 <?php 31 34 $index=$index+1; 32 } 35 endforeach; 36 endforeach; 33 37 ?> 34 38 </div> -
welocally-places/trunk/views/themes/suffusion/welocally-places-map-widget-display.php
r473697 r514360 30 30 </div> 31 31 </div> 32 <div class="wl-place-widget-website text-align-right">33 <a href="<?php echo places_get_mapview_link(); ?>">34 <?php _e('view larger', $wlPlaces->pluginDomain)?>35 </a>36 </div>37 32 </div> 38 33 </div> -
welocally-places/trunk/views/themes/twentyeleven/category-places-map.php
r473697 r514360 19 19 ?> 20 20 <?php get_header(); ?> 21 <!-- include -->21 <!-- include for me2 --> 22 22 <?php 23 23 -
welocally-places/trunk/views/themes/twentyeleven/welocally-places-list-widget-display.php
r463355 r514360 3 3 $index = 0; 4 4 echo '<aside class="widget sidebar-item"><h3 class="widget-title">'.$title.'</h3><div><ul class="wl-places-list">'; 5 foreach( $posts as $post ) { ?> 5 foreach ($posts as $post): 6 $places = get_post_places($post->ID); 7 foreach ($places as $place): 8 ?> 6 9 7 10 <?php /** … … 11 14 * @return string 12 15 */ 13 $PlaceSelected = get_post_meta( $post->ID, '_PlaceSelected', true );16 $PlaceSelected = $place; 14 17 15 18 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post') : … … 21 24 22 25 <aside> 23 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $ post->ID; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div>24 <div id="plugin-place<?php echo $ post->ID; ?>"></div>26 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $index; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div> 27 <div id="plugin-place<?php echo $index; ?>"></div> 25 28 </aside> 26 29 <?php endif; ?> 27 30 <?php 28 31 $index=$index+1; 29 } 32 endforeach; 33 endforeach; 34 30 35 echo "</ul></div></aside>"; 31 36 ?> -
welocally-places/trunk/views/themes/twentyeleven/welocally-places-map-widget-display.php
r473697 r514360 26 26 </div> 27 27 </div> 28 <div class="wl-place-widget-website text-align-right"> 29 <a href="<?php echo places_get_mapview_link(); ?>"> 30 <?php _e('view larger', $wlPlaces->pluginDomain)?> 31 </a> 32 </div> 28 33 29 </div> 34 30 </aside> -
welocally-places/trunk/views/themes/twentyten/welocally-places-list-widget-display.php
r463355 r514360 3 3 $index = 0; 4 4 echo '<aside class="widget sidebar-item"><h3 class="widget-title">'.$title.'</h3><div class="wl-places-list">'; 5 foreach( $posts as $post ) { ?> 5 6 foreach ($posts as $post): 7 foreach (get_post_places($post) as $place): 8 ?> 6 9 7 10 <?php /** … … 11 14 * @return string 12 15 */ 13 $PlaceSelected = get_post_meta( $post->ID, '_PlaceSelected', true );16 $PlaceSelected = $place; 14 17 15 18 if( $PlaceSelected != '' && $_REQUEST['json'] != 'get_post') : … … 18 21 include($places_list_include);?> 19 22 20 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $ post->ID; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div>21 <div id="plugin-place<?php echo $ post->ID; ?>"></div>23 <div class="wl-place-widget-category" id="plugin-place-category<?php echo $index; ?>" style="{display:none;}"><?php echo $this->get_categories($post->ID, $exclude_cats); ?></div> 24 <div id="plugin-place<?php echo $index; ?>"></div> 22 25 <?php endif; ?> 23 26 <?php 24 27 $index=$index+1; 25 } 28 endforeach; 29 endforeach; 26 30 echo "</div></aside>"; 27 31 ?> -
welocally-places/trunk/views/themes/twentyten/welocally-places-map-widget-display.php
r473697 r514360 27 27 </div> 28 28 </div> 29 <div class="wl-place-widget-website text-align-right"> 30 <a href="<?php echo places_get_mapview_link(); ?>"> 31 <?php _e('view larger', $wlPlaces->pluginDomain)?> 32 </a> 33 </div> 29 34 30 </div> 35 31 </aside> -
welocally-places/trunk/views/welocally-places-list-widget-admin.php
r463355 r514360 1 <script type="text/javascript">2 jQuery(document).ready(function() {3 4 });5 </script>6 1 <style type="text/css"> 7 2 … … 46 41 <select id="<?php echo $this->get_field_id( 'order_dir' ); ?>" 47 42 name="<?php echo $this->get_field_name( 'order_dir' ); ?>"> 43 <option value="desc" <?php if($instance['order_dir']=='desc') echo 'selected';?>>Decending</option> 48 44 <option value="asc" <?php if($instance['order_dir']=='asc') echo 'selected';?>>Acending</option> 49 <option value="desc" <?php if($instance['order_dir']=='desc') echo 'selected';?>>Decending</option>50 45 </select> 51 46 </div> -
welocally-places/trunk/welocally-places-list-widget.class.php
r463355 r514360 23 23 24 24 function widget( $args, $instance ) { 25 global $wp_query; 25 global $wp_query,$wlPlaces; 26 $options = $wlPlaces->getOptions(); 26 27 extract( $args ); 27 28 28 /* User-selected settings. */ 29 29 $style = $instance['style']; 30 30 $title = apply_filters('widget_title', $instance['title'] ); 31 $limit = $instance['limit']; 31 32 $limit = 1000; 33 $limit_places = $instance['limit']; 32 34 $order_by = $instance['order_by']; 33 35 $order_dir = $instance['order_dir']; … … 43 45 /* Display list of places. */ 44 46 if( function_exists( 'get_places' ) ) { 45 $templateOverride = locate_template( array( 'places/places-map-widget-display.php' ) ); 46 47 $theme_dir = get_theme_view_dir(); 48 49 $templateLoc = $templateOverride ? $templateOverride : dirname( __FILE__ ) . 50 '/views/themes/'.$theme_dir.'/welocally-places-list-widget-display.php'; 51 47 $templateLoc = apply_filters('list_widget_template',''); 52 48 //view 53 49 include( $templateLoc ); -
welocally-places/trunk/welocally-places-map-widget.class.php
r463355 r514360 26 26 27 27 function widget( $args, $instance ) { 28 global $wp_query; 28 global $wp_query,$wlPlaces; 29 $options = $wlPlaces->getOptions(); 29 30 extract( $args ); 30 31 … … 43 44 /* Display list of places. */ 44 45 if( function_exists( 'get_places' ) ) { 45 $templateOverride = locate_template( array( 'places/places-map-widget-display.php' ) ); 46 47 $theme_dir = get_theme_view_dir(); 48 49 $templateLoc = $templateOverride ? $templateOverride : dirname( __FILE__ ) . 50 '/views/themes/'.$theme_dir.'/welocally-places-map-widget-display.php'; 51 46 $templateLoc = apply_filters('map_widget_template',''); 52 47 //view 53 48 include( $templateLoc ); -
welocally-places/trunk/welocally-places.class.php
r476641 r514360 1 1 <?php 2 require_once('welocally-places-tag.class.php'); 3 require_once('welocally-places-tag-processor.class.php'); 4 2 5 if ( !class_exists( 'WelocallyPlaces' ) ) { 3 6 /** 4 * Main plugin5 7 */ 6 8 class WelocallyPlaces { 7 9 8 const VERSION = '1.0.15'; 10 const VERSION = '1.1.16'; 11 const DB_VERSION = '2.0'; 9 12 const WLERROROPT = '_welocally_errors'; 10 13 const CATEGORYNAME = 'Place'; … … 14 17 const TIMEFORMAT = 'g:i A'; 15 18 const DBDATEFORMAT = 'Y-m-d'; 16 const DBDATETIMEFORMAT = 'Y-m-d G:i:s'; 19 const DBDATETIMEFORMAT = 'Y-m-d G:i:s'; 17 20 18 21 public $displaying; … … 61 64 add_action( 'init', array( $this, 'loadDomainStylesScripts' ) ); 62 65 add_action( 'pre_get_posts', array( $this, 'setOptions' ) ); 63 66 add_action( 'admin_enqueue_scripts', array( $this, 'loadAdminDomainStylesScripts' ) ); 64 67 add_action( 'admin_menu', array( $this, 'addPlaceBox' ) ); 65 68 add_action( 'save_post', array( $this, 'addPlaceMetaSave' ), 15 ); 69 add_action( 'save_post', array( $this, 'tagHandling')); 66 70 add_action( 'publish_post', array( $this, 'addPlaceMetaPublish' ), 15 ); 67 71 add_action( 'template_redirect',array($this, 'templateChooser' ), 1 ); … … 69 73 add_action( 'sp_places_post_errors', array( 'WLPLACES_Post_Exception', 'displayMessage' ) ); 70 74 add_action( 'sp_places_options_top', array( 'WLPLACES_Options_Exception', 'displayMessage') ); 71 72 add_filter( 'the_content', array($this, 'wl_content_search' )); 73 74 } 75 76 77 function wl_content_search( $content ) { 78 $content = str_replace( '[welocally/]', $this->addPostPlaceInfoMarkup( $GLOBALS['post']->ID ), $content ); 79 return $content; 80 } 81 82 83 75 76 add_filter( 'the_content', array( $this, 'wl_content_tag_search') ); 77 } 78 79 public function wl_content_tag_search($content) { 80 return WelocallyPlaces_Tag::searchAndReplace($content, array($this, 'addPostPlaceTagMarkup')); 81 } 82 83 //this is a little strange is ths obsolete? 84 84 public function templateChooser() { 85 86 //temporary disable 87 //return; 85 88 86 89 $cat_map_layout_type = $this->getSingleOption('cat_map_layout'); … … 93 96 $cat_ID = get_query_var( 'cat' ); 94 97 95 $places_in_category_posts = get_places_posts_for_category($cat_ID); 96 97 error_log("got place count:".count($places_in_category_posts), 0); 98 $places_in_category_posts = get_places_posts_for_category($cat_ID); 98 99 99 100 if(count($places_in_category_posts) == 0) 100 101 return; 101 102 103 104 global $wp_query; 102 103 global $wp_query, $wlPlaces; 104 $options = $wlPlaces->getOptions(); 105 105 if ( $this->in_category()) { 106 106 107 if( '' == locate_template( array( 'places/category-places-map.php' ), true ) ) { 108 109 $theme_dir = get_theme_view_dir(); 110 111 load_template( dirname( __FILE__ ) . '/views/themes/'.$theme_dir.'/category-places-map.php' ); 107 if( '' == locate_template( array( 'places/category-places-map.php' ), true ) ) { 108 $templateLoc = apply_filters('category_template',''); 109 //view 110 load_template( $templateLoc ); 112 111 } 113 112 exit; … … 116 115 } 117 116 } 118 119 117 120 118 … … 154 152 155 153 156 //---------- 154 157 155 public function loadDomainStylesScripts() { 158 156 … … 160 158 $placesURL = trailingslashit( WP_PLUGIN_URL ) . trailingslashit( plugin_basename( dirname( __FILE__ ) ) ) . 'resources/'; 161 159 162 //app stuff 163 wp_enqueue_script('google-maps' , 'https://maps.google.com/maps/api/js? sensor=true' , false , '3');160 //app stuff, for right now we will embed this key but this should be coming from a web service 161 wp_enqueue_script('google-maps' , 'https://maps.google.com/maps/api/js?key=AIzaSyACXX0_pKBA6L0Z2ajyIvh5Bi8h9crGVlg&sensor=true&language=en' , false , '3'); 164 162 wp_enqueue_script('sp-places-script', $placesURL.'places.js', array('jquery') ); 165 163 if( locate_template( array('places/places.css') ) ) { … … 185 183 wp_enqueue_script('media-upload'); 186 184 wp_enqueue_script('thickbox'); 187 /*wp_register_script('wl-upload', WP_PLUGIN_URL.'/welocally-places/resources/upload.js', array('jquery','media-upload','thickbox'));188 wp_enqueue_script('wl-upload');*/189 190 185 //color picker 191 186 wp_enqueue_script('js-color-picker',WP_PLUGIN_URL.'/welocally-places/resources/jscolor.js', array('jquery')); 192 187 188 wp_enqueue_script('wlplaces', WP_PLUGIN_URL . '/welocally-places/resources/wlplaces.js', array('jquery')); 189 } 190 191 192 public function loadAdminDomainStylesScripts() { 193 194 $placesURL = trailingslashit( WP_PLUGIN_URL ) 195 . trailingslashit( plugin_basename( dirname( __FILE__ ) ) ) . 'resources/'; 196 197 //app stuff 198 wp_enqueue_script('jquery-ui-all' , 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'); 199 wp_enqueue_script('js-color-picker',WP_PLUGIN_URL.'/welocally-places/resources/jscolor.js', array('jquery')); 200 wp_enqueue_script('media-upload'); 201 202 wp_enqueue_style('thickbox'); 203 204 wp_register_style( 'jquery-ui-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css' ); 205 wp_enqueue_style( 'jquery-ui-style' ); 193 206 } 194 207 … … 225 238 } 226 239 227 /**240 /** 228 241 * Creates the category and sets up the theme resource folder with sample config files. Calls updateMapPostMeta(). 229 242 * … … 231 244 */ 232 245 public function on_activate( ) { 246 global $wpdb; 247 233 248 $now = time(); 234 249 $firstTime = $now - ($now % 66400); 235 $this->create_category_if_not_exists( ); 236 } 250 $this->create_category_if_not_exists( ); 251 252 // create places table 253 $db_version = get_option('Welocally_DBVersion'); 254 255 if ($db_version != self::DB_VERSION) { 256 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 257 258 $sql = "CREATE TABLE {$wpdb->prefix}wl_places ( 259 id INT PRIMARY KEY AUTO_INCREMENT, 260 wl_id VARCHAR(255) NOT NULL, 261 place TEXT NULL, 262 created DATETIME NOT NULL 263 );"; 264 dbDelta($sql); 265 266 $sql = "CREATE TABLE {$wpdb->prefix}wl_places_posts ( 267 id INT PRIMARY KEY AUTO_INCREMENT, 268 place_id INT NOT NULL, 269 post_id MEDIUMINT(9) NOT NULL, 270 created DATETIME NOT NULL 271 );"; 272 dbDelta($sql); 273 } 274 275 update_option('Welocally_DBVersion', self::DB_VERSION); 276 } 277 237 278 238 279 /** … … 252 293 */ 253 294 public function addPlaceBox( ) { 254 add_meta_box( 'Place Details', __( 'Welocally Places', 'Place_textdomain' ), 255 array( $this, 'placeMetaBox' ), 'post', 'normal', 'high' ); 256 } 295 foreach (array('post','page') as $type) 296 { 297 add_meta_box( 'wl-place-finder-meta-1', __( 'Welocally Places', 'Place_textdomain' ), 298 array( $this, 'placeMetaBox' ), $type, 'normal', 'high' ); 299 } 300 } 257 301 258 302 public function placeMetaBox() { … … 279 323 include( dirname( __FILE__ ) . '/views/places-meta-box.php' ); 280 324 } 281 282 283 284 285 325 326 public function addPostPlaceTagMarkup($tag, $str) { 327 global $post; 328 global $wpdb; 329 static $placecount = 0; 330 331 if (!$tag->id) 332 return $str; 333 334 if ($place = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wl_places WHERE wl_id = %s", $tag->id))) { 335 $place_json = $place->place; 336 337 $resultContent = ''; 338 339 $showmap=true; 340 $cat_ID = get_query_var( 'cat' ); 341 342 // if(is_single()){ 343 if(is_singular()){ 344 $showmap=true; 345 } else if(is_home() || isset($cat_ID)){ 346 $showmap=false; 347 } 348 349 $isCustom = false; 350 $customMapJson = '[ ]'; 351 if(wl_get_option('map_custom_style') != ''){ 352 $isCustom = true; 353 $customMapJson = wl_get_option("map_custom_style"); 354 } 355 356 $whereImage=$this->pluginUrl.'/resources/images/here.png'; 357 358 359 // use place template 360 $t = new StdClass(); 361 $t->uid = ++$placecount; 362 $t->WPPost = $post->ID; 363 $t->postId = $tag->postId; 364 $t->placeJSON = $place_json; 365 $t->options = array( 366 'showmap' => $showmap, 367 'isCustom' => $isCustom, 368 'map_custom_style' => $customMapJson, 369 'map_icon_web' => wl_get_option("map_icon_web"), 370 'map_icon_directions' => wl_get_option("map_icon_directions"), 371 'font_place_name' => wl_get_option("font_place_name"), 372 'color_place_name' => wl_get_option("color_place_name"), 373 'size_place_name' => wl_get_option("size_place_name"), 374 'font_place_address' => wl_get_option("font_place_address"), 375 'color_place_address' => wl_get_option("color_place_address"), 376 'size_place_address' => wl_get_option("size_place_address"), 377 'where_image' => $whereImage 378 ); 379 380 ob_start(); 381 include(dirname(__FILE__) . '/views/place-content-template.php'); 382 $resultContent = ob_get_contents(); 383 ob_end_clean(); 384 385 $t = null; 386 387 return $resultContent; 388 389 } 390 391 return $str; 392 // $ShowPlaceAddress = get_post_meta( $postId, '_ShowPlaceAddress', true ); 393 394 } 286 395 287 396 /* Callback for adding to the post itself … … 305 414 if(wl_get_option('map_custom_style') != ''){ 306 415 $isCustom = 'true'; 307 $customMapJson = base64_decode(wl_get_option("map_custom_style"));416 $customMapJson = wl_get_option("map_custom_style"); 308 417 } 309 418 … … 379 488 } 380 489 381 /**382 * redundant383 */384 public function create_custom_category_if_not_exists( $categoryName ) {385 if ( !category_exists( $categoryName ) ) {386 $category_id = wp_create_category( $categoryName );387 return $category_id;388 } else {389 return get_cat_ID( $categoryName );390 }391 392 }393 394 395 396 490 public function addPlaceMetaSave( $postId ) { 397 491 $this->addPlaceMeta( $postId, 'save_post' ); … … 404 498 public function addPlaceMeta( $postId, $action ) { 405 499 406 //check to delete existing place info407 500 if(!empty( $_POST['deletePlaceInfo'] )){ 408 501 delete_post_meta($postId, '_PlaceSelected'); 409 502 delete_post_meta($postId, '_isWLPlace'); 410 503 update_post_meta( $postId, '_isWLPlace', 'false' ); 411 } else if( empty( $_POST['deletePlaceInfo'] ) && !empty( $_POST['PlaceSelected'] ) && isset( $_POST['isWLPlace'] ) 412 && $_POST['isWLPlace'] == 'true' ) { 413 414 error_log("save case 1: [".$_POST['PlaceSelected']."]", 0); 504 } else if( !empty( $_POST['PlaceSelected']) ) { 415 505 416 506 $category_id = $this->create_category_if_not_exists(); … … 449 539 } 450 540 else if($_POST['isWLPlace'] == 'false' || !isset( $_POST['isWLPlace']) ) { 451 error_log("save case 3", 0);452 541 update_post_meta( $postId, '_isWLPlace', 'false' ); 453 542 } … … 455 544 456 545 } 546 547 public function tagHandling($post_id) { 548 if (!wp_is_post_revision($post_id)) { 549 $post = get_post($post_id); 550 551 $tags = WelocallyPlaces_Tag::parseText($post->post_content); 552 553 $proc = new WelocallyPlaces_TagProcessor(); 554 $result = $proc->processTags($tags, $post_id); 555 } 556 } 457 557 458 558 … … 470 570 } 471 571 472 /*473 should be parameterized474 */475 public function post_place_welocally($selectedPostJson, $action) {476 477 478 //set POST variables479 $url = wl_server_base().'/rcadmin/wpp/publish';480 481 482 //open connection483 $ch = curl_init();484 485 486 //set the url, number of POST vars, POST data487 curl_setopt($ch,CURLOPT_URL,$url);488 curl_setopt($ch, CURLOPT_POST, true);489 curl_setopt($ch,CURLOPT_POSTFIELDS,$selectedPostJson);490 curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: application/json; charset=utf-8', 'publisher-key: c1da06473823.oaklandly','welocally-baseurl: http://www.oaklandly.com','wp-action: '.$action));491 492 //execute post493 $result = curl_exec($ch);494 495 //close connection496 curl_close($ch);497 }498 499 500 572 501 573 /// OPTIONS DATA … … 507 579 508 580 public function getSingleOption( $key ) { 509 /*if($optionName) {510 $options = $this->getOptions();511 return ( $options[$optionName] ) ? $options[$optionName] : $default;512 }*/513 514 515 //if( $this->latestOptions ) return $this->latestOptions[$key];516 581 $options = $this->getOptions(); 517 582 return $options[$key]; … … 545 610 } 546 611 547 612 /* 613 * just remove legacy meta 614 */ 615 public function deletePostPlacesMeta($postId) { 616 617 global $wpdb; 618 619 //will recurse to elements 620 if (is_array($postId)) { 621 foreach ($postId as $p) { 622 $this->deletePostPlacesMeta($p); 623 } 624 } 625 626 $wpdb->query( 627 " 628 DELETE FROM {$wpdb->prefix}postmeta 629 WHERE post_id = '$postId' AND meta_key='_PlaceSelected'; 630 " 631 ); 632 633 } 634 635 /* 636 * this is probably inefficient and could be done better with 637 * some sort of join 638 */ 639 public function deletePostPlaces($postId) { 640 641 global $wpdb; 642 643 //will recurse to elements 644 if (is_array($postId)) { 645 foreach ($postId as $p) { 646 $this->deletePostPlaces($p); 647 } 648 } 649 650 $postId = is_array($postId) ? $postId['ID'] : (is_object($postId) ? $postId->ID : intval($postId)); 651 652 //remove it from places table 653 $post_places = $this->getPostPlaces($postId) ; 654 foreach ($post_places as $place) { 655 656 $wpdb->query( 657 " 658 DELETE FROM {$wpdb->prefix}wl_places 659 WHERE wl_id = '$place->_id'; 660 " 661 ); 662 } 663 664 //remove it from posts 665 $wpdb->query( 666 " 667 DELETE FROM {$wpdb->prefix}wl_places_posts 668 WHERE post_id = $postId; 669 " 670 ); 671 } 672 673 674 public function getPostPlaces($postId) { 675 global $wpdb; 676 677 if (is_array($postId)) { 678 $places = array(); 679 680 foreach ($postId as $p) { 681 if (is_object($p) || is_array($p)) { 682 $p_ = (array) $p; 683 $places = $places + $this->getPostPlaces($p_['ID']); 684 } else if (is_int($p)) { 685 $places = $places + $this->getPostPlaces($p); 686 } 687 } 688 689 return $places; 690 } 691 692 $postId = is_array($postId) ? $postId['ID'] : (is_object($postId) ? $postId->ID : intval($postId)); 693 694 $places = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT place FROM {$wpdb->prefix}wl_places p INNER JOIN {$wpdb->prefix}wl_places_posts pp ON p.id = pp.place_id WHERE pp.post_id = %d", $postId)); 695 696 if ($places) 697 return array_map('json_decode', $places); 698 699 return array(); 700 } 701 702 public function getPostPlacesMeta($postId) { 703 global $wpdb; 704 705 if (is_array($postId)) { 706 $places = array(); 707 708 foreach ($postId as $p) { 709 if (is_object($p) || is_array($p)) { 710 $p_ = (array) $p; 711 $places = $places + $this->getPostPlacesMeta($p_['ID']); 712 } else if (is_int($p)) { 713 $places = $places + $this->getPostPlacesMeta($p); 714 } 715 } 716 717 return $places; 718 } 719 720 $postId = is_array($postId) ? $postId['ID'] : (is_object($postId) ? $postId->ID : intval($postId)); 721 722 $places = $wpdb->get_col($wpdb->prepare("SELECT meta_value FROM {$wpdb->prefix}postmeta WHERE post_id = %d and meta_key='_PlaceSelected'", $postId)); 723 724 if ($places) 725 //return array_map('json_decode', $places); 726 return json_decode($places[0]); 727 728 return array(); 729 } 548 730 549 731 } 732 550 733 global $wlPlaces; 551 734 $wlPlaces = new WelocallyPlaces(); -
welocally-places/trunk/welocally-places.php
r476641 r514360 4 4 Plugin Name: Welocally Places 5 5 Plugin URI: http://www.welocally.com/wordpress/?page_id=2 6 Description: The Welocally Places plugin lets easily associate places f or our 21M POI database withoutgeocoding. The map widget makes it easy for your users to find the places your are writing about on a map.7 Version: 1. 0.158 Author: Welocally Inc.6 Description: The Welocally Places plugin lets easily associate places from our 21M POI database without manual geocoding. The map widget makes it easy for your users to find the places your are writing about on a map. 7 Version: 1.1.16 8 Author: Welocally 9 9 Author URI: http://welocally.com 10 10 License: GPL2 11 Notes: test hook 6 11 12 */ 12 13 … … 19 20 add_action('wp_ajax_get_places', 'welocally_getplaces'); 20 21 add_action('wp_ajax_remove_token', 'welocally_remove_token'); 22 add_action('wp_ajax_save_place', 'welocally_save_place'); 23 24 //catgeories 25 add_action('wp_ajax_get_classifiers_types', 'welocally_get_classifiers_types'); 26 add_action('wp_ajax_get_classifiers_categories', 'welocally_get_classifiers_categories'); 27 add_action('wp_ajax_get_classifiers_subcategories', 'welocally_get_classifiers_subcategories'); 28 29 21 30 add_action('wp_loaded', 'wl_self_deprecating_sidebar_registration'); 22 add_filter('the_excerpt', 'wl_get_excerpt_basic'); 23 24 function wl_get_excerpt_basic() { 25 global $post; 26 return wl_get_post_excerpt($post->ID); 27 } 31 add_filter('the_excerpt', 'wl_get_excerpt_basic'); 32 33 // add filter's for plugin templates 34 add_filter('map_widget_template', 'wl_places_get_template_map_widget',10); 35 add_filter('list_widget_template', 'wl_places_get_template_list_widget',10); 36 add_filter('category_template', 'wl_places_get_template_category',10); 37 28 38 29 39 function wl_server_base() { 30 40 return wl_get_option("api_endpoint", null); 41 } 42 43 44 function welocally_getkey() { 45 46 $selectedPostJson = json_encode($_POST); 47 48 //set POST variables 49 $url = wl_server_base() . '/admin/signup/2_0/plugin/key.json'; 50 51 error_log("url:".$url, 0); 52 53 $result_json = wl_do_curl_post($url, $selectedPostJson, array ( 54 'Content-Type: application/json; charset=utf-8' 55 )); 56 57 $result_model = json_decode($result_json); 58 59 60 die(); // this is required to return a proper result 61 } 62 63 function welocally_register($selectedPostJson) { 64 65 $url = wl_server_base() . '/admin/signup/2_0/plugin/register'; 66 67 error_log("url:".$url, 0); 68 69 $result_json = wl_do_curl_post($url, $selectedPostJson, array ( 70 'Content-Type: application/json; charset=utf-8' 71 ), true); 72 73 return $result_json; 74 } 75 76 77 function welocally_save_place() { 78 79 $placeToSave = $_POST['place']; 80 $placeToSave['properties']['name'] = stripslashes($_POST['place']['properties']['name']); 81 $placeToSave['properties']['address'] = stripslashes($_POST['place']['properties']['address']); 82 83 $selectedPostJson = json_encode($placeToSave); 84 error_log("place 1:".print_r($placeToSave, true),0); 85 error_log("place 2:".strval($selectedPostJson),0); 86 87 //set POST variables 88 $url = wl_server_base() . '/geodb/place/1_0/'; 89 90 error_log("url:".$url, 0); 91 92 $result_json = wl_do_curl_put($url, $selectedPostJson, array ( 93 'Content-Type: application/json; charset=utf-8', 94 'site-key:' . wl_get_option('siteKey', null), 95 'site-token:' . wl_get_option('siteToken', null) 96 )); 97 98 $result_model = json_decode($result_json); 99 100 die(); // this is required to return a proper result 101 } 102 103 function welocally_getplaces() { 104 105 106 $url = wl_server_base() .'/geodb/place/1_0/search.json?'.http_build_query($_GET); 107 108 error_log("url:".$url, 0); 109 110 $result_json = wl_do_curl_get($url, array ( 111 'Content-Type: application/json; charset=utf-8', 112 'site-key:' . wl_get_option('siteKey', null), 113 'site-token:' . wl_get_option('siteToken', null) 114 )); 115 116 die(); // this is required to return a proper result 117 } 118 119 function welocally_get_classifiers_types() { 120 121 122 $url = wl_server_base() .'/geodb/classifier/1_0/types.json'; 123 124 error_log("url:".$url, 0); 125 126 $result_json = wl_do_curl_get($url, array ( 127 'Content-Type: application/json; charset=utf-8', 128 'site-key:' . wl_get_option('siteKey', null), 129 'site-token:' . wl_get_option('siteToken', null) 130 )); 131 132 die(); // this is required to return a proper result 133 } 134 135 function welocally_get_classifiers_categories() { 136 137 138 $url = wl_server_base() .'/geodb/classifier/1_0/categories.json?'.http_build_query($_GET); 139 140 error_log("url:".$url, 0); 141 142 $result_json = wl_do_curl_get($url, array ( 143 'Content-Type: application/json; charset=utf-8', 144 'site-key:' . wl_get_option('siteKey', null), 145 'site-token:' . wl_get_option('siteToken', null) 146 )); 147 148 die(); // this is required to return a proper result 149 } 150 151 function welocally_get_classifiers_subcategories() { 152 153 $url = wl_server_base() .'/geodb/classifier/1_0/subcategories.json?'.http_build_query($_GET); 154 155 error_log("url:".$url, 0); 156 157 $result_json = wl_do_curl_get($url, array ( 158 'Content-Type: application/json; charset=utf-8', 159 'site-key:' . wl_get_option('siteKey', null), 160 'site-token:' . wl_get_option('siteToken', null) 161 )); 162 163 die(); // this is required to return a proper result 164 } 165 166 //-------- GET ------------ 167 168 function wl_do_curl_get($url, $headers){ 169 error_log("wl_do_curl_get url:".$url, 0); 170 171 $result_json = ''; 172 if (preg_match("/https/", $url)) { 173 $result_json = wl_do_curl_get_https($url, $headers); 174 } else { 175 $result_json = wl_do_curl_get_http($url, $headers); 176 } 177 178 return $result_json; 179 } 180 181 function wl_do_curl_get_http($url, $headers) { 182 //open connection 183 $ch = curl_init(); 184 185 //set the url, number of POST vars, POST data 186 curl_setopt($ch, CURLOPT_URL, $url); 187 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 188 189 //execute post 190 $result_json = curl_exec($ch); 191 192 curl_close($ch); 193 194 return $result_json; 195 } 196 197 198 function wl_do_curl_get_https($https_url, $headers) { 199 200 //open connection 201 $ch = curl_init(); 202 203 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 204 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 205 curl_setopt($ch, CURLOPT_CAINFO, NULL); 206 curl_setopt($ch, CURLOPT_CAPATH, NULL); 207 208 //set the url, number of POST vars, POST data 209 curl_setopt($ch, CURLOPT_URL, $https_url); 210 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 211 212 //execute post 213 $result_json = curl_exec($ch); 214 215 curl_close($ch); 216 217 return $result_json; 218 } 219 220 //-------- PUT ------------ 221 function wl_do_curl_put($url, $selectedPostJson, $headers) { 222 error_log("PUT url:".$url." JSON:".$selectedPostJson, 0); 223 224 $result_json = ''; 225 if (preg_match("/https/", $url)) { 226 $result_json = wl_do_curl_put_https($url, $selectedPostJson, $headers); 227 } else { 228 $result_json = wl_do_curl_put_http($url, $selectedPostJson, $headers); 229 } 230 231 return $result_json; 232 } 233 234 235 236 237 function wl_do_curl_put_http($url, $selectedPostJson, $headers) { 238 //open connection 239 $ch = curl_init(); 240 241 $requestLength = strlen($selectedPostJson); 242 243 $fh = fopen('php://memory', 'rw'); 244 fwrite($fh, $selectedPostJson); 245 rewind($fh); 246 247 //set the url, number of POST vars, POST data 248 curl_setopt($ch, CURLOPT_URL, $url); 249 curl_setopt($ch, CURLOPT_INFILE, $fh); 250 curl_setopt($ch, CURLOPT_INFILESIZE, $requestLength); 251 curl_setopt($ch, CURLOPT_PUT, true); 252 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 253 254 //execute put 255 $result_json = curl_exec($ch); 256 257 curl_close($ch); 258 259 fclose($fh); 260 261 return $result_json; 262 } 263 264 function wl_do_curl_put_https($https_url, $selectedPostJson, $headers) { 265 266 //open connection 267 $ch = curl_init(); 268 269 $requestLength = strlen($selectedPostJson); 270 271 $fh = fopen('php://memory', 'rw'); 272 fwrite($fh, $selectedPostJson); 273 rewind($fh); 274 275 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 276 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 277 curl_setopt($ch, CURLOPT_CAINFO, NULL); 278 curl_setopt($ch, CURLOPT_CAPATH, NULL); 279 280 //set the url, number of POST vars, POST data 281 curl_setopt($ch, CURLOPT_URL, $https_url); 282 curl_setopt($ch, CURLOPT_INFILE, $fh); 283 curl_setopt($ch, CURLOPT_INFILESIZE, $requestLength); 284 curl_setopt($ch, CURLOPT_PUT, true); 285 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 286 287 //execute put 288 $result_json = curl_exec($ch); 289 290 curl_close($ch); 291 292 fclose($fh); 293 294 return $result_json; 295 } 296 297 298 299 300 301 302 //-------- POST ------------ 303 function wl_do_curl_post($url, $selectedPostJson, $headers, $returnxfer = false) { 304 $result_json = ''; 305 if (preg_match("/https/", $url)) { 306 $result_json = wl_do_curl_post_https($url, $selectedPostJson, $headers,$returnxfer); 307 } else { 308 $result_json = wl_do_curl_post_http($url, $selectedPostJson, $headers,$returnxfer); 309 } 310 311 return $result_json; 312 } 313 314 function wl_do_curl_post_http($url, $selectedPostJson, $headers, $returnxfer = false) { 315 //open connection 316 $ch = curl_init(); 317 318 //set the url, number of POST vars, POST data 319 curl_setopt($ch, CURLOPT_URL, $url); 320 curl_setopt($ch, CURLOPT_POST, true); 321 curl_setopt($ch, CURLOPT_POSTFIELDS, $selectedPostJson); 322 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 323 curl_setopt($ch, CURLOPT_RETURNTRANSFER, $returnxfer); 324 325 326 //execute post 327 $result_json = curl_exec($ch); 328 329 curl_close($ch); 330 331 return $result_json; 332 } 333 334 function wl_do_curl_post_https($https_url, $selectedPostJson, $headers, $returnxfer = false) { 335 336 //open connection 337 $ch = curl_init(); 338 339 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 340 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 341 curl_setopt($ch, CURLOPT_CAINFO, NULL); 342 curl_setopt($ch, CURLOPT_CAPATH, NULL); 343 curl_setopt($ch, CURLOPT_RETURNTRANSFER, $returnxfer); 344 345 //set the url, number of POST vars, POST data 346 curl_setopt($ch, CURLOPT_URL, $https_url); 347 curl_setopt($ch, CURLOPT_POST, true); 348 curl_setopt($ch, CURLOPT_POSTFIELDS, $selectedPostJson); 349 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 350 351 //execute post 352 $result_json = curl_exec($ch); 353 354 curl_close($ch); 355 356 return $result_json; 357 } 358 359 360 361 //----- end of neworking section ----------// 362 363 function wl_debug() { 364 $args = func_get_args(); 365 366 echo '<pre>'; 367 foreach ($args as $arg) { 368 print_r($arg); 369 } 370 echo '</pre>'; 371 } 372 373 function wl_debug_e() { 374 call_user_func_array('wl_debug', func_get_args()); 375 exit; 31 376 } 32 377 … … 59 404 60 405 $selectedPostJson = json_encode($_POST); 61 syslog(LOG_WARNING, "A" . var_export($selectedPostJson, true)); 62 406 63 407 $options = wl_get_options(); 64 408 … … 70 414 } 71 415 72 function welocally_getkey() { 73 74 $selectedPostJson = json_encode($_POST); 75 //syslog(LOG_WARNING, "A" . var_export($selectedPostJson, true)); 76 77 //set POST variables 78 $url = wl_server_base() . '/rcadmin/signup/plugin/key.json'; 79 80 error_log("url:".$url, 0); 81 82 $result_json = wl_do_curl($url, $selectedPostJson, array ( 83 'Content-Type: application/json; charset=utf-8' 84 )); 85 86 die(); // this is required to return a proper result 87 } 88 89 function wl_do_curl($url, $selectedPostJson, $headers) { 90 $result_json = ''; 91 if (preg_match("/https/", $url)) { 92 $result_json = wl_do_curl_https($url, $selectedPostJson, $headers); 93 } else { 94 $result_json = wl_do_curl_http($url, $selectedPostJson, $headers); 95 } 96 97 return $result_json; 98 } 99 100 function wl_do_curl_http($url, $selectedPostJson, $headers) { 101 //open connection 102 $ch = curl_init(); 103 104 //set the url, number of POST vars, POST data 105 curl_setopt($ch, CURLOPT_URL, $url); 106 curl_setopt($ch, CURLOPT_POST, true); 107 curl_setopt($ch, CURLOPT_POSTFIELDS, $selectedPostJson); 108 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 109 110 //execute post 111 $result_json = curl_exec($ch); 112 113 curl_close($ch); 114 115 return $result_json; 116 } 117 118 function wl_do_curl_https($https_url, $selectedPostJson, $headers) { 119 120 //open connection 121 $ch = curl_init(); 122 123 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 124 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 125 curl_setopt($ch, CURLOPT_CAINFO, NULL); 126 curl_setopt($ch, CURLOPT_CAPATH, NULL); 127 128 //set the url, number of POST vars, POST data 129 curl_setopt($ch, CURLOPT_URL, $https_url); 130 curl_setopt($ch, CURLOPT_POST, true); 131 curl_setopt($ch, CURLOPT_POSTFIELDS, $selectedPostJson); 132 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 133 134 //execute post 135 $result_json = curl_exec($ch); 136 137 curl_close($ch); 138 139 return $result_json; 140 } 141 142 function welocally_getplaces() { 143 144 $selectedPostJson = json_encode($_POST); 145 syslog(LOG_WARNING, "A" . var_export($selectedPostJson, true)); 146 147 //set POST variables http://108.200.49.246/ 148 $url = wl_server_base() . '/rcadmin/publisher/place/queryplaces.json'; 149 150 $result_json = wl_do_curl($url, $selectedPostJson, array ( 151 'Content-Type: application/json; charset=utf-8', 152 'site-key:' . wl_get_option('siteKey', null), 153 'site-token:' . wl_get_option('siteToken', null) 154 )); 155 156 die(); // this is required to return a proper result 157 } 158 159 function welocally_add_place() { 160 161 $selectedPostJson = json_encode($_POST); 162 163 //set POST variables 164 $url = wl_server_base() . '/rcadmin/publisher/place/addplace.json'; 165 166 $result_json = wl_do_curl($url, $selectedPostJson, array ( 167 'Content-Type: application/json; charset=utf-8' 168 )); 169 170 die(); // this is required to return a proper result 171 } 416 172 417 173 418 function welocally_requirements_check() { … … 190 435 } 191 436 } 437 438 function wl_get_excerpt_basic() { 439 global $post; 440 return wl_get_post_excerpt($post->ID); 441 } 442 192 443 193 444 function welocally_activate() { … … 228 479 }*/ 229 480 } 481 230 482 ?>
Note: See TracChangeset
for help on using the changeset viewer.