Skip to content

Commit 20c379d

Browse files
committed
Release new version 2.5.0
= 2.5.0 - 2022/02/23 = * This update has 4 code tweaks that harden the plugins security and improve performance - please run this update as soon as you see it. * Tweak - Nonce check for when settings form is submitted from plugin framework * Tweak - Capabilities manage_options check for when settings form is submitted from plugin framework * Tweak - Call update_google_map_api_key when settings form is submitted instead of instance of Admin_UI * Tweak - Call update_google_font_api_key when settings form is submitted instead of instance of Fonts_Face
1 parent 7d0e27c commit 20c379d

File tree

5 files changed

+53
-27
lines changed

5 files changed

+53
-27
lines changed

admin/admin-interface.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,19 @@ public function get_settings( $options, $option_name = '' ) {
596596
/*-----------------------------------------------------------------------------------*/
597597

598598
public function save_settings( $options, $option_name = '' ) {
599+
600+
check_admin_referer( 'save_settings_' . $this->plugin_name );
601+
602+
if ( ! current_user_can( 'manage_options' ) ) {
603+
return false;
604+
}
599605

600606
if ( !is_array( $options ) || count( $options ) < 1 ) return;
601607

602608
if ( empty( $_POST ) ) return false;
609+
610+
$this->update_google_map_api_key();
611+
$GLOBALS[$this->plugin_prefix.'fonts_face']->update_google_font_api_key();
603612

604613
$update_options = array();
605614
$update_separate_options = array();
@@ -3691,6 +3700,7 @@ class="<?php echo $class; ?>"
36913700
</div> <!-- Close Panel Row -->
36923701
<?php do_action( $this->plugin_name . '-' . trim( $form_key ) . '_settings_end' ); ?>
36933702
<p class="submit">
3703+
<?php wp_nonce_field( 'save_settings_'. $this->plugin_name ); ?>
36943704
<input type="submit" value="<?php _e('Save changes', 'page-views-count'); ?>" class="button button-primary" name="bt_save_settings" />
36953705
<input type="submit" name="bt_reset_settings" class="button" value="<?php _e('Reset Settings', 'page-views-count'); ?>" />
36963706
<input type="hidden" name="form_name_action" value="<?php echo esc_attr( $form_key ); ?>" />

admin/admin-ui.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public function __construct() {
8787
}
8888

8989
$this->support_url = 'https://wordpress.org/support/plugin/page-views-count/';
90-
$this->update_google_map_api_key();
9190
}
9291

9392

admin/includes/fonts_face.php

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,34 @@ public function __construct() {
364364
return;
365365
}
366366

367+
if ( apply_filters( $this->plugin_name . '_new_google_fonts_enable', true ) ) {
368+
$this->is_valid_google_api_key();
369+
$google_fonts = get_option( $this->plugin_name . '_google_font_list', array() );
370+
} else {
371+
$google_fonts = array();
372+
}
373+
374+
if ( ! is_array( $google_fonts ) || count( $google_fonts ) < 1 ) {
375+
$google_fonts = apply_filters( $this->plugin_name . '_google_fonts', $this->google_fonts );
376+
}
377+
378+
sort( $google_fonts );
379+
380+
$new_google_fonts = array();
381+
foreach ( $google_fonts as $row ) {
382+
$new_google_fonts[$row['name']] = $row;
383+
}
384+
385+
$this->google_fonts = $new_google_fonts;
386+
387+
}
388+
389+
public function update_google_font_api_key() {
390+
391+
if ( ! $this->is_load_google_fonts ) {
392+
return;
393+
}
394+
367395
// Enable Google Font API Key
368396
if ( isset( $_POST[ $this->google_api_key_option . '_enable' ] ) ) {
369397
$old_google_api_key_enable = get_option( $this->google_api_key_option . '_enable', 0 );
@@ -396,27 +424,6 @@ public function __construct() {
396424
delete_transient( $this->google_api_key_option . '_status' );
397425
}
398426
}
399-
400-
if ( apply_filters( $this->plugin_name . '_new_google_fonts_enable', true ) ) {
401-
$this->is_valid_google_api_key();
402-
$google_fonts = get_option( $this->plugin_name . '_google_font_list', array() );
403-
} else {
404-
$google_fonts = array();
405-
}
406-
407-
if ( ! is_array( $google_fonts ) || count( $google_fonts ) < 1 ) {
408-
$google_fonts = apply_filters( $this->plugin_name . '_google_fonts', $this->google_fonts );
409-
}
410-
411-
sort( $google_fonts );
412-
413-
$new_google_fonts = array();
414-
foreach ( $google_fonts as $row ) {
415-
$new_google_fonts[$row['name']] = $row;
416-
}
417-
418-
$this->google_fonts = $new_google_fonts;
419-
420427
}
421428

422429
public function validate_google_api_key( $g_key = '' ) {

page-views-count.php

Lines changed: 3 additions & 3 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.4.15
5+
Version: 2.5.0
66
Requires at least: 5.6
7-
Tested up to: 5.9
7+
Tested up to: 5.9.1
88
Author: a3rev Software
99
Author URI: https://a3rev.com
1010
Text Domain: page-views-count
@@ -23,7 +23,7 @@
2323

2424
define( 'A3_PVC_KEY', 'a3_page_view_count' );
2525
define( 'A3_PVC_PREFIX', 'wp_pvc_' );
26-
define( 'A3_PVC_VERSION', '2.4.15' );
26+
define( 'A3_PVC_VERSION', '2.5.0' );
2727
define( 'A3_PVC_G_FONTS', false );
2828

2929
use \A3Rev\PageViewsCount\FrameWork;

readme.txt

Lines changed: 12 additions & 2 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: 5.6
5-
Tested up to: 5.9
6-
Stable tag: 2.4.15
5+
Tested up to: 5.9.1
6+
Stable tag: 2.5.0
77
License: GPLv3
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

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

103103
== Changelog ==
104104

105+
= 2.5.0 - 2022/02/23 =
106+
* This update has 4 code tweaks that harden the plugins security and improve performance - please run this update as soon as you see it.
107+
* Tweak - Nonce check for when settings form is submitted from plugin framework
108+
* Tweak - Capabilities manage_options check for when settings form is submitted from plugin framework
109+
* Tweak - Call update_google_map_api_key when settings form is submitted instead of instance of Admin_UI
110+
* Tweak - Call update_google_font_api_key when settings form is submitted instead of instance of Fonts_Face
111+
105112
= 2.4.15 - 2022/02/01 =
106113
* This is an important security release that patches a SQL injection vulnerability that affects all previous versions. Please run this immediately.
107114
* Security - Patch for SQL injection attack vulnerability
@@ -488,6 +495,9 @@ The manual installation method involves down loading our plugin and uploading it
488495

489496
== Upgrade Notice ==
490497

498+
= 2.5.0 =
499+
This update has 4 code tweaks that harden the plugins security and improve performance - please run this update as soon as you see it.
500+
491501
= 2.4.15 =
492502
This is an important security release that patches a SQL injection vulnerability that affects all previous versions. Please run this immediately.
493503

0 commit comments

Comments
 (0)