Skip to content

Commit a8ec46f

Browse files
committed
Release new version 2.4.0
* This big feature release adds dynamic text, change Total Views and Views Today text from the plugins dashboard. Add support for Dynamic Text string translation. Compatibility with WordPress 5.4, Gutenberg 7.5, WooCommerce 4.0 plus PHP 7.0 to 7.4 * Feature - Add dynamic text support for Total Views and Views Today day text from plugin settings * Feature - Option to show text on either side of the count number or both sides * Feature - Add dynamic text strings support for translations with plugins like WPML and Qtranslate * Tweak - Add the dynamic text options to the Counter Position and Style option box. * Tweak - Replace No total views yet text with the number 0 * Tweak - Do not show Views Today when the count is 0 * Tweak - Move the Counter Icon settings to new options box. * Tweak - Update Gutenberg block for work compatibility with Gutenberg latest version 7.5 * Tweak - Test for compatibility with WordPress 5.4 * Tweak - Run Travis CI unit build tests for PHP compatibility issues with PHP 7.0 to 7.4 * Tweak - Update readme decription screenshots.
1 parent 00f9062 commit a8ec46f

File tree

7 files changed

+46
-67
lines changed

7 files changed

+46
-67
lines changed

admin/admin-ui.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function is_valid_google_map_api_key( $cache=true ) {
143143
// Check it is a valid request
144144
if ( ! is_wp_error( $respone_api ) ) {
145145

146-
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body'];
146+
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body']; // @codingStandardsIgnoreLine // phpcs:ignore
147147
$response_map = json_decode( $json_string, true );
148148

149149
// Make sure that the valid response from google is not an error message

admin/includes/fonts_face.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ public function is_valid_google_api_key( $cache=true ) {
451451
// Check it is a valid request
452452
if ( ! is_wp_error( $respone_api ) ) {
453453

454-
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body'];
454+
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body']; // @codingStandardsIgnoreLine // phpcs:ignore
455455
$response_fonts = json_decode( $json_string, true );
456456

457457
// Make sure that the valid response from google is not an error message
@@ -470,7 +470,7 @@ public function is_valid_google_api_key( $cache=true ) {
470470
$response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
471471
$webfonts = wp_remote_retrieve_body( $response );
472472
if ( ! empty( $webfonts ) ) {
473-
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts;
473+
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts; // @codingStandardsIgnoreLine // phpcs:ignore
474474
$response_fonts = json_decode( $json_string, true );
475475
}
476476
}
@@ -524,7 +524,7 @@ public function is_valid_google_api_key( $cache=true ) {
524524
$response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
525525
$webfonts = wp_remote_retrieve_body( $response );
526526
if ( ! empty( $webfonts ) ) {
527-
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts;
527+
$json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts; // @codingStandardsIgnoreLine // phpcs:ignore
528528
$response_fonts = json_decode( $json_string, true );
529529
}
530530
}

admin/settings/general-settings.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function init_form_fields() {
235235
),
236236

237237
array(
238-
'name' => __( 'Counter Position and Style', 'page-views-count' ),
238+
'name' => __( 'Counter Position and Type', 'page-views-count' ),
239239
'type' => 'heading',
240240
'id' => 'page_views_count_customize_box',
241241
'is_box' => true,
@@ -333,18 +333,6 @@ public function init_form_fields() {
333333
),
334334
)
335335
),
336-
array(
337-
'name' => __( 'No Views Total', 'page-views-count' ),
338-
'id' => 'total_no_views_text',
339-
'type' => 'text',
340-
'default' => __( 'No views yet', 'page-views-count' ),
341-
),
342-
array(
343-
'name' => __( 'No Views Today', 'page-views-count' ),
344-
'id' => 'today_no_views_text',
345-
'type' => 'text',
346-
'default' => __( 'no views today', 'page-views-count' ),
347-
),
348336

349337
array(
350338
'name' => __( 'Counter Icon', 'page-views-count' ),

page-views-count.php

Lines changed: 4 additions & 4 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.3.0
6-
Requires at least: 4.9
7-
Tested up to: 5.3.2
5+
Version: 2.4.0
6+
Requires at least: 5.0
7+
Tested up to: 5.4.0
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.3.0' );
26+
define( 'A3_PVC_VERSION', '2.4.0' );
2727
define( 'A3_PVC_G_FONTS', false );
2828

2929
use \A3Rev\PageViewsCount\FrameWork;

readme.txt

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== Page View Count ===
22
Contributors: a3rev, a3rev Software, nguyencongtuan
33
Tags: wordpress page view, page view count , post views, post view count, gutenberg
4-
Requires at least: 4.9
5-
Tested up to: 5.3.2
6-
Stable tag: 2.3.0
4+
Requires at least: 5.0
5+
Tested up to: 5.4.0
6+
Stable tag: 2.4.0
77
License: GPLv3
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -62,7 +62,7 @@ Want to add a new language to Page Views Count? Great! You can contribute via [t
6262

6363
= Minimum Requirements =
6464

65-
* WordPress 4.9 or greater
65+
* WordPress 5.0 or greater
6666
* PHP version 7.0 or greater
6767
* MySQL version 5.6 or greater OR MariaDB version 10.0 or greater
6868

@@ -83,11 +83,11 @@ The manual installation method involves down loading our plugin and uploading it
8383

8484
== Screenshots ==
8585

86-
1. Page Views Count Dashboard
87-
2. Counter Position and Style Options box and settings
88-
3. Counter Position Bottom and Alignment set to Left
89-
4. Counter Position Bottom and Alignment set to Centre
90-
5. Counter Position Bottom and Alignment set to Right
86+
1. Counter
87+
2. PVC Admin
88+
3. Counter position and type
89+
4. PVC Widget
90+
5. PVC Gutenberg Block
9191

9292

9393
== Usage ==
@@ -103,6 +103,20 @@ The manual installation method involves down loading our plugin and uploading it
103103

104104
== Changelog ==
105105

106+
= 2.4.0 - 2020/03/19 =
107+
* This big feature release adds dynamic text, change Total Views and Views Today text from the plugins dashboard. Add support for Dynamic Text string translation. Compatibility with WordPress 5.4, Gutenberg 7.5, WooCommerce 4.0 plus PHP 7.0 to 7.4
108+
* Feature - Add dynamic text support for Total Views and Views Today day text from plugin settings
109+
* Feature - Option to show text on either side of the count number or both sides
110+
* Feature - Add dynamic text strings support for translations with plugins like WPML and Qtranslate
111+
* Tweak - Add the dynamic text options to the Counter Position and Style option box.
112+
* Tweak - Replace No total views yet text with the number 0
113+
* Tweak - Do not show Views Today when the count is 0
114+
* Tweak - Move the Counter Icon settings to new options box.
115+
* Tweak - Update Gutenberg block for work compatibility with Gutenberg latest version 7.5
116+
* Tweak - Test for compatibility with WordPress 5.4
117+
* Tweak - Run Travis CI unit build tests for PHP compatibility issues with PHP 7.0 to 7.4
118+
* Tweak - Update readme decription screenshots.
119+
106120
= 2.3.0 - 2020/03/10 =
107121
* This feature release contains, new PVC shortcode, new PVC Widget, option to only show total views, a new eye icon option, full compatibility with Elementor Templates, completion of PHP Composer refactor and 4 PHP fixes for compatibility with PHP v 7.0 to 7.4.
108122
* Feature - Add new PVC shortcode `[pvc_stats postid="" increase="1" show_views_today="1"]`
@@ -360,6 +374,9 @@ The manual installation method involves down loading our plugin and uploading it
360374

361375
== Upgrade Notice ==
362376

377+
= 2.4.0 =
378+
This big feature release adds dynamic text, change Total Views and Views Today text from the plugins dashboard. Add support for Dynamic Text string translation. Compatibility with WordPress 5.4, Gutenberg 7.5, WooCommerce 4.0 plus PHP 7.0 to 7.4
379+
363380
= 2.3.0 =
364381
This feature release contains, new PVC shortcode, new PVC Widget, option to only show total views, a new eye icon option, full compatibility with Elementor Templates, completion of PHP Composer refactor and 4 PHP fixes for compatibility with PHP v 7.0 to 7.4.
365382

src/class-wpml-functions.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ public function wpml_register_dynamic_string() {
4646
icl_register_string($this->plugin_wpml_name, 'Today Text Before', $pvc_settings['today_text_before'] );
4747

4848
icl_register_string($this->plugin_wpml_name, 'Today Text After', $pvc_settings['today_text_after'] );
49-
50-
icl_register_string($this->plugin_wpml_name, 'No Views Total', $pvc_settings['total_no_views_text'] );
51-
52-
icl_register_string($this->plugin_wpml_name, 'No Views Today', $pvc_settings['today_no_views_text'] );
5349

5450
}
5551
}
@@ -66,12 +62,6 @@ public function pvc_settings( $current_settings = array() ) {
6662

6763
if ( is_array( $current_settings ) && isset( $current_settings['today_text_after'] ) )
6864
$current_settings['today_text_after'] = ( function_exists('icl_t') ? icl_t( $this->plugin_wpml_name, 'Today Text After', $current_settings['today_text_after'] ) : $current_settings['today_text_after'] );
69-
70-
if ( is_array( $current_settings ) && isset( $current_settings['total_no_views_text'] ) )
71-
$current_settings['total_no_views_text'] = ( function_exists('icl_t') ? icl_t( $this->plugin_wpml_name, 'No Views Total', $current_settings['total_no_views_text'] ) : $current_settings['total_no_views_text'] );
72-
73-
if ( is_array( $current_settings ) && isset( $current_settings['today_no_views_text'] ) )
74-
$current_settings['today_no_views_text'] = ( function_exists('icl_t') ? icl_t( $this->plugin_wpml_name, 'No Views Today', $current_settings['today_no_views_text'] ) : $current_settings['today_no_views_text'] );
7565

7666

7767
return $current_settings;

src/pvc_class.php

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,16 @@ public static function pvc_get_stats( $post_id, $views_type = 'all' ) {
149149
$total = self::pvc_fetch_post_total( $post_id );
150150
$today = self::pvc_fetch_post_today( $post_id );
151151

152-
if ( ! empty( $total ) ) {
153-
154-
$output_html .= $pvc_settings['total_text_before'] . ' ' . number_format( $total ) . ' ' . $pvc_settings['total_text_after'];
152+
$output_html .= $pvc_settings['total_text_before'] . ' ' . number_format( $total ) . ' ' . $pvc_settings['total_text_after'];
155153

156-
if ( empty( $views_type ) ) {
157-
$views_type = $pvc_settings['views_type'];
158-
}
159-
160-
if ( 'all' === $views_type ) {
161-
$output_html .= ', ';
154+
if ( empty( $views_type ) ) {
155+
$views_type = $pvc_settings['views_type'];
156+
}
162157

163-
if ( ! empty( $today ) ) {
164-
$output_html .= $pvc_settings['today_text_before'] . ' ' . number_format( $today ) . ' ' . $pvc_settings['today_text_after'];
165-
} else {
166-
$output_html .= $pvc_settings['today_no_views_text'];
167-
}
168-
}
158+
if ( 'all' === $views_type && ! empty( $today ) ) {
159+
$output_html .= ', ';
169160

170-
} else {
171-
$output_html .= $pvc_settings['total_no_views_text'];
161+
$output_html .= $pvc_settings['today_text_before'] . ' ' . number_format( $today ) . ' ' . $pvc_settings['today_text_after'];
172162
}
173163

174164
$output_html = apply_filters( 'pvc_filter_get_stats', $output_html, $post_id );
@@ -241,17 +231,11 @@ public static function register_plugin_scripts() {
241231
<!-- PVC Template -->
242232
<script type="text/template" id="pvc-stats-view-template">
243233
<i class="pvc-stats-icon <?php echo $pvc_settings['icon_size']; ?>" aria-hidden="true"><?php echo ( 'eye' == $pvc_settings['icon'] ? self::$eye_icon : self::$chart_icon ); ?></i>
244-
<% if ( total_view > 0 ) { %>
245-
<?php echo $pvc_settings['total_text_before']; ?> <%= total_view %> <?php echo $pvc_settings['total_text_after']; ?><span class="views_today">,
246-
<% if ( today_view > 0 ) { %>
247-
<?php echo $pvc_settings['today_text_before']; ?> <%= today_view %> <?php echo $pvc_settings['today_text_after']; ?>
248-
<% } else { %>
249-
<?php echo $pvc_settings['today_no_views_text']; ?>
250-
<% } %>
251-
</span>
252-
<% } else { %>
253-
<?php echo $pvc_settings['total_no_views_text']; ?>
234+
<?php echo $pvc_settings['total_text_before']; ?> <%= total_view %> <?php echo $pvc_settings['total_text_after']; ?>
235+
<% if ( today_view > 0 ) { %>
236+
<span class="views_today">, <?php echo $pvc_settings['today_text_before']; ?> <%= today_view %> <?php echo $pvc_settings['today_text_after']; ?></span>
254237
<% } %>
238+
</span>
255239
</script>
256240
<?php // phpcs:enable ?>
257241
<?php // @codingStandardsIgnoreEnd ?>

0 commit comments

Comments
 (0)