Skip to content

Commit 2bfd0dd

Browse files
committed
Release new version 2.4.5
= 2.4.5 - 2020/12/15 = * This maintenance release adds a block preview image for block discovery * Tweak - Add support for Block Discovery Preview
1 parent 0548bf3 commit 2bfd0dd

File tree

6 files changed

+49
-6
lines changed

6 files changed

+49
-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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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.4
5+
Version: 2.4.5
66
Requires at least: 5.0
77
Tested up to: 5.6
88
Author: a3rev Software
@@ -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.4' );
26+
define( 'A3_PVC_VERSION', '2.4.5' );
2727
define( 'A3_PVC_G_FONTS', false );
2828

2929
use \A3Rev\PageViewsCount\FrameWork;

readme.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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
55
Tested up to: 5.6
6-
Stable tag: 2.4.4
6+
Stable tag: 2.4.5
77
License: GPLv3
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

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

104104
== Changelog ==
105105

106+
= 2.4.5 - 2020/12/15 =
107+
* This maintenance release adds a block preview image for block discovery
108+
* Tweak - Add support for Block Discovery Preview
109+
106110
= 2.4.4 - 2020/12/08 =
107111
* This maintenance release has tweaks and a fix for compatibility with WordPress major version 5.6, PHP 7.4.8 and Gutenberg 9.4
108112
* Tweak - Test for compatibility with PHP 7.4.8
@@ -398,6 +402,9 @@ The manual installation method involves down loading our plugin and uploading it
398402

399403
== Upgrade Notice ==
400404

405+
= 2.4.5 =
406+
This maintenance release adds a block preview image for block discovery
407+
401408
= 2.4.4 =
402409
This maintenance release has tweaks and a fix for compatibility with WordPress major version 5.6, PHP 7.4.8 and Gutenberg 9.4
403410

src/blocks.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ function cgb_editor_assets() { // phpcs:ignore
6464
true // Enqueue the script in the footer.
6565
);
6666

67+
wp_localize_script( 'page_views_count-cgb-block-js', 'pvcblock', array(
68+
'preview' => A3_PVC_URL. '/src/blocks/stats/preview.jpg',
69+
) );
70+
6771
// Styles.
6872
// wp_enqueue_style(
6973
// 'page_views_count-cgb-block-editor-css', // Handle.
@@ -121,7 +125,11 @@ public function register_block() {
121125
'isDisabled' => array(
122126
'type' => 'boolean',
123127
'default' => true,
124-
)
128+
),
129+
'isPreview' => array(
130+
'type' => 'boolean',
131+
'default' => false,
132+
),
125133
),
126134
'render_callback' => array( $this, 'render' )
127135
);
@@ -148,7 +156,11 @@ public function register_block() {
148156
'isDisabled' => array(
149157
'type' => 'boolean',
150158
'default' => true,
151-
)
159+
),
160+
'isPreview' => array(
161+
'type' => 'boolean',
162+
'default' => false,
163+
),
152164
),
153165
'render_callback' => array( $this, 'render_editor' )
154166
) );

src/blocks/stats/block.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ registerBlockType('page-views-count/stats', {
4949
__('Views', 'page-views-count'),
5050
__('Stats', 'page-views-count'),
5151
],
52+
example: {
53+
attributes: {
54+
isPreview: true,
55+
},
56+
},
5257

5358
attributes: {
5459
align: {
@@ -61,6 +66,13 @@ registerBlockType('page-views-count/stats', {
6166
type: 'boolean',
6267
default: true,
6368
},
69+
/**
70+
* For previewing?
71+
*/
72+
isPreview: {
73+
type: 'boolean',
74+
default: false,
75+
},
6476
},
6577

6678
/**
@@ -72,6 +84,18 @@ registerBlockType('page-views-count/stats', {
7284
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
7385
*/
7486
edit: ({ attributes, setAttributes }) => {
87+
88+
if ( attributes.isPreview ) {
89+
return ( <img
90+
src={ pvcblock.preview }
91+
alt={ __( 'Page Views Count Preview', 'page-views-count' ) }
92+
style={ {
93+
width: '100%',
94+
height: 'auto',
95+
} }
96+
/> );
97+
}
98+
7599
const { align, isDisabled } = attributes;
76100
const postID = select('core/editor').getCurrentPostId();
77101

src/blocks/stats/preview.jpg

17.1 KB
Loading

0 commit comments

Comments
 (0)