WPtouch - Version 4.3.30

Version Description

Download this release

Release Info

Developer wptouch
Plugin Icon 128x128 WPtouch
Version 4.3.30
Comparing to
See all releases

Code changes from version 4.3.29 to 4.3.30

Files changed (4) hide show
  1. core/admin-settings.php +90 -19
  2. lang/wptouch.pot +4 -4
  3. readme.txt +5 -1
  4. wptouch.php +2 -2
core/admin-settings.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  function wptouch_settings_process( $wptouch_pro ) {
3
- if ( isset( $wptouch_pro->post[ 'wptouch-reset-3' ] ) ) {
4
  $wptouch_pro->verify_post_nonce();
5
 
6
  // Clear the cookie
@@ -23,24 +23,25 @@ function wptouch_settings_process( $wptouch_pro ) {
23
 
24
  wptouch_delete_all_transients();
25
 
26
- } else if ( isset( $wptouch_pro->post['wptouch-submit-3' ] ) ) {
27
  $wptouch_pro->verify_post_nonce();
28
 
29
- if ( isset( $wptouch_pro->post[ 'wptouch_restore_settings'] ) && strlen( $wptouch_pro->post[ 'wptouch_restore_settings' ] ) ) {
30
  require_once( 'admin-backup-restore.php' );
31
 
32
- wptouch_restore_settings( $wptouch_pro->post[ 'wptouch_restore_settings'] );
 
33
  return;
34
  }
35
 
36
- $new_settings = array();
37
  $modified_domains = array();
38
 
39
  // Search for all the settings to update
40
- foreach( $wptouch_pro->post as $key => $content ) {
41
  if ( preg_match( '#^wptouch__(.*)__(.*)#', $key, $match ) ) {
42
  $setting_domain = sanitize_text_field( $match[1] );
43
- $setting_name = sanitize_text_field( $match[2] );
44
 
45
  // Decode slashes on strings
46
  if ( is_string( $content ) ) {
@@ -60,10 +61,10 @@ function wptouch_settings_process( $wptouch_pro ) {
60
  }
61
 
62
  // Do a loop and find all the checkboxes that should be disabled
63
- foreach( $wptouch_pro->post as $key => $content ) {
64
  if ( preg_match( '#^hid-wptouch__(.*)__(.*)#', $key, $match ) ) {
65
  $setting_domain = sanitize_text_field( $match[1] );
66
- $setting_name = sanitize_text_field( $match[2] );
67
 
68
  $new_settings[ $setting_domain ][ $setting_name ] = ( isset( $new_settings[ $setting_domain ][ $setting_name ] ) ? 1 : 0 );
69
 
@@ -71,24 +72,66 @@ function wptouch_settings_process( $wptouch_pro ) {
71
  }
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  // Update all the domains that have been modified
75
- foreach( $modified_domains as $domain => $ignored_value ) {
76
  $settings = $wptouch_pro->get_settings( $domain );
77
 
78
  // Sanitize and update settings with new values.
79
  foreach ( $new_settings[ $domain ] as $key => $value ) {
80
  if ( isset( $settings->$key ) ) {
81
  $key = sanitize_key( $key );
82
- if ( 'custom_stats_code' === $key ) {
83
- $value = wp_kses( $value, [
84
- 'script' => true,
85
- ] );
86
- } else if ( is_numeric( $value ) ) {
87
- $value = intval( $value );
88
- } else if ( is_email( $value ) ) {
89
- $value = sanitize_email( $value );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  } else {
91
- $value = sanitize_text_field( $value );
92
  }
93
  $settings->$key = $value;
94
  }
@@ -104,4 +147,32 @@ function wptouch_settings_process( $wptouch_pro ) {
104
  }
105
 
106
  do_action( 'wptouch_admin_save_settings_completed' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
1
  <?php
2
  function wptouch_settings_process( $wptouch_pro ) {
3
+ if ( isset( $wptouch_pro->post['wptouch-reset-3'] ) ) {
4
  $wptouch_pro->verify_post_nonce();
5
 
6
  // Clear the cookie
23
 
24
  wptouch_delete_all_transients();
25
 
26
+ } else if ( isset( $wptouch_pro->post['wptouch-submit-3'] ) ) {
27
  $wptouch_pro->verify_post_nonce();
28
 
29
+ if ( isset( $wptouch_pro->post['wptouch_restore_settings'] ) && strlen( $wptouch_pro->post['wptouch_restore_settings'] ) ) {
30
  require_once( 'admin-backup-restore.php' );
31
 
32
+ wptouch_restore_settings( $wptouch_pro->post['wptouch_restore_settings'] );
33
+
34
  return;
35
  }
36
 
37
+ $new_settings = array();
38
  $modified_domains = array();
39
 
40
  // Search for all the settings to update
41
+ foreach ( $wptouch_pro->post as $key => $content ) {
42
  if ( preg_match( '#^wptouch__(.*)__(.*)#', $key, $match ) ) {
43
  $setting_domain = sanitize_text_field( $match[1] );
44
+ $setting_name = sanitize_text_field( $match[2] );
45
 
46
  // Decode slashes on strings
47
  if ( is_string( $content ) ) {
61
  }
62
 
63
  // Do a loop and find all the checkboxes that should be disabled
64
+ foreach ( $wptouch_pro->post as $key => $content ) {
65
  if ( preg_match( '#^hid-wptouch__(.*)__(.*)#', $key, $match ) ) {
66
  $setting_domain = sanitize_text_field( $match[1] );
67
+ $setting_name = sanitize_text_field( $match[2] );
68
 
69
  $new_settings[ $setting_domain ][ $setting_name ] = ( isset( $new_settings[ $setting_domain ][ $setting_name ] ) ? 1 : 0 );
70
 
72
  }
73
  }
74
 
75
+ /**
76
+ * Settings fields that should allow script tags.
77
+ */
78
+ $script_tags_allowed_fields = array(
79
+ 'custom_stats_code',
80
+ 'custom_advertising_mobile',
81
+ 'advertising_header_code_1',
82
+ 'advertising_header_code_2',
83
+ 'advertising_footer_code_1',
84
+ 'advertising_footer_code_2',
85
+ 'advertising_pre_content_code_1',
86
+ 'advertising_pre_content_code_2',
87
+ 'advertising_post_content_code_1',
88
+ 'advertising_post_content_code_2',
89
+ 'advertising_mid_content_code_1',
90
+ 'advertising_mid_content_code_2',
91
+ 'advertising_page_level_code_1',
92
+ 'advertising_page_level_code_2',
93
+ 'advertising_custom_head_code',
94
+ );
95
+
96
  // Update all the domains that have been modified
97
+ foreach ( $modified_domains as $domain => $ignored_value ) {
98
  $settings = $wptouch_pro->get_settings( $domain );
99
 
100
  // Sanitize and update settings with new values.
101
  foreach ( $new_settings[ $domain ] as $key => $value ) {
102
  if ( isset( $settings->$key ) ) {
103
  $key = sanitize_key( $key );
104
+ if ( is_array( $value ) ) {
105
+ $value = array_map( 'wptouch_sanitize_value', $value );
106
+ } else if ( in_array( $key, $script_tags_allowed_fields, true ) ) {
107
+ $allowed_tags = wp_kses_allowed_html( 'post' );
108
+ // Add script tag and attributes to allowed tags.
109
+ $allowed_tags = wp_parse_args( array(
110
+ 'script' => array(
111
+ 'class' => true,
112
+ 'id' => true,
113
+ 'src' => true,
114
+ 'type' => true,
115
+ 'async' => true,
116
+ 'crossorigin' => true,
117
+ 'defer' => true,
118
+ 'importance' => true,
119
+ 'integrity' => true,
120
+ 'nomodule' => true,
121
+ 'nonce' => true,
122
+ 'text' => true,
123
+ 'charset' => true,
124
+ 'language' => true,
125
+ ),
126
+ 'noscript' => array (
127
+ 'class' => true,
128
+ 'id' => true,
129
+ 'style' => true,
130
+ ),
131
+ ), $allowed_tags );
132
+ $value = wp_kses( $value, $allowed_tags );
133
  } else {
134
+ $value = wptouch_sanitize_value( $value );
135
  }
136
  $settings->$key = $value;
137
  }
147
  }
148
 
149
  do_action( 'wptouch_admin_save_settings_completed' );
150
+ }
151
+
152
+ /**
153
+ * Sanitize setting value.
154
+ *
155
+ * @param mixed $value The value to sanitize.
156
+ *
157
+ * @return bool|int|string
158
+ */
159
+ function wptouch_sanitize_value( $value ) {
160
+ switch ( true ) {
161
+ case is_numeric( $value ):
162
+ $value = intval( $value );
163
+ break;
164
+
165
+ case is_bool( $value ):
166
+ $value = ( bool ) $value;
167
+ break;
168
+
169
+ case is_email( $value ):
170
+ $value = sanitize_email( $value );
171
+ break;
172
+
173
+ default:
174
+ $value = wp_strip_all_tags( $value );
175
+ }
176
+
177
+ return $value;
178
  }
lang/wptouch.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the WPtouch Mobile Plugin package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WPtouch Mobile Plugin 4.3.29\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wptouch\n"
7
- "POT-Creation-Date: 2018-10-16 18:19:13+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -2533,9 +2533,9 @@ msgstr ""
2533
  msgid "WPtouch Mobile Plugin"
2534
  msgstr ""
2535
 
2536
- #. #-#-#-#-# wptouch.pot (WPtouch Mobile Plugin 4.3.29) #-#-#-#-#
2537
  #. Plugin URI of the plugin/theme
2538
- #. #-#-#-#-# wptouch.pot (WPtouch Mobile Plugin 4.3.29) #-#-#-#-#
2539
  #. Author URI of the plugin/theme
2540
  msgid "http://www.wptouch.com/"
2541
  msgstr ""
2
  # This file is distributed under the same license as the WPtouch Mobile Plugin package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WPtouch Mobile Plugin 4.3.30\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wptouch\n"
7
+ "POT-Creation-Date: 2018-10-24 19:47:44+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
2533
  msgid "WPtouch Mobile Plugin"
2534
  msgstr ""
2535
 
2536
+ #. #-#-#-#-# wptouch.pot (WPtouch Mobile Plugin 4.3.30) #-#-#-#-#
2537
  #. Plugin URI of the plugin/theme
2538
+ #. #-#-#-#-# wptouch.pot (WPtouch Mobile Plugin 4.3.30) #-#-#-#-#
2539
  #. Author URI of the plugin/theme
2540
  msgid "http://www.wptouch.com/"
2541
  msgstr ""
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: wptouch, sureswiftcapital, duanestorey, dalemugford, adamdipardo, oxymoron
3
  Tags: wptouch, iphone, ipod, bravenewcode, mobile, mobile-friendly, android, blackberry, smartphone, responsive, design, mobile plugin, ios, mobile theme
4
  Requires at least: 4.2
5
- Stable tag: 4.3.29
6
  Tested up to: 4.9
7
  License: GPLv2
8
 
@@ -33,6 +33,10 @@ For more information visit [WPtouch.com](http://www.wptouch.com/?utm_campaign=wp
33
 
34
  == Changelog ==
35
 
 
 
 
 
36
  = Version 4.3.29 (October 16th, 2018) =
37
 
38
  * Fixed: Add helper file to output WordPress comment form cookie checkbox field for child themes that contain custom comment form layouts.
2
  Contributors: wptouch, sureswiftcapital, duanestorey, dalemugford, adamdipardo, oxymoron
3
  Tags: wptouch, iphone, ipod, bravenewcode, mobile, mobile-friendly, android, blackberry, smartphone, responsive, design, mobile plugin, ios, mobile theme
4
  Requires at least: 4.2
5
+ Stable tag: 4.3.30
6
  Tested up to: 4.9
7
  License: GPLv2
8
 
33
 
34
  == Changelog ==
35
 
36
+ = Version 4.3.30 (October 19th, 2018) =
37
+
38
+ * Fixed: Script tag attributes being stripped from custom analytics text area entries.
39
+
40
  = Version 4.3.29 (October 16th, 2018) =
41
 
42
  * Fixed: Add helper file to output WordPress comment form cookie checkbox field for child themes that contain custom comment form layouts.
wptouch.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: WPtouch Mobile Plugin
4
  Plugin URI: http://www.wptouch.com/
5
- Version: 4.3.29
6
  Description: Make a beautiful mobile-friendly version of your website with just a few clicks.
7
  Author: WPtouch
8
  Author URI: http://www.wptouch.com/
@@ -14,7 +14,7 @@
14
 
15
  function wptouch_create_four_object() {
16
  if ( !defined( 'WPTOUCH_IS_PRO' ) ) {
17
- define( 'WPTOUCH_VERSION', '4.3.29' );
18
 
19
  define( 'WPTOUCH_BASE_NAME', basename( __FILE__, '.php' ) . '.php' );
20
  define( 'WPTOUCH_DIR', WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . basename( __FILE__, '.php' ) );
2
  /*
3
  Plugin Name: WPtouch Mobile Plugin
4
  Plugin URI: http://www.wptouch.com/
5
+ Version: 4.3.30
6
  Description: Make a beautiful mobile-friendly version of your website with just a few clicks.
7
  Author: WPtouch
8
  Author URI: http://www.wptouch.com/
14
 
15
  function wptouch_create_four_object() {
16
  if ( !defined( 'WPTOUCH_IS_PRO' ) ) {
17
+ define( 'WPTOUCH_VERSION', '4.3.30' );
18
 
19
  define( 'WPTOUCH_BASE_NAME', basename( __FILE__, '.php' ) . '.php' );
20
  define( 'WPTOUCH_DIR', WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . basename( __FILE__, '.php' ) );