Skip to content

Commit 1eded7f

Browse files
committed
Release new version 2.2.1
= 2.2.1 - 2019/12/17 = * This maintenance release has a full code security review plus compatibility with WordPress 5.3.1 * Tweak - Remove the hard coded PHP error_reporting display errors false from compile sass to css * Tweak - Test for compatibility with WordPress 5.3.1 * Dev - Replace file_get_contents with HTTP API wp_remote_get * Dev - Ensure that all inputs are sanitized and all outputs are escaped
1 parent 0d1422a commit 1eded7f

File tree

10 files changed

+293
-173
lines changed

10 files changed

+293
-173
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/package-lock.json export-ignore
77
/package.json export-ignore
88
/README.md export-ignore
9+
/prettier.config.js export-ignore
910
/.vscode/ export-ignore
1011
/node_modules/ export-ignore
1112
/composer.* export-ignore

admin/admin-init.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function admin_settings_page( $page_data = array() ) {
187187

188188
?>
189189
<div class="wrap">
190-
<div class="icon32 icon32-a3rev-ui-settings icon32-a3rev<?php echo $current_page; ?>" id="icon32-a3rev<?php echo $current_page; ?>"><br /></div>
190+
<div class="icon32 icon32-a3rev-ui-settings icon32-a3rev<?php echo esc_attr( $current_page ); ?>" id="icon32-a3rev<?php echo esc_attr( $current_page ); ?>"><br /></div>
191191
<?php
192192
$tabs = apply_filters( $this->plugin_name . '-' . $current_page . '_settings_tabs_array', array() );
193193

@@ -299,7 +299,7 @@ public function admin_settings_tab( $current_page = '', $tab_data = array() ) {
299299
<?php
300300
foreach ( $subtabs as $subtab ) {
301301
?>
302-
<div class="section" id="<?php echo trim( $subtab['name'] ); ?>">
302+
<div class="section" id="<?php echo trim( esc_attr( $subtab['name'] ) ); ?>">
303303
<?php if ( isset( $subtab['callback_function'] ) && !empty( $subtab['callback_function'] ) ) call_user_func( $subtab['callback_function'] ); ?>
304304
</div>
305305
<?php

admin/admin-interface.php

Lines changed: 262 additions & 146 deletions
Large diffs are not rendered by default.

admin/admin-ui.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class WP_PVC_Admin_UI
3131
* You must change to correct plugin name that you are working
3232
*/
3333

34-
public $framework_version = '2.1.0';
34+
public $framework_version = '2.2.0';
3535
public $plugin_name = A3_PVC_KEY;
3636
public $plugin_path = A3_PVC_PLUGIN_NAME;
3737
public $google_api_key_option = '';
@@ -173,7 +173,7 @@ public function update_google_map_api_key() {
173173

174174
update_option( $this->google_map_api_key_option . '_enable', 1 );
175175

176-
$option_value = trim( $_POST[ $this->google_map_api_key_option ] );
176+
$option_value = trim( sanitize_text_field( $_POST[ $this->google_map_api_key_option ] ) );
177177

178178
$old_google_map_api_key_option = get_option( $this->google_map_api_key_option );
179179

@@ -191,7 +191,7 @@ public function update_google_map_api_key() {
191191

192192
update_option( $this->google_map_api_key_option . '_enable', 0 );
193193

194-
$option_value = trim( $_POST[ $this->google_map_api_key_option ] );
194+
$option_value = trim( sanitize_text_field( $_POST[ $this->google_map_api_key_option ] ) );
195195
update_option( $this->google_map_api_key_option, $option_value );
196196

197197
if ( 0 != $old_google_map_api_key_enable ) {

admin/includes/fonts_face.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function __construct() {
368368

369369
update_option( $this->google_api_key_option . '_enable', 1 );
370370

371-
$option_value = trim( $_POST[ $this->google_api_key_option ] );
371+
$option_value = trim( sanitize_text_field( $_POST[ $this->google_api_key_option ] ) );
372372

373373
$old_google_api_key_option = get_option( $this->google_api_key_option );
374374

@@ -386,7 +386,7 @@ public function __construct() {
386386

387387
update_option( $this->google_api_key_option . '_enable', 0 );
388388

389-
$option_value = trim( $_POST[ $this->google_api_key_option ] );
389+
$option_value = trim( sanitize_text_field( $_POST[ $this->google_api_key_option ] ) );
390390
update_option( $this->google_api_key_option, $option_value );
391391

392392
if ( 0 != $old_google_api_key_enable ) {
@@ -465,8 +465,9 @@ public function is_valid_google_api_key( $cache=true ) {
465465

466466
// Get font list from default webfonts.json file of plugin
467467
if ( 'invalid' == $google_api_key_status && file_exists( $this->admin_plugin_dir() . '/assets/webfonts/webfonts.json' ) ) {
468-
$webfonts = file_get_contents( $this->admin_plugin_dir() . '/assets/webfonts/webfonts.json' );
469-
if ( false != $webfonts ) {
468+
$response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
469+
$webfonts = wp_remote_retrieve_body( $response );
470+
if ( ! empty( $webfonts ) ) {
470471
$json_string = get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts;
471472
$response_fonts = json_decode( $json_string, true );
472473
}
@@ -518,8 +519,9 @@ public function is_valid_google_api_key( $cache=true ) {
518519

519520
// Get font list from default webfonts.json file of plugin
520521
if ( file_exists( $this->admin_plugin_dir() . '/assets/webfonts/webfonts.json' ) ) {
521-
$webfonts = file_get_contents( $this->admin_plugin_dir() . '/assets/webfonts/webfonts.json' );
522-
if ( false != $webfonts ) {
522+
$response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
523+
$webfonts = wp_remote_retrieve_body( $response );
524+
if ( ! empty( $webfonts ) ) {
523525
$json_string = get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts;
524526
$response_fonts = json_decode( $json_string, true );
525527
}

admin/less/sass.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public function plugin_compile_less_mincss( $sass, $css_file_name = '' )
7171

7272
global $wp_filesystem;
7373

74-
@ini_set( 'display_errors', false );
7574
$_upload_dir = wp_upload_dir();
7675
$wp_filesystem->chmod($_upload_dir['basedir'], 0755);
7776
if (! $wp_filesystem->is_dir($_upload_dir['basedir'] . '/sass')) {

page-views-count.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
/*
33
Plugin Name: Page Views Count
44
Description: Show front end users all time views and views today on posts, pages, index pages and custom post types with the Page Views Count Plugin. Use the Page Views Count function to add page views to any content type or object created by your theme or plugins.
5-
Version: 2.2.0
5+
Version: 2.2.1
66
Requires at least: 4.6
7-
Tested up to: 5.2.3
7+
Tested up to: 5.3.1
88
Author: a3rev Software
99
Author URI: https://a3rev.com
1010
Text Domain: page-views-count
@@ -22,7 +22,7 @@
2222
define('A3_PVC_IMAGES_URL', A3_PVC_URL . '/assets/images');
2323

2424
define( 'A3_PVC_KEY', 'a3_page_view_count' );
25-
define( 'A3_PVC_VERSION', '2.2.0' );
25+
define( 'A3_PVC_VERSION', '2.2.1' );
2626
define( 'A3_PVC_G_FONTS', false );
2727

2828
if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
@@ -95,5 +95,3 @@ function pvc_check_exclude( $postid = 0 ) {
9595
return true;
9696
}
9797
}
98-
99-
?>

readme.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: a3rev, a3rev Software, nguyencongtuan
33
Tags: wordpress page view, page view count , post views, post view count, gutenberg
44
Requires at least: 4.6
5-
Tested up to: 5.2.3
6-
Stable tag: 2.2.0
5+
Tested up to: 5.3.1
6+
Stable tag: 2.2.1
77
License: GPLv3
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -98,6 +98,13 @@ The manual installation method involves down loading our plugin and uploading it
9898

9999
== Changelog ==
100100

101+
= 2.2.1 - 2019/12/17 =
102+
* This maintenance release has a full code security review plus compatibility with WordPress 5.3.1
103+
* Tweak - Remove the hard coded PHP error_reporting display errors false from compile sass to css
104+
* Tweak - Test for compatibility with WordPress 5.3.1
105+
* Dev - Replace file_get_contents with HTTP API wp_remote_get
106+
* Dev - Ensure that all inputs are sanitized and all outputs are escaped
107+
101108
= 2.2.0 - 2019/09/12 =
102109
* This feature upgrade is a full refactor of the plugins PHP to PHP dependency manager Composer with autoloading.
103110
* Feature - Plugin fully refactored to Composer for cleaner code and faster PHP code
@@ -110,10 +117,10 @@ The manual installation method involves down loading our plugin and uploading it
110117
* This is a maintenance upgrade to fix a potentially fatal error conflict with sites running PHP 7.3 plus compatibility with WordPress 5.2.2
111118
* Fix - PHP warning continue targeting switch is equivalent to break for compatibility on PHP 7.3
112119

113-
= 2.1.1 2018/12/17 =
120+
= 2.1.1 - 2018/12/17 =
114121
* This is a maintenance update for WordPress version 5.0.2 and PHP 7.3 compatibility.
115-
* Framework Update to use WordPress ESLint rules
116-
* Framework Test and update for compatibility with PHP 7.3
122+
* Framework - Update to use WordPress ESLint rules
123+
* Framework - Test and update for compatibility with PHP 7.3
117124
* Tweak - Test for compatibility with WordPress
118125

119126
= 2.1.0 - 2018/12/14 =

src/metabox/class-pvc-metabox.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,11 @@ public function save( $post_id ) {
150150

151151
// Manual change Total Views and Today Views
152152
if ( isset( $_POST['a3_pvc_total_views'] ) && isset( $_POST['a3_pvc_today_views'] ) ) {
153-
$total_views = trim( $_POST['a3_pvc_total_views'] );
154-
$today_views = trim( $_POST['a3_pvc_today_views'] );
153+
$total_views = absint( trim( $_POST['a3_pvc_total_views'] ) );
154+
$today_views = absint( trim( $_POST['a3_pvc_today_views'] ) );
155155

156156
A3_PVC::pvc_stats_manual_update( $post_id, $total_views, $today_views );
157157
}
158158
}
159159

160160
}
161-
162-
?>

src/pvc_class.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,4 +476,3 @@ public static function plugin_extra_links($links, $plugin_name) {
476476
return $links;
477477
}
478478
}
479-
?>

0 commit comments

Comments
 (0)