Version Description
No known upgrade issues.
Download this release
Release Info
Developer | mpwalsh8 |
Plugin | Google Forms |
Version | 0.35 |
Comparing to | |
See all releases |
Code changes from version 0.34 to 0.35
- index.php +2 -2
- readme.txt +6 -1
- wpgform-core.php +46 -28
index.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
* Plugin Name: WordPress Google Form
|
5 |
* Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
|
6 |
* Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
|
7 |
-
* Version: 0.
|
8 |
-
* Build: 0.
|
9 |
* Last Modified: $WCDATE$
|
10 |
* Author: Mike Walsh
|
11 |
* Author URI: http://www.michaelwalsh.org
|
4 |
* Plugin Name: WordPress Google Form
|
5 |
* Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
|
6 |
* Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
|
7 |
+
* Version: 0.35
|
8 |
+
* Build: 0.35.$WCREV$
|
9 |
* Last Modified: $WCDATE$
|
10 |
* Author: Mike Walsh
|
11 |
* Author URI: http://www.michaelwalsh.org
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.4.1
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Embeds a published, public Google Form in a WordPress post, page, or widget.
|
10 |
|
@@ -46,6 +46,7 @@ The WordPress Google Form shortcode `gform` supports a number of attributes that
|
|
46 |
* __maph1h2__: By default Google Forms have title wrapped in a <h1> tag. If you want the form title but not as an <h1> element, add `maph1h2='on'` to your shortcode usage. The <h1> elements will be mapped to <h2> elements. The CSS class attributes remain unchanged.
|
47 |
* __email__: Notify the site's WordPress administrator (or sendto email address) that a form has been submitted by setting the __email__ attribute to __on__. This will result in an email being sent to the blog administrator (or sendto email address) letting them know a form was submitted with the URL of the form along with the date and time of submission.
|
48 |
* __sendto__: Notify the "sendto" email address that a form has been submitted by setting the __email__ attribute to __on__. This will result in an email being sent to the "sendto" letting them know a form was submitted with the URL of the form along with the date and time of submission. The email message will always be sent to the blog administrator via Bcc.
|
|
|
49 |
|
50 |
`[gform form='https://docs.google.com/spreadsheet/viewform?hl=en_US&pli=1&formkey=ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678#gid=0' confirm='http://www.example.com/thankyou/' style='ajax' class='mygform' legal='off' prefix='mygform-' br='on' title='on' maph1h2='on' email='on']`
|
51 |
|
@@ -192,6 +193,10 @@ No known upgrade issues.
|
|
192 |
|
193 |
== Changelog ==
|
194 |
|
|
|
|
|
|
|
|
|
195 |
= Version 0.34 =
|
196 |
* Fixed syntax error which caused plugin to fail. Whoops.
|
197 |
|
4 |
Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.4.1
|
7 |
+
Stable tag: 0.35
|
8 |
|
9 |
Embeds a published, public Google Form in a WordPress post, page, or widget.
|
10 |
|
46 |
* __maph1h2__: By default Google Forms have title wrapped in a <h1> tag. If you want the form title but not as an <h1> element, add `maph1h2='on'` to your shortcode usage. The <h1> elements will be mapped to <h2> elements. The CSS class attributes remain unchanged.
|
47 |
* __email__: Notify the site's WordPress administrator (or sendto email address) that a form has been submitted by setting the __email__ attribute to __on__. This will result in an email being sent to the blog administrator (or sendto email address) letting them know a form was submitted with the URL of the form along with the date and time of submission.
|
48 |
* __sendto__: Notify the "sendto" email address that a form has been submitted by setting the __email__ attribute to __on__. This will result in an email being sent to the "sendto" letting them know a form was submitted with the URL of the form along with the date and time of submission. The email message will always be sent to the blog administrator via Bcc.
|
49 |
+
* __spreadsheet__: The full URL to the "Shared" Google Docs Spreadsheet which stores the form responses. You must be able to open this URL successfully from a browser for the link in the email to work properly. This attribute is used in conjunction with the __email__ attribute, it has no effect when the __email__ attribute is not turned __on__.
|
50 |
|
51 |
`[gform form='https://docs.google.com/spreadsheet/viewform?hl=en_US&pli=1&formkey=ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678#gid=0' confirm='http://www.example.com/thankyou/' style='ajax' class='mygform' legal='off' prefix='mygform-' br='on' title='on' maph1h2='on' email='on']`
|
52 |
|
193 |
|
194 |
== Changelog ==
|
195 |
|
196 |
+
= Version 0.35 =
|
197 |
+
* Changed format of email to use the title of the page/post instead of the permalink to the form.
|
198 |
+
* Added new shortcode attribute __spreadsheet__. The value __spreadsheet__ attribute is a full URL to a shared Google Docs Spreadsheet which contains the responses to the form. A link to the Spreadsheet is included in the email notification when enabled.
|
199 |
+
|
200 |
= Version 0.34 =
|
201 |
* Fixed syntax error which caused plugin to fail. Whoops.
|
202 |
|
wpgform-core.php
CHANGED
@@ -271,6 +271,16 @@ class wpGForm
|
|
271 |
$suffix = $options['suffix'] ;
|
272 |
}
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
// Breaks between labels and inputs?
|
275 |
$br = $options['br'] === 'on' ;
|
276 |
|
@@ -551,7 +561,7 @@ jQuery(document).ready(function($) {
|
|
551 |
// Send email?
|
552 |
if (self::$posted && is_null($action) && $email)
|
553 |
{
|
554 |
-
wpGForm::SendConfirmationEmail($wpgform_options['email_format'], $sendto) ;
|
555 |
}
|
556 |
|
557 |
// Check browser compatibility? The jQuery used by this plugin may
|
@@ -694,7 +704,7 @@ jQuery(document).ready(function($) {
|
|
694 |
global $pagenow ;
|
695 |
$pageURL = 'http' ;
|
696 |
|
697 |
-
if ($_SERVER[
|
698 |
|
699 |
$pageURL .= '://' ;
|
700 |
|
@@ -714,20 +724,21 @@ jQuery(document).ready(function($) {
|
|
714 |
*/
|
715 |
function RenderGForm($atts) {
|
716 |
$params = shortcode_atts(array(
|
717 |
-
'form'
|
718 |
-
'confirm'
|
719 |
-
'alert'
|
720 |
-
'class'
|
721 |
-
'legal'
|
722 |
-
'br'
|
723 |
-
'suffix'
|
724 |
-
'prefix'
|
725 |
-
'readonly'
|
726 |
-
'title'
|
727 |
-
'maph1h2'
|
728 |
-
'email'
|
729 |
-
'sendto'
|
730 |
-
'
|
|
|
731 |
), $atts) ;
|
732 |
|
733 |
return wpGForm::ConstructGForm($params) ;
|
@@ -741,12 +752,17 @@ jQuery(document).ready(function($) {
|
|
741 |
*
|
742 |
* @param string $action - action to take, register or unregister
|
743 |
*/
|
744 |
-
function SendConfirmationEmail($mode = WPGFORM_EMAIL_FORMAT_HTML, $sendto = false)
|
745 |
{
|
746 |
$wpgform_options = wpgform_get_plugin_options() ;
|
747 |
|
748 |
if ($sendto === false || $sendto === null) $sendto = get_bloginfo('admin_email') ;
|
749 |
|
|
|
|
|
|
|
|
|
|
|
750 |
if ($mode == WPGFORM_EMAIL_FORMAT_HTML)
|
751 |
{
|
752 |
$headers = 'MIME-Version: 1.0' . PHP_EOL ;
|
@@ -773,6 +789,7 @@ jQuery(document).ready(function($) {
|
|
773 |
{
|
774 |
$html = '
|
775 |
<html>
|
|
|
776 |
<head>
|
777 |
<title>%s</title>
|
778 |
</head>
|
@@ -783,7 +800,8 @@ jQuery(document).ready(function($) {
|
|
783 |
<p>
|
784 |
A form was submitted on your web site.
|
785 |
<ul>
|
786 |
-
<li>
|
|
|
787 |
<li>Date: %s</li>
|
788 |
<li>Time: %s</li>
|
789 |
</ul>
|
@@ -792,24 +810,21 @@ jQuery(document).ready(function($) {
|
|
792 |
Thank you,<br/><br/>
|
793 |
%s
|
794 |
</p>
|
795 |
-
<p>
|
796 |
-
</p>
|
797 |
</body>
|
798 |
-
</html>
|
799 |
-
' ;
|
800 |
|
801 |
-
$message = sprintf($html, get_bloginfo('name'),
|
802 |
-
|
803 |
}
|
804 |
else
|
805 |
{
|
806 |
$plain = 'FYI -' . PHP_EOL . PHP_EOL ;
|
807 |
$plain .= 'A form was submitted on your web site:' . PHP_EOL . PHP_EOL ;
|
808 |
-
$plain .= '
|
809 |
-
$plain .= 'Thank you,' . PHP_EOL . PHP_EOL . '%s' . PHP_EOL ;
|
810 |
|
811 |
-
$message = sprintf($plain,
|
812 |
-
date('Y-m-d'), date('H:i'), get_option('blogname')) ;
|
813 |
}
|
814 |
|
815 |
$to = sprintf('%s wpGForm Contact <%s>', get_option('blogname'), $sendto) ;
|
@@ -820,6 +835,9 @@ jQuery(document).ready(function($) {
|
|
820 |
|
821 |
$subject = sprintf('Form Submission from %s', get_option('blogname')) ;
|
822 |
|
|
|
|
|
|
|
823 |
$status = wp_mail($to, $subject, $message, $headers) ;
|
824 |
|
825 |
return $status ;
|
271 |
$suffix = $options['suffix'] ;
|
272 |
}
|
273 |
|
274 |
+
// Spreadsheet URL? Optional
|
275 |
+
if (!$options['spreadsheet'])
|
276 |
+
{
|
277 |
+
$spreadsheet = null ;
|
278 |
+
}
|
279 |
+
else
|
280 |
+
{
|
281 |
+
$spreadsheet = $options['spreadsheet'] ;
|
282 |
+
}
|
283 |
+
|
284 |
// Breaks between labels and inputs?
|
285 |
$br = $options['br'] === 'on' ;
|
286 |
|
561 |
// Send email?
|
562 |
if (self::$posted && is_null($action) && $email)
|
563 |
{
|
564 |
+
wpGForm::SendConfirmationEmail($wpgform_options['email_format'], $sendto, $spreadsheet) ;
|
565 |
}
|
566 |
|
567 |
// Check browser compatibility? The jQuery used by this plugin may
|
704 |
global $pagenow ;
|
705 |
$pageURL = 'http' ;
|
706 |
|
707 |
+
if (array_key_exists('HTTPS', $_SERVER) && $_SERVER['HTTPS'] == 'on') $pageURL .= 's' ;
|
708 |
|
709 |
$pageURL .= '://' ;
|
710 |
|
724 |
*/
|
725 |
function RenderGForm($atts) {
|
726 |
$params = shortcode_atts(array(
|
727 |
+
'form' => false, // Google Form URL
|
728 |
+
'confirm' => false, // Custom confirmation page URL to redirect to
|
729 |
+
'alert' => null, // Optional Alert Message
|
730 |
+
'class' => 'gform', // Container element's custom class value
|
731 |
+
'legal' => 'on', // Display Google Legal Stuff
|
732 |
+
'br' => 'off', // Insert <br> tags between labels and inputs
|
733 |
+
'suffix' => null, // Add suffix character(s) to all labels
|
734 |
+
'prefix' => null, // Add suffix character(s) to all labels
|
735 |
+
'readonly' => 'off', // Set all form elements to disabled
|
736 |
+
'title' => 'on', // Remove the H1 element(s) from the Form
|
737 |
+
'maph1h2' => 'off', // Map H1 element(s) on the form to H2 element(s)
|
738 |
+
'email' => 'off', // Send an email confirmation to blog admin on submission
|
739 |
+
'sendto' => null, // Send an email confirmation to a specific address on submission
|
740 |
+
'spreadsheet' => false, // Google Spreadsheet URL
|
741 |
+
'style' => WPGFORM_CONFIRM_REDIRECT // How to present the custom confirmation after submit
|
742 |
), $atts) ;
|
743 |
|
744 |
return wpGForm::ConstructGForm($params) ;
|
752 |
*
|
753 |
* @param string $action - action to take, register or unregister
|
754 |
*/
|
755 |
+
function SendConfirmationEmail($mode = WPGFORM_EMAIL_FORMAT_HTML, $sendto = false, $spreadsheet = null)
|
756 |
{
|
757 |
$wpgform_options = wpgform_get_plugin_options() ;
|
758 |
|
759 |
if ($sendto === false || $sendto === null) $sendto = get_bloginfo('admin_email') ;
|
760 |
|
761 |
+
if ($spreadsheet === false || $spreadsheet === null)
|
762 |
+
$spreadsheet = 'N/A' ;
|
763 |
+
else
|
764 |
+
$spreadsheet = sprintf('<a href="%s">View Form Submissions</a>', $spreadsheet) ;
|
765 |
+
|
766 |
if ($mode == WPGFORM_EMAIL_FORMAT_HTML)
|
767 |
{
|
768 |
$headers = 'MIME-Version: 1.0' . PHP_EOL ;
|
789 |
{
|
790 |
$html = '
|
791 |
<html>
|
792 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
793 |
<head>
|
794 |
<title>%s</title>
|
795 |
</head>
|
800 |
<p>
|
801 |
A form was submitted on your web site.
|
802 |
<ul>
|
803 |
+
<li>Form: %s</li>
|
804 |
+
<li>Responses: %s</li>
|
805 |
<li>Date: %s</li>
|
806 |
<li>Time: %s</li>
|
807 |
</ul>
|
810 |
Thank you,<br/><br/>
|
811 |
%s
|
812 |
</p>
|
|
|
|
|
813 |
</body>
|
814 |
+
</html>' ;
|
|
|
815 |
|
816 |
+
$message = sprintf($html, get_bloginfo('name'), get_the_title(),
|
817 |
+
$spreadsheet, date('Y-m-d'), date('H:i'), get_bloginfo('name')) ;
|
818 |
}
|
819 |
else
|
820 |
{
|
821 |
$plain = 'FYI -' . PHP_EOL . PHP_EOL ;
|
822 |
$plain .= 'A form was submitted on your web site:' . PHP_EOL . PHP_EOL ;
|
823 |
+
$plain .= 'Form: %s' . PHP_EOL . 'Responses: %s' . PHP_EOL . 'Date: %s' . PHP_EOL ;
|
824 |
+
$plain .= 'Time: %s' . PHP_EOL . PHP_EOL . 'Thank you,' . PHP_EOL . PHP_EOL . '%s' . PHP_EOL ;
|
825 |
|
826 |
+
$message = sprintf($plain, get_the_title(),
|
827 |
+
date('Y-m-d'), date('H:i'), $spreadsheet, get_option('blogname')) ;
|
828 |
}
|
829 |
|
830 |
$to = sprintf('%s wpGForm Contact <%s>', get_option('blogname'), $sendto) ;
|
835 |
|
836 |
$subject = sprintf('Form Submission from %s', get_option('blogname')) ;
|
837 |
|
838 |
+
if (WPGFORM_DEBUG)
|
839 |
+
wpgform_preprint_r($headers, htmlentities($message)) ;
|
840 |
+
|
841 |
$status = wp_mail($to, $subject, $message, $headers) ;
|
842 |
|
843 |
return $status ;
|