Skip to content

Commit eb9beb7

Browse files
committed
Release new version 2.4.9
* This maintenance release has code rewrites for WordPress 5.8 compatibility plus a Security patch * Tweak - Test for compatibility with WordPress 5.8 * Tweak - Test for compatibility with Gutenberg 10.7 * Tweak - Register block page-views-count/stats-editor inside block.js file for work compatibility with WordPress 5.8 new features * Security - Added escaping for the shortcode postid parameter
1 parent 0242bea commit eb9beb7

File tree

7 files changed

+133
-6
lines changed

7 files changed

+133
-6
lines changed

dist/blocks.build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.8
5+
Version: 2.4.9
66
Requires at least: 5.0
7-
Tested up to: 5.7
7+
Tested up to: 5.8
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.8' );
26+
define( 'A3_PVC_VERSION', '2.4.9' );
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.0
5-
Tested up to: 5.7
6-
Stable tag: 2.4.8
5+
Tested up to: 5.8
6+
Stable tag: 2.4.9
77
License: GPLv3
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

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

104104
== Changelog ==
105105

106+
= 2.4.9 - 2021/07/10 =
107+
* This maintenance release has code rewrites for WordPress 5.8 compatibility plus a Security patch
108+
* Tweak - Test for compatibility with WordPress 5.8
109+
* Tweak - Test for compatibility with Gutenberg 10.7
110+
* Tweak - Register block page-views-count/stats-editor inside block.js file for work compatibility with WordPress 5.8 new features
111+
* Security - Added escaping for the shortcode postid parameter
112+
106113
= 2.4.8 - 2021/03/17 =
107114
* This maintenance release updates 23 deprecated jQuery functions for compatibility with the latest version of jQuery in WordPress 5.7
108115
* Tweak - Update JavaScript on plugin framework for compatibility with latest version of jQuery and resolve PHP warning event shorthand is deprecated.
@@ -456,6 +463,9 @@ The manual installation method involves down loading our plugin and uploading it
456463

457464
== Upgrade Notice ==
458465

466+
= 2.4.9 =
467+
This maintenance release has code rewrites for WordPress 5.8 compatibility plus a Security patch
468+
459469
= 2.4.8 =
460470
This maintenance release updates 23 deprecated jQuery functions for compatibility with the latest version of jQuery in WordPress 5.7
461471

src/blocks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ updateCategory('a3rev-blocks', {
2121
});
2222

2323
import './blocks/stats/block';
24+
import './blocks/stats-editor/block';

src/blocks/stats-editor/block.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* BLOCK: page-views-count
3+
*
4+
* Registering a basic block with Gutenberg.
5+
* Simple block, renders and saves the same content without any interactivity.
6+
*/
7+
8+
// Import CSS.
9+
//import './style.scss';
10+
//import './editor.scss';
11+
12+
const { __ } = wp.i18n; // Import __() from wp.i18n
13+
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
14+
15+
/**
16+
* Register: aa Gutenberg Block.
17+
*
18+
* Registers a new block provided a unique name and an object defining its
19+
* behavior. Once registered, the block is made editor as an option to any
20+
* editor interface where blocks are implemented.
21+
*
22+
* @link https://wordpress.org/gutenberg/handbook/block-api/
23+
* @param {string} name Block name.
24+
* @param {Object} settings Block settings.
25+
* @return {?WPBlock} The block, if it has been successfully
26+
* registered; otherwise `undefined`.
27+
*/
28+
registerBlockType('page-views-count/stats-editor', {
29+
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
30+
title: __('Page Views', 'page-views-count'), // Block title.
31+
32+
attributes: {
33+
align: {
34+
type: 'string',
35+
},
36+
postID: {
37+
type: 'string',
38+
},
39+
isDisabled: {
40+
type: 'boolean',
41+
default: true,
42+
},
43+
/**
44+
* For previewing?
45+
*/
46+
isPreview: {
47+
type: 'boolean',
48+
default: false,
49+
},
50+
},
51+
52+
/**
53+
* The edit function describes the structure of your block in the context of the editor.
54+
* This represents what the editor will render when the block is used.
55+
*
56+
* The "edit" property must be a valid function.
57+
*
58+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
59+
*/
60+
edit: ({ attributes, setAttributes }) => {
61+
62+
// Rendering in PHP
63+
return null;
64+
},
65+
66+
/**
67+
* The save function defines the way in which the different attributes should be combined
68+
* into the final markup, which is then serialized by Gutenberg into post_content.
69+
*
70+
* The "save" property must be specified and must be a valid function.
71+
*
72+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
73+
*/
74+
save() {
75+
// Rendering in PHP
76+
return null;
77+
},
78+
});

src/blocks/stats/block.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "page-views-count/stats",
3+
"title": "Page Views",
4+
"description": "Show all time views and views today",
5+
"textdomain": "page-views-count",
6+
"icon": {
7+
"foreground": "#24b6f1"
8+
},
9+
"category": "a3rev-blocks",
10+
"supports": {
11+
"multiple": false
12+
},
13+
"keywords": [ "Page Views Count", "Views", "Stats" ],
14+
"example": {
15+
"attributes": {
16+
"isPreview": true
17+
}
18+
},
19+
"attributes": {
20+
"align": {
21+
"type": "string"
22+
},
23+
"postID": {
24+
"type": "string",
25+
"default": 0
26+
},
27+
"isDisabled": {
28+
"type": "boolean",
29+
"default": true
30+
},
31+
"isPreview": {
32+
"type": "boolean",
33+
"default": false
34+
}
35+
}
36+
}

src/pvc_shortcode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public function parse_shortcode( $attr = array() ) {
2727
), $attr )
2828
);
2929

30+
$postid = esc_attr( $postid ); // XSS ok
31+
3032
$output = apply_filters( 'pvc_stats_shortcode', '', $postid, $increase, $show_views_today );
3133

3234
return $output;

0 commit comments

Comments
 (0)