Optin Forms - Version 1.1.1

Version Description

  • Fixed exclude function.
Download this release

Release Info

Developer brs
Plugin Icon 128x128 Optin Forms
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1 to 1.1.1

Files changed (3) hide show
  1. includes/functions-forms.php +55 -17
  2. optin-forms.php +16 -3
  3. readme.txt +8 -2
includes/functions-forms.php CHANGED
@@ -1,15 +1,48 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  // Insert form on post, after first paragraph
4
  add_filter( "the_content", "optinform_insert_form_first_paragraph_post" );
5
 
6
  function optinform_insert_form_first_paragraph_post($content) {
7
  global $optinforms_form_placement_post, $optinforms_form_exclude_posts;
 
8
  if($optinforms_form_placement_post == '1'){
9
  $ad_code = optinforms_create_form();
10
- $optinforms_form_exclude_posts = explode(',', $optinforms_form_exclude_posts);
11
- if(is_single()) {
12
- if(is_single($optinforms_form_exclude_posts)) {
 
 
13
  // do nothing
14
  }
15
  else {
@@ -27,12 +60,12 @@ function optinform_insert_form_first_paragraph_post($content) {
27
  add_filter( "the_content", "optinform_insert_form_first_paragraph_page" );
28
 
29
  function optinform_insert_form_first_paragraph_page($content) {
30
- global $optinforms_form_placement_page, $optinforms_form_exclude_pages;
 
31
  if($optinforms_form_placement_page == '1'){
32
  $ad_code = optinforms_create_form();
33
- $optinforms_form_exclude_pages = explode(',', $optinforms_form_exclude_pages);
34
  if(is_page()) {
35
- if(is_page($optinforms_form_exclude_pages)) {
36
  // do nothing
37
  }
38
  else {
@@ -50,12 +83,12 @@ function optinform_insert_form_first_paragraph_page($content) {
50
  add_filter( "the_content", "optinform_insert_form_second_paragraph_post" );
51
 
52
  function optinform_insert_form_second_paragraph_post($content) {
53
- global $optinforms_form_placement_post, $optinforms_form_exclude_posts;
 
54
  if($optinforms_form_placement_post == '2'){
55
  $ad_code = optinforms_create_form();
56
- $optinforms_form_exclude_posts = explode(',', $optinforms_form_exclude_posts);
57
  if(is_single()) {
58
- if(is_single($optinforms_form_exclude_posts)) {
59
  // do nothing
60
  }
61
  else {
@@ -73,12 +106,12 @@ function optinform_insert_form_second_paragraph_post($content) {
73
  add_filter( "the_content", "optinform_insert_form_second_paragraph_page" );
74
 
75
  function optinform_insert_form_second_paragraph_page($content) {
76
- global $optinforms_form_placement_page, $optinforms_form_exclude_pages;
 
77
  if($optinforms_form_placement_page == '2'){
78
  $ad_code = optinforms_create_form();
79
- $optinforms_form_exclude_pages = explode(',', $optinforms_form_exclude_pages);
80
  if(is_page()) {
81
- if(is_page($optinforms_form_exclude_pages)) {
82
  // do nothing
83
  }
84
  else {
@@ -112,16 +145,21 @@ add_filter( "the_content", "optinforms_insert_form_after_post" );
112
 
113
  function optinforms_insert_form_after_post($content) {
114
  global $optinforms_form_placement_post, $optinforms_form_exclude_posts;
 
115
  if($optinforms_form_placement_post == '3' || empty($optinforms_form_placement_post)) {
116
- $optinforms_form_exclude_posts = explode(',', $optinforms_form_exclude_posts);
117
- if(is_single()) {
118
- if(is_single($optinforms_form_exclude_posts)) {
 
 
 
119
  // do nothing
120
  }
121
  else {
122
  $content .= optinforms_create_form();
123
  }
124
  }
 
125
  }
126
  return $content;
127
  }
@@ -131,10 +169,10 @@ add_filter( "the_content", "optinforms_insert_form_after_page" );
131
 
132
  function optinforms_insert_form_after_page($content) {
133
  global $optinforms_form_placement_page, $optinforms_form_exclude_pages;
 
134
  if($optinforms_form_placement_page == '3' || empty($optinforms_form_placement_page)) {
135
- $optinforms_form_exclude_pages = explode(',', $optinforms_form_exclude_pages);
136
  if(is_page()) {
137
- if(is_page($optinforms_form_exclude_pages)) {
138
  // do nothing
139
  }
140
  else {
1
  <?php
2
 
3
+ // Get excluded posts and create an array
4
+ function optinforms_get_excluded_posts() {
5
+ global $optinforms_form_exclude_posts;
6
+ if(empty($optinforms_form_exclude_posts)) {
7
+ $optinforms_get_excluded_posts = '0';
8
+ }
9
+ if(!is_string($optinforms_form_exclude_posts)) {
10
+ $optinforms_get_excluded_posts = '0';
11
+ }
12
+ else {
13
+ $optinforms_get_excluded_posts = explode(',', $optinforms_form_exclude_posts);
14
+ }
15
+ return $optinforms_get_excluded_posts;
16
+ }
17
+
18
+ // Get excluded pages and create an array
19
+ function optinforms_get_excluded_pages() {
20
+ global $optinforms_form_exclude_pages;
21
+ if(empty($optinforms_form_exclude_pages)) {
22
+ $optinforms_get_excluded_pages = '0';
23
+ }
24
+ if(!is_string($optinforms_form_exclude_pages)) {
25
+ $optinforms_get_excluded_pages = '0';
26
+ }
27
+ else {
28
+ $optinforms_get_excluded_pages = explode(',', $optinforms_form_exclude_pages);
29
+ }
30
+ return $optinforms_get_excluded_pages;
31
+ }
32
+
33
  // Insert form on post, after first paragraph
34
  add_filter( "the_content", "optinform_insert_form_first_paragraph_post" );
35
 
36
  function optinform_insert_form_first_paragraph_post($content) {
37
  global $optinforms_form_placement_post, $optinforms_form_exclude_posts;
38
+ $optinforms_get_excluded_posts = optinforms_get_excluded_posts(); // THIS ONE IS NEW !!!
39
  if($optinforms_form_placement_post == '1'){
40
  $ad_code = optinforms_create_form();
41
+ if(empty($optinforms_form_exclude_posts) && is_single()) {
42
+ return optinform_insert_form_after_paragraph($ad_code, 1, $content);
43
+ }
44
+ elseif (!empty($optinforms_form_exclude_posts) && is_single()) {
45
+ if(is_single($optinforms_get_excluded_posts)) {
46
  // do nothing
47
  }
48
  else {
60
  add_filter( "the_content", "optinform_insert_form_first_paragraph_page" );
61
 
62
  function optinform_insert_form_first_paragraph_page($content) {
63
+ global $optinforms_form_placement_page;
64
+ $optinforms_get_excluded_pages = optinforms_get_excluded_pages(); // THIS ONE IS NEW !!!
65
  if($optinforms_form_placement_page == '1'){
66
  $ad_code = optinforms_create_form();
 
67
  if(is_page()) {
68
+ if(is_page($optinforms_get_excluded_pages)) {
69
  // do nothing
70
  }
71
  else {
83
  add_filter( "the_content", "optinform_insert_form_second_paragraph_post" );
84
 
85
  function optinform_insert_form_second_paragraph_post($content) {
86
+ global $optinforms_form_placement_post;
87
+ $optinforms_get_excluded_posts = optinforms_get_excluded_posts(); // THIS ONE IS NEW !!!
88
  if($optinforms_form_placement_post == '2'){
89
  $ad_code = optinforms_create_form();
 
90
  if(is_single()) {
91
+ if(is_single($optinforms_get_excluded_posts)) {
92
  // do nothing
93
  }
94
  else {
106
  add_filter( "the_content", "optinform_insert_form_second_paragraph_page" );
107
 
108
  function optinform_insert_form_second_paragraph_page($content) {
109
+ global $optinforms_form_placement_page;
110
+ $optinforms_get_excluded_pages = optinforms_get_excluded_pages(); // THIS ONE IS NEW !!!
111
  if($optinforms_form_placement_page == '2'){
112
  $ad_code = optinforms_create_form();
 
113
  if(is_page()) {
114
+ if(is_page($optinforms_get_excluded_pages)) {
115
  // do nothing
116
  }
117
  else {
145
 
146
  function optinforms_insert_form_after_post($content) {
147
  global $optinforms_form_placement_post, $optinforms_form_exclude_posts;
148
+ $optinforms_get_excluded_posts = optinforms_get_excluded_posts(); // THIS ONE IS NEW !!!
149
  if($optinforms_form_placement_post == '3' || empty($optinforms_form_placement_post)) {
150
+
151
+ if(empty($optinforms_form_exclude_posts) && is_single()) {
152
+ $content .= optinforms_create_form();
153
+ }
154
+ elseif (!empty($optinforms_form_exclude_posts) && is_single()) {
155
+ if(is_single($optinforms_get_excluded_posts)) {
156
  // do nothing
157
  }
158
  else {
159
  $content .= optinforms_create_form();
160
  }
161
  }
162
+
163
  }
164
  return $content;
165
  }
169
 
170
  function optinforms_insert_form_after_page($content) {
171
  global $optinforms_form_placement_page, $optinforms_form_exclude_pages;
172
+ $optinforms_get_excluded_pages = optinforms_get_excluded_pages(); // THIS ONE IS NEW !!!
173
  if($optinforms_form_placement_page == '3' || empty($optinforms_form_placement_page)) {
 
174
  if(is_page()) {
175
+ if(is_page($optinforms_get_excluded_pages)) {
176
  // do nothing
177
  }
178
  else {
optin-forms.php CHANGED
@@ -4,11 +4,25 @@ Plugin Name: Optin Forms
4
  Plugin URI: http://www.codeleon.com/wordpress/plugins/optin-forms
5
  Description: Create beautiful optin forms with ease. Choose a form design, customize it, and add your form to your blog with a simple mouse-click.
6
  Author: Codeleon
7
- Version: 1.1
8
  Author URI: http://www.codeleon.com
9
- License: Free
10
  Text Domain: optinforms
11
  Domain Path: /languages/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  */
13
 
14
  // Add translation to plugin
@@ -91,7 +105,6 @@ function optinforms_main_page() {
91
  <div class="wrap">
92
  <div id="icon-optinforms" class="icon32">
93
  </div><!--icon-32-->
94
-
95
  <h2 class="title"><?php echo optinforms_menu_tabs(); ?></h2>
96
  </div><!--wrap-->
97
 
4
  Plugin URI: http://www.codeleon.com/wordpress/plugins/optin-forms
5
  Description: Create beautiful optin forms with ease. Choose a form design, customize it, and add your form to your blog with a simple mouse-click.
6
  Author: Codeleon
7
+ Version: 1.1.1
8
  Author URI: http://www.codeleon.com
 
9
  Text Domain: optinforms
10
  Domain Path: /languages/
11
+ License:
12
+ Copyright 2014 codeleon.com
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
  // Add translation to plugin
105
  <div class="wrap">
106
  <div id="icon-optinforms" class="icon32">
107
  </div><!--icon-32-->
 
108
  <h2 class="title"><?php echo optinforms_menu_tabs(); ?></h2>
109
  </div><!--wrap-->
110
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: brs
3
  Tags: optin, form, forms, aweber, icontact, mailchimp, getresponse, mad mimi, interspire, email marketer, email marketing, email, e-mail, list, list building, opt-in, newsletter, autoresponder, popup, pop-up, mailing, mailing list, mail, webform, newsletter plugin, optin plugin, opt-in plugin, conversion, design
4
  Requires at least: 3.2
5
- Tested up to: 3.8.1
6
- Stable tag: 1.1
7
 
8
  Create beautiful optin forms with ease. Choose a form design, customize it, and add your form to your blog with a simple mouse-click.
9
 
@@ -48,6 +48,9 @@ Having trouble with the plugin? Simply post your question to the [support forum]
48
 
49
  == Changelog ==
50
 
 
 
 
51
  = 1.1 =
52
  * Added exclude options.
53
  * Added shortcode.
@@ -60,6 +63,9 @@ Having trouble with the plugin? Simply post your question to the [support forum]
60
 
61
  == Upgrade Notice ==
62
 
 
 
 
63
  = 1.1 =
64
  New display options, exclude your optin form on specific posts and pages, and add your form with a shortcode!
65
 
2
  Contributors: brs
3
  Tags: optin, form, forms, aweber, icontact, mailchimp, getresponse, mad mimi, interspire, email marketer, email marketing, email, e-mail, list, list building, opt-in, newsletter, autoresponder, popup, pop-up, mailing, mailing list, mail, webform, newsletter plugin, optin plugin, opt-in plugin, conversion, design
4
  Requires at least: 3.2
5
+ Tested up to: 3.9
6
+ Stable tag: 1.1.1
7
 
8
  Create beautiful optin forms with ease. Choose a form design, customize it, and add your form to your blog with a simple mouse-click.
9
 
48
 
49
  == Changelog ==
50
 
51
+ = 1.1.1 =
52
+ * Fixed exclude function.
53
+
54
  = 1.1 =
55
  * Added exclude options.
56
  * Added shortcode.
63
 
64
  == Upgrade Notice ==
65
 
66
+ = 1.1.1 =
67
+ Fixed exclude function that caused warnings on certain installations.
68
+
69
  = 1.1 =
70
  New display options, exclude your optin form on specific posts and pages, and add your form with a shortcode!
71