Google Forms - Version 0.10

Version Description

No known upgrade issues.

Download this release

Release Info

Developer mpwalsh8
Plugin Icon wp plugin Google Forms
Version 0.10
Comparing to
See all releases

Code changes from version 0.9 to 0.10

Files changed (5) hide show
  1. gforms.css +5 -0
  2. index.php +2 -2
  3. readme.txt +20 -6
  4. wpgform-core.php +48 -28
  5. wpgform-options.php +2 -2
gforms.css CHANGED
@@ -8,6 +8,11 @@
8
  * default font.
9
  */
10
 
 
 
 
 
 
11
  body.ss-base-body {}
12
  div.errorbox-good {}
13
  div.ss-attribution {}
8
  * default font.
9
  */
10
 
11
+ label.gform-error {
12
+ float: right;
13
+ color: red;
14
+ font-weight: bold;
15
+ }
16
  body.ss-base-body {}
17
  div.errorbox-good {}
18
  div.ss-attribution {}
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.9
8
- * Build: 0.9.$WCREV$
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.10
8
+ * Build: 0.10.$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.2.1
7
- Stable tag: trunk
8
 
9
  Embeds a published, public Google Form in a WordPress post, page, or widget.
10
 
@@ -70,9 +70,11 @@ For many uses the simple embedding of a Google Form in an `<iframe>` may be suff
70
  = I really like having a colon character after my form labels, is that possible? =
71
  Sure. You can use the following CSS to have the colon character appear after all of your form labels.
72
 
73
- `label.ss-q-title:after {
 
74
  content: ':';
75
- }`
 
76
 
77
  == CSS ==
78
 
@@ -87,9 +89,15 @@ There are two ways to customize the Google Form CSS.
87
 
88
  = Default Google Form CSS =
89
 
90
- As of 2011-09-22, the following is are the CSS classes which Google Forms make use of. The CSS below represents the default CSS provided by WordPress Google Form. These CSS definitions can be copied and pasted into your theme CSS or the WordPress Google Form custom CSS setting and changed as desired.
91
 
92
- 'body.ss-base-body {}
 
 
 
 
 
 
93
  div.errorbox-good {}
94
  div.ss-attribution {}
95
  div.ss-footer {}
@@ -142,7 +150,8 @@ textarea.ss-q-long {
142
  background-color: #e0e0e0;
143
  font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
144
  }
145
- tr.ss-gridrow {}`
 
146
 
147
  == Screenshots ==
148
 
@@ -156,6 +165,11 @@ No known upgrade issues.
156
 
157
  == Changelog ==
158
 
 
 
 
 
 
159
  = Version 0.9 =
160
 
161
  * Added screenshots.
4
  Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
5
  Requires at least: 3.0
6
  Tested up to: 3.2.1
7
+ Stable tag: 0.10
8
 
9
  Embeds a published, public Google Form in a WordPress post, page, or widget.
10
 
70
  = I really like having a colon character after my form labels, is that possible? =
71
  Sure. You can use the following CSS to have the colon character appear after all of your form labels.
72
 
73
+ `
74
+ label.ss-q-title:after {
75
  content: ':';
76
+ }
77
+ `
78
 
79
  == CSS ==
80
 
89
 
90
  = Default Google Form CSS =
91
 
92
+ As of 2011-10-07, the following is are the CSS classes which Google Forms make use of. The CSS below represents the default CSS provided by WordPress Google Form. These CSS definitions can be copied and pasted into your theme CSS or the WordPress Google Form custom CSS setting and changed as desired.
93
 
94
+ `
95
+ label.gform-error {
96
+ float: right;
97
+ color: red;
98
+ font-weight: bold;
99
+ }
100
+ body.ss-base-body {}
101
  div.errorbox-good {}
102
  div.ss-attribution {}
103
  div.ss-footer {}
150
  background-color: #e0e0e0;
151
  font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
152
  }
