Top 10 – Popular posts plugin for WordPress - Version 2.7.0

Version Description

Release post: https://wzn.io/2HWbtwr

  • Features:

    • Recreate the Top 10 database tables. You can find the button in the Tools page. Backup your database first
    • New export/import interface to export and import the Top 10 tables and settings
  • Enhancements:

    • tptn_views shortcode adds a new parameter 'count' to explicitly set the count type. Choose from daily, total or overall. This is overridden if daily is set to 0 (backwards compatibility)
Download this release

Release Info

Developer Ajay
Plugin Icon 128x128 Top 10 – Popular posts plugin for WordPress
Version 2.7.0
Comparing to
See all releases

Code changes from version 2.6.3 to 2.7.0

README.md CHANGED
@@ -5,9 +5,9 @@
5
  [![WordPress Tested](https://img.shields.io/wordpress/v/top-10.svg?style=flat-square)](https://wordpress.org/plugins/top-10/)
6
  [![Build Status](https://travis-ci.org/WebberZone/top-10.svg?branch=master)](https://travis-ci.org/WebberZone/top-10)
7
 
8
- __Requires:__ 4.5
9
 
10
- __Tested up to:__ 5.1
11
 
12
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
13
 
@@ -38,9 +38,15 @@ Top 10 also has powerful API and is fully extendable with WordPress actions and
38
  * **Exclusions**: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
39
  * **Styles**: The output is wrapped in CSS classes which allows you to easily style the list. You can enter your custom CSS styles from within WordPress Admin area or use the style included.
40
  * **Admin interface**: View list of daily and/or overall popular posts from within the dashboard. Top 10 also adds two sortable columns to your All Posts and All Pages pages in your WordPress Admin area
 
41
  * **Works with caching plugins** like WP-Super-Cache, W3 Total Cache or Quick Cache
42
  * **Extendable code**: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
43
 
 
 
 
 
 
44
  ### Donations
45
 
46
  I spend a significant amount of my free time maintaining, updating and more importantly supporting this plugin. If you have been using this plugin and find this useful, do consider making a donation. This helps me pay for my hosting and domains.
5
  [![WordPress Tested](https://img.shields.io/wordpress/v/top-10.svg?style=flat-square)](https://wordpress.org/plugins/top-10/)
6
  [![Build Status](https://travis-ci.org/WebberZone/top-10.svg?branch=master)](https://travis-ci.org/WebberZone/top-10)
7
 
8
+ __Requires:__ 4.7
9
 
10
+ __Tested up to:__ 5.2
11
 
12
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
13
 
38
  * **Exclusions**: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
39
  * **Styles**: The output is wrapped in CSS classes which allows you to easily style the list. You can enter your custom CSS styles from within WordPress Admin area or use the style included.
40
  * **Admin interface**: View list of daily and/or overall popular posts from within the dashboard. Top 10 also adds two sortable columns to your All Posts and All Pages pages in your WordPress Admin area
41
+ * **Export/Import interface**: Export the count tables and settings to restore in the same site or on other installs
42
  * **Works with caching plugins** like WP-Super-Cache, W3 Total Cache or Quick Cache
43
  * **Extendable code**: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
44
 
45
+ ### GDPR
46
+ Top 10 is GDPR compliant as it doesn't collect any personal data about your visitors when installed out of the box. You can see the data the plugin stores in the `wp_top_ten` and `wp_top_ten_daily` tables in the database. Note: the prefix `wp` might be different if you have changed it from the default.
47
+
48
+ YOU ARE RESPONSIBLE FOR ENSURING THAT ALL GDPR REQUIREMENTS ARE MET ON YOUR WEBSITE.
49
+
50
  ### Donations
51
 
52
  I spend a significant amount of my free time maintaining, updating and more importantly supporting this plugin. If you have been using this plugin and find this useful, do consider making a donation. This helps me pay for my hosting and domains.
includes/admin/admin.php CHANGED
@@ -25,7 +25,7 @@ if ( ! defined( 'WPINC' ) ) {
25
  * @return void
26
  */
27
  function tptn_add_admin_pages_links() {
28
- global $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily;
29
 
30
  $tptn_settings_page = add_menu_page( esc_html__( 'Top 10 Settings', 'top-10' ), esc_html__( 'Top 10', 'top-10' ), 'manage_options', 'tptn_options_page', 'tptn_options_page', 'dashicons-editor-ol' );
31
  add_action( "load-$tptn_settings_page", 'tptn_settings_help' ); // Load the settings contextual help.
@@ -34,10 +34,6 @@ function tptn_add_admin_pages_links() {
34
  $plugin_page = add_submenu_page( 'tptn_options_page', esc_html__( 'Top 10 Settings', 'top-10' ), esc_html__( 'Settings', 'top-10' ), 'manage_options', 'tptn_options_page', 'tptn_options_page' );
35
  add_action( 'admin_head-' . $plugin_page, 'tptn_adminhead' );
36
 
37
- $tptn_settings_tools_help = add_submenu_page( 'tptn_options_page', esc_html__( 'Top 10 Tools', 'top-10' ), esc_html__( 'Tools', 'top-10' ), 'manage_options', 'tptn_tools_page', 'tptn_tools_page' );
38
- add_action( "load-$tptn_settings_tools_help", 'tptn_settings_tools_help' );
39
- add_action( 'admin_head-' . $tptn_settings_tools_help, 'tptn_adminhead' );
40
-
41
  // Initialise Top 10 Statistics pages.
42
  $tptn_stats_screen = new Top_Ten_Statistics();
43
 
@@ -49,6 +45,14 @@ function tptn_add_admin_pages_links() {
49
  add_action( "load-$tptn_settings_popular_posts_daily", array( $tptn_stats_screen, 'screen_option' ) );
50
  add_action( 'admin_head-' . $tptn_settings_popular_posts_daily, 'tptn_adminhead' );
51
 
 
 
 
 
 
 
 
 
52
  }
53
  add_action( 'admin_menu', 'tptn_add_admin_pages_links' );
54
 
25
  * @return void
26
  */
27
  function tptn_add_admin_pages_links() {
28
+ global $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help;
29
 
30
  $tptn_settings_page = add_menu_page( esc_html__( 'Top 10 Settings', 'top-10' ), esc_html__( 'Top 10', 'top-10' ), 'manage_options', 'tptn_options_page', 'tptn_options_page', 'dashicons-editor-ol' );
31
  add_action( "load-$tptn_settings_page", 'tptn_settings_help' ); // Load the settings contextual help.
34
  $plugin_page = add_submenu_page( 'tptn_options_page', esc_html__( 'Top 10 Settings', 'top-10' ), esc_html__( 'Settings', 'top-10' ), 'manage_options', 'tptn_options_page', 'tptn_options_page' );
35
  add_action( 'admin_head-' . $plugin_page, 'tptn_adminhead' );
36
 
 
 
 
 
37
  // Initialise Top 10 Statistics pages.
38
  $tptn_stats_screen = new Top_Ten_Statistics();
39
 
45
  add_action( "load-$tptn_settings_popular_posts_daily", array( $tptn_stats_screen, 'screen_option' ) );
46
  add_action( 'admin_head-' . $tptn_settings_popular_posts_daily, 'tptn_adminhead' );
47
 
48
+ // Add links to Tools pages.
49
+ $tptn_settings_tools_help = add_submenu_page( 'tptn_options_page', esc_html__( 'Top 10 Tools', 'top-10' ), esc_html__( 'Tools', 'top-10' ), 'manage_options', 'tptn_tools_page', 'tptn_tools_page' );
50
+ add_action( "load-$tptn_settings_tools_help", 'tptn_settings_tools_help' );
51
+ add_action( 'admin_head-' . $tptn_settings_tools_help, 'tptn_adminhead' );
52
+
53
+ $tptn_settings_exim_help = add_submenu_page( 'tptn_options_page', esc_html__( 'Top 10 Import Export Tables', 'top-10' ), esc_html__( 'Import/Export', 'top-10' ), 'manage_options', 'tptn_exim_page', 'tptn_exim_page' );
54
+ add_action( "load-$tptn_settings_exim_help", 'tptn_settings_exim_help' );
55
+ add_action( 'admin_head-' . $tptn_settings_exim_help, 'tptn_adminhead' );
56
  }
57
  add_action( 'admin_menu', 'tptn_add_admin_pages_links' );
58
 
includes/admin/help-tab.php CHANGED
@@ -146,3 +146,42 @@ function tptn_settings_tools_help() {
146
 
147
  do_action( 'tptn_settings_tools_help', $screen );
148
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
  do_action( 'tptn_settings_tools_help', $screen );
148
  }
149
+
150
+ /**
151
+ * Generates the Tools help page.
152
+ *
153
+ * @since 2.7.0
154
+ */
155
+ function tptn_settings_exim_help() {
156
+ global $tptn_settings_exim_help;
157
+
158
+ $screen = get_current_screen();
159
+
160
+ if ( $screen->id !== $tptn_settings_exim_help ) {
161
+ return;
162
+ }
163
+
164
+ $screen->set_help_sidebar(
165
+ /* translators: 1: Support link. */
166
+ '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%1$s">WebberZone support site</a>.', 'top-10' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
167
+ /* translators: 1: Forum link. */
168
+ '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%1$s">WordPress.org support forums</a>.', 'top-10' ), esc_url( 'https://wordpress.org/support/plugin/top-10' ) ) . '</p>' .
169
+ '<p>' . sprintf(
170
+ /* translators: 1: Knowledgebase link. */
171
+ __( '<a href="%1$s">Top 10 Knowledge base</a>', 'top-10' ),
172
+ esc_url( 'https://webberzone.com/support/section/top-10/' )
173
+ ) . '</p>'
174
+ );
175
+
176
+ $screen->add_help_tab(
177
+ array(
178
+ 'id' => 'tptn-settings-general',
179
+ 'title' => __( 'General', 'top-10' ),
180
+ 'content' =>
181
+ '<p>' . __( 'This screen allows you to import and export the database tables.', 'top-10' ) . '</p>' .
182
+ '<p>' . __( 'Refer to the knowledge base to learn how to use this in detail.', 'top-10' ) . '</p>',
183
+ )
184
+ );
185
+
186
+ do_action( 'tptn_settings_tools_help', $screen );
187
+ }
includes/admin/import-export.php ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions to import and export the Top 10 data.
4
+ *
5
+ * @link https://webberzone.com
6
+ * @since 2.7.0
7
+ *
8
+ * @package Top 10
9
+ * @subpackage Admin/Tools/Import_Export
10
+ */
11
+
12
+ // If this file is called directly, abort.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
+
18
+ /**
19
+ * Render the tools settings page.
20
+ *
21
+ * @since 2.7.0
22
+ *
23
+ * @return void
24
+ */
25
+ function tptn_exim_page() {
26
+
27
+ /* Message for successful file import */
28
+ if ( isset( $_GET['file_import'] ) && 'success' === $_GET['file_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
29
+ add_settings_error( 'tptn-notices', '', esc_html__( 'Data has been imported into the table', 'top-10' ), 'updated' );
30
+ }
31
+
32
+ /* Message for successful file import */
33
+ if ( isset( $_GET['settings_import'] ) && 'success' === $_GET['settings_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
34
+ add_settings_error( 'tptn-notices', '', esc_html__( 'Settings have been imported successfully', 'top-10' ), 'updated' );
35
+ }
36
+
37
+ ob_start();
38
+ ?>
39
+ <div class="wrap">
40
+ <h1><?php esc_html_e( 'Top 10 - Import/Export tables', 'top-10' ); ?></h1>
41
+
42
+ <?php settings_errors(); ?>
43
+
44
+ <div id="poststuff">
45
+ <div id="post-body" class="metabox-holder columns-2">
46
+ <div id="post-body-content">
47
+
48
+ <form method="post">
49
+
50
+ <h2 style="padding-left:0px"><?php esc_html_e( 'Export/Import settings', 'top-10' ); ?></h2>
51
+ <p class="description">
52
+ <?php esc_html_e( 'Export the plugin settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'top-10' ); ?>
53
+ </p>
54
+ <p><input type="hidden" name="tptn_action" value="export_settings" /></p>
55
+ <p>
56
+ <?php submit_button( esc_html__( 'Export Settings', 'top-10' ), 'primary', 'tptn_export_settings', false ); ?>
57
+ </p>
58
+
59
+ <?php wp_nonce_field( 'tptn_export_setting_nonce', 'tptn_export_setting_nonce' ); ?>
60
+ </form>
61
+
62
+ <form method="post" enctype="multipart/form-data">
63
+
64
+ <p class="description">
65
+ <?php esc_html_e( 'Import the plugin settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'top-10' ); ?>
66
+ </p>
67
+ <p>
68
+ <input type="file" name="import_settings_file" />
69
+ </p>
70
+ <p>
71
+ <?php submit_button( esc_html__( 'Import Settings', 'top-10' ), 'primary', 'tptn_import_settings', false ); ?>
72
+ </p>
73
+
74
+ <input type="hidden" name="tptn_action" value="import_settings" />
75
+ <?php wp_nonce_field( 'tptn_import_settings_nonce', 'tptn_import_settings_nonce' ); ?>
76
+ </form>
77
+
78
+ <form method="post">
79
+
80
+ <h2 style="padding-left:0px"><?php esc_html_e( 'Export tables', 'top-10' ); ?></h2>
81
+ <p class="description">
82
+ <?php esc_html_e( 'Click the buttons below to export the overall and the daily tables. The file is downloaded as an CSV file which you should be able to edit in Excel or any other compatible software.', 'top-10' ); ?>
83
+ <?php esc_html_e( 'If you are using WordPress Multisite then this will include the counts across all sites as the plugin uses a single table to store counts.', 'top-10' ); ?>
84
+ </p>
85
+ <p><input type="hidden" name="tptn_action" value="export_settings" /></p>
86
+ <p>
87
+ <?php submit_button( esc_html__( 'Export overall tables', 'top-10' ), 'primary', 'tptn_export_total', false ); ?>
88
+ <?php submit_button( esc_html__( 'Export daily tables', 'top-10' ), 'primary', 'tptn_export_daily', false ); ?>
89
+ </p>
90
+
91
+ <?php wp_nonce_field( 'tptn_export_nonce', 'tptn_export_nonce' ); ?>
92
+ </form>
93
+
94
+ <form method="post" enctype="multipart/form-data">
95
+
96
+ <h2 style="padding-left:0px"><?php esc_html_e( 'Import tables', 'top-10' ); ?></h2>
97
+ <p class="description">
98
+ <?php esc_html_e( 'This action will replace the data in your tables, so I suggest that you export the existing data using the buttons above, amend it and then import it. It is important to maintain the export format of the data to avoid corruption.', 'top-10' ); ?>
99
+ </p>
100
+ <p class="description">
101
+ <strong><?php esc_html_e( 'Backup your database before proceeding so you will be able to restore it in case anything goes wrong.', 'top-10' ); ?></strong>
102
+ </p>
103
+ <h4 style="padding-left:0px"><?php esc_html_e( 'Import Overall Table', 'top-10' ); ?></h4>
104
+ <p>
105
+ <input type="file" name="import_file" />
106
+ </p>
107
+ <p>
108
+ <?php submit_button( esc_html__( 'Import Overall CSV', 'top-10' ), 'primary', 'tptn_import_total', false ); ?>
109
+ </p>
110
+
111
+ <h4 style="padding-left:0px"><?php esc_html_e( 'Import Daily Table', 'top-10' ); ?></h4>
112
+ <p>
113
+ <input type="file" name="import_file_daily" />
114
+ </p>
115
+ <p>
116
+ <?php submit_button( esc_html__( 'Import Daily CSV', 'top-10' ), 'primary', 'tptn_import_daily', false ); ?>
117
+ </p>
118
+
119
+ <input type="hidden" name="tptn_action" value="import_settings" />
120
+ <?php wp_nonce_field( 'tptn_import_nonce', 'tptn_import_nonce' ); ?>
121
+ </form>
122
+
123
+ </div><!-- /#post-body-content -->
124
+
125
+ <div id="postbox-container-1" class="postbox-container">
126
+
127
+ <div id="side-sortables" class="meta-box-sortables ui-sortable">
128
+ <?php include_once 'sidebar.php'; ?>
129
+ </div><!-- /#side-sortables -->
130
+
131
+ </div><!-- /#postbox-container-1 -->
132
+ </div><!-- /#post-body -->
133
+ <br class="clear" />
134
+ </div><!-- /#poststuff -->
135
+
136
+ </div><!-- /.wrap -->
137
+
138
+ <?php
139
+ echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
140
+ }
141
+
142
+
143
+ /**
144
+ * Process a settings export that generates a .json file of the shop settings
145
+ *
146
+ * @since 2.7.0
147
+ */
148
+ function tptn_export_tables() {
149
+ global $wpdb;
150
+
151
+ if ( empty( $_POST['tptn_action'] ) || 'export_settings' !== $_POST['tptn_action'] ) {
152
+ return;
153
+ }
154
+
155
+ if ( isset( $_POST['tptn_export_nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['tptn_export_nonce'] ), 'tptn_export_nonce' ) ) {
156
+ return;
157
+ }
158
+
159
+ if ( ! current_user_can( 'manage_options' ) ) {
160
+ return;
161
+ }
162
+
163
+ if ( isset( $_POST['tptn_export_total'] ) ) {
164
+ $daily = false;
165
+ } elseif ( isset( $_POST['tptn_export_daily'] ) ) {
166
+ $daily = true;
167
+ } else {
168
+ return;
169
+ }
170
+
171
+ $table_name = $wpdb->base_prefix . 'top_ten';
172
+ if ( $daily ) {
173
+ $table_name .= '_daily';
174
+ }
175
+
176
+ $filename = 'top-ten' . ( $daily ? '-daily' : '' ) . '-table-' . current_time( 'Y_m_d_Hi' ) . '.csv';
177
+
178
+ $header_row = array(
179
+ esc_html__( 'Post ID', 'top-10' ),
180
+ esc_html__( 'Visits', 'top-10' ),
181
+ );
182
+ if ( $daily ) {
183
+ $header_row[] = esc_html__( 'Date', 'top-10' );
184
+ }
185
+ $header_row[] = esc_html__( 'Blog ID', 'top-10' );
186
+
187
+ $data_rows = array();
188
+
189
+ $sql = 'SELECT * FROM ' . $table_name;
190
+
191
+ $results = $wpdb->get_results( $sql, 'ARRAY_A' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
192
+
193
+ foreach ( $results as $result ) {
194
+ $row = array(
195
+ $result['postnumber'],
196
+ $result['cntaccess'],
197
+ );
198
+ if ( $daily ) {
199
+ $row[] = $result['dp_date'];
200
+ }
201
+ $row[] = $result['blog_id'];
202
+
203
+ $data_rows[] = $row;
204
+ }
205
+
206
+ ignore_user_abort( true );
207
+
208
+ $fh = fopen( 'php://output', 'w' );
209
+ fprintf( $fh, chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF ) );
210
+
211
+ nocache_headers();
212
+ header( 'Content-Type: text/csv; charset=utf-8' );
213
+ header( "Content-Disposition: attachment; filename={$filename}" );
214
+ header( 'Expires: 0' );
215
+
216
+ fputcsv( $fh, $header_row );
217
+ foreach ( $data_rows as $data_row ) {
218
+ fputcsv( $fh, $data_row );
219
+ }
220
+ fclose( $fh ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
221
+
222
+ exit;
223
+ }
224
+ add_action( 'admin_init', 'tptn_export_tables' );
225
+
226
+ /**
227
+ * Process a settings export that generates a .json file of the shop settings
228
+ *
229
+ * @since 2.7.0
230
+ */
231
+ function tptn_import_tables() {
232
+ global $wpdb;
233
+
234
+ if ( empty( $_POST['tptn_action'] ) || 'import_settings' !== $_POST['tptn_action'] ) {
235
+ return;
236
+ }
237
+
238
+ if ( isset( $_POST['tptn_import_nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['tptn_import_nonce'] ), 'tptn_import_nonce' ) ) {
239
+ return;
240
+ }
241
+
242
+ if ( ! current_user_can( 'manage_options' ) ) {
243
+ return;
244
+ }
245
+
246
+ if ( isset( $_POST['tptn_import_total'] ) ) {
247
+ $daily = false;
248
+ } elseif ( isset( $_POST['tptn_import_daily'] ) ) {
249
+ $daily = true;
250
+ } else {
251
+ return;
252
+ }
253
+
254
+ $table_name = $wpdb->base_prefix . 'top_ten';
255
+ $filename = 'import_file';
256
+ if ( $daily ) {
257
+ $table_name .= '_daily';
258
+ $filename .= '_daily';
259
+ }
260
+
261
+ $extension = isset( $_FILES[ $filename ]['name'] ) ? end( explode( '.', sanitize_file_name( wp_unslash( $_FILES[ $filename ]['name'] ) ) ) ) : '';
262
+
263
+ if ( 'csv' !== $extension ) {
264
+ wp_die( esc_html__( 'Please upload a valid .csv file', 'top-10' ) );
265
+ }
266
+
267
+ $import_file = isset( $_FILES[ $filename ]['tmp_name'] ) ? ( wp_unslash( $_FILES[ $filename ]['tmp_name'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
268
+
269
+ if ( empty( $import_file ) ) {
270
+ wp_die( esc_html__( 'Please upload a file to import', 'top-10' ) );
271
+ }
272
+
273
+ // Truncate the table before import.
274
+ tptn_trunc_count( $daily );
275
+
276
+ // Open uploaded CSV file with read-only mode.
277
+ $csv_file = fopen( $import_file, 'r' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
278
+
279
+ // Skip first line.
280
+ fgetcsv( $csv_file );
281
+
282
+ while ( ( $line = fgetcsv( $csv_file, 100, ',' ) ) !== false ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
283
+
284
+ if ( $daily ) {
285
+ $dp_date = str_replace( '/', '-', $line[2] );
286
+ $dp_date = date( 'Y-m-d H', strtotime( $dp_date ) );
287
+
288
+ $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, dp_date, blog_id) VALUES( %d, %d, %s, %d ) ", $line[0], $line[1], $dp_date, $line[3] ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
289
+ } else {
290
+ $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES( %d, %d, %d ) ", $line[0], $line[1], $line[2] ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
291
+ }
292
+ }
293
+
294
+ // Close file.
295
+ fclose( $csv_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
296
+
297
+ wp_safe_redirect(
298
+ add_query_arg(
299
+ array(
300
+ 'page' => 'tptn_exim_page',
301
+ 'file_import' => 'success',
302
+ ),
303
+ admin_url( 'admin.php' )
304
+ )
305
+ );
306
+ exit;
307
+
308
+ }
309
+ add_action( 'admin_init', 'tptn_import_tables' );
310
+
311
+ /**
312
+ * Process a settings export that generates a .json file of the shop settings
313
+ *
314
+ * @since 2.7.0
315
+ */
316
+ function tptn_process_settings_export() {
317
+
318
+ if ( empty( $_POST['tptn_action'] ) || 'export_settings' !== $_POST['tptn_action'] ) {
319
+ return;
320
+ }
321
+
322
+ if ( isset( $_POST['tptn_export_settings_nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['tptn_export_settings_nonce'] ), 'tptn_export_settings_nonce' ) ) {
323
+ return;
324
+ }
325
+
326
+ if ( ! current_user_can( 'manage_options' ) ) {
327
+ return;
328
+ }
329
+
330
+ $settings = get_option( 'tptn_settings' );
331
+
332
+ ignore_user_abort( true );
333
+
334
+ nocache_headers();
335
+ header( 'Content-Type: application/json; charset=utf-8' );
336
+ header( 'Content-Disposition: attachment; filename=tptn-settings-export-' . date( 'm-d-Y' ) . '.json' );
337
+ header( 'Expires: 0' );
338
+
339
+ echo wp_json_encode( $settings );
340
+ exit;
341
+ }
342
+ add_action( 'admin_init', 'tptn_process_settings_export' );
343
+
344
+ /**
345
+ * Process a settings import from a json file
346
+ *
347
+ * @since 2.7.0
348
+ */
349
+ function tptn_process_settings_import() {
350
+
351
+ if ( empty( $_POST['tptn_action'] ) || 'import_settings' !== $_POST['tptn_action'] ) {
352
+ return;
353
+ }
354
+
355
+ if ( isset( $_POST['tptn_import_settings_nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['tptn_import_settings_nonce'] ), 'tptn_import_settings_nonce' ) ) {
356
+ return;
357
+ }
358
+
359
+ if ( ! current_user_can( 'manage_options' ) ) {
360
+ return;
361
+ }
362
+
363
+ $filename = 'import_settings_file';
364
+ $extension = isset( $_FILES[ $filename ]['name'] ) ? end( explode( '.', sanitize_file_name( wp_unslash( $_FILES[ $filename ]['name'] ) ) ) ) : '';
365
+
366
+ if ( 'json' !== $extension ) {
367
+ wp_die( esc_html__( 'Please upload a valid .json file', 'top-10' ) );
368
+ }
369
+
370
+ $import_file = isset( $_FILES[ $filename ]['tmp_name'] ) ? ( wp_unslash( $_FILES[ $filename ]['tmp_name'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
371
+
372
+ if ( empty( $import_file ) ) {
373
+ wp_die( esc_html__( 'Please upload a file to import', 'top-10' ) );
374
+ }
375
+
376
+ // Retrieve the settings from the file and convert the json object to an array.
377
+ $settings = (array) json_decode( file_get_contents( $import_file ), true ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
378
+
379
+ update_option( 'tptn_settings', $settings );
380
+
381
+ wp_safe_redirect(
382
+ add_query_arg(
383
+ array(
384
+ 'page' => 'tptn_exim_page',
385
+ 'settings_import' => 'success',
386
+ ),
387
+ admin_url( 'admin.php' )
388
+ )
389
+ );
390
+ exit;
391
+
392
+ }
393
+ add_action( 'admin_init', 'tptn_process_settings_import' );
includes/admin/tools.php CHANGED
@@ -36,6 +36,12 @@ function tptn_tools_page() {
36
  add_settings_error( 'tptn-notices', '', esc_html__( 'Top 10 popular posts reset', 'top-10' ), 'error' );
37
  }
38
 
 
 
 
 
 
 
39
  /* Truncate daily posts table */
40
  if ( ( isset( $_POST['tptn_trunc_daily'] ) ) && ( check_admin_referer( 'tptn-tools-settings' ) ) ) {
41
  tptn_trunc_count( true );
@@ -95,35 +101,44 @@ function tptn_tools_page() {
95
  </p>
96
 
97
  <h2 style="padding-left:0px"><?php esc_html_e( 'Reset database', 'top-10' ); ?></h2>
 
 
 
98
  <p>
99
  <input name="tptn_trunc_all" type="submit" id="tptn_trunc_all" value="<?php esc_attr_e( 'Reset Popular Posts Network-wide', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" onclick="if (!confirm('<?php esc_attr_e( 'Are you sure you want to reset the popular posts?', 'top-10' ); ?>')) return false;" />
100
  <input name="tptn_trunc_daily" type="submit" id="tptn_trunc_daily" value="<?php esc_attr_e( 'Reset Daily Popular Posts Network-wide', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" onclick="if (!confirm('<?php esc_attr_e( 'Are you sure you want to reset the daily popular posts?', 'top-10' ); ?>')) return false;" />
101
  </p>
 
 
102
  <p class="description">
103
- <?php esc_html_e( 'This will reset the Top 10 tables. If you are running Top 10 on multisite then it will delete the popular posts across the entire network. This cannot be reversed. Make sure that your database has been backed up before proceeding', 'top-10' ); ?>
104
  </p>
105
-
106
- <h2 style="padding-left:0px"><?php esc_html_e( 'Other tools', 'top-10' ); ?></h2>
107
  <p>
108
- <input name="tptn_delete_old_settings" type="submit" id="tptn_delete_old_settings" value="<?php esc_attr_e( 'Delete old settings', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will delete the settings before v2.5.x. Proceed?', 'top-10' ); ?>')) return false;" />
109
  </p>
 
 
110
  <p class="description">
111
  <?php esc_html_e( 'From v2.5.x, Top 10 stores the settings in a new key in the database. This will delete the old settings for the current blog. It is recommended that you do this at the earliest after upgrade. However, you should do this only if you are comfortable with the new settings.', 'top-10' ); ?>
112
  </p>
113
-
114
  <p>
115
- <input name="tptn_merge_blogids" type="submit" id="tptn_merge_blogids" value="<?php esc_attr_e( 'Merge blog ID 0 and 1 post counts', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will merge post counts for blog IDs 0 and 1. Proceed?', 'top-10' ); ?>')) return false;" />
116
  </p>
 
117
  <p class="description">
118
  <?php esc_html_e( 'This will merge post counts for posts with table entries of 0 and 1', 'top-10' ); ?>
119
  </p>
120
-
121
  <p>
122
- <input name="tptn_clean_duplicates" type="submit" id="tptn_clean_duplicates" value="<?php esc_attr_e( 'Merge duplicates across blog IDs', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will delete the duplicate entries in the tables. Proceed?', 'top-10' ); ?>')) return false;" />
123
  </p>
 
124
  <p class="description">
125
  <?php esc_html_e( 'In older versions, the plugin created entries with duplicate post IDs. Clicking the button below will merge these duplicate IDs', 'top-10' ); ?>
126
  </p>
 
 
 
 
127
  <?php wp_nonce_field( 'tptn-tools-settings' ); ?>
128
  </form>
129
 
@@ -183,8 +198,7 @@ function tptn_merge_blogids( $daily = false ) {
183
  }
184
 
185
  if ( $daily ) {
186
- $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
187
- "
188
  INSERT INTO `$table_name` (postnumber, cntaccess, dp_date, blog_id) (
189
  SELECT
190
  postnumber,
@@ -195,22 +209,23 @@ function tptn_merge_blogids( $daily = false ) {
195
  WHERE blog_ID IN (0,1)
196
  GROUP BY postnumber, dp_date
197
  ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
198
- "
199
- );
 
200
  } else {
201
- $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
202
- "
203
- INSERT INTO `$table_name` (postnumber, cntaccess, blog_id) (
204
- SELECT
205
- postnumber,
206
- SUM(cntaccess) as sumCount,
207
- 1
208
- FROM `$table_name`
209
- WHERE blog_ID IN (0,1)
210
- GROUP BY postnumber
211
- ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
212
- "
213
- );
214
  }
215
 
216
  $wpdb->query( "DELETE FROM $table_name WHERE blog_id = 0" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
@@ -269,3 +284,62 @@ function tptn_recreate_primary_key_html() {
269
  */
270
  return apply_filters( 'tptn_recreate_primary_key_html', $sql );
271
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  add_settings_error( 'tptn-notices', '', esc_html__( 'Top 10 popular posts reset', 'top-10' ), 'error' );
37
  }
38
 
39
+ /* Recreate tables */
40
+ if ( ( isset( $_POST['tptn_recreate_tables'] ) ) && ( check_admin_referer( 'tptn-tools-settings' ) ) ) {
41
+ tptn_recreate_tables();
42
+ add_settings_error( 'tptn-notices', '', esc_html__( 'Top 10 tables have been recreated', 'top-10' ), 'updated' );
43
+ }
44
+
45
  /* Truncate daily posts table */
46
  if ( ( isset( $_POST['tptn_trunc_daily'] ) ) && ( check_admin_referer( 'tptn-tools-settings' ) ) ) {
47
  tptn_trunc_count( true );
101
  </p>
102
 
103
  <h2 style="padding-left:0px"><?php esc_html_e( 'Reset database', 'top-10' ); ?></h2>
104
+ <p class="description">
105
+ <?php esc_html_e( 'This will reset the Top 10 tables. If you are running Top 10 on multisite then it will delete the popular posts across the entire network. This cannot be reversed. Make sure that your database has been backed up before proceeding', 'top-10' ); ?>
106
+ </p>
107
  <p>
108
  <input name="tptn_trunc_all" type="submit" id="tptn_trunc_all" value="<?php esc_attr_e( 'Reset Popular Posts Network-wide', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" onclick="if (!confirm('<?php esc_attr_e( 'Are you sure you want to reset the popular posts?', 'top-10' ); ?>')) return false;" />
109
  <input name="tptn_trunc_daily" type="submit" id="tptn_trunc_daily" value="<?php esc_attr_e( 'Reset Daily Popular Posts Network-wide', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" onclick="if (!confirm('<?php esc_attr_e( 'Are you sure you want to reset the daily popular posts?', 'top-10' ); ?>')) return false;" />
110
  </p>
111
+
112
+ <h2 style="padding-left:0px"><?php esc_html_e( 'Recreate Database Tables', 'top-10' ); ?></h2>
113
  <p class="description">
114
+ <?php esc_html_e( 'Only click the button below after performing a full backup of the database. You can use any of the popular backup plugins or phpMyAdmin to achieve this. The authors of this plugin do not guarantee that everything will go smoothly as it depends on your site environment and volume of data. If you are not comfortable, please do not proceed.', 'top-10' ); ?>
115
  </p>
 
 
116
  <p>
117
+ <input name="tptn_recreate_tables" type="submit" id="tptn_recreate_tables" value="<?php esc_attr_e( 'Recreate Database Tables', 'top-10' ); ?>" style="color:#f00" onclick="if (!confirm('<?php esc_attr_e( 'Hit Cancel if you have not backed up your database', 'top-10' ); ?>')) return false;" class="button button-secondary" />
118
  </p>
119
+
120
+ <h2 style="padding-left:0px"><?php esc_html_e( 'Other tools', 'top-10' ); ?></h2>
121
  <p class="description">
122
  <?php esc_html_e( 'From v2.5.x, Top 10 stores the settings in a new key in the database. This will delete the old settings for the current blog. It is recommended that you do this at the earliest after upgrade. However, you should do this only if you are comfortable with the new settings.', 'top-10' ); ?>
123
  </p>
 
124
  <p>
125
+ <input name="tptn_delete_old_settings" type="submit" id="tptn_delete_old_settings" value="<?php esc_attr_e( 'Delete old settings', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will delete the settings before v2.5.x. Proceed?', 'top-10' ); ?>')) return false;" />
126
  </p>
127
+
128
  <p class="description">
129
  <?php esc_html_e( 'This will merge post counts for posts with table entries of 0 and 1', 'top-10' ); ?>
130
  </p>
 
131
  <p>
132
+ <input name="tptn_merge_blogids" type="submit" id="tptn_merge_blogids" value="<?php esc_attr_e( 'Merge blog ID 0 and 1 post counts', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will merge post counts for blog IDs 0 and 1. Proceed?', 'top-10' ); ?>')) return false;" />
133
  </p>
134
+
135
  <p class="description">
136
  <?php esc_html_e( 'In older versions, the plugin created entries with duplicate post IDs. Clicking the button below will merge these duplicate IDs', 'top-10' ); ?>
137
  </p>
138
+ <p>
139
+ <input name="tptn_clean_duplicates" type="submit" id="tptn_clean_duplicates" value="<?php esc_attr_e( 'Merge duplicates across blog IDs', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'This will delete the duplicate entries in the tables. Proceed?', 'top-10' ); ?>')) return false;" />
140
+ </p>
141
+
142
  <?php wp_nonce_field( 'tptn-tools-settings' ); ?>
143
  </form>
144
 
198
  }
199
 
200
  if ( $daily ) {
201
+ $sql = "
 
202
  INSERT INTO `$table_name` (postnumber, cntaccess, dp_date, blog_id) (
203
  SELECT
204
  postnumber,
209
  WHERE blog_ID IN (0,1)
210
  GROUP BY postnumber, dp_date
211
  ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
212
+ ";
213
+
214
+ $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
215
  } else {
216
+ $sql = "
217
+ INSERT INTO `$table_name` (postnumber, cntaccess, blog_id) (
218
+ SELECT
219
+ postnumber,
220
+ SUM(cntaccess) as sumCount,
221
+ 1
222
+ FROM `$table_name`
223
+ WHERE blog_ID IN (0,1)
224
+ GROUP BY postnumber
225
+ ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
226
+ ";
227
+
228
+ $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
229
  }
230
 
231
  $wpdb->query( "DELETE FROM $table_name WHERE blog_id = 0" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
284
  */
285
  return apply_filters( 'tptn_recreate_primary_key_html', $sql );
286
  }
287
+
288
+ /**
289
+ * Retrieves the SQL code to recreate the PRIMARY KEY.
290
+ *
291
+ * @since 2.7.0
292
+ */
293
+ function tptn_recreate_tables() {
294
+ global $wpdb;
295
+
296
+ $table_name = $wpdb->base_prefix . 'top_ten';
297
+ $table_name_daily = $wpdb->base_prefix . 'top_ten_daily';
298
+ $table_name_temp = $table_name . '_temp';
299
+ $table_name_daily_temp = $table_name_daily . '_temp';
300
+
301
+ $wpdb->hide_errors();
302
+
303
+ // 1. create temporary tables with the data.
304
+ $wpdb->query( "CREATE TEMPORARY TABLE {$table_name_temp} SELECT * FROM $table_name;" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
305
+ $wpdb->query( "CREATE TEMPORARY TABLE {$table_name_daily_temp} SELECT * FROM $table_name_daily;" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
306
+
307
+ // 2. Drop the tables.
308
+ $wpdb->query( "DROP TABLE $table_name" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
309
+ $wpdb->query( "DROP TABLE $table_name_daily" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
310
+
311
+ // 3. Run the activation function which will recreate the tables.
312
+ tptn_single_activate();
313
+
314
+ // 4. Reinsert the data from the temporary table.
315
+ $sql = "
316
+ INSERT INTO `$table_name` (postnumber, cntaccess, blog_id) (
317
+ SELECT
318
+ postnumber,
319
+ cntaccess,
320
+ blog_id
321
+ FROM `$table_name_temp`
322
+ );
323
+ ";
324
+
325
+ $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
326
+
327
+ $sql = "
328
+ INSERT INTO `$table_name_daily` (postnumber, cntaccess, dp_date, blog_id) (
329
+ SELECT
330
+ postnumber,
331
+ cntaccess,
332
+ dp_date,
333
+ blog_id
334
+ FROM `$table_name_daily_temp`
335
+ );
336
+ ";
337
+
338
+ $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
339
+
340
+ // 5. Drop the temporary tables.
341
+ $wpdb->query( "DROP TABLE $table_name_temp" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
342
+ $wpdb->query( "DROP TABLE $table_name_daily_temp" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
343
+
344
+ $wpdb->show_errors();
345
+ }
includes/modules/shortcode.php CHANGED
@@ -43,15 +43,19 @@ add_shortcode( 'tptn_list', 'tptn_shortcode' );
43
  * @param string $content Content.
44
  * @return string Views of the post
45
  */
46
- function tptn_shortcode_views( $atts, $content = null ) {
47
  $a = shortcode_atts(
48
  array(
49
  'daily' => '0',
 
50
  ),
51
  $atts
52
  );
53
 
54
- return get_tptn_post_count_only( get_the_ID(), ( $a['daily'] ? 'daily' : 'total' ) );
 
 
 
55
  }
56
  add_shortcode( 'tptn_views', 'tptn_shortcode_views' );
57
 
43
  * @param string $content Content.
44
  * @return string Views of the post
45
  */
46
+ function tptn_shortcode_views( $atts, $content = null ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
47
  $a = shortcode_atts(
48
  array(
49
  'daily' => '0',
50
+ 'count' => 'total',
51
  ),
52
  $atts
53
  );
54
 
55
+ // If daily is explicitly set to 1, then pass daily, else pass count.
56
+ $count = $a['daily'] ? 'daily' : $a['count'];
57
+
58
+ return get_tptn_post_count_only( get_the_ID(), $count );
59
  }
60
  add_shortcode( 'tptn_views', 'tptn_shortcode_views' );
61
 
languages/top-10-en_US.mo CHANGED
Binary file
languages/top-10-en_US.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2019-04-27 10:16+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
@@ -43,12 +43,12 @@ msgstr ""
43
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
44
  msgstr ""
45
 
46
- #: includes/admin/admin-dashboard.php:127 includes/admin/admin.php:44
47
  #: includes/admin/class-top-ten-statistics.php:128
48
  msgid "Popular Posts"
49
  msgstr ""
50
 
51
- #: includes/admin/admin-dashboard.php:132 includes/admin/admin.php:48
52
  msgid "Daily Popular Posts"
53
  msgstr ""
54
 
@@ -113,31 +113,39 @@ msgstr ""
113
  msgid "Top 10"
114
  msgstr ""
115
 
116
- #: includes/admin/admin.php:34 includes/admin/admin.php:366
117
  msgid "Settings"
118
  msgstr ""
119
 
120
- #: includes/admin/admin.php:37 includes/admin/tools.php:68
 
 
 
 
 
 
 
 
121
  msgid "Top 10 Tools"
122
  msgstr ""
123
 
124
- #: includes/admin/admin.php:37
125
  msgid "Tools"
126
  msgstr ""
127
 
128
- #: includes/admin/admin.php:44 includes/admin/class-top-ten-statistics.php:74
129
- msgid "Top 10 Popular Posts"
130
  msgstr ""
131
 
132
- #: includes/admin/admin.php:48
133
- msgid "Top 10 Daily Popular Posts"
134
  msgstr ""
135
 
136
- #: includes/admin/admin.php:202
137
  msgid "New information not saved. Do you wish to leave the page?"
138
  msgstr ""
139
 
140
- #: includes/admin/admin.php:320
141
  #, php-format
142
  msgid ""
143
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
@@ -145,15 +153,15 @@ msgid ""
145
  "\"_blank\">WordPress.org</a>"
146
  msgstr ""
147
 
148
- #: includes/admin/admin.php:388 includes/admin/sidebar.php:55
149
  msgid "Support"
150
  msgstr ""
151
 
152
- #: includes/admin/admin.php:389
153
  msgid "Donate"
154
  msgstr ""
155
 
156
- #: includes/admin/admin.php:390
157
  msgid "Contribute"
158
  msgstr ""
159
 
@@ -225,6 +233,7 @@ msgid "Author"
225
  msgstr ""
226
 
227
  #: includes/admin/class-top-ten-statistics-table.php:345
 
228
  msgid "Date"
229
  msgstr ""
230
 
@@ -914,6 +923,7 @@ msgid ""
914
  msgstr ""
915
 
916
  #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
 
917
  #, php-format
918
  msgid ""
919
  "For more information or how to get support visit the <a href=\"%1$s"
@@ -921,6 +931,7 @@ msgid ""
921
  msgstr ""
922
 
923
  #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
 
924
  #, php-format
925
  msgid ""
926
  "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
@@ -935,7 +946,7 @@ msgid ""
935
  msgstr ""
936
 
937
  #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
938
- #: includes/admin/settings-page.php:125
939
  msgid "General"
940
  msgstr ""
941
 
@@ -1037,6 +1048,138 @@ msgid ""
1037
  "fixes for older versions of Top 10."
1038
  msgstr ""
1039
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1040
  #: includes/admin/save-settings.php:51
1041
  msgid ""
1042
  "Settings have been reset to their default values. Reload this page to view "
@@ -1126,83 +1269,96 @@ msgid "Top 10 popular posts reset"
1126
  msgstr ""
1127
 
1128
  #: includes/admin/tools.php:42
1129
- msgid "Top 10 daily popular posts reset"
1130
  msgstr ""
1131
 
1132
  #: includes/admin/tools.php:48
 
 
 
 
1133
  msgid "Old settings key has been deleted"
1134
  msgstr ""
1135
 
1136
- #: includes/admin/tools.php:55
1137
  msgid "Duplicate rows cleaned from the tables"
1138
  msgstr ""
1139
 
1140
- #: includes/admin/tools.php:62
1141
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1142
  msgstr ""
1143
 
1144
- #: includes/admin/tools.php:78 includes/admin/tools.php:80
1145
  msgid "Clear cache"
1146
  msgstr ""
1147
 
1148
- #: includes/admin/tools.php:83
1149
  msgid ""
1150
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1151
  "save the settings page."
1152
  msgstr ""
1153
 
1154
- #: includes/admin/tools.php:86 includes/admin/tools.php:88
1155
  msgid "Recreate Primary Key"
1156
  msgstr ""
1157
 
1158
- #: includes/admin/tools.php:91
1159
  msgid ""
1160
  "Deletes and reinitializes the primary key in the database tables. If the "
1161
  "above function gives an error, then you can run the below code in phpMyAdmin "
1162
  "or Adminer. Remember to backup your database first!"
1163
  msgstr ""
1164
 
1165
- #: includes/admin/tools.php:97
1166
  msgid "Reset database"
1167
  msgstr ""
1168
 
1169
- #: includes/admin/tools.php:99
 
 
 
 
 
 
 
 
1170
  msgid "Reset Popular Posts Network-wide"
1171
  msgstr ""
1172
 
1173
- #: includes/admin/tools.php:99
1174
  msgid "Are you sure you want to reset the popular posts?"
1175
  msgstr ""
1176
 
1177
- #: includes/admin/tools.php:100
1178
  msgid "Reset Daily Popular Posts Network-wide"
1179
  msgstr ""
1180
 
1181
- #: includes/admin/tools.php:100
1182
  msgid "Are you sure you want to reset the daily popular posts?"
1183
  msgstr ""
1184
 
1185
- #: includes/admin/tools.php:103
1186
- msgid ""
1187
- "This will reset the Top 10 tables. If you are running Top 10 on multisite "
1188
- "then it will delete the popular posts across the entire network. This cannot "
1189
- "be reversed. Make sure that your database has been backed up before "
1190
- "proceeding"
1191
  msgstr ""
1192
 
1193
- #: includes/admin/tools.php:106
1194
- msgid "Other tools"
 
 
 
 
 
1195
  msgstr ""
1196
 
1197
- #: includes/admin/tools.php:108
1198
- msgid "Delete old settings"
1199
  msgstr ""
1200
 
1201
- #: includes/admin/tools.php:108
1202
- msgid "This will delete the settings before v2.5.x. Proceed?"
1203
  msgstr ""
1204
 
1205
- #: includes/admin/tools.php:111
1206
  msgid ""
1207
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1208
  "will delete the old settings for the current blog. It is recommended that "
@@ -1210,32 +1366,40 @@ msgid ""
1210
  "if you are comfortable with the new settings."
1211
  msgstr ""
1212
 
1213
- #: includes/admin/tools.php:115
1214
- msgid "Merge blog ID 0 and 1 post counts"
1215
  msgstr ""
1216
 
1217
- #: includes/admin/tools.php:115
1218
- msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1219
  msgstr ""
1220
 
1221
- #: includes/admin/tools.php:118
1222
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1223
  msgstr ""
1224
 
1225
- #: includes/admin/tools.php:122
1226
- msgid "Merge duplicates across blog IDs"
1227
  msgstr ""
1228
 
1229
- #: includes/admin/tools.php:122
1230
- msgid "This will delete the duplicate entries in the tables. Proceed?"
1231
  msgstr ""
1232
 
1233
- #: includes/admin/tools.php:125
1234
  msgid ""
1235
  "In older versions, the plugin created entries with duplicate post IDs. "
1236
  "Clicking the button below will merge these duplicate IDs"
1237
  msgstr ""
1238
 
 
 
 
 
 
 
 
 
1239
  #: includes/cron.php:87
1240
  msgid "Once Weekly"
1241
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2019-05-27 00:10+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
43
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
44
  msgstr ""
45
 
46
+ #: includes/admin/admin-dashboard.php:127 includes/admin/admin.php:40
47
  #: includes/admin/class-top-ten-statistics.php:128
48
  msgid "Popular Posts"
49
  msgstr ""
50
 
51
+ #: includes/admin/admin-dashboard.php:132 includes/admin/admin.php:44
52
  msgid "Daily Popular Posts"
53
  msgstr ""
54
 
113
  msgid "Top 10"
114
  msgstr ""
115
 
116
+ #: includes/admin/admin.php:34 includes/admin/admin.php:370
117
  msgid "Settings"
118
  msgstr ""
119
 
120
+ #: includes/admin/admin.php:40 includes/admin/class-top-ten-statistics.php:74
121
+ msgid "Top 10 Popular Posts"
122
+ msgstr ""
123
+
124
+ #: includes/admin/admin.php:44
125
+ msgid "Top 10 Daily Popular Posts"
126
+ msgstr ""
127
+
128
+ #: includes/admin/admin.php:49 includes/admin/tools.php:74
129
  msgid "Top 10 Tools"
130
  msgstr ""
131
 
132
+ #: includes/admin/admin.php:49
133
  msgid "Tools"
134
  msgstr ""
135
 
136
+ #: includes/admin/admin.php:53
137
+ msgid "Top 10 Import Export Tables"
138
  msgstr ""
139
 
140
+ #: includes/admin/admin.php:53
141
+ msgid "Import/Export"
142
  msgstr ""
143
 
144
+ #: includes/admin/admin.php:206
145
  msgid "New information not saved. Do you wish to leave the page?"
146
  msgstr ""
147
 
148
+ #: includes/admin/admin.php:324
149
  #, php-format
150
  msgid ""
151
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
153
  "\"_blank\">WordPress.org</a>"
154
  msgstr ""
155
 
156
+ #: includes/admin/admin.php:392 includes/admin/sidebar.php:55
157
  msgid "Support"
158
  msgstr ""
159
 
160
+ #: includes/admin/admin.php:393
161
  msgid "Donate"
162
  msgstr ""
163
 
164
+ #: includes/admin/admin.php:394
165
  msgid "Contribute"
166
  msgstr ""
167
 
233
  msgstr ""
234
 
235
  #: includes/admin/class-top-ten-statistics-table.php:345
236
+ #: includes/admin/import-export.php:183
237
  msgid "Date"
238
  msgstr ""
239
 
923
  msgstr ""
924
 
925
  #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
926
+ #: includes/admin/help-tab.php:166
927
  #, php-format
928
  msgid ""
929
  "For more information or how to get support visit the <a href=\"%1$s"
931
  msgstr ""
932
 
933
  #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
934
+ #: includes/admin/help-tab.php:168
935
  #, php-format
936
  msgid ""
937
  "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
946
  msgstr ""
947
 
948
  #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
949
+ #: includes/admin/help-tab.php:179 includes/admin/settings-page.php:125
950
  msgid "General"
951
  msgstr ""
952
 
1048
  "fixes for older versions of Top 10."
1049
  msgstr ""
1050
 
1051
+ #: includes/admin/help-tab.php:171
1052
+ #, php-format
1053
+ msgid "<a href=\"%1$s\">Top 10 Knowledge base</a>"
1054
+ msgstr ""
1055
+
1056
+ #: includes/admin/help-tab.php:181
1057
+ msgid "This screen allows you to import and export the database tables."
1058
+ msgstr ""
1059
+
1060
+ #: includes/admin/help-tab.php:182
1061
+ msgid "Refer to the knowledge base to learn how to use this in detail."
1062
+ msgstr ""
1063
+
1064
+ #: includes/admin/import-export.php:29
1065
+ msgid "Data has been imported into the table"
1066
+ msgstr ""
1067
+
1068
+ #: includes/admin/import-export.php:34
1069
+ msgid "Settings have been imported successfully"
1070
+ msgstr ""
1071
+
1072
+ #: includes/admin/import-export.php:40
1073
+ msgid "Top 10 - Import/Export tables"
1074
+ msgstr ""
1075
+
1076
+ #: includes/admin/import-export.php:50
1077
+ msgid "Export/Import settings"
1078
+ msgstr ""
1079
+
1080
+ #: includes/admin/import-export.php:52
1081
+ msgid ""
1082
+ "Export the plugin settings for this site as a .json file. This allows you to "
1083
+ "easily import the configuration into another site."
1084
+ msgstr ""
1085
+
1086
+ #: includes/admin/import-export.php:56
1087
+ msgid "Export Settings"
1088
+ msgstr ""
1089
+
1090
+ #: includes/admin/import-export.php:65
1091
+ msgid ""
1092
+ "Import the plugin settings from a .json file. This file can be obtained by "
1093
+ "exporting the settings on another site using the form above."
1094
+ msgstr ""
1095
+
1096
+ #: includes/admin/import-export.php:71
1097
+ msgid "Import Settings"
1098
+ msgstr ""
1099
+
1100
+ #: includes/admin/import-export.php:80
1101
+ msgid "Export tables"
1102
+ msgstr ""
1103
+
1104
+ #: includes/admin/import-export.php:82
1105
+ msgid ""
1106
+ "Click the buttons below to export the overall and the daily tables. The file "
1107
+ "is downloaded as an CSV file which you should be able to edit in Excel or "
1108
+ "any other compatible software."
1109
+ msgstr ""
1110
+
1111
+ #: includes/admin/import-export.php:83
1112
+ msgid ""
1113
+ "If you are using WordPress Multisite then this will include the counts "
1114
+ "across all sites as the plugin uses a single table to store counts."
1115
+ msgstr ""
1116
+
1117
+ #: includes/admin/import-export.php:87
1118
+ msgid "Export overall tables"
1119
+ msgstr ""
1120
+
1121
+ #: includes/admin/import-export.php:88
1122
+ msgid "Export daily tables"
1123
+ msgstr ""
1124
+
1125
+ #: includes/admin/import-export.php:96
1126
+ msgid "Import tables"
1127
+ msgstr ""
1128
+
1129
+ #: includes/admin/import-export.php:98
1130
+ msgid ""
1131
+ "This action will replace the data in your tables, so I suggest that you "
1132
+ "export the existing data using the buttons above, amend it and then import "
1133
+ "it. It is important to maintain the export format of the data to avoid "
1134
+ "corruption."
1135
+ msgstr ""
1136
+
1137
+ #: includes/admin/import-export.php:101
1138
+ msgid ""
1139
+ "Backup your database before proceeding so you will be able to restore it in "
1140
+ "case anything goes wrong."
1141
+ msgstr ""
1142
+
1143
+ #: includes/admin/import-export.php:103
1144
+ msgid "Import Overall Table"
1145
+ msgstr ""
1146
+
1147
+ #: includes/admin/import-export.php:108
1148
+ msgid "Import Overall CSV"
1149
+ msgstr ""
1150
+
1151
+ #: includes/admin/import-export.php:111
1152
+ msgid "Import Daily Table"
1153
+ msgstr ""
1154
+
1155
+ #: includes/admin/import-export.php:116
1156
+ msgid "Import Daily CSV"
1157
+ msgstr ""
1158
+
1159
+ #: includes/admin/import-export.php:179
1160
+ msgid "Post ID"
1161
+ msgstr ""
1162
+
1163
+ #: includes/admin/import-export.php:180
1164
+ msgid "Visits"
1165
+ msgstr ""
1166
+
1167
+ #: includes/admin/import-export.php:185
1168
+ msgid "Blog ID"
1169
+ msgstr ""
1170
+
1171
+ #: includes/admin/import-export.php:264
1172
+ msgid "Please upload a valid .csv file"
1173
+ msgstr ""
1174
+
1175
+ #: includes/admin/import-export.php:270 includes/admin/import-export.php:373
1176
+ msgid "Please upload a file to import"
1177
+ msgstr ""
1178
+
1179
+ #: includes/admin/import-export.php:367
1180
+ msgid "Please upload a valid .json file"
1181
+ msgstr ""
1182
+
1183
  #: includes/admin/save-settings.php:51
1184
  msgid ""
1185
  "Settings have been reset to their default values. Reload this page to view "
1269
  msgstr ""
1270
 
1271
  #: includes/admin/tools.php:42
1272
+ msgid "Top 10 tables have been recreated"
1273
  msgstr ""
1274
 
1275
  #: includes/admin/tools.php:48
1276
+ msgid "Top 10 daily popular posts reset"
1277
+ msgstr ""
1278
+
1279
+ #: includes/admin/tools.php:54
1280
  msgid "Old settings key has been deleted"
1281
  msgstr ""
1282
 
1283
+ #: includes/admin/tools.php:61
1284
  msgid "Duplicate rows cleaned from the tables"
1285
  msgstr ""
1286
 
1287
+ #: includes/admin/tools.php:68
1288
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1289
  msgstr ""
1290
 
1291
+ #: includes/admin/tools.php:84 includes/admin/tools.php:86
1292
  msgid "Clear cache"
1293
  msgstr ""
1294
 
1295
+ #: includes/admin/tools.php:89
1296
  msgid ""
1297
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1298
  "save the settings page."
1299
  msgstr ""
1300
 
1301
+ #: includes/admin/tools.php:92 includes/admin/tools.php:94
1302
  msgid "Recreate Primary Key"
1303
  msgstr ""
1304
 
1305
+ #: includes/admin/tools.php:97
1306
  msgid ""
1307
  "Deletes and reinitializes the primary key in the database tables. If the "
1308
  "above function gives an error, then you can run the below code in phpMyAdmin "
1309
  "or Adminer. Remember to backup your database first!"
1310
  msgstr ""
1311
 
1312
+ #: includes/admin/tools.php:103
1313
  msgid "Reset database"
1314
  msgstr ""
1315
 
1316
+ #: includes/admin/tools.php:105
1317
+ msgid ""
1318
+ "This will reset the Top 10 tables. If you are running Top 10 on multisite "
1319
+ "then it will delete the popular posts across the entire network. This cannot "
1320
+ "be reversed. Make sure that your database has been backed up before "
1321
+ "proceeding"
1322
+ msgstr ""
1323
+
1324
+ #: includes/admin/tools.php:108
1325
  msgid "Reset Popular Posts Network-wide"
1326
  msgstr ""
1327
 
1328
+ #: includes/admin/tools.php:108
1329
  msgid "Are you sure you want to reset the popular posts?"
1330
  msgstr ""
1331
 
1332
+ #: includes/admin/tools.php:109
1333
  msgid "Reset Daily Popular Posts Network-wide"
1334
  msgstr ""
1335
 
1336
+ #: includes/admin/tools.php:109
1337
  msgid "Are you sure you want to reset the daily popular posts?"
1338
  msgstr ""
1339
 
1340
+ #: includes/admin/tools.php:112 includes/admin/tools.php:117
1341
+ msgid "Recreate Database Tables"
 
 
 
 
1342
  msgstr ""
1343
 
1344
+ #: includes/admin/tools.php:114
1345
+ msgid ""
1346
+ "Only click the button below after performing a full backup of the database. "
1347
+ "You can use any of the popular backup plugins or phpMyAdmin to achieve this. "
1348
+ "The authors of this plugin do not guarantee that everything will go smoothly "
1349
+ "as it depends on your site environment and volume of data. If you are not "
1350
+ "comfortable, please do not proceed."
1351
  msgstr ""
1352
 
1353
+ #: includes/admin/tools.php:117
1354
+ msgid "Hit Cancel if you have not backed up your database"
1355
  msgstr ""
1356
 
1357
+ #: includes/admin/tools.php:120
1358
+ msgid "Other tools"
1359
  msgstr ""
1360
 
1361
+ #: includes/admin/tools.php:122
1362
  msgid ""
1363
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1364
  "will delete the old settings for the current blog. It is recommended that "
1366
  "if you are comfortable with the new settings."
1367
  msgstr ""
1368
 
1369
+ #: includes/admin/tools.php:125
1370
+ msgid "Delete old settings"
1371
  msgstr ""
1372
 
1373
+ #: includes/admin/tools.php:125
1374
+ msgid "This will delete the settings before v2.5.x. Proceed?"
1375
  msgstr ""
1376
 
1377
+ #: includes/admin/tools.php:129
1378
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1379
  msgstr ""
1380
 
1381
+ #: includes/admin/tools.php:132
1382
+ msgid "Merge blog ID 0 and 1 post counts"
1383
  msgstr ""
1384
 
1385
+ #: includes/admin/tools.php:132
1386
+ msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1387
  msgstr ""
1388
 
1389
+ #: includes/admin/tools.php:136
1390
  msgid ""
1391
  "In older versions, the plugin created entries with duplicate post IDs. "
1392
  "Clicking the button below will merge these duplicate IDs"
1393
  msgstr ""
1394
 
1395
+ #: includes/admin/tools.php:139
1396
+ msgid "Merge duplicates across blog IDs"
1397
+ msgstr ""
1398
+
1399
+ #: includes/admin/tools.php:139
1400
+ msgid "This will delete the duplicate entries in the tables. Proceed?"
1401
+ msgstr ""
1402
+
1403
  #: includes/cron.php:87
1404
  msgid "Once Weekly"
1405
  msgstr ""
languages/top-10-en_US.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2019-04-27 10:16+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
@@ -44,12 +44,12 @@ msgstr ""
44
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
45
  msgstr ""
46
 
47
- #: includes/admin/admin-dashboard.php:127 includes/admin/admin.php:44
48
  #: includes/admin/class-top-ten-statistics.php:128
49
  msgid "Popular Posts"
50
  msgstr ""
51
 
52
- #: includes/admin/admin-dashboard.php:132 includes/admin/admin.php:48
53
  msgid "Daily Popular Posts"
54
  msgstr ""
55
 
@@ -114,31 +114,39 @@ msgstr ""
114
  msgid "Top 10"
115
  msgstr ""
116
 
117
- #: includes/admin/admin.php:34 includes/admin/admin.php:366
118
  msgid "Settings"
119
  msgstr ""
120
 
121
- #: includes/admin/admin.php:37 includes/admin/tools.php:68
 
 
 
 
 
 
 
 
122
  msgid "Top 10 Tools"
123
  msgstr ""
124
 
125
- #: includes/admin/admin.php:37
126
  msgid "Tools"
127
  msgstr ""
128
 
129
- #: includes/admin/admin.php:44 includes/admin/class-top-ten-statistics.php:74
130
- msgid "Top 10 Popular Posts"
131
  msgstr ""
132
 
133
- #: includes/admin/admin.php:48
134
- msgid "Top 10 Daily Popular Posts"
135
  msgstr ""
136
 
137
- #: includes/admin/admin.php:202
138
  msgid "New information not saved. Do you wish to leave the page?"
139
  msgstr ""
140
 
141
- #: includes/admin/admin.php:320
142
  #, php-format
143
  msgid ""
144
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
@@ -146,15 +154,15 @@ msgid ""
146
  "\"_blank\">WordPress.org</a>"
147
  msgstr ""
148
 
149
- #: includes/admin/admin.php:388 includes/admin/sidebar.php:55
150
  msgid "Support"
151
  msgstr ""
152
 
153
- #: includes/admin/admin.php:389
154
  msgid "Donate"
155
  msgstr ""
156
 
157
- #: includes/admin/admin.php:390
158
  msgid "Contribute"
159
  msgstr ""
160
 
@@ -226,6 +234,7 @@ msgid "Author"
226
  msgstr ""
227
 
228
  #: includes/admin/class-top-ten-statistics-table.php:345
 
229
  msgid "Date"
230
  msgstr ""
231
 
@@ -915,6 +924,7 @@ msgid ""
915
  msgstr ""
916
 
917
  #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
 
918
  #, php-format
919
  msgid ""
920
  "For more information or how to get support visit the <a href=\"%1$s"
@@ -922,6 +932,7 @@ msgid ""
922
  msgstr ""
923
 
924
  #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
 
925
  #, php-format
926
  msgid ""
927
  "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
@@ -936,7 +947,7 @@ msgid ""
936
  msgstr ""
937
 
938
  #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
939
- #: includes/admin/settings-page.php:125
940
  msgid "General"
941
  msgstr ""
942
 
@@ -1038,6 +1049,138 @@ msgid ""
1038
  "fixes for older versions of Top 10."
1039
  msgstr ""
1040
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1041
  #: includes/admin/save-settings.php:51
1042
  msgid ""
1043
  "Settings have been reset to their default values. Reload this page to view "
@@ -1127,83 +1270,96 @@ msgid "Top 10 popular posts reset"
1127
  msgstr ""
1128
 
1129
  #: includes/admin/tools.php:42
1130
- msgid "Top 10 daily popular posts reset"
1131
  msgstr ""
1132
 
1133
  #: includes/admin/tools.php:48
 
 
 
 
1134
  msgid "Old settings key has been deleted"
1135
  msgstr ""
1136
 
1137
- #: includes/admin/tools.php:55
1138
  msgid "Duplicate rows cleaned from the tables"
1139
  msgstr ""
1140
 
1141
- #: includes/admin/tools.php:62
1142
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1143
  msgstr ""
1144
 
1145
- #: includes/admin/tools.php:78 includes/admin/tools.php:80
1146
  msgid "Clear cache"
1147
  msgstr ""
1148
 
1149
- #: includes/admin/tools.php:83
1150
  msgid ""
1151
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1152
  "save the settings page."
1153
  msgstr ""
1154
 
1155
- #: includes/admin/tools.php:86 includes/admin/tools.php:88
1156
  msgid "Recreate Primary Key"
1157
  msgstr ""
1158
 
1159
- #: includes/admin/tools.php:91
1160
  msgid ""
1161
  "Deletes and reinitializes the primary key in the database tables. If the "
1162
  "above function gives an error, then you can run the below code in phpMyAdmin "
1163
  "or Adminer. Remember to backup your database first!"
1164
  msgstr ""
1165
 
1166
- #: includes/admin/tools.php:97
1167
  msgid "Reset database"
1168
  msgstr ""
1169
 
1170
- #: includes/admin/tools.php:99
 
 
 
 
 
 
 
 
1171
  msgid "Reset Popular Posts Network-wide"
1172
  msgstr ""
1173
 
1174
- #: includes/admin/tools.php:99
1175
  msgid "Are you sure you want to reset the popular posts?"
1176
  msgstr ""
1177
 
1178
- #: includes/admin/tools.php:100
1179
  msgid "Reset Daily Popular Posts Network-wide"
1180
  msgstr ""
1181
 
1182
- #: includes/admin/tools.php:100
1183
  msgid "Are you sure you want to reset the daily popular posts?"
1184
  msgstr ""
1185
 
1186
- #: includes/admin/tools.php:103
1187
- msgid ""
1188
- "This will reset the Top 10 tables. If you are running Top 10 on multisite "
1189
- "then it will delete the popular posts across the entire network. This cannot "
1190
- "be reversed. Make sure that your database has been backed up before "
1191
- "proceeding"
1192
  msgstr ""
1193
 
1194
- #: includes/admin/tools.php:106
1195
- msgid "Other tools"
 
 
 
 
 
1196
  msgstr ""
1197
 
1198
- #: includes/admin/tools.php:108
1199
- msgid "Delete old settings"
1200
  msgstr ""
1201
 
1202
- #: includes/admin/tools.php:108
1203
- msgid "This will delete the settings before v2.5.x. Proceed?"
1204
  msgstr ""
1205
 
1206
- #: includes/admin/tools.php:111
1207
  msgid ""
1208
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1209
  "will delete the old settings for the current blog. It is recommended that "
@@ -1211,32 +1367,40 @@ msgid ""
1211
  "if you are comfortable with the new settings."
1212
  msgstr ""
1213
 
1214
- #: includes/admin/tools.php:115
1215
- msgid "Merge blog ID 0 and 1 post counts"
1216
  msgstr ""
1217
 
1218
- #: includes/admin/tools.php:115
1219
- msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1220
  msgstr ""
1221
 
1222
- #: includes/admin/tools.php:118
1223
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1224
  msgstr ""
1225
 
1226
- #: includes/admin/tools.php:122
1227
- msgid "Merge duplicates across blog IDs"
1228
  msgstr ""
1229
 
1230
- #: includes/admin/tools.php:122
1231
- msgid "This will delete the duplicate entries in the tables. Proceed?"
1232
  msgstr ""
1233
 
1234
- #: includes/admin/tools.php:125
1235
  msgid ""
1236
  "In older versions, the plugin created entries with duplicate post IDs. "
1237
  "Clicking the button below will merge these duplicate IDs"
1238
  msgstr ""
1239
 
 
 
 
 
 
 
 
 
1240
  #: includes/cron.php:87
1241
  msgid "Once Weekly"
1242
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2019-05-27 00:10+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
44
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
45
  msgstr ""
46
 
47
+ #: includes/admin/admin-dashboard.php:127 includes/admin/admin.php:40
48
  #: includes/admin/class-top-ten-statistics.php:128
49
  msgid "Popular Posts"
50
  msgstr ""
51
 
52
+ #: includes/admin/admin-dashboard.php:132 includes/admin/admin.php:44
53
  msgid "Daily Popular Posts"
54
  msgstr ""
55
 
114
  msgid "Top 10"
115
  msgstr ""
116
 
117
+ #: includes/admin/admin.php:34 includes/admin/admin.php:370
118
  msgid "Settings"
119
  msgstr ""
120
 
121
+ #: includes/admin/admin.php:40 includes/admin/class-top-ten-statistics.php:74
122
+ msgid "Top 10 Popular Posts"
123
+ msgstr ""
124
+
125
+ #: includes/admin/admin.php:44
126
+ msgid "Top 10 Daily Popular Posts"
127
+ msgstr ""
128
+
129
+ #: includes/admin/admin.php:49 includes/admin/tools.php:74
130
  msgid "Top 10 Tools"
131
  msgstr ""
132
 
133
+ #: includes/admin/admin.php:49
134
  msgid "Tools"
135
  msgstr ""
136
 
137
+ #: includes/admin/admin.php:53
138
+ msgid "Top 10 Import Export Tables"
139
  msgstr ""
140
 
141
+ #: includes/admin/admin.php:53
142
+ msgid "Import/Export"
143
  msgstr ""
144
 
145
+ #: includes/admin/admin.php:206
146
  msgid "New information not saved. Do you wish to leave the page?"
147
  msgstr ""
148
 
149
+ #: includes/admin/admin.php:324
150
  #, php-format
151
  msgid ""
152
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
154
  "\"_blank\">WordPress.org</a>"
155
  msgstr ""
156
 
157
+ #: includes/admin/admin.php:392 includes/admin/sidebar.php:55
158
  msgid "Support"
159
  msgstr ""
160
 
161
+ #: includes/admin/admin.php:393
162
  msgid "Donate"
163
  msgstr ""
164
 
165
+ #: includes/admin/admin.php:394
166
  msgid "Contribute"
167
  msgstr ""
168
 
234
  msgstr ""
235
 
236
  #: includes/admin/class-top-ten-statistics-table.php:345
237
+ #: includes/admin/import-export.php:183
238
  msgid "Date"
239
  msgstr ""
240
 
924
  msgstr ""
925
 
926
  #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
927
+ #: includes/admin/help-tab.php:166
928
  #, php-format
929
  msgid ""
930
  "For more information or how to get support visit the <a href=\"%1$s"
932
  msgstr ""
933
 
934
  #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
935
+ #: includes/admin/help-tab.php:168
936
  #, php-format
937
  msgid ""
938
  "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
947
  msgstr ""
948
 
949
  #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
950
+ #: includes/admin/help-tab.php:179 includes/admin/settings-page.php:125
951
  msgid "General"
952
  msgstr ""
953
 
1049
  "fixes for older versions of Top 10."
1050
  msgstr ""
1051
 
1052
+ #: includes/admin/help-tab.php:171
1053
+ #, php-format
1054
+ msgid "<a href=\"%1$s\">Top 10 Knowledge base</a>"
1055
+ msgstr ""
1056
+
1057
+ #: includes/admin/help-tab.php:181
1058
+ msgid "This screen allows you to import and export the database tables."
1059
+ msgstr ""
1060
+
1061
+ #: includes/admin/help-tab.php:182
1062
+ msgid "Refer to the knowledge base to learn how to use this in detail."
1063
+ msgstr ""
1064
+
1065
+ #: includes/admin/import-export.php:29
1066
+ msgid "Data has been imported into the table"
1067
+ msgstr ""
1068
+
1069
+ #: includes/admin/import-export.php:34
1070
+ msgid "Settings have been imported successfully"
1071
+ msgstr ""
1072
+
1073
+ #: includes/admin/import-export.php:40
1074
+ msgid "Top 10 - Import/Export tables"
1075
+ msgstr ""
1076
+
1077
+ #: includes/admin/import-export.php:50
1078
+ msgid "Export/Import settings"
1079
+ msgstr ""
1080
+
1081
+ #: includes/admin/import-export.php:52
1082
+ msgid ""
1083
+ "Export the plugin settings for this site as a .json file. This allows you to "
1084
+ "easily import the configuration into another site."
1085
+ msgstr ""
1086
+
1087
+ #: includes/admin/import-export.php:56
1088
+ msgid "Export Settings"
1089
+ msgstr ""
1090
+
1091
+ #: includes/admin/import-export.php:65
1092
+ msgid ""
1093
+ "Import the plugin settings from a .json file. This file can be obtained by "
1094
+ "exporting the settings on another site using the form above."
1095
+ msgstr ""
1096
+
1097
+ #: includes/admin/import-export.php:71
1098
+ msgid "Import Settings"
1099
+ msgstr ""
1100
+
1101
+ #: includes/admin/import-export.php:80
1102
+ msgid "Export tables"
1103
+ msgstr ""
1104
+
1105
+ #: includes/admin/import-export.php:82
1106
+ msgid ""
1107
+ "Click the buttons below to export the overall and the daily tables. The file "
1108
+ "is downloaded as an CSV file which you should be able to edit in Excel or "
1109
+ "any other compatible software."
1110
+ msgstr ""
1111
+
1112
+ #: includes/admin/import-export.php:83
1113
+ msgid ""
1114
+ "If you are using WordPress Multisite then this will include the counts "
1115
+ "across all sites as the plugin uses a single table to store counts."
1116
+ msgstr ""
1117
+
1118
+ #: includes/admin/import-export.php:87
1119
+ msgid "Export overall tables"
1120
+ msgstr ""
1121
+
1122
+ #: includes/admin/import-export.php:88
1123
+ msgid "Export daily tables"
1124
+ msgstr ""
1125
+
1126
+ #: includes/admin/import-export.php:96
1127
+ msgid "Import tables"
1128
+ msgstr ""
1129
+
1130
+ #: includes/admin/import-export.php:98
1131
+ msgid ""
1132
+ "This action will replace the data in your tables, so I suggest that you "
1133
+ "export the existing data using the buttons above, amend it and then import "
1134
+ "it. It is important to maintain the export format of the data to avoid "
1135
+ "corruption."
1136
+ msgstr ""
1137
+
1138
+ #: includes/admin/import-export.php:101
1139
+ msgid ""
1140
+ "Backup your database before proceeding so you will be able to restore it in "
1141
+ "case anything goes wrong."
1142
+ msgstr ""
1143
+
1144
+ #: includes/admin/import-export.php:103
1145
+ msgid "Import Overall Table"
1146
+ msgstr ""
1147
+
1148
+ #: includes/admin/import-export.php:108
1149
+ msgid "Import Overall CSV"
1150
+ msgstr ""
1151
+
1152
+ #: includes/admin/import-export.php:111
1153
+ msgid "Import Daily Table"
1154
+ msgstr ""
1155
+
1156
+ #: includes/admin/import-export.php:116
1157
+ msgid "Import Daily CSV"
1158
+ msgstr ""
1159
+
1160
+ #: includes/admin/import-export.php:179
1161
+ msgid "Post ID"
1162
+ msgstr ""
1163
+
1164
+ #: includes/admin/import-export.php:180
1165
+ msgid "Visits"
1166
+ msgstr ""
1167
+
1168
+ #: includes/admin/import-export.php:185
1169
+ msgid "Blog ID"
1170
+ msgstr ""
1171
+
1172
+ #: includes/admin/import-export.php:264
1173
+ msgid "Please upload a valid .csv file"
1174
+ msgstr ""
1175
+
1176
+ #: includes/admin/import-export.php:270 includes/admin/import-export.php:373
1177
+ msgid "Please upload a file to import"
1178
+ msgstr ""
1179
+
1180
+ #: includes/admin/import-export.php:367
1181
+ msgid "Please upload a valid .json file"
1182
+ msgstr ""
1183
+
1184
  #: includes/admin/save-settings.php:51
1185
  msgid ""
1186
  "Settings have been reset to their default values. Reload this page to view "
1270
  msgstr ""
1271
 
1272
  #: includes/admin/tools.php:42
1273
+ msgid "Top 10 tables have been recreated"
1274
  msgstr ""
1275
 
1276
  #: includes/admin/tools.php:48
1277
+ msgid "Top 10 daily popular posts reset"
1278
+ msgstr ""
1279
+
1280
+ #: includes/admin/tools.php:54
1281
  msgid "Old settings key has been deleted"
1282
  msgstr ""
1283
 
1284
+ #: includes/admin/tools.php:61
1285
  msgid "Duplicate rows cleaned from the tables"
1286
  msgstr ""
1287
 
1288
+ #: includes/admin/tools.php:68
1289
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1290
  msgstr ""
1291
 
1292
+ #: includes/admin/tools.php:84 includes/admin/tools.php:86
1293
  msgid "Clear cache"
1294
  msgstr ""
1295
 
1296
+ #: includes/admin/tools.php:89
1297
  msgid ""
1298
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1299
  "save the settings page."
1300
  msgstr ""
1301
 
1302
+ #: includes/admin/tools.php:92 includes/admin/tools.php:94
1303
  msgid "Recreate Primary Key"
1304
  msgstr ""
1305
 
1306
+ #: includes/admin/tools.php:97
1307
  msgid ""
1308
  "Deletes and reinitializes the primary key in the database tables. If the "
1309
  "above function gives an error, then you can run the below code in phpMyAdmin "
1310
  "or Adminer. Remember to backup your database first!"
1311
  msgstr ""
1312
 
1313
+ #: includes/admin/tools.php:103
1314
  msgid "Reset database"
1315
  msgstr ""
1316
 
1317
+ #: includes/admin/tools.php:105
1318
+ msgid ""
1319
+ "This will reset the Top 10 tables. If you are running Top 10 on multisite "
1320
+ "then it will delete the popular posts across the entire network. This cannot "
1321
+ "be reversed. Make sure that your database has been backed up before "
1322
+ "proceeding"
1323
+ msgstr ""
1324
+
1325
+ #: includes/admin/tools.php:108
1326
  msgid "Reset Popular Posts Network-wide"
1327
  msgstr ""
1328
 
1329
+ #: includes/admin/tools.php:108
1330
  msgid "Are you sure you want to reset the popular posts?"
1331
  msgstr ""
1332
 
1333
+ #: includes/admin/tools.php:109
1334
  msgid "Reset Daily Popular Posts Network-wide"
1335
  msgstr ""
1336
 
1337
+ #: includes/admin/tools.php:109
1338
  msgid "Are you sure you want to reset the daily popular posts?"
1339
  msgstr ""
1340
 
1341
+ #: includes/admin/tools.php:112 includes/admin/tools.php:117
1342
+ msgid "Recreate Database Tables"
 
 
 
 
1343
  msgstr ""
1344
 
1345
+ #: includes/admin/tools.php:114
1346
+ msgid ""
1347
+ "Only click the button below after performing a full backup of the database. "
1348
+ "You can use any of the popular backup plugins or phpMyAdmin to achieve this. "
1349
+ "The authors of this plugin do not guarantee that everything will go smoothly "
1350
+ "as it depends on your site environment and volume of data. If you are not "
1351
+ "comfortable, please do not proceed."
1352
  msgstr ""
1353
 
1354
+ #: includes/admin/tools.php:117
1355
+ msgid "Hit Cancel if you have not backed up your database"
1356
  msgstr ""
1357
 
1358
+ #: includes/admin/tools.php:120
1359
+ msgid "Other tools"
1360
  msgstr ""
1361
 
1362
+ #: includes/admin/tools.php:122
1363
  msgid ""
1364
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1365
  "will delete the old settings for the current blog. It is recommended that "
1367
  "if you are comfortable with the new settings."
1368
  msgstr ""
1369
 
1370
+ #: includes/admin/tools.php:125
1371
+ msgid "Delete old settings"
1372
  msgstr ""
1373
 
1374
+ #: includes/admin/tools.php:125
1375
+ msgid "This will delete the settings before v2.5.x. Proceed?"
1376
  msgstr ""
1377
 
1378
+ #: includes/admin/tools.php:129
1379
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1380
  msgstr ""
1381
 
1382
+ #: includes/admin/tools.php:132
1383
+ msgid "Merge blog ID 0 and 1 post counts"
1384
  msgstr ""
1385
 
1386
+ #: includes/admin/tools.php:132
1387
+ msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1388
  msgstr ""
1389
 
1390
+ #: includes/admin/tools.php:136
1391
  msgid ""
1392
  "In older versions, the plugin created entries with duplicate post IDs. "
1393
  "Clicking the button below will merge these duplicate IDs"
1394
  msgstr ""
1395
 
1396
+ #: includes/admin/tools.php:139
1397
+ msgid "Merge duplicates across blog IDs"
1398
+ msgstr ""
1399
+
1400
+ #: includes/admin/tools.php:139
1401
+ msgid "This will delete the duplicate entries in the tables. Proceed?"
1402
+ msgstr ""
1403
+
1404
  #: includes/cron.php:87
1405
  msgid "Once Weekly"
1406
  msgstr ""
readme.txt CHANGED
@@ -32,6 +32,7 @@ Top 10 also has powerful API and is fully extendable with WordPress actions and
32
  * **Exclusions**: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
33
  * **Styles**: The output is wrapped in CSS classes which allows you to easily style the list. You can enter your custom CSS styles from within WordPress Admin area or use the style included.
34
  * **Admin interface**: View list of daily and/or overall popular posts from within the dashboard. Top 10 also adds two sortable columns to your All Posts and All Pages pages in your WordPress Admin area
 
35
  * **Works with caching plugins** like WP-Super-Cache, W3 Total Cache or Quick Cache
36
  * **Extendable code**: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
37
 
@@ -64,8 +65,9 @@ So, if you've got some cool feature that you'd like to implement into the plugin
64
  6. Top 10 options - Maintenance
65
  7. Top 10 widget options
66
  8. Top 10 Meta box on the Edit Post screen
67
- 9. Reset count and tools
68
  10. Top 10 - Popular posts view in Admin
 
69
 
70
  == Installation ==
71
 
@@ -156,6 +158,17 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
156
 
157
  == Changelog ==
158
 
 
 
 
 
 
 
 
 
 
 
 
159
  = 2.6.3 =
160
 
161
  Release post: [https://wzn.io/2L7w8mi](https://wzn.io/2L7w8mi)
@@ -274,7 +287,7 @@ For previous changelog entries, please refer to the separate changelog.txt file
274
 
275
  == Upgrade Notice ==
276
 
277
- = 2.6.3 =
278
- * Bug fix release! Please verify your settings after upgrade.
279
  Check the Changelog for more details
280
 
32
  * **Exclusions**: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
33
  * **Styles**: The output is wrapped in CSS classes which allows you to easily style the list. You can enter your custom CSS styles from within WordPress Admin area or use the style included.
34
  * **Admin interface**: View list of daily and/or overall popular posts from within the dashboard. Top 10 also adds two sortable columns to your All Posts and All Pages pages in your WordPress Admin area
35
+ * **Export/Import interface**: Export the count tables and settings to restore in the same site or on other installs
36
  * **Works with caching plugins** like WP-Super-Cache, W3 Total Cache or Quick Cache
37
  * **Extendable code**: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
38
 
65
  6. Top 10 options - Maintenance
66
  7. Top 10 widget options
67
  8. Top 10 Meta box on the Edit Post screen
68
+ 9. Top 10 Tools page
69
  10. Top 10 - Popular posts view in Admin
70
+ 11. Top 10 Export/Import interface
71
 
72
  == Installation ==
73
 
158
 
159
  == Changelog ==
160
 
161
+ = 2.7.0 =
162
+
163
+ Release post: [https://wzn.io/2HWbtwr](https://wzn.io/2HWbtwr)
164
+
165
+ * Features:
166
+ * Recreate the Top 10 database tables. You can find the button in the Tools page. Backup your database first
167
+ * New export/import interface to export and import the Top 10 tables and settings
168
+
169
+ * Enhancements:
170
+ * `tptn_views` shortcode adds a new parameter 'count' to explicitly set the count type. Choose from daily, total or overall. This is overridden if daily is set to 0 (backwards compatibility)
171
+
172
  = 2.6.3 =
173
 
174
  Release post: [https://wzn.io/2L7w8mi](https://wzn.io/2L7w8mi)
287
 
288
  == Upgrade Notice ==
289
 
290
+ = 2.7.0 =
291
+ * New admin interface to import and export settings and the counts table.
292
  Check the Changelog for more details
293
 
top-10.php CHANGED
@@ -14,7 +14,7 @@
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
- * Version: 2.6.3
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
@@ -149,6 +149,7 @@ if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
149
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/save-settings.php';
150
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/help-tab.php';
151
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/tools.php';
 
152
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/admin-metabox.php';
153
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/admin-columns.php';
154
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/admin-dashboard.php';
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
+ * Version: 2.7.0
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
149
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/save-settings.php';
150
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/help-tab.php';
151
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/tools.php';
152
+ require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/import-export.php';
153
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/admin-metabox.php';
154
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/admin-columns.php';
155
  require_once TOP_TEN_PLUGIN_DIR . 'includes/admin/admin-dashboard.php';