git-svn-id: https://192.168.0.254/svn/Proyectos.OriginalHouse_Web/trunk@19 54e8636e-a86c-764f-903d-b964358a1ae2
This commit is contained in:
parent
a1537fb22a
commit
9e9aecf1a2
File diff suppressed because one or more lines are too long
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Google Maps v3 Shortcode
|
||||
Plugin URI: http://gis.yohman.com
|
||||
Description: This plugin allows you to add one or more maps to your page/post using shortcodes. Features include: multiple maps on the same page, specify location by address or lat/lon combo, add kml, show traffic, add your own custom image icon, set map size.
|
||||
Version: 1.02
|
||||
Author: yohda
|
||||
Author URI: http://gis.yohman.com/
|
||||
*/
|
||||
|
||||
// Add the google maps api to header
|
||||
add_action('wp_head', 'gmaps_header');
|
||||
|
||||
function gmaps_header() {
|
||||
?>
|
||||
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Main function to generate google map
|
||||
function mapme($attr) {
|
||||
|
||||
// default atts
|
||||
$attr = shortcode_atts(array(
|
||||
'lat' => '0',
|
||||
'lon' => '0',
|
||||
'id' => 'map',
|
||||
'z' => '1',
|
||||
'w' => '400',
|
||||
'h' => '300',
|
||||
'maptype' => 'ROADMAP',
|
||||
'address' => '',
|
||||
'kml' => '',
|
||||
'marker' => '',
|
||||
'markerimage' => '',
|
||||
'traffic' => 'no',
|
||||
'infowindow' => ''
|
||||
|
||||
), $attr);
|
||||
|
||||
|
||||
$returnme = '
|
||||
<div id="' .$attr['id'] . '" style="width:' . $attr['w'] . 'px;height:' . $attr['h'] . 'px;border:1px solid gray;"></div><br>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var latlng = new google.maps.LatLng(' . $attr['lat'] . ', ' . $attr['lon'] . ');
|
||||
var myOptions = {
|
||||
zoom: ' . $attr['z'] . ',
|
||||
center: latlng,
|
||||
mapTypeId: google.maps.MapTypeId.' . $attr['maptype'] . '
|
||||
};
|
||||
var ' . $attr['id'] . ' = new google.maps.Map(document.getElementById("' . $attr['id'] . '"),
|
||||
myOptions);
|
||||
';
|
||||
|
||||
//kml
|
||||
if($attr['kml'] != '')
|
||||
{
|
||||
//Wordpress converts "&" into "&", so converting those back
|
||||
$thiskml = str_replace("&","&",$attr['kml']);
|
||||
$returnme .= '
|
||||
var kmllayer = new google.maps.KmlLayer(\'' . $thiskml . '\');
|
||||
kmllayer.setMap(' . $attr['id'] . ');
|
||||
';
|
||||
}
|
||||
|
||||
//traffic
|
||||
if($attr['traffic'] == 'yes')
|
||||
{
|
||||
$returnme .= '
|
||||
var trafficLayer = new google.maps.TrafficLayer();
|
||||
trafficLayer.setMap(' . $attr['id'] . ');
|
||||
';
|
||||
}
|
||||
|
||||
//address
|
||||
if($attr['address'] != '')
|
||||
{
|
||||
$returnme .= '
|
||||
var geocoder_' . $attr['id'] . ' = new google.maps.Geocoder();
|
||||
var address = \'' . $attr['address'] . '\';
|
||||
geocoder_' . $attr['id'] . '.geocode( { \'address\': address}, function(results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
' . $attr['id'] . '.setCenter(results[0].geometry.location);
|
||||
';
|
||||
|
||||
if ($attr['marker'] !='')
|
||||
{
|
||||
//add custom image
|
||||
if ($attr['markerimage'] !='')
|
||||
{
|
||||
$returnme .= 'var image = "'. $attr['markerimage'] .'";';
|
||||
}
|
||||
$returnme .= '
|
||||
var marker = new google.maps.Marker({
|
||||
map: ' . $attr['id'] . ',
|
||||
';
|
||||
if ($attr['markerimage'] !='')
|
||||
{
|
||||
$returnme .= 'icon: image,';
|
||||
}
|
||||
$returnme .= '
|
||||
position: ' . $attr['id'] . '.getCenter()
|
||||
});
|
||||
';
|
||||
|
||||
//infowindow
|
||||
if($attr['infowindow'] != '')
|
||||
{
|
||||
//first convert and decode html chars
|
||||
$thiscontent = htmlspecialchars_decode($attr['infowindow']);
|
||||
$returnme .= '
|
||||
var contentString = \'' . $thiscontent . '\';
|
||||
var infowindow = new google.maps.InfoWindow({
|
||||
content: contentString
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, \'click\', function() {
|
||||
infowindow.open(' . $attr['id'] . ',marker);
|
||||
});
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$returnme .= '
|
||||
} else {
|
||||
alert("Geocode was not successful for the following reason: " + status);
|
||||
}
|
||||
});
|
||||
';
|
||||
}
|
||||
|
||||
//marker: show if address is not specified
|
||||
if ($attr['marker'] != '' && $attr['address'] == '')
|
||||
{
|
||||
//add custom image
|
||||
if ($attr['markerimage'] !='')
|
||||
{
|
||||
$returnme .= 'var image = "'. $attr['markerimage'] .'";';
|
||||
}
|
||||
|
||||
$returnme .= '
|
||||
var marker = new google.maps.Marker({
|
||||
map: ' . $attr['id'] . ',
|
||||
';
|
||||
if ($attr['markerimage'] !='')
|
||||
{
|
||||
$returnme .= 'icon: image,';
|
||||
}
|
||||
$returnme .= '
|
||||
position: ' . $attr['id'] . '.getCenter()
|
||||
});
|
||||
';
|
||||
|
||||
//infowindow
|
||||
if($attr['infowindow'] != '')
|
||||
{
|
||||
$returnme .= '
|
||||
var contentString = \'' . $attr['infowindow'] . '\';
|
||||
var infowindow = new google.maps.InfoWindow({
|
||||
content: contentString
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, \'click\', function() {
|
||||
infowindow.open(' . $attr['id'] . ',marker);
|
||||
});
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$returnme .= '</script>';
|
||||
|
||||
return $returnme;
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
add_shortcode('map', 'mapme');
|
||||
|
||||
|
||||
?>
|
||||
108
src/wp-content/plugins/google-maps-v3-shortcode/readme.txt
Normal file
108
src/wp-content/plugins/google-maps-v3-shortcode/readme.txt
Normal file
@ -0,0 +1,108 @@
|
||||
=== Plugin Name ===
|
||||
Contributors: yohman
|
||||
Donate link: http://gis.yohman.com/blog/2010/10/27/wordpress-plugin-google-maps-shortcode/
|
||||
Tags: google, google maps, google maps api, kml, network links, shortcode, shortcodes, google maps v3, v3, geocode, map, mapping, maps, latitude, longitude, api, traffic
|
||||
Requires at least: 2.8
|
||||
Tested up to: 3.01
|
||||
Stable tag: 1.02
|
||||
|
||||
This plugin allows you to add one or more maps (via the Google Maps v3 API) to your page/post using shortcodes.
|
||||
|
||||
|
||||
== Description ==
|
||||
|
||||
This plugin allows you to add a google map into your post/page using shortcodes.
|
||||
|
||||
Features:
|
||||
|
||||
* multiple maps on the same post
|
||||
* set map size
|
||||
* set zoom level
|
||||
* set map type
|
||||
* set location by latitude/longitude
|
||||
* set location by address
|
||||
* add marker
|
||||
* add custom image as map icon
|
||||
* add KML via URL link
|
||||
* show traffic
|
||||
* support for Google My Maps
|
||||
|
||||
See a full description here:
|
||||
|
||||
http://gis.yohman.com/blog/2010/10/27/wordpress-plugin-google-maps-shortcode/
|
||||
|
||||
== Installation ==
|
||||
|
||||
This section describes how to install the plugin and get it working.
|
||||
|
||||
e.g.
|
||||
|
||||
1. Upload `google-maps-v3-shortcode` directory to the `/wp-content/plugins/` directory
|
||||
1. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
1. Add shortcodes in your posts (ex: [map address="New York, USA"])
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
= How do I add a map to my post =
|
||||
|
||||
Using shortcodes in the edit box for your post.
|
||||
|
||||
Ex: [map address="New York, USA"]
|
||||
|
||||
See a full description of available shortcodes here:
|
||||
|
||||
http://gis.yohman.com/blog/2010/10/27/wordpress-plugin-google-maps-shortcode/
|
||||
|
||||
= Can I add multiple maps to the same post? =
|
||||
|
||||
Yes! But make sure you use the "id" parameter to create unique id's for each map.
|
||||
|
||||
Ex:
|
||||
[map id="map1" address="New York, USA"]
|
||||
[map id="map2" address="Los Angeles, USA"]
|
||||
|
||||
= Can I change the size of the map? =
|
||||
Yes! Just add your own width and height parameters (the default is 400x300).
|
||||
|
||||
Ex:
|
||||
[map w="200" h="100"]
|
||||
|
||||
= Can you add KML's? =
|
||||
Yes! Just provide the url link to the KML file. The map will auto center and zoom to the extent of your KML.
|
||||
|
||||
Ex:
|
||||
[map kml="http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml"]
|
||||
|
||||
= What about adding Google MyMaps? =
|
||||
Yes! To do so, follow the instructions on this tutorial:
|
||||
|
||||
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
See full working examples here:
|
||||
|
||||
http://gis.yohman.com/blog/2010/10/27/wordpress-plugin-google-maps-shortcode/
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.02 =
|
||||
* Fixed bug to allow for KML's with special characters in the URL (this makes it possible to add Google MyMap KML's)
|
||||
|
||||
= 1.01 =
|
||||
* Added info window support
|
||||
* Got rid of red border around maps
|
||||
|
||||
= 1.0 =
|
||||
* First release
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 1.02 =
|
||||
* Fixed bug to allow for KML's with special characters in the URL (this makes it possible to add Google MyMap KML's)
|
||||
|
||||
= 1.01 =
|
||||
* Added info window support
|
||||
* Got rid of red border around maps
|
||||
|
||||
= 1.0 =
|
||||
* First release
|
||||
@ -79,6 +79,8 @@ if(!is_admin()){
|
||||
function js_load_js(){
|
||||
wp_enqueue_script('jquery');
|
||||
wp_enqueue_script('jquerySliderJs', JS_URL.'/js/jquerySlider.min.js');
|
||||
|
||||
|
||||
}
|
||||
|
||||
add_action('wp_print_styles', 'js_load_css');
|
||||
@ -102,7 +104,7 @@ if(!is_admin()){
|
||||
});
|
||||
});
|
||||
</script>";
|
||||
|
||||
$out .= "<!--[if IE]><script type='text/javascript' src='".JS_URL."/js/excanvas.compiled.js'><![endif]-->";
|
||||
echo $out;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
.tubepress_thumbnail_area {
|
||||
margin: 0;
|
||||
background: #272524;
|
||||
}
|
||||
|
||||
.tubepress_thumbs {
|
||||
@ -39,12 +40,17 @@
|
||||
display: none;
|
||||
margin: 0 auto ! important;
|
||||
-ms-interpolation-mode: bicubic;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.tubepress_thumb a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tubepress_thumb a:hover img {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tubepress_meta_group {
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
|
||||
@ -20,15 +20,15 @@
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
display: table-cell;
|
||||
background: #fff;
|
||||
background: #272524;
|
||||
height: 196px;
|
||||
width: 240px;
|
||||
width: 192px;
|
||||
}
|
||||
|
||||
.tcp_product_thumb a {
|
||||
display: block;
|
||||
height: 196px;
|
||||
width: 240px;
|
||||
width: 192px;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
@ -43,8 +43,12 @@
|
||||
-webkit-box-shadow:none;
|
||||
box-shadow:none;
|
||||
display: none;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.tcp_product_thumb a:hover img {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
.wp-pagenavi {
|
||||
@ -80,3 +84,20 @@
|
||||
border:none !important;
|
||||
color: #AFA8A5 !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#mapa {
|
||||
float: right;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 65px;
|
||||
width: 500px !important;
|
||||
height: 380px !important;
|
||||
}
|
||||
|
||||
#mapa img {
|
||||
-moz-box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
@ -93,11 +93,6 @@ jQuery(document).ready(function() {
|
||||
|
||||
} // End IF Statement
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add alt-row styling to tables. */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
jQuery( '.entry table tr:odd').addClass( 'alt-table-row' );
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Superfish navigation dropdown. */
|
||||
@ -116,80 +111,80 @@ if( jQuery().superfish ) {
|
||||
/* Detect and adjust the heights of the main columns to match. */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
// Detect the heights of the two main columns.
|
||||
|
||||
var content;
|
||||
content = jQuery("#main");
|
||||
|
||||
var contentHeight = content.height();
|
||||
|
||||
if ( jQuery('#sidebar').length ) {
|
||||
alert('hola');
|
||||
var sidebar;
|
||||
sidebar = jQuery("#sidebar");
|
||||
|
||||
var sidebarHeight = sidebar.height();
|
||||
|
||||
// Determine the ideal new sidebar height.
|
||||
|
||||
var newSidebarHeight;
|
||||
var contentPadding;
|
||||
var sidebarPadding;
|
||||
|
||||
contentPadding = parseInt( content.css( 'padding-top' ) ) + parseInt( content.css( 'padding-bottom' ) );
|
||||
sidebarPadding = parseInt( sidebar.css( 'padding-top' ) ) + parseInt( sidebar.css( 'padding-bottom' ) );
|
||||
|
||||
if( contentHeight < sidebarHeight ) {
|
||||
content.height( sidebarHeight + sidebarPadding );
|
||||
sidebar.height( sidebarHeight + sidebarPadding );
|
||||
|
||||
newSidebarHeight = sidebarHeight + sidebarPadding;
|
||||
|
||||
content.css( 'padding-bottom', 8 );
|
||||
|
||||
} // End IF Statement
|
||||
|
||||
if( contentHeight > sidebarHeight ) {
|
||||
|
||||
sidebar.height( contentHeight + contentPadding );
|
||||
content.height( contentHeight + contentPadding );
|
||||
|
||||
newSidebarHeight = contentHeight + contentPadding;
|
||||
|
||||
content.css( 'padding-bottom', 8 );
|
||||
|
||||
} // End IF Statement
|
||||
|
||||
newSidebarHeight = Math.ceil( newSidebarHeight );
|
||||
|
||||
// Make the height of the sidebar the same as the container.
|
||||
// sidebar.css( 'height', String( newSidebarHeight + 'px' ) );
|
||||
}
|
||||
// // Detect the heights of the two main columns.
|
||||
//
|
||||
// var content;
|
||||
// content = jQuery("#main");
|
||||
//
|
||||
// var contentHeight = content.height();
|
||||
//
|
||||
// if ( jQuery('#sidebar').length ) {
|
||||
// alert('hola');
|
||||
// var sidebar;
|
||||
// sidebar = jQuery("#sidebar");
|
||||
//
|
||||
// var sidebarHeight = sidebar.height();
|
||||
//
|
||||
// // Determine the ideal new sidebar height.
|
||||
//
|
||||
// var newSidebarHeight;
|
||||
// var contentPadding;
|
||||
// var sidebarPadding;
|
||||
//
|
||||
// contentPadding = parseInt( content.css( 'padding-top' ) ) + parseInt( content.css( 'padding-bottom' ) );
|
||||
// sidebarPadding = parseInt( sidebar.css( 'padding-top' ) ) + parseInt( sidebar.css( 'padding-bottom' ) );
|
||||
//
|
||||
// if( contentHeight < sidebarHeight ) {
|
||||
// content.height( sidebarHeight + sidebarPadding );
|
||||
// sidebar.height( sidebarHeight + sidebarPadding );
|
||||
//
|
||||
// newSidebarHeight = sidebarHeight + sidebarPadding;
|
||||
//
|
||||
// content.css( 'padding-bottom', 8 );
|
||||
//
|
||||
// } // End IF Statement
|
||||
//
|
||||
// if( contentHeight > sidebarHeight ) {
|
||||
//
|
||||
// sidebar.height( contentHeight + contentPadding );
|
||||
// content.height( contentHeight + contentPadding );
|
||||
//
|
||||
// newSidebarHeight = contentHeight + contentPadding;
|
||||
//
|
||||
// content.css( 'padding-bottom', 8 );
|
||||
//
|
||||
// } // End IF Statement
|
||||
//
|
||||
// newSidebarHeight = Math.ceil( newSidebarHeight );
|
||||
//
|
||||
// // Make the height of the sidebar the same as the container.
|
||||
// // sidebar.css( 'height', String( newSidebarHeight + 'px' ) );
|
||||
// }
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Toggle Search Form. */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
jQuery( '.top-search a' ).click( function() {
|
||||
|
||||
var searchAnchorObj = jQuery( this );
|
||||
|
||||
if ( searchAnchorObj.parent().hasClass( 'close' ) ) {
|
||||
searchAnchorObj.fadeTo( 'slow', 0, function () {
|
||||
searchAnchorObj.parent().removeClass( 'close' );
|
||||
searchAnchorObj.text( 'Search' ).fadeTo( 'slow', 1 );
|
||||
});
|
||||
} else {
|
||||
searchAnchorObj.fadeTo( 'slow', 0, function () {
|
||||
searchAnchorObj.parent().addClass( 'close' );
|
||||
searchAnchorObj.text( 'Close' ).fadeTo( 'slow', 1 );
|
||||
});
|
||||
}
|
||||
|
||||
jQuery( '#search-top' ).slideToggle( 'slow', function() {});
|
||||
|
||||
return false;
|
||||
});
|
||||
//jQuery( '.top-search a' ).click( function() {
|
||||
//
|
||||
// var searchAnchorObj = jQuery( this );
|
||||
//
|
||||
// if ( searchAnchorObj.parent().hasClass( 'close' ) ) {
|
||||
// searchAnchorObj.fadeTo( 'slow', 0, function () {
|
||||
// searchAnchorObj.parent().removeClass( 'close' );
|
||||
// searchAnchorObj.text( 'Search' ).fadeTo( 'slow', 1 );
|
||||
// });
|
||||
// } else {
|
||||
// searchAnchorObj.fadeTo( 'slow', 0, function () {
|
||||
// searchAnchorObj.parent().addClass( 'close' );
|
||||
// searchAnchorObj.text( 'Close' ).fadeTo( 'slow', 1 );
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// jQuery( '#search-top' ).slideToggle( 'slow', function() {});
|
||||
//
|
||||
// return false;
|
||||
//});
|
||||
|
||||
}); // End jQuery()
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ $see_first_custom_area = isset( $instance['see_first_custom_area'] ) ? $instance
|
||||
$see_second_custom_area = isset( $instance['see_second_custom_area'] ) ? $instance['see_second_custom_area'] : false;
|
||||
$see_third_custom_area = isset( $instance['see_third_custom_area'] ) ? $instance['see_third_custom_area'] : false;
|
||||
|
||||
$thumb_size = array(210,210);
|
||||
$thumb_size = array(185,185);
|
||||
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
@ -76,7 +76,7 @@ while ( have_posts() ) :
|
||||
|
||||
?>
|
||||
<a rel="lightbox" href="<?php echo $large_image_url[0]; ?>" title="<?php echo $description; ?>" class="size-<?php echo $image_size; ?>">
|
||||
<?php the_post_thumbnail($thumb_size); ?>
|
||||
<?php echo the_post_thumbnail($thumb_size); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {text-de
|
||||
.social-icons li.facebook {background: url(images/ico-facebook-footer.png) no-repeat left center;}
|
||||
.social-icons li.twitter {background: url(images/ico-twitter-footer.png) no-repeat left center;;}
|
||||
.social-icons li.blogger {background: url(images/ico-blogger-footer.png) no-repeat left center;;}
|
||||
.social-icons li a {padding: 2px 20px 0px 35px; display: block; color: #999; text-transform: none;}
|
||||
.social-icons li a {padding: 2px 20px 0px 35px; display: block; color: #999; text-transform: uppercase;}
|
||||
.social-icons li a:hover {text-decoration: none; color: #fff}
|
||||
|
||||
|
||||
|
||||
@ -1,192 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Template Name: Contact Form
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
$nameError = '';
|
||||
$emailError = '';
|
||||
$commentError = '';
|
||||
|
||||
//If the form is submitted
|
||||
if(isset($_POST['submitted'])) {
|
||||
|
||||
//Check to see if the honeypot captcha field was filled in
|
||||
if(trim($_POST['checking']) !== '') {
|
||||
$captchaError = true;
|
||||
} else {
|
||||
|
||||
//Check to make sure that the name field is not empty
|
||||
if(trim($_POST['contactName']) === '') {
|
||||
$nameError = __( 'You forgot to enter your name.', 'woothemes' );
|
||||
$hasError = true;
|
||||
} else {
|
||||
$name = trim($_POST['contactName']);
|
||||
}
|
||||
|
||||
//Check to make sure sure that a valid email address is submitted
|
||||
if(trim($_POST['email']) === '') {
|
||||
$emailError = __( 'You forgot to enter your email address.', 'woothemes' );
|
||||
$hasError = true;
|
||||
} else if (!eregi( "^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
|
||||
$emailError = __( 'You entered an invalid email address.', 'woothemes' );
|
||||
$hasError = true;
|
||||
} else {
|
||||
$email = trim($_POST['email']);
|
||||
}
|
||||
|
||||
//Check to make sure comments were entered
|
||||
if(trim($_POST['comments']) === '') {
|
||||
$commentError = __( 'You forgot to enter your comments.', 'woothemes' );
|
||||
$hasError = true;
|
||||
} else {
|
||||
if(function_exists( 'stripslashes')) {
|
||||
$comments = stripslashes(trim($_POST['comments']));
|
||||
} else {
|
||||
$comments = trim($_POST['comments']);
|
||||
}
|
||||
}
|
||||
|
||||
//If there is no error, send the email
|
||||
if(!isset($hasError)) {
|
||||
|
||||
$emailTo = get_option( 'woo_contactform_email' );
|
||||
$subject = __( 'Contact Form Submission from ', 'woothemes' ).$name;
|
||||
$sendCopy = trim($_POST['sendCopy']);
|
||||
$body = __( "Name: $name \n\nEmail: $email \n\nComments: $comments", 'woothemes' );
|
||||
$headers = __( 'From: ', 'woothemes') .' <'.$email.'>' . "\r\n" . __( 'Reply-To: ', 'woothemes' ) . $email;
|
||||
|
||||
//Modified 2010-04-29 (fox)
|
||||
wp_mail($emailTo, $subject, $body, $headers);
|
||||
|
||||
if($sendCopy == true) {
|
||||
$subject = __( 'You emailed ', 'woothemes' ).get_bloginfo( 'title' );
|
||||
$headers = __( 'From: ', 'woothemes' ) . '<'.$emailTo.'>';
|
||||
wp_mail($email, $subject, $body, $headers);
|
||||
}
|
||||
|
||||
$emailSent = true;
|
||||
|
||||
}
|
||||
}
|
||||
} ?>
|
||||
<?php get_header(); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--//--><![CDATA[//><!--
|
||||
jQuery(document).ready(function() {
|
||||
jQuery( 'form#contactForm').submit(function() {
|
||||
jQuery( 'form#contactForm .error').remove();
|
||||
var hasError = false;
|
||||
jQuery( '.requiredField').each(function() {
|
||||
if(jQuery.trim(jQuery(this).val()) == '') {
|
||||
var labelText = jQuery(this).prev( 'label').text();
|
||||
jQuery(this).parent().append( '<span class="error"><?php _e( 'You forgot to enter your', 'woothemes' ); ?> '+labelText+'.</span>' );
|
||||
jQuery(this).addClass( 'inputError' );
|
||||
hasError = true;
|
||||
} else if(jQuery(this).hasClass( 'email')) {
|
||||
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
||||
if(!emailReg.test(jQuery.trim(jQuery(this).val()))) {
|
||||
var labelText = jQuery(this).prev( 'label').text();
|
||||
jQuery(this).parent().append( '<span class="error"><?php _e( 'You entered an invalid', 'woothemes' ); ?> '+labelText+'.</span>' );
|
||||
jQuery(this).addClass( 'inputError' );
|
||||
hasError = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(!hasError) {
|
||||
var formInput = jQuery(this).serialize();
|
||||
jQuery.post(jQuery(this).attr( 'action'),formInput, function(data){
|
||||
jQuery( 'form#contactForm').slideUp( "fast", function() {
|
||||
jQuery(this).before( '<p class="tick"><?php _e( '<strong>Thanks!</strong> Your email was successfully sent.', 'woothemes' ); ?></p>' );
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
});
|
||||
//-->!]]>
|
||||
</script>
|
||||
|
||||
<div id="content" class="col-full">
|
||||
<div id="main" class="col-right">
|
||||
|
||||
<?php if ( $woo_options[ 'woo_breadcrumbs_show' ] == 'true' ) { ?>
|
||||
<div id="breadcrumbs">
|
||||
<?php woo_breadcrumbs(); ?>
|
||||
</div><!--/#breadcrumbs -->
|
||||
<?php } ?>
|
||||
|
||||
<div id="contact-page" class="post">
|
||||
|
||||
<?php if( isset( $emailSent ) && $emailSent == true ) { ?>
|
||||
|
||||
<p class="info"><?php _e( 'Your email was successfully sent.', 'woothemes' ); ?></p>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<?php if ( have_posts() ) { ?>
|
||||
|
||||
<?php while ( have_posts() ) { the_post(); ?>
|
||||
|
||||
<h1 class="title"><?php the_title(); ?></h1>
|
||||
|
||||
<div class="entry">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
|
||||
<?php if(isset($hasError) || isset($captchaError) ) { ?>
|
||||
<p class="alert"><?php _e( 'There was an error submitting the form.', 'woothemes' ); ?></p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( get_option( 'woo_contactform_email') == '' ) { ?>
|
||||
<?php echo do_shortcode( '[box type="alert"]'.__( 'E-mail has not been setup properly. Please add your contact e-mail!', 'woothemes' ).'[/box]' ); ?>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<form action="<?php the_permalink(); ?>" id="contactForm" method="post">
|
||||
|
||||
<ol class="forms">
|
||||
<li><label for="contactName"><?php _e( 'Name', 'woothemes' ); ?></label>
|
||||
<input type="text" name="contactName" id="contactName" value="<?php if( isset( $_POST['contactName'] ) ) { echo $_POST['contactName']; } ?>" class="txt requiredField" />
|
||||
<?php if($nameError != '') { ?>
|
||||
<span class="error"><?php echo $nameError;?></span>
|
||||
<?php } ?>
|
||||
</li>
|
||||
|
||||
<li><label for="email"><?php _e( 'Email', 'woothemes' ); ?></label>
|
||||
<input type="text" name="email" id="email" value="<?php if( isset( $_POST['email'] ) ) { echo $_POST['email']; } ?>" class="txt requiredField email" />
|
||||
<?php if($emailError != '') { ?>
|
||||
<span class="error"><?php echo $emailError;?></span>
|
||||
<?php } ?>
|
||||
</li>
|
||||
|
||||
<li class="textarea"><label for="commentsText"><?php _e( 'Message', 'woothemes' ); ?></label>
|
||||
<textarea name="comments" id="commentsText" rows="20" cols="30" class="requiredField"><?php if( isset( $_POST['comments'] ) ) { if( function_exists( 'stripslashes' ) ) { echo stripslashes( $_POST['comments'] ); } else { echo $_POST['comments']; } } ?></textarea>
|
||||
<?php if( $commentError != '' ) { ?>
|
||||
<span class="error"><?php echo $commentError;?></span>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<li class="inline"><input type="checkbox" name="sendCopy" id="sendCopy" value="true"<?php if( isset( $_POST['sendCopy'] ) && $_POST['sendCopy'] == true ) { echo ' checked="checked"'; } ?> /><label for="sendCopy"><?php _e( 'Send a copy of this email to yourself', 'woothemes' ); ?></label></li>
|
||||
<li class="screenReader"><label for="checking" class="screenReader"><?php _e( 'If you want to submit this form, do not enter anything in this field', 'woothemes' ); ?></label><input type="text" name="checking" id="checking" class="screenReader" value="<?php if( isset( $_POST['checking'] ) ) { echo $_POST['checking']; } ?>" /></li>
|
||||
<li class="buttons"><input type="hidden" name="submitted" id="submitted" value="true" /><input class="submit button" type="submit" value="<?php esc_attr_e( 'Submit', 'woothemes' ); ?>" /></li>
|
||||
</ol>
|
||||
</form>
|
||||
<?php
|
||||
} // End WHILE Loop
|
||||
} // End IF Statement
|
||||
?>
|
||||
<?php } ?>
|
||||
|
||||
<div class="fix"></div>
|
||||
|
||||
</div><!-- /#contact-page -->
|
||||
</div><!-- /#main -->
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
</div><!-- /#content -->
|
||||
|
||||
<?php get_footer(); ?>
|
||||
Reference in New Issue
Block a user