153
+ tr.ss-gridrow {}
154
+ `
155
 
156
  == Screenshots ==
157
 
165
 
166
  == Changelog ==
167
 
168
+ = Version 0.10 =
169
+
170
+ * Added support for required fields using the jQuery Validate plugin.
171
+ * Added CSS classes to support jQuery required field validation.
172
+
173
  = Version 0.9 =
174
 
175
  * Added screenshots.
wpgform-core.php CHANGED
@@ -28,18 +28,17 @@ define('WPGFORM_PATH', WP_PLUGIN_DIR.'/'.dirname(plugin_basename(__FILE__))) ;
28
  */
29
  function wpgform_init()
30
  {
31
- $wpgform_options = get_option('wpgform_options');
32
 
33
  if ($wpgform_options['sc_posts'] == 1)
34
- add_shortcode('wpgform', 'wpgform_shortcode');
35
 
36
  if ($wpgform_options['sc_widgets'] == 1)
37
- add_filter('widget_text', 'do_shortcode');
38
 
39
- if ($wpgform_options['default_css'] == 1)
40
- add_action('template_redirect', 'wpgform_head');
41
 
42
- //add_action('wp_footer', 'wpgform_footer') ;
43
  }
44
 
45
  /**
@@ -54,10 +53,10 @@ function wpgform_admin_menu()
54
  require_once(WPGFORM_PATH . '/wpgform-options.php') ;
55
 
56
  $wpgform_options_page = add_options_page('WP Google Form', 'WP Google Form ',
57
- 'manage_options', 'wpgform-options.php', 'wpgform_options_page');
58
- add_action('admin_footer-'.$wpgform_options_page, 'wpgform_options_admin_footer');
59
- add_action('admin_print_scripts-'.$wpgform_options_page, 'wpgform_options_print_scripts');
60
- add_action('admin_print_styles-'.$wpgform_options_page, 'wpgform_options_print_styles');
61
  }
62
 
63
  /**
@@ -91,12 +90,12 @@ function wpgform_register_activation_hook()
91
  ,'donation_message' => 0
92
  ) ;
93
 
94
- add_option('wpgform_options', $default_wpgform_options);
95
- //add_shortcode('wpgform', 'wpgform_shortcode');
96
- add_filter('widget_text', 'do_shortcode');
97
  }
98
 
99
- add_shortcode('gform', array('wpGForm', 'RenderGForm'));
100
 
101
 
102
  /**
@@ -227,7 +226,7 @@ class wpGForm
227
  ,'thead' => array()
228
  ,'tr' => array('class' => array())
229
  ,'td' => array('class' => array(), 'style' => array())
230
- );
231
 
232
  $html = wp_kses($html, $allowed_tags) ;
233
 
@@ -251,7 +250,7 @@ class wpGForm
251
  // much of anything useful.
252
 
253
  $html = preg_replace('#<script[^>]*>.*?</script>#is',
254
- '<!-- Google Forms unnessary Javascript removed -->' . PHP_EOL, $html);
255
 
256
  // Augment class names with some sort of a prefix?
257
 
@@ -295,7 +294,7 @@ class wpGForm
295
 
296
  // Output custom CSS?
297
 
298
- $wpgform_options = get_option('wpgform_options');
299
 
300
  if ($wpgform_options['custom_css'] == 1)
301
  $css = '<style>' . $wpgform_options['custom_css_styles'] . '</style>' ;
@@ -332,9 +331,21 @@ class wpGForm
332
  */
333
  function wpgform_head()
334
  {
335
- // Need default gForm CSS
336
- wp_enqueue_style('gform',
337
- plugins_url(plugin_basename(dirname(__FILE__) . '/gforms.css'))) ;
 
 
 
 
 
 
 
 
 
 
 
 
338
  }
339
 
340
  /**
@@ -344,17 +355,26 @@ function wpgform_head()
344
  */
345
  function wpgform_footer()
346
  {
347
- // Need jQuery to dink with DIV content
348
- wp_enqueue_script('jquery') ;
 
 
 
 
 
 
349
  ?>
 
350
  <script type="text/javascript">
351
- //
352
- // jQuery script to decode any HTML entities found in the
353
- // ss-section-description classes.
354
- //
355
  jQuery(document).ready(function($) {
356
- alert('GForm jQuery goes here.') ;
357
- // Placeholder to do some processing on the Google form content if/when needed.
 
 
 
 
 
 
358
  });
359
  </script>
360
  <?php
28
  */
29
  function wpgform_init()
30
  {
31
+ $wpgform_options = get_option('wpgform_options') ;
32
 
33
  if ($wpgform_options['sc_posts'] == 1)
34
+ add_shortcode('wpgform', 'wpgform_shortcode') ;
35
 
36
  if ($wpgform_options['sc_widgets'] == 1)
37
+ add_filter('widget_text', 'do_shortcode') ;
38
 
39
+ add_action('template_redirect', 'wpgform_head') ;
 
40
 
41
+ add_action('wp_footer', 'wpgform_footer') ;
42
  }
43
 
44
  /**
53
  require_once(WPGFORM_PATH . '/wpgform-options.php') ;
54
 
55
  $wpgform_options_page = add_options_page('WP Google Form', 'WP Google Form ',
56
+ 'manage_options', 'wpgform-options.php', 'wpgform_options_page') ;
57
+ add_action('admin_footer-'.$wpgform_options_page, 'wpgform_options_admin_footer') ;
58
+ add_action('admin_print_scripts-'.$wpgform_options_page, 'wpgform_options_print_scripts') ;
59
+ add_action('admin_print_styles-'.$wpgform_options_page, 'wpgform_options_print_styles') ;
60
  }
61
 
62
  /**
90
  ,'donation_message' => 0
91
  ) ;
92
 
93
+ add_option('wpgform_options', $default_wpgform_options) ;
94
+ //add_shortcode('wpgform', 'wpgform_shortcode') ;
95
+ add_filter('widget_text', 'do_shortcode') ;
96
  }
97
 
98
+ add_shortcode('gform', array('wpGForm', 'RenderGForm')) ;
99
 
100
 
101
  /**
226
  ,'thead' => array()
227
  ,'tr' => array('class' => array())
228
  ,'td' => array('class' => array(), 'style' => array())
229
+ ) ;
230
 
231
  $html = wp_kses($html, $allowed_tags) ;
232
 
250
  // much of anything useful.
251
 
252
  $html = preg_replace('#<script[^>]*>.*?</script>#is',
253
+ '<!-- Google Forms unnessary Javascript removed -->' . PHP_EOL, $html) ;
254
 
255
  // Augment class names with some sort of a prefix?
256
 
294
 
295
  // Output custom CSS?
296
 
297
+ $wpgform_options = get_option('wpgform_options') ;
298
 
299
  if ($wpgform_options['custom_css'] == 1)
300
  $css = '<style>' . $wpgform_options['custom_css_styles'] . '</style>' ;
331
  */
332
  function wpgform_head()
333
  {
334
+ $wpgform_options = get_option('wpgform_options') ;
335
+
336
+ // Load default gForm CSS?
337
+ if ($wpgform_options['default_css'] == 1)
338
+ {
339
+ wp_enqueue_style('gform',
340
+ plugins_url(plugin_basename(dirname(__FILE__) . '/gforms.css'))) ;
341
+ }
342
+
343
+ // Load the jQuery Validate from the Microsoft CDN, it isn't
344
+ // available from the Google CDN or I'd load it from there!
345
+ wp_register_script('jquery-validate',
346
+ 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js',
347
+ array('jquery'), false, true) ;
348
+ wp_enqueue_script('jquery-validate') ;
349
  }
350
 
351
  /**
355
  */
356
  function wpgform_footer()
357
  {
358
+ //
359
+ // jQuery script to initialize the form validation
360
+ // neccessary so bad or missing data is submitted.
361
+ // When required fields are blank the normal Google
362
+ // processing for form errors doesn't occur, this
363
+ // jQuery script handles it gracefully. The fields
364
+ // have only rudimentary validation.
365
+ //
366
  ?>
367
+
368
  <script type="text/javascript">
 
 
 
 
369
  jQuery(document).ready(function($) {
370
+ $("div > .ss-item-required input").addClass("gform-required");
371
+ $("div > .ss-item-required textarea").addClass("gform-required");
372
+ $.validator.addClassRules("gform-required", {
373
+ required: true
374
+ });
375
+ $("#ss-form").validate({
376
+ errorClass: "gform-error"
377
+ }) ;
378
  });
379
  </script>
380
  <?php
wpgform-options.php CHANGED
@@ -27,7 +27,7 @@
27
  */
28
  function wpgform_options_admin_footer()
29
  {
30
- error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
31
  ?>
32
  <!-- Setup jQuery Tabs -->
33
  <script type="text/javascript">
@@ -36,7 +36,7 @@ function wpgform_options_admin_footer()
36
  }) ;
37
  </script>
38
  <?php
39
- error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
40
  } /* function wpgform_options_admin_footer() */
41
 
42
  /**
27
  */
28
  function wpgform_options_admin_footer()
29
  {
30
+ //error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
31
  ?>
32
  <!-- Setup jQuery Tabs -->
33
  <script type="text/javascript">
36
  }) ;
37
  </script>
38
  <?php
39
+ //error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
40
  } /* function wpgform_options_admin_footer() */
41
 
42
  /**