Top 10 – Popular posts plugin for WordPress - Version 2.4.0

Version Description

  • Features:

    • New tracker using a properly enqueued .js file. Two inbuilt options to use query variables or ajaxurl to process the counts
    • Shortcode and the widget now have an added parameter for 'offset'. This is useful if you would like to display different widgets/shortcodes but not always start from the first post
  • Bug fixes:

    • Attachments now work with the widget and elsewhere
    • New tracker now works when jQuery is loaded in the footer
    • Don't add tracker code when previewing in customizer
    • Doesn't report an error if no author is assigned to a post
  • Deprecated:

    • tptn_add_tracker and tptn_add_viewed_count have been deprecated. These should no longer be needed with the new tracker option.
    • wick script in Settings page which was used for fetching category slugs. You should now use the category name (prompted automatically). Slugs will be automatically converted into names.
Download this release

Release Info

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

Code changes from version 2.3.2 to 2.4.0

README.md CHANGED
@@ -1,90 +1,89 @@
1
- [![Build Status](https://travis-ci.org/WebberZone/top-10.svg?branch=master)](https://travis-ci.org/WebberZone/top-10)
2
-
3
- # Top 10 - Popular posts plugin for WordPress
4
-
5
- __Requires:__ 3.9
6
-
7
- __Tested up to:__ 4.5
8
-
9
- __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
10
-
11
- __Plugin page:__ [Top 10](https://webberzone.com/plugins/top-10/) | [WordPress.org plugin page](https://wordpress.org/plugins/top-10/)
12
-
13
- Track daily and total visits on your blog posts. Display the count as well as popular and trending posts.
14
-
15
- ## Description
16
-
17
- WordPress doesn't have an in-built support tracking page views or displaying popular posts. [Top 10](https://webberzone.com/plugins/top-10/) is an easy to use, yet, powerful WordPress plugin that will count the number of page views of your posts, pages and any custom post types. You can then display the page view counts as well as display your most popular posts.
18
-
19
- Top 10 will add a widget that you can use to display the popular posts list.
20
-
21
- Although several similar plugins exist today, Top 10 is one of the most feature rich popular post plugins with support for thumbnails, shortcodes, widgets, custom post types and CSS styles. The inbuilt caching system also helps reduce server load by caching your popular posts output. The tracking uses ajax and is thus compatible with most popular caching plugins.
22
-
23
- Top 10 also has powerful API and is fully extendable with WordPress actions and filters to allow you easily extend the code base to add new features or tweak existing ones.
24
-
25
- ### Features
26
-
27
- * **Page counter**: Counts page views on single posts, pages and *custom post types* on an hourly basis which can then be easily displayed automatically, using shortcodes or functions.
28
- * **Popular posts**: Display a list of popular posts either for total counts or for a custom period. You can choose how many posts are to be displayed along with loads of other customisation options
29
- * **Widget ready**: Sidebar widgets available for daily popular and overall popular posts. Highly customizable widgets to control what you want to display in the list of posts
30
- * **Shortcodes**: The plugin includes two shortcodes `[tptn_list]` and `[tptn_views]` to display the posts list and the number of views respectively
31
- * **Thumbnail support**
32
- * Support for WordPress post thumbnails. Top 10 will create a custom image size (`tptn_thumbnail`) with the dimensions specified in the Settings page
33
- * Auto-extract the first image in your post to be displayed as a thumbnail
34
- * Manually enter the URL of the thumbnail via [WordPress meta fields](http://codex.wordpress.org/Custom_Fields). Specify this using the meta box in your Edit screens.
35
- * **Exclusions**: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
36
- * **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.
37
- * **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
38
- * **Works with caching plugins** like WP-Super-Cache, W3 Total Cache or Quick Cache
39
- * **Extendable code**: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
40
-
41
- ### Donations
42
-
43
- I spend a significant amount of my free time maintaining, updating and more importantly supporting this plugin. Those who have sought support in the support forums know that I have done my best to answer your question and solve your problem.
44
- 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.
45
-
46
- ### Translations
47
-
48
- Top 10 is available for [translation directly on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/top-10). Check out the official [Translator Handbook](https://make.wordpress.org/polyglots/handbook/tools/glotpress-translate-wordpress-org/) to contribute.
49
-
50
-
51
- ## Screenshots
52
- ![General Options](https://raw.github.com/WebberZone/top-10/master/assets/screenshot-5.png)
53
- _Top 10 settings page - Styles Options_
54
-
55
- For more screenshots visit the [WordPress plugin page](http://wordpress.org/plugins/top-10/screenshots/).
56
-
57
- ## Installation
58
-
59
- ### WordPress install (the easy way)
60
- 1. Navigate to Plugins within your WordPress Admin Area
61
-
62
- 2. Click "Add new" and in the search box enter "Top 10"
63
-
64
- 3. Find the plugin in the list (usually the first result) and click "Install Now"
65
-
66
- ### Manual install
67
- 1. Download the plugin
68
-
69
- 2. Extract the contents of top-10.zip to wp-content/plugins/ folder. You should get a folder called top-10.
70
-
71
- 3. Activate the Plugin in WP-Admin.
72
-
73
- 4. Go to **Top 10** to configure
74
-
75
- 5. Go to **Appearance » Widgets** to add the Popular Posts sidebar widget to your theme
76
-
77
- 6. Go to **Top 10 » View Popular Posts** to view the list of popular posts
78
-
79
-
80
- ## Frequently Asked Questions
81
-
82
- Check out the [FAQ on the plugin page](http://wordpress.org/plugins/top-10/faq/).
83
-
84
- If your question isn't listed there, please create a new post at the [WordPress.org support forum](http://wordpress.org/support/plugin/top-10). It is the fastest way to get support as I monitor the forums regularly. I also provide [premium *paid* support via email](https://webberzone.com/support/).
85
-
86
-
87
- ## About this repository
88
-
89
- This GitHub repository always holds the latest development version of the plugin. If you're looking for an official WordPress release, you can find this on the [WordPress.org repository](http://wordpress.org/plugins/top-10). In addition to stable releases, latest beta versions are made available under [releases](https://github.com/WebberZone/top-10/releases).
90
-
1
+ [![Build Status](https://travis-ci.org/WebberZone/top-10.svg?branch=master)](https://travis-ci.org/WebberZone/top-10)
2
+
3
+ # Top 10 - Popular posts plugin for WordPress
4
+
5
+ __Requires:__ 4.1
6
+
7
+ __Tested up to:__ 4.7
8
+
9
+ __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
10
+
11
+ __Plugin page:__ [Top 10](https://webberzone.com/plugins/top-10/) | [WordPress.org plugin page](https://wordpress.org/plugins/top-10/)
12
+
13
+ Track daily and total visits on your blog posts. Display the count as well as popular and trending posts.
14
+
15
+ ## Description
16
+
17
+ WordPress doesn't have an in-built system to track page views or displaying popular posts. [Top 10](https://webberzone.com/plugins/top-10/) is an easy to use, yet, powerful WordPress plugin that will count the number of page views of your posts, pages and any custom post types. You can then display the page view counts as well as display your most popular posts.
18
+
19
+ Top 10 will add a widget that you can use to display the popular posts list.
20
+
21
+ Although several similar plugins exist today, Top 10 is one of the most feature rich popular post plugins with support for thumbnails, shortcodes, widgets, custom post types and CSS styles. The inbuilt caching system also helps reduce server load by caching your popular posts output. The tracking uses ajax and is thus compatible with most popular caching plugins.
22
+
23
+ Top 10 also has powerful API and is fully extendable with WordPress actions and filters to allow you easily extend the code base to add new features or tweak existing ones.
24
+
25
+ ### Features
26
+
27
+ * **Page counter**: Counts page views on single posts, pages and *custom post types* on an hourly basis which can then be easily displayed automatically, using shortcodes or functions
28
+ * **Popular posts**: Display a list of popular posts either for total counts or for a custom period. You can choose how many posts are to be displayed along with loads of other customisation options
29
+ * **Widget ready**: Sidebar widgets available for daily popular and overall popular posts. Highly customizable widgets to control what you want to display in the list of posts
30
+ * **Shortcodes**: The plugin includes two shortcodes `[tptn_list]` and `[tptn_views]` to display the posts list and the number of views respectively
31
+ * **Thumbnail support**
32
+ * Support for WordPress post thumbnails. Top 10 will create a custom image size (`tptn_thumbnail`) with the dimensions specified in the Settings page
33
+ * Auto-extract the first image in your post to be displayed as a thumbnail
34
+ * Manually enter the URL of the thumbnail via [WordPress meta fields](http://codex.wordpress.org/Custom_Fields). Specify this using the meta box in your Edit screens.
35
+ * **Exclusions**: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
36
+ * **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.
37
+ * **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
38
+ * **Works with caching plugins** like WP-Super-Cache, W3 Total Cache or Quick Cache
39
+ * **Extendable code**: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
40
+
41
+ ### Donations
42
+
43
+ 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.
44
+
45
+ ### Translations
46
+
47
+ Top 10 is available for [translation directly on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/top-10). Check out the official [Translator Handbook](https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/) to contribute.
48
+
49
+
50
+ ## Screenshots
51
+ ![Style Options](https://raw.github.com/WebberZone/top-10/master/wporg-assets/screenshot-5.png)
52
+ _Top 10 settings page - Styles Options_
53
+
54
+ For more screenshots visit the [WordPress plugin page](http://wordpress.org/plugins/top-10/screenshots/).
55
+
56
+ ## Installation
57
+
58
+ ### WordPress install (the easy way)
59
+ 1. Navigate to Plugins within your WordPress Admin Area
60
+
61
+ 2. Click "Add new" and in the search box enter "Top 10"
62
+
63
+ 3. Find the plugin in the list (usually the first result) and click "Install Now"
64
+
65
+ ### Manual install
66
+ 1. Download the plugin
67
+
68
+ 2. Extract the contents of top-10.zip to wp-content/plugins/ folder. You should get a folder called top-10.
69
+
70
+ 3. Activate the Plugin in WP-Admin.
71
+
72
+ 4. Go to **Top 10** to configure
73
+
74
+ 5. Go to **Appearance » Widgets** to add the Popular Posts sidebar widget to your theme
75
+
76
+ 6. Go to **Top 10 » View Popular Posts** to view the list of popular posts
77
+
78
+
79
+ ## Frequently Asked Questions
80
+
81
+ Check out the [FAQ on the plugin page](http://wordpress.org/plugins/top-10/faq/).
82
+
83
+ If your question isn't listed there, please create a new post at the [WordPress.org support forum](http://wordpress.org/support/plugin/top-10). It is the fastest way to get support as I monitor the forums regularly. I also provide [premium *paid* support via email](https://webberzone.com/support/).
84
+
85
+
86
+ ## About this repository
87
+
88
+ This GitHub repository always holds the latest development version of the plugin. If you're looking for an official WordPress release, you can find this on the [WordPress.org repository](http://wordpress.org/plugins/top-10). In addition to stable releases, latest beta versions are made available under [releases](https://github.com/WebberZone/top-10/releases).
89
+
 
admin/admin-columns.php CHANGED
@@ -19,8 +19,8 @@ if ( ! defined( 'WPINC' ) ) {
19
  *
20
  * @since 1.2
21
  *
22
- * @param array $cols Array of all columns on posts page
23
- * @return array Modified array of columns
24
  */
25
  function tptn_column( $cols ) {
26
  global $tptn_settings;
@@ -47,25 +47,25 @@ add_filter( 'manage_pages_columns', 'tptn_column' );
47
  *
48
  * @since 1.2
49
  *
50
- * @param string $column_name Name of the column
51
- * @param int|string $id Post ID
52
  */
53
  function tptn_value( $column_name, $id ) {
54
  global $wpdb, $tptn_settings;
55
 
56
  $blog_id = get_current_blog_id();
57
 
58
- // Add Total count
59
- if ( ( $column_name == 'tptn_total' ) && ( $tptn_settings['pv_in_admin'] ) ) {
60
  $table_name = $wpdb->base_prefix . 'top_ten';
61
 
62
- $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, cntaccess FROM {$table_name} WHERE postnumber = %d AND blog_id = %d ", $id, $blog_id ) );
63
  $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->cntaccess : 0 ) );
64
- echo $cntaccess;
65
  }
66
 
67
- // Now process daily count
68
- if ( ( $column_name == 'tptn_daily' ) && ( $tptn_settings['pv_in_admin'] ) ) {
69
  $table_name = $wpdb->base_prefix . 'top_ten_daily';
70
 
71
  $daily_range = $tptn_settings['daily_range'];
@@ -81,17 +81,16 @@ function tptn_value( $column_name, $id ) {
81
  $from_date = gmdate( 'Y-m-d H' , $from_date );
82
  }
83
 
84
- $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, SUM(cntaccess) as sumCount FROM {$table_name} WHERE postnumber = %d AND dp_date >= '%s' AND blog_id = %d GROUP BY postnumber ", $id, $from_date, $blog_id ) );
85
- $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->sumCount : 0 ) );
86
-
87
- echo $cntaccess;
88
  }
89
 
90
- // Now process both
91
- if ( ( $column_name == 'tptn_both' ) && ( $tptn_settings['pv_in_admin'] ) ) {
92
  $table_name = $wpdb->base_prefix . 'top_ten';
93
 
94
- $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, cntaccess FROM {$table_name} WHERE postnumber = %d AND blog_id = %d ", $id, $blog_id ) );
95
  $cntaccess = number_format_i18n( (($resultscount) ? $resultscount->cntaccess : 0) );
96
 
97
  $table_name = $wpdb->base_prefix . 'top_ten_daily';
@@ -109,10 +108,10 @@ function tptn_value( $column_name, $id ) {
109
  $from_date = gmdate( 'Y-m-d H' , $from_date );
110
  }
111
 
112
- $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, SUM(cntaccess) as sumCount FROM {$table_name} WHERE postnumber = %d AND dp_date >= '%s' AND blog_id = %d GROUP BY postnumber ", $id, $from_date, $blog_id ) );
113
- $cntaccess .= ' / ' . number_format_i18n( ( ( $resultscount ) ? $resultscount->sumCount : 0 ) );
114
 
115
- echo $cntaccess;
116
  }
117
  }
118
  add_action( 'manage_posts_custom_column', 'tptn_value', 10, 2 );
@@ -124,7 +123,7 @@ add_action( 'manage_pages_custom_column', 'tptn_value', 10, 2 );
124
  *
125
  * @since 1.9.8.2
126
  *
127
- * @param array $cols Array with column names
128
  * @return array Filtered columns array
129
  */
130
  function tptn_column_register_sortable( $cols ) {
@@ -146,23 +145,23 @@ add_filter( 'manage_edit-page_sortable_columns', 'tptn_column_register_sortable'
146
  *
147
  * @since 1.9.8.2
148
  *
149
- * @param array $clauses Lookup clauses
150
- * @param object $wp_query WP Query object
151
  * @return array Filtered clauses
152
  */
153
  function tptn_column_clauses( $clauses, $wp_query ) {
154
  global $wpdb;
155
  $tptn_settings = tptn_read_options();
156
 
157
- if ( isset( $wp_query->query['orderby'] ) && 'tptn_total' == $wp_query->query['orderby'] ) {
158
 
159
  $table_name = $wpdb->base_prefix . 'top_ten';
160
  $clauses['join'] .= "LEFT OUTER JOIN {$table_name} ON {$wpdb->posts}.ID={$table_name}.postnumber";
161
  $clauses['orderby'] = 'cntaccess ';
162
- $clauses['orderby'] .= ( 'ASC' == strtoupper( $wp_query->get( 'order' ) ) ) ? 'ASC' : 'DESC';
163
  }
164
 
165
- if ( isset( $wp_query->query['orderby'] ) && 'tptn_daily' == $wp_query->query['orderby'] ) {
166
 
167
  $table_name = $wpdb->base_prefix . 'top_ten_daily';
168
 
@@ -183,7 +182,7 @@ function tptn_column_clauses( $clauses, $wp_query ) {
183
  $clauses['where'] .= " AND {$table_name}.dp_date >= '$from_date' ";
184
  $clauses['groupby'] = "{$table_name}.postnumber";
185
  $clauses['orderby'] = "SUM({$table_name}.cntaccess) ";
186
- $clauses['orderby'] .= ( 'ASC' == strtoupper( $wp_query->get( 'order' ) ) ) ? 'ASC' : 'DESC';
187
  }
188
 
189
  return $clauses;
19
  *
20
  * @since 1.2
21
  *
22
+ * @param array $cols Array of all columns on posts page.
23
+ * @return array Modified array of columns.
24
  */
25
  function tptn_column( $cols ) {
26
  global $tptn_settings;
47
  *
48
  * @since 1.2
49
  *
50
+ * @param string $column_name Name of the column.
51
+ * @param int|string $id Post ID.
52
  */
53
  function tptn_value( $column_name, $id ) {
54
  global $wpdb, $tptn_settings;
55
 
56
  $blog_id = get_current_blog_id();
57
 
58
+ // Add Total count.
59
+ if ( ( 'tptn_total' === $column_name ) && ( $tptn_settings['pv_in_admin'] ) ) {
60
  $table_name = $wpdb->base_prefix . 'top_ten';
61
 
62
+ $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, cntaccess FROM {$table_name} WHERE postnumber = %d AND blog_id = %d ", $id, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
63
  $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->cntaccess : 0 ) );
64
+ echo esc_html( $cntaccess );
65
  }
66
 
67
+ // Now process daily count.
68
+ if ( ( 'tptn_daily' === $column_name ) && ( $tptn_settings['pv_in_admin'] ) ) {
69
  $table_name = $wpdb->base_prefix . 'top_ten_daily';
70
 
71
  $daily_range = $tptn_settings['daily_range'];
81
  $from_date = gmdate( 'Y-m-d H' , $from_date );
82
  }
83
 
84
+ $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, SUM(cntaccess) as sum_count FROM {$table_name} WHERE postnumber = %d AND dp_date >= '%s' AND blog_id = %d GROUP BY postnumber ", $id, $from_date, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
85
+ $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->sum_count : 0 ) );
86
+ echo esc_html( $cntaccess );
 
87
  }
88
 
89
+ // Now process both.
90
+ if ( ( 'tptn_both' === $column_name ) && ( $tptn_settings['pv_in_admin'] ) ) {
91
  $table_name = $wpdb->base_prefix . 'top_ten';
92
 
93
+ $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, cntaccess FROM {$table_name} WHERE postnumber = %d AND blog_id = %d ", $id, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
94
  $cntaccess = number_format_i18n( (($resultscount) ? $resultscount->cntaccess : 0) );
95
 
96
  $table_name = $wpdb->base_prefix . 'top_ten_daily';
108
  $from_date = gmdate( 'Y-m-d H' , $from_date );
109
  }
110
 
111
+ $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, SUM(cntaccess) as sum_count FROM {$table_name} WHERE postnumber = %d AND dp_date >= '%s' AND blog_id = %d GROUP BY postnumber ", $id, $from_date, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
112
+ $cntaccess .= ' / ' . number_format_i18n( ( ( $resultscount ) ? $resultscount->sum_count : 0 ) );
113
 
114
+ echo esc_html( $cntaccess );
115
  }
116
  }
117
  add_action( 'manage_posts_custom_column', 'tptn_value', 10, 2 );
123
  *
124
  * @since 1.9.8.2
125
  *
126
+ * @param array $cols Array with column names.
127
  * @return array Filtered columns array
128
  */
129
  function tptn_column_register_sortable( $cols ) {
145
  *
146
  * @since 1.9.8.2
147
  *
148
+ * @param array $clauses Lookup clauses.
149
+ * @param object $wp_query WP Query object.
150
  * @return array Filtered clauses
151
  */
152
  function tptn_column_clauses( $clauses, $wp_query ) {
153
  global $wpdb;
154
  $tptn_settings = tptn_read_options();
155
 
156
+ if ( isset( $wp_query->query['orderby'] ) && 'tptn_total' === $wp_query->query['orderby'] ) {
157
 
158
  $table_name = $wpdb->base_prefix . 'top_ten';
159
  $clauses['join'] .= "LEFT OUTER JOIN {$table_name} ON {$wpdb->posts}.ID={$table_name}.postnumber";
160
  $clauses['orderby'] = 'cntaccess ';
161
+ $clauses['orderby'] .= ( 'ASC' === strtoupper( $wp_query->get( 'order' ) ) ) ? 'ASC' : 'DESC';
162
  }
163
 
164
+ if ( isset( $wp_query->query['orderby'] ) && 'tptn_daily' === $wp_query->query['orderby'] ) {
165
 
166
  $table_name = $wpdb->base_prefix . 'top_ten_daily';
167
 
182
  $clauses['where'] .= " AND {$table_name}.dp_date >= '$from_date' ";
183
  $clauses['groupby'] = "{$table_name}.postnumber";
184
  $clauses['orderby'] = "SUM({$table_name}.cntaccess) ";
185
+ $clauses['orderby'] .= ( 'ASC' === strtoupper( $wp_query->get( 'order' ) ) ) ? 'ASC' : 'DESC';
186
  }
187
 
188
  return $clauses;
admin/admin-dashboard.php CHANGED
@@ -22,17 +22,18 @@ if ( ! defined( 'WPINC' ) ) {
22
  *
23
  * @since 1.3
24
  *
25
- * @param bool $daily Switch for Daily or Overall popular posts
26
- * @param int $page Which page of the lists are we on?
27
- * @param int $limit Maximum number of posts per page
28
- * @param bool $widget Is this a WordPress widget?
29
  * @return Formatted list of popular posts
30
  */
31
  function tptn_pop_display( $daily = false, $page = 0, $limit = false, $widget = false ) {
32
  global $wpdb, $tptn_settings;
33
 
34
  $table_name = $wpdb->base_prefix . 'top_ten';
35
- if ( $daily ) { $table_name .= '_daily'; // If we're viewing daily posts, set this to true
 
36
  }
37
  if ( ! $limit ) { $limit = $tptn_settings['limit']; }
38
 
@@ -51,7 +52,7 @@ function tptn_pop_display( $daily = false, $page = 0, $limit = false, $widget =
51
  $output .= '<ul>';
52
  foreach ( $results as $result ) {
53
  $output .= '<li><a href="' . get_permalink( $result['postnumber'] ) . '">' . get_the_title( $result['postnumber'] ) . '</a>';
54
- $output .= ' (' . number_format_i18n( $result['sumCount'] ) . ')';
55
  $output .= '</li>';
56
  }
57
  $output .= '</ul>';
@@ -72,7 +73,18 @@ function tptn_pop_display( $daily = false, $page = 0, $limit = false, $widget =
72
  $output .= '</p>';
73
  $output .= '</div>';
74
 
75
- return apply_filters( 'tptn_pop_display', $output );
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
 
@@ -82,7 +94,7 @@ function tptn_pop_display( $daily = false, $page = 0, $limit = false, $widget =
82
  * @since 1.1
83
  */
84
  function tptn_pop_dashboard() {
85
- echo tptn_pop_display( false, 0, 10, true );
86
  }
87
 
88
 
@@ -92,7 +104,7 @@ function tptn_pop_dashboard() {
92
  * @since 1.2
93
  */
94
  function tptn_pop_daily_dashboard() {
95
- echo tptn_pop_display( true, 0, 10, true );
96
  }
97
 
98
 
22
  *
23
  * @since 1.3
24
  *
25
+ * @param bool $daily Switch for Daily or Overall popular posts.
26
+ * @param int $page Which page of the lists are we on.
27
+ * @param int $limit Maximum number of posts per page.
28
+ * @param bool $widget Is this a WordPress widget.
29
  * @return Formatted list of popular posts
30
  */
31
  function tptn_pop_display( $daily = false, $page = 0, $limit = false, $widget = false ) {
32
  global $wpdb, $tptn_settings;
33
 
34
  $table_name = $wpdb->base_prefix . 'top_ten';
35
+ if ( $daily ) {
36
+ $table_name .= '_daily'; // If we're viewing daily posts, set this to true.
37
  }
38
  if ( ! $limit ) { $limit = $tptn_settings['limit']; }
39
 
52
  $output .= '<ul>';
53
  foreach ( $results as $result ) {
54
  $output .= '<li><a href="' . get_permalink( $result['postnumber'] ) . '">' . get_the_title( $result['postnumber'] ) . '</a>';
55
+ $output .= ' (' . number_format_i18n( $result['sum_count'] ) . ')';
56
  $output .= '</li>';
57
  }
58
  $output .= '</ul>';
73
  $output .= '</p>';
74
  $output .= '</div>';
75
 
76
+ /**
77
+ * Filters the dashboard widget output
78
+ *
79
+ * @since 1.3
80
+ *
81
+ * @param string $output Text output
82
+ * @param bool $daily Switch for Daily or Overall popular posts.
83
+ * @param int $page Which page of the lists are we on.
84
+ * @param int $limit Maximum number of posts per page.
85
+ * @param bool $widget Is this a WordPress widget.
86
+ */
87
+ return apply_filters( 'tptn_pop_display', $output, $daily, $page, $limit, $widget );
88
  }
89
 
90
 
94
  * @since 1.1
95
  */
96
  function tptn_pop_dashboard() {
97
+ echo tptn_pop_display( false, 0, 10, true ); // WPCS: XSS OK.
98
  }
99
 
100
 
104
  * @since 1.2
105
  */
106
  function tptn_pop_daily_dashboard() {
107
+ echo tptn_pop_display( true, 0, 10, true ); // WPCS: XSS OK.
108
  }
109
 
110
 
admin/admin-metabox.php CHANGED
@@ -21,16 +21,16 @@ if ( ! defined( 'WPINC' ) ) {
21
  *
22
  * @since 1.9.10
23
  *
24
- * @param text $post_type Post type
25
- * @param object $post Post object
26
  */
27
  function tptn_add_meta_box( $post_type, $post ) {
28
  global $tptn_settings;
29
 
30
- // If metaboxes are disabled, then exit
31
  if ( ! $tptn_settings['show_metabox'] ) { return; }
32
 
33
- // If current user isn't an admin and we're restricting metaboxes to admins only, then exit
34
  if ( ! current_user_can( 'manage_options' ) && $tptn_settings['show_metabox_admins'] ) { return; }
35
 
36
  $args = array(
@@ -47,7 +47,7 @@ function tptn_add_meta_box( $post_type, $post ) {
47
  */
48
  $post_types = apply_filters( 'tptn_meta_box_post_types', $post_types );
49
 
50
- if ( in_array( $post_type, $post_types ) ) {
51
 
52
  add_meta_box(
53
  'tptn_metabox',
@@ -75,18 +75,18 @@ function tptn_call_meta_box() {
75
  // Add an nonce field so we can check for it later.
76
  wp_nonce_field( 'tptn_meta_box', 'tptn_meta_box_nonce' );
77
 
78
- // Get the number of visits for the post being editted
79
- $resultscount = $wpdb->get_row( $wpdb->prepare(
80
  "SELECT postnumber, cntaccess FROM {$table_name} WHERE postnumber = %d AND blog_id = %d " ,
81
  $post->ID,
82
  get_current_blog_id()
83
- ) );
84
  $total_count = $resultscount ? $resultscount->cntaccess : 0;
85
 
86
- // Get the post meta
87
  $tptn_post_meta = get_post_meta( $post->ID, 'tptn_post_meta', true );
88
 
89
- // Disable display option
90
  if ( isset( $tptn_post_meta['disable_here'] ) ) {
91
  $disable_here = $tptn_post_meta['disable_here'];
92
  } else {
@@ -101,9 +101,9 @@ function tptn_call_meta_box() {
101
 
102
  ?>
103
  <p>
104
- <label for="total_count"><strong><?php _e( 'Visit count:', 'top-10' ); ?></strong></label>
105
- <input type="text" id="total_count" name="total_count" value="<?php echo $total_count ?>" style="width:100%" />
106
- <em><?php _e( 'Enter a number above to update the visit count. Leaving the above box blank will set the count to zero', 'top-10' ); ?></em>
107
  </p>
108
 
109
  <?php
@@ -112,29 +112,29 @@ function tptn_call_meta_box() {
112
  $value = ( $results ) ? $results : '';
113
  ?>
114
  <p>
115
- <label for="disable_here"><strong><?php _e( 'Disable Popular Posts display:', 'top-10' ); ?></strong></label>
116
- <input type="checkbox" id="disable_here" name="disable_here" <?php if ( 1 == $disable_here ) { echo ' checked="checked" '; } ?> />
117
  <br />
118
- <em><?php _e( 'If this is checked, then Top 10 will not display the popular posts widgets when viewing this post.', 'top-10' ); ?></em>
119
  </p>
120
 
121
  <p>
122
- <label for="exclude_this_post"><strong><?php _e( 'Exclude this post from the popular posts list:', 'top-10' ); ?></strong></label>
123
- <input type="checkbox" id="exclude_this_post" name="exclude_this_post" <?php if ( 1 == $exclude_this_post ) { echo ' checked="checked" '; } ?> />
124
  <br />
125
- <em><?php _e( 'If this is checked, then this post will be excluded from the popular posts list.', 'top-10' ); ?></em>
126
  </p>
127
 
128
  <p>
129
- <label for="thumb_meta"><strong><?php _e( 'Location of thumbnail:', 'top-10' ); ?></strong></label>
130
  <input type="text" id="thumb_meta" name="thumb_meta" value="<?php echo esc_url( $value ) ?>" style="width:100%" />
131
- <em><?php _e( "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This image will be used for the post. It will be resized to the thumbnail size set under Top 10 Settings &raquo; Thumbnail options.", 'top-10' ); ?></em>
132
- <em><?php _e( 'The URL above is saved in the meta field:', 'top-10' ); ?></em><strong><?php echo $tptn_settings['thumb_meta']; ?></strong>
133
  </p>
134
 
135
  <p>
136
  <?php if ( function_exists( 'crp_read_options' ) ) { ?>
137
- <em style="color:red"><?php printf( __( 'You have %1$s installed. If you are trying to modify the thumbnail, then you will need to make the same change in the %1$s meta box on this page.', 'top-10' ), 'Contextual Related Posts' ); ?></em>
138
  <?php } ?>
139
  </p>
140
 
@@ -151,7 +151,7 @@ function tptn_call_meta_box() {
151
  *
152
  * @since 1.9.10
153
  *
154
- * @param int $post_id
155
  */
156
  function tptn_save_meta_box( $post_id ) {
157
  global $tptn_settings, $wpdb;
@@ -160,67 +160,60 @@ function tptn_save_meta_box( $post_id ) {
160
 
161
  $table_name = $wpdb->base_prefix . 'top_ten';
162
 
163
- // Bail if we're doing an auto save
164
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; }
165
 
166
- // if our nonce isn't there, or we can't verify it, bail
167
- if ( ! isset( $_POST['tptn_meta_box_nonce'] ) || ! wp_verify_nonce( $_POST['tptn_meta_box_nonce'], 'tptn_meta_box' ) ) { return; }
 
 
168
 
169
- // if our current user can't edit this post, bail
170
- if ( ! current_user_can( 'edit_posts' ) ) { return; }
 
 
171
 
172
- // Update the posts view count
173
- if ( isset( $_POST['total_count'] ) ) {
174
- $total_count = intval( $_POST['total_count'] );
175
  $blog_id = get_current_blog_id();
176
 
177
- if ( 0 <> $total_count ) {
178
-
179
- $tt = $wpdb->query( $wpdb->prepare(
 
 
 
 
 
180
  "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES('%d', '%d', '%d') ON DUPLICATE KEY UPDATE cntaccess= %d ",
181
  $post_id,
182
  $total_count,
183
  $blog_id,
184
  $total_count
185
- ) );
186
- } else {
187
- $resultscount = $wpdb->query( $wpdb->prepare(
188
- "DELETE FROM {$table_name} WHERE postnumber = %d AND blog_id = %d",
189
- $post_id,
190
- $blog_id
191
- ) );
192
  }
193
  }
194
 
195
- // Update the thumbnail URL
196
- if ( isset( $_POST['thumb_meta'] ) ) {
197
- $thumb_meta = '' == $_POST['thumb_meta'] ? '' : sanitize_text_field( $_POST['thumb_meta'] );
198
- }
199
-
200
- $tptn_post_meta = get_post_meta( $post_id, $tptn_settings['thumb_meta'], true );
201
-
202
- if ( $tptn_post_meta && '' != $tptn_post_meta ) {
203
- $gotmeta = true;
204
- } else {
205
- $gotmeta = false;
206
  }
207
 
208
- if ( $gotmeta && '' != $thumb_meta ) {
209
  update_post_meta( $post_id, $tptn_settings['thumb_meta'], $thumb_meta );
210
- } elseif ( ! $gotmeta && '' != $thumb_meta ) {
211
- add_post_meta( $post_id, $tptn_settings['thumb_meta'], $thumb_meta );
212
  } else {
213
  delete_post_meta( $post_id, $tptn_settings['thumb_meta'] );
214
  }
215
 
216
- // Disable posts
217
- if ( isset( $_POST['disable_here'] ) ) {
218
  $tptn_post_meta['disable_here'] = 1;
219
  } else {
220
  $tptn_post_meta['disable_here'] = 0;
221
  }
222
 
223
- if ( isset( $_POST['exclude_this_post'] ) ) {
224
  $tptn_post_meta['exclude_this_post'] = 1;
225
  } else {
226
  $tptn_post_meta['exclude_this_post'] = 0;
21
  *
22
  * @since 1.9.10
23
  *
24
+ * @param text $post_type Post type.
25
+ * @param object $post Post object.
26
  */
27
  function tptn_add_meta_box( $post_type, $post ) {
28
  global $tptn_settings;
29
 
30
+ // If metaboxes are disabled, then exit.
31
  if ( ! $tptn_settings['show_metabox'] ) { return; }
32
 
33
+ // If current user isn't an admin and we're restricting metaboxes to admins only, then exit.
34
  if ( ! current_user_can( 'manage_options' ) && $tptn_settings['show_metabox_admins'] ) { return; }
35
 
36
  $args = array(
47
  */
48
  $post_types = apply_filters( 'tptn_meta_box_post_types', $post_types );
49
 
50
+ if ( in_array( $post_type, $post_types, true ) ) {
51
 
52
  add_meta_box(
53
  'tptn_metabox',
75
  // Add an nonce field so we can check for it later.
76
  wp_nonce_field( 'tptn_meta_box', 'tptn_meta_box_nonce' );
77
 
78
+ // Get the number of visits for the post being editted.
79
+ $resultscount = $wpdb->get_row( $wpdb->prepare( // WPCS: unprepared SQL OK.
80
  "SELECT postnumber, cntaccess FROM {$table_name} WHERE postnumber = %d AND blog_id = %d " ,
81
  $post->ID,
82
  get_current_blog_id()
83
+ ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
84
  $total_count = $resultscount ? $resultscount->cntaccess : 0;
85
 
86
+ // Get the post meta.
87
  $tptn_post_meta = get_post_meta( $post->ID, 'tptn_post_meta', true );
88
 
89
+ // Disable display option.
90
  if ( isset( $tptn_post_meta['disable_here'] ) ) {
91
  $disable_here = $tptn_post_meta['disable_here'];
92
  } else {
101
 
102
  ?>
103
  <p>
104
+ <label for="total_count"><strong><?php esc_html_e( 'Visit count:', 'top-10' ); ?></strong></label>
105
+ <input type="text" id="total_count" name="total_count" value="<?php echo esc_attr( $total_count ); ?>" style="width:100%" />
106
+ <em><?php esc_html_e( 'Enter a number above to update the visit count. Leaving the above box blank will set the count to zero', 'top-10' ); ?></em>
107
  </p>
108
 
109
  <?php
112
  $value = ( $results ) ? $results : '';
113
  ?>
114
  <p>
115
+ <label for="disable_here"><strong><?php esc_html_e( 'Disable Popular Posts display:', 'top-10' ); ?></strong></label>
116
+ <input type="checkbox" id="disable_here" name="disable_here" <?php checked( 1, $disable_here, true ); ?> />
117
  <br />
118
+ <em><?php esc_html_e( 'If this is checked, then Top 10 will not display the popular posts widgets when viewing this post.', 'top-10' ); ?></em>
119
  </p>
120
 
121
  <p>
122
+ <label for="exclude_this_post"><strong><?php esc_html_e( 'Exclude this post from the popular posts list:', 'top-10' ); ?></strong></label>
123
+ <input type="checkbox" id="exclude_this_post" name="exclude_this_post" <?php checked( 1, $exclude_this_post, true ); ?> />
124
  <br />
125
+ <em><?php esc_html_e( 'If this is checked, then this post will be excluded from the popular posts list.', 'top-10' ); ?></em>
126
  </p>
127
 
128
  <p>
129
+ <label for="thumb_meta"><strong><?php esc_html_e( 'Location of thumbnail:', 'top-10' ); ?></strong></label>
130
  <input type="text" id="thumb_meta" name="thumb_meta" value="<?php echo esc_url( $value ) ?>" style="width:100%" />
131
+ <em><?php esc_html_e( "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This image will be used for the post. It will be resized to the thumbnail size set under Top 10 Settings &raquo; Thumbnail options.", 'top-10' ); ?></em>
132
+ <em><?php esc_html_e( 'The URL above is saved in the meta field:', 'top-10' ); ?></em><strong><?php echo esc_attr( $tptn_settings['thumb_meta'] ); ?></strong>
133
  </p>
134
 
135
  <p>
136
  <?php if ( function_exists( 'crp_read_options' ) ) { ?>
137
+ <em style="color:red"><?php printf( __( 'You have %1$s installed. If you are trying to modify the thumbnail, then you will need to make the same change in the %1$s meta box on this page.', 'top-10' ), 'Contextual Related Posts' ); // WPCS: XSS OK. ?></em>
138
  <?php } ?>
139
  </p>
140
 
151
  *
152
  * @since 1.9.10
153
  *
154
+ * @param int $post_id Post ID.
155
  */
156
  function tptn_save_meta_box( $post_id ) {
157
  global $tptn_settings, $wpdb;
160
 
161
  $table_name = $wpdb->base_prefix . 'top_ten';
162
 
163
+ // Bail if we're doing an auto save.
164
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; }
165
 
166
+ // If our nonce isn't there, or we can't verify it, bail.
167
+ if ( ! isset( $_POST['tptn_meta_box_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['tptn_meta_box_nonce'] ), 'tptn_meta_box' ) ) { // Input var okay.
168
+ return;
169
+ }
170
 
171
+ // If our current user can't edit this post, bail.
172
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
173
+ return;
174
+ }
175
 
176
+ // Update the posts view count.
177
+ if ( isset( $_POST['total_count'] ) ) { // Input var okay.
178
+ $total_count = intval( $_POST['total_count'] ); // Input var okay.
179
  $blog_id = get_current_blog_id();
180
 
181
+ if ( 0 === $total_count ) {
182
+ $wpdb->query( $wpdb->prepare( // WPCS: unprepared SQL OK.
183
+ "DELETE FROM {$table_name} WHERE postnumber = %d AND blog_id = %d",
184
+ $post_id,
185
+ $blog_id
186
+ ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
187
+ } else {
188
+ $wpdb->query( $wpdb->prepare( // WPCS: unprepared SQL OK.
189
  "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES('%d', '%d', '%d') ON DUPLICATE KEY UPDATE cntaccess= %d ",
190
  $post_id,
191
  $total_count,
192
  $blog_id,
193
  $total_count
194
+ ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
 
 
 
 
 
 
195
  }
196
  }
197
 
198
+ // Update the thumbnail URL.
199
+ if ( isset( $_POST['thumb_meta'] ) ) { // Input var okay.
200
+ $thumb_meta = empty( $_POST['thumb_meta'] ) ? '' : sanitize_text_field( wp_unslash( $_POST['thumb_meta'] ) ); // Input var okay.
 
 
 
 
 
 
 
 
201
  }
202
 
203
+ if ( ! empty( $thumb_meta ) ) {
204
  update_post_meta( $post_id, $tptn_settings['thumb_meta'], $thumb_meta );
 
 
205
  } else {
206
  delete_post_meta( $post_id, $tptn_settings['thumb_meta'] );
207
  }
208
 
209
+ // Disable posts.
210
+ if ( isset( $_POST['disable_here'] ) ) { // Input var okay.
211
  $tptn_post_meta['disable_here'] = 1;
212
  } else {
213
  $tptn_post_meta['disable_here'] = 0;
214
  }
215
 
216
+ if ( isset( $_POST['exclude_this_post'] ) ) { // Input var okay.
217
  $tptn_post_meta['exclude_this_post'] = 1;
218
  } else {
219
  $tptn_post_meta['exclude_this_post'] = 0;
admin/admin.php CHANGED
@@ -36,13 +36,14 @@ function tptn_options() {
36
  }
37
 
38
  /*
39
- Temporary check if default styles are off and left thumbnails are selected - will be eventually deprecated
40
- // This is a mismatch, so we force it to no style */
41
- if ( ( false == $tptn_settings['include_default_style'] ) && ( 'left_thumbs' == $tptn_settings['tptn_styles'] ) ) {
 
42
  $tptn_settings['tptn_styles'] = 'no_style';
43
  update_option( 'ald_tptn_settings', $tptn_settings );
44
  }
45
- if ( ( true == $tptn_settings['include_default_style'] ) && ( 'left_thumbs' != $tptn_settings['tptn_styles'] ) ) {
46
  $tptn_settings['tptn_styles'] = 'left_thumbs';
47
  update_option( 'ald_tptn_settings', $tptn_settings );
48
  }
@@ -61,10 +62,9 @@ function tptn_options() {
61
  $tptn_settings['activate_overall'] = isset( $_POST['activate_overall'] ) ? true : false;
62
  $tptn_settings['activate_daily'] = isset( $_POST['activate_daily'] ) ? true : false;
63
  $tptn_settings['cache'] = isset( $_POST['cache'] ) ? true : false;
64
- $tptn_settings['cache_fix'] = isset( $_POST['cache_fix'] ) ? true : false;
65
  $tptn_settings['daily_midnight'] = isset( $_POST['daily_midnight'] ) ? true : false;
66
- $tptn_settings['daily_range'] = intval( $_POST['daily_range'] );
67
- $tptn_settings['hour_range'] = intval( $_POST['hour_range'] );
68
  $tptn_settings['uninstall_clean_options'] = isset( $_POST['uninstall_clean_options'] ) ? true : false;
69
  $tptn_settings['uninstall_clean_tables'] = isset( $_POST['uninstall_clean_tables'] ) ? true : false;
70
  $tptn_settings['show_metabox'] = ( isset( $_POST['show_metabox'] ) ? true : false );
@@ -80,10 +80,11 @@ function tptn_options() {
80
  $tptn_settings['add_to_tag_archives'] = isset( $_POST['add_to_tag_archives'] ) ? true : false;
81
  $tptn_settings['add_to_archives'] = isset( $_POST['add_to_archives'] ) ? true : false;
82
 
83
- $tptn_settings['count_disp_form'] = wp_kses_post( $_POST['count_disp_form'] );
84
- $tptn_settings['count_disp_form_zero'] = wp_kses_post( $_POST['count_disp_form_zero'] );
85
  $tptn_settings['dynamic_post_count'] = isset( $_POST['dynamic_post_count'] ) ? true : false;
86
 
 
87
  $tptn_settings['track_authors'] = isset( $_POST['track_authors'] ) ? true : false;
88
  $tptn_settings['track_admins'] = isset( $_POST['track_admins'] ) ? true : false;
89
  $tptn_settings['track_editors'] = isset( $_POST['track_editors'] ) ? true : false;
@@ -92,10 +93,10 @@ function tptn_options() {
92
  $tptn_settings['show_count_non_admins'] = isset( $_POST['show_count_non_admins'] ) ? true : false;
93
 
94
  /* Popular post list options */
95
- $tptn_settings['limit'] = intval( $_POST['limit'] );
96
- $tptn_settings['how_old'] = intval( $_POST['how_old'] );
97
 
98
- // Process post types to be selected
99
  $wp_post_types = get_post_types( array(
100
  'public' => true,
101
  ) );
@@ -103,17 +104,25 @@ function tptn_options() {
103
  $post_types = array_intersect( $wp_post_types, $post_types_arr );
104
  $tptn_settings['post_types'] = http_build_query( $post_types, '', '&' );
105
 
106
- $tptn_settings['exclude_post_ids'] = '' == sanitize_text_field( $_POST['exclude_post_ids'] ) ? '' : implode( ',', array_map( 'intval', explode( ',', sanitize_text_field( $_POST['exclude_post_ids'] ) ) ) );
107
 
108
  /**** Exclude categories ****/
109
  $exclude_categories_slugs = array_map( 'trim', explode( ',', sanitize_text_field( $_POST['exclude_cat_slugs'] ) ) );
110
- $tptn_settings['exclude_cat_slugs'] = implode( ', ', $exclude_categories_slugs );
111
 
112
  foreach ( $exclude_categories_slugs as $exclude_categories_slug ) {
113
- $catObj = get_category_by_slug( $exclude_categories_slug );
114
- if ( isset( $catObj->term_taxonomy_id ) ) { $exclude_categories[] = $catObj->term_taxonomy_id; }
 
 
 
 
 
 
 
 
115
  }
116
  $tptn_settings['exclude_categories'] = ( isset( $exclude_categories ) ) ? join( ',', $exclude_categories ) : '';
 
117
 
118
  $tptn_settings['title'] = wp_kses_post( $_POST['title'] );
119
  $tptn_settings['title_daily'] = wp_kses_post( $_POST['title_daily'] );
@@ -122,15 +131,15 @@ function tptn_options() {
122
  $tptn_settings['blank_output_text'] = wp_kses_post( $_POST['blank_output_text'] );
123
 
124
  $tptn_settings['show_excerpt'] = isset( $_POST['show_excerpt'] ) ? true : false;
125
- $tptn_settings['excerpt_length'] = intval( $_POST['excerpt_length'] );
126
  $tptn_settings['show_date'] = isset( $_POST['show_date'] ) ? true : false;
127
  $tptn_settings['show_author'] = isset( $_POST['show_author'] ) ? true : false;
128
- $tptn_settings['title_length'] = intval( $_POST['title_length'] );
129
  $tptn_settings['disp_list_count'] = isset( $_POST['disp_list_count'] ) ? true : false;
130
 
131
  $tptn_settings['link_new_window'] = isset( $_POST['link_new_window'] ) ? true : false;
132
  $tptn_settings['link_nofollow'] = isset( $_POST['link_nofollow'] ) ? true : false;
133
- $tptn_settings['exclude_on_post_ids'] = '' == sanitize_text_field( $_POST['exclude_on_post_ids'] ) ? '' : implode( ',', array_map( 'intval', explode( ',', sanitize_text_field( $_POST['exclude_on_post_ids'] ) ) ) );
134
 
135
  // List HTML options
136
  $tptn_settings['before_list'] = wp_kses_post( $_POST['before_list'] );
@@ -141,25 +150,25 @@ function tptn_options() {
141
  /* Thumbnail options */
142
  $tptn_settings['post_thumb_op'] = sanitize_text_field( $_POST['post_thumb_op'] );
143
  $tptn_settings['thumb_size'] = sanitize_text_field( $_POST['thumb_size'] );
144
- $tptn_settings['thumb_width'] = intval( $_POST['thumb_width'] );
145
- $tptn_settings['thumb_height'] = intval( $_POST['thumb_height'] );
146
  $tptn_settings['thumb_crop'] = ( isset( $_POST['thumb_crop'] ) ? true : false );
147
  $tptn_settings['thumb_html'] = sanitize_text_field( $_POST['thumb_html'] );
148
 
149
- $tptn_settings['thumb_meta'] = '' == sanitize_text_field( $_POST['thumb_meta'] ) ? 'post-image' : sanitize_text_field( $_POST['thumb_meta'] );
150
  $tptn_settings['scan_images'] = isset( $_POST['scan_images'] ) ? true : false;
151
  $tptn_settings['thumb_default_show'] = isset( $_POST['thumb_default_show'] ) ? true : false;
152
- $tptn_settings['thumb_default'] = ( ( '' == esc_url_raw( $_POST['thumb_default'] ) ) || ( '/default.png' == esc_url_raw( $_POST['thumb_default'] ) ) ) ? TOP_TEN_PLUGIN_URL . '/default.png' : esc_url_raw( $_POST['thumb_default'] );
153
 
154
  /* Styles */
155
  $tptn_settings['custom_CSS'] = wp_kses_post( $_POST['custom_CSS'] );
156
 
157
  $tptn_settings['tptn_styles'] = sanitize_text_field( $_POST['tptn_styles'] );
158
 
159
- if ( 'left_thumbs' == $tptn_settings['tptn_styles'] ) {
160
  $tptn_settings['include_default_style'] = true;
161
  $tptn_settings['post_thumb_op'] = 'inline';
162
- } elseif ( 'text_only' == $tptn_settings['tptn_styles'] ) {
163
  $tptn_settings['include_default_style'] = false;
164
  $tptn_settings['post_thumb_op'] = 'text_only';
165
  } else {
@@ -183,20 +192,21 @@ function tptn_options() {
183
  parse_str( $tptn_settings['post_types'], $post_types );
184
  $posts_types_inc = array_intersect( $wp_post_types, $post_types );
185
 
186
- // Delete the cache
187
  tptn_cache_delete();
188
 
189
  /* Echo a success message */
190
- $str = '<div id="message" class="updated fade"><p>'. __( 'Options saved successfully. If enabled, the cache has been cleared.', 'top-10' ) . '</p>';
191
 
192
- if ( 'left_thumbs' == $tptn_settings['tptn_styles'] ) {
193
- $str .= '<p>'. __( 'Left Thumbnails style selected. Post thumbnail location set to Inline before text.', 'top-10' ) . '</p>';
194
  }
195
- if ( 'text_only' == $tptn_settings['tptn_styles'] ) {
196
- $str .= '<p>'. __( 'Text Only style selected. Thumbnails will not be displayed.', 'top-10' ) . '</p>';
197
  }
198
- if ( 'tptn_thumbnail' != $tptn_settings['thumb_size'] ) {
199
- $str .= '<p>'. sprintf( __( 'Pre-built thumbnail size selected. Thumbnail set to %d x %d.', 'top-10' ), $tptn_settings['thumb_width'], $tptn_settings['thumb_height'] ) . '</p>';
 
200
  }
201
 
202
  $str .= '</div>';
@@ -211,21 +221,21 @@ function tptn_options() {
211
  update_option( 'ald_tptn_settings', $tptn_settings );
212
  tptn_disable_run();
213
 
214
- $str = '<div id="message" class="updated fade"><p>'. __( 'Options set to Default.', 'top-10' ) .'</p></div>';
215
  echo $str;
216
  }
217
 
218
  /* Truncate overall posts table */
219
  if ( ( isset( $_POST['tptn_trunc_all'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
220
  tptn_trunc_count( false );
221
- $str = '<div id="message" class="updated fade"><p>'. __( 'Top 10 popular posts reset', 'top-10' ) .'</p></div>';
222
  echo $str;
223
  }
224
 
225
  /* Truncate daily posts table */
226
  if ( ( isset( $_POST['tptn_trunc_daily'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
227
  tptn_trunc_count( true );
228
- $str = '<div id="message" class="updated fade"><p>'. __( 'Top 10 daily popular posts reset', 'top-10' ) .'</p></div>';
229
  echo $str;
230
  }
231
 
@@ -233,7 +243,7 @@ function tptn_options() {
233
  if ( ( isset( $_POST['tptn_clean_duplicates'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
234
  tptn_clean_duplicates( true );
235
  tptn_clean_duplicates( false );
236
- $str = '<div id="message" class="updated fade"><p>'. __( 'Duplicate rows cleaned from tables', 'top-10' ) .'</p></div>';
237
  echo $str;
238
  }
239
 
@@ -241,24 +251,24 @@ function tptn_options() {
241
  if ( ( isset( $_POST['tptn_merge_blogids'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
242
  tptn_merge_blogids( true );
243
  tptn_merge_blogids( false );
244
- $str = '<div id="message" class="updated fade"><p>'. __( 'Post counts across blog IDs 0 and 1 have been merged', 'top-10' ) .'</p></div>';
245
  echo $str;
246
  }
247
 
248
  /* Save maintenance options */
249
  if ( ( isset( $_POST['tptn_mnts_save'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
250
- $tptn_settings['cron_hour'] = min( 23, intval( $_POST['cron_hour'] ) );
251
- $tptn_settings['cron_min'] = min( 59, intval( $_POST['cron_min'] ) );
252
  $tptn_settings['cron_recurrence'] = sanitize_text_field( $_POST['cron_recurrence'] );
253
 
254
  if ( isset( $_POST['cron_on'] ) ) {
255
  $tptn_settings['cron_on'] = true;
256
  tptn_enable_run( $tptn_settings['cron_hour'], $tptn_settings['cron_min'], $tptn_settings['cron_recurrence'] );
257
- $str = '<div id="message" class="updated fade"><p>' . __( 'Scheduled maintenance enabled / modified', 'top-10' ) .'</p></div>';
258
  } else {
259
  $tptn_settings['cron_on'] = false;
260
  tptn_disable_run();
261
- $str = '<div id="message" class="updated fade"><p>'. __( 'Scheduled maintenance disabled', 'top-10' ) .'</p></div>';
262
  }
263
  update_option( 'ald_tptn_settings', $tptn_settings );
264
  $tptn_settings = tptn_read_options();
@@ -275,7 +285,7 @@ function tptn_options() {
275
  foreach ( $top_ten_mu_tables_sel_blog_ids as $top_ten_mu_tables_sel_blog_id ) {
276
  $sql = '
277
  INSERT INTO ' . $wpdb->base_prefix . "top_ten (postnumber, cntaccess, blog_id)
278
- SELECT postnumber, cntaccess, '%d' FROM " . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten
279
  ON DUPLICATE KEY UPDATE ' . $wpdb->base_prefix . 'top_ten.cntaccess = ' . $wpdb->base_prefix . 'top_ten.cntaccess + (
280
  SELECT ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten.cntaccess FROM ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten WHERE ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten.postnumber = ' . $wpdb->base_prefix . 'top_ten.postnumber
281
  )
@@ -285,7 +295,7 @@ function tptn_options() {
285
 
286
  $sql = '
287
  INSERT INTO ' . $wpdb->base_prefix . "top_ten_daily (postnumber, cntaccess, dp_date, blog_id)
288
- SELECT postnumber, cntaccess, dp_date, '%d' FROM " . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily
289
  ON DUPLICATE KEY UPDATE ' . $wpdb->base_prefix . 'top_ten_daily.cntaccess = ' . $wpdb->base_prefix . 'top_ten_daily.cntaccess + (
290
  SELECT ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily.cntaccess FROM ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily WHERE ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily.postnumber = ' . $wpdb->base_prefix . 'top_ten_daily.postnumber
291
  )
@@ -296,7 +306,7 @@ function tptn_options() {
296
 
297
  update_site_option( 'top_ten_mu_tables_sel_blog_ids', array_unique( array_merge( $top_ten_mu_tables_sel_blog_ids, get_site_option( 'top_ten_mu_tables_sel_blog_ids', array() ) ) ) );
298
 
299
- $str = '<div id="message" class="updated fade"><p>'. __( 'Counts from selected sites have been imported.', 'top-10' ) .'</p></div>';
300
  echo $str;
301
  }
302
 
@@ -321,7 +331,7 @@ function tptn_options() {
321
  $sql = substr( $sql, 0, -2 );
322
 
323
  $wpdb->query( $sql );
324
- $str = '<div id="message" class="updated fade"><p>'. __( 'Selected tables have been deleted. Note that only imported tables have been deleted.', 'top-10' ) .'</p></div>';
325
  echo $str;
326
  }
327
  }
@@ -338,68 +348,95 @@ function tptn_options() {
338
  */
339
  function tptn_admin_side() {
340
  ?>
341
- <div id="donatediv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
342
- <h3 class='hndle'><span><?php _e( 'Support the development', 'top-10' ); ?></span></h3>
343
- <div class="inside">
344
- <div id="donate-form">
345
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
346
- <input type="hidden" name="cmd" value="_xclick">
347
- <input type="hidden" name="business" value="donate@ajaydsouza.com">
348
- <input type="hidden" name="lc" value="IN">
349
- <input type="hidden" name="item_name" value="<?php _e( 'Donation for Top 10', 'top-10' ); ?>">
350
- <input type="hidden" name="item_number" value="tptn_admin">
351
- <strong><?php _e( 'Enter amount in USD:', 'top-10' ); ?></strong> <input name="amount" value="10.00" size="6" type="text"><br />
352
- <input type="hidden" name="currency_code" value="USD">
353
- <input type="hidden" name="button_subtype" value="services">
354
- <input type="hidden" name="bn" value="PP-BuyNowBF:btn_donate_LG.gif:NonHosted">
355
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="<?php _e( 'Send your donation to the author of Top 10', 'top-10' ); ?>">
356
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
357
- </form>
 
 
 
 
 
 
358
  </div>
359
- </div>
360
  </div>
361
- <div id="followdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
362
- <h3 class='hndle'><span><?php _e( 'Follow me', 'top-10' ); ?></span></h3>
363
- <div class="inside">
364
- <div id="twitter">
365
- <div style="text-align:center"><a href="https://twitter.com/WebberZoneWP" class="twitter-follow-button" data-show-count="false" data-size="large" data-dnt="true">Follow @WebberZoneWP</a>
366
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></div>
367
  </div>
368
- <div id="facebook">
369
- <div id="fb-root"></div>
370
- <script>
371
- //<![CDATA[
372
- (function(d, s, id) {
373
- var js, fjs = d.getElementsByTagName(s)[0];
374
- if (d.getElementById(id)) return;
375
- js = d.createElement(s); js.id = id;
376
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4&appId=458036114376706";
377
- fjs.parentNode.insertBefore(js, fjs);
378
- }(document, 'script', 'facebook-jssdk'));
379
- //]]>
380
- </script>
381
- <div class="fb-page" data-href="https://www.facebook.com/WebberZone" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="false" data-show-posts="false"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/WebberZone"><a href="https://www.facebook.com/WebberZone">WebberZone</a></blockquote></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  </div>
383
- </div>
384
  </div>
385
- <div id="qlinksdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
386
- <h3 class='hndle'><span><?php _e( 'Quick links', 'top-10' ); ?></span></h3>
387
- <div class="inside">
388
- <div id="quick-links">
389
- <ul>
390
- <li><a href="https://webberzone.com/plugins/top-10/" target="_blank"><?php _e( 'Top 10 plugin page', 'top-10' ); ?></a></li>
391
- <li><a href="https://github.com/ajaydsouza/top-10" target="_blank"><?php _e( 'Top 10 Github page', 'top-10' ); ?></a></li>
392
- <li><a href="https://webberzone.com/plugins/" target="_blank"><?php _e( 'Other plugins', 'top-10' ); ?></a></li>
393
- <li><a href="https://wordpress.org/plugins/top-10/faq/" target="_blank"><?php _e( 'FAQ', 'top-10' ); ?></a></li>
394
- <li><a href="https://wordpress.org/support/plugin/top-10" target="_blank"><?php _e( 'Support', 'top-10' ); ?></a></li>
395
- <li><a href="https://wordpress.org/support/view/plugin-reviews/top-10" target="_blank"><?php _e( 'Reviews', 'top-10' ); ?></a></li>
396
- <li><a href="https://ajaydsouza.com/" target="_blank"><?php _e( "Ajay's blog", 'top-10' ); ?></a></li>
397
- </ul>
398
  </div>
399
- </div>
400
  </div>
401
 
402
- <?php
403
  }
404
 
405
 
@@ -411,20 +448,20 @@ function tptn_admin_side() {
411
  function tptn_adminmenu() {
412
 
413
  $plugin_page = add_menu_page( __( 'Top 10 Settings', 'top-10' ), __( 'Top 10', 'top-10' ), 'manage_options', 'tptn_options', 'tptn_options', 'dashicons-editor-ol' );
414
- add_action( 'admin_head-'. $plugin_page, 'tptn_adminhead' );
415
 
416
  $plugin_page = add_submenu_page( 'tptn_options', __( 'Top 10 Settings', 'top-10' ), __( 'Top 10 Settings', 'top-10' ), 'manage_options', 'tptn_options', 'tptn_options' );
417
- add_action( 'admin_head-'. $plugin_page, 'tptn_adminhead' );
418
 
419
  $tptn_stats_screen = new Top_Ten_Statistics;
420
 
421
  $plugin_page = add_submenu_page( 'tptn_options', __( 'View Popular Posts', 'top-10' ), __( 'View Popular Posts', 'top-10' ), 'manage_options', 'tptn_popular_posts', array( $tptn_stats_screen, 'plugin_settings_page' ) );
422
  add_action( "load-$plugin_page", array( $tptn_stats_screen, 'screen_option' ) );
423
- add_action( 'admin_head-'. $plugin_page, 'tptn_adminhead' );
424
 
425
  $plugin_page = add_submenu_page( 'tptn_options', __( 'Daily Popular Posts', 'top-10' ), __( 'Daily Popular Posts', 'top-10' ), 'manage_options', 'tptn_popular_posts&orderby=daily_count&order=desc', array( $tptn_stats_screen, 'plugin_settings_page' ) );
426
  add_action( "load-$plugin_page", array( $tptn_stats_screen, 'screen_option' ) );
427
- add_action( 'admin_head-'. $plugin_page, 'tptn_adminhead' );
428
 
429
  }
430
  add_action( 'admin_menu', 'tptn_adminmenu' );
@@ -441,90 +478,75 @@ function tptn_adminhead() {
441
  wp_enqueue_script( 'wp-lists' );
442
  wp_enqueue_script( 'postbox' );
443
  wp_enqueue_script( 'plugin-install' );
 
444
 
445
  add_thickbox();
446
 
447
  ?>
448
- <style type="text/css">
449
- .postbox .handlediv:before {
450
- right:12px;
451
- font:400 20px/1 dashicons;
452
- speak:none;
453
- display:inline-block;
454
- top:0;
455
- position:relative;
456
- -webkit-font-smoothing:antialiased;
457
- -moz-osx-font-smoothing:grayscale;
458
- text-decoration:none!important;
459
- content:'\f142';
460
- padding:8px 10px;
461
- }
462
- .postbox.closed .handlediv:before {
463
- content: '\f140';
464
- }
465
- .wrap h2:before {
466
- content: "\f204";
467
- display: inline-block;
468
- -webkit-font-smoothing: antialiased;
469
- font: normal 29px/1 'dashicons';
470
- vertical-align: middle;
471
- margin-right: 0.3em;
472
- }
473
- </style>
474
-
475
- <script type="text/javascript">
476
- //<![CDATA[
477
- jQuery(document).ready( function($) {
478
- // close postboxes that should be closed
479
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
480
- // postboxes setup
481
- postboxes.add_postbox_toggles('tptn_options');
482
- });
483
- //]]>
484
- </script>
485
-
486
- <script type="text/javascript" language="JavaScript">
487
- //<![CDATA[
488
- function checkForm() {
489
- answer = true;
490
- if (siw && siw.selectingSomething)
491
- answer = false;
492
- return answer;
493
- }//
494
- //]]>
495
- </script>
496
-
497
- <link rel="stylesheet" type="text/css" href="<?php echo TOP_TEN_PLUGIN_URL ?>/admin/wick/wick.css" />
498
- <script type="text/javascript" language="JavaScript">
499
- //<![CDATA[
500
- function clearCache() {
501
- /**** since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php ****/
502
- jQuery.post(ajaxurl, {action: 'tptn_clear_cache'}, function(response, textStatus, jqXHR) {
503
- alert( response.message );
504
- }, 'json');
505
- }
506
-
507
- <?php
508
- function wick_data() {
509
 
510
- $categories = get_categories( 'hide_empty=0' );
511
- $str = 'collection = [';
512
- foreach ( $categories as $cat ) {
513
- $str .= "'" . $cat->slug . "',";
514
  }
515
- $str = substr( $str, 0, -1 ); // Remove trailing comma
516
- $str .= '];';
517
 
518
- echo $str;
519
- }
520
- wick_data();
521
- ?>
522
- //]]>
523
- </script>
 
 
 
524
 
525
- <script type="text/javascript" src="<?php echo TOP_TEN_PLUGIN_URL ?>/admin/wick/wick.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
 
527
- <?php
528
  }
529
 
530
 
@@ -533,8 +555,8 @@ function tptn_adminhead() {
533
  *
534
  * @version 1.9.2
535
  *
536
- * @param array $links
537
- * @return array Links array with our settings link added
538
  */
539
  function tptn_plugin_actions_links( $links ) {
540
 
@@ -554,21 +576,21 @@ add_filter( 'plugin_action_links_' . plugin_basename( plugin_dir_path( __DIR__ )
554
  *
555
  * @since 1.5
556
  *
557
- * @param array $links
558
- * @param array $file
559
  * @return array Links array with our links added
560
  */
561
  function tptn_plugin_actions( $links, $file ) {
562
  $plugin = plugin_basename( TOP_TEN_PLUGIN_FILE );
563
 
564
- // create link
565
  if ( $file == $plugin ) {
566
- $links[] = '<a href="https://webberzone.com/support/">' . __( 'Support', 'top-10' ) . '</a>';
567
  $links[] = '<a href="https://ajaydsouza.com/donate/">' . __( 'Donate', 'top-10' ) . '</a>';
 
568
  }
569
  return $links;
570
  }
571
- add_filter( 'plugin_action_links', 'tptn_plugin_actions', 10, 2 );
572
 
573
 
574
  /**
@@ -576,7 +598,7 @@ add_filter( 'plugin_action_links', 'tptn_plugin_actions', 10, 2 );
576
  *
577
  * @since 1.6.2
578
  *
579
- * @param bool $daily Daily flag
580
  */
581
  function tptn_clean_duplicates( $daily = false ) {
582
  global $wpdb;
@@ -609,31 +631,30 @@ function tptn_merge_blogids( $daily = false ) {
609
 
610
  if ( $daily ) {
611
  $wpdb->query( "
612
- INSERT INTO `$table_name` (postnumber, cntaccess, dp_date, blog_id) (
613
- SELECT
614
- postnumber,
615
- SUM(cntaccess) as sumCount,
616
- dp_date,
617
- 1
618
- FROM `$table_name`
619
- WHERE blog_ID IN (0,1)
620
- GROUP BY postnumber, dp_date
621
- ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
622
- " );
623
  } else {
624
  $wpdb->query( "
625
- INSERT INTO `$table_name` (postnumber, cntaccess, blog_id) (
626
- SELECT
627
- postnumber,
628
- SUM(cntaccess) as sumCount,
629
- 1
630
- FROM `$table_name`
631
- WHERE blog_ID IN (0,1)
632
- GROUP BY postnumber
633
- ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
634
- " );
635
  }
636
 
637
  $wpdb->query( "DELETE FROM $table_name WHERE blog_id = 0" );
638
  }
639
-
36
  }
37
 
38
  /*
39
+ Temporary check if default styles are off and left thumbnails are selected - will be eventually deprecated
40
+ This is a mismatch, so we force it to no style
41
+ */
42
+ if ( ( false === $tptn_settings['include_default_style'] ) && ( 'left_thumbs' === $tptn_settings['tptn_styles'] ) ) {
43
  $tptn_settings['tptn_styles'] = 'no_style';
44
  update_option( 'ald_tptn_settings', $tptn_settings );
45
  }
46
+ if ( ( true === $tptn_settings['include_default_style'] ) && ( 'left_thumbs' !== $tptn_settings['tptn_styles'] ) ) {
47
  $tptn_settings['tptn_styles'] = 'left_thumbs';
48
  update_option( 'ald_tptn_settings', $tptn_settings );
49
  }
62
  $tptn_settings['activate_overall'] = isset( $_POST['activate_overall'] ) ? true : false;
63
  $tptn_settings['activate_daily'] = isset( $_POST['activate_daily'] ) ? true : false;
64
  $tptn_settings['cache'] = isset( $_POST['cache'] ) ? true : false;
 
65
  $tptn_settings['daily_midnight'] = isset( $_POST['daily_midnight'] ) ? true : false;
66
+ $tptn_settings['daily_range'] = absint( $_POST['daily_range'] );
67
+ $tptn_settings['hour_range'] = absint( $_POST['hour_range'] );
68
  $tptn_settings['uninstall_clean_options'] = isset( $_POST['uninstall_clean_options'] ) ? true : false;
69
  $tptn_settings['uninstall_clean_tables'] = isset( $_POST['uninstall_clean_tables'] ) ? true : false;
70
  $tptn_settings['show_metabox'] = ( isset( $_POST['show_metabox'] ) ? true : false );
80
  $tptn_settings['add_to_tag_archives'] = isset( $_POST['add_to_tag_archives'] ) ? true : false;
81
  $tptn_settings['add_to_archives'] = isset( $_POST['add_to_archives'] ) ? true : false;
82
 
83
+ $tptn_settings['count_disp_form'] = wp_kses_post( wp_unslash( $_POST['count_disp_form'] ) );
84
+ $tptn_settings['count_disp_form_zero'] = wp_kses_post( wp_unslash( $_POST['count_disp_form_zero'] ) );
85
  $tptn_settings['dynamic_post_count'] = isset( $_POST['dynamic_post_count'] ) ? true : false;
86
 
87
+ $tptn_settings['tracker_type'] = sanitize_text_field( $_POST['tracker_type'] );
88
  $tptn_settings['track_authors'] = isset( $_POST['track_authors'] ) ? true : false;
89
  $tptn_settings['track_admins'] = isset( $_POST['track_admins'] ) ? true : false;
90
  $tptn_settings['track_editors'] = isset( $_POST['track_editors'] ) ? true : false;
93
  $tptn_settings['show_count_non_admins'] = isset( $_POST['show_count_non_admins'] ) ? true : false;
94
 
95
  /* Popular post list options */
96
+ $tptn_settings['limit'] = absint( $_POST['limit'] );
97
+ $tptn_settings['how_old'] = absint( $_POST['how_old'] );
98
 
99
+ // Process post types to be selected.
100
  $wp_post_types = get_post_types( array(
101
  'public' => true,
102
  ) );
104
  $post_types = array_intersect( $wp_post_types, $post_types_arr );
105
  $tptn_settings['post_types'] = http_build_query( $post_types, '', '&' );
106
 
107
+ $tptn_settings['exclude_post_ids'] = empty( sanitize_text_field( $_POST['exclude_post_ids'] ) ) ? '' : implode( ',', array_map( 'absint', explode( ',', sanitize_text_field( wp_unslash( $_POST['exclude_post_ids'] ) ) ) ) );
108
 
109
  /**** Exclude categories ****/
110
  $exclude_categories_slugs = array_map( 'trim', explode( ',', sanitize_text_field( $_POST['exclude_cat_slugs'] ) ) );
 
111
 
112
  foreach ( $exclude_categories_slugs as $exclude_categories_slug ) {
113
+ $category_obj = get_term_by( 'name', $exclude_categories_slug, 'category' );
114
+
115
+ // Fall back to slugs since that was the default format before v2.4.0.
116
+ if ( false === $category_obj ) {
117
+ $category_obj = get_term_by( 'slug', $exclude_categories_slug, 'category' );
118
+ }
119
+ if ( isset( $category_obj->term_taxonomy_id ) ) {
120
+ $exclude_categories[] = $category_obj->term_taxonomy_id;
121
+ $exclude_cat_slugs[] = $category_obj->name;
122
+ }
123
  }
124
  $tptn_settings['exclude_categories'] = ( isset( $exclude_categories ) ) ? join( ',', $exclude_categories ) : '';
125
+ $tptn_settings['exclude_cat_slugs'] = ( isset( $exclude_cat_slugs ) ) ? join( ',', $exclude_cat_slugs ) : '';
126
 
127
  $tptn_settings['title'] = wp_kses_post( $_POST['title'] );
128
  $tptn_settings['title_daily'] = wp_kses_post( $_POST['title_daily'] );
131
  $tptn_settings['blank_output_text'] = wp_kses_post( $_POST['blank_output_text'] );
132
 
133
  $tptn_settings['show_excerpt'] = isset( $_POST['show_excerpt'] ) ? true : false;
134
+ $tptn_settings['excerpt_length'] = absint( $_POST['excerpt_length'] );
135
  $tptn_settings['show_date'] = isset( $_POST['show_date'] ) ? true : false;
136
  $tptn_settings['show_author'] = isset( $_POST['show_author'] ) ? true : false;
137
+ $tptn_settings['title_length'] = absint( $_POST['title_length'] );
138
  $tptn_settings['disp_list_count'] = isset( $_POST['disp_list_count'] ) ? true : false;
139
 
140
  $tptn_settings['link_new_window'] = isset( $_POST['link_new_window'] ) ? true : false;
141
  $tptn_settings['link_nofollow'] = isset( $_POST['link_nofollow'] ) ? true : false;
142
+ $tptn_settings['exclude_on_post_ids'] = empty( $_POST['exclude_on_post_ids'] ) ? '' : implode( ',', array_map( 'absint', explode( ',', sanitize_text_field( $_POST['exclude_on_post_ids'] ) ) ) );
143
 
144
  // List HTML options
145
  $tptn_settings['before_list'] = wp_kses_post( $_POST['before_list'] );
150
  /* Thumbnail options */
151
  $tptn_settings['post_thumb_op'] = sanitize_text_field( $_POST['post_thumb_op'] );
152
  $tptn_settings['thumb_size'] = sanitize_text_field( $_POST['thumb_size'] );
153
+ $tptn_settings['thumb_width'] = absint( $_POST['thumb_width'] );
154
+ $tptn_settings['thumb_height'] = absint( $_POST['thumb_height'] );
155
  $tptn_settings['thumb_crop'] = ( isset( $_POST['thumb_crop'] ) ? true : false );
156
  $tptn_settings['thumb_html'] = sanitize_text_field( $_POST['thumb_html'] );
157
 
158
+ $tptn_settings['thumb_meta'] = empty( $_POST['thumb_meta'] ) ? 'post-image' : sanitize_text_field( $_POST['thumb_meta'] );
159
  $tptn_settings['scan_images'] = isset( $_POST['scan_images'] ) ? true : false;
160
  $tptn_settings['thumb_default_show'] = isset( $_POST['thumb_default_show'] ) ? true : false;
161
+ $tptn_settings['thumb_default'] = ( ( '' === esc_url_raw( $_POST['thumb_default'] ) ) || ( '/default.png' === esc_url_raw( $_POST['thumb_default'] ) ) ) ? TOP_TEN_PLUGIN_URL . '/default.png' : esc_url_raw( $_POST['thumb_default'] );
162
 
163
  /* Styles */
164
  $tptn_settings['custom_CSS'] = wp_kses_post( $_POST['custom_CSS'] );
165
 
166
  $tptn_settings['tptn_styles'] = sanitize_text_field( $_POST['tptn_styles'] );
167
 
168
+ if ( 'left_thumbs' === $tptn_settings['tptn_styles'] ) {
169
  $tptn_settings['include_default_style'] = true;
170
  $tptn_settings['post_thumb_op'] = 'inline';
171
+ } elseif ( 'text_only' === $tptn_settings['tptn_styles'] ) {
172
  $tptn_settings['include_default_style'] = false;
173
  $tptn_settings['post_thumb_op'] = 'text_only';
174
  } else {
192
  parse_str( $tptn_settings['post_types'], $post_types );
193
  $posts_types_inc = array_intersect( $wp_post_types, $post_types );
194
 
195
+ // Delete the cache.
196
  tptn_cache_delete();
197
 
198
  /* Echo a success message */
199
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Options saved successfully. If enabled, the cache has been cleared.', 'top-10' ) . '</p>';
200
 
201
+ if ( 'left_thumbs' === $tptn_settings['tptn_styles'] ) {
202
+ $str .= '<p>' . __( 'Left Thumbnails style selected. Post thumbnail location set to Inline before text.', 'top-10' ) . '</p>';
203
  }
204
+ if ( 'text_only' === $tptn_settings['tptn_styles'] ) {
205
+ $str .= '<p>' . __( 'Text Only style selected. Thumbnails will not be displayed.', 'top-10' ) . '</p>';
206
  }
207
+ if ( 'tptn_thumbnail' !== $tptn_settings['thumb_size'] ) {
208
+ $thumb_size = tptn_get_all_image_sizes( $tptn_settings['thumb_size'] );
209
+ $str .= '<p>' . sprintf( __( 'Pre-built thumbnail size selected. Thumbnail set to %1$d x %2$d.', 'top-10' ), $thumb_size['width'], $thumb_size['height'] ) . '</p>';
210
  }
211
 
212
  $str .= '</div>';
221
  update_option( 'ald_tptn_settings', $tptn_settings );
222
  tptn_disable_run();
223
 
224
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Options set to Default.', 'top-10' ) . '</p></div>';
225
  echo $str;
226
  }
227
 
228
  /* Truncate overall posts table */
229
  if ( ( isset( $_POST['tptn_trunc_all'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
230
  tptn_trunc_count( false );
231
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Top 10 popular posts reset', 'top-10' ) . '</p></div>';
232
  echo $str;
233
  }
234
 
235
  /* Truncate daily posts table */
236
  if ( ( isset( $_POST['tptn_trunc_daily'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
237
  tptn_trunc_count( true );
238
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Top 10 daily popular posts reset', 'top-10' ) . '</p></div>';
239
  echo $str;
240
  }
241
 
243
  if ( ( isset( $_POST['tptn_clean_duplicates'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
244
  tptn_clean_duplicates( true );
245
  tptn_clean_duplicates( false );
246
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Duplicate rows cleaned from tables', 'top-10' ) . '</p></div>';
247
  echo $str;
248
  }
249
 
251
  if ( ( isset( $_POST['tptn_merge_blogids'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
252
  tptn_merge_blogids( true );
253
  tptn_merge_blogids( false );
254
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Post counts across blog IDs 0 and 1 have been merged', 'top-10' ) . '</p></div>';
255
  echo $str;
256
  }
257
 
258
  /* Save maintenance options */
259
  if ( ( isset( $_POST['tptn_mnts_save'] ) ) && ( check_admin_referer( 'tptn-plugin-settings' ) ) ) {
260
+ $tptn_settings['cron_hour'] = min( 23, absint( $_POST['cron_hour'] ) );
261
+ $tptn_settings['cron_min'] = min( 59, absint( $_POST['cron_min'] ) );
262
  $tptn_settings['cron_recurrence'] = sanitize_text_field( $_POST['cron_recurrence'] );
263
 
264
  if ( isset( $_POST['cron_on'] ) ) {
265
  $tptn_settings['cron_on'] = true;
266
  tptn_enable_run( $tptn_settings['cron_hour'], $tptn_settings['cron_min'], $tptn_settings['cron_recurrence'] );
267
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Scheduled maintenance enabled / modified', 'top-10' ) . '</p></div>';
268
  } else {
269
  $tptn_settings['cron_on'] = false;
270
  tptn_disable_run();
271
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Scheduled maintenance disabled', 'top-10' ) . '</p></div>';
272
  }
273
  update_option( 'ald_tptn_settings', $tptn_settings );
274
  $tptn_settings = tptn_read_options();
285
  foreach ( $top_ten_mu_tables_sel_blog_ids as $top_ten_mu_tables_sel_blog_id ) {
286
  $sql = '
287
  INSERT INTO ' . $wpdb->base_prefix . "top_ten (postnumber, cntaccess, blog_id)
288
+ SELECT postnumber, cntaccess, '%d' FROM " . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten
289
  ON DUPLICATE KEY UPDATE ' . $wpdb->base_prefix . 'top_ten.cntaccess = ' . $wpdb->base_prefix . 'top_ten.cntaccess + (
290
  SELECT ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten.cntaccess FROM ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten WHERE ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten.postnumber = ' . $wpdb->base_prefix . 'top_ten.postnumber
291
  )
295
 
296
  $sql = '
297
  INSERT INTO ' . $wpdb->base_prefix . "top_ten_daily (postnumber, cntaccess, dp_date, blog_id)
298
+ SELECT postnumber, cntaccess, dp_date, '%d' FROM " . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily
299
  ON DUPLICATE KEY UPDATE ' . $wpdb->base_prefix . 'top_ten_daily.cntaccess = ' . $wpdb->base_prefix . 'top_ten_daily.cntaccess + (
300
  SELECT ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily.cntaccess FROM ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily WHERE ' . $wpdb->base_prefix . $top_ten_mu_tables_sel_blog_id . '_top_ten_daily.postnumber = ' . $wpdb->base_prefix . 'top_ten_daily.postnumber
301
  )
306
 
307
  update_site_option( 'top_ten_mu_tables_sel_blog_ids', array_unique( array_merge( $top_ten_mu_tables_sel_blog_ids, get_site_option( 'top_ten_mu_tables_sel_blog_ids', array() ) ) ) );
308
 
309
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Counts from selected sites have been imported.', 'top-10' ) . '</p></div>';
310
  echo $str;
311
  }
312
 
331
  $sql = substr( $sql, 0, -2 );
332
 
333
  $wpdb->query( $sql );
334
+ $str = '<div id="message" class="updated fade"><p>' . __( 'Selected tables have been deleted. Note that only imported tables have been deleted.', 'top-10' ) . '</p></div>';
335
  echo $str;
336
  }
337
  }
348
  */
349
  function tptn_admin_side() {
350
  ?>
351
+ <div id="donatediv" class="postbox">
352
+ <div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'top-10' ); ?>">
353
+ <br />
354
+ </div>
355
+ <h3 class='hndle'><span><?php esc_html_e( 'Support the development', 'top-10' ); ?></span></h3>
356
+ <div class="inside">
357
+ <div id="donate-form">
358
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
359
+ <input type="hidden" name="cmd" value="_xclick">
360
+ <input type="hidden" name="business" value="donate@ajaydsouza.com">
361
+ <input type="hidden" name="lc" value="IN">
362
+ <input type="hidden" name="item_name" value="<?php esc_attr_e( 'Donation for Top 10', 'top-10' ); ?>">
363
+ <input type="hidden" name="item_number" value="tptn_admin">
364
+ <strong><?php esc_html_e( 'Enter amount in USD:', 'top-10' ); ?></strong>
365
+ <input name="amount" value="10.00" size="6" type="text">
366
+ <br />
367
+ <input type="hidden" name="currency_code" value="USD">
368
+ <input type="hidden" name="button_subtype" value="services">
369
+ <input type="hidden" name="bn" value="PP-BuyNowBF:btn_donate_LG.gif:NonHosted">
370
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="<?php esc_attr_e( 'Send your donation to the author of Top 10', 'top-10' ); ?>">
371
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
372
+ </form>
373
+ </div>
374
  </div>
 
375
  </div>
376
+ <div id="qlinksdiv" class="postbox">
377
+ <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'top-10' ); ?>">
378
+ <br />
 
 
 
379
  </div>
380
+ <h3 class='hndle'><span><?php esc_html_e( 'Quick links', 'top-10' ); ?></span></h3>
381
+ <div class="inside">
382
+ <div id="quick-links">
383
+ <ul>
384
+ <li>
385
+ <a href="https://webberzone.com/" target="_blank">
386
+ WebberZone
387
+ </a>
388
+ </li>
389
+ <li>
390
+ <a href="https://webberzone.com/plugins/top-10/" target="_blank">
391
+ <?php esc_html_e( 'Top 10 plugin page', 'top-10' ); ?>
392
+ </a>
393
+ </li>
394
+ <li>
395
+ <a href="https://github.com/ajaydsouza/top-10" target="_blank">
396
+ <?php esc_html_e( 'Top 10 Github page', 'top-10' ); ?>
397
+ </a>
398
+ </li>
399
+ <li>
400
+ <a href="https://wordpress.org/plugins/top-10/faq/" target="_blank">
401
+ <?php esc_html_e( 'FAQ', 'top-10' ); ?>
402
+ </a>
403
+ </li>
404
+ <li>
405
+ <a href="https://wordpress.org/support/plugin/top-10" target="_blank">
406
+ <?php esc_html_e( 'Support', 'top-10' ); ?>
407
+ </a>
408
+ </li>
409
+ <li>
410
+ <a href="https://wordpress.org/support/view/plugin-reviews/top-10" target="_blank">
411
+ <?php esc_html_e( 'Reviews', 'top-10' ); ?>
412
+ </a>
413
+ </li>
414
+ <li>
415
+ <a href="https://ajaydsouza.com/" target="_blank">
416
+ <?php esc_html_e( "Ajay's blog", 'top-10' ); ?>
417
+ </a>
418
+ </li>
419
+ <li>
420
+ <a href="https://webberzone.com/plugins/" target="_blank">
421
+ <?php esc_html_e( 'Other plugins', 'top-10' ); ?>
422
+ </a>
423
+ </li>
424
+ </ul>
425
+ </div>
426
  </div>
 
427
  </div>
428
+ <div id="followdiv" class="postbox">
429
+ <div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'top-10' ); ?>">
430
+ <br />
431
+ </div>
432
+ <h3 class='hndle'><span><?php esc_html_e( 'Follow us', 'top-10' ); ?></span></h3>
433
+ <div class="inside">
434
+ <a href="https://facebook.com/webberzone/" target="_blank"><img src="<?php echo esc_url( TOP_TEN_PLUGIN_URL . '/admin/images/fb.png' ); ?>" width="100" height="100" /></a>
435
+ <a href="https://twitter.com/webberzonewp/" target="_blank"><img src="<?php echo esc_url( TOP_TEN_PLUGIN_URL . '/admin/images/twitter.jpg' ); ?>" width="100" height="100" /></a>
 
 
 
 
 
436
  </div>
 
437
  </div>
438
 
439
+ <?php
440
  }
441
 
442
 
448
  function tptn_adminmenu() {
449
 
450
  $plugin_page = add_menu_page( __( 'Top 10 Settings', 'top-10' ), __( 'Top 10', 'top-10' ), 'manage_options', 'tptn_options', 'tptn_options', 'dashicons-editor-ol' );
451
+ add_action( 'admin_head-' . $plugin_page, 'tptn_adminhead' );
452
 
453
  $plugin_page = add_submenu_page( 'tptn_options', __( 'Top 10 Settings', 'top-10' ), __( 'Top 10 Settings', 'top-10' ), 'manage_options', 'tptn_options', 'tptn_options' );
454
+ add_action( 'admin_head-' . $plugin_page, 'tptn_adminhead' );
455
 
456
  $tptn_stats_screen = new Top_Ten_Statistics;
457
 
458
  $plugin_page = add_submenu_page( 'tptn_options', __( 'View Popular Posts', 'top-10' ), __( 'View Popular Posts', 'top-10' ), 'manage_options', 'tptn_popular_posts', array( $tptn_stats_screen, 'plugin_settings_page' ) );
459
  add_action( "load-$plugin_page", array( $tptn_stats_screen, 'screen_option' ) );
460
+ add_action( 'admin_head-' . $plugin_page, 'tptn_adminhead' );
461
 
462
  $plugin_page = add_submenu_page( 'tptn_options', __( 'Daily Popular Posts', 'top-10' ), __( 'Daily Popular Posts', 'top-10' ), 'manage_options', 'tptn_popular_posts&orderby=daily_count&order=desc', array( $tptn_stats_screen, 'plugin_settings_page' ) );
463
  add_action( "load-$plugin_page", array( $tptn_stats_screen, 'screen_option' ) );
464
+ add_action( 'admin_head-' . $plugin_page, 'tptn_adminhead' );
465
 
466
  }
467
  add_action( 'admin_menu', 'tptn_adminmenu' );
478
  wp_enqueue_script( 'wp-lists' );
479
  wp_enqueue_script( 'postbox' );
480
  wp_enqueue_script( 'plugin-install' );
481
+ wp_enqueue_script( 'suggest' );
482
 
483
  add_thickbox();
484
 
485
  ?>
486
+ <style type="text/css">
487
+ .postbox .handlediv:before {
488
+ right: 12px;
489
+ font: 400 20px/1 dashicons;
490
+ speak: none;
491
+ display: inline-block;
492
+ top: 0;
493
+ position: relative;
494
+ -webkit-font-smoothing: antialiased;
495
+ -moz-osx-font-smoothing: grayscale;
496
+ text-decoration: none!important;
497
+ content: '\f142';
498
+ padding: 8px 10px;
499
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
501
+ .postbox.closed .handlediv:before {
502
+ content: '\f140';
 
 
503
  }
 
 
504
 
505
+ .wrap h2:before {
506
+ content: "\f204";
507
+ display: inline-block;
508
+ -webkit-font-smoothing: antialiased;
509
+ font: normal 29px/1 'dashicons';
510
+ vertical-align: middle;
511
+ margin-right: 0.3em;
512
+ }
513
+ </style>
514
 
515
+ <script type="text/javascript">
516
+ //<![CDATA[
517
+ jQuery(document).ready(function ($) {
518
+ // close postboxes that should be closed
519
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
520
+ // postboxes setup
521
+ postboxes.add_postbox_toggles('tptn_options');
522
+ });
523
+
524
+ // Function to add auto suggest.
525
+ function setSuggest( id, taxonomy ) {
526
+ jQuery('#' + id).suggest("<?php echo admin_url( 'admin-ajax.php?action=ajax-tag-search&tax=' ); ?>" + taxonomy, {multiple:true, multipleSep: ","});
527
+ }
528
+
529
+ // Function check the form submission.
530
+ function checkForm() {
531
+ answer = true;
532
+ if (siw && siw.selectingSomething)
533
+ answer = false;
534
+ return answer;
535
+ } //
536
+
537
+ // Function to clear the cache.
538
+ function clearCache() {
539
+ /**** since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php ****/
540
+ jQuery.post(ajaxurl, {
541
+ action: 'tptn_clear_cache'
542
+ }, function (response, textStatus, jqXHR) {
543
+ alert(response.message);
544
+ }, 'json');
545
+ }
546
+ //]]>
547
+ </script>
548
 
549
+ <?php
550
  }
551
 
552
 
555
  *
556
  * @version 1.9.2
557
  *
558
+ * @param array $links Action links.
559
+ * @return array Links array with our settings link added.
560
  */
561
  function tptn_plugin_actions_links( $links ) {
562
 
576
  *
577
  * @since 1.5
578
  *
579
+ * @param array $links Action links.
580
+ * @param array $file Plugin file name.
581
  * @return array Links array with our links added
582
  */
583
  function tptn_plugin_actions( $links, $file ) {
584
  $plugin = plugin_basename( TOP_TEN_PLUGIN_FILE );
585
 
 
586
  if ( $file == $plugin ) {
587
+ $links[] = '<a href="https://wordpress.org/support/plugin/top-10/">' . __( 'Support', 'top-10' ) . '</a>';
588
  $links[] = '<a href="https://ajaydsouza.com/donate/">' . __( 'Donate', 'top-10' ) . '</a>';
589
+ $links[] = '<a href="https://github.com/WebberZone/top-10">' . __( 'Contribute', 'contextual-related-posts' ) . '</a>';
590
  }
591
  return $links;
592
  }
593
+ add_filter( 'plugin_row_meta', 'tptn_plugin_actions', 10, 2 );
594
 
595
 
596
  /**
598
  *
599
  * @since 1.6.2
600
  *
601
+ * @param bool $daily Daily flag.
602
  */
603
  function tptn_clean_duplicates( $daily = false ) {
604
  global $wpdb;
631
 
632
  if ( $daily ) {
633
  $wpdb->query( "
634
+ INSERT INTO `$table_name` (postnumber, cntaccess, dp_date, blog_id) (
635
+ SELECT
636
+ postnumber,
637
+ SUM(cntaccess) as sumCount,
638
+ dp_date,
639
+ 1
640
+ FROM `$table_name`
641
+ WHERE blog_ID IN (0,1)
642
+ GROUP BY postnumber, dp_date
643
+ ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
644
+ " );
645
  } else {
646
  $wpdb->query( "
647
+ INSERT INTO `$table_name` (postnumber, cntaccess, blog_id) (
648
+ SELECT
649
+ postnumber,
650
+ SUM(cntaccess) as sumCount,
651
+ 1
652
+ FROM `$table_name`
653
+ WHERE blog_ID IN (0,1)
654
+ GROUP BY postnumber
655
+ ) ON DUPLICATE KEY UPDATE cntaccess = VALUES(cntaccess);
656
+ " );
657
  }
658
 
659
  $wpdb->query( "DELETE FROM $table_name WHERE blog_id = 0" );
660
  }
 
admin/cache.php CHANGED
@@ -14,7 +14,7 @@ function tptn_ajax_clearcache() {
14
 
15
  tptn_cache_delete();
16
 
17
- exit( json_encode( array(
18
  'success' => 1,
19
  'message' => __( 'Top 10 cache has been cleared', 'top-10' ),
20
  ) ) );
@@ -56,7 +56,7 @@ function tptn_cache_get_keys() {
56
  /**
57
  * Delete the Top 10 cache.
58
  *
59
- * @param array $transients
60
  */
61
  function tptn_cache_delete( $transients = array() ) {
62
 
@@ -92,7 +92,7 @@ function tptn_cache_get_widget_keys() {
92
  WHERE `option_name` LIKE '_transient_tptn_%_widget%'
93
  ";
94
 
95
- $results = $wpdb->get_results( $sql );
96
 
97
  if ( is_array( $results ) ) {
98
  foreach ( $results as $result ) {
14
 
15
  tptn_cache_delete();
16
 
17
+ exit( wp_json_encode( array(
18
  'success' => 1,
19
  'message' => __( 'Top 10 cache has been cleared', 'top-10' ),
20
  ) ) );
56
  /**
57
  * Delete the Top 10 cache.
58
  *
59
+ * @param array $transients Array of transients to delete.
60
  */
61
  function tptn_cache_delete( $transients = array() ) {
62
 
92
  WHERE `option_name` LIKE '_transient_tptn_%_widget%'
93
  ";
94
 
95
+ $results = $wpdb->get_results( $sql ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
96
 
97
  if ( is_array( $results ) ) {
98
  foreach ( $results as $result ) {
admin/class-stats.php CHANGED
@@ -20,7 +20,6 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
20
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
21
  }
22
 
23
-
24
  /**
25
  * Top_Ten_Statistics_Table class.
26
  *
@@ -33,18 +32,17 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
33
  */
34
  public function __construct() {
35
  parent::__construct( array(
36
- 'singular' => __( 'popular_post', 'top-10' ), // singular name of the listed records
37
- 'plural' => __( 'popular_posts', 'top-10' ), // plural name of the listed records
38
- // 'ajax' => false //does this table support ajax?
39
  ) );
40
  }
41
 
42
  /**
43
  * Retrieve the Top 10 posts
44
  *
45
- * @param int $per_page
46
- * @param int $page_number
47
- * @param string $search
48
  *
49
  * @return array Array of popular posts
50
  */
@@ -68,7 +66,7 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
68
  $table_name_daily = $wpdb->base_prefix . 'top_ten_daily AS ttd';
69
  $table_name = $wpdb->base_prefix . 'top_ten AS ttt';
70
 
71
- // Fields to return
72
  $fields[] = 'ID';
73
  $fields[] = 'post_title as title';
74
  $fields[] = 'post_type';
@@ -79,18 +77,19 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
79
 
80
  $fields = implode( ', ', $fields );
81
 
82
- // Create the JOIN clause
83
  $join = " INNER JOIN {$wpdb->posts} ON ttt.postnumber=ID ";
84
- $join .= $wpdb->prepare( " LEFT JOIN (
 
85
  SELECT * FROM {$table_name_daily}
86
  WHERE ttd.dp_date >= '%s'
87
  ) AS ttd
88
  ON ttt.postnumber=ttd.postnumber
89
  ", $from_date );
90
 
91
- // Create the base WHERE clause
92
- $where = $wpdb->prepare( ' AND ttt.blog_id = %d ', $blog_id ); // Posts need to be from the current blog only
93
- $where .= " AND $wpdb->posts.post_status = 'publish' "; // Only show published posts
94
 
95
  /* If search argument is set, do a search for it. */
96
  if ( isset( $args['search'] ) ) {
@@ -98,21 +97,21 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
98
  }
99
 
100
  /* If post filter argument is set, do a search for it. */
101
- if ( isset( $args['post-type-filter'] ) && $args['post-type-filter'] != 'All' ) {
102
  $where .= $wpdb->prepare( " AND $wpdb->posts.post_type = '%s' ", $args['post-type-filter'] );
103
  }
104
 
105
- // Create the base GROUP BY clause
106
  $groupby = ' ID ';
107
 
108
  // Create the base ORDER BY clause.
109
  $orderby = ' total_count DESC ';
110
 
111
- if ( ! empty( $_REQUEST['orderby'] ) ) {
112
- $orderby = esc_sql( $_REQUEST['orderby'] );
113
 
114
  if ( ! empty( $_REQUEST['order'] ) ) {
115
- $order = esc_sql( $_REQUEST['order'] );
116
 
117
  if ( in_array( $order, array( 'asc', 'ASC', 'desc', 'DESC' ) ) ) {
118
  $orderby .= ' ' . $order;
@@ -122,7 +121,7 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
122
  }
123
  }
124
 
125
- // Create the base LIMITS clause
126
  $limits = $wpdb->prepare( ' LIMIT %d, %d ', ( $page_number - 1 ) * $per_page, $per_page );
127
 
128
  if ( ! empty( $groupby ) ) {
@@ -144,7 +143,7 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
144
  /**
145
  * Delete the post count for this post.
146
  *
147
- * @param int $id post ID
148
  */
149
  public static function delete_post_count( $id ) {
150
  global $wpdb;
@@ -164,7 +163,8 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
164
  /**
165
  * Returns the count of records in the database.
166
  *
167
- * @return null|string
 
168
  */
169
  public static function record_count( $args = null ) {
170
  global $wpdb;
@@ -173,14 +173,14 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
173
  SELECT COUNT(*) FROM {$wpdb->base_prefix}top_ten as ttt
174
  INNER JOIN {$wpdb->posts} ON ttt.postnumber=ID
175
  WHERE blog_id=%d
176
- AND $wpdb->posts.post_status = 'publish'
177
  ", get_current_blog_id() );
178
 
179
  if ( isset( $args['search'] ) ) {
180
  $sql .= $wpdb->prepare( " AND $wpdb->posts.post_title LIKE '%%%s%%' ", $args['search'] );
181
  }
182
 
183
- if ( isset( $args['post-type-filter'] ) && $args['post-type-filter'] != 'All' ) {
184
  $sql .= $wpdb->prepare( " AND $wpdb->posts.post_type = '%s' ", $args['post-type-filter'] );
185
  }
186
 
@@ -191,15 +191,15 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
191
  * Text displayed when no post data is available
192
  */
193
  public function no_items() {
194
- _e( 'No popular posts available.', 'top-10' );
195
  }
196
 
197
 
198
  /**
199
  * Render a column when no column specific method exist.
200
  *
201
- * @param array $item
202
- * @param string $column_name
203
  *
204
  * @return mixed
205
  */
@@ -211,28 +211,28 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
211
  case 'daily_count':
212
  return intval( $item[ $column_name ] );
213
  default:
214
- return print_r( $item, true ); // Show the whole array for troubleshooting purposes
215
  }
216
  }
217
 
218
  /**
219
  * Render the checkbox column.
220
  *
221
- * @param array $item
222
  * @return string
223
  */
224
  function column_cb( $item ) {
225
  return sprintf(
226
  '<input type="checkbox" name="%1$s[]" value="%2$s" />',
227
- /*$1%s*/ 'bulk-delete', // Let's simply repurpose the table's singular label ("movie")
228
- /*$2%s*/ $item['ID'] // The value of the checkbox should be the record's id
229
  );
230
  }
231
 
232
  /**
233
  * Render the title column.
234
  *
235
- * @param array $item
236
  * @return string
237
  */
238
  function column_title( $item ) {
@@ -245,12 +245,12 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
245
  'delete' => sprintf( '<a href="?page=%s&action=%s&post=%s&_wpnonce=%s">' . __( 'Delete', 'top-10' ) . '</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['ID'] ), $delete_nonce ),
246
  );
247
 
248
- // Return the title contents
249
  return sprintf( '<a href="%4$s">%1$s</a> <span style="color:silver">(id:%2$s)</span>%3$s',
250
- /*$1%s*/ $item['title'],
251
- /*$2%s*/ $item['ID'],
252
- /*$3%s*/ $this->row_actions( $actions ),
253
- /*$3%s*/ get_edit_post_link( $item['ID'] )
254
  );
255
 
256
  }
@@ -259,8 +259,8 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
259
  /**
260
  * Handles the post date column output.
261
  *
262
- * @param array $item
263
- * @return string
264
  */
265
  public function column_date( $item ) {
266
 
@@ -276,25 +276,25 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
276
  $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
277
  }
278
 
279
- echo '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
280
  }
281
 
282
  /**
283
  * Handles the post author column output.
284
  *
285
- * @param array $item
286
- * @return string
287
  */
288
  public function column_author( $item ) {
289
  $author_info = get_userdata( $item['post_author'] );
290
- $author_name = ucwords( trim( stripslashes( $author_info->display_name ) ) );
291
 
292
  printf( '<a href="%s">%s</a>',
293
  esc_url( add_query_arg( array(
294
  'post_type' => $item['post_type'],
295
- 'author' => $author_info->ID,
296
  ), 'edit.php' ) ),
297
- $author_name
298
  );
299
  }
300
 
@@ -352,6 +352,8 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
352
 
353
  /**
354
  * Handles data query and filter, sorting, and pagination.
 
 
355
  */
356
  public function prepare_items( $args = null ) {
357
 
@@ -385,19 +387,19 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
385
  // In our file that handles the request, verify the nonce.
386
  $nonce = esc_attr( $_REQUEST['_wpnonce'] );
387
  if ( ! wp_verify_nonce( $nonce, 'tptn_delete_entry' ) ) {
388
- die( __( 'Are you sure you want to do this', 'top-10' ) );
389
  } else {
390
  self::delete_post_count( absint( $_GET['post'] ) );
391
  }
392
  }
393
 
394
- // If the delete bulk action is triggered
395
- if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'bulk-delete' )
396
- || ( isset( $_POST['action2'] ) && $_POST['action2'] == 'bulk-delete' )
397
  ) {
398
- $delete_ids = esc_sql( $_POST['bulk-delete'] );
399
 
400
- // loop over the array of record IDs and delete them
401
  foreach ( $delete_ids as $id ) {
402
  self::delete_post_count( $id );
403
  }
@@ -407,7 +409,7 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
407
  /**
408
  * Adds extra navigation elements to the table.
409
  *
410
- * @param string $which
411
  */
412
  public function extra_tablenav( $which ) {
413
  ?>
@@ -426,11 +428,11 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
426
 
427
  foreach ( $post_types as $post_type ) {
428
  $selected = '';
429
- if ( isset( $_REQUEST['post-type-filter'] ) && $_REQUEST['post-type-filter'] == $post_type ) {
430
  $selected = ' selected = "selected"';
431
  }
432
  ?>
433
- <option value="<?php echo $post_type; ?>" <?php echo $selected; ?>><?php echo $post_type; ?></option>
434
  <?php
435
  }
436
 
@@ -450,10 +452,14 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
450
  */
451
  class Top_Ten_Statistics {
452
 
453
- // class instance
 
 
454
  static $instance;
455
 
456
- // WP_List_Table object
 
 
457
  public $pop_posts_obj;
458
 
459
  /**
@@ -466,6 +472,14 @@ class Top_Ten_Statistics {
466
  add_filter( 'set-screen-option', array( __CLASS__, 'set_screen' ), 10, 3 );
467
  }
468
 
 
 
 
 
 
 
 
 
469
  public static function set_screen( $status, $option, $value ) {
470
  return $value;
471
  }
@@ -484,15 +498,15 @@ class Top_Ten_Statistics {
484
  <div id="post-body-content">
485
  <div class="meta-box-sortables ui-sortable">
486
  <form method="get">
487
- <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ) ?>" />
488
  <?php
489
  // If this is a search?
490
  if ( isset( $_REQUEST['s'] ) ) {
491
- $args['search'] = esc_sql( $_REQUEST['s'] );
492
  }
493
  // If this is a post type filter?
494
  if ( isset( $_REQUEST['post-type-filter'] ) ) {
495
- $args['post-type-filter'] = esc_sql( $_REQUEST['post-type-filter'] );
496
  }
497
 
498
  $this->pop_posts_obj->prepare_items( $args );
@@ -539,3 +553,6 @@ class Top_Ten_Statistics {
539
  }
540
  }
541
 
 
 
 
20
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
21
  }
22
 
 
23
  /**
24
  * Top_Ten_Statistics_Table class.
25
  *
32
  */
33
  public function __construct() {
34
  parent::__construct( array(
35
+ 'singular' => __( 'popular_post', 'top-10' ), // Singular name of the listed records.
36
+ 'plural' => __( 'popular_posts', 'top-10' ), // plural name of the listed records.
 
37
  ) );
38
  }
39
 
40
  /**
41
  * Retrieve the Top 10 posts
42
  *
43
+ * @param int $per_page Posts per page.
44
+ * @param int $page_number Page number.
45
+ * @param array $args Array of arguments.
46
  *
47
  * @return array Array of popular posts
48
  */
66
  $table_name_daily = $wpdb->base_prefix . 'top_ten_daily AS ttd';
67
  $table_name = $wpdb->base_prefix . 'top_ten AS ttt';
68
 
69
+ // Fields to return.
70
  $fields[] = 'ID';
71
  $fields[] = 'post_title as title';
72
  $fields[] = 'post_type';
77
 
78
  $fields = implode( ', ', $fields );
79
 
80
+ // Create the JOIN clause.
81
  $join = " INNER JOIN {$wpdb->posts} ON ttt.postnumber=ID ";
82
+ $join .= $wpdb->prepare( // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
83
+ " LEFT JOIN (
84
  SELECT * FROM {$table_name_daily}
85
  WHERE ttd.dp_date >= '%s'
86
  ) AS ttd
87
  ON ttt.postnumber=ttd.postnumber
88
  ", $from_date );
89
 
90
+ // Create the base WHERE clause.
91
+ $where = $wpdb->prepare( ' AND ttt.blog_id = %d ', $blog_id ); // Posts need to be from the current blog only.
92
+ $where .= " AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'inherit') "; // Show published posts and attachments.
93
 
94
  /* If search argument is set, do a search for it. */
95
  if ( isset( $args['search'] ) ) {
97
  }
98
 
99
  /* If post filter argument is set, do a search for it. */
100
+ if ( isset( $args['post-type-filter'] ) && 'All' !== $args['post-type-filter'] ) {
101
  $where .= $wpdb->prepare( " AND $wpdb->posts.post_type = '%s' ", $args['post-type-filter'] );
102
  }
103
 
104
+ // Create the base GROUP BY clause.
105
  $groupby = ' ID ';
106
 
107
  // Create the base ORDER BY clause.
108
  $orderby = ' total_count DESC ';
109
 
110
+ if ( ! empty( $_REQUEST['orderby'] ) ) { // Input var okay.
111
+ $orderby = sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) );
112
 
113
  if ( ! empty( $_REQUEST['order'] ) ) {
114
+ $order = sanitize_text_field( wp_unslash( $_REQUEST['order'] ) );
115
 
116
  if ( in_array( $order, array( 'asc', 'ASC', 'desc', 'DESC' ) ) ) {
117
  $orderby .= ' ' . $order;
121
  }
122
  }
123
 
124
+ // Create the base LIMITS clause.
125
  $limits = $wpdb->prepare( ' LIMIT %d, %d ', ( $page_number - 1 ) * $per_page, $per_page );
126
 
127
  if ( ! empty( $groupby ) ) {
143
  /**
144
  * Delete the post count for this post.
145
  *
146
+ * @param int $id post ID.
147
  */
148
  public static function delete_post_count( $id ) {
149
  global $wpdb;
163
  /**
164
  * Returns the count of records in the database.
165
  *
166
+ * @param string $args Array of arguments.
167
+ * @return null|string null|string
168
  */
169
  public static function record_count( $args = null ) {
170
  global $wpdb;
173
  SELECT COUNT(*) FROM {$wpdb->base_prefix}top_ten as ttt
174
  INNER JOIN {$wpdb->posts} ON ttt.postnumber=ID
175
  WHERE blog_id=%d
176
+ AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'inherit')
177
  ", get_current_blog_id() );
178
 
179
  if ( isset( $args['search'] ) ) {
180
  $sql .= $wpdb->prepare( " AND $wpdb->posts.post_title LIKE '%%%s%%' ", $args['search'] );
181
  }
182
 
183
+ if ( isset( $args['post-type-filter'] ) && 'All' !== $args['post-type-filter'] ) {
184
  $sql .= $wpdb->prepare( " AND $wpdb->posts.post_type = '%s' ", $args['post-type-filter'] );
185
  }
186
 
191
  * Text displayed when no post data is available
192
  */
193
  public function no_items() {
194
+ esc_html_e( 'No popular posts available.', 'top-10' );
195
  }
196
 
197
 
198
  /**
199
  * Render a column when no column specific method exist.
200
  *
201
+ * @param array $item Current item.
202
+ * @param string $column_name Column name.
203
  *
204
  * @return mixed
205
  */
211
  case 'daily_count':
212
  return intval( $item[ $column_name ] );
213
  default:
214
+ return print_r( $item, true ); // Show the whole array for troubleshooting purposes.
215
  }
216
  }
217
 
218
  /**
219
  * Render the checkbox column.
220
  *
221
+ * @param array $item Current item.
222
  * @return string
223
  */
224
  function column_cb( $item ) {
225
  return sprintf(
226
  '<input type="checkbox" name="%1$s[]" value="%2$s" />',
227
+ 'bulk-delete',
228
+ $item['ID']
229
  );
230
  }
231
 
232
  /**
233
  * Render the title column.
234
  *
235
+ * @param array $item Current item.
236
  * @return string
237
  */
238
  function column_title( $item ) {
245
  'delete' => sprintf( '<a href="?page=%s&action=%s&post=%s&_wpnonce=%s">' . __( 'Delete', 'top-10' ) . '</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['ID'] ), $delete_nonce ),
246
  );
247
 
248
+ // Return the title contents.
249
  return sprintf( '<a href="%4$s">%1$s</a> <span style="color:silver">(id:%2$s)</span>%3$s',
250
+ $item['title'],
251
+ $item['ID'],
252
+ $this->row_actions( $actions ),
253
+ get_edit_post_link( $item['ID'] )
254
  );
255
 
256
  }
259
  /**
260
  * Handles the post date column output.
261
  *
262
+ * @param array $item Current item.
263
+ * @return void
264
  */
265
  public function column_date( $item ) {
266
 
276
  $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
277
  }
278
 
279
+ echo '<abbr title="' . esc_attr( $t_time ) . '">' . esc_attr( $h_time ) . '</abbr>';
280
  }
281
 
282
  /**
283
  * Handles the post author column output.
284
  *
285
+ * @param array $item Current item.
286
+ * @return void
287
  */
288
  public function column_author( $item ) {
289
  $author_info = get_userdata( $item['post_author'] );
290
+ $author_name = ( false === $author_info ) ? '' : ucwords( trim( stripslashes( $author_info->display_name ) ) );
291
 
292
  printf( '<a href="%s">%s</a>',
293
  esc_url( add_query_arg( array(
294
  'post_type' => $item['post_type'],
295
+ 'author' => ( false === $author_info ) ? 0 : $author_info->ID,
296
  ), 'edit.php' ) ),
297
+ esc_html( $author_name )
298
  );
299
  }
300
 
352
 
353
  /**
354
  * Handles data query and filter, sorting, and pagination.
355
+ *
356
+ * @param array $args Array of arguments.
357
  */
358
  public function prepare_items( $args = null ) {
359
 
387
  // In our file that handles the request, verify the nonce.
388
  $nonce = esc_attr( $_REQUEST['_wpnonce'] );
389
  if ( ! wp_verify_nonce( $nonce, 'tptn_delete_entry' ) ) {
390
+ die( esc_html__( 'Are you sure you want to do this', 'top-10' ) );
391
  } else {
392
  self::delete_post_count( absint( $_GET['post'] ) );
393
  }
394
  }
395
 
396
+ // If the delete bulk action is triggered.
397
+ if ( ( isset( $_REQUEST['action'] ) && 'bulk-delete' === $_REQUEST['action'] )
398
+ || ( isset( $_REQUEST['action2'] ) && 'bulk-delete' === $_REQUEST['action2'] )
399
  ) {
400
+ $delete_ids = sanitize_text_field( wp_unslash( $_REQUEST['bulk-delete'] ) );
401
 
402
+ // Loop over the array of record IDs and delete them,
403
  foreach ( $delete_ids as $id ) {
404
  self::delete_post_count( $id );
405
  }
409
  /**
410
  * Adds extra navigation elements to the table.
411
  *
412
+ * @param string $which Which part of the table are we.
413
  */
414
  public function extra_tablenav( $which ) {
415
  ?>
428
 
429
  foreach ( $post_types as $post_type ) {
430
  $selected = '';
431
+ if ( isset( $_REQUEST['post-type-filter'] ) && $_REQUEST['post-type-filter'] === $post_type ) {
432
  $selected = ' selected = "selected"';
433
  }
434
  ?>
435
+ <option value="<?php echo esc_attr( $post_type ); ?>" <?php echo esc_attr( $selected ); ?>><?php echo esc_attr( $post_type ); ?></option>
436
  <?php
437
  }
438
 
452
  */
453
  class Top_Ten_Statistics {
454
 
455
+ /**
456
+ * Class instance.
457
+ */
458
  static $instance;
459
 
460
+ /**
461
+ * WP_List_Table object.
462
+ */
463
  public $pop_posts_obj;
464
 
465
  /**
472
  add_filter( 'set-screen-option', array( __CLASS__, 'set_screen' ), 10, 3 );
473
  }
474
 
475
+ /**
476
+ * Set screen.
477
+ *
478
+ * @param string $status Status of screen.
479
+ * @param string $option Option name.
480
+ * @param string $value Option value
481
+ * @return string Value.
482
+ */
483
  public static function set_screen( $status, $option, $value ) {
484
  return $value;
485
  }
498
  <div id="post-body-content">
499
  <div class="meta-box-sortables ui-sortable">
500
  <form method="get">
501
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ) ?>" />
502
  <?php
503
  // If this is a search?
504
  if ( isset( $_REQUEST['s'] ) ) {
505
+ $args['search'] = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) );
506
  }
507
  // If this is a post type filter?
508
  if ( isset( $_REQUEST['post-type-filter'] ) ) {
509
+ $args['post-type-filter'] = sanitize_text_field( wp_unslash( $_REQUEST['post-type-filter'] ) );
510
  }
511
 
512
  $this->pop_posts_obj->prepare_items( $args );
553
  }
554
  }
555
 
556
+ add_action( 'plugins_loaded', function () {
557
+ Top_Ten_Statistics::get_instance();
558
+ } );
admin/deprecated.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Top_Ten
8
  */
9
 
10
-
11
  /**
12
  * Function to generate the top 10 daily popular posts page.
13
  *
@@ -25,7 +24,7 @@ function tptn_manage_daily() {
25
  * @since 1.3
26
  * @deprecated 2.2.0
27
  *
28
- * @param int $daily Overall popular
29
  */
30
  function tptn_manage( $daily = 0 ) {
31
 
@@ -37,26 +36,32 @@ function tptn_manage( $daily = 0 ) {
37
 
38
  <div class="wrap">
39
  <h2>
40
- <?php if ( ! $daily ) {
41
- _e( 'Popular Posts', 'top-10' );
42
  } else {
43
- _e( 'Daily Popular Posts', 'top-10' );
44
  } ?>
45
  </h2>
46
  <div id="poststuff">
47
- <div id="post-body" class="metabox-holder columns-2">
48
- <div id="post-body-content">
49
- <?php echo tptn_pop_display( $daily, $paged, $limit, false ); ?>
50
- </div><!-- /post-body-content -->
51
- <div id="postbox-container-1" class="postbox-container">
52
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
53
- <?php tptn_admin_side(); ?>
54
- </div><!-- /side-sortables -->
55
- </div><!-- /postbox-container-1 -->
56
- </div><!-- /post-body -->
57
- <br class="clear" />
58
- </div><!-- /poststuff -->
59
- </div><!-- /wrap -->
 
 
 
 
 
 
60
 
61
  <?php
62
  }
7
  * @package Top_Ten
8
  */
9
 
 
10
  /**
11
  * Function to generate the top 10 daily popular posts page.
12
  *
24
  * @since 1.3
25
  * @deprecated 2.2.0
26
  *
27
+ * @param int $daily Overall popular.
28
  */
29
  function tptn_manage( $daily = 0 ) {
30
 
36
 
37
  <div class="wrap">
38
  <h2>
39
+ <?php if ( ! $daily ) {
40
+ esc_html_e( 'Popular Posts', 'top-10' );
41
  } else {
42
+ esc_html_e( 'Daily Popular Posts', 'top-10' );
43
  } ?>
44
  </h2>
45
  <div id="poststuff">
46
+ <div id="post-body" class="metabox-holder columns-2">
47
+ <div id="post-body-content">
48
+ <?php echo tptn_pop_display( $daily, $paged, $limit, false ); ?>
49
+ </div>
50
+ <!-- /post-body-content -->
51
+ <div id="postbox-container-1" class="postbox-container">
52
+ <div id="side-sortables" class="meta-box-sortables ui-sortable">
53
+ <?php tptn_admin_side(); ?>
54
+ </div>
55
+ <!-- /side-sortables -->
56
+ </div>
57
+ <!-- /postbox-container-1 -->
58
+ </div>
59
+ <!-- /post-body -->
60
+ <br class="clear" />
61
+ </div>
62
+ <!-- /poststuff -->
63
+ </div>
64
+ <!-- /wrap -->
65
 
66
  <?php
67
  }
admin/images/fb.png ADDED
Binary file
admin/images/twitter.jpg ADDED
Binary file
admin/main-view.php CHANGED
@@ -19,7 +19,7 @@ if ( ! defined( 'WPINC' ) ) {
19
  ?>
20
 
21
  <div class="wrap">
22
- <h2><?php _e( 'Top 10 Settings', 'top-10' ); ?></h2>
23
 
24
  <ul class="subsubsub">
25
  <?php
@@ -31,12 +31,12 @@ if ( ! defined( 'WPINC' ) ) {
31
  do_action( 'tptn_admin_nav_bar_before' )
32
  ?>
33
 
34
- <li><a href="#genopdiv"><?php _e( 'General options', 'top-10' ); ?></a> | </li>
35
- <li><a href="#counteropdiv"><?php _e( 'Counter and tracker options', 'top-10' ); ?></a> | </li>
36
- <li><a href="#pplopdiv"><?php _e( 'Popular post list options', 'top-10' ); ?></a> | </li>
37
- <li><a href="#thumbopdiv"><?php _e( 'Thumbnail options', 'top-10' ); ?></a> | </li>
38
- <li><a href="#customcssdiv"><?php _e( 'Styles', 'top-10' ); ?></a> | </li>
39
- <li><a href="#tptn_maintenance_op"><?php _e( 'Maintenance', 'top-10' ); ?></a></li>
40
 
41
  <?php
42
  /**
@@ -52,8 +52,8 @@ if ( ! defined( 'WPINC' ) ) {
52
  <div id="post-body" class="metabox-holder columns-2">
53
  <div id="post-body-content">
54
  <form method="post" id="tptn_options" name="tptn_options" onsubmit="return checkForm()">
55
- <div id="genopdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
56
- <h3 class='hndle'><span><?php _e( 'General options', 'top-10' ); ?></span></h3>
57
  <div class="inside">
58
  <table class="form-table">
59
 
@@ -69,91 +69,84 @@ if ( ! defined( 'WPINC' ) ) {
69
  ?>
70
 
71
  <tr>
72
- <th scope="row"><?php _e( 'Enable trackers:', 'top-10' ); ?></th>
73
  <td>
74
  <p>
75
  <label>
76
- <input type="checkbox" name="activate_overall" id="activate_overall" <?php if ( $tptn_settings['activate_overall'] ) { echo 'checked="checked"'; } ?> />
77
- <?php _e( 'Overall', 'top-10' ); ?>
78
  </label>
79
  </p>
80
  <p>
81
  <label>
82
- <input type="checkbox" name="activate_daily" id="activate_daily" <?php if ( $tptn_settings['activate_daily'] ) { echo 'checked="checked"'; } ?> />
83
- <?php _e( 'Daily', 'top-10' ); ?>
84
  </label>
85
  </p>
86
  </td>
87
  </tr>
88
  <tr>
89
- <th scope="row"><label for="cache_fix"><?php _e( 'Use Ajax for tracking:', 'top-10' ); ?></label></th>
90
  <td>
91
- <input type="checkbox" name="cache_fix" id="cache_fix" <?php if ( $tptn_settings['cache_fix'] ) { echo 'checked="checked"'; } ?> />
92
- <p class="description"><?php _e( 'This will try to prevent W3 Total Cache and other caching plugins from caching the tracker script of the plugin. Try toggling this option in case you find that your posts are not tracked.', 'top-10' ); ?></p>
 
93
  </td>
94
  </tr>
95
  <tr>
96
- <th scope="row"><label for="cache"><?php _e( 'Enable cache:', 'top-10' ); ?></label></th>
97
  <td>
98
- <p><input type="checkbox" name="cache" id="cache" <?php if ( $tptn_settings['cache'] ) { echo 'checked="checked"'; } ?> /></p>
99
- <p class="description"><?php _e( 'If activated, Top 10 will use the Transients API to cache the popular posts output for 1 hour.', 'top-10' ); ?></p>
100
- <p><input type="button" name="cache_clear" id="cache_clear" value="<?php _e( 'Clear cache', 'top-10' ); ?>" class="button-secondary" onclick="return clearCache();" /></p>
101
  </td>
102
  </tr>
103
  <tr>
104
- <th scope="row"><label for="daily_midnight"><?php _e( 'Start daily counts from midnight:', 'top-10' ); ?></label></th>
105
  <td>
106
- <input type="checkbox" name="daily_midnight" id="daily_midnight" <?php if ( $tptn_settings['daily_midnight'] ) { echo 'checked="checked"'; } ?> />
107
- <p class="description"><?php _e( 'Daily counter will display number of visits from midnight. This option is checked by default and mimics the way most normal counters work. Turning this off will allow you to use the hourly setting in the next option.', 'top-10' ); ?></p>
 
108
  </td>
109
  </tr>
110
  <tr>
111
- <th scope="row"><label for="daily_range"><?php _e( 'Daily popular contains top posts over:', 'top-10' ); ?></label></th>
112
  <td>
113
- <input type="textbox" name="daily_range" id="daily_range" size="3" value="<?php echo stripslashes( $tptn_settings['daily_range'] ); ?>"> <?php _e( 'day(s)', 'top-10' ); ?>
114
- <input type="textbox" name="hour_range" id="hour_range" size="3" value="<?php echo stripslashes( $tptn_settings['hour_range'] ); ?>"> <?php _e( 'hour(s)', 'top-10' ); ?>
115
- <p class="description"><?php _e( 'Think of Daily Popular has a custom date range applied as a global setting. Instead of displaying popular posts from the past day, this setting lets you display posts for as many days or as few hours as you want. This can be overridden in the widget.', 'top-10' ); ?></p>
116
  </td>
117
  </tr>
118
  <tr>
119
- <th scope="row"><label for="uninstall_clean_options"><?php _e( 'Delete options on uninstall', 'top-10' ); ?></label></th>
120
  <td>
121
- <input type="checkbox" name="uninstall_clean_options" id="uninstall_clean_options" <?php if ( $tptn_settings['uninstall_clean_options'] ) { echo 'checked="checked"'; } ?> />
122
- <p class="description"><?php _e( 'If this is checked, all settings related to Top 10 are removed from the database if you choose to uninstall/delete the plugin.', 'top-10' ); ?></p>
 
123
  </td>
124
  </tr>
125
- <tr>
126
- <th scope="row"><label for="uninstall_clean_tables"><?php _e( 'Delete counter data on uninstall', 'top-10' ); ?></label></th>
127
  <td>
128
- <input type="checkbox" name="uninstall_clean_tables" id="uninstall_clean_tables" <?php if ( $tptn_settings['uninstall_clean_tables'] ) { echo 'checked="checked"'; } ?> />
129
- <p class="description"><?php _e( 'If this is checked, the tables containing the counter statistics are removed from the database if you choose to uninstall/delete the plugin.', 'top-10' ); ?></p>
130
- <p class="description"><?php _e( "Keep this unchecked if you choose to reinstall the plugin and don't want to lose your counter data.", 'top-10' ); ?></p>
131
- </td>
132
- </tr>
133
- <tr><th scope="row"><label for="show_metabox"><?php _e( 'Show metabox:', 'top-10' ); ?></label></th>
134
- <td>
135
- <input type="checkbox" name="show_metabox" id="show_metabox" <?php if ( $tptn_settings['show_metabox'] ) { echo 'checked="checked"'; } ?> />
136
- <p class="description"><?php _e( 'This will add the Top 10 metabox on Edit Posts or Add New Posts screens. Also applies to Pages and Custom Post Types.', 'top-10' ); ?></p>
137
  </td>
138
  </tr>
139
 
140
- <tr><th scope="row"><label for="show_metabox_admins"><?php _e( 'Limit metabox to Admins only:', 'top-10' ); ?></label></th>
141
  <td>
142
- <input type="checkbox" name="show_metabox_admins" id="show_metabox_admins" <?php if ( $tptn_settings['show_metabox_admins'] ) { echo 'checked="checked"'; } ?> />
143
- <p class="description"><?php _e( 'If this is selected, the metabox will be hidden from anyone who is not an Admin. Otherwise, by default, Contributors and above will be able to see the metabox. This applies only if the above option is selected.', 'top-10' ); ?></p>
144
  </td>
145
  </tr>
146
 
147
  <tr>
148
- <th scope="row"><label for="show_credit"><?php _e( 'Link to Top 10 plugin page', 'top-10' ); ?></label></th>
149
  <td>
150
- <input type="checkbox" name="show_credit" id="show_credit" <?php if ( $tptn_settings['show_credit'] ) { echo 'checked="checked"'; } ?> />
151
- <p class="description"><?php _e( 'A link to the plugin is added as an extra list item to the list of popular posts', 'top-10' ); ?></p>
152
  </td>
153
  </tr>
154
  <tr>
155
  <td scope="row" colspan="2">
156
- <input type="submit" name="tptn_save" id="tptn_genop_save" value="<?php _e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
157
  </td>
158
  </tr>
159
 
@@ -171,8 +164,8 @@ if ( ! defined( 'WPINC' ) ) {
171
  </table>
172
  </div>
173
  </div>
174
- <div id="counteropdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
175
- <h3 class='hndle'><span><?php _e( 'Counter and tracker options', 'top-10' ); ?></span></h3>
176
  <div class="inside">
177
  <table class="form-table">
178
 
@@ -188,77 +181,103 @@ if ( ! defined( 'WPINC' ) ) {
188
  ?>
189
 
190
  <tr>
191
- <th scope="row"><?php _e( 'Display number of views on:', 'top-10' ); ?></th>
192
- <td>
193
- <label><input type="checkbox" name="add_to_content" id="add_to_content" <?php if ( $tptn_settings['add_to_content'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Posts', 'top-10' ); ?></label><br />
194
- <label><input type="checkbox" name="count_on_pages" id="count_on_pages" <?php if ( $tptn_settings['count_on_pages'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Pages', 'top-10' ); ?></label><br />
195
- <label><input type="checkbox" name="add_to_home" id="add_to_home" <?php if ( $tptn_settings['add_to_home'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Home page', 'top-10' ); ?></label></label><br />
196
- <label><input type="checkbox" name="add_to_feed" id="add_to_feed" <?php if ( $tptn_settings['add_to_feed'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Feeds', 'top-10' ); ?></label></label><br />
197
- <label><input type="checkbox" name="add_to_category_archives" id="add_to_category_archives" <?php if ( $tptn_settings['add_to_category_archives'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Category archives', 'top-10' ); ?></label><br />
198
- <label><input type="checkbox" name="add_to_tag_archives" id="add_to_tag_archives" <?php if ( $tptn_settings['add_to_tag_archives'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Tag archives', 'top-10' ); ?></label></label><br />
199
- <label><input type="checkbox" name="add_to_archives" id="add_to_archives" <?php if ( $tptn_settings['add_to_archives'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Other archives', 'top-10' ); ?></label></label>
200
- <p class="description"><?php _e( "If you choose to disable this, please add <code>&lt;?php if ( function_exists ( 'echo_tptn_post_count' ) ) echo_tptn_post_count(); ?&gt;</code> to your template file where you want it displayed", 'top-10' ); ?></p>
201
- </td>
202
- </tr>
203
- <tr>
204
- <th scope="row"><label for="title"><?php _e( 'Format to display the post views:', 'top-10' ); ?></label></th>
205
  <td>
206
- <textarea name="count_disp_form" id="count_disp_form" cols="50" rows="3" style="width:100%"><?php echo htmlspecialchars( stripslashes( $tptn_settings['count_disp_form'] ) ); ?></textarea>
207
- <p class="description"><?php _e( 'Use <code>%totalcount%</code> to display the total count, <code>%dailycount%</code> to display the daily count and <code>%overallcount%</code> to display the overall count across all posts on the blog. e.g. the default options displays <code>[Visited 123 times, 23 visits today]</code>', 'top-10' ); ?>
 
 
 
 
 
 
 
 
208
  </td>
209
  </tr>
210
  <tr>
211
- <th scope="row"><label for="title"><?php _e( 'What do display when there are no visits?', 'top-10' ); ?></label></th>
212
  <td>
213
- <textarea name="count_disp_form_zero" id="count_disp_form_zero" cols="50" rows="3" style="width:100%"><?php echo htmlspecialchars( stripslashes( $tptn_settings['count_disp_form_zero'] ) ); ?></textarea>
214
- <p class="description"><?php _e( "This text applies only when there are 0 hits for the post and it isn't a single page. e.g. if you display post views on the homepage or archives then this text will be used. To override this, just enter the same text as above option.", 'top-10' ); ?>
 
 
 
 
 
 
 
215
  </td>
216
  </tr>
217
  <tr>
218
- <th scope="row"><label for="dynamic_post_count"><?php _e( 'Always display latest post count', 'top-10' ); ?></label></th>
219
  <td>
220
- <input type="checkbox" name="dynamic_post_count" id="dynamic_post_count" <?php if ( $tptn_settings['dynamic_post_count'] ) { echo 'checked="checked"'; } ?> />
221
- <p class="description"><?php _e( 'This option uses JavaScript and will increase your page load time. Turn this off if you are not using caching plugins or are OK with displaying older cached counts.', 'top-10' ); ?></p>
222
  </td>
223
  </tr>
224
  <tr>
225
- <th scope="row"><label for="track_authors"><?php _e( 'Track visits of authors on their own posts?', 'top-10' ); ?></label></th>
226
  <td>
227
- <input type="checkbox" name="track_authors" id="track_authors" <?php if ( $tptn_settings['track_authors'] ) { echo 'checked="checked"'; } ?> />
228
- <p class="description"><?php _e( 'Disabling this option will stop authors visits tracked on their own posts', 'top-10' ); ?></p>
229
  </td>
230
  </tr>
231
- <tr>
232
- <th scope="row"><label for="track_admins"><?php _e( 'Track visits of admins?', 'top-10' ); ?></label></th>
233
  <td>
234
- <input type="checkbox" name="track_admins" id="track_admins" <?php if ( $tptn_settings['track_admins'] ) { echo 'checked="checked"'; } ?> />
235
- <p class="description"><?php _e( 'Disabling this option will stop admin visits being tracked.', 'top-10' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
236
  </td>
237
  </tr>
 
238
  <tr>
239
- <th scope="row"><label for="track_editors"><?php _e( 'Track visits of Editors?', 'top-10' ); ?></label></th>
240
  <td>
241
- <input type="checkbox" name="track_editors" id="track_editors" <?php if ( $tptn_settings['track_editors'] ) { echo 'checked="checked"'; } ?> />
242
- <p class="description"><?php _e( 'Disabling this option will stop editor visits being tracked.', 'top-10' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
243
  </td>
244
  </tr>
245
  <tr>
246
- <th scope="row"><label for="pv_in_admin"><?php _e( 'Display page views on Posts and Pages in Admin', 'top-10' ); ?></label></th>
247
  <td>
248
- <input type="checkbox" name="pv_in_admin" id="pv_in_admin" <?php if ( $tptn_settings['pv_in_admin'] ) { echo 'checked="checked"'; } ?> />
249
- <p class="description"><?php _e( "Adds three columns called Total Views, Today's Views and Views to All Posts and All Pages", 'top-10' ); ?></p>
250
  </td>
251
  </tr>
252
  <tr>
253
- <th scope="row"><label for="show_count_non_admins"><?php _e( 'Show number of views to non-admins', 'top-10' ); ?></label></th>
254
  <td>
255
- <input type="checkbox" name="show_count_non_admins" id="show_count_non_admins" <?php if ( $tptn_settings['show_count_non_admins'] ) { echo 'checked="checked"'; } ?> />
256
- <p class="description"><?php _e( "If you disable this then non-admins won't see the above columns or view the independent pages with the top posts", 'top-10' ); ?></p>
257
  </td>
258
  </tr>
259
  <tr>
260
  <td scope="row" colspan="2">
261
- <input type="submit" name="tptn_save" id="tptn_counterop_save" value="<?php _e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
262
  </td>
263
  </tr>
264
 
@@ -276,8 +295,8 @@ if ( ! defined( 'WPINC' ) ) {
276
  </table>
277
  </div>
278
  </div>
279
- <div id="pplopdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
280
- <h3 class='hndle'><span><?php _e( 'Popular post list options', 'top-10' ); ?></span></h3>
281
  <div class="inside">
282
  <table class="form-table">
283
 
@@ -293,28 +312,28 @@ if ( ! defined( 'WPINC' ) ) {
293
  ?>
294
 
295
  <tr>
296
- <th scope="row"><label for="limit"><?php _e( 'Number of popular posts to display:', 'top-10' ); ?></label></th>
297
  <td>
298
  <input type="textbox" name="limit" id="limit" value="<?php echo esc_attr( stripslashes( $tptn_settings['limit'] ) ); ?>">
299
- <p class="description"><?php _e( "Maximum number of posts that will be displayed in the list. This option is used if you don't specify the number of posts in the widget or shortcodes", 'top-10' ); ?></p>
300
  </td>
301
  </tr>
302
  <tr>
303
- <th scope="row"><label for="how_old"><?php _e( 'Published age of posts:', 'top-10' ); ?></label></th>
304
  <td>
305
- <input type="textbox" name="how_old" id="how_old" value="<?php echo esc_attr( stripslashes( $tptn_settings['how_old'] ) ); ?>"> <?php _e( 'days', 'top-10' ); ?>
306
- <p class="description"><?php _e( 'This options allows you to only show posts that have been published within the above day range. Applies to both overall posts and daily posts lists.', 'top-10' ); ?></p>
307
- <p class="description"><?php _e( 'e.g. 365 days will only show posts published in the last year in the popular posts lists. Enter 0 for no restriction.', 'top-10' ); ?></p>
308
  </td>
309
  </tr>
310
  <tr>
311
- <th scope="row"><?php _e( 'Post types to include in results (including custom post types)', 'top-10' ); ?></th>
312
  <td>
313
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
314
 
315
  <label>
316
- <input type="checkbox" name="post_types[]" value="<?php echo $wp_post_type; ?>" <?php if ( in_array( $wp_post_type, $posts_types_inc ) ) { echo 'checked="checked"'; } ?> />
317
- <?php echo $wp_post_type; ?>
318
  </label>
319
  <br />
320
 
@@ -322,152 +341,141 @@ if ( ! defined( 'WPINC' ) ) {
322
  </td>
323
  </tr>
324
  <tr>
325
- <th scope="row"><label for="exclude_post_ids"><?php _e( 'List of post or page IDs to exclude from the results:', 'top-10' ); ?></label></th>
326
  <td><input type="textbox" name="exclude_post_ids" id="exclude_post_ids" value="<?php echo esc_attr( stripslashes( $tptn_settings['exclude_post_ids'] ) ); ?>" style="width:250px">
327
- <p class="description"><?php _e( 'Enter comma separated list of IDs. e.g. 188,320,500', 'top-10' ); ?></p>
328
  </td>
329
  </tr>
330
  <tr>
331
- <th scope="row"><label for="exclude_cat_slugs"><?php _e( 'Exclude Categories:', 'top-10' ); ?></label></th>
332
- <td>
333
- <div style="position:relative;text-align:left">
334
- <table id="MYCUSTOMFLOATER" class="myCustomFloater" style="position:absolute;top:50px;left:0;background-color:#cecece;display:none;visibility:hidden">
335
- <tr><td><!--
336
- please see: http://chrisholland.blogspot.com/2004/09/geekstuff-css-display-inline-block.html
337
- to explain why i'm using a table here.
338
- You could replace the table/tr/td with a DIV, but you'd have to specify it's width and height
339
- -->
340
- <div class="myCustomFloaterContent">
341
- you should never be seeing this
342
- </div>
343
- </td></tr>
344
- </table>
345
- <textarea class="wickEnabled:MYCUSTOMFLOATER" cols="50" rows="3" wrap="virtual" name="exclude_cat_slugs" style="width:100%"><?php echo ( stripslashes( $tptn_settings['exclude_cat_slugs'] ) ); ?></textarea>
346
- <p class="description"><?php _e( 'Comma separated list of category slugs. The field above has an autocomplete so simply start typing in the starting letters and it will prompt you with options', 'top-10' ); ?></p>
347
- </div>
348
  <p class="description highlight">
349
  <?php
350
- _e( 'Excluded category IDs are:', 'top-10' );
351
- echo ' ' . $tptn_settings['exclude_categories'];
352
  ?>
353
  </p>
354
  <p class="description">
355
  <?php
356
- _e( 'These might differ from the IDs visible in the Categories page which use the <code>term_id</code>. Top 10 uses the <code>term_taxonomy_id</code> which is unique to this taxonomy.', 'top-10' );
357
  ?>
358
  </p>
359
  </td>
360
  </tr>
361
  <tr>
362
- <th scope="row"><label for="title"><?php _e( 'Title of popular posts:', 'top-10' ); ?></label></th>
363
  <td>
364
- <input type="textbox" name="title" id="title" value="<?php echo esc_attr( stripslashes( $tptn_settings['title'] ) ); ?>" style="width:250px" />
365
  </td>
366
  </tr>
367
  <tr>
368
- <th scope="row"><label for="title_daily"><?php _e( 'Title of daily popular posts:', 'top-10' ); ?></label></th>
369
  <td>
370
- <input type="textbox" name="title_daily" id="title_daily" value="<?php echo esc_attr( stripslashes( $tptn_settings['title_daily'] ) ); ?>" style="width:250px" />
371
  </td>
372
  </tr>
373
  <tr>
374
- <th scope="row"><label for="blank_output"><?php _e( 'When there are no posts, what should be shown?', 'top-10' ); ?></label></th>
375
  <td>
376
  <label>
377
- <input type="radio" name="blank_output" value="blank" id="blank_output_0" <?php if ( $tptn_settings['blank_output'] ) { echo 'checked="checked"'; } ?> />
378
- <?php _e( 'Blank Output', 'top-10' ); ?></label>
 
379
  <br />
380
  <label>
381
- <input type="radio" name="blank_output" value="customs" id="blank_output_1" <?php if ( ! $tptn_settings['blank_output'] ) { echo 'checked="checked"'; } ?> />
382
- <?php _e( 'Display:', 'top-10' ); ?></label>
383
- <input type="textbox" name="blank_output_text" id="blank_output_text" value="<?php echo esc_attr( stripslashes( $tptn_settings['blank_output_text'] ) ); ?>" style="width:250px" />
 
384
  </td>
385
  </tr>
386
  <tr>
387
- <th scope="row"><label for="show_excerpt"><?php _e( 'Show post excerpt in list?', 'top-10' ); ?></label></th>
388
  <td>
389
- <input type="checkbox" name="show_excerpt" id="show_excerpt" <?php if ( $tptn_settings['show_excerpt'] ) { echo 'checked="checked"'; } ?> />
390
  </td>
391
  </tr>
392
  <tr>
393
- <th scope="row"><label for="excerpt_length"><?php _e( 'Length of excerpt (in words):', 'top-10' ); ?></label></th>
394
  <td>
395
- <input type="textbox" name="excerpt_length" id="excerpt_length" value="<?php echo stripslashes( $tptn_settings['excerpt_length'] ); ?>" />
396
  </td>
397
  </tr>
398
  <tr>
399
- <th scope="row"><label for="show_author"><?php _e( 'Show post author in list?', 'top-10' ); ?></label></th>
400
  <td>
401
- <input type="checkbox" name="show_author" id="show_author" <?php if ( $tptn_settings['show_author'] ) { echo 'checked="checked"'; } ?> />
402
  </td>
403
  </tr>
404
  <tr>
405
- <th scope="row"><label for="show_date"><?php _e( 'Show post date in list?', 'top-10' ); ?></label></th>
406
  <td>
407
- <input type="checkbox" name="show_date" id="show_date" <?php if ( $tptn_settings['show_date'] ) { echo 'checked="checked"'; } ?> />
408
  </td>
409
  </tr>
410
  <tr>
411
- <th scope="row"><label for="title_length"><?php _e( 'Limit post title length (in characters)', 'top-10' ); ?></label></th>
412
  <td>
413
- <input type="textbox" name="title_length" id="title_length" value="<?php echo stripslashes( $tptn_settings['title_length'] ); ?>" />
414
  </td>
415
  </tr>
416
  <tr>
417
- <th scope="row"><label for="disp_list_count"><?php _e( 'Show view count in list?', 'top-10' ); ?></label></th>
418
  <td>
419
- <input type="checkbox" name="disp_list_count" id="disp_list_count" <?php if ( $tptn_settings['disp_list_count'] ) { echo 'checked="checked"'; } ?> />
420
  </td>
421
  </tr>
422
  <tr>
423
- <th scope="row"><label for="link_new_window "><?php _e( 'Open links in new window', 'top-10' ); ?></label></th>
424
  <td>
425
- <input type="checkbox" name="link_new_window" id="link_new_window" <?php if ( $tptn_settings['link_new_window'] ) { echo 'checked="checked"'; } ?> />
426
  </td>
427
  </tr>
428
  <tr>
429
- <th scope="row"><label for="link_nofollow"><?php _e( 'Add nofollow attribute to links in the list', 'top-10' ); ?></label></th>
430
  <td>
431
- <input type="checkbox" name="link_nofollow" id="link_nofollow" <?php if ( $tptn_settings['link_nofollow'] ) { echo 'checked="checked"'; } ?> />
432
  </td>
433
  </tr>
434
  <tr>
435
- <th scope="row"><label for="exclude_on_post_ids"><?php _e( 'Exclude display of related posts on these posts / pages', 'top-10' ); ?></label></th>
436
  <td>
437
  <input type="textbox" name="exclude_on_post_ids" id="exclude_on_post_ids" value="<?php echo esc_attr( stripslashes( $tptn_settings['exclude_on_post_ids'] ) ); ?>" style="width:250px">
438
- <p class="description"><?php _e( 'Enter comma separated list of IDs. e.g. 188,320,500', 'top-10' ); ?></p>
439
  </td>
440
  </tr>
441
 
442
- <tr style="background: #eee"><th scope="row" colspan="2"><?php _e( 'Customise the list HTML', 'top-10' ); ?></th>
443
  </tr>
444
  <tr>
445
- <th scope="row"><label for="before_list"><?php _e( 'HTML to display before the list of posts:', 'top-10' ); ?></label></th>
446
  <td>
447
  <input type="textbox" name="before_list" id="before_list" value="<?php echo esc_attr( stripslashes( $tptn_settings['before_list'] ) ); ?>" style="width:250px" />
448
  </td>
449
  </tr>
450
  <tr>
451
- <th scope="row"><label for="before_list_item"><?php _e( 'HTML to display before each list item:', 'top-10' ); ?></label></th>
452
  <td>
453
  <input type="textbox" name="before_list_item" id="before_list_item" value="<?php echo esc_attr( stripslashes( $tptn_settings['before_list_item'] ) ); ?>" style="width:250px" />
454
  </td>
455
  </tr>
456
  <tr>
457
- <th scope="row"><label for="after_list_item"><?php _e( 'HTML to display after each list item:', 'top-10' ); ?></label></th>
458
  <td>
459
  <input type="textbox" name="after_list_item" id="after_list_item" value="<?php echo esc_attr( stripslashes( $tptn_settings['after_list_item'] ) ); ?>" style="width:250px" />
460
  </td>
461
  </tr>
462
  <tr>
463
- <th scope="row"><label for="after_list"><?php _e( 'HTML to display after the list of posts:', 'top-10' ); ?></label></th>
464
  <td>
465
  <input type="textbox" name="after_list" id="after_list" value="<?php echo esc_attr( stripslashes( $tptn_settings['after_list'] ) ); ?>" style="width:250px" />
466
  </td>
467
  </tr>
468
  <tr>
469
  <td scope="row" colspan="2">
470
- <input type="submit" name="tptn_save" id="tptn_pplop_save" value="<?php _e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
471
  </td>
472
  </tr>
473
 
@@ -485,8 +493,8 @@ if ( ! defined( 'WPINC' ) ) {
485
  </table>
486
  </div>
487
  </div>
488
- <div id="thumbopdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
489
- <h3 class='hndle'><span><?php _e( 'Thumbnail options', 'top-10' ); ?></span></h3>
490
  <div class="inside">
491
  <table class="form-table">
492
 
@@ -501,37 +509,38 @@ if ( ! defined( 'WPINC' ) ) {
501
  do_action( 'tptn_admin_thumbnail_options_before', $tptn_settings );
502
  ?>
503
 
504
- <tr><th scope="row"><label for="post_thumb_op"><?php _e( 'Location of post thumbnail:', 'top-10' ); ?></label></th>
505
  <td>
506
  <label>
507
- <input type="radio" name="post_thumb_op" value="inline" id="post_thumb_op_0" <?php if ( 'inline' == $tptn_settings['post_thumb_op'] ) { echo 'checked="checked"'; } ?> />
508
- <?php _e( 'Display thumbnails inline with posts, before title', 'top-10' ); ?>
509
  </label>
510
  <br />
511
  <label>
512
- <input type="radio" name="post_thumb_op" value="after" id="post_thumb_op_1" <?php if ( 'after' == $tptn_settings['post_thumb_op'] ) { echo 'checked="checked"'; } ?> />
513
- <?php _e( 'Display thumbnails inline with posts, after title', 'top-10' ); ?>
514
  </label>
515
  <br />
516
  <label>
517
- <input type="radio" name="post_thumb_op" value="thumbs_only" id="post_thumb_op_2" <?php if ( 'thumbs_only' == $tptn_settings['post_thumb_op'] ) { echo 'checked="checked"'; } ?> />
518
- <?php _e( 'Display only thumbnails, no text', 'top-10' ); ?>
519
  </label>
520
  <br />
521
  <label>
522
- <input type="radio" name="post_thumb_op" value="text_only" id="post_thumb_op_3" <?php if ( 'text_only' == $tptn_settings['post_thumb_op'] ) { echo 'checked="checked"'; } ?> />
523
- <?php _e( 'Do not display thumbnails, only text.', 'top-10' ); ?>
524
  </label>
525
 
526
- <?php if ( 'left_thumbs' == $tptn_settings['tptn_styles'] ) { ?>
527
- <p style="color: #F00"><?php _e( 'This setting cannot be changed because an inbuilt style has been selected under the Styles section. If you would like to change this option, please select No styles under the Styles section.', 'top-10' ); ?></p>
528
  <?php } ?>
529
  </td>
530
  </tr>
531
- <tr><th scope="row"><?php _e( 'Thumbnail size:', 'top-10' ); ?></th>
532
  <td>
533
  <?php
534
- $tptn_get_all_image_sizes = tptn_get_all_image_sizes();
 
535
  if ( isset( $tptn_get_all_image_sizes['tptn_thumbnail'] ) ) {
536
  unset( $tptn_get_all_image_sizes['tptn_thumbnail'] );
537
  }
@@ -539,8 +548,8 @@ if ( ! defined( 'WPINC' ) ) {
539
  foreach ( $tptn_get_all_image_sizes as $size ) :
540
  ?>
541
  <label>
542
- <input type="radio" name="thumb_size" value="<?php echo $size['name'] ?>" id="<?php echo $size['name'] ?>" <?php if ( $tptn_settings['thumb_size'] == $size['name'] ) { echo 'checked="checked"'; } ?> />
543
- <?php echo $size['name']; ?> ( <?php echo $size['width']; ?>x<?php echo $size['height']; ?>
544
  <?php
545
  if ( $size['crop'] ) {
546
  echo 'cropped';
@@ -552,85 +561,90 @@ if ( ! defined( 'WPINC' ) ) {
552
  <?php endforeach; ?>
553
 
554
  <label>
555
- <input type="radio" name="thumb_size" value="tptn_thumbnail" id="tptn_thumbnail" <?php if ( $tptn_settings['thumb_size'] == 'tptn_thumbnail' ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Custom size', 'top-10' ); ?>
556
  </label>
557
  <p class="description">
558
- <?php _e( 'You can choose from existing image sizes above or create a custom size. If you have chosen Custom size above, then enter the width, height and crop settings below. For best results, use a cropped image.', 'top-10' ); ?><br />
559
- <?php _e( 'If you change the width and/or height below, existing images will not be automatically resized.', 'top-10' ); ?>
560
- <?php printf( __( "I recommend using <a href='%s' class='thickbox'>OTF Regenerate Thumbnails</a> or <a href='%s' class='thickbox'>Regenerate Thumbnails</a> to regenerate all image sizes.", 'top-10' ), self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=otf-regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ), self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ); ?>
 
 
 
 
561
  </p>
562
  <p class="description">
563
- <?php _e( "If you're using the Left Thumbs style below then the thumbnail width and height that you set here will supersede the widget. Alternatively, choose <strong>Style attributes</strong> under <strong>Image size attributes</strong> option below", 'top-10' ); ?>
564
  </p>
565
  </td>
566
- <tr><th scope="row"><label for="thumb_width"><?php _e( 'Width of custom thumbnail:', 'top-10' ); ?></label></th>
 
567
  <td>
568
  <input type="textbox" name="thumb_width" id="thumb_width" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_width'] ) ); ?>" style="width:50px" />px
569
  </td>
570
  </tr>
571
- <tr><th scope="row"><label for="thumb_height"><?php _e( 'Height of custom thumbnail', 'top-10' ); ?></label></th>
572
  <td>
573
  <input type="textbox" name="thumb_height" id="thumb_height" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_height'] ) ); ?>" style="width:50px" />px
574
  </td>
575
  </tr>
576
- <tr><th scope="row"><label for="thumb_crop"><?php _e( 'Crop mode:', 'top-10' ); ?></label></th>
577
  <td>
578
- <input type="checkbox" name="thumb_crop" id="thumb_crop" <?php if ( $tptn_settings['thumb_crop'] ) { echo 'checked="checked"'; } ?> />
579
  <p class="description">
580
- <?php _e( 'By default, thumbnails will be proportionately cropped. Check this box to hard crop the thumbnails.', 'top-10' ); ?>
581
- <?php printf( __( "<a href='%s' target='_blank'>Difference between soft and hard crop</a>", 'top-10' ), esc_url( 'http://www.davidtan.org/wordpress-hard-crop-vs-soft-crop-difference-comparison-example/' ) ); ?>
582
  </p>
583
  </td>
584
  </tr>
585
- <tr><th scope="row"><label for="thumb_html"><?php _e( 'Image size attributes:', 'top-10' ); ?></label></th>
586
  <td>
587
  <label>
588
- <input type="radio" name="thumb_html" value="css" id="thumb_html_0" <?php if ( 'css' == $tptn_settings['thumb_html'] ) { echo 'checked="checked"'; } ?> />
589
- <?php _e( 'Style attributes are used for width and height.', 'top-10' );
590
- echo ' <code>style="max-width:' . $tptn_settings['thumb_width'] . 'px;max-height:' . $tptn_settings['thumb_height'] . 'px;"</code>'; ?>
591
  </label>
592
  <br />
593
  <label>
594
- <input type="radio" name="thumb_html" value="html" id="thumb_html_1" <?php if ( 'html' == $tptn_settings['thumb_html'] ) { echo 'checked="checked"'; } ?> />
595
- <?php _e( 'HTML width and height attributes are used for width and height.', 'top-10' );
596
- echo ' <code>width="' . $tptn_settings['thumb_width'] . '" height="' . $tptn_settings['thumb_height'] . '"</code>'; ?>
597
  </label>
598
  <br />
599
  <label>
600
- <input type="radio" name="thumb_html" value="none" id="thumb_html_1" <?php if ( 'none' == $tptn_settings['thumb_html'] ) { echo 'checked="checked"'; } ?> />
601
- <?php _e( 'No HTML or Style attributes set for width and height', 'top-10' ); ?>
602
  </label>
603
  <br />
604
  </td>
605
  </tr>
606
- <tr><th scope="row"><label for="thumb_meta"><?php _e( 'Post thumbnail meta field name:', 'top-10' ); ?></label></th>
607
  <td>
608
  <input type="textbox" name="thumb_meta" id="thumb_meta" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_meta'] ) ); ?>">
609
- <p class="description"><?php _e( 'The value of this field should contain the image source and is set in the <em>Add New Post</em> screen', 'top-10' ); ?></p>
610
  </td>
611
  </tr>
612
- <tr><th scope="row"><label for="scan_images"><?php _e( 'If the postmeta is not set, then should the plugin extract the first image from the post?', 'top-10' ); ?></label></th>
613
  <td>
614
- <input type="checkbox" name="scan_images" id="scan_images" <?php if ( $tptn_settings['scan_images'] ) { echo 'checked="checked"'; } ?> />
615
- <p class="description"><?php _e( 'This could slow down the loading of your page if the first image in the related posts is large in file-size', 'top-10' ); ?></p>
616
  </td>
617
  </tr>
618
- <tr><th scope="row"><label for="thumb_default_show"><?php _e( 'Use default thumbnail?', 'top-10' ); ?></label></th>
619
  <td>
620
- <input type="checkbox" name="thumb_default_show" id="thumb_default_show" <?php if ( $tptn_settings['thumb_default_show'] ) { echo 'checked="checked"'; } ?> />
621
- <p class="description"><?php _e( 'If checked, when no thumbnail is found, show a default one from the URL below. If not checked and no thumbnail is found, no image will be shown.', 'top-10' ); ?></p>
622
  </td>
623
  </tr>
624
- <tr><th scope="row"><label for="thumb_default"><?php _e( 'Default thumbnail:', 'top-10' ); ?></label></th>
625
  <td>
626
  <input type="textbox" name="thumb_default" id="thumb_default" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_default'] ) ); ?>" style="width:100%"> <br />
627
- <?php if ( '' != $tptn_settings['thumb_default'] ) { echo "<img src='{$tptn_settings['thumb_default']}' style='max-width:200px' />"; } ?>
628
- <p class="description"><?php _e( "The plugin will first check if the post contains a thumbnail. If it doesn't then it will check the meta field. If this is not available, then it will show the default image as specified above", 'top-10' ); ?></p>
629
  </td>
630
  </tr>
631
  <tr>
632
  <td scope="row" colspan="2">
633
- <input type="submit" name="tptn_save" id="tptn_thumbop_save" value="<?php _e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
634
  </td>
635
  </tr>
636
 
@@ -648,8 +662,8 @@ if ( ! defined( 'WPINC' ) ) {
648
  </table>
649
  </div>
650
  </div>
651
- <div id="customcssdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
652
- <h3 class='hndle'><span><?php _e( 'Styles', 'top-10' ); ?></span></h3>
653
  <div class="inside">
654
  <table class="form-table">
655
 
@@ -664,27 +678,27 @@ if ( ! defined( 'WPINC' ) ) {
664
  do_action( 'tptn_admin_custom_styles_before', $tptn_settings );
665
  ?>
666
 
667
- <tr><th scope="row"><?php _e( 'Style of the related posts:', 'top-10' ); ?></th>
668
  <td>
669
  <label>
670
- <input type="radio" name="tptn_styles" value="no_style" id="tptn_styles_1" <?php if ( 'no_style' == $tptn_settings['tptn_styles'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'No styles', 'top-10' ); ?>
671
  </label>
672
- <p class="description"><?php _e( 'Select this option if you plan to add your own styles', 'top-10' ); ?></p>
673
  <br />
674
 
675
  <label>
676
- <input type="radio" name="tptn_styles" value="left_thumbs" id="tptn_styles_0" <?php if ( $tptn_settings['include_default_style'] && ( 'left_thumbs' == $tptn_settings['tptn_styles'] ) ) { echo 'checked="checked"'; } ?> />
677
- <?php _e( 'Left Thumbnails', 'top-10' ); ?>
678
  </label>
679
- <p class="description"><img src="<?php echo plugins_url( 'admin/images/tptn-left-thumbs.png', TOP_TEN_PLUGIN_FILE ); ?>" /></p>
680
- <p class="description"><?php _e( 'Enabling this option will set the post thumbnail to be before text. Disabling this option will not revert any settings.', 'top-10' ); ?></p>
681
- <p class="description"><?php printf( __( 'You can view the default style at <a href="%1$s" target="_blank">%1$s</a>', 'top-10' ), esc_url( 'https://github.com/WebberZone/top-10/blob/master/css/default-style.css' ) ); ?></p>
682
  <br />
683
 
684
  <label>
685
- <input type="radio" name="tptn_styles" value="text_only" id="tptn_styles_1" <?php if ( 'text_only' == $tptn_settings['tptn_styles'] ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Text only', 'top-10' ); ?>
686
  </label>
687
- <p class="description"><?php _e( 'Enabling this option will disable thumbnails and no longer include the default style sheet included in the plugin.', 'top-10' ); ?></p>
688
 
689
  <?php
690
  /**
@@ -700,12 +714,12 @@ if ( ! defined( 'WPINC' ) ) {
700
  </td>
701
  </tr>
702
 
703
- <tr><th scope="row" colspan="2"><?php _e( 'Custom CSS to add to header:', 'top-10' ); ?></th>
704
  </tr>
705
  <tr>
706
  <td scope="row" colspan="2">
707
- <textarea name="custom_CSS" id="custom_CSS" rows="15" cols="80" style="width:100%"><?php echo stripslashes( $tptn_settings['custom_CSS'] ); ?></textarea>
708
- <p class="description"><?php _e( 'Do not include <code>style</code> tags. Check out the <a href="http://wordpress.org/extend/plugins/top-10/faq/" target="_blank">FAQ</a> for available CSS classes to style.', 'top-10' ); ?></p>
709
  </td>
710
  </tr>
711
 
@@ -724,8 +738,8 @@ if ( ! defined( 'WPINC' ) ) {
724
  </div>
725
  </div>
726
  <p>
727
- <input type="submit" name="tptn_save" id="tptn_save" value="<?php _e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
728
- <input type="submit" name="tptn_default" id="tptn_default" value="<?php _e( 'Default Options', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php _e( 'Do you want to set options to Default?', 'top-10' ); ?>')) return false;" />
729
  </p>
730
  <?php wp_nonce_field( 'tptn-plugin-settings' ); ?>
731
  </form>
@@ -744,39 +758,39 @@ if ( ! defined( 'WPINC' ) ) {
744
  <hr class="clear" />
745
 
746
  <form method="post" id="tptn_maintenance_op" name="tptn_reset_options" onsubmit="return checkForm()">
747
- <div id="resetopdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
748
- <h3 class='hndle'><span><?php _e( 'Maintenance', 'top-10' ); ?></span></h3>
749
  <div class="inside">
750
  <table class="form-table">
751
  <tr><td scope="row" colspan="2">
752
- <p class="description"><?php _e( 'Over time the Daily Top 10 database grows in size, which reduces the performance of the plugin. Cleaning the database at regular intervals could improve performance, especially on high traffic blogs. Enabling maintenance will automatically delete entries older than 90 days.', 'top-10' ); ?><br />
753
- <strong><?php _e( 'Note: When scheduled maintenance is enabled, WordPress will run the cron job everytime the job is rescheduled (i.e. you change the settings below).', 'top-10' ); ?></strong>
754
  </td>
755
  </tr>
756
- <tr><th scope="row"><label for="cron_on"><?php _e( 'Enable scheduled maintenance of daily tables:', 'top-10' ); ?></label></th>
757
- <td><input type="checkbox" name="cron_on" id="cron_on" <?php if ( $tptn_settings['cron_on'] ) { echo 'checked="checked"'; } ?> />
758
  </td>
759
  </tr>
760
- <tr><th scope="row"><label for="cron_hour"><?php _e( 'Time to run maintenance', 'top-10' ); ?></label></th>
761
- <td><input type="textbox" name="cron_hour" id="cron_hour" value="<?php echo esc_attr( stripslashes( $tptn_settings['cron_hour'] ) ); ?>" style="width:50px" /> <?php _e( 'hrs', 'top-10' ); ?> : <input type="textbox" name="cron_min" id="cron_min" value="<?php echo esc_attr( stripslashes( $tptn_settings['cron_min'] ) ); ?>" style="width:50px" /> <?php _e( 'min', 'top-10' ); ?></td>
762
  </tr>
763
- <tr><th scope="row"><label for="cron_recurrence"><?php _e( 'How often should the maintenance be run:', 'top-10' ); ?></label></th>
764
  <td>
765
  <label>
766
- <input type="radio" name="cron_recurrence" value="daily" id="cron_recurrence0" <?php if ( 'daily' == $tptn_settings['cron_recurrence'] ) { echo 'checked="checked"'; } ?> />
767
- <?php _e( 'Daily', 'top-10' ); ?></label>
768
  <br />
769
  <label>
770
- <input type="radio" name="cron_recurrence" value="weekly" id="cron_recurrence1" <?php if ( 'weekly' == $tptn_settings['cron_recurrence'] ) { echo 'checked="checked"'; } ?> />
771
- <?php _e( 'Weekly', 'top-10' ); ?></label>
772
  <br />
773
  <label>
774
- <input type="radio" name="cron_recurrence" value="fortnightly" id="cron_recurrence2" <?php if ( 'fortnightly' == $tptn_settings['cron_recurrence'] ) { echo 'checked="checked"'; } ?> />
775
- <?php _e( 'Fortnightly', 'top-10' ); ?></label>
776
  <br />
777
  <label>
778
- <input type="radio" name="cron_recurrence" value="monthly" id="cron_recurrence3" <?php if ( 'monthly' == $tptn_settings['cron_recurrence'] ) { echo 'checked="checked"'; } ?> />
779
- <?php _e( 'Monthly', 'top-10' ); ?></label>
780
  <br />
781
  </td>
782
  </tr>
@@ -785,50 +799,49 @@ if ( ! defined( 'WPINC' ) ) {
785
  if ( ( $tptn_settings['cron_on'] ) || wp_next_scheduled( 'tptn_cron_hook' ) ) {
786
  if ( wp_next_scheduled( 'tptn_cron_hook' ) ) {
787
  echo '<span style="color:#0c0">';
788
- _e( 'The cron job has been scheduled. Maintenance will run', 'top-10' );
789
- echo ' ' . wp_get_schedule( 'tptn_cron_hook' );
790
- echo '.</span>';
791
  } else {
792
  echo '<span style="color:#e00">';
793
- _e( 'The cron job is missing. Please resave this page to add the job', 'top-10' );
794
  echo '</span>';
795
  }
796
  } else {
797
  echo '<span style="color:#FFA500">';
798
- _e( 'Maintenance is turned off', 'top-10' );
799
  echo '</span>';
800
  }
801
  ?>
802
  </td></tr>
803
  </table>
804
- <input type="submit" name="tptn_mnts_save" id="tptn_mnts_save" value="<?php _e( 'Save Maintenance Options', 'top-10' ); ?>" class="button button-primary" />
805
  </div>
806
  </div>
807
  <?php wp_nonce_field( 'tptn-plugin-settings' ); ?>
808
  </form>
809
 
810
  <form method="post" id="tptn_reset_options" name="tptn_reset_options" onsubmit="return checkForm()">
811
- <div id="resetopdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
812
- <h3 class='hndle'><span><?php _e( 'Reset count and other tools', 'top-10' ); ?></span></h3>
813
  <div class="inside">
814
  <p class="description">
815
- <?php _e( 'This cannot be reversed. Make sure that your database has been backed up before proceeding', 'top-10' ); ?>
816
  </p>
817
  <p>
818
- <input name="tptn_trunc_all" type="submit" id="tptn_trunc_all" value="<?php _e( 'Reset Popular Posts', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" onclick="if (!confirm('<?php _e( 'Are you sure you want to reset the popular posts?', 'top-10' ); ?>')) return false;" />
819
- <input name="tptn_trunc_daily" type="submit" id="tptn_trunc_daily" value="<?php _e( 'Reset Daily Popular Posts', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" onclick="if (!confirm('<?php _e( 'Are you sure you want to reset the daily popular posts?', 'top-10' ); ?>')) return false;" />
820
  </p>
821
  <p class="description">
822
- <?php _e( 'This will merge post counts for posts with table entries of 0 and 1', 'top-10' ); ?>
823
  </p>
824
  <p>
825
- <input name="tptn_merge_blogids" type="submit" id="tptn_merge_blogids" value="<?php _e( 'Merge blog ID 0 and 1 post counts', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php _e( 'This will merge post counts for blog IDs 0 and 1. Proceed?', 'top-10' ); ?>')) return false;" />
826
  </p>
827
  <p class="description">
828
- <?php _e( 'In older versions, the plugin created entries with duplicate post IDs. Clicking the button below will merge these duplicate IDs', 'top-10' ); ?>
829
  </p>
830
  <p>
831
- <input name="tptn_clean_duplicates" type="submit" id="tptn_clean_duplicates" value="<?php _e( 'Merge duplicates across blog IDs', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php _e( 'This will delete the duplicate entries in the tables. Proceed?', 'top-10' ); ?>')) return false;" />
832
  </p>
833
  </div>
834
  </div>
@@ -842,114 +855,114 @@ if ( ! defined( 'WPINC' ) ) {
842
  if ( is_multisite() ) {
843
  ?>
844
 
845
- <form method="post" id="tptn_import_mu" name="tptn_import_mu" onsubmit="return checkForm()">
846
- <div id="resetopdiv" class="postbox"><div class="handlediv" title="<?php _e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
847
- <h3 class='hndle'><span><?php _e( 'WordPress Multisite: Migrate Top 10 v1.x counts to 2.x', 'top-10' ); ?></span></h3>
848
- <div class="inside">
849
- <p class="description">
850
- <?php _e( "If you've been using Top 10 v1.x on multisite, you would have needed to activate the plugin independently for each site. This would have resulted in two tables being created for each site in the network.", 'top-10' ); ?>
851
- <?php _e( 'Top 10 v2.x onwards uses only a single table to record the count, keeping your database clean. You can use this tool to import the recorded counts from v1.x tables to the new v2.x table format.', 'top-10' ); ?>
852
- </p>
853
- <p class="description">
854
- <?php _e( 'If you do not see any tables below, then it means that either all data has already been imported or no relevant information has been found.', 'top-10' ); ?>
855
- </p>
856
- <p class="description">
857
- <strong style="color:#C00"><?php _e( 'After running the importer, please verify that all the counts have been successfully imported. Only then should you delete any old tables!', 'top-10' ); ?></strong>
858
- </p>
859
 
860
- <?php
861
- $top_ten_mu_tables_sel_blog_ids = get_site_option( 'top_ten_mu_tables_sel_blog_ids', array() );
862
- $top_ten_mu_tables_blog_ids = array();
863
- $top_ten_all_mu_tables = array();
864
-
865
- // Get all blogs in the network and activate plugin on each one
866
- $blog_ids = $wpdb->get_col( "
867
- SELECT blog_id FROM $wpdb->blogs
868
- WHERE archived = '0' AND spam = '0' AND deleted = '0'
869
- " );
870
- foreach ( $blog_ids as $blog_id ) {
871
- switch_to_blog( $blog_id );
872
- $top_ten_mu_table = $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "top_ten' " );
873
-
874
- if ( ! empty( $top_ten_mu_table ) && ! is_main_site( $blog_id ) ) {
875
- $top_ten_mu_tables_blog_ids[] = $blog_id;
876
- $top_ten_all_mu_tables[ $top_ten_mu_table ][0] = $top_ten_mu_table;
877
- $top_ten_all_mu_tables[ $top_ten_mu_table ][1] = in_array( $blog_id, $top_ten_mu_tables_sel_blog_ids ) ? 1 : 0;
878
- $top_ten_all_mu_tables[ $top_ten_mu_table ][2] = $blog_id;
879
- }
880
- }
881
-
882
- // Switch back to the current blog
883
- restore_current_blog();
884
-
885
- if ( ! empty( $top_ten_all_mu_tables ) ) {
886
- ?>
887
 
888
- <table class="form-table">
889
- <tr>
890
- <th>
891
- <?php _e( 'Blog ID', 'top-10' ); ?>
892
- </th>
893
- <th>
894
- <?php _e( 'Status', 'top-10' ); ?>
895
- </th>
896
- <th>
897
- <?php _e( 'Select to import', 'top-10' ); ?>
898
- </th>
899
- </tr>
 
 
 
 
 
 
900
 
901
- <?php
902
- foreach ( $top_ten_all_mu_tables as $top_ten_all_mu_table ) {
903
- ?>
904
- <tr>
905
- <td>
906
  <?php
907
- _e( 'Blog #', 'top-10' );
908
- echo $top_ten_all_mu_table[2];
909
- echo ': ';
910
- echo get_blog_details( $top_ten_all_mu_table[2] )->blogname;
911
  ?>
912
- </td>
913
- <td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
914
  <?php
915
- if ( 0 == $top_ten_all_mu_table[1] ) {
916
- echo '<span style="color:#F00">';
917
- _e( 'Not imported', 'top-10' );
918
- echo '</span>';
919
- } else {
920
- echo '<span style="color:#0F0">';
921
- _e( 'Imported', 'top-10' );
922
- echo '</span>';
923
  }
924
- ?>
925
- </td>
926
- <td>
927
- <?php
928
- if ( 0 == $top_ten_all_mu_table[1] ) {
929
- echo '<input type="checkbox" name="top_ten_all_mu_tables[' . $top_ten_all_mu_table[0] . ']" value="' . $top_ten_all_mu_table[2] . '" checked="checked" />';
930
- } else {
931
- echo '<input type="checkbox" name="top_ten_all_mu_tables[' . $top_ten_all_mu_table[0] . ']" value="' . $top_ten_all_mu_table[2] . '" />';
932
- }
933
- ?>
934
- </td>
935
- </tr>
936
- <?php
937
- }
938
- ?>
939
- </table>
940
- <p>
941
- <input type="hidden" name="top_ten_mu_tables_blog_ids" value="<?php echo implode( ',', $top_ten_mu_tables_blog_ids ); ?>" />
942
- <input name="tptn_import" type="submit" id="tptn_import" value="<?php _e( 'Begin import', 'top-10' ); ?>" class="button button-primary" />
943
- <input name="tptn_delete_selected_tables" type="submit" id="tptn_delete_selected_tables" value="<?php _e( 'Delete selected tables', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" />
944
- <input name="tptn_delete_imported_tables" type="submit" id="tptn_delete_imported_tables" value="<?php _e( 'Delete all imported tables', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" />
945
- </p>
946
- <?php
947
- } // End if ( ! empty( $top_ten_all_mu_tables ) )
948
- ?>
949
- </div>
950
- </div>
951
- <?php wp_nonce_field( 'tptn-plugin-settings' ); ?>
952
- </form>
953
  <?php
954
  }
955
  ?>
19
  ?>
20
 
21
  <div class="wrap">
22
+ <h2><?php esc_html_e( 'Top 10 Settings', 'top-10' ); ?></h2>
23
 
24
  <ul class="subsubsub">
25
  <?php
31
  do_action( 'tptn_admin_nav_bar_before' )
32
  ?>
33
 
34
+ <li><a href="#genopdiv"><?php esc_html_e( 'General options', 'top-10' ); ?></a> | </li>
35
+ <li><a href="#counteropdiv"><?php esc_html_e( 'Counter and tracker options', 'top-10' ); ?></a> | </li>
36
+ <li><a href="#pplopdiv"><?php esc_html_e( 'Popular post list options', 'top-10' ); ?></a> | </li>
37
+ <li><a href="#thumbopdiv"><?php esc_html_e( 'Thumbnail options', 'top-10' ); ?></a> | </li>
38
+ <li><a href="#customcssdiv"><?php esc_html_e( 'Styles', 'top-10' ); ?></a> | </li>
39
+ <li><a href="#tptn_maintenance_op"><?php esc_html_e( 'Maintenance', 'top-10' ); ?></a></li>
40
 
41
  <?php
42
  /**
52
  <div id="post-body" class="metabox-holder columns-2">
53
  <div id="post-body-content">
54
  <form method="post" id="tptn_options" name="tptn_options" onsubmit="return checkForm()">
55
+ <div id="genopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
56
+ <h3 class='hndle'><span><?php esc_html_e( 'General options', 'top-10' ); ?></span></h3>
57
  <div class="inside">
58
  <table class="form-table">
59
 
69
  ?>
70
 
71
  <tr>
72
+ <th scope="row"><?php esc_html_e( 'Enable trackers:', 'top-10' ); ?></th>
73
  <td>
74
  <p>
75
  <label>
76
+ <input type="checkbox" name="activate_overall" id="activate_overall" <?php checked( true, $tptn_settings['activate_overall'] ); ?> />
77
+ <?php esc_html_e( 'Overall', 'top-10' ); ?>
78
  </label>
79
  </p>
80
  <p>
81
  <label>
82
+ <input type="checkbox" name="activate_daily" id="activate_daily" <?php checked( true, $tptn_settings['activate_daily'] ); ?> />
83
+ <?php esc_html_e( 'Daily', 'top-10' ); ?>
84
  </label>
85
  </p>
86
  </td>
87
  </tr>
88
  <tr>
89
+ <th scope="row"><label for="cache"><?php esc_html_e( 'Enable cache:', 'top-10' ); ?></label></th>
90
  <td>
91
+ <p><input type="checkbox" name="cache" id="cache" <?php checked( true, $tptn_settings['cache'] ); ?> /></p>
92
+ <p class="description"><?php esc_html_e( 'If activated, Top 10 will use the Transients API to cache the popular posts output for 1 hour.', 'top-10' ); ?></p>
93
+ <p><input type="button" name="cache_clear" id="cache_clear" value="<?php esc_attr_e( 'Clear cache', 'top-10' ); ?>" class="button-secondary" onclick="return clearCache();" /></p>
94
  </td>
95
  </tr>
96
  <tr>
97
+ <th scope="row"><label for="daily_midnight"><?php esc_html_e( 'Start daily counts from midnight:', 'top-10' ); ?></label></th>
98
  <td>
99
+ <input type="checkbox" name="daily_midnight" id="daily_midnight" <?php checked( true, $tptn_settings['daily_midnight'] ); ?> />
100
+ <p class="description"><?php esc_html_e( 'Daily counter will display number of visits from midnight. This option is checked by default and mimics the way most normal counters work. Turning this off will allow you to use the hourly setting in the next option.', 'top-10' ); ?></p>
 
101
  </td>
102
  </tr>
103
  <tr>
104
+ <th scope="row"><label for="daily_range"><?php esc_html_e( 'Daily popular contains top posts over:', 'top-10' ); ?></label></th>
105
  <td>
106
+ <input type="textbox" name="daily_range" id="daily_range" size="3" value="<?php echo esc_attr( $tptn_settings['daily_range'] ); ?>"> <?php esc_html_e( 'day(s)', 'top-10' ); ?>
107
+ <input type="textbox" name="hour_range" id="hour_range" size="3" value="<?php echo esc_attr( $tptn_settings['hour_range'] ); ?>"> <?php esc_html_e( 'hour(s)', 'top-10' ); ?>
108
+ <p class="description"><?php esc_html_e( 'Think of Daily Popular has a custom date range applied as a global setting. Instead of displaying popular posts from the past day, this setting lets you display posts for as many days or as few hours as you want. This can be overridden in the widget.', 'top-10' ); ?></p>
109
  </td>
110
  </tr>
111
  <tr>
112
+ <th scope="row"><label for="uninstall_clean_options"><?php esc_html_e( 'Delete options on uninstall', 'top-10' ); ?></label></th>
113
  <td>
114
+ <input type="checkbox" name="uninstall_clean_options" id="uninstall_clean_options" <?php checked( true, $tptn_settings['uninstall_clean_options'] ); ?> />
115
+ <p class="description"><?php esc_html_e( 'If this is checked, all settings related to Top 10 are removed from the database if you choose to uninstall/delete the plugin.', 'top-10' ); ?></p>
 
116
  </td>
117
  </tr>
118
  <tr>
119
+ <th scope="row"><label for="uninstall_clean_tables"><?php esc_html_e( 'Delete counter data on uninstall', 'top-10' ); ?></label></th>
120
  <td>
121
+ <input type="checkbox" name="uninstall_clean_tables" id="uninstall_clean_tables" <?php checked( true, $tptn_settings['uninstall_clean_tables'] ); ?> />
122
+ <p class="description"><?php esc_html_e( 'If this is checked, the tables containing the counter statistics are removed from the database if you choose to uninstall/delete the plugin.', 'top-10' ); ?></p>
123
+ <p class="description"><?php esc_html_e( "Keep this unchecked if you choose to reinstall the plugin and don't want to lose your counter data.", 'top-10' ); ?></p>
124
  </td>
125
  </tr>
126
+ <tr><th scope="row"><label for="show_metabox"><?php esc_html_e( 'Show metabox:', 'top-10' ); ?></label></th>
 
127
  <td>
128
+ <input type="checkbox" name="show_metabox" id="show_metabox" <?php checked( true, $tptn_settings['show_metabox'] ); ?> />
129
+ <p class="description"><?php esc_html_e( 'This will add the Top 10 metabox on Edit Posts or Add New Posts screens. Also applies to Pages and Custom Post Types.', 'top-10' ); ?></p>
 
 
 
 
 
 
 
130
  </td>
131
  </tr>
132
 
133
+ <tr><th scope="row"><label for="show_metabox_admins"><?php esc_html_e( 'Limit metabox to Admins only:', 'top-10' ); ?></label></th>
134
  <td>
135
+ <input type="checkbox" name="show_metabox_admins" id="show_metabox_admins" <?php checked( true, $tptn_settings['show_metabox_admins'] ); ?> />
136
+ <p class="description"><?php esc_html_e( 'If this is selected, the metabox will be hidden from anyone who is not an Admin. Otherwise, by default, Contributors and above will be able to see the metabox. This applies only if the above option is selected.', 'top-10' ); ?></p>
137
  </td>
138
  </tr>
139
 
140
  <tr>
141
+ <th scope="row"><label for="show_credit"><?php esc_html_e( 'Link to Top 10 plugin page', 'top-10' ); ?></label></th>
142
  <td>
143
+ <input type="checkbox" name="show_credit" id="show_credit" <?php checked( true, $tptn_settings['show_credit'] ); ?> />
144
+ <p class="description"><?php esc_html_e( 'A link to the plugin is added as an extra list item to the list of popular posts', 'top-10' ); ?></p>
145
  </td>
146
  </tr>
147
  <tr>
148
  <td scope="row" colspan="2">
149
+ <input type="submit" name="tptn_save" id="tptn_genop_save" value="<?php esc_attr_e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
150
  </td>
151
  </tr>
152
 
164
  </table>
165
  </div>
166
  </div>
167
+ <div id="counteropdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
168
+ <h3 class='hndle'><span><?php esc_html_e( 'Counter and tracker options', 'top-10' ); ?></span></h3>
169
  <div class="inside">
170
  <table class="form-table">
171
 
181
  ?>
182
 
183
  <tr>
184
+ <th scope="row"><?php esc_html_e( 'Display number of views on:', 'top-10' ); ?></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  <td>
186
+ <label><input type="checkbox" name="add_to_content" id="add_to_content" <?php checked( true, $tptn_settings['add_to_content'] ); ?> /> <?php esc_html_e( 'Posts', 'top-10' ); ?></label><br />
187
+ <label><input type="checkbox" name="count_on_pages" id="count_on_pages" <?php checked( true, $tptn_settings['count_on_pages'] ); ?> /> <?php esc_html_e( 'Pages', 'top-10' ); ?></label><br />
188
+ <label><input type="checkbox" name="add_to_home" id="add_to_home" <?php checked( true, $tptn_settings['add_to_home'] ); ?> /> <?php esc_html_e( 'Home page', 'top-10' ); ?></label></label><br />
189
+ <label><input type="checkbox" name="add_to_feed" id="add_to_feed" <?php checked( true, $tptn_settings['add_to_feed'] ); ?> /> <?php esc_html_e( 'Feeds', 'top-10' ); ?></label></label><br />
190
+ <label><input type="checkbox" name="add_to_category_archives" id="add_to_category_archives" <?php checked( true, $tptn_settings['add_to_category_archives'] ); ?> /> <?php esc_html_e( 'Category archives', 'top-10' ); ?></label><br />
191
+ <label><input type="checkbox" name="add_to_tag_archives" id="add_to_tag_archives" <?php checked( true, $tptn_settings['add_to_tag_archives'] ); ?> /> <?php esc_html_e( 'Tag archives', 'top-10' ); ?></label></label><br />
192
+ <label><input type="checkbox" name="add_to_archives" id="add_to_archives" <?php checked( true, $tptn_settings['add_to_archives'] ); ?> /> <?php esc_html_e( 'Other archives', 'top-10' ); ?></label></label>
193
+ <p class="description">
194
+ <?php printf( esc_html__( 'If you choose to disable this, please add %s to your template file where you want it displayed', 'top-10' ), "<code>&lt;?php if ( function_exists ( 'echo_tptn_post_count' ) ) echo_tptn_post_count(); ?&gt;</code>" ); ?>
195
+ </p>
196
  </td>
197
  </tr>
198
  <tr>
199
+ <th scope="row"><label for="title"><?php esc_html_e( 'Format to display the post views:', 'top-10' ); ?></label></th>
200
  <td>
201
+ <textarea name="count_disp_form" id="count_disp_form" cols="50" rows="3" style="width:100%"><?php echo esc_textarea( $tptn_settings['count_disp_form'] ); ?></textarea>
202
+ <p class="description">
203
+ <?php printf( esc_html__( 'Use %1$s to display the total count, %2$s for daily count and %3$s for overall counts across all posts. Default display is %4$s ', 'top-10' ),
204
+ '<code>%totalcount%</code>',
205
+ '<code>%dailycount%</code>',
206
+ '<code>%overallcount%</code>',
207
+ '<code>(Visited %totalcount% times, %dailycount% visits today)</code>'
208
+ ); ?>
209
+ </p>
210
  </td>
211
  </tr>
212
  <tr>
213
+ <th scope="row"><label for="title"><?php esc_html_e( 'What do display when there are no visits?', 'top-10' ); ?></label></th>
214
  <td>
215
+ <textarea name="count_disp_form_zero" id="count_disp_form_zero" cols="50" rows="3" style="width:100%"><?php echo esc_textarea( $tptn_settings['count_disp_form_zero'] ); ?></textarea>
216
+ <p class="description"><?php esc_html_e( "This text applies only when there are 0 hits for the post and it isn't a single page. e.g. if you display post views on the homepage or archives then this text will be used. To override this, just enter the same text as above option.", 'top-10' ); ?>
217
  </td>
218
  </tr>
219
  <tr>
220
+ <th scope="row"><label for="dynamic_post_count"><?php esc_html_e( 'Always display latest post count', 'top-10' ); ?></label></th>
221
  <td>
222
+ <input type="checkbox" name="dynamic_post_count" id="dynamic_post_count" <?php checked( true, $tptn_settings['dynamic_post_count'] ); ?> />
223
+ <p class="description"><?php esc_html_e( 'This option uses JavaScript and will increase your page load time. Turn this off if you are not using caching plugins or are OK with displaying older cached counts.', 'top-10' ); ?></p>
224
  </td>
225
  </tr>
226
+
227
+ <tr><th scope="row"><?php esc_html_e( 'Tracker type', 'top-10' ); ?>:</th>
228
  <td>
229
+ <?php
230
+ $trackers = tptn_get_tracker_types();
231
+
232
+ foreach ( $trackers as $tracker ) :
233
+ ?>
234
+
235
+ <label>
236
+ <input type="radio" name="tracker_type" value="<?php echo esc_attr( $tracker['id'] ); ?>" id="<?php echo esc_attr( $tracker['id'] ); ?>" <?php checked( $tracker['id'], $tptn_settings['tracker_type'], true ) ?> />
237
+ <?php echo esc_html( $tracker['name'] ) ?>
238
+ </label>
239
+ - <em><?php echo esc_html( $tracker['description'] ) ?></em>
240
+ <br />
241
+
242
+ <?php endforeach; ?>
243
  </td>
244
  </tr>
245
+
246
  <tr>
247
+ <th scope="row"><label><?php esc_html_e( 'Track user groups', 'top-10' ); ?></label></th>
248
  <td>
249
+ <label>
250
+ <input type="checkbox" name="track_authors" id="track_authors" <?php checked( true, $tptn_settings['track_authors'], true ); ?> />
251
+ <?php esc_html_e( 'Authors on their own posts', 'top-10' ); ?>
252
+ </label><br />
253
+ <label>
254
+ <input type="checkbox" name="track_editors" id="track_editors" <?php checked( true, $tptn_settings['track_editors'], true ); ?> />
255
+ <?php esc_html_e( 'Editors', 'top-10' ); ?>
256
+ </label><br />
257
+ <label>
258
+ <input type="checkbox" name="track_admins" id="track_admins" <?php checked( true, $tptn_settings['track_admins'], true ); ?> />
259
+ <?php esc_html_e( 'Admins', 'top-10' ); ?>
260
+ </label>
261
+ <p class="description"><?php esc_html_e( 'If the current user falls into any one of the three groups when browsing a post, then the tracker is disabled', 'top-10' ); ?></p>
262
  </td>
263
  </tr>
264
  <tr>
265
+ <th scope="row"><label for="pv_in_admin"><?php esc_html_e( 'Display page views on Posts and Pages in Admin', 'top-10' ); ?></label></th>
266
  <td>
267
+ <input type="checkbox" name="pv_in_admin" id="pv_in_admin" <?php checked( true, $tptn_settings['pv_in_admin'] ); ?> />
268
+ <p class="description"><?php esc_html_e( "Adds three columns called Total Views, Today's Views and Views to All Posts and All Pages", 'top-10' ); ?></p>
269
  </td>
270
  </tr>
271
  <tr>
272
+ <th scope="row"><label for="show_count_non_admins"><?php esc_html_e( 'Show number of views to non-admins', 'top-10' ); ?></label></th>
273
  <td>
274
+ <input type="checkbox" name="show_count_non_admins" id="show_count_non_admins" <?php checked( true, $tptn_settings['show_count_non_admins'] ); ?> />
275
+ <p class="description"><?php esc_html_e( "If you disable this then non-admins won't see the above columns or view the independent pages with the top posts", 'top-10' ); ?></p>
276
  </td>
277
  </tr>
278
  <tr>
279
  <td scope="row" colspan="2">
280
+ <input type="submit" name="tptn_save" id="tptn_counterop_save" value="<?php esc_html_e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
281
  </td>
282
  </tr>
283
 
295
  </table>
296
  </div>
297
  </div>
298
+ <div id="pplopdiv" class="postbox"><div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
299
+ <h3 class='hndle'><span><?php esc_html_e( 'Popular post list options', 'top-10' ); ?></span></h3>
300
  <div class="inside">
301
  <table class="form-table">
302
 
312
  ?>
313
 
314
  <tr>
315
+ <th scope="row"><label for="limit"><?php esc_html_e( 'Number of popular posts to display:', 'top-10' ); ?></label></th>
316
  <td>
317
  <input type="textbox" name="limit" id="limit" value="<?php echo esc_attr( stripslashes( $tptn_settings['limit'] ) ); ?>">
318
+ <p class="description"><?php esc_html_e( "Maximum number of posts that will be displayed in the list. This option is used if you don't specify the number of posts in the widget or shortcodes", 'top-10' ); ?></p>
319
  </td>
320
  </tr>
321
  <tr>
322
+ <th scope="row"><label for="how_old"><?php esc_html_e( 'Published age of posts:', 'top-10' ); ?></label></th>
323
  <td>
324
+ <input type="textbox" name="how_old" id="how_old" value="<?php echo esc_attr( stripslashes( $tptn_settings['how_old'] ) ); ?>"> <?php esc_html_e( 'days', 'top-10' ); ?>
325
+ <p class="description"><?php esc_html_e( 'This options allows you to only show posts that have been published within the above day range. Applies to both overall posts and daily posts lists.', 'top-10' ); ?></p>
326
+ <p class="description"><?php esc_html_e( 'e.g. 365 days will only show posts published in the last year in the popular posts lists. Enter 0 for no restriction.', 'top-10' ); ?></p>
327
  </td>
328
  </tr>
329
  <tr>
330
+ <th scope="row"><?php esc_html_e( 'Post types to include in results (including custom post types)', 'top-10' ); ?></th>
331
  <td>
332
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
333
 
334
  <label>
335
+ <input type="checkbox" name="post_types[]" value="<?php echo esc_attr( $wp_post_type ); ?>" <?php checked( true, in_array( $wp_post_type, $posts_types_inc, true ) ); ?> />
336
+ <?php echo esc_html( $wp_post_type ); ?>
337
  </label>
338
  <br />
339
 
341
  </td>
342
  </tr>
343
  <tr>
344
+ <th scope="row"><label for="exclude_post_ids"><?php esc_html_e( 'List of post or page IDs to exclude from the results:', 'top-10' ); ?></label></th>
345
  <td><input type="textbox" name="exclude_post_ids" id="exclude_post_ids" value="<?php echo esc_attr( stripslashes( $tptn_settings['exclude_post_ids'] ) ); ?>" style="width:250px">
346
+ <p class="description"><?php esc_html_e( 'Enter comma separated list of IDs. e.g. 188,320,500', 'top-10' ); ?></p>
347
  </td>
348
  </tr>
349
  <tr>
350
+ <th scope="row"><label for="exclude_cat_slugs"><?php esc_html_e( 'Exclude Categories:', 'top-10' ); ?></label></th>
351
+ <td>
352
+ <label><input type="textbox" name="exclude_cat_slugs" id="exclude_cat_slugs" value="<?php echo esc_attr( $tptn_settings['exclude_cat_slugs'] ); ?>" onfocus="setSuggest('exclude_cat_slugs', 'category');" class="widefat"></label>
353
+ <p class="description"><?php esc_html_e( 'Comma separated list of category names. The field above has an autocomplete so simply start typing in the starting letters and it will prompt you with options. Does not support tags or custom taxonomies.', 'top-10' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  <p class="description highlight">
355
  <?php
356
+ esc_html_e( 'Excluded category IDs are:', 'top-10' );
357
+ echo ' ' . esc_html( $tptn_settings['exclude_categories'] );
358
  ?>
359
  </p>
360
  <p class="description">
361
  <?php
362
+ printf( esc_html__( 'These might differ from the IDs visible in the Categories page which use the %1$s. Top 10 uses the %2$s which is unique to this taxonomy.', 'top-10' ), '<code>term_id</code>', '<code>term_taxonomy_id</code>' ); ?>
363
  ?>
364
  </p>
365
  </td>
366
  </tr>
367
  <tr>
368
+ <th scope="row"><label for="title"><?php esc_html_e( 'Title of popular posts:', 'top-10' ); ?></label></th>
369
  <td>
370
+ <input type="textbox" name="title" id="title" value="<?php echo esc_attr( $tptn_settings['title'] ); ?>" style="width:250px" />
371
  </td>
372
  </tr>
373
  <tr>
374
+ <th scope="row"><label for="title_daily"><?php esc_html_e( 'Title of daily popular posts:', 'top-10' ); ?></label></th>
375
  <td>
376
+ <input type="textbox" name="title_daily" id="title_daily" value="<?php echo esc_attr( $tptn_settings['title_daily'] ); ?>" style="width:250px" />
377
  </td>
378
  </tr>
379
  <tr>
380
+ <th scope="row"><label for="blank_output"><?php esc_html_e( 'When there are no posts, what should be shown?', 'top-10' ); ?></label></th>
381
  <td>
382
  <label>
383
+ <input type="radio" name="blank_output" value="blank" id="blank_output_0" <?php checked( true, $tptn_settings['blank_output'] ); ?> />
384
+ <?php esc_html_e( 'Blank Output', 'top-10' ); ?>
385
+ </label>
386
  <br />
387
  <label>
388
+ <input type="radio" name="blank_output" value="customs" id="blank_output_1" <?php checked( false, $tptn_settings['blank_output'] ); ?> />
389
+ <?php esc_html_e( 'Display:', 'top-10' ); ?>
390
+ </label>
391
+ <input type="textbox" name="blank_output_text" id="blank_output_text" value="<?php echo esc_attr( $tptn_settings['blank_output_text'] ); ?>" style="width:250px" />
392
  </td>
393
  </tr>
394
  <tr>
395
+ <th scope="row"><label for="show_excerpt"><?php esc_html_e( 'Show post excerpt in list?', 'top-10' ); ?></label></th>
396
  <td>
397
+ <input type="checkbox" name="show_excerpt" id="show_excerpt" <?php checked( true, $tptn_settings['show_excerpt'] ); ?> />
398
  </td>
399
  </tr>
400
  <tr>
401
+ <th scope="row"><label for="excerpt_length"><?php esc_html_e( 'Length of excerpt (in words):', 'top-10' ); ?></label></th>
402
  <td>
403
+ <input type="textbox" name="excerpt_length" id="excerpt_length" value="<?php echo esc_attr( $tptn_settings['excerpt_length'] ); ?>" />
404
  </td>
405
  </tr>
406
  <tr>
407
+ <th scope="row"><label for="show_author"><?php esc_html_e( 'Show post author in list?', 'top-10' ); ?></label></th>
408
  <td>
409
+ <input type="checkbox" name="show_author" id="show_author" <?php checked( true, $tptn_settings['show_author'] ); ?> />
410
  </td>
411
  </tr>
412
  <tr>
413
+ <th scope="row"><label for="show_date"><?php esc_html_e( 'Show post date in list?', 'top-10' ); ?></label></th>
414
  <td>
415
+ <input type="checkbox" name="show_date" id="show_date" <?php checked( $tptn_settings['show_date'] ); ?> />
416
  </td>
417
  </tr>
418
  <tr>
419
+ <th scope="row"><label for="title_length"><?php esc_html_e( 'Limit post title length (in characters)', 'top-10' ); ?></label></th>
420
  <td>
421
+ <input type="textbox" name="title_length" id="title_length" value="<?php echo esc_attr( $tptn_settings['title_length'] ); ?>" />
422
  </td>
423
  </tr>
424
  <tr>
425
+ <th scope="row"><label for="disp_list_count"><?php esc_html_e( 'Show view count in list?', 'top-10' ); ?></label></th>
426
  <td>
427
+ <input type="checkbox" name="disp_list_count" id="disp_list_count" <?php checked( true, $tptn_settings['disp_list_count'] ); ?> />
428
  </td>
429
  </tr>
430
  <tr>
431
+ <th scope="row"><label for="link_new_window "><?php esc_html_e( 'Open links in new window', 'top-10' ); ?></label></th>
432
  <td>
433
+ <input type="checkbox" name="link_new_window" id="link_new_window" <?php checked( true, $tptn_settings['link_new_window'] ); ?> />
434
  </td>
435
  </tr>
436
  <tr>
437
+ <th scope="row"><label for="link_nofollow"><?php esc_html_e( 'Add nofollow attribute to links in the list', 'top-10' ); ?></label></th>
438
  <td>
439
+ <input type="checkbox" name="link_nofollow" id="link_nofollow" <?php checked( true, $tptn_settings['link_nofollow'] ); ?> />
440
  </td>
441
  </tr>
442
  <tr>
443
+ <th scope="row"><label for="exclude_on_post_ids"><?php esc_html_e( 'Exclude display of related posts on these posts / pages', 'top-10' ); ?></label></th>
444
  <td>
445
  <input type="textbox" name="exclude_on_post_ids" id="exclude_on_post_ids" value="<?php echo esc_attr( stripslashes( $tptn_settings['exclude_on_post_ids'] ) ); ?>" style="width:250px">
446
+ <p class="description"><?php esc_html_e( 'Enter comma separated list of IDs. e.g. 188,320,500', 'top-10' ); ?></p>
447
  </td>
448
  </tr>
449
 
450
+ <tr style="background: #eee"><th scope="row" colspan="2"><?php esc_html_e( 'Customise the list HTML', 'top-10' ); ?></th>
451
  </tr>
452
  <tr>
453
+ <th scope="row"><label for="before_list"><?php esc_html_e( 'HTML to display before the list of posts:', 'top-10' ); ?></label></th>
454
  <td>
455
  <input type="textbox" name="before_list" id="before_list" value="<?php echo esc_attr( stripslashes( $tptn_settings['before_list'] ) ); ?>" style="width:250px" />
456
  </td>
457
  </tr>
458
  <tr>
459
+ <th scope="row"><label for="before_list_item"><?php esc_html_e( 'HTML to display before each list item:', 'top-10' ); ?></label></th>
460
  <td>
461
  <input type="textbox" name="before_list_item" id="before_list_item" value="<?php echo esc_attr( stripslashes( $tptn_settings['before_list_item'] ) ); ?>" style="width:250px" />
462
  </td>
463
  </tr>
464
  <tr>
465
+ <th scope="row"><label for="after_list_item"><?php esc_html_e( 'HTML to display after each list item:', 'top-10' ); ?></label></th>
466
  <td>
467
  <input type="textbox" name="after_list_item" id="after_list_item" value="<?php echo esc_attr( stripslashes( $tptn_settings['after_list_item'] ) ); ?>" style="width:250px" />
468
  </td>
469
  </tr>
470
  <tr>
471
+ <th scope="row"><label for="after_list"><?php esc_html_e( 'HTML to display after the list of posts:', 'top-10' ); ?></label></th>
472
  <td>
473
  <input type="textbox" name="after_list" id="after_list" value="<?php echo esc_attr( stripslashes( $tptn_settings['after_list'] ) ); ?>" style="width:250px" />
474
  </td>
475
  </tr>
476
  <tr>
477
  <td scope="row" colspan="2">
478
+ <input type="submit" name="tptn_save" id="tptn_pplop_save" value="<?php esc_attr_e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
479
  </td>
480
  </tr>
481
 
493
  </table>
494
  </div>
495
  </div>
496
+ <div id="thumbopdiv" class="postbox"><div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
497
+ <h3 class='hndle'><span><?php esc_html_e( 'Thumbnail options', 'top-10' ); ?></span></h3>
498
  <div class="inside">
499
  <table class="form-table">
500
 
509
  do_action( 'tptn_admin_thumbnail_options_before', $tptn_settings );
510
  ?>
511
 
512
+ <tr><th scope="row"><label for="post_thumb_op"><?php esc_html_e( 'Location of post thumbnail:', 'top-10' ); ?></label></th>
513
  <td>
514
  <label>
515
+ <input type="radio" name="post_thumb_op" value="inline" id="post_thumb_op_0" <?php checked( 'inline', $tptn_settings['post_thumb_op'], true ); ?> />
516
+ <?php esc_html_e( 'Display thumbnails inline with posts, before title', 'top-10' ); ?>
517
  </label>
518
  <br />
519
  <label>
520
+ <input type="radio" name="post_thumb_op" value="after" id="post_thumb_op_1" <?php checked( 'after', $tptn_settings['post_thumb_op'], true ); ?> />
521
+ <?php esc_html_e( 'Display thumbnails inline with posts, after title', 'top-10' ); ?>
522
  </label>
523
  <br />
524
  <label>
525
+ <input type="radio" name="post_thumb_op" value="thumbs_only" id="post_thumb_op_2" <?php checked( 'thumbs_only', $tptn_settings['post_thumb_op'], true ); ?> />
526
+ <?php esc_html_e( 'Display only thumbnails, no text', 'top-10' ); ?>
527
  </label>
528
  <br />
529
  <label>
530
+ <input type="radio" name="post_thumb_op" value="text_only" id="post_thumb_op_3" <?php checked( 'text_only', $tptn_settings['post_thumb_op'], true ); ?> />
531
+ <?php esc_html_e( 'Do not display thumbnails, only text.', 'top-10' ); ?>
532
  </label>
533
 
534
+ <?php if ( 'left_thumbs' === $tptn_settings['tptn_styles'] ) { ?>
535
+ <p style="color: #F00"><?php esc_html_e( 'This setting cannot be changed because an inbuilt style has been selected under the Styles section. If you would like to change this option, please select No styles under the Styles section.', 'top-10' ); ?></p>
536
  <?php } ?>
537
  </td>
538
  </tr>
539
+ <tr><th scope="row"><?php esc_html_e( 'Thumbnail size:', 'top-10' ); ?></th>
540
  <td>
541
  <?php
542
+ $tptn_get_all_image_sizes = tptn_get_all_image_sizes();
543
+
544
  if ( isset( $tptn_get_all_image_sizes['tptn_thumbnail'] ) ) {
545
  unset( $tptn_get_all_image_sizes['tptn_thumbnail'] );
546
  }
548
  foreach ( $tptn_get_all_image_sizes as $size ) :
549
  ?>
550
  <label>
551
+ <input type="radio" name="thumb_size" value="<?php echo esc_attr( $size['name'] ); ?>" id="<?php echo esc_attr( $size['name'] ); ?>" <?php checked( $tptn_settings['thumb_size'], $size['name'], true ); ?> />
552
+ <?php echo esc_attr( $size['name'] ); ?> ( <?php echo esc_attr( $size['width'] ); ?>x<?php echo esc_attr( $size['height'] ); ?>
553
  <?php
554
  if ( $size['crop'] ) {
555
  echo 'cropped';
561
  <?php endforeach; ?>
562
 
563
  <label>
564
+ <input type="radio" name="thumb_size" value="tptn_thumbnail" id="tptn_thumbnail" <?php checked( $tptn_settings['thumb_size'], 'tptn_thumbnail', true ); ?> /> <?php esc_html_e( 'Custom size', 'top-10' ); ?>
565
  </label>
566
  <p class="description">
567
+ <?php esc_html_e( 'You can choose from existing image sizes above or create a custom size. If you have chosen Custom size above, then enter the width, height and crop settings below. For best results, use a cropped image.', 'top-10' ); ?><br />
568
+ <?php esc_html_e( 'If you change the width and/or height below, existing images will not be automatically resized.', 'top-10' ); ?>
569
+ <?php printf(
570
+ esc_html__( 'I recommend using %1$s or %2$s to regenerate all image sizes.', 'top-10' ),
571
+ '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=otf-regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">OTF Regenerate Thumbnails</a>',
572
+ '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">Regenerate Thumbnails</a>'
573
+ ); ?>
574
  </p>
575
  <p class="description">
576
+ <?php esc_html_e( "If you're using the Left Thumbs style below then the thumbnail width and height that you set here will supersede the widget. Alternatively, choose <strong>Style attributes</strong> under <strong>Image size attributes</strong> option below", 'top-10' ); ?>
577
  </p>
578
  </td>
579
+ </tr>
580
+ <tr><th scope="row"><label for="thumb_width"><?php esc_html_e( 'Width of custom thumbnail', 'top-10' ); ?>:</label></th>
581
  <td>
582
  <input type="textbox" name="thumb_width" id="thumb_width" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_width'] ) ); ?>" style="width:50px" />px
583
  </td>
584
  </tr>
585
+ <tr><th scope="row"><label for="thumb_height"><?php esc_html_e( 'Height of custom thumbnail', 'top-10' ); ?>:</label></th>
586
  <td>
587
  <input type="textbox" name="thumb_height" id="thumb_height" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_height'] ) ); ?>" style="width:50px" />px
588
  </td>
589
  </tr>
590
+ <tr><th scope="row"><label for="thumb_crop"><?php esc_html_e( 'Hard crop thumbnails', 'top-10' ); ?>:</label></th>
591
  <td>
592
+ <input type="checkbox" name="thumb_crop" id="thumb_crop" <?php checked( true, $tptn_settings['thumb_crop'] ); ?> />
593
  <p class="description">
594
+ <?php esc_html_e( 'By default, thumbnails will be proportionately cropped. Check this box to hard crop the thumbnails.', 'top-10' ); ?>
595
+ <?php printf( esc_html__( "<a href='%s' target='_blank'>Difference between soft and hard crop</a>", 'top-10' ), esc_url( 'http://www.davidtan.org/wordpress-hard-crop-vs-soft-crop-difference-comparison-example/' ) ); ?>
596
  </p>
597
  </td>
598
  </tr>
599
+ <tr><th scope="row"><label for="thumb_html"><?php esc_html_e( 'Image size attributes:', 'top-10' ); ?></label></th>
600
  <td>
601
  <label>
602
+ <input type="radio" name="thumb_html" value="css" id="thumb_html_0" <?php checked( 'css', $tptn_settings['thumb_html'], true ); ?> />
603
+ <?php esc_html_e( 'Style attributes. e.g.', 'top-10' );
604
+ echo ' <code>style="max-width:' . esc_attr( $tptn_settings['thumb_width'] ) . 'px;max-height:' . esc_attr( $tptn_settings['thumb_height'] ) . 'px;"</code>'; ?>
605
  </label>
606
  <br />
607
  <label>
608
+ <input type="radio" name="thumb_html" value="html" id="thumb_html_1" <?php checked( 'html', $tptn_settings['thumb_html'], true ); ?> />
609
+ <?php esc_html_e( 'HTML width and height attributes. e.g.', 'top-10' );
610
+ echo ' <code>width="' . esc_attr( $tptn_settings['thumb_width'] ) . '" height="' . esc_attr( $tptn_settings['thumb_height'] ) . '"</code>' ?>
611
  </label>
612
  <br />
613
  <label>
614
+ <input type="radio" name="thumb_html" value="none" id="thumb_html_1" <?php checked( 'none', $tptn_settings['thumb_html'], true ); ?> />
615
+ <?php esc_html_e( 'No HTML or Style attributes', 'top-10' ); ?>
616
  </label>
617
  <br />
618
  </td>
619
  </tr>
620
+ <tr><th scope="row"><label for="thumb_meta"><?php esc_html_e( 'Post thumbnail meta field name:', 'top-10' ); ?></label></th>
621
  <td>
622
  <input type="textbox" name="thumb_meta" id="thumb_meta" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_meta'] ) ); ?>">
623
+ <p class="description"><?php esc_html_e( 'The value of this field should contain the image source and is set in the <em>Add New Post</em> screen', 'top-10' ); ?></p>
624
  </td>
625
  </tr>
626
+ <tr><th scope="row"><label for="scan_images"><?php esc_html_e( 'If the postmeta is not set, then should the plugin extract the first image from the post?', 'top-10' ); ?></label></th>
627
  <td>
628
+ <input type="checkbox" name="scan_images" id="scan_images" <?php checked( true, $tptn_settings['scan_images'] ); ?> />
629
+ <p class="description"><?php esc_html_e( 'This could slow down the loading of your page if the first image in the related posts is large in file-size', 'top-10' ); ?></p>
630
  </td>
631
  </tr>
632
+ <tr><th scope="row"><label for="thumb_default_show"><?php esc_html_e( 'Use default thumbnail?', 'top-10' ); ?></label></th>
633
  <td>
634
+ <input type="checkbox" name="thumb_default_show" id="thumb_default_show" <?php checked( true, $tptn_settings['thumb_default_show'] ); ?> />
635
+ <p class="description"><?php esc_html_e( 'If checked, when no thumbnail is found, show a default one from the URL below. If not checked and no thumbnail is found, no image will be shown.', 'top-10' ); ?></p>
636
  </td>
637
  </tr>
638
+ <tr><th scope="row"><label for="thumb_default"><?php esc_html_e( 'Default thumbnail:', 'top-10' ); ?></label></th>
639
  <td>
640
  <input type="textbox" name="thumb_default" id="thumb_default" value="<?php echo esc_attr( stripslashes( $tptn_settings['thumb_default'] ) ); ?>" style="width:100%"> <br />
641
+ <?php if ( '' !== $tptn_settings['thumb_default'] ) { printf( "<img src='%s' style='max-width:200px' />", esc_url( $tptn_settings['thumb_default'] ) ); } ?>
642
+ <p class="description"><?php esc_html_e( "The plugin will first check if the post contains a thumbnail. If it doesn't then it will check the meta field. If this is not available, then it will show the default image as specified above", 'top-10' ); ?></p>
643
  </td>
644
  </tr>
645
  <tr>
646
  <td scope="row" colspan="2">
647
+ <input type="submit" name="tptn_save" id="tptn_thumbop_save" value="<?php esc_attr_e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
648
  </td>
649
  </tr>
650
 
662
  </table>
663
  </div>
664
  </div>
665
+ <div id="customcssdiv" class="postbox"><div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
666
+ <h3 class='hndle'><span><?php esc_html_e( 'Styles', 'top-10' ); ?></span></h3>
667
  <div class="inside">
668
  <table class="form-table">
669
 
678
  do_action( 'tptn_admin_custom_styles_before', $tptn_settings );
679
  ?>
680
 
681
+ <tr><th scope="row"><?php esc_html_e( 'Style of the popular posts:', 'top-10' ); ?></th>
682
  <td>
683
  <label>
684
+ <input type="radio" name="tptn_styles" value="no_style" id="tptn_styles_1" <?php checked( 'no_style', $tptn_settings['tptn_styles'], true ); ?> /> <?php esc_html_e( 'No styles', 'top-10' ); ?>
685
  </label>
686
+ <p class="description"><?php esc_html_e( 'Select this option if you plan to add your own styles', 'top-10' ); ?></p>
687
  <br />
688
 
689
  <label>
690
+ <input type="radio" name="tptn_styles" value="left_thumbs" id="tptn_styles_0" <?php if ( $tptn_settings['include_default_style'] && ( 'left_thumbs' === $tptn_settings['tptn_styles'] ) ) { echo 'checked="checked"'; } ?> />
691
+ <?php esc_html_e( 'Left Thumbnails', 'top-10' ); ?>
692
  </label>
693
+ <p class="description"><img src="<?php echo esc_url( plugins_url( 'admin/images/tptn-left-thumbs.png', TOP_TEN_PLUGIN_FILE ) ); ?>" /></p>
694
+ <p class="description"><?php esc_html_e( 'Enabling this option will set the post thumbnail to be before text. Disabling this option will not revert any settings.', 'top-10' ); ?></p>
695
+ <p class="description"><?php printf( esc_html__( 'You can view the default style at %s', 'top-10' ), '<a href="https://github.com/WebberZone/top-10/blob/master/css/default-style.css" target="_blank">https://github.com/WebberZone/top-10/blob/master/css/default-style.css</a>' ); ?></p>
696
  <br />
697
 
698
  <label>
699
+ <input type="radio" name="tptn_styles" value="text_only" id="tptn_styles_1" <?php checked( 'text_only', $tptn_settings['tptn_styles'], true ); ?> /> <?php esc_html_e( 'Text only', 'top-10' ); ?>
700
  </label>
701
+ <p class="description"><?php esc_html_e( 'Enabling this option will disable thumbnails and no longer include the default style sheet included in the plugin.', 'top-10' ); ?></p>
702
 
703
  <?php
704
  /**
714
  </td>
715
  </tr>
716
 
717
+ <tr><th scope="row" colspan="2"><?php esc_html_e( 'Custom CSS to add to header:', 'top-10' ); ?></th>
718
  </tr>
719
  <tr>
720
  <td scope="row" colspan="2">
721
+ <textarea name="custom_CSS" id="custom_CSS" rows="15" cols="80" style="width:100%"><?php echo esc_textarea( $tptn_settings['custom_CSS'] ); ?></textarea>
722
+ <p class="description"><?php printf( esc_html__( 'Do not include %1$s tags. Check out the %2$s for available CSS classes to style.', 'top-10' ), '<code>style</code>', '<a href="http://wordpress.org/extend/plugins/top-10/faq/" target="_blank">FAQ</a>' ); ?></p>
723
  </td>
724
  </tr>
725
 
738
  </div>
739
  </div>
740
  <p>
741
+ <input type="submit" name="tptn_save" id="tptn_save" value="<?php esc_attr_e( 'Save Options', 'top-10' ); ?>" class="button button-primary" />
742
+ <input type="submit" name="tptn_default" id="tptn_default" value="<?php esc_attr_e( 'Default Options', 'top-10' ); ?>" class="button button-secondary" onclick="if (!confirm('<?php esc_attr_e( 'Do you want to set options to Default?', 'top-10' ); ?>')) return false;" />
743
  </p>
744
  <?php wp_nonce_field( 'tptn-plugin-settings' ); ?>
745
  </form>
758
  <hr class="clear" />
759
 
760
  <form method="post" id="tptn_maintenance_op" name="tptn_reset_options" onsubmit="return checkForm()">
761
+ <div id="resetopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
762
+ <h3 class='hndle'><span><?php esc_html_e( 'Maintenance', 'top-10' ); ?></span></h3>
763
  <div class="inside">
764
  <table class="form-table">
765
  <tr><td scope="row" colspan="2">
766
+ <p class="description"><?php esc_html_e( 'Over time the Daily Top 10 database grows in size, which reduces the performance of the plugin. Cleaning the database at regular intervals could improve performance, especially on high traffic blogs. Enabling maintenance will automatically delete entries older than 90 days.', 'top-10' ); ?><br />
767
+ <strong><?php esc_html_e( 'Note: When scheduled maintenance is enabled, WordPress will run the cron job everytime the job is rescheduled (i.e. you change the settings below).', 'top-10' ); ?></strong>
768
  </td>
769
  </tr>
770
+ <tr><th scope="row"><label for="cron_on"><?php esc_html_e( 'Enable scheduled maintenance of daily tables:', 'top-10' ); ?></label></th>
771
+ <td><input type="checkbox" name="cron_on" id="cron_on" <?php checked( true, $tptn_settings['cron_on'] ); ?> />
772
  </td>
773
  </tr>
774
+ <tr><th scope="row"><label for="cron_hour"><?php esc_html_e( 'Time to run maintenance', 'top-10' ); ?></label></th>
775
+ <td><input type="textbox" name="cron_hour" id="cron_hour" value="<?php echo esc_attr( stripslashes( $tptn_settings['cron_hour'] ) ); ?>" style="width:50px" /> <?php esc_html_e( 'hrs', 'top-10' ); ?> : <input type="textbox" name="cron_min" id="cron_min" value="<?php echo esc_attr( stripslashes( $tptn_settings['cron_min'] ) ); ?>" style="width:50px" /> <?php esc_html_e( 'min', 'top-10' ); ?></td>
776
  </tr>
777
+ <tr><th scope="row"><label for="cron_recurrence"><?php esc_html_e( 'How often should the maintenance be run:', 'top-10' ); ?></label></th>
778
  <td>
779
  <label>
780
+ <input type="radio" name="cron_recurrence" value="daily" id="cron_recurrence0" <?php checked( 'daily', $tptn_settings['cron_recurrence'], true ); ?> />
781
+ <?php esc_html_e( 'Daily', 'top-10' ); ?></label>
782
  <br />
783
  <label>
784
+ <input type="radio" name="cron_recurrence" value="weekly" id="cron_recurrence1" <?php checked( 'weekly', $tptn_settings['cron_recurrence'], true ); ?> />
785
+ <?php esc_html_e( 'Weekly', 'top-10' ); ?></label>
786
  <br />
787
  <label>
788
+ <input type="radio" name="cron_recurrence" value="fortnightly" id="cron_recurrence2" <?php checked( 'fortnightly', $tptn_settings['cron_recurrence'], true ); ?> />
789
+ <?php esc_html_e( 'Fortnightly', 'top-10' ); ?></label>
790
  <br />
791
  <label>
792
+ <input type="radio" name="cron_recurrence" value="monthly" id="cron_recurrence3" <?php checked( 'monthly', $tptn_settings['cron_recurrence'], true ); ?> />
793
+ <?php esc_html_e( 'Monthly', 'top-10' ); ?></label>
794
  <br />
795
  </td>
796
  </tr>
799
  if ( ( $tptn_settings['cron_on'] ) || wp_next_scheduled( 'tptn_cron_hook' ) ) {
800
  if ( wp_next_scheduled( 'tptn_cron_hook' ) ) {
801
  echo '<span style="color:#0c0">';
802
+ printf( esc_html__( 'The cron job has been scheduled. Maintenance will run %s.', 'top-10' ), esc_html__( wp_get_schedule( 'tptn_cron_hook' ) ) );
803
+ echo '</span>';
 
804
  } else {
805
  echo '<span style="color:#e00">';
806
+ esc_html_e( 'The cron job is missing. Please resave this page to add the job', 'top-10' );
807
  echo '</span>';
808
  }
809
  } else {
810
  echo '<span style="color:#FFA500">';
811
+ esc_html_e( 'Maintenance is turned off', 'top-10' );
812
  echo '</span>';
813
  }
814
  ?>
815
  </td></tr>
816
  </table>
817
+ <input type="submit" name="tptn_mnts_save" id="tptn_mnts_save" value="<?php esc_html_e( 'Save Maintenance Options', 'top-10' ); ?>" class="button button-primary" />
818
  </div>
819
  </div>
820
  <?php wp_nonce_field( 'tptn-plugin-settings' ); ?>
821
  </form>
822
 
823
  <form method="post" id="tptn_reset_options" name="tptn_reset_options" onsubmit="return checkForm()">
824
+ <div id="resetopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
825
+ <h3 class='hndle'><span><?php esc_html_e( 'Reset count and other tools', 'top-10' ); ?></span></h3>
826
  <div class="inside">
827
  <p class="description">
828
+ <?php esc_html_e( 'This cannot be reversed. Make sure that your database has been backed up before proceeding', 'top-10' ); ?>
829
  </p>
830
  <p>
831
+ <input name="tptn_trunc_all" type="submit" id="tptn_trunc_all" value="<?php esc_attr_e( 'Reset Popular Posts', '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;" />
832
+ <input name="tptn_trunc_daily" type="submit" id="tptn_trunc_daily" value="<?php esc_attr_e( 'Reset Daily Popular Posts', '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;" />
833
  </p>
834
  <p class="description">
835
+ <?php esc_html_e( 'This will merge post counts for posts with table entries of 0 and 1', 'top-10' ); ?>
836
  </p>
837
  <p>
838
+ <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;" />
839
  </p>
840
  <p class="description">
841
+ <?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' ); ?>
842
  </p>
843
  <p>
844
+ <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;" />
845
  </p>
846
  </div>
847
  </div>
855
  if ( is_multisite() ) {
856
  ?>
857
 
858
+ <form method="post" id="tptn_import_mu" name="tptn_import_mu" onsubmit="return checkForm()">
859
+ <div id="resetopdiv" class="postbox"><div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'top-10' ); ?>"><br /></div>
860
+ <h3 class='hndle'><span><?php esc_html_e( 'WordPress Multisite: Migrate Top 10 v1.x counts to 2.x', 'top-10' ); ?></span></h3>
861
+ <div class="inside">
862
+ <p class="description">
863
+ <?php esc_html_e( "If you've been using Top 10 v1.x on multisite, you would have needed to activate the plugin independently for each site. This would have resulted in two tables being created for each site in the network.", 'top-10' ); ?>
864
+ <?php esc_html_e( 'Top 10 v2.x onwards uses only a single table to record the count, keeping your database clean. You can use this tool to import the recorded counts from v1.x tables to the new v2.x table format.', 'top-10' ); ?>
865
+ </p>
866
+ <p class="description">
867
+ <?php esc_html_e( 'If you do not see any tables below, then it means that either all data has already been imported or no relevant information has been found.', 'top-10' ); ?>
868
+ </p>
869
+ <p class="description">
870
+ <strong style="color:#C00"><?php esc_html_e( 'After running the importer, please verify that all the counts have been successfully imported. Only then should you delete any old tables!', 'top-10' ); ?></strong>
871
+ </p>
872
 
873
+ <?php
874
+ $top_ten_mu_tables_sel_blog_ids = get_site_option( 'top_ten_mu_tables_sel_blog_ids', array() );
875
+ $top_ten_mu_tables_blog_ids = array();
876
+ $top_ten_all_mu_tables = array();
877
+
878
+ // Get all blogs in the network and activate plugin on each one.
879
+ $blog_ids = $wpdb->get_col( "
880
+ SELECT blog_id FROM $wpdb->blogs
881
+ WHERE archived = '0' AND spam = '0' AND deleted = '0'
882
+ " ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
883
+ foreach ( $blog_ids as $blog_id ) {
884
+ switch_to_blog( $blog_id );
885
+ $top_ten_mu_table = $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "top_ten' " ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
886
+
887
+ if ( ! empty( $top_ten_mu_table ) && ! is_main_site( $blog_id ) ) {
888
+ $top_ten_mu_tables_blog_ids[] = $blog_id;
889
+ $top_ten_all_mu_tables[ $top_ten_mu_table ][0] = $top_ten_mu_table;
890
+ $top_ten_all_mu_tables[ $top_ten_mu_table ][1] = in_array( $blog_id, $top_ten_mu_tables_sel_blog_ids ) ? 1 : 0;
891
+ $top_ten_all_mu_tables[ $top_ten_mu_table ][2] = $blog_id;
892
+ }
893
+ }
 
 
 
 
 
 
894
 
895
+ // Switch back to the current blog
896
+ restore_current_blog();
897
+
898
+ if ( ! empty( $top_ten_all_mu_tables ) ) {
899
+ ?>
900
+
901
+ <table class="form-table">
902
+ <tr>
903
+ <th>
904
+ <?php esc_html_e( 'Blog ID', 'top-10' ); ?>
905
+ </th>
906
+ <th>
907
+ <?php esc_html_e( 'Status', 'top-10' ); ?>
908
+ </th>
909
+ <th>
910
+ <?php esc_html_e( 'Select to import', 'top-10' ); ?>
911
+ </th>
912
+ </tr>
913
 
 
 
 
 
 
914
  <?php
915
+ foreach ( $top_ten_all_mu_tables as $top_ten_all_mu_table ) {
 
 
 
916
  ?>
917
+ <tr>
918
+ <td>
919
+ <?php
920
+ esc_html_e( 'Blog #', 'top-10' );
921
+ echo $top_ten_all_mu_table[2];
922
+ echo ': ';
923
+ echo get_blog_details( $top_ten_all_mu_table[2] )->blogname;
924
+ ?>
925
+ </td>
926
+ <td>
927
+ <?php
928
+ if ( 0 == $top_ten_all_mu_table[1] ) {
929
+ echo '<span style="color:#F00">';
930
+ esc_html_e( 'Not imported', 'top-10' );
931
+ echo '</span>';
932
+ } else {
933
+ echo '<span style="color:#0F0">';
934
+ esc_html_e( 'Imported', 'top-10' );
935
+ echo '</span>';
936
+ }
937
+ ?>
938
+ </td>
939
+ <td>
940
+ <?php
941
+ if ( 0 == $top_ten_all_mu_table[1] ) {
942
+ echo '<input type="checkbox" name="top_ten_all_mu_tables[' . $top_ten_all_mu_table[0] . ']" value="' . $top_ten_all_mu_table[2] . '" checked="checked" />';
943
+ } else {
944
+ echo '<input type="checkbox" name="top_ten_all_mu_tables[' . $top_ten_all_mu_table[0] . ']" value="' . $top_ten_all_mu_table[2] . '" />';
945
+ }
946
+ ?>
947
+ </td>
948
+ </tr>
949
  <?php
 
 
 
 
 
 
 
 
950
  }
951
+ ?>
952
+ </table>
953
+ <p>
954
+ <input type="hidden" name="top_ten_mu_tables_blog_ids" value="<?php echo implode( ',', $top_ten_mu_tables_blog_ids ); ?>" />
955
+ <input name="tptn_import" type="submit" id="tptn_import" value="<?php esc_attr_e( 'Begin import', 'top-10' ); ?>" class="button button-primary" />
956
+ <input name="tptn_delete_selected_tables" type="submit" id="tptn_delete_selected_tables" value="<?php esc_attr_e( 'Delete selected tables', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" />
957
+ <input name="tptn_delete_imported_tables" type="submit" id="tptn_delete_imported_tables" value="<?php esc_attr_e( 'Delete all imported tables', 'top-10' ); ?>" class="button button-secondary" style="color:#f00" />
958
+ </p>
959
+ <?php
960
+ } // End if.
961
+ ?>
962
+ </div>
963
+ </div>
964
+ <?php wp_nonce_field( 'tptn-plugin-settings' ); ?>
965
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
966
  <?php
967
  }
968
  ?>
admin/wick/wick.css DELETED
@@ -1,50 +0,0 @@
1
- /*
2
- WICK: Web Input Completion Kit
3
- http://wick.sourceforge.net/
4
- Copyright (c) 2004, Christopher T. Holland,
5
- All rights reserved.
6
-
7
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
-
9
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
- Neither the name of the Christopher T. Holland, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13
-
14
- */
15
-
16
- .floater {
17
- position:absolute;
18
- z-index:2;
19
- bottom:0;
20
- right:0;
21
- display:none;
22
- padding:0;
23
- }
24
-
25
- .floater td {
26
- font-family: Gill, Helvetica, sans-serif;
27
- background-color:white;
28
- border:1px inset #979797;
29
- color:black;
30
- }
31
-
32
- .matchedSmartInputItem {
33
- font-size:0.8em;
34
- padding: 5px 10px 1px 5px;
35
- margin:0;
36
- cursor:pointer;
37
- }
38
-
39
- .selectedSmartInputItem {
40
- color:white;
41
- background-color:#3875D7;
42
- }
43
-
44
- #smartInputResults {
45
- padding:0;margin:0;
46
- }
47
-
48
- .siwCredit {
49
- margin:0;padding:0;margin-top:10px;font-size:0.7em;color:black;
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/wick/wick.js DELETED
@@ -1,485 +0,0 @@
1
- /*
2
- WICK: Web Input Completion Kit
3
- http://wick.sourceforge.net/
4
- Copyright (c) 2004, Christopher T. Holland
5
- All rights reserved.
6
-
7
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
-
9
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
- Neither the name of the Christopher T. Holland, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13
-
14
- */
15
- /* start dhtml building blocks */
16
- function freezeEvent(e) {
17
- if (e.preventDefault) { e.preventDefault(); }
18
- e.returnValue = false;
19
- e.cancelBubble = true;
20
- if (e.stopPropagation) { e.stopPropagation(); }
21
- return false;
22
- }//freezeEvent
23
-
24
- function isWithinNode(e,i,c,t,obj) {
25
- answer = false;
26
- te = e;
27
- while (te && ! answer) {
28
- if ((te.id && (te.id == i)) || (te.className && (te.className == i + "Class"))
29
- || ( ! t && c && te.className && (te.className == c))
30
- || ( ! t && c && te.className && (te.className.indexOf( c ) != -1))
31
- || (t && te.tagName && (te.tagName.toLowerCase() == t))
32
- || (obj && (te == obj))
33
- ) {
34
- answer = te;
35
- } else {
36
- te = te.parentNode;
37
- }
38
- }
39
- return te;
40
- }//isWithinNode
41
-
42
- function getEvent(event) {
43
- return (event ? event : window.event);
44
- }//getEvent()
45
-
46
- function getEventElement(e) {
47
- return (e.srcElement ? e.srcElement: (e.target ? e.target : e.currentTarget));
48
- }//getEventElement()
49
-
50
- function findElementPosX(obj) {
51
- curleft = 0;
52
- if (obj.offsetParent) {
53
- while (obj.offsetParent) {
54
- curleft += obj.offsetLeft;
55
- obj = obj.offsetParent;
56
- }
57
- } //if offsetParent exists
58
- else if (obj.x) {
59
- curleft += obj.x
60
- return curleft; }
61
- }//findElementPosX
62
-
63
- function findElementPosY(obj) {
64
- curtop = 0;
65
- if (obj.offsetParent) {
66
- while (obj.offsetParent) {
67
- curtop += obj.offsetTop;
68
- obj = obj.offsetParent;
69
- }
70
- } //if offsetParent exists
71
- else if (obj.y) {
72
- curtop += obj.y
73
- return curtop; }
74
- }//findElementPosY
75
-
76
- /* end dhtml building blocks */
77
-
78
- function handleKeyPress(event) {
79
- e = getEvent( event );
80
- eL = getEventElement( e );
81
-
82
- upEl = isWithinNode( eL,null,"wickEnabled",null,null );
83
-
84
- kc = e["keyCode"];
85
-
86
- if (siw && ((kc == 13) || (kc == 9))) {
87
- siw.selectingSomething = true;
88
- if (siw.isSafari) { siw.inputBox.blur(); // hack to "wake up" safari
89
- } siw.inputBox.focus();
90
- siw.inputBox.value = siw.inputBox.value.replace( /[ \r\n\t\f\s]+$/gi,' ' );
91
- hideSmartInputFloater();
92
- } else if (upEl && (kc != 38) && (kc != 40) && (kc != 37) && (kc != 39) && (kc != 13) && (kc != 27)) {
93
- if ( ! siw || (siw && ! siw.selectingSomething)) {
94
- processSmartInput( upEl );
95
- }
96
- } else if (siw && siw.inputBox) {
97
- siw.inputBox.focus(); // kinda part of the hack.
98
- }
99
-
100
- }//handleKeyPress()
101
-
102
-
103
- function handleKeyDown(event) {
104
- e = getEvent( event );
105
- eL = getEventElement( e );
106
-
107
- if (siw && (kc = e["keyCode"])) {
108
- if (kc == 40) {
109
- siw.selectingSomething = true;
110
- freezeEvent( e );
111
- if (siw.isGecko) { siw.inputBox.blur(); } /* Gecko hack */
112
- selectNextSmartInputMatchItem();
113
- } else if (kc == 38) {
114
- siw.selectingSomething = true;
115
- freezeEvent( e );
116
- if (siw.isGecko) { siw.inputBox.blur(); }
117
- selectPreviousSmartInputMatchItem();
118
- } else if ((kc == 13) || (kc == 9)) {
119
- siw.selectingSomething = true;
120
- activateCurrentSmartInputMatch();
121
- freezeEvent( e );
122
- } else if (kc == 27) {
123
- hideSmartInputFloater();
124
- freezeEvent( e );
125
- } else {
126
- siw.selectingSomething = false;
127
- }
128
- }
129
-
130
- }//handleKeyDown()
131
-
132
- function handleFocus(event) {
133
- e = getEvent( event );
134
- eL = getEventElement( e );
135
- if (focEl = isWithinNode( eL,null,"wickEnabled",null,null )) {
136
- if ( ! siw || (siw && ! siw.selectingSomething)) { processSmartInput( focEl ); }
137
- }
138
- }//handleFocus()
139
-
140
- function handleBlur(event) {
141
- e = getEvent( event );
142
- eL = getEventElement( e );
143
- if (blurEl = isWithinNode( eL,null,"wickEnabled",null,null )) {
144
- if (siw && ! siw.selectingSomething) { hideSmartInputFloater(); }
145
- }
146
- }//handleBlur()
147
-
148
- function handleClick(event) {
149
- e2 = getEvent( event );
150
- eL2 = getEventElement( e2 );
151
- if (siw && siw.selectingSomething) {
152
- selectFromMouseClick();
153
- }
154
- }//handleClick()
155
-
156
- function handleMouseOver(event) {
157
- e = getEvent( event );
158
- eL = getEventElement( e );
159
- if (siw && (mEl = isWithinNode( eL,null,"matchedSmartInputItem",null,null ))) {
160
- siw.selectingSomething = true;
161
- selectFromMouseOver( mEl );
162
- } else if (isWithinNode( eL,null,"siwCredit",null,null )) {
163
- siw.selectingSomething = true;
164
- } else if (siw) {
165
- siw.selectingSomething = false;
166
- }
167
- }//handleMouseOver
168
-
169
- function showSmartInputFloater() {
170
- if ( ! siw.floater.style.display || (siw.floater.style.display == "none")) {
171
- if ( ! siw.customFloater) {
172
- x = findElementPosX( siw.inputBox );
173
- y = findElementPosY( siw.inputBox ) + siw.inputBox.offsetHeight;
174
- // hack: browser-specific adjustments.
175
- if ( ! siw.isGecko && ! siw.isWinIE) { x += 8; }
176
- if ( ! siw.isGecko && ! siw.isWinIE) { y += 10; }
177
- siw.floater.style.left = x;
178
- siw.floater.style.top = y;
179
- } else {
180
- // you may
181
- // do additional things for your custom floater
182
- // beyond setting display and visibility
183
- }
184
- siw.floater.style.display = "block";
185
- siw.floater.style.visibility = "visible";
186
- }
187
- }//showSmartInputFloater()
188
-
189
- function hideSmartInputFloater() {
190
- if (siw) {
191
- siw.floater.style.display = "none";
192
- siw.floater.style.visibility = "hidden";
193
- siw = null;
194
- }//siw exists
195
- }//hideSmartInputFloater
196
-
197
- function processSmartInput(inputBox) {
198
- if ( ! siw) { siw = new smartInputWindow(); }
199
- siw.inputBox = inputBox;
200
-
201
- classData = inputBox.className.split( " " );
202
- siwDirectives = null;
203
- for (i = 0;( ! siwDirectives && classData[i]);i++) {
204
- if (classData[i].indexOf( "wickEnabled" ) != -1) {
205
- siwDirectives = classData[i]; }
206
- }
207
-
208
- if (siwDirectives && (siwDirectives.indexOf( ":" ) != -1)) {
209
- siw.customFloater = true;
210
- newFloaterId = siwDirectives.split( ":" )[1];
211
- siw.floater = document.getElementById( newFloaterId );
212
- siw.floaterContent = siw.floater.getElementsByTagName( "div" )[0];
213
- }
214
-
215
- setSmartInputData();
216
- if (siw.matchCollection && (siw.matchCollection.length > 0)) { selectSmartInputMatchItem( 0 ); }
217
- content = getSmartInputBoxContent();
218
- if (content) {
219
- modifySmartInputBoxContent( content );
220
- showSmartInputFloater();
221
- } else { hideSmartInputFloater(); }
222
- }//processSmartInput()
223
-
224
- function smartInputMatch(cleanValue, value) {
225
- this.cleanValue = cleanValue;
226
- this.value = value;
227
- this.isSelected = false;
228
- }//smartInputMatch
229
-
230
- function simplify(s) {
231
- return s.toLowerCase().replace( /^[ \s\f\t\n\r]+/,'' ).replace( /[ \s\f\t\n\r]+$/,'' );
232
- // .replace(/[�,�,�,�,\u00E9,\u00E8,\u00EA,\u00EB]/gi,"e").replace(/[�,�,\u00E0,\u00E2]/gi,"a").
233
- }//simplify
234
-
235
- function getUserInputToMatch(s) {
236
- a = s;
237
- fields = s.split( "," );
238
- if (fields.length > 0) { a = fields[fields.length - 1]; }
239
- return a;
240
- }//getUserInputToMatch
241
-
242
- function getUserInputBase() {
243
- s = siw.inputBox.value;
244
- a = s;
245
- if ((lastComma = s.lastIndexOf( "," )) != -1) {
246
- a = a.replace( /^(.*\,[ \r\n\t\f\s]*).*$/i,'$1' );
247
- } else { a = ""; }
248
- return a;
249
- }//getUserInputBase()
250
-
251
- function runMatchingLogic(userInput, standalone) {
252
- userInput = simplify( userInput );
253
- uifc = userInput.charAt( 0 ).toLowerCase();
254
- if (uifc == '"') { uifc = (n = userInput.charAt( 1 )) ? n.toLowerCase() : "z"; }
255
- if (standalone) { userInput = uifc; }
256
- if (siw) { siw.matchCollection = new Array(); }
257
- pointerToCollectionToUse = collection;
258
- if (siw && siw.revisedCollection && (siw.revisedCollection.length > 0) && siw.lastUserInput && (userInput.indexOf( siw.lastUserInput ) == 0)) {
259
- pointerToCollectionToUse = siw.revisedCollection;
260
- } else if (collectionIndex[userInput] && (collectionIndex[userInput].length > 0)) {
261
- pointerToCollectionToUse = collectionIndex[userInput];
262
- } else if (collectionIndex[uifc] && (collectionIndex[uifc].length > 0)) {
263
- pointerToCollectionToUse = collectionIndex[uifc];
264
- } else if (siw && (userInput.length == 1) && ( ! collectionIndex[uifc])) {
265
- siw.buildIndex = true;
266
- } else if (siw) {
267
- siw.buildIndex = false;
268
- }
269
-
270
- tempCollection = new Array();
271
-
272
- re1m = new RegExp( "^([ \"\>\<\-]*)(" + userInput + ")","i" );
273
- re2m = new RegExp( "([ \"\>\<\-]+)(" + userInput + ")","i" );
274
- re1 = new RegExp( "^([ \"\}\{\-]*)(" + userInput + ")","gi" );
275
- re2 = new RegExp( "([ \"\}\{\-]+)(" + userInput + ")","gi" );
276
-
277
- for (i = 0,j = 0;(i < pointerToCollectionToUse.length);i++) {
278
- displayMatches = (( ! standalone) && (j < siw.MAX_MATCHES));
279
- entry = pointerToCollectionToUse[i];
280
- mEntry = simplify( entry );
281
- if ( ! standalone && (mEntry.indexOf( userInput ) == 0)) {
282
- userInput = userInput.replace( /\>/gi,'\\}' ).replace( /\< ?/gi,'\\{' );
283
- re = new RegExp( "(" + userInput + ")","i" );
284
- if (displayMatches) {
285
- siw.matchCollection[j] = new smartInputMatch( entry, mEntry.replace( /\>/gi,'}' ).replace( /\< ?/gi,'{' ).replace( re,"<b>$1</b>" ) );
286
- }
287
- tempCollection[j] = entry;
288
- j++;
289
- } else if (mEntry.match( re1m ) || mEntry.match( re2m )) {
290
- if ( ! standalone && displayMatches) {
291
- siw.matchCollection[j] = new smartInputMatch( entry, mEntry.replace( /\>/gi,'}' ).replace( /\</gi,'{' ).replace( re1,"$1<b>$2</b>" ).replace( re2,"$1<b>$2</b>" ) );
292
- }
293
- tempCollection[j] = entry;
294
- j++;
295
- }
296
- }//loop thru collection
297
- if (siw) {
298
- siw.lastUserInput = userInput;
299
- siw.revisedCollection = tempCollection.join( "," ).split( "," );
300
- collectionIndex[userInput] = tempCollection.join( "," ).split( "," );
301
- }
302
- if (standalone || siw.buildIndex) {
303
- collectionIndex[uifc] = tempCollection.join( "," ).split( "," );
304
- if (siw) { siw.buildIndex = false; }
305
- }
306
- }//runMatchingLogic
307
-
308
- function setSmartInputData() {
309
- if (siw) {
310
- orgUserInput = siw.inputBox.value;
311
- orgUserInput = getUserInputToMatch( orgUserInput );
312
- userInput = orgUserInput.toLowerCase().replace( /[\r\n\t\f\s]+/gi,' ' ).replace( /^ +/gi,'' ).replace( / +$/gi,'' ).replace( / +/gi,' ' ).replace( /\\/gi,'' ).replace( /\[/gi,'' ).replace( /\(/gi,'' ).replace( /\./gi,'\.' ).replace( /\?/gi,'' );
313
- if (userInput && (userInput != "") && (userInput != '"')) {
314
- runMatchingLogic( userInput );
315
- } //if userinput not blank and is meaningful
316
- else {
317
- siw.matchCollection = null;
318
- }
319
- }//siw exists ... uhmkaaayyyyy
320
- }//setSmartInputData
321
-
322
- function getSmartInputBoxContent() {
323
- a = null;
324
- if (siw && siw.matchCollection && (siw.matchCollection.length > 0)) {
325
- a = '';
326
- for (i = 0;i < siw.matchCollection.length; i++) {
327
- selectedString = siw.matchCollection[i].isSelected ? ' selectedSmartInputItem' : '';
328
- a += '<p class="matchedSmartInputItem' + selectedString + '">' + siw.matchCollection[i].value.replace( /\{ */gi,"&lt;" ).replace( /\} */gi,"&gt;" ) + '</p>';
329
- }//
330
- }//siw exists
331
- return a;
332
- }//getSmartInputBoxContent
333
-
334
- function modifySmartInputBoxContent(content) {
335
- // todo: remove credits 'cuz no one gives a shit ;] - done
336
- siw.floaterContent.innerHTML = '<div id="smartInputResults">' + content + (siw.showCredit ? ('<p class="siwCredit">Powered By: <a target="PhrawgBlog" href="http://chrisholland.blogspot.com/?from=smartinput&ref=' + escape( location.href ) + '">Chris Holland</a></p>') : '') + '</div>';
337
- siw.matchListDisplay = document.getElementById( "smartInputResults" );
338
- }//modifySmartInputBoxContent()
339
-
340
- function selectFromMouseOver(o) {
341
- currentIndex = getCurrentlySelectedSmartInputItem();
342
- if (currentIndex != null) { deSelectSmartInputMatchItem( currentIndex ); }
343
- newIndex = getIndexFromElement( o );
344
- selectSmartInputMatchItem( newIndex );
345
- modifySmartInputBoxContent( getSmartInputBoxContent() );
346
- }//selectFromMouseOver
347
-
348
- function selectFromMouseClick() {
349
- activateCurrentSmartInputMatch();
350
- siw.inputBox.focus();
351
- hideSmartInputFloater();
352
- }//selectFromMouseClick
353
-
354
- function getIndexFromElement(o) {
355
- index = 0;
356
- while (o = o.previousSibling) {
357
- index++;
358
- }//
359
- return index;
360
- }//getIndexFromElement
361
-
362
- function getCurrentlySelectedSmartInputItem() {
363
- answer = null;
364
- for (i = 0; ((i < siw.matchCollection.length) && ! answer) ; i++) {
365
- if (siw.matchCollection[i].isSelected) {
366
- answer = i; }
367
- }//
368
- return answer;
369
- }//getCurrentlySelectedSmartInputItem
370
-
371
- function selectSmartInputMatchItem(index) {
372
- siw.matchCollection[index].isSelected = true;
373
- }//selectSmartInputMatchItem()
374
-
375
- function deSelectSmartInputMatchItem(index) {
376
- siw.matchCollection[index].isSelected = false;
377
- }//deSelectSmartInputMatchItem()
378
-
379
- function selectNextSmartInputMatchItem() {
380
- currentIndex = getCurrentlySelectedSmartInputItem();
381
- if (currentIndex != null) {
382
- deSelectSmartInputMatchItem( currentIndex );
383
- if ((currentIndex + 1) < siw.matchCollection.length) {
384
- selectSmartInputMatchItem( currentIndex + 1 ); } else { selectSmartInputMatchItem( 0 ); }
385
- } else {
386
- selectSmartInputMatchItem( 0 );
387
- }
388
- modifySmartInputBoxContent( getSmartInputBoxContent() );
389
- }//selectNextSmartInputMatchItem
390
-
391
- function selectPreviousSmartInputMatchItem() {
392
- currentIndex = getCurrentlySelectedSmartInputItem();
393
- if (currentIndex != null) {
394
- deSelectSmartInputMatchItem( currentIndex );
395
- if ((currentIndex - 1) >= 0) {
396
- selectSmartInputMatchItem( currentIndex - 1 ); } else { selectSmartInputMatchItem( siw.matchCollection.length - 1 ); }
397
- } else {
398
- selectSmartInputMatchItem( siw.matchCollection.length - 1 );
399
- }
400
- modifySmartInputBoxContent( getSmartInputBoxContent() );
401
- }//selectPreviousSmartInputMatchItem
402
-
403
- function activateCurrentSmartInputMatch() {
404
- baseValue = getUserInputBase();
405
- if ((selIndex = getCurrentlySelectedSmartInputItem()) != null) {
406
- addedValue = siw.matchCollection[selIndex].cleanValue;
407
- theString = (baseValue ? baseValue : "") + addedValue + ", ";
408
- siw.inputBox.value = theString;
409
- runMatchingLogic( addedValue, true );
410
- }
411
- }//activateCurrentSmartInputMatch
412
-
413
- function smartInputWindow () {
414
- this.customFloater = false;
415
- this.floater = document.getElementById( "smartInputFloater" );
416
- this.floaterContent = document.getElementById( "smartInputFloaterContent" );
417
- this.selectedSmartInputItem = null;
418
- this.MAX_MATCHES = 15;
419
- this.isGecko = (navigator.userAgent.indexOf( "Gecko/200" ) != -1);
420
- this.isSafari = (navigator.userAgent.indexOf( "Safari" ) != -1);
421
- this.isWinIE = ((navigator.userAgent.indexOf( "Win" ) != -1 ) && (navigator.userAgent.indexOf( "MSIE" ) != -1 ));
422
- this.showCredit = false;
423
- }//smartInputWindow Object
424
-
425
- function registerSmartInputListeners() {
426
- inputs = document.getElementsByTagName( "input" );
427
- texts = document.getElementsByTagName( "textarea" );
428
- allinputs = new Array();
429
- z = 0;
430
- y = 0;
431
- while (inputs[z]) {
432
- allinputs[z] = inputs[z];
433
- z++;
434
- }//
435
- while (texts[y]) {
436
- allinputs[z] = texts[y];
437
- z++;
438
- y++;
439
- }//
440
-
441
- for (i = 0; i < allinputs.length;i++) {
442
- if ((c = allinputs[i].className) && (c == "wickEnabled")) {
443
- allinputs[i].setAttribute( "autocomplete","OFF" );
444
- allinputs[i].onfocus = handleFocus;
445
- allinputs[i].onblur = handleBlur;
446
- allinputs[i].onkeydown = handleKeyDown;
447
- allinputs[i].onkeyup = handleKeyPress;
448
- }
449
- }//loop thru inputs
450
- }//registerSmartInputListeners
451
-
452
- siw = null;
453
-
454
- if (document.addEventListener) {
455
- document.addEventListener( "keydown", handleKeyDown, false );
456
- document.addEventListener( "keyup", handleKeyPress, false );
457
- document.addEventListener( "mouseup", handleClick, false );
458
- document.addEventListener( "mouseover", handleMouseOver, false );
459
- } else {
460
- document.onkeydown = handleKeyDown;
461
- document.onkeyup = handleKeyPress;
462
- document.onmouseup = handleClick;
463
- document.onmouseover = handleMouseOver;
464
- }
465
-
466
- registerSmartInputListeners();
467
-
468
- document.write(
469
- '<table id="smartInputFloater" class="floater" cellpadding="0" cellspacing="0"><tr><td id="smartInputFloaterContent" nowrap="nowrap">'
470
- + '<\/td><\/tr><\/table>'
471
- );
472
-
473
- // note: instruct users to the fact that no commas should be present in entries.
474
- // it would make things insanely messy.
475
- // this is why i'm filtering commas here:
476
- for (x = 0;x < collection.length;x++) {
477
- collection[x] = collection[x].replace( /\,/gi,'' );
478
- }//
479
-
480
- collectionIndex = new Array();
481
-
482
- ds = "";
483
- function debug(s) {
484
- ds += ( s + "\n");
485
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/activate-deactivate.php CHANGED
@@ -5,7 +5,6 @@
5
  * @package Top_Ten
6
  */
7
 
8
-
9
  /**
10
  * Fired when the plugin is Network Activated.
11
  *
@@ -21,17 +20,17 @@ function tptn_activation_hook( $network_wide ) {
21
 
22
  if ( is_multisite() && $network_wide ) {
23
 
24
- // Get all blogs in the network and activate plugin on each one
25
  $blog_ids = $wpdb->get_col( "
26
  SELECT blog_id FROM $wpdb->blogs
27
  WHERE archived = '0' AND spam = '0' AND deleted = '0'
28
- " );
29
  foreach ( $blog_ids as $blog_id ) {
30
  switch_to_blog( $blog_id );
31
  tptn_single_activate();
32
  }
33
 
34
- // Switch back to the current blog
35
  restore_current_blog();
36
 
37
  } else {
@@ -85,7 +84,7 @@ function tptn_single_activate() {
85
  add_site_option( 'tptn_db_version', $tptn_db_version );
86
  }
87
 
88
- // Upgrade table code
89
  $installed_ver = get_site_option( 'tptn_db_version' );
90
 
91
  if ( $installed_ver != $tptn_db_version ) {
5
  * @package Top_Ten
6
  */
7
 
 
8
  /**
9
  * Fired when the plugin is Network Activated.
10
  *
20
 
21
  if ( is_multisite() && $network_wide ) {
22
 
23
+ // Get all blogs in the network and activate plugin on each one.
24
  $blog_ids = $wpdb->get_col( "
25
  SELECT blog_id FROM $wpdb->blogs
26
  WHERE archived = '0' AND spam = '0' AND deleted = '0'
27
+ " ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
28
  foreach ( $blog_ids as $blog_id ) {
29
  switch_to_blog( $blog_id );
30
  tptn_single_activate();
31
  }
32
 
33
+ // Switch back to the current blog.
34
  restore_current_blog();
35
 
36
  } else {
84
  add_site_option( 'tptn_db_version', $tptn_db_version );
85
  }
86
 
87
+ // Upgrade table code.
88
  $installed_ver = get_site_option( 'tptn_db_version' );
89
 
90
  if ( $installed_ver != $tptn_db_version ) {
includes/counter.php CHANGED
@@ -5,209 +5,11 @@
5
  * @package Top_Ten
6
  */
7
 
8
-
9
- /**
10
- * Function to update the post views for the current post. Filters `the_content`.
11
- *
12
- * @since 1.0
13
- *
14
- * @param string $content Post content
15
- * @return string Filtered content
16
- */
17
- function tptn_add_viewed_count( $content ) {
18
- global $post, $tptn_settings;
19
-
20
- $home_url = home_url( '/' );
21
-
22
- /**
23
- * Filter the script URL of the counter.
24
- *
25
- * Create a filter function to overwrite the script URL to use the external top-10-counter.js.php
26
- * You can use TOP_TEN_PLUGIN_URL . '/top-10-addcount.js.php' as a source
27
- * TOP_TEN_PLUGIN_URL is a global constant
28
- *
29
- * @since 2.0
30
- */
31
- $home_url = apply_filters( 'tptn_add_counter_script_url', $home_url );
32
-
33
- // Strip any query strings since we don't need them
34
- $home_url = strtok( $home_url, '?' );
35
-
36
- if ( is_singular() && $post->post_status != 'draft' ) {
37
-
38
- $current_user = wp_get_current_user(); // Let's get the current user
39
- $post_author = ( $current_user->ID == $post->post_author ) ? true : false; // Is the current user the post author?
40
- $current_user_admin = ( current_user_can( 'manage_options' ) ) ? true : false; // Is the current user an admin?
41
- $current_user_editor = ( ( current_user_can( 'edit_others_posts' ) ) && ( ! current_user_can( 'manage_options' ) ) ) ? true : false; // Is the current user an editor?
42
-
43
- $include_code = true;
44
- if ( ( $post_author ) && ( ! $tptn_settings['track_authors'] ) ) {
45
- $include_code = false;
46
- }
47
- if ( ( $current_user_admin ) && ( ! $tptn_settings['track_admins'] ) ) {
48
- $include_code = false;
49
- }
50
- if ( ( $current_user_editor ) && ( ! $tptn_settings['track_editors'] ) ) {
51
- $include_code = false;
52
- }
53
-
54
- if ( $include_code ) {
55
-
56
- $output = '';
57
- $id = intval( $post->ID );
58
- $blog_id = get_current_blog_id();
59
- $activate_counter = $tptn_settings['activate_overall'] ? 1 : 0; // It's 1 if we're updating the overall count
60
- $activate_counter = $activate_counter + ( $tptn_settings['activate_daily'] ? 10 : 0 ); // It's 10 if we're updating the daily count
61
-
62
- if ( $activate_counter > 0 ) {
63
- if ( $tptn_settings['cache_fix'] ) {
64
- $output = '<script type="text/javascript"> jQuery.ajax({
65
- url: "' . $home_url . '",
66
- data: {
67
- top_ten_id: ' . $id . ',
68
- top_ten_blog_id: ' . $blog_id . ',
69
- activate_counter: ' . $activate_counter . ',
70
- top10_rnd: (new Date()).getTime() + "-" + Math.floor(Math.random() * 100000)
71
- }
72
- }); </script>';
73
-
74
- } else {
75
- $output = '<script type="text/javascript" async src="' . $home_url . '?top_ten_id=' . $id . '&amp;top_ten_blog_id=' . $blog_id . '&amp;activate_counter=' . $activate_counter . '"></script>';
76
- }
77
- }
78
-
79
- /**
80
- * Filter the counter script
81
- *
82
- * @since 1.9.8.5
83
- *
84
- * @param string $output Counter script code
85
- */
86
- $output = apply_filters( 'tptn_viewed_count', $output );
87
-
88
- return $content.$output;
89
- } else {
90
- return $content;
91
- }
92
- } else {
93
- return $content;
94
- }
95
- }
96
- add_filter( 'the_content', 'tptn_add_viewed_count' );
97
-
98
-
99
- /**
100
- * Enqueue Scripts.
101
- *
102
- * @since 1.9.7
103
- */
104
- function tptn_enqueue_scripts() {
105
- global $tptn_settings;
106
-
107
- if ( $tptn_settings['cache_fix'] ) {
108
- wp_enqueue_script( 'jquery' );
109
- }
110
- }
111
- add_action( 'wp_enqueue_scripts', 'tptn_enqueue_scripts' ); // wp_enqueue_scripts action hook to link only on the front-end
112
-
113
-
114
- /**
115
- * Function to add additional queries to query_vars.
116
- *
117
- * @since 2.0.0
118
- *
119
- * @param array $vars Query variables array
120
- * @return array $Query variables array with Top 10 parameters appended
121
- */
122
- function tptn_query_vars( $vars ) {
123
- // add these to the list of queryvars that WP gathers
124
- $vars[] = 'top_ten_id';
125
- $vars[] = 'top_ten_blog_id';
126
- $vars[] = 'activate_counter';
127
- $vars[] = 'view_counter';
128
- return $vars;
129
- }
130
- add_filter( 'query_vars', 'tptn_query_vars' );
131
-
132
-
133
- /**
134
- * Function to update the .
135
- *
136
- * @since 2.0.0
137
- *
138
- * @param object $wp WordPress object
139
- */
140
- function tptn_parse_request( $wp ) {
141
- global $wpdb;
142
-
143
- if ( empty( $wp ) ) {
144
- global $wp;
145
- }
146
-
147
- if ( ! isset( $wp->query_vars ) || ! is_array( $wp->query_vars ) ) {
148
- return;
149
- }
150
-
151
- $table_name = $wpdb->base_prefix . 'top_ten';
152
- $top_ten_daily = $wpdb->base_prefix . 'top_ten_daily';
153
- $str = '';
154
-
155
- if ( array_key_exists( 'top_ten_id', $wp->query_vars ) && array_key_exists( 'activate_counter', $wp->query_vars ) && $wp->query_vars['top_ten_id'] != '' ) {
156
-
157
- $id = intval( $wp->query_vars['top_ten_id'] );
158
- $blog_id = intval( $wp->query_vars['top_ten_blog_id'] );
159
- $activate_counter = intval( $wp->query_vars['activate_counter'] );
160
-
161
- if ( $id > 0 ) {
162
-
163
- if ( ( 1 == $activate_counter ) || ( 11 == $activate_counter ) ) {
164
-
165
- $tt = $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES('%d', '1', '%d') ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $blog_id ) );
166
-
167
- $str .= ( false === $tt ) ? 'tte' : 'tt' . $tt;
168
- }
169
-
170
- if ( ( 10 == $activate_counter ) || ( 11 == $activate_counter ) ) {
171
-
172
- $current_date = gmdate( 'Y-m-d H', current_time( 'timestamp', 0 ) );
173
-
174
- $ttd = $wpdb->query( $wpdb->prepare( "INSERT INTO {$top_ten_daily} (postnumber, cntaccess, dp_date, blog_id) VALUES('%d', '1', '%s', '%d' ) ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $current_date, $blog_id ) );
175
-
176
- $str .= ( false === $ttd ) ? ' ttde' : ' ttd' . $ttd;
177
- }
178
- }
179
- Header( 'content-type: application/x-javascript' );
180
- echo '<!-- ' . $str . ' -->';
181
-
182
- // stop anything else from loading as it is not needed.
183
- exit;
184
-
185
- } elseif ( array_key_exists( 'top_ten_id', $wp->query_vars ) && array_key_exists( 'view_counter', $wp->query_vars ) && $wp->query_vars['top_ten_id'] != '' ) {
186
-
187
- $id = intval( $wp->query_vars['top_ten_id'] );
188
-
189
- if ( $id > 0 ) {
190
-
191
- $output = get_tptn_post_count( $id );
192
-
193
- Header( 'content-type: application/x-javascript' );
194
- echo 'document.write("' . $output . '")';
195
-
196
- // stop anything else from loading as it is not needed.
197
- exit;
198
- }
199
- } else {
200
- return;
201
- }
202
- }
203
- add_action( 'parse_request', 'tptn_parse_request' );
204
-
205
-
206
  /**
207
  * Function to add the viewed count to the post content. Filters `the_content`.
208
  *
209
  * @since 1.0
210
- * @param string $content Post content
211
  * @return string Filtered post content
212
  */
213
  function tptn_pc_content( $content ) {
@@ -216,7 +18,7 @@ function tptn_pc_content( $content ) {
216
  $exclude_on_post_ids = explode( ',', $tptn_settings['exclude_on_post_ids'] );
217
 
218
  if ( in_array( $post->ID, $exclude_on_post_ids ) ) {
219
- return $content; // Exit without adding related posts
220
  }
221
 
222
  if ( ( is_single() ) && ( $tptn_settings['add_to_content'] ) ) {
@@ -239,11 +41,11 @@ add_filter( 'the_content', 'tptn_pc_content' );
239
 
240
 
241
  /**
242
- * Filter to add related posts to feeds.
243
  *
244
  * @since 1.9.8
245
  *
246
- * @param string $content Post content
247
  * @return string Filtered post content
248
  */
249
  function tptn_rss_filter( $content ) {
@@ -265,7 +67,7 @@ add_filter( 'the_content_feed', 'tptn_rss_filter' );
265
  * Function to manually display count.
266
  *
267
  * @since 1.0
268
- * @param int|boolean $echo Flag to echo the output?
269
  * @return string Formatted string if $echo is set to 0|false
270
  */
271
  function echo_tptn_post_count( $echo = 1 ) {
@@ -276,15 +78,11 @@ function echo_tptn_post_count( $echo = 1 ) {
276
  /**
277
  * Filter the script URL of the counter.
278
  *
279
- * Create a filter function to overwrite the script URL to use the external top-10-counter.js.php
280
- * You can use TOP_TEN_PLUGIN_URL . '/top-10-counter.js.php' as a source
281
- * TOP_TEN_PLUGIN_URL is a global constant
282
- *
283
  * @since 2.0
284
  */
285
  $home_url = apply_filters( 'tptn_view_counter_script_url', $home_url );
286
 
287
- // Strip any query strings since we don't need them
288
  $home_url = strtok( $home_url, '?' );
289
 
290
  $id = intval( $post->ID );
@@ -319,8 +117,8 @@ function echo_tptn_post_count( $echo = 1 ) {
319
  * Return the formatted post count for the supplied ID.
320
  *
321
  * @since 1.9.2
322
- * @param int|string $id Post ID
323
- * @param int|string $blog_id Blog ID
324
  * @return int|string Formatted post count
325
  */
326
  function get_tptn_post_count( $id = false, $blog_id = false ) {
@@ -332,7 +130,7 @@ function get_tptn_post_count( $id = false, $blog_id = false ) {
332
 
333
  if ( $id > 0 ) {
334
 
335
- // Total count per post
336
  if ( ( false !== strpos( $count_disp_form, '%totalcount%' ) ) || ( false !== strpos( $count_disp_form_zero, '%totalcount%' ) ) ) {
337
  if ( ( 0 == $totalcntaccess ) && ( ! is_singular() ) ) {
338
  $count_disp_form_zero = str_replace( '%totalcount%', $totalcntaccess, $count_disp_form_zero );
@@ -341,7 +139,7 @@ function get_tptn_post_count( $id = false, $blog_id = false ) {
341
  }
342
  }
343
 
344
- // Now process daily count
345
  if ( ( false !== strpos( $count_disp_form, '%dailycount%' ) ) || ( false !== strpos( $count_disp_form_zero, '%dailycount%' ) ) ) {
346
  $cntaccess = get_tptn_post_count_only( $id, 'daily' );
347
  if ( ( 0 == $totalcntaccess ) && ( ! is_singular() ) ) {
@@ -351,7 +149,7 @@ function get_tptn_post_count( $id = false, $blog_id = false ) {
351
  }
352
  }
353
 
354
- // Now process overall count
355
  if ( ( false !== strpos( $count_disp_form, '%overallcount%' ) ) || ( false !== strpos( $count_disp_form_zero, '%overallcount%' ) ) ) {
356
  $cntaccess = get_tptn_post_count_only( $id, 'overall' );
357
  if ( ( 0 == $cntaccess ) && ( ! is_singular() ) ) {
@@ -377,8 +175,9 @@ function get_tptn_post_count( $id = false, $blog_id = false ) {
377
  *
378
  * @since 1.9.8.5
379
  *
380
- * @param mixed $id Post ID
381
- * @param string $count Which count to return? total, daily or overall
 
382
  * @return int Post count
383
  */
384
  function get_tptn_post_count_only( $id = false, $count = 'total', $blog_id = false ) {
@@ -411,12 +210,12 @@ function get_tptn_post_count_only( $id = false, $count = 'total', $blog_id = fal
411
  $from_date = gmdate( 'Y-m-d H' , $from_date );
412
  }
413
 
414
- $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, SUM(cntaccess) as sumCount FROM {$table_name_daily} WHERE postnumber = %d AND blog_id = %d AND dp_date >= '%s' GROUP BY postnumber ", array( $id, $blog_id, $from_date ) ) );
415
- $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->sumCount : 0 ) );
416
  break;
417
  case 'overall':
418
- $resultscount = $wpdb->get_row( 'SELECT SUM(cntaccess) as sumCount FROM ' . $table_name );
419
- $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->sumCount : 0 ) );
420
  break;
421
  }
422
  return apply_filters( 'tptn_post_count_only', $cntaccess );
@@ -426,21 +225,3 @@ function get_tptn_post_count_only( $id = false, $count = 'total', $blog_id = fal
426
  }
427
 
428
 
429
- /**
430
- * Add tracker code.
431
- *
432
- * @since 2.3.0
433
- *
434
- * @param bool $echo Echo the code or return it?
435
- * @return string|void
436
- */
437
- function tptn_add_tracker( $echo = true ) {
438
-
439
- if ( $echo ) {
440
- echo tptn_add_viewed_count( '' );
441
- } else {
442
- return tptn_add_viewed_count( '' );
443
- }
444
- }
445
-
446
-
5
  * @package Top_Ten
6
  */
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  /**
9
  * Function to add the viewed count to the post content. Filters `the_content`.
10
  *
11
  * @since 1.0
12
+ * @param string $content Post content.
13
  * @return string Filtered post content
14
  */
15
  function tptn_pc_content( $content ) {
18
  $exclude_on_post_ids = explode( ',', $tptn_settings['exclude_on_post_ids'] );
19
 
20
  if ( in_array( $post->ID, $exclude_on_post_ids ) ) {
21
+ return $content; // Exit without adding related posts.
22
  }
23
 
24
  if ( ( is_single() ) && ( $tptn_settings['add_to_content'] ) ) {
41
 
42
 
43
  /**
44
+ * Filter to display the post count when viewing feeds.
45
  *
46
  * @since 1.9.8
47
  *
48
+ * @param string $content Post content.
49
  * @return string Filtered post content
50
  */
51
  function tptn_rss_filter( $content ) {
67
  * Function to manually display count.
68
  *
69
  * @since 1.0
70
+ * @param int|boolean $echo Flag to echo the output.
71
  * @return string Formatted string if $echo is set to 0|false
72
  */
73
  function echo_tptn_post_count( $echo = 1 ) {
78
  /**
79
  * Filter the script URL of the counter.
80
  *
 
 
 
 
81
  * @since 2.0
82
  */
83
  $home_url = apply_filters( 'tptn_view_counter_script_url', $home_url );
84
 
85
+ // Strip any query strings since we don't need them.
86
  $home_url = strtok( $home_url, '?' );
87
 
88
  $id = intval( $post->ID );
117
  * Return the formatted post count for the supplied ID.
118
  *
119
  * @since 1.9.2
120
+ * @param int|string $id Post ID.
121
+ * @param int|string $blog_id Blog ID.
122
  * @return int|string Formatted post count
123
  */
124
  function get_tptn_post_count( $id = false, $blog_id = false ) {
130
 
131
  if ( $id > 0 ) {
132
 
133
+ // Total count per post.
134
  if ( ( false !== strpos( $count_disp_form, '%totalcount%' ) ) || ( false !== strpos( $count_disp_form_zero, '%totalcount%' ) ) ) {
135
  if ( ( 0 == $totalcntaccess ) && ( ! is_singular() ) ) {
136
  $count_disp_form_zero = str_replace( '%totalcount%', $totalcntaccess, $count_disp_form_zero );
139
  }
140
  }
141
 
142
+ // Now process daily count.
143
  if ( ( false !== strpos( $count_disp_form, '%dailycount%' ) ) || ( false !== strpos( $count_disp_form_zero, '%dailycount%' ) ) ) {
144
  $cntaccess = get_tptn_post_count_only( $id, 'daily' );
145
  if ( ( 0 == $totalcntaccess ) && ( ! is_singular() ) ) {
149
  }
150
  }
151
 
152
+ // Now process overall count.
153
  if ( ( false !== strpos( $count_disp_form, '%overallcount%' ) ) || ( false !== strpos( $count_disp_form_zero, '%overallcount%' ) ) ) {
154
  $cntaccess = get_tptn_post_count_only( $id, 'overall' );
155
  if ( ( 0 == $cntaccess ) && ( ! is_singular() ) ) {
175
  *
176
  * @since 1.9.8.5
177
  *
178
+ * @param mixed $id Post ID.
179
+ * @param string $count Which count to return? total, daily or overall.
180
+ * @param bool $blog_id Blog ID.
181
  * @return int Post count
182
  */
183
  function get_tptn_post_count_only( $id = false, $count = 'total', $blog_id = false ) {
210
  $from_date = gmdate( 'Y-m-d H' , $from_date );
211
  }
212
 
213
+ $resultscount = $wpdb->get_row( $wpdb->prepare( "SELECT postnumber, SUM(cntaccess) as sum_count FROM {$table_name_daily} WHERE postnumber = %d AND blog_id = %d AND dp_date >= '%s' GROUP BY postnumber ", array( $id, $blog_id, $from_date ) ) );
214
+ $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->sum_count : 0 ) );
215
  break;
216
  case 'overall':
217
+ $resultscount = $wpdb->get_row( 'SELECT SUM(cntaccess) as sum_count FROM ' . $table_name );
218
+ $cntaccess = number_format_i18n( ( ( $resultscount ) ? $resultscount->sum_count : 0 ) );
219
  break;
220
  }
221
  return apply_filters( 'tptn_post_count_only', $cntaccess );
225
  }
226
 
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/cron.php CHANGED
@@ -5,7 +5,6 @@
5
  * @package Top_Ten
6
  */
7
 
8
-
9
  /**
10
  * Function to truncate daily run.
11
  *
@@ -20,10 +19,10 @@ function tptn_cron() {
20
  $from_date = strtotime( '-90 DAY' , $current_time );
21
  $from_date = gmdate( 'Y-m-d H' , $from_date );
22
 
23
- $resultscount = $wpdb->query( $wpdb->prepare(
24
  "DELETE FROM {$table_name_daily} WHERE dp_date <= '%s' ",
25
  $from_date
26
- ) );
27
 
28
  }
29
  add_action( 'tptn_cron_hook', 'tptn_cron' );
@@ -33,12 +32,12 @@ add_action( 'tptn_cron_hook', 'tptn_cron' );
33
  * Function to enable run or actions.
34
  *
35
  * @since 1.9
36
- * @param int $hour Hour
37
- * @param int $min Minute
38
- * @param int $recurrence Frequency
39
  */
40
  function tptn_enable_run( $hour, $min, $recurrence ) {
41
- // Invoke WordPress internal cron
42
  if ( ! wp_next_scheduled( 'tptn_cron_hook' ) ) {
43
  wp_schedule_event( mktime( $hour, $min, 0 ), $recurrence, 'tptn_cron_hook' );
44
  } else {
@@ -59,32 +58,32 @@ function tptn_disable_run() {
59
  }
60
  }
61
 
62
- // Let's declare this conditional function to add more schedules. It will be a generic function across all plugins that I develop
63
  if ( ! function_exists( 'ald_more_reccurences' ) ) :
64
 
65
  /**
66
  * Function to add weekly and fortnightly recurrences. Filters `cron_schedules`.
67
  *
68
- * @param array Array of existing schedules
69
- * @return array Filtered array with new schedules
70
  */
71
  function ald_more_reccurences( $schedules ) {
72
- // add a 'weekly' interval
73
  $schedules['weekly'] = array(
74
- 'interval' => WEEK_IN_SECONDS,
75
- 'display' => __( 'Once Weekly', 'top-10' ),
76
  );
77
  $schedules['fortnightly'] = array(
78
- 'interval' => 2 * WEEK_IN_SECONDS,
79
- 'display' => __( 'Once Fortnightly', 'top-10' ),
80
  );
81
  $schedules['monthly'] = array(
82
- 'interval' => 30 * DAY_IN_SECONDS,
83
- 'display' => __( 'Once Monthly', 'top-10' ),
84
  );
85
  $schedules['quarterly'] = array(
86
- 'interval' => 90 * DAY_IN_SECONDS,
87
- 'display' => __( 'Once quarterly', 'top-10' ),
88
  );
89
  return $schedules;
90
  }
5
  * @package Top_Ten
6
  */
7
 
 
8
  /**
9
  * Function to truncate daily run.
10
  *
19
  $from_date = strtotime( '-90 DAY' , $current_time );
20
  $from_date = gmdate( 'Y-m-d H' , $from_date );
21
 
22
+ $resultscount = $wpdb->query( $wpdb->prepare( // WPCS: unprepared SQL OK.
23
  "DELETE FROM {$table_name_daily} WHERE dp_date <= '%s' ",
24
  $from_date
25
+ ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
26
 
27
  }
28
  add_action( 'tptn_cron_hook', 'tptn_cron' );
32
  * Function to enable run or actions.
33
  *
34
  * @since 1.9
35
+ * @param int $hour Hour.
36
+ * @param int $min Minute.
37
+ * @param int $recurrence Frequency.
38
  */
39
  function tptn_enable_run( $hour, $min, $recurrence ) {
40
+ // Invoke WordPress internal cron.
41
  if ( ! wp_next_scheduled( 'tptn_cron_hook' ) ) {
42
  wp_schedule_event( mktime( $hour, $min, 0 ), $recurrence, 'tptn_cron_hook' );
43
  } else {
58
  }
59
  }
60
 
61
+ // Let's declare this conditional function to add more schedules. It will be a generic function across all plugins that I develop.
62
  if ( ! function_exists( 'ald_more_reccurences' ) ) :
63
 
64
  /**
65
  * Function to add weekly and fortnightly recurrences. Filters `cron_schedules`.
66
  *
67
+ * @param array $schedules Array of existing schedules.
68
+ * @return array Filtered array with new schedules
69
  */
70
  function ald_more_reccurences( $schedules ) {
71
+ // Add a 'weekly' interval.
72
  $schedules['weekly'] = array(
73
+ 'interval' => WEEK_IN_SECONDS,
74
+ 'display' => __( 'Once Weekly', 'top-10' ),
75
  );
76
  $schedules['fortnightly'] = array(
77
+ 'interval' => 2 * WEEK_IN_SECONDS,
78
+ 'display' => __( 'Once Fortnightly', 'top-10' ),
79
  );
80
  $schedules['monthly'] = array(
81
+ 'interval' => 30 * DAY_IN_SECONDS,
82
+ 'display' => __( 'Once Monthly', 'top-10' ),
83
  );
84
  $schedules['quarterly'] = array(
85
+ 'interval' => 90 * DAY_IN_SECONDS,
86
+ 'display' => __( 'Once quarterly', 'top-10' ),
87
  );
88
  return $schedules;
89
  }
includes/deprecated.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Top_Ten
8
  */
9
 
10
-
11
  /**
12
  * Holds the filesystem directory path (with trailing slash) for Top 10
13
  *
@@ -36,7 +35,7 @@ $tptn_url = plugins_url() . '/' . plugin_basename( dirname( TOP_TEN_PLUGIN_FILE
36
  * @since 1.9.8
37
  * @deprecated 2.2.0
38
  *
39
- * @param string $content Post content
40
  * @return string Filtered post content
41
  */
42
  function ald_tptn_rss( $content ) {
@@ -47,3 +46,107 @@ function ald_tptn_rss( $content ) {
47
  }
48
 
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  * @package Top_Ten
8
  */
9
 
 
10
  /**
11
  * Holds the filesystem directory path (with trailing slash) for Top 10
12
  *
35
  * @since 1.9.8
36
  * @deprecated 2.2.0
37
  *
38
+ * @param string $content Post content.
39
  * @return string Filtered post content
40
  */
41
  function ald_tptn_rss( $content ) {
46
  }
47
 
48
 
49
+ /**
50
+ * Function to update the post views for the current post. Filters `the_content`.
51
+ *
52
+ * @since 1.0
53
+ *
54
+ * @deprecated 2.4.0
55
+ *
56
+ * @param string $content Post content.
57
+ */
58
+ function tptn_add_viewed_count( $content = '' ) {
59
+ global $post, $tptn_settings;
60
+
61
+ _deprecated_function( __FUNCTION__, '2.4.0' );
62
+
63
+ $home_url = home_url( '/' );
64
+
65
+ /**
66
+ * Filter the script URL of the counter.
67
+ *
68
+ * @since 2.0
69
+ */
70
+ $home_url = apply_filters( 'tptn_add_counter_script_url', $home_url );
71
+
72
+ // Strip any query strings since we don't need them.
73
+ $home_url = strtok( $home_url, '?' );
74
+
75
+ if ( is_singular() && 'draft' !== $post->post_status ) {
76
+
77
+ $current_user = wp_get_current_user(); // Let's get the current user
78
+ $post_author = ( $current_user->ID == $post->post_author ) ? true : false; // Is the current user the post author?
79
+ $current_user_admin = ( current_user_can( 'manage_options' ) ) ? true : false; // Is the current user an admin?
80
+ $current_user_editor = ( ( current_user_can( 'edit_others_posts' ) ) && ( ! current_user_can( 'manage_options' ) ) ) ? true : false; // Is the current user an editor?
81
+
82
+ $include_code = true;
83
+ if ( ( $post_author ) && ( ! $tptn_settings['track_authors'] ) ) {
84
+ $include_code = false;
85
+ }
86
+ if ( ( $current_user_admin ) && ( ! $tptn_settings['track_admins'] ) ) {
87
+ $include_code = false;
88
+ }
89
+ if ( ( $current_user_editor ) && ( ! $tptn_settings['track_editors'] ) ) {
90
+ $include_code = false;
91
+ }
92
+
93
+ if ( $include_code ) {
94
+
95
+ $output = '';
96
+ $id = intval( $post->ID );
97
+ $blog_id = get_current_blog_id();
98
+ $activate_counter = $tptn_settings['activate_overall'] ? 1 : 0; // It's 1 if we're updating the overall count.
99
+ $activate_counter = $activate_counter + ( $tptn_settings['activate_daily'] ? 10 : 0 ); // It's 10 if we're updating the daily count.
100
+
101
+ if ( $activate_counter > 0 ) {
102
+ $output = '
103
+ <script type="text/javascript"> jQuery(document).ready(function() {
104
+ jQuery.ajax({
105
+ url: "' . $home_url . '",
106
+ data: {
107
+ top_ten_id: ' . $id . ',
108
+ top_ten_blog_id: ' . $blog_id . ',
109
+ activate_counter: ' . $activate_counter . ',
110
+ top10_rnd: (new Date()).getTime() + "-" + Math.floor(Math.random() * 100000)
111
+ }
112
+ });
113
+ });</script>';
114
+ }
115
+
116
+ /**
117
+ * Filter the counter script
118
+ *
119
+ * @since 1.9.8.5
120
+ *
121
+ * @param string $output Counter script code
122
+ */
123
+ $output = apply_filters( 'tptn_viewed_count', $output );
124
+
125
+ echo $output;
126
+ }
127
+ }
128
+ }
129
+
130
+
131
+ /**
132
+ * Add tracker code.
133
+ *
134
+ * @since 2.3.0
135
+ *
136
+ * @deprecated 2.4.0
137
+ *
138
+ * @param bool $echo Echo the code or return it.
139
+ * @return string|void
140
+ */
141
+ function tptn_add_tracker( $echo = true ) {
142
+
143
+ _deprecated_function( __FUNCTION__, '2.4.0' );
144
+
145
+ if ( $echo ) {
146
+ echo tptn_add_viewed_count( '' );
147
+ } else {
148
+ return tptn_add_viewed_count( '' );
149
+ }
150
+ }
151
+
152
+
includes/formatting.php CHANGED
@@ -5,14 +5,14 @@
5
  * @package Top_Ten
6
  */
7
 
8
-
9
  /**
10
  * Function to create an excerpt for the post.
11
  *
12
  * @since 1.6
13
- * @param int $id Post ID
14
- * @param int|string $excerpt_length Length of the excerpt in words
15
- * @return string Excerpt
 
16
  */
17
  function tptn_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
18
  $content = '';
@@ -21,7 +21,7 @@ function tptn_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
21
  $content = get_post( $id )->post_excerpt;
22
  }
23
 
24
- if ( '' == $content ) {
25
  $content = get_post( $id )->post_content;
26
  }
27
 
@@ -49,21 +49,21 @@ function tptn_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
49
  * Function to limit content by characters.
50
  *
51
  * @since 1.9.8
52
- * @param string $content Content to be used to make an excerpt
53
- * @param int $no_of_char Maximum length of excerpt in characters
54
- * @return string Formatted content
55
  */
56
  function tptn_max_formatted_content( $content, $no_of_char = -1 ) {
57
- $content = strip_tags( $content ); // Remove CRLFs, leaving space in their wake
58
 
59
  if ( ( $no_of_char > 0 ) && ( strlen( $content ) > $no_of_char ) ) {
60
- $aWords = preg_split( '/[\s]+/', substr( $content, 0, $no_of_char ) );
61
 
62
- // Break back down into a string of words, but drop the last one if it's chopped off
63
- if ( substr( $content, $no_of_char, 1 ) == ' ' ) {
64
- $content = implode( ' ', $aWords );
65
  } else {
66
- $content = implode( ' ', array_slice( $aWords, 0, -1 ) ) .'&hellip;';
67
  }
68
  }
69
 
5
  * @package Top_Ten
6
  */
7
 
 
8
  /**
9
  * Function to create an excerpt for the post.
10
  *
11
  * @since 1.6
12
+ * @param int $id Post ID.
13
+ * @param int|string $excerpt_length Length of the excerpt in words.
14
+ * @param bool $use_excerpt Use Excerpt.
15
+ * @return string Excerpt
16
  */
17
  function tptn_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
18
  $content = '';
21
  $content = get_post( $id )->post_excerpt;
22
  }
23
 
24
+ if ( '' === $content ) {
25
  $content = get_post( $id )->post_content;
26
  }
27
 
49
  * Function to limit content by characters.
50
  *
51
  * @since 1.9.8
52
+ * @param string $content Content to be used to make an excerpt.
53
+ * @param int $no_of_char Maximum length of excerpt in characters.
54
+ * @return string Formatted content.
55
  */
56
  function tptn_max_formatted_content( $content, $no_of_char = -1 ) {
57
+ $content = strip_tags( $content );
58
 
59
  if ( ( $no_of_char > 0 ) && ( strlen( $content ) > $no_of_char ) ) {
60
+ $no_of_words = preg_split( '/[\s]+/', substr( $content, 0, $no_of_char ) );
61
 
62
+ // Break back down into a string of words, but drop the last one if it's chopped off.
63
+ if ( substr( $content, $no_of_char, 1 ) === ' ' ) {
64
+ $content = implode( ' ', $no_of_words );
65
  } else {
66
+ $content = implode( ' ', array_slice( $no_of_words, 0, -1 ) ) . '&hellip;';
67
  }
68
  }
69
 
{admin/wick → includes/js}/index.php RENAMED
File without changes
includes/js/top-10-tracker.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function($){var data={'action':'tptn_tracker','top_ten_nonce':ajax_tptn_tracker.top_ten_nonce,'top_ten_id':ajax_tptn_tracker.top_ten_id,'top_ten_blog_id':ajax_tptn_tracker.top_ten_blog_id,'activate_counter':ajax_tptn_tracker.activate_counter};jQuery.post(ajax_tptn_tracker.ajax_url,data);});
includes/l10n.php CHANGED
@@ -5,7 +5,6 @@
5
  * @package Top_Ten
6
  */
7
 
8
-
9
  /**
10
  * Function to load translation files.
11
  *
@@ -22,7 +21,7 @@ add_action( 'plugins_loaded', 'tptn_lang_init' );
22
  *
23
  * @since 2.1.0
24
  *
25
- * @param $post_id Post ID
26
  */
27
  function tptn_object_id_cur_lang( $post_id ) {
28
 
5
  * @package Top_Ten
6
  */
7
 
 
8
  /**
9
  * Function to load translation files.
10
  *
21
  *
22
  * @since 2.1.0
23
  *
24
+ * @param int $post_id Post ID.
25
  */
26
  function tptn_object_id_cur_lang( $post_id ) {
27
 
includes/modules/class-top-10-widget.php CHANGED
@@ -14,7 +14,6 @@ if ( ! defined( 'WPINC' ) ) {
14
  die;
15
  }
16
 
17
-
18
  /**
19
  * Top 10 Widget.
20
  *
@@ -27,9 +26,12 @@ class Top_Ten_Widget extends WP_Widget {
27
  */
28
  function __construct() {
29
  parent::__construct(
30
- 'widget_tptn_pop', // Base ID
31
- __( 'Popular Posts [Top 10]', 'top-10' ), // Name
32
- array( 'description' => __( 'Display popular posts', 'top-10' ) ) // Args
 
 
 
33
  );
34
 
35
  add_action( 'wp_enqueue_scripts', array( $this, 'front_end_styles' ) );
@@ -46,6 +48,7 @@ class Top_Ten_Widget extends WP_Widget {
46
  function form( $instance ) {
47
  $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
48
  $limit = isset( $instance['limit'] ) ? esc_attr( $instance['limit'] ) : '';
 
49
  $disp_list_count = isset( $instance['disp_list_count'] ) ? esc_attr( $instance['disp_list_count'] ) : '';
50
  $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
51
  $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
@@ -57,11 +60,11 @@ class Top_Ten_Widget extends WP_Widget {
57
  $daily_range = isset( $instance['daily_range'] ) ? esc_attr( $instance['daily_range'] ) : '';
58
  $hour_range = isset( $instance['hour_range'] ) ? esc_attr( $instance['hour_range'] ) : '';
59
 
60
- // Parse the Post types
61
  $post_types = array();
62
  if ( isset( $instance['post_types'] ) ) {
63
  $post_types = $instance['post_types'];
64
- parse_str( $post_types, $post_types ); // Save post types in $post_types variable
65
  }
66
  $wp_post_types = get_post_types( array(
67
  'public' => true,
@@ -70,78 +73,83 @@ class Top_Ten_Widget extends WP_Widget {
70
 
71
  ?>
72
  <p>
73
- <label for="<?php echo $this->get_field_id( 'title' ); ?>">
74
- <?php _e( 'Title', 'top-10' ); ?>: <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
 
 
 
 
 
75
  </label>
76
  </p>
77
  <p>
78
- <label for="<?php echo $this->get_field_id( 'limit' ); ?>">
79
- <?php _e( 'No. of posts', 'top-10' ); ?>: <input class="widefat" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" />
80
  </label>
81
  </p>
82
  <p>
83
- <select class="widefat" id="<?php echo $this->get_field_id( 'daily' ); ?>" name="<?php echo $this->get_field_name( 'daily' ); ?>">
84
- <option value="overall" <?php if ( 'overall' == $daily ) { echo 'selected="selected"'; } ?>><?php _e( 'Overall', 'top-10' ); ?></option>
85
- <option value="daily" <?php if ( 'daily' == $daily ) { echo 'selected="selected"'; } ?>><?php _e( 'Custom time period (Enter below)', 'top-10' ); ?></option>
86
  </select>
87
  </p>
88
  <p>
89
- <?php _e( 'In days and hours (applies only to custom option above)', 'top-10' ); ?>:
90
- <label for="<?php echo $this->get_field_id( 'daily_range' ); ?>">
91
- <input class="widefat" id="<?php echo $this->get_field_id( 'daily_range' ); ?>" name="<?php echo $this->get_field_name( 'daily_range' ); ?>" type="text" value="<?php echo esc_attr( $daily_range ); ?>" /> <?php _e( 'days', 'top-10' ); ?>
92
  </label>
93
- <label for="<?php echo $this->get_field_id( 'hour_range' ); ?>">
94
- <input class="widefat" id="<?php echo $this->get_field_id( 'hour_range' ); ?>" name="<?php echo $this->get_field_name( 'hour_range' ); ?>" type="text" value="<?php echo esc_attr( $hour_range ); ?>" /> <?php _e( 'hours', 'top-10' ); ?>
95
  </label>
96
  </p>
97
  <p>
98
- <label for="<?php echo $this->get_field_id( 'disp_list_count' ); ?>">
99
- <input id="<?php echo $this->get_field_id( 'disp_list_count' ); ?>" name="<?php echo $this->get_field_name( 'disp_list_count' ); ?>" type="checkbox" <?php if ( $disp_list_count ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Show count?', 'top-10' ); ?>
100
  </label>
101
  </p>
102
  <p>
103
- <label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>">
104
- <input id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" type="checkbox" <?php if ( $show_excerpt ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Show excerpt?', 'top-10' ); ?>
105
  </label>
106
  </p>
107
  <p>
108
- <label for="<?php echo $this->get_field_id( 'show_author' ); ?>">
109
- <input id="<?php echo $this->get_field_id( 'show_author' ); ?>" name="<?php echo $this->get_field_name( 'show_author' ); ?>" type="checkbox" <?php if ( $show_author ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Show author?', 'top-10' ); ?>
110
  </label>
111
  </p>
112
  <p>
113
- <label for="<?php echo $this->get_field_id( 'show_date' ); ?>">
114
- <input id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" type="checkbox" <?php if ( $show_date ) { echo 'checked="checked"'; } ?> /> <?php _e( 'Show date?', 'top-10' ); ?>
115
  </label>
116
  </p>
117
  <p>
118
- <?php _e( 'Thumbnail options', 'top-10' ); ?>: <br />
119
- <select class="widefat" id="<?php echo $this->get_field_id( 'post_thumb_op' ); ?>" name="<?php echo $this->get_field_name( 'post_thumb_op' ); ?>">
120
- <option value="inline" <?php if ( 'inline' == $post_thumb_op ) { echo 'selected="selected"'; } ?>><?php _e( 'Thumbnails inline, before title','top-10' ); ?></option>
121
- <option value="after" <?php if ( 'after' == $post_thumb_op ) { echo 'selected="selected"'; } ?>><?php _e( 'Thumbnails inline, after title','top-10' ); ?></option>
122
- <option value="thumbs_only" <?php if ( 'thumbs_only' == $post_thumb_op ) { echo 'selected="selected"'; } ?>><?php _e( 'Only thumbnails, no text','top-10' ); ?></option>
123
- <option value="text_only" <?php if ( 'text_only' == $post_thumb_op ) { echo 'selected="selected"'; } ?>><?php _e( 'No thumbnails, only text.','top-10' ); ?></option>
124
  </select>
125
  </p>
126
  <p>
127
- <label for="<?php echo $this->get_field_id( 'thumb_height' ); ?>">
128
- <?php _e( 'Thumbnail height', 'top-10' ); ?>:
129
- <input class="widefat" id="<?php echo $this->get_field_id( 'thumb_height' ); ?>" name="<?php echo $this->get_field_name( 'thumb_height' ); ?>" type="text" value="<?php echo esc_attr( $thumb_height ); ?>" />
130
  </label>
131
  </p>
132
  <p>
133
- <label for="<?php echo $this->get_field_id( 'thumb_width' ); ?>">
134
- <?php _e( 'Thumbnail width', 'top-10' ); ?>:
135
- <input class="widefat" id="<?php echo $this->get_field_id( 'thumb_width' ); ?>" name="<?php echo $this->get_field_name( 'thumb_width' ); ?>" type="text" value="<?php echo esc_attr( $thumb_width ); ?>" />
136
  </label>
137
  </p>
138
- <p><?php _e( 'Post types to include:', 'top-10' ); ?><br />
139
 
140
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
141
 
142
  <label>
143
- <input id="<?php echo $this->get_field_id( 'post_types' ); ?>" name="<?php echo $this->get_field_name( 'post_types' ); ?>[]" type="checkbox" value="<?php echo $wp_post_type; ?>" <?php if ( in_array( $wp_post_type, $posts_types_inc ) ) { echo 'checked="checked"'; } ?> />
144
- <?php echo $wp_post_type; ?>
145
  </label>
146
  <br />
147
 
@@ -176,6 +184,7 @@ class Top_Ten_Widget extends WP_Widget {
176
  $instance = $old_instance;
177
  $instance['title'] = strip_tags( $new_instance['title'] );
178
  $instance['limit'] = $new_instance['limit'];
 
179
  $instance['daily'] = $new_instance['daily'];
180
  $instance['daily_range'] = strip_tags( $new_instance['daily_range'] );
181
  $instance['hour_range'] = strip_tags( $new_instance['hour_range'] );
@@ -187,7 +196,7 @@ class Top_Ten_Widget extends WP_Widget {
187
  $instance['thumb_height'] = $new_instance['thumb_height'];
188
  $instance['thumb_width'] = $new_instance['thumb_width'];
189
 
190
- // Process post types to be selected
191
  $wp_post_types = get_post_types( array(
192
  'public' => true,
193
  ) );
@@ -216,7 +225,7 @@ class Top_Ten_Widget extends WP_Widget {
216
  function widget( $args, $instance ) {
217
  global $tptn_settings, $post;
218
 
219
- // Get the post meta
220
  if ( isset( $post ) ) {
221
  $tptn_post_meta = get_post_meta( $post->ID, 'tptn_post_meta', true );
222
 
@@ -230,18 +239,19 @@ class Top_Ten_Widget extends WP_Widget {
230
  $limit = $tptn_settings['limit'];
231
  }
232
 
 
233
  $daily_range = ( empty( $instance['daily_range'] ) ) ? $tptn_settings['daily_range'] : $instance['daily_range'];
234
  $hour_range = ( empty( $instance['hour_range'] ) ) ? $tptn_settings['hour_range'] : $instance['hour_range'];
235
 
236
- $daily = ( isset( $instance['daily'] ) && ( 'daily' == $instance['daily'] ) ) ? true : false;
237
 
238
  $output = $args['before_widget'];
239
  $output .= $args['before_title'] . $title . $args['after_title'];
240
 
241
  $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
242
 
243
- $thumb_height = ( isset( $instance['thumb_height'] ) && '' != $instance['thumb_height'] ) ? intval( $instance['thumb_height'] ) : $tptn_settings['thumb_height'];
244
- $thumb_width = ( isset( $instance['thumb_width'] ) && '' != $instance['thumb_width'] ) ? intval( $instance['thumb_width'] ) : $tptn_settings['thumb_width'];
245
 
246
  $disp_list_count = isset( $instance['disp_list_count'] ) ? esc_attr( $instance['disp_list_count'] ) : '';
247
  $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
@@ -254,6 +264,7 @@ class Top_Ten_Widget extends WP_Widget {
254
  'instance_id' => $this->number,
255
  'heading' => 0,
256
  'limit' => $limit,
 
257
  'daily' => $daily,
258
  'daily_range' => $daily_range,
259
  'hour_range' => $hour_range,
@@ -280,7 +291,7 @@ class Top_Ten_Widget extends WP_Widget {
280
 
281
  $output .= $args['after_widget'];
282
 
283
- echo $output;
284
 
285
  } //ending function widget
286
 
@@ -293,25 +304,25 @@ class Top_Ten_Widget extends WP_Widget {
293
  function front_end_styles() {
294
  global $tptn_settings;
295
 
296
- if ( ! 'left_thumbs' == $tptn_settings['tptn_styles'] ) {
297
  return;
298
  }
299
 
300
- // we need to process all instances because this function gets to run only once
301
  $widget_settings = get_option( $this->option_name );
302
 
303
  foreach ( (array) $widget_settings as $instance => $options ) {
304
 
305
- // identify instance
306
  $widget_id = "{$this->id_base}-{$instance}";
307
 
308
- // check if it's our instance
309
  if ( ! is_active_widget( false, $widget_id, $this->id_base, true ) ) {
310
  continue; // Not active.
311
  }
312
 
313
- $thumb_height = ( isset( $options['thumb_height'] ) && '' != $options['thumb_height'] ) ? intval( $options['thumb_height'] ) : $tptn_settings['thumb_height'];
314
- $thumb_width = ( isset( $options['thumb_width'] ) && '' != $options['thumb_width'] ) ? intval( $options['thumb_width'] ) : $tptn_settings['thumb_width'];
315
 
316
  // Enqueue the custom css for the thumb width and height for this specific widget.
317
  $custom_css = "
14
  die;
15
  }
16
 
 
17
  /**
18
  * Top 10 Widget.
19
  *
26
  */
27
  function __construct() {
28
  parent::__construct(
29
+ 'widget_tptn_pop', // Base ID.
30
+ __( 'Popular Posts [Top 10]', 'top-10' ), // Name.
31
+ array(
32
+ 'description' => __( 'Display popular posts', 'where-did-they-go-from-here' ),
33
+ 'customize_selective_refresh' => true,
34
+ )
35
  );
36
 
37
  add_action( 'wp_enqueue_scripts', array( $this, 'front_end_styles' ) );
48
  function form( $instance ) {
49
  $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
50
  $limit = isset( $instance['limit'] ) ? esc_attr( $instance['limit'] ) : '';
51
+ $offset = isset( $instance['offset'] ) ? esc_attr( $instance['offset'] ) : '';
52
  $disp_list_count = isset( $instance['disp_list_count'] ) ? esc_attr( $instance['disp_list_count'] ) : '';
53
  $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
54
  $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
60
  $daily_range = isset( $instance['daily_range'] ) ? esc_attr( $instance['daily_range'] ) : '';
61
  $hour_range = isset( $instance['hour_range'] ) ? esc_attr( $instance['hour_range'] ) : '';
62
 
63
+ // Parse the Post types.
64
  $post_types = array();
65
  if ( isset( $instance['post_types'] ) ) {
66
  $post_types = $instance['post_types'];
67
+ parse_str( $post_types, $post_types ); // Save post types in $post_types variable.
68
  }
69
  $wp_post_types = get_post_types( array(
70
  'public' => true,
73
 
74
  ?>
75
  <p>
76
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
77
+ <?php esc_html_e( 'Title', 'top-10' ); ?>: <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
78
+ </label>
79
+ </p>
80
+ <p>
81
+ <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
82
+ <?php esc_html_e( 'No. of posts', 'top-10' ); ?>: <input class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" />
83
  </label>
84
  </p>
85
  <p>
86
+ <label for="<?php echo esc_attr( $this->get_field_id( 'offset' ) ); ?>">
87
+ <?php esc_html_e( 'Offset', 'top-10' ); ?>: <input class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'offset' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'offset' ) ); ?>" type="text" value="<?php echo esc_attr( $offset ); ?>" />
88
  </label>
89
  </p>
90
  <p>
91
+ <select class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'daily' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'daily' ) ); ?>">
92
+ <option value="overall" <?php selected( 'overall', $daily, true ); ?>><?php esc_html_e( 'Overall', 'top-10' ); ?></option>
93
+ <option value="daily" <?php selected( 'daily', $daily, true ); ?>><?php esc_html_e( 'Custom time period (Enter below)', 'top-10' ); ?></option>
94
  </select>
95
  </p>
96
  <p>
97
+ <?php esc_html_e( 'In days and hours (applies only to custom option above)', 'top-10' ); ?>:
98
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'daily_range' ) ); ?>">
99
+ <input class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'daily_range' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'daily_range' ) ); ?>" type="text" value="<?php echo esc_attr( $daily_range ); ?>" /> <?php esc_html_e( 'days', 'top-10' ); ?>
100
  </label>
101
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'hour_range' ) ); ?>">
102
+ <input class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'hour_range' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'hour_range' ) ); ?>" type="text" value="<?php echo esc_attr( $hour_range ); ?>" /> <?php esc_html_e( 'hours', 'top-10' ); ?>
103
  </label>
104
  </p>
105
  <p>
106
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'disp_list_count' ) ); ?>">
107
+ <input id="<?php echo esc_attr_e( $this->get_field_id( 'disp_list_count' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'disp_list_count' ) ); ?>" type="checkbox" <?php if ( $disp_list_count ) { echo 'checked="checked"'; } ?> /> <?php esc_html_e( 'Show count?', 'top-10' ); ?>
108
  </label>
109
  </p>
110
  <p>
111
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'show_excerpt' ) ); ?>">
112
+ <input id="<?php echo esc_attr_e( $this->get_field_id( 'show_excerpt' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'show_excerpt' ) ); ?>" type="checkbox" <?php if ( $show_excerpt ) { echo 'checked="checked"'; } ?> /> <?php esc_html_e( 'Show excerpt?', 'top-10' ); ?>
113
  </label>
114
  </p>
115
  <p>
116
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'show_author' ) ); ?>">
117
+ <input id="<?php echo esc_attr_e( $this->get_field_id( 'show_author' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'show_author' ) ); ?>" type="checkbox" <?php if ( $show_author ) { echo 'checked="checked"'; } ?> /> <?php esc_html_e( 'Show author?', 'top-10' ); ?>
118
  </label>
119
  </p>
120
  <p>
121
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'show_date' ) ); ?>">
122
+ <input id="<?php echo esc_attr_e( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'show_date' ) ); ?>" type="checkbox" <?php if ( $show_date ) { echo 'checked="checked"'; } ?> /> <?php esc_html_e( 'Show date?', 'top-10' ); ?>
123
  </label>
124
  </p>
125
  <p>
126
+ <?php esc_html_e( 'Thumbnail options', 'top-10' ); ?>: <br />
127
+ <select class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'post_thumb_op' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'post_thumb_op' ) ); ?>">
128
+ <option value="inline" <?php selected( 'inline', $post_thumb_op, true ); ?>><?php esc_html_e( 'Thumbnails inline, before title','top-10' ); ?></option>
129
+ <option value="after" <?php selected( 'after', $post_thumb_op, true ); ?>><?php esc_html_e( 'Thumbnails inline, after title','top-10' ); ?></option>
130
+ <option value="thumbs_only" <?php selected( 'thumbs_only', $post_thumb_op, true ); ?>><?php esc_html_e( 'Only thumbnails, no text','top-10' ); ?></option>
131
+ <option value="text_only" <?php selected( 'text_only', $post_thumb_op, true ); ?>><?php esc_html_e( 'No thumbnails, only text.','top-10' ); ?></option>
132
  </select>
133
  </p>
134
  <p>
135
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'thumb_height' ) ); ?>">
136
+ <?php esc_html_e( 'Thumbnail height', 'top-10' ); ?>:
137
+ <input class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'thumb_height' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'thumb_height' ) ); ?>" type="text" value="<?php echo esc_attr( $thumb_height ); ?>" />
138
  </label>
139
  </p>
140
  <p>
141
+ <label for="<?php echo esc_attr_e( $this->get_field_id( 'thumb_width' ) ); ?>">
142
+ <?php esc_html_e( 'Thumbnail width', 'top-10' ); ?>:
143
+ <input class="widefat" id="<?php echo esc_attr_e( $this->get_field_id( 'thumb_width' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'thumb_width' ) ); ?>" type="text" value="<?php echo esc_attr( $thumb_width ); ?>" />
144
  </label>
145
  </p>
146
+ <p><?php esc_html_e( 'Post types to include:', 'top-10' ); ?><br />
147
 
148
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
149
 
150
  <label>
151
+ <input id="<?php echo esc_attr_e( $this->get_field_id( 'post_types' ) ); ?>" name="<?php echo esc_attr_e( $this->get_field_name( 'post_types' ) ); ?>[]" type="checkbox" value="<?php echo esc_attr_e( $wp_post_type ); ?>" <?php checked( true, in_array( $wp_post_type, $posts_types_inc, true ), true ); ?> />
152
+ <?php echo esc_attr_e( $wp_post_type ); ?>
153
  </label>
154
  <br />
155
 
184
  $instance = $old_instance;
185
  $instance['title'] = strip_tags( $new_instance['title'] );
186
  $instance['limit'] = $new_instance['limit'];
187
+ $instance['offset'] = $new_instance['offset'];
188
  $instance['daily'] = $new_instance['daily'];
189
  $instance['daily_range'] = strip_tags( $new_instance['daily_range'] );
190
  $instance['hour_range'] = strip_tags( $new_instance['hour_range'] );
196
  $instance['thumb_height'] = $new_instance['thumb_height'];
197
  $instance['thumb_width'] = $new_instance['thumb_width'];
198
 
199
+ // Process post types to be selected.
200
  $wp_post_types = get_post_types( array(
201
  'public' => true,
202
  ) );
225
  function widget( $args, $instance ) {
226
  global $tptn_settings, $post;
227
 
228
+ // Get the post meta.
229
  if ( isset( $post ) ) {
230
  $tptn_post_meta = get_post_meta( $post->ID, 'tptn_post_meta', true );
231
 
239
  $limit = $tptn_settings['limit'];
240
  }
241
 
242
+ $offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
243
  $daily_range = ( empty( $instance['daily_range'] ) ) ? $tptn_settings['daily_range'] : $instance['daily_range'];
244
  $hour_range = ( empty( $instance['hour_range'] ) ) ? $tptn_settings['hour_range'] : $instance['hour_range'];
245
 
246
+ $daily = ( isset( $instance['daily'] ) && ( 'daily' === $instance['daily'] ) ) ? true : false;
247
 
248
  $output = $args['before_widget'];
249
  $output .= $args['before_title'] . $title . $args['after_title'];
250
 
251
  $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
252
 
253
+ $thumb_height = ( isset( $instance['thumb_height'] ) && '' !== $instance['thumb_height'] ) ? absint( $instance['thumb_height'] ) : $tptn_settings['thumb_height'];
254
+ $thumb_width = ( isset( $instance['thumb_width'] ) && '' !== $instance['thumb_width'] ) ? absint( $instance['thumb_width'] ) : $tptn_settings['thumb_width'];
255
 
256
  $disp_list_count = isset( $instance['disp_list_count'] ) ? esc_attr( $instance['disp_list_count'] ) : '';
257
  $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
264
  'instance_id' => $this->number,
265
  'heading' => 0,
266
  'limit' => $limit,
267
+ 'offset' => $offset,
268
  'daily' => $daily,
269
  'daily_range' => $daily_range,
270
  'hour_range' => $hour_range,
291
 
292
  $output .= $args['after_widget'];
293
 
294
+ echo $output; // WPCS: XSS OK.
295
 
296
  } //ending function widget
297
 
304
  function front_end_styles() {
305
  global $tptn_settings;
306
 
307
+ if ( ! 'left_thumbs' === $tptn_settings['tptn_styles'] ) {
308
  return;
309
  }
310
 
311
+ // We need to process all instances because this function gets to run only once.
312
  $widget_settings = get_option( $this->option_name );
313
 
314
  foreach ( (array) $widget_settings as $instance => $options ) {
315
 
316
+ // Identify instance.
317
  $widget_id = "{$this->id_base}-{$instance}";
318
 
319
+ // Check if it's our instance.
320
  if ( ! is_active_widget( false, $widget_id, $this->id_base, true ) ) {
321
  continue; // Not active.
322
  }
323
 
324
+ $thumb_height = ( isset( $options['thumb_height'] ) && '' !== $options['thumb_height'] ) ? absint( $options['thumb_height'] ) : $tptn_settings['thumb_height'];
325
+ $thumb_width = ( isset( $options['thumb_width'] ) && '' !== $options['thumb_width'] ) ? absint( $options['thumb_width'] ) : $tptn_settings['thumb_width'];
326
 
327
  // Enqueue the custom css for the thumb width and height for this specific widget.
328
  $custom_css = "
includes/modules/exclusions.php CHANGED
@@ -5,13 +5,12 @@
5
  * @package Top_Ten
6
  */
7
 
8
-
9
  /**
10
  * Function to filter exclude post IDs.
11
  *
12
  * @since 2.2.0
13
  *
14
- * @param array $exclude_post_ids Original excluded post IDs
15
  * @return array Updated excluded post ID
16
  */
17
  function tptn_exclude_post_ids( $exclude_post_ids ) {
5
  * @package Top_Ten
6
  */
7
 
 
8
  /**
9
  * Function to filter exclude post IDs.
10
  *
11
  * @since 2.2.0
12
  *
13
+ * @param array $exclude_post_ids Original excluded post IDs.
14
  * @return array Updated excluded post ID
15
  */
16
  function tptn_exclude_post_ids( $exclude_post_ids ) {
includes/modules/shortcode.php CHANGED
@@ -9,8 +9,8 @@
9
  * Creates a shortcode [tptn_list limit="5" heading="1" daily="0"].
10
  *
11
  * @since 1.9.9
12
- * @param array $atts Shortcode attributes
13
- * @param string $content Content
14
  * @return string Formatted list of posts generated by tptn_pop_posts
15
  */
16
  function tptn_shortcode( $atts, $content = null ) {
@@ -22,6 +22,7 @@ function tptn_shortcode( $atts, $content = null ) {
22
  'heading' => 1,
23
  'daily' => 0,
24
  'is_shortcode' => 1,
 
25
  )
26
  ), $atts, 'top-10' );
27
 
@@ -34,8 +35,8 @@ add_shortcode( 'tptn_list', 'tptn_shortcode' );
34
  * Creates a shortcode [tptn_views daily="0"].
35
  *
36
  * @since 1.9.9
37
- * @param array $atts Shortcode attributes
38
- * @param string $content Content
39
  * @return string Views of the post
40
  */
41
  function tptn_shortcode_views( $atts, $content = null ) {
9
  * Creates a shortcode [tptn_list limit="5" heading="1" daily="0"].
10
  *
11
  * @since 1.9.9
12
+ * @param array $atts Shortcode attributes.
13
+ * @param string $content Content.
14
  * @return string Formatted list of posts generated by tptn_pop_posts
15
  */
16
  function tptn_shortcode( $atts, $content = null ) {
22
  'heading' => 1,
23
  'daily' => 0,
24
  'is_shortcode' => 1,
25
+ 'offset' => 0,
26
  )
27
  ), $atts, 'top-10' );
28
 
35
  * Creates a shortcode [tptn_views daily="0"].
36
  *
37
  * @since 1.9.9
38
+ * @param array $atts Shortcode attributes.
39
+ * @param string $content Content.
40
  * @return string Views of the post
41
  */
42
  function tptn_shortcode_views( $atts, $content = null ) {
includes/modules/taxonomies.php CHANGED
@@ -15,13 +15,13 @@ if ( ! defined( 'WPINC' ) ) {
15
  *
16
  * @since 2.2.0
17
  *
18
- * @param mixed $join
19
  * @return string Filtered JOIN clause
20
  */
21
  function tptn_exclude_categories_join( $join ) {
22
  global $wpdb, $tptn_settings;
23
 
24
- if ( '' != $tptn_settings['exclude_categories'] ) {
25
 
26
  $sql = $join;
27
  $sql .= " LEFT JOIN $wpdb->term_relationships AS excat_tr ON ($wpdb->posts.ID = excat_tr.object_id) ";
@@ -40,13 +40,13 @@ add_filter( 'tptn_posts_join', 'tptn_exclude_categories_join' );
40
  *
41
  * @since 2.2.0
42
  *
43
- * @param mixed $where
44
  * @return string Filtered WHERE clause
45
  */
46
  function tptn_exclude_categories_where( $where ) {
47
  global $wpdb, $tptn_settings;
48
 
49
- if ( '' == $tptn_settings['exclude_categories'] ) {
50
  return $where;
51
  } else {
52
 
@@ -72,13 +72,13 @@ add_filter( 'tptn_posts_where', 'tptn_exclude_categories_where' );
72
  *
73
  * @since 2.3.0
74
  *
75
- * @param mixed $groupby
76
  * @return string Filtered GROUP BY clause
77
  */
78
  function tptn_exclude_categories_groupby( $groupby ) {
79
  global $tptn_settings;
80
 
81
- if ( '' != $tptn_settings['exclude_categories'] && '' != $groupby ) {
82
 
83
  $sql = $groupby;
84
  $sql .= ', excat_tt.term_taxonomy_id ';
15
  *
16
  * @since 2.2.0
17
  *
18
+ * @param mixed $join Join clause.
19
  * @return string Filtered JOIN clause
20
  */
21
  function tptn_exclude_categories_join( $join ) {
22
  global $wpdb, $tptn_settings;
23
 
24
+ if ( '' !== $tptn_settings['exclude_categories'] ) {
25
 
26
  $sql = $join;
27
  $sql .= " LEFT JOIN $wpdb->term_relationships AS excat_tr ON ($wpdb->posts.ID = excat_tr.object_id) ";
40
  *
41
  * @since 2.2.0
42
  *
43
+ * @param mixed $where WHERE clause.
44
  * @return string Filtered WHERE clause
45
  */
46
  function tptn_exclude_categories_where( $where ) {
47
  global $wpdb, $tptn_settings;
48
 
49
+ if ( '' === $tptn_settings['exclude_categories'] ) {
50
  return $where;
51
  } else {
52
 
72
  *
73
  * @since 2.3.0
74
  *
75
+ * @param mixed $groupby GROUP BY clause.
76
  * @return string Filtered GROUP BY clause
77
  */
78
  function tptn_exclude_categories_groupby( $groupby ) {
79
  global $tptn_settings;
80
 
81
+ if ( '' !== $tptn_settings['exclude_categories'] && '' !== $groupby ) {
82
 
83
  $sql = $groupby;
84
  $sql .= ', excat_tt.term_taxonomy_id ';
includes/public/display-posts.php CHANGED
@@ -37,6 +37,7 @@ function tptn_pop_posts( $args ) {
37
  'strict_limit' => false,
38
  'posts_only' => false,
39
  'heading' => 1,
 
40
  );
41
 
42
  // Merge the $defaults array with the $tptn_settings array
@@ -133,7 +134,7 @@ function tptn_pop_posts( $args ) {
133
  // Push the current ID into the array to ensure we're not repeating it
134
  array_push( $processed_results, $resultid );
135
 
136
- $sumcount = $result->sumCount; // Store the count. We'll need this later
137
 
138
  /**
139
  * Filter the post ID for each result. Allows a custom function to hook in and change the ID if needed.
@@ -179,7 +180,7 @@ function tptn_pop_posts( $args ) {
179
 
180
  if ( $args['disp_list_count'] ) {
181
 
182
- $tptn_list_count = '(' . number_format_i18n( $sumcount ) . ')';
183
 
184
  /**
185
  * Filter the formatted list count text.
@@ -187,10 +188,10 @@ function tptn_pop_posts( $args ) {
187
  * @since 2.1.0
188
  *
189
  * @param string $tptn_list_count Formatted list count
190
- * @param int $sumcount Post count
191
  * @param object $result Post object
192
  */
193
- $tptn_list_count = apply_filters( 'tptn_list_count', $tptn_list_count, $sumcount, $result );
194
 
195
  $output .= ' <span class="tptn_list_count">' . $tptn_list_count . '</span>';
196
  }
@@ -225,9 +226,9 @@ function tptn_pop_posts( $args ) {
225
  $output .= tptn_before_list_item( $args, $result );
226
 
227
  $output .= sprintf(
228
- __( 'Popular posts by <a href="%s" rel="nofollow" %s>Top 10 plugin</a>', 'top-10' ),
229
  esc_url( 'https://webberzone.com/plugins/top-10/' ),
230
- tptn_link_attributes( $args )
231
  );
232
 
233
  $output .= tptn_after_list_item( $args, $result );
@@ -298,6 +299,7 @@ function get_tptn_pop_posts( $args = array() ) {
298
  'daily' => false,
299
  'strict_limit' => true,
300
  'posts_only' => false,
 
301
  );
302
 
303
  // Merge the $defaults array with the $tptn_settings array
@@ -313,6 +315,7 @@ function get_tptn_pop_posts( $args = array() ) {
313
  }
314
 
315
  $limit = ( $args['strict_limit'] ) ? $args['limit'] : ( $args['limit'] * 5 );
 
316
 
317
  // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
318
  if ( ! empty( $args['post_types'] ) && false === strpos( $args['post_types'], '=' ) ) {
@@ -349,7 +352,7 @@ function get_tptn_pop_posts( $args = array() ) {
349
  // Fields to return
350
  $fields[] = 'ID';
351
  $fields[] = 'postnumber';
352
- $fields[] = ( $args['daily'] ) ? 'SUM(cntaccess) as sumCount' : 'cntaccess as sumCount';
353
 
354
  $fields = implode( ', ', $fields );
355
 
@@ -358,7 +361,7 @@ function get_tptn_pop_posts( $args = array() ) {
358
 
359
  // Create the base WHERE clause
360
  $where .= $wpdb->prepare( ' AND blog_id = %d ', $blog_id ); // Posts need to be from the current blog only
361
- $where .= " AND $wpdb->posts.post_status = 'publish' "; // Only show published posts
362
 
363
  if ( $args['daily'] ) {
364
  $where .= $wpdb->prepare( " AND dp_date >= '%s' ", $from_date ); // Only fetch posts that are tracked after this date
@@ -393,10 +396,10 @@ function get_tptn_pop_posts( $args = array() ) {
393
  }
394
 
395
  // Create the base ORDER BY clause
396
- $orderby = ' sumCount DESC ';
397
 
398
  // Create the base LIMITS clause
399
- $limits .= $wpdb->prepare( ' LIMIT %d ', $limit );
400
 
401
  /**
402
  * Filter the SELECT clause of the query.
37
  'strict_limit' => false,
38
  'posts_only' => false,
39
  'heading' => 1,
40
+ 'offset' => 0,
41
  );
42
 
43
  // Merge the $defaults array with the $tptn_settings array
134
  // Push the current ID into the array to ensure we're not repeating it
135
  array_push( $processed_results, $resultid );
136
 
137
+ $sum_count = $result->sum_count; // Store the count. We'll need this later
138
 
139
  /**
140
  * Filter the post ID for each result. Allows a custom function to hook in and change the ID if needed.
180
 
181
  if ( $args['disp_list_count'] ) {
182
 
183
+ $tptn_list_count = '(' . number_format_i18n( $sum_count ) . ')';
184
 
185
  /**
186
  * Filter the formatted list count text.
188
  * @since 2.1.0
189
  *
190
  * @param string $tptn_list_count Formatted list count
191
+ * @param int $sum_count Post count
192
  * @param object $result Post object
193
  */
194
+ $tptn_list_count = apply_filters( 'tptn_list_count', $tptn_list_count, $sum_count, $result );
195
 
196
  $output .= ' <span class="tptn_list_count">' . $tptn_list_count . '</span>';
197
  }
226
  $output .= tptn_before_list_item( $args, $result );
227
 
228
  $output .= sprintf(
229
+ __( 'Popular posts by <a href="%1$s" rel="nofollow" %2$s>Top 10 plugin</a>', 'top-10' ),
230
  esc_url( 'https://webberzone.com/plugins/top-10/' ),
231
+ tptn_link_attributes( $args, $result )
232
  );
233
 
234
  $output .= tptn_after_list_item( $args, $result );
299
  'daily' => false,
300
  'strict_limit' => true,
301
  'posts_only' => false,
302
+ 'offset' => 0,
303
  );
304
 
305
  // Merge the $defaults array with the $tptn_settings array
315
  }
316
 
317
  $limit = ( $args['strict_limit'] ) ? $args['limit'] : ( $args['limit'] * 5 );
318
+ $offset = isset( $args['offset'] ) ? $args['offset'] : 0;
319
 
320
  // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
321
  if ( ! empty( $args['post_types'] ) && false === strpos( $args['post_types'], '=' ) ) {
352
  // Fields to return
353
  $fields[] = 'ID';
354
  $fields[] = 'postnumber';
355
+ $fields[] = ( $args['daily'] ) ? 'SUM(cntaccess) as sum_count' : 'cntaccess as sum_count';
356
 
357
  $fields = implode( ', ', $fields );
358
 
361
 
362
  // Create the base WHERE clause
363
  $where .= $wpdb->prepare( ' AND blog_id = %d ', $blog_id ); // Posts need to be from the current blog only
364
+ $where .= " AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'inherit') "; // Show published posts and attachments
365
 
366
  if ( $args['daily'] ) {
367
  $where .= $wpdb->prepare( " AND dp_date >= '%s' ", $from_date ); // Only fetch posts that are tracked after this date
396
  }
397
 
398
  // Create the base ORDER BY clause
399
+ $orderby = ' sum_count DESC ';
400
 
401
  // Create the base LIMITS clause
402
+ $limits .= $wpdb->prepare( ' LIMIT %d, %d ', $offset, $limit );
403
 
404
  /**
405
  * Filter the SELECT clause of the query.
includes/public/media.php CHANGED
@@ -16,14 +16,13 @@ function tptn_add_image_sizes() {
16
 
17
  if ( ! in_array( $tptn_settings['thumb_size'], get_intermediate_image_sizes() ) ) {
18
  $tptn_settings['thumb_size'] = 'tptn_thumbnail';
19
- update_option( 'ald_tptn_settings', $tptn_settings );
20
  }
21
 
22
  // Add image sizes if 'tptn_thumbnail' is selected or the selected thumbnail size is no longer valid
23
  if ( 'tptn_thumbnail' == $tptn_settings['thumb_size'] ) {
24
  $width = empty( $tptn_settings['thumb_width'] ) ? 150 : $tptn_settings['thumb_width'];
25
  $height = empty( $tptn_settings['thumb_height'] ) ? 150 : $tptn_settings['thumb_height'];
26
- $crop = isset( $tptn_settings['thumb_crop'] ) ? $tptn_settings['thumb_crop'] : false;
27
 
28
  add_image_size( 'tptn_thumbnail', $width, $height, $crop );
29
  }
@@ -193,7 +192,7 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
193
 
194
  if ( 'css' == $args['thumb_html'] ) {
195
  $thumb_html = 'style="max-width:' . $args['thumb_width'] . 'px;max-height:' . $args['thumb_height'] . 'px;"';
196
- } else if ( 'html' == $args['thumb_html'] ) {
197
  $thumb_html = 'width="' . $args['thumb_width'] . '" height="' . $args['thumb_height'] . '"';
198
  } else {
199
  $thumb_html = '';
16
 
17
  if ( ! in_array( $tptn_settings['thumb_size'], get_intermediate_image_sizes() ) ) {
18
  $tptn_settings['thumb_size'] = 'tptn_thumbnail';
 
19
  }
20
 
21
  // Add image sizes if 'tptn_thumbnail' is selected or the selected thumbnail size is no longer valid
22
  if ( 'tptn_thumbnail' == $tptn_settings['thumb_size'] ) {
23
  $width = empty( $tptn_settings['thumb_width'] ) ? 150 : $tptn_settings['thumb_width'];
24
  $height = empty( $tptn_settings['thumb_height'] ) ? 150 : $tptn_settings['thumb_height'];
25
+ $crop = isset( $tptn_settings['thumb_crop'] ) ? $tptn_settings['thumb_crop'] : true;
26
 
27
  add_image_size( 'tptn_thumbnail', $width, $height, $crop );
28
  }
192
 
193
  if ( 'css' == $args['thumb_html'] ) {
194
  $thumb_html = 'style="max-width:' . $args['thumb_width'] . 'px;max-height:' . $args['thumb_height'] . 'px;"';
195
+ } elseif ( 'html' == $args['thumb_html'] ) {
196
  $thumb_html = 'width="' . $args['thumb_width'] . '" height="' . $args['thumb_height'] . '"';
197
  } else {
198
  $thumb_html = '';
includes/public/output-generator.php CHANGED
@@ -22,7 +22,7 @@ if ( ! defined( 'WPINC' ) ) {
22
  * @param array $args Array of arguments
23
  * @return string Space separated list of link attributes
24
  */
25
- function tptn_link_attributes( $args ) {
26
 
27
  $rel_attribute = ( $args['link_nofollow'] ) ? ' rel="nofollow" ' : ' ';
28
 
@@ -41,7 +41,7 @@ function tptn_link_attributes( $args ) {
41
  * @param array $link_attributes Array of link attributes
42
  * @param array $args Array of arguments
43
  */
44
- $link_attributes = apply_filters( 'tptn_link_attributes', $link_attributes, $args );
45
 
46
  // Convert it to a string
47
  $link_attributes = implode( ' ', $link_attributes );
@@ -265,7 +265,7 @@ function tptn_list_link( $args, $result ) {
265
 
266
  $output = '';
267
  $title = tptn_post_title( $args, $result );
268
- $link_attributes = tptn_link_attributes( $args );
269
 
270
  if ( 'after' == $args['post_thumb_op'] ) {
271
  $output .= '<a href="' . get_permalink( $result->ID ) . '" ' . $link_attributes . ' class="tptn_link">'; // Add beginning of link
22
  * @param array $args Array of arguments
23
  * @return string Space separated list of link attributes
24
  */
25
+ function tptn_link_attributes( $args, $result ) {
26
 
27
  $rel_attribute = ( $args['link_nofollow'] ) ? ' rel="nofollow" ' : ' ';
28
 
41
  * @param array $link_attributes Array of link attributes
42
  * @param array $args Array of arguments
43
  */
44
+ $link_attributes = apply_filters( 'tptn_link_attributes', $link_attributes, $args, $result );
45
 
46
  // Convert it to a string
47
  $link_attributes = implode( ' ', $link_attributes );
265
 
266
  $output = '';
267
  $title = tptn_post_title( $args, $result );
268
+ $link_attributes = tptn_link_attributes( $args, $result );
269
 
270
  if ( 'after' == $args['post_thumb_op'] ) {
271
  $output .= '<a href="' . get_permalink( $result->ID ) . '" ' . $link_attributes . ' class="tptn_link">'; // Add beginning of link
includes/tracker.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions controlling the tracker
4
+ *
5
+ * @package Top_Ten
6
+ */
7
+
8
+ /**
9
+ * Enqueues the scripts needed by Top 10.
10
+ *
11
+ * @since 1.9.7
12
+ * @return void
13
+ */
14
+ function tptn_enqueue_scripts() {
15
+ global $post, $tptn_settings;
16
+
17
+ if ( is_singular() && 'draft' !== $post->post_status && ! is_customize_preview() ) {
18
+
19
+ $current_user = wp_get_current_user(); // Let's get the current user
20
+ $post_author = ( $current_user->ID === $post->post_author ) ? true : false; // Is the current user the post author?
21
+ $current_user_admin = ( current_user_can( 'manage_options' ) ) ? true : false; // Is the current user an admin?
22
+ $current_user_editor = ( ( current_user_can( 'edit_others_posts' ) ) && ( ! current_user_can( 'manage_options' ) ) ) ? true : false; // Is the current user an editor?
23
+
24
+ $include_code = true;
25
+ if ( ( $post_author ) && ( ! $tptn_settings['track_authors'] ) ) {
26
+ $include_code = false;
27
+ }
28
+ if ( ( $current_user_admin ) && ( ! $tptn_settings['track_admins'] ) ) {
29
+ $include_code = false;
30
+ }
31
+ if ( ( $current_user_editor ) && ( ! $tptn_settings['track_editors'] ) ) {
32
+ $include_code = false;
33
+ }
34
+
35
+ if ( $include_code ) {
36
+
37
+ $id = absint( $post->ID );
38
+ $blog_id = get_current_blog_id();
39
+ $activate_counter = $tptn_settings['activate_overall'] ? 1 : 0; // It's 1 if we're updating the overall count.
40
+ $activate_counter = $activate_counter + ( $tptn_settings['activate_daily'] ? 10 : 0 ); // It's 10 if we're updating the daily count.
41
+
42
+ if ( 'query_based' === $tptn_settings['tracker_type'] ) {
43
+ $home_url = home_url( '/' );
44
+ } else {
45
+ $home_url = admin_url( 'admin-ajax.php' );
46
+ }
47
+
48
+ /**
49
+ * Filter the URL of the tracker.
50
+ *
51
+ * Other tracker types can override the URL processed by the jQuery.post request
52
+ * The corresponding tracker can use the below variables or append their own to $ajax_tptn_tracker
53
+ *
54
+ * @since 2.0
55
+ */
56
+ $home_url = apply_filters( 'tptn_add_counter_script_url', $home_url );
57
+
58
+ // Strip any query strings since we don't need them.
59
+ $home_url = strtok( $home_url, '?' );
60
+
61
+ $ajax_tptn_tracker = array(
62
+ 'ajax_url' => $home_url,
63
+ 'top_ten_nonce' => wp_create_nonce( 'tptn-tracker-nonce' ),
64
+ 'top_ten_id' => $id,
65
+ 'top_ten_blog_id' => $blog_id,
66
+ 'activate_counter' => $activate_counter,
67
+ 'tptn_rnd' => wp_rand( 1, time() ),
68
+ );
69
+
70
+ /**
71
+ * Filter the localize script arguments for the Top 10 tracker.
72
+ *
73
+ * @since 2.4.0
74
+ */
75
+ $ajax_tptn_tracker = apply_filters( 'tptn_tracker_script_args', $ajax_tptn_tracker );
76
+
77
+ wp_enqueue_script( 'tptn_tracker', plugins_url( 'includes/js/top-10-tracker.js', TOP_TEN_PLUGIN_FILE ), array( 'jquery' ) );
78
+
79
+ wp_localize_script( 'tptn_tracker', 'ajax_tptn_tracker', $ajax_tptn_tracker );
80
+
81
+ }
82
+ }
83
+
84
+ }
85
+ add_action( 'wp_enqueue_scripts', 'tptn_enqueue_scripts' );
86
+
87
+
88
+ /**
89
+ * Function to add additional queries to query_vars.
90
+ *
91
+ * @since 2.0.0
92
+ *
93
+ * @param array $vars Query variables array.
94
+ * @return array $Query variables array with Top 10 parameters appended
95
+ */
96
+ function tptn_query_vars( $vars ) {
97
+ // Add these to the list of queryvars that WP gathers.
98
+ $vars[] = 'top_ten_id';
99
+ $vars[] = 'top_ten_blog_id';
100
+ $vars[] = 'activate_counter';
101
+ $vars[] = 'view_counter';
102
+ $vars[] = 'top_ten_debug';
103
+ return $vars;
104
+ }
105
+ add_filter( 'query_vars', 'tptn_query_vars' );
106
+
107
+
108
+ /**
109
+ * Parses the WordPress object to update/display the count.
110
+ *
111
+ * @since 2.0.0
112
+ *
113
+ * @param object $wp WordPress object.
114
+ */
115
+ function tptn_parse_request( $wp ) {
116
+ global $wpdb;
117
+
118
+ if ( empty( $wp ) ) {
119
+ global $wp;
120
+ }
121
+
122
+ if ( ! isset( $wp->query_vars ) || ! is_array( $wp->query_vars ) ) {
123
+ return;
124
+ }
125
+
126
+ $table_name = $wpdb->base_prefix . 'top_ten';
127
+ $top_ten_daily = $wpdb->base_prefix . 'top_ten_daily';
128
+ $str = '';
129
+
130
+ if ( array_key_exists( 'top_ten_id', $wp->query_vars ) && array_key_exists( 'activate_counter', $wp->query_vars ) && '' !== $wp->query_vars['top_ten_id'] ) {
131
+
132
+ $id = absint( $wp->query_vars['top_ten_id'] );
133
+ $blog_id = absint( $wp->query_vars['top_ten_blog_id'] );
134
+ $activate_counter = absint( $wp->query_vars['activate_counter'] );
135
+
136
+ if ( $id > 0 ) {
137
+
138
+ if ( ( 1 === $activate_counter ) || ( 11 === $activate_counter ) ) {
139
+
140
+ $tt = $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES('%d', '1', '%d') ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
141
+
142
+ $str .= ( false === $tt ) ? 'tte' : 'tt' . $tt;
143
+ }
144
+
145
+ if ( ( 10 === $activate_counter ) || ( 11 === $activate_counter ) ) {
146
+
147
+ $current_date = gmdate( 'Y-m-d H', current_time( 'timestamp', 0 ) );
148
+
149
+ $ttd = $wpdb->query( $wpdb->prepare( "INSERT INTO {$top_ten_daily} (postnumber, cntaccess, dp_date, blog_id) VALUES('%d', '1', '%s', '%d' ) ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $current_date, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
150
+
151
+ $str .= ( false === $ttd ) ? ' ttde' : ' ttd' . $ttd;
152
+ }
153
+ }
154
+
155
+ // If the debug parameter is set then we output $str else we send a No Content header.
156
+ if ( array_key_exists( 'top_ten_debug', $wp->query_vars ) && 1 === absint( $wp->query_vars['top_ten_debug'] ) ) {
157
+ header( 'content-type: application/x-javascript' );
158
+ echo esc_html( $str );
159
+ } else {
160
+ header( 'HTTP/1.0 204 No Content' );
161
+ header( 'Cache-Control: max-age=15, s-maxage=0' );
162
+ }
163
+
164
+ // Stop anything else from loading as it is not needed.
165
+ exit;
166
+
167
+ } elseif ( array_key_exists( 'top_ten_id', $wp->query_vars ) && array_key_exists( 'view_counter', $wp->query_vars ) && '' !== $wp->query_vars['top_ten_id'] ) {
168
+
169
+ $id = absint( $wp->query_vars['top_ten_id'] );
170
+
171
+ if ( $id > 0 ) {
172
+
173
+ $output = get_tptn_post_count( $id );
174
+
175
+ header( 'content-type: application/x-javascript' );
176
+ echo 'document.write("' . $output . '")'; // WPCS: XSS OK.
177
+
178
+ // Stop anything else from loading as it is not needed.
179
+ exit;
180
+ }
181
+ } else {
182
+ return;
183
+ }
184
+ }
185
+ add_action( 'parse_request', 'tptn_parse_request' );
186
+
187
+
188
+ /**
189
+ * Parse the ajax response.
190
+ *
191
+ * @since 2.4.0
192
+ */
193
+ function tptn_tracker_parser() {
194
+
195
+ global $wpdb;
196
+
197
+ // Check for the nonce and exit if failed.
198
+ if ( isset( $_POST['top_ten_nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['top_ten_nonce'] ), 'tptn-tracker-nonce' ) ) { // Input var okay.
199
+ wp_die( esc_html__( 'Top 10: Security check failed', 'top-10' ) );
200
+ }
201
+
202
+ $table_name = $wpdb->base_prefix . 'top_ten';
203
+ $top_ten_daily = $wpdb->base_prefix . 'top_ten_daily';
204
+ $str = '';
205
+
206
+ $id = isset( $_POST['top_ten_id'] ) ? absint( sanitize_text_field( wp_unslash( $_POST['top_ten_id'] ) ) ) : 0; // Input var okay.
207
+ $blog_id = isset( $_POST['top_ten_blog_id'] ) ? absint( sanitize_text_field( wp_unslash( $_POST['top_ten_blog_id'] ) ) ) : 0; // Input var okay.
208
+ $activate_counter = isset( $_POST['activate_counter'] ) ? absint( sanitize_text_field( wp_unslash( $_POST['activate_counter'] ) ) ) : 0; // Input var okay.
209
+
210
+ if ( $id > 0 ) {
211
+
212
+ if ( ( 1 === $activate_counter ) || ( 11 === $activate_counter ) ) {
213
+
214
+ $tt = $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES('%d', '1', '%d') ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
215
+
216
+ $str .= ( false === $tt ) ? 'tte' : 'tt' . $tt;
217
+ }
218
+
219
+ if ( ( 10 === $activate_counter ) || ( 11 === $activate_counter ) ) {
220
+
221
+ $current_date = gmdate( 'Y-m-d H', current_time( 'timestamp', 0 ) );
222
+
223
+ $ttd = $wpdb->query( $wpdb->prepare( "INSERT INTO {$top_ten_daily} (postnumber, cntaccess, dp_date, blog_id) VALUES('%d', '1', '%s', '%d' ) ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $current_date, $blog_id ) ); // DB call ok; no-cache ok; WPCS: unprepared SQL OK.
224
+
225
+ $str .= ( false === $ttd ) ? ' ttde' : ' ttd' . $ttd;
226
+ }
227
+ }
228
+
229
+ echo esc_html( $str );
230
+
231
+ wp_die();
232
+ }
233
+ add_action( 'wp_ajax_nopriv_tptn_tracker', 'tptn_tracker_parser' );
234
+ add_action( 'wp_ajax_tptn_tracker', 'tptn_tracker_parser' );
235
+
236
+
237
+ /**
238
+ * Function returns the different types of trackers.
239
+ *
240
+ * @since 2.4.0
241
+ * @return array Tracker types.
242
+ */
243
+ function tptn_get_tracker_types() {
244
+
245
+ $trackers = array(
246
+ array(
247
+ 'id' => 'query_based',
248
+ 'name' => __( 'Query variable based', 'top-10' ),
249
+ 'description' => __( 'Uses query variables to record visits', 'top-10' ),
250
+ ),
251
+ array(
252
+ 'id' => 'ajaxurl',
253
+ 'name' => __( 'Ajaxurl based', 'top-10' ),
254
+ 'description' => __( 'Uses admin-ajax.php which is inbuilt within WordPress to process the tracker', 'top-10' ),
255
+ ),
256
+ );
257
+
258
+ /**
259
+ * Filter the array containing the types of trackers to add your own.
260
+ *
261
+ * @since 2.4.0
262
+ *
263
+ * @param string $trackers Different trackers.
264
+ */
265
+ return apply_filters( 'tptn_get_tracker_types', $trackers );
266
+ }
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: 2016-03-25 09:32+0000\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: Ajay DSouza <me@ajaydsouza.com>\n"
@@ -12,7 +12,7 @@ msgstr ""
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext\n"
14
  "X-Poedit-Basepath: ..\n"
15
- "X-Generator: Poedit 1.8.4\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: .\n"
@@ -30,73 +30,27 @@ msgstr ""
30
  msgid "Views"
31
  msgstr ""
32
 
33
- #: admin/admin-dashboard.php:63
34
  msgid "View all daily popular posts"
35
  msgstr ""
36
 
37
- #: admin/admin-dashboard.php:65
38
  msgid "View all popular posts"
39
  msgstr ""
40
 
41
- #: admin/admin-dashboard.php:71
42
  #, php-format
43
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
44
  msgstr ""
45
 
46
- #: admin/admin-dashboard.php:110 admin/class-stats.php:516
47
- #: admin/deprecated.php:41
48
  msgid "Popular Posts"
49
  msgstr ""
50
 
51
- #: admin/admin-dashboard.php:115 admin/admin.php:426 admin/deprecated.php:43
52
  msgid "Daily Popular Posts"
53
  msgstr ""
54
 
55
- #: admin/admin-metabox.php:104
56
- msgid "Visit count:"
57
- msgstr ""
58
-
59
- #: admin/admin-metabox.php:106
60
- msgid ""
61
- "Enter a number above to update the visit count. Leaving the above box blank "
62
- "will set the count to zero"
63
- msgstr ""
64
-
65
- #: admin/admin-metabox.php:115
66
- msgid "Disable Popular Posts display:"
67
- msgstr ""
68
-
69
- #: admin/admin-metabox.php:118
70
- msgid ""
71
- "If this is checked, then Top 10 will not display the popular posts widgets "
72
- "when viewing this post."
73
- msgstr ""
74
-
75
- #: admin/admin-metabox.php:122
76
- msgid "Exclude this post from the popular posts list:"
77
- msgstr ""
78
-
79
- #: admin/admin-metabox.php:125
80
- msgid ""
81
- "If this is checked, then this post will be excluded from the popular posts "
82
- "list."
83
- msgstr ""
84
-
85
- #: admin/admin-metabox.php:129
86
- msgid "Location of thumbnail:"
87
- msgstr ""
88
-
89
- #: admin/admin-metabox.php:131
90
- msgid ""
91
- "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
92
- "image will be used for the post. It will be resized to the thumbnail size "
93
- "set under Top 10 Settings &raquo; Thumbnail options."
94
- msgstr ""
95
-
96
- #: admin/admin-metabox.php:132
97
- msgid "The URL above is saved in the meta field:"
98
- msgstr ""
99
-
100
  #: admin/admin-metabox.php:137
101
  #, php-format
102
  msgid ""
@@ -104,1050 +58,181 @@ msgid ""
104
  "will need to make the same change in the %1$s meta box on this page."
105
  msgstr ""
106
 
107
- #: admin/admin.php:191
108
  msgid "Options saved successfully. If enabled, the cache has been cleared."
109
  msgstr ""
110
 
111
- #: admin/admin.php:194
112
  msgid ""
113
  "Left Thumbnails style selected. Post thumbnail location set to Inline before "
114
  "text."
115
  msgstr ""
116
 
117
- #: admin/admin.php:197
118
  msgid "Text Only style selected. Thumbnails will not be displayed."
119
  msgstr ""
120
 
121
- #: admin/admin.php:200
122
  #, php-format
123
- msgid "Pre-built thumbnail size selected. Thumbnail set to %d x %d."
124
  msgstr ""
125
 
126
- #: admin/admin.php:215
127
  msgid "Options set to Default."
128
  msgstr ""
129
 
130
- #: admin/admin.php:222
131
  msgid "Top 10 popular posts reset"
132
  msgstr ""
133
 
134
- #: admin/admin.php:229
135
  msgid "Top 10 daily popular posts reset"
136
  msgstr ""
137
 
138
- #: admin/admin.php:237
139
  msgid "Duplicate rows cleaned from tables"
140
  msgstr ""
141
 
142
- #: admin/admin.php:245
143
  msgid "Post counts across blog IDs 0 and 1 have been merged"
144
  msgstr ""
145
 
146
- #: admin/admin.php:258
147
  msgid "Scheduled maintenance enabled / modified"
148
  msgstr ""
149
 
150
- #: admin/admin.php:262
151
  msgid "Scheduled maintenance disabled"
152
  msgstr ""
153
 
154
- #: admin/admin.php:300
155
  msgid "Counts from selected sites have been imported."
156
  msgstr ""
157
 
158
- #: admin/admin.php:325
159
  msgid ""
160
  "Selected tables have been deleted. Note that only imported tables have been "
161
  "deleted."
162
  msgstr ""
163
 
164
- #: admin/admin.php:342 admin/admin.php:362 admin/admin.php:386
165
- #: admin/main-view.php:55 admin/main-view.php:181 admin/main-view.php:286
166
- #: admin/main-view.php:495 admin/main-view.php:658 admin/main-view.php:754
167
- #: admin/main-view.php:818 admin/main-view.php:853
168
- msgid "Click to toggle"
169
- msgstr ""
170
-
171
- #: admin/admin.php:343
172
- msgid "Support the development"
173
- msgstr ""
174
-
175
- #: admin/admin.php:350
176
- msgid "Donation for Top 10"
177
- msgstr ""
178
-
179
- #: admin/admin.php:352
180
- msgid "Enter amount in USD:"
181
- msgstr ""
182
-
183
- #: admin/admin.php:356
184
- msgid "Send your donation to the author of Top 10"
185
- msgstr ""
186
-
187
- #: admin/admin.php:363
188
- msgid "Follow me"
189
- msgstr ""
190
-
191
- #: admin/admin.php:387
192
- msgid "Quick links"
193
- msgstr ""
194
-
195
- #: admin/admin.php:391
196
- msgid "Top 10 plugin page"
197
- msgstr ""
198
-
199
- #: admin/admin.php:392
200
- msgid "Top 10 Github page"
201
- msgstr ""
202
-
203
- #: admin/admin.php:393
204
- msgid "Other plugins"
205
- msgstr ""
206
-
207
- #: admin/admin.php:394
208
- msgid "FAQ"
209
- msgstr ""
210
-
211
- #: admin/admin.php:395 admin/admin.php:567
212
- msgid "Support"
213
- msgstr ""
214
-
215
- #: admin/admin.php:396
216
- msgid "Reviews"
217
- msgstr ""
218
-
219
- #: admin/admin.php:397
220
- msgid "Ajay's blog"
221
- msgstr ""
222
-
223
- #: admin/admin.php:414 admin/admin.php:417 admin/main-view.php:22
224
  msgid "Top 10 Settings"
225
  msgstr ""
226
 
227
- #: admin/admin.php:414
228
  msgid "Top 10"
229
  msgstr ""
230
 
231
- #: admin/admin.php:422
232
  msgid "View Popular Posts"
233
  msgstr ""
234
 
235
- #: admin/admin.php:544
236
  msgid "Settings"
237
  msgstr ""
238
 
239
- #: admin/admin.php:568
 
 
 
 
240
  msgid "Donate"
241
  msgstr ""
242
 
 
 
 
 
243
  #: admin/cache.php:19
244
  msgid "Top 10 cache has been cleared"
245
  msgstr ""
246
 
247
- #: admin/class-stats.php:36
248
  msgid "popular_post"
249
  msgstr ""
250
 
251
- #: admin/class-stats.php:37
252
  msgid "popular_posts"
253
  msgstr ""
254
 
255
- #: admin/class-stats.php:185
256
- msgid "No popular posts available."
257
- msgstr ""
258
-
259
- #: admin/class-stats.php:234
260
  msgid "View"
261
  msgstr ""
262
 
263
- #: admin/class-stats.php:235
264
  msgid "Edit"
265
  msgstr ""
266
 
267
- #: admin/class-stats.php:236
268
  msgid "Delete"
269
  msgstr ""
270
 
271
- #: admin/class-stats.php:258
272
  msgid "Y/m/d g:i:s a"
273
  msgstr ""
274
 
275
- #: admin/class-stats.php:265
276
  #, php-format
277
  msgid "%s ago"
278
  msgstr ""
279
 
280
- #: admin/class-stats.php:267
281
  msgid "Y/m/d"
282
  msgstr ""
283
 
284
- #: admin/class-stats.php:300 includes/modules/class-top-10-widget.php:74
285
  msgid "Title"
286
  msgstr ""
287
 
288
- #: admin/class-stats.php:301
289
  msgid "Total visits"
290
  msgstr ""
291
 
292
- #: admin/class-stats.php:302
293
  msgid "Daily visits"
294
  msgstr ""
295
 
296
- #: admin/class-stats.php:303
297
  msgid "Post type"
298
  msgstr ""
299
 
300
- #: admin/class-stats.php:304
301
  msgid "Author"
302
  msgstr ""
303
 
304
- #: admin/class-stats.php:305
305
  msgid "Date"
306
  msgstr ""
307
 
308
- #: admin/class-stats.php:339
309
  msgid "Delete Count"
310
  msgstr ""
311
 
312
- #: admin/class-stats.php:379
313
- msgid "Are you sure you want to do this"
314
- msgstr ""
315
-
316
- #: admin/class-stats.php:430
317
  msgid "Filter"
318
  msgstr ""
319
 
320
- #: admin/class-stats.php:491
321
  msgid "Search Table"
322
  msgstr ""
323
 
324
- #: admin/main-view.php:34 admin/main-view.php:56
325
- msgid "General options"
326
- msgstr ""
327
-
328
- #: admin/main-view.php:35 admin/main-view.php:182
329
- msgid "Counter and tracker options"
330
- msgstr ""
331
-
332
- #: admin/main-view.php:36 admin/main-view.php:287
333
- msgid "Popular post list options"
334
- msgstr ""
335
-
336
- #: admin/main-view.php:37 admin/main-view.php:496
337
- #: includes/modules/class-top-10-widget.php:118
338
- msgid "Thumbnail options"
339
- msgstr ""
340
-
341
- #: admin/main-view.php:38 admin/main-view.php:659
342
- msgid "Styles"
343
- msgstr ""
344
-
345
- #: admin/main-view.php:39 admin/main-view.php:755
346
- msgid "Maintenance"
347
- msgstr ""
348
-
349
- #: admin/main-view.php:72
350
- msgid "Enable trackers:"
351
- msgstr ""
352
-
353
- #: admin/main-view.php:77 includes/modules/class-top-10-widget.php:84
354
- msgid "Overall"
355
- msgstr ""
356
-
357
- #: admin/main-view.php:83 admin/main-view.php:774
358
- msgid "Daily"
359
- msgstr ""
360
-
361
- #: admin/main-view.php:89
362
- msgid "Use Ajax for tracking:"
363
- msgstr ""
364
-
365
- #: admin/main-view.php:92
366
- msgid ""
367
- "This will try to prevent W3 Total Cache and other caching plugins from "
368
- "caching the tracker script of the plugin. Try toggling this option in case "
369
- "you find that your posts are not tracked."
370
- msgstr ""
371
-
372
- #: admin/main-view.php:96
373
- msgid "Use external JS file for tracking:"
374
- msgstr ""
375
-
376
- #: admin/main-view.php:99
377
- msgid ""
378
- "This uses the external javascript file for tracking. This is a more "
379
- "efficient and less resource intensive tracker. This settings might have some "
380
- "compatibility issues on some WordPress installs or might be blocked by some "
381
- "security plugins. If you find that your posts are not being tracked then "
382
- "disable this option."
383
- msgstr ""
384
-
385
- #: admin/main-view.php:103
386
- msgid "Enable cache:"
387
- msgstr ""
388
-
389
- #: admin/main-view.php:106
390
- msgid ""
391
- "If activated, Top 10 will use the Transients API to cache the popular posts "
392
- "output for 1 hour."
393
- msgstr ""
394
-
395
- #: admin/main-view.php:107
396
- msgid "Clear cache"
397
- msgstr ""
398
-
399
- #: admin/main-view.php:111
400
- msgid "Start daily counts from midnight:"
401
- msgstr ""
402
-
403
- #: admin/main-view.php:114
404
- msgid ""
405
- "Daily counter will display number of visits from midnight. This option is "
406
- "checked by default and mimics the way most normal counters work. Turning "
407
- "this off will allow you to use the hourly setting in the next option."
408
- msgstr ""
409
-
410
- #: admin/main-view.php:118
411
- msgid "Daily popular contains top posts over:"
412
- msgstr ""
413
-
414
- #: admin/main-view.php:120
415
- msgid "day(s)"
416
- msgstr ""
417
-
418
- #: admin/main-view.php:121
419
- msgid "hour(s)"
420
- msgstr ""
421
-
422
- #: admin/main-view.php:122
423
- msgid ""
424
- "Think of Daily Popular has a custom date range applied as a global setting. "
425
- "Instead of displaying popular posts from the past day, this setting lets you "
426
- "display posts for as many days or as few hours as you want. This can be "
427
- "overridden in the widget."
428
- msgstr ""
429
-
430
- #: admin/main-view.php:126
431
- msgid "Delete options on uninstall"
432
- msgstr ""
433
-
434
- #: admin/main-view.php:129
435
- msgid ""
436
- "If this is checked, all settings related to Top 10 are removed from the "
437
- "database if you choose to uninstall/delete the plugin."
438
- msgstr ""
439
-
440
- #: admin/main-view.php:133
441
- msgid "Delete counter data on uninstall"
442
- msgstr ""
443
-
444
- #: admin/main-view.php:136
445
- msgid ""
446
- "If this is checked, the tables containing the counter statistics are removed "
447
- "from the database if you choose to uninstall/delete the plugin."
448
- msgstr ""
449
-
450
- #: admin/main-view.php:137
451
- msgid ""
452
- "Keep this unchecked if you choose to reinstall the plugin and don't want to "
453
- "lose your counter data."
454
- msgstr ""
455
-
456
- #: admin/main-view.php:140
457
- msgid "Show metabox:"
458
- msgstr ""
459
-
460
- #: admin/main-view.php:143
461
- msgid ""
462
- "This will add the Top 10 metabox on Edit Posts or Add New Posts screens. "
463
- "Also applies to Pages and Custom Post Types."
464
- msgstr ""
465
-
466
- #: admin/main-view.php:147
467
- msgid "Limit metabox to Admins only:"
468
- msgstr ""
469
-
470
- #: admin/main-view.php:150
471
- msgid ""
472
- "If this is selected, the metabox will be hidden from anyone who is not an "
473
- "Admin. Otherwise, by default, Contributors and above will be able to see the "
474
- "metabox. This applies only if the above option is selected."
475
- msgstr ""
476
-
477
- #: admin/main-view.php:155
478
- msgid "Link to Top 10 plugin page"
479
- msgstr ""
480
-
481
- #: admin/main-view.php:158
482
- msgid ""
483
- "A link to the plugin is added as an extra list item to the list of popular "
484
- "posts"
485
- msgstr ""
486
-
487
- #: admin/main-view.php:163 admin/main-view.php:268 admin/main-view.php:477
488
- #: admin/main-view.php:640 admin/main-view.php:734
489
- msgid "Save Options"
490
- msgstr ""
491
-
492
- #: admin/main-view.php:198
493
- msgid "Display number of views on:"
494
- msgstr ""
495
-
496
- #: admin/main-view.php:200
497
- msgid "Posts"
498
- msgstr ""
499
-
500
- #: admin/main-view.php:201
501
- msgid "Pages"
502
- msgstr ""
503
-
504
- #: admin/main-view.php:202
505
- msgid "Home page"
506
- msgstr ""
507
-
508
- #: admin/main-view.php:203
509
- msgid "Feeds"
510
- msgstr ""
511
-
512
- #: admin/main-view.php:204
513
- msgid "Category archives"
514
- msgstr ""
515
-
516
- #: admin/main-view.php:205
517
- msgid "Tag archives"
518
- msgstr ""
519
-
520
- #: admin/main-view.php:206
521
- msgid "Other archives"
522
- msgstr ""
523
-
524
- #: admin/main-view.php:207
525
- msgid ""
526
- "If you choose to disable this, please add <code>&lt;?php if "
527
- "( function_exists ( 'echo_tptn_post_count' ) ) echo_tptn_post_count(); ?&gt;"
528
- "</code> to your template file where you want it displayed"
529
- msgstr ""
530
-
531
- #: admin/main-view.php:211
532
- msgid "Format to display the post views:"
533
- msgstr ""
534
-
535
- #: admin/main-view.php:214
536
- msgid ""
537
- "Use <code>%totalcount%</code> to display the total count, <code>%dailycount"
538
- "%</code> to display the daily count and <code>%overallcount%</code> to "
539
- "display the overall count across all posts on the blog. e.g. the default "
540
- "options displays <code>[Visited 123 times, 23 visits today]</code>"
541
- msgstr ""
542
-
543
- #: admin/main-view.php:218
544
- msgid "What do display when there are no visits?"
545
- msgstr ""
546
-
547
- #: admin/main-view.php:221
548
- msgid ""
549
- "This text applies only when there are 0 hits for the post and it isn't a "
550
- "single page. e.g. if you display post views on the homepage or archives then "
551
- "this text will be used. To override this, just enter the same text as above "
552
- "option."
553
- msgstr ""
554
-
555
- #: admin/main-view.php:225
556
- msgid "Always display latest post count"
557
- msgstr ""
558
-
559
- #: admin/main-view.php:228
560
- msgid ""
561
- "This option uses JavaScript and will increase your page load time. Turn this "
562
- "off if you are not using caching plugins or are OK with displaying older "
563
- "cached counts."
564
- msgstr ""
565
-
566
- #: admin/main-view.php:232
567
- msgid "Track visits of authors on their own posts?"
568
- msgstr ""
569
-
570
- #: admin/main-view.php:235
571
- msgid ""
572
- "Disabling this option will stop authors visits tracked on their own posts"
573
- msgstr ""
574
-
575
- #: admin/main-view.php:239
576
- msgid "Track visits of admins?"
577
- msgstr ""
578
-
579
- #: admin/main-view.php:242
580
- msgid "Disabling this option will stop admin visits being tracked."
581
- msgstr ""
582
-
583
- #: admin/main-view.php:246
584
- msgid "Track visits of Editors?"
585
- msgstr ""
586
-
587
- #: admin/main-view.php:249
588
- msgid "Disabling this option will stop editor visits being tracked."
589
- msgstr ""
590
-
591
- #: admin/main-view.php:253
592
- msgid "Display page views on Posts and Pages in Admin"
593
- msgstr ""
594
-
595
- #: admin/main-view.php:256
596
- msgid ""
597
- "Adds three columns called Total Views, Today's Views and Views to All Posts "
598
- "and All Pages"
599
- msgstr ""
600
-
601
- #: admin/main-view.php:260
602
- msgid "Show number of views to non-admins"
603
- msgstr ""
604
-
605
- #: admin/main-view.php:263
606
- msgid ""
607
- "If you disable this then non-admins won't see the above columns or view the "
608
- "independent pages with the top posts"
609
- msgstr ""
610
-
611
- #: admin/main-view.php:303
612
- msgid "Number of popular posts to display:"
613
- msgstr ""
614
-
615
- #: admin/main-view.php:306
616
- msgid ""
617
- "Maximum number of posts that will be displayed in the list. This option is "
618
- "used if you don't specify the number of posts in the widget or shortcodes"
619
- msgstr ""
620
-
621
- #: admin/main-view.php:310
622
- msgid "Published age of posts:"
623
- msgstr ""
624
-
625
- #: admin/main-view.php:312 includes/modules/class-top-10-widget.php:91
626
- msgid "days"
627
- msgstr ""
628
-
629
- #: admin/main-view.php:313
630
- msgid ""
631
- "This options allows you to only show posts that have been published within "
632
- "the above day range. Applies to both overall posts and daily posts lists."
633
- msgstr ""
634
-
635
- #: admin/main-view.php:314
636
- msgid ""
637
- "e.g. 365 days will only show posts published in the last year in the popular "
638
- "posts lists. Enter 0 for no restriction."
639
- msgstr ""
640
-
641
- #: admin/main-view.php:318
642
- msgid "Post types to include in results (including custom post types)"
643
- msgstr ""
644
-
645
- #: admin/main-view.php:332
646
- msgid "List of post or page IDs to exclude from the results:"
647
- msgstr ""
648
-
649
- #: admin/main-view.php:334 admin/main-view.php:445
650
- msgid "Enter comma separated list of IDs. e.g. 188,320,500"
651
- msgstr ""
652
-
653
- #: admin/main-view.php:338
654
- msgid "Exclude Categories:"
655
- msgstr ""
656
-
657
- #: admin/main-view.php:353
658
- msgid ""
659
- "Comma separated list of category slugs. The field above has an autocomplete "
660
- "so simply start typing in the starting letters and it will prompt you with "
661
- "options"
662
- msgstr ""
663
-
664
- #: admin/main-view.php:357
665
- msgid "Excluded category IDs are:"
666
- msgstr ""
667
-
668
- #: admin/main-view.php:363
669
- msgid ""
670
- "These might differ from the IDs visible in the Categories page which use the "
671
- "<code>term_id</code>. Top 10 uses the <code>term_taxonomy_id</code> which is "
672
- "unique to this taxonomy."
673
- msgstr ""
674
-
675
- #: admin/main-view.php:369
676
- msgid "Title of popular posts:"
677
- msgstr ""
678
-
679
- #: admin/main-view.php:375
680
- msgid "Title of daily popular posts:"
681
- msgstr ""
682
-
683
- #: admin/main-view.php:381
684
- msgid "When there are no posts, what should be shown?"
685
- msgstr ""
686
-
687
- #: admin/main-view.php:385
688
- msgid "Blank Output"
689
- msgstr ""
690
-
691
- #: admin/main-view.php:389
692
- msgid "Display:"
693
- msgstr ""
694
-
695
- #: admin/main-view.php:394
696
- msgid "Show post excerpt in list?"
697
- msgstr ""
698
-
699
- #: admin/main-view.php:400
700
- msgid "Length of excerpt (in words):"
701
- msgstr ""
702
-
703
- #: admin/main-view.php:406
704
- msgid "Show post author in list?"
705
- msgstr ""
706
-
707
- #: admin/main-view.php:412
708
- msgid "Show post date in list?"
709
- msgstr ""
710
-
711
- #: admin/main-view.php:418
712
- msgid "Limit post title length (in characters)"
713
- msgstr ""
714
-
715
- #: admin/main-view.php:424
716
- msgid "Show view count in list?"
717
- msgstr ""
718
-
719
- #: admin/main-view.php:430
720
- msgid "Open links in new window"
721
- msgstr ""
722
-
723
- #: admin/main-view.php:436
724
- msgid "Add nofollow attribute to links in the list"
725
- msgstr ""
726
-
727
- #: admin/main-view.php:442
728
- msgid "Exclude display of related posts on these posts / pages"
729
- msgstr ""
730
-
731
- #: admin/main-view.php:449
732
- msgid "Customise the list HTML"
733
- msgstr ""
734
-
735
- #: admin/main-view.php:452
736
- msgid "HTML to display before the list of posts:"
737
- msgstr ""
738
-
739
- #: admin/main-view.php:458
740
- msgid "HTML to display before each list item:"
741
- msgstr ""
742
-
743
- #: admin/main-view.php:464
744
- msgid "HTML to display after each list item:"
745
- msgstr ""
746
-
747
- #: admin/main-view.php:470
748
- msgid "HTML to display after the list of posts:"
749
- msgstr ""
750
-
751
- #: admin/main-view.php:511
752
- msgid "Location of post thumbnail:"
753
- msgstr ""
754
-
755
- #: admin/main-view.php:515
756
- msgid "Display thumbnails inline with posts, before title"
757
- msgstr ""
758
-
759
- #: admin/main-view.php:520
760
- msgid "Display thumbnails inline with posts, after title"
761
- msgstr ""
762
-
763
- #: admin/main-view.php:525
764
- msgid "Display only thumbnails, no text"
765
- msgstr ""
766
-
767
- #: admin/main-view.php:530
768
- msgid "Do not display thumbnails, only text."
769
- msgstr ""
770
-
771
- #: admin/main-view.php:534
772
- msgid ""
773
- "This setting cannot be changed because an inbuilt style has been selected "
774
- "under the Styles section. If you would like to change this option, please "
775
- "select No styles under the Styles section."
776
- msgstr ""
777
-
778
- #: admin/main-view.php:538
779
- msgid "Thumbnail size:"
780
- msgstr ""
781
-
782
- #: admin/main-view.php:562
783
- msgid "Custom size"
784
- msgstr ""
785
-
786
- #: admin/main-view.php:565
787
- msgid ""
788
- "You can choose from existing image sizes above or create a custom size. If "
789
- "you have chosen Custom size above, then enter the width, height and crop "
790
- "settings below. For best results, use a cropped image."
791
- msgstr ""
792
-
793
- #: admin/main-view.php:566
794
- msgid ""
795
- "If you change the width and/or height below, existing images will not be "
796
- "automatically resized."
797
- msgstr ""
798
-
799
- #: admin/main-view.php:567
800
- #, php-format
801
- msgid ""
802
- "I recommend using <a href='%s' class='thickbox'>OTF Regenerate Thumbnails</"
803
- "a> or <a href='%s' class='thickbox'>Regenerate Thumbnails</a> to regenerate "
804
- "all image sizes."
805
- msgstr ""
806
-
807
- #: admin/main-view.php:570
808
- msgid ""
809
- "If you're using the Left Thumbs style below then the thumbnail width and "
810
- "height that you set here will supersede the widget. Alternatively, choose "
811
- "<strong>Style attributes</strong> under <strong>Image size attributes</"
812
- "strong> option below"
813
- msgstr ""
814
-
815
- #: admin/main-view.php:573
816
- msgid "Width of custom thumbnail:"
817
- msgstr ""
818
-
819
- #: admin/main-view.php:578
820
- msgid "Height of custom thumbnail"
821
- msgstr ""
822
-
823
- #: admin/main-view.php:583
824
- msgid "Crop mode:"
825
- msgstr ""
826
-
827
- #: admin/main-view.php:587
828
- msgid ""
829
- "By default, thumbnails will be proportionately cropped. Check this box to "
830
- "hard crop the thumbnails."
831
- msgstr ""
832
-
833
- #: admin/main-view.php:588
834
- #, php-format
835
- msgid "<a href='%s' target='_blank'>Difference between soft and hard crop</a>"
836
- msgstr ""
837
-
838
- #: admin/main-view.php:592
839
- msgid "Image size attributes:"
840
- msgstr ""
841
-
842
- #: admin/main-view.php:596
843
- msgid "Style attributes are used for width and height."
844
- msgstr ""
845
-
846
- #: admin/main-view.php:602
847
- msgid "HTML width and height attributes are used for width and height."
848
- msgstr ""
849
-
850
- #: admin/main-view.php:608
851
- msgid "No HTML or Style attributes set for width and height"
852
- msgstr ""
853
-
854
- #: admin/main-view.php:613
855
- msgid "Post thumbnail meta field name:"
856
- msgstr ""
857
-
858
- #: admin/main-view.php:616
859
- msgid ""
860
- "The value of this field should contain the image source and is set in the "
861
- "<em>Add New Post</em> screen"
862
- msgstr ""
863
-
864
- #: admin/main-view.php:619
865
- msgid ""
866
- "If the postmeta is not set, then should the plugin extract the first image "
867
- "from the post?"
868
- msgstr ""
869
-
870
- #: admin/main-view.php:622
871
- msgid ""
872
- "This could slow down the loading of your page if the first image in the "
873
- "related posts is large in file-size"
874
- msgstr ""
875
-
876
- #: admin/main-view.php:625
877
- msgid "Use default thumbnail?"
878
- msgstr ""
879
-
880
- #: admin/main-view.php:628
881
- msgid ""
882
- "If checked, when no thumbnail is found, show a default one from the URL "
883
- "below. If not checked and no thumbnail is found, no image will be shown."
884
- msgstr ""
885
-
886
- #: admin/main-view.php:631
887
- msgid "Default thumbnail:"
888
- msgstr ""
889
-
890
- #: admin/main-view.php:635
891
- msgid ""
892
- "The plugin will first check if the post contains a thumbnail. If it doesn't "
893
- "then it will check the meta field. If this is not available, then it will "
894
- "show the default image as specified above"
895
- msgstr ""
896
-
897
- #: admin/main-view.php:674
898
- msgid "Style of the related posts:"
899
- msgstr ""
900
-
901
- #: admin/main-view.php:677
902
- msgid "No styles"
903
- msgstr ""
904
-
905
- #: admin/main-view.php:679
906
- msgid "Select this option if you plan to add your own styles"
907
- msgstr ""
908
-
909
- #: admin/main-view.php:684
910
- msgid "Left Thumbnails"
911
- msgstr ""
912
-
913
- #: admin/main-view.php:687
914
- msgid ""
915
- "Enabling this option will set the post thumbnail to be before text. "
916
- "Disabling this option will not revert any settings."
917
- msgstr ""
918
-
919
- #: admin/main-view.php:688
920
- #, php-format
921
- msgid ""
922
- "You can view the default style at <a href=\"%1$s\" target=\"_blank\">%1$s</a>"
923
- msgstr ""
924
-
925
- #: admin/main-view.php:692
926
- msgid "Text only"
927
- msgstr ""
928
-
929
- #: admin/main-view.php:694
930
- msgid ""
931
- "Enabling this option will disable thumbnails and no longer include the "
932
- "default style sheet included in the plugin."
933
- msgstr ""
934
-
935
- #: admin/main-view.php:710
936
- msgid "Custom CSS to add to header:"
937
- msgstr ""
938
-
939
- #: admin/main-view.php:715
940
- msgid ""
941
- "Do not include <code>style</code> tags. Check out the <a href=\"http://"
942
- "wordpress.org/extend/plugins/top-10/faq/\" target=\"_blank\">FAQ</a> for "
943
- "available CSS classes to style."
944
- msgstr ""
945
-
946
- #: admin/main-view.php:735
947
- msgid "Default Options"
948
- msgstr ""
949
-
950
- #: admin/main-view.php:735
951
- msgid "Do you want to set options to Default?"
952
- msgstr ""
953
-
954
- #: admin/main-view.php:759
955
- msgid ""
956
- "Over time the Daily Top 10 database grows in size, which reduces the "
957
- "performance of the plugin. Cleaning the database at regular intervals could "
958
- "improve performance, especially on high traffic blogs. Enabling maintenance "
959
- "will automatically delete entries older than 90 days."
960
- msgstr ""
961
-
962
- #: admin/main-view.php:760
963
- msgid ""
964
- "Note: When scheduled maintenance is enabled, WordPress will run the cron job "
965
- "everytime the job is rescheduled (i.e. you change the settings below)."
966
- msgstr ""
967
-
968
- #: admin/main-view.php:763
969
- msgid "Enable scheduled maintenance of daily tables:"
970
- msgstr ""
971
-
972
- #: admin/main-view.php:767
973
- msgid "Time to run maintenance"
974
- msgstr ""
975
-
976
- #: admin/main-view.php:768
977
- msgid "hrs"
978
- msgstr ""
979
-
980
- #: admin/main-view.php:768
981
- msgid "min"
982
- msgstr ""
983
-
984
- #: admin/main-view.php:770
985
- msgid "How often should the maintenance be run:"
986
- msgstr ""
987
-
988
- #: admin/main-view.php:778
989
- msgid "Weekly"
990
- msgstr ""
991
-
992
- #: admin/main-view.php:782
993
- msgid "Fortnightly"
994
- msgstr ""
995
-
996
- #: admin/main-view.php:786
997
- msgid "Monthly"
998
- msgstr ""
999
-
1000
- #: admin/main-view.php:795
1001
- msgid "The cron job has been scheduled. Maintenance will run"
1002
- msgstr ""
1003
-
1004
- #: admin/main-view.php:800
1005
- msgid "The cron job is missing. Please resave this page to add the job"
1006
- msgstr ""
1007
-
1008
- #: admin/main-view.php:805
1009
- msgid "Maintenance is turned off"
1010
- msgstr ""
1011
-
1012
- #: admin/main-view.php:811
1013
- msgid "Save Maintenance Options"
1014
- msgstr ""
1015
-
1016
- #: admin/main-view.php:819
1017
- msgid "Reset count and other tools"
1018
- msgstr ""
1019
-
1020
- #: admin/main-view.php:822
1021
- msgid ""
1022
- "This cannot be reversed. Make sure that your database has been backed up "
1023
- "before proceeding"
1024
- msgstr ""
1025
-
1026
- #: admin/main-view.php:825
1027
- msgid "Reset Popular Posts"
1028
- msgstr ""
1029
-
1030
- #: admin/main-view.php:825
1031
- msgid "Are you sure you want to reset the popular posts?"
1032
- msgstr ""
1033
-
1034
- #: admin/main-view.php:826
1035
- msgid "Reset Daily Popular Posts"
1036
- msgstr ""
1037
-
1038
- #: admin/main-view.php:826
1039
- msgid "Are you sure you want to reset the daily popular posts?"
1040
- msgstr ""
1041
-
1042
- #: admin/main-view.php:829
1043
- msgid "This will merge post counts for posts with table entries of 0 and 1"
1044
- msgstr ""
1045
-
1046
- #: admin/main-view.php:832
1047
- msgid "Merge blog ID 0 and 1 post counts"
1048
- msgstr ""
1049
-
1050
- #: admin/main-view.php:832
1051
- msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1052
- msgstr ""
1053
-
1054
- #: admin/main-view.php:835
1055
- msgid ""
1056
- "In older versions, the plugin created entries with duplicate post IDs. "
1057
- "Clicking the button below will merge these duplicate IDs"
1058
- msgstr ""
1059
-
1060
- #: admin/main-view.php:838
1061
- msgid "Merge duplicates across blog IDs"
1062
- msgstr ""
1063
-
1064
- #: admin/main-view.php:838
1065
- msgid "This will delete the duplicate entries in the tables. Proceed?"
1066
- msgstr ""
1067
-
1068
- #: admin/main-view.php:854
1069
- msgid "WordPress Multisite: Migrate Top 10 v1.x counts to 2.x"
1070
- msgstr ""
1071
-
1072
- #: admin/main-view.php:857
1073
- msgid ""
1074
- "If you've been using Top 10 v1.x on multisite, you would have needed to "
1075
- "activate the plugin independently for each site. This would have resulted in "
1076
- "two tables being created for each site in the network."
1077
- msgstr ""
1078
-
1079
- #: admin/main-view.php:858
1080
- msgid ""
1081
- "Top 10 v2.x onwards uses only a single table to record the count, keeping "
1082
- "your database clean. You can use this tool to import the recorded counts "
1083
- "from v1.x tables to the new v2.x table format."
1084
- msgstr ""
1085
-
1086
- #: admin/main-view.php:861
1087
- msgid ""
1088
- "If you do not see any tables below, then it means that either all data has "
1089
- "already been imported or no relevant information has been found."
1090
- msgstr ""
1091
-
1092
- #: admin/main-view.php:864
1093
- msgid ""
1094
- "After running the importer, please verify that all the counts have been "
1095
- "successfully imported. Only then should you delete any old tables!"
1096
- msgstr ""
1097
-
1098
- #: admin/main-view.php:898
1099
- msgid "Blog ID"
1100
- msgstr ""
1101
-
1102
- #: admin/main-view.php:901
1103
- msgid "Status"
1104
- msgstr ""
1105
-
1106
- #: admin/main-view.php:904
1107
- msgid "Select to import"
1108
- msgstr ""
1109
-
1110
- #: admin/main-view.php:914
1111
- msgid "Blog #"
1112
- msgstr ""
1113
-
1114
- #: admin/main-view.php:924
1115
- msgid "Not imported"
1116
- msgstr ""
1117
-
1118
- #: admin/main-view.php:928
1119
- msgid "Imported"
1120
- msgstr ""
1121
-
1122
- #: admin/main-view.php:949
1123
- msgid "Begin import"
1124
- msgstr ""
1125
-
1126
- #: admin/main-view.php:950
1127
- msgid "Delete selected tables"
1128
- msgstr ""
1129
-
1130
- #: admin/main-view.php:951
1131
- msgid "Delete all imported tables"
1132
- msgstr ""
1133
-
1134
- #: includes/cron.php:75
1135
  msgid "Once Weekly"
1136
  msgstr ""
1137
 
1138
- #: includes/cron.php:79
1139
  msgid "Once Fortnightly"
1140
  msgstr ""
1141
 
1142
- #: includes/cron.php:83
1143
  msgid "Once Monthly"
1144
  msgstr ""
1145
 
1146
- #: includes/cron.php:87
1147
  msgid "Once quarterly"
1148
  msgstr ""
1149
 
1150
- #: includes/modules/class-top-10-widget.php:31
1151
  msgid "Popular Posts [Top 10]"
1152
  msgstr ""
1153
 
@@ -1155,75 +240,16 @@ msgstr ""
1155
  msgid "Display popular posts"
1156
  msgstr ""
1157
 
1158
- #: includes/modules/class-top-10-widget.php:79
1159
- msgid "No. of posts"
1160
- msgstr ""
1161
-
1162
- #: includes/modules/class-top-10-widget.php:85
1163
- msgid "Custom time period (Enter below)"
1164
- msgstr ""
1165
-
1166
- #: includes/modules/class-top-10-widget.php:89
1167
- msgid "In days and hours (applies only to custom option above)"
1168
- msgstr ""
1169
-
1170
- #: includes/modules/class-top-10-widget.php:94
1171
- msgid "hours"
1172
- msgstr ""
1173
-
1174
- #: includes/modules/class-top-10-widget.php:99
1175
- msgid "Show count?"
1176
- msgstr ""
1177
-
1178
- #: includes/modules/class-top-10-widget.php:104
1179
- msgid "Show excerpt?"
1180
- msgstr ""
1181
-
1182
- #: includes/modules/class-top-10-widget.php:109
1183
- msgid "Show author?"
1184
- msgstr ""
1185
-
1186
- #: includes/modules/class-top-10-widget.php:114
1187
- msgid "Show date?"
1188
- msgstr ""
1189
-
1190
- #: includes/modules/class-top-10-widget.php:120
1191
- msgid "Thumbnails inline, before title"
1192
- msgstr ""
1193
-
1194
- #: includes/modules/class-top-10-widget.php:121
1195
- msgid "Thumbnails inline, after title"
1196
- msgstr ""
1197
-
1198
- #: includes/modules/class-top-10-widget.php:122
1199
- msgid "Only thumbnails, no text"
1200
- msgstr ""
1201
-
1202
- #: includes/modules/class-top-10-widget.php:123
1203
- msgid "No thumbnails, only text."
1204
- msgstr ""
1205
-
1206
- #: includes/modules/class-top-10-widget.php:128
1207
- msgid "Thumbnail height"
1208
- msgstr ""
1209
-
1210
- #: includes/modules/class-top-10-widget.php:134
1211
- msgid "Thumbnail width"
1212
- msgstr ""
1213
-
1214
- #: includes/modules/class-top-10-widget.php:138
1215
- msgid "Post types to include:"
1216
- msgstr ""
1217
-
1218
- #: includes/public/display-posts.php:91
1219
  msgid ""
1220
  "posts_only argument has been deprecated. Use get_tptn_pop_posts() to get the "
1221
  "posts only."
1222
  msgstr ""
1223
 
1224
- #: includes/public/display-posts.php:228
1225
  #, php-format
1226
- msgid "Popular posts by <a href=\"%s\" rel=\"nofollow\" %s>Top 10 plugin</a>"
 
1227
  msgstr ""
1228
 
1229
  #: includes/public/media.php:60
@@ -1242,6 +268,23 @@ msgstr ""
1242
  msgid " by "
1243
  msgstr ""
1244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1245
  #: top-10.php:94
1246
  msgid "<h3>Popular Posts</h3>"
1247
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-09-22 16:25+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: Ajay DSouza <me@ajaydsouza.com>\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext\n"
14
  "X-Poedit-Basepath: ..\n"
15
+ "X-Generator: Poedit 1.8.9\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: .\n"
30
  msgid "Views"
31
  msgstr ""
32
 
33
+ #: admin/admin-dashboard.php:64
34
  msgid "View all daily popular posts"
35
  msgstr ""
36
 
37
+ #: admin/admin-dashboard.php:66
38
  msgid "View all popular posts"
39
  msgstr ""
40
 
41
+ #: admin/admin-dashboard.php:72
42
  #, php-format
43
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
44
  msgstr ""
45
 
46
+ #: admin/admin-dashboard.php:122 admin/class-stats.php:539
 
47
  msgid "Popular Posts"
48
  msgstr ""
49
 
50
+ #: admin/admin-dashboard.php:127 admin/admin.php:461
51
  msgid "Daily Popular Posts"
52
  msgstr ""
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  #: admin/admin-metabox.php:137
55
  #, php-format
56
  msgid ""
58
  "will need to make the same change in the %1$s meta box on this page."
59
  msgstr ""
60
 
61
+ #: admin/admin.php:199
62
  msgid "Options saved successfully. If enabled, the cache has been cleared."
63
  msgstr ""
64
 
65
+ #: admin/admin.php:202
66
  msgid ""
67
  "Left Thumbnails style selected. Post thumbnail location set to Inline before "
68
  "text."
69
  msgstr ""
70
 
71
+ #: admin/admin.php:205
72
  msgid "Text Only style selected. Thumbnails will not be displayed."
73
  msgstr ""
74
 
75
+ #: admin/admin.php:208
76
  #, php-format
77
+ msgid "Pre-built thumbnail size selected. Thumbnail set to %1$d x %1$d."
78
  msgstr ""
79
 
80
+ #: admin/admin.php:223
81
  msgid "Options set to Default."
82
  msgstr ""
83
 
84
+ #: admin/admin.php:230
85
  msgid "Top 10 popular posts reset"
86
  msgstr ""
87
 
88
+ #: admin/admin.php:237
89
  msgid "Top 10 daily popular posts reset"
90
  msgstr ""
91
 
92
+ #: admin/admin.php:245
93
  msgid "Duplicate rows cleaned from tables"
94
  msgstr ""
95
 
96
+ #: admin/admin.php:253
97
  msgid "Post counts across blog IDs 0 and 1 have been merged"
98
  msgstr ""
99
 
100
+ #: admin/admin.php:266
101
  msgid "Scheduled maintenance enabled / modified"
102
  msgstr ""
103
 
104
+ #: admin/admin.php:270
105
  msgid "Scheduled maintenance disabled"
106
  msgstr ""
107
 
108
+ #: admin/admin.php:308
109
  msgid "Counts from selected sites have been imported."
110
  msgstr ""
111
 
112
+ #: admin/admin.php:333
113
  msgid ""
114
  "Selected tables have been deleted. Note that only imported tables have been "
115
  "deleted."
116
  msgstr ""
117
 
118
+ #: admin/admin.php:449 admin/admin.php:452
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  msgid "Top 10 Settings"
120
  msgstr ""
121
 
122
+ #: admin/admin.php:449
123
  msgid "Top 10"
124
  msgstr ""
125
 
126
+ #: admin/admin.php:457
127
  msgid "View Popular Posts"
128
  msgstr ""
129
 
130
+ #: admin/admin.php:564
131
  msgid "Settings"
132
  msgstr ""
133
 
134
+ #: admin/admin.php:586
135
+ msgid "Support"
136
+ msgstr ""
137
+
138
+ #: admin/admin.php:587
139
  msgid "Donate"
140
  msgstr ""
141
 
142
+ #: admin/admin.php:588
143
+ msgid "Contribute"
144
+ msgstr ""
145
+
146
  #: admin/cache.php:19
147
  msgid "Top 10 cache has been cleared"
148
  msgstr ""
149
 
150
+ #: admin/class-stats.php:35
151
  msgid "popular_post"
152
  msgstr ""
153
 
154
+ #: admin/class-stats.php:36
155
  msgid "popular_posts"
156
  msgstr ""
157
 
158
+ #: admin/class-stats.php:243
 
 
 
 
159
  msgid "View"
160
  msgstr ""
161
 
162
+ #: admin/class-stats.php:244
163
  msgid "Edit"
164
  msgstr ""
165
 
166
+ #: admin/class-stats.php:245
167
  msgid "Delete"
168
  msgstr ""
169
 
170
+ #: admin/class-stats.php:267
171
  msgid "Y/m/d g:i:s a"
172
  msgstr ""
173
 
174
+ #: admin/class-stats.php:274
175
  #, php-format
176
  msgid "%s ago"
177
  msgstr ""
178
 
179
+ #: admin/class-stats.php:276
180
  msgid "Y/m/d"
181
  msgstr ""
182
 
183
+ #: admin/class-stats.php:309
184
  msgid "Title"
185
  msgstr ""
186
 
187
+ #: admin/class-stats.php:310
188
  msgid "Total visits"
189
  msgstr ""
190
 
191
+ #: admin/class-stats.php:311
192
  msgid "Daily visits"
193
  msgstr ""
194
 
195
+ #: admin/class-stats.php:312
196
  msgid "Post type"
197
  msgstr ""
198
 
199
+ #: admin/class-stats.php:313
200
  msgid "Author"
201
  msgstr ""
202
 
203
+ #: admin/class-stats.php:314
204
  msgid "Date"
205
  msgstr ""
206
 
207
+ #: admin/class-stats.php:348
208
  msgid "Delete Count"
209
  msgstr ""
210
 
211
+ #: admin/class-stats.php:441
 
 
 
 
212
  msgid "Filter"
213
  msgstr ""
214
 
215
+ #: admin/class-stats.php:514
216
  msgid "Search Table"
217
  msgstr ""
218
 
219
+ #: includes/cron.php:74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  msgid "Once Weekly"
221
  msgstr ""
222
 
223
+ #: includes/cron.php:78
224
  msgid "Once Fortnightly"
225
  msgstr ""
226
 
227
+ #: includes/cron.php:82
228
  msgid "Once Monthly"
229
  msgstr ""
230
 
231
+ #: includes/cron.php:86
232
  msgid "Once quarterly"
233
  msgstr ""
234
 
235
+ #: includes/modules/class-top-10-widget.php:30
236
  msgid "Popular Posts [Top 10]"
237
  msgstr ""
238
 
240
  msgid "Display popular posts"
241
  msgstr ""
242
 
243
+ #: includes/public/display-posts.php:92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  msgid ""
245
  "posts_only argument has been deprecated. Use get_tptn_pop_posts() to get the "
246
  "posts only."
247
  msgstr ""
248
 
249
+ #: includes/public/display-posts.php:229
250
  #, php-format
251
+ msgid ""
252
+ "Popular posts by <a href=\"%1$s\" rel=\"nofollow\" %2$s>Top 10 plugin</a>"
253
  msgstr ""
254
 
255
  #: includes/public/media.php:60
268
  msgid " by "
269
  msgstr ""
270
 
271
+ #: includes/tracker.php:248
272
+ msgid "Query variable based"
273
+ msgstr ""
274
+
275
+ #: includes/tracker.php:249
276
+ msgid "Uses query variables to record visits"
277
+ msgstr ""
278
+
279
+ #: includes/tracker.php:253
280
+ msgid "Ajaxurl based"
281
+ msgstr ""
282
+
283
+ #: includes/tracker.php:254
284
+ msgid ""
285
+ "Uses admin-ajax.php which is inbuilt within WordPress to process the tracker"
286
+ msgstr ""
287
+
288
  #: top-10.php:94
289
  msgid "<h3>Popular Posts</h3>"
290
  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: 2016-03-25 09:32+0000\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
  "Language-Team: Ajay DSouza <me@ajaydsouza.com>\n"
@@ -13,7 +13,7 @@ msgstr ""
13
  "Content-Transfer-Encoding: 8bit\n"
14
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext\n"
15
  "X-Poedit-Basepath: ..\n"
16
- "X-Generator: Poedit 1.8.4\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
  "X-Poedit-SearchPathExcluded-0: ../admin/wick\n"
@@ -30,73 +30,27 @@ msgstr ""
30
  msgid "Views"
31
  msgstr ""
32
 
33
- #: admin/admin-dashboard.php:63
34
  msgid "View all daily popular posts"
35
  msgstr ""
36
 
37
- #: admin/admin-dashboard.php:65
38
  msgid "View all popular posts"
39
  msgstr ""
40
 
41
- #: admin/admin-dashboard.php:71
42
  #, php-format
43
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
44
  msgstr ""
45
 
46
- #: admin/admin-dashboard.php:110 admin/class-stats.php:516
47
- #: admin/deprecated.php:41
48
  msgid "Popular Posts"
49
  msgstr ""
50
 
51
- #: admin/admin-dashboard.php:115 admin/admin.php:426 admin/deprecated.php:43
52
  msgid "Daily Popular Posts"
53
  msgstr ""
54
 
55
- #: admin/admin-metabox.php:104
56
- msgid "Visit count:"
57
- msgstr ""
58
-
59
- #: admin/admin-metabox.php:106
60
- msgid ""
61
- "Enter a number above to update the visit count. Leaving the above box blank "
62
- "will set the count to zero"
63
- msgstr ""
64
-
65
- #: admin/admin-metabox.php:115
66
- msgid "Disable Popular Posts display:"
67
- msgstr ""
68
-
69
- #: admin/admin-metabox.php:118
70
- msgid ""
71
- "If this is checked, then Top 10 will not display the popular posts widgets "
72
- "when viewing this post."
73
- msgstr ""
74
-
75
- #: admin/admin-metabox.php:122
76
- msgid "Exclude this post from the popular posts list:"
77
- msgstr ""
78
-
79
- #: admin/admin-metabox.php:125
80
- msgid ""
81
- "If this is checked, then this post will be excluded from the popular posts "
82
- "list."
83
- msgstr ""
84
-
85
- #: admin/admin-metabox.php:129
86
- msgid "Location of thumbnail:"
87
- msgstr ""
88
-
89
- #: admin/admin-metabox.php:131
90
- msgid ""
91
- "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
92
- "image will be used for the post. It will be resized to the thumbnail size "
93
- "set under Top 10 Settings &raquo; Thumbnail options."
94
- msgstr ""
95
-
96
- #: admin/admin-metabox.php:132
97
- msgid "The URL above is saved in the meta field:"
98
- msgstr ""
99
-
100
  #: admin/admin-metabox.php:137
101
  #, php-format
102
  msgid ""
@@ -104,1050 +58,181 @@ msgid ""
104
  "will need to make the same change in the %1$s meta box on this page."
105
  msgstr ""
106
 
107
- #: admin/admin.php:191
108
  msgid "Options saved successfully. If enabled, the cache has been cleared."
109
  msgstr ""
110
 
111
- #: admin/admin.php:194
112
  msgid ""
113
  "Left Thumbnails style selected. Post thumbnail location set to Inline before "
114
  "text."
115
  msgstr ""
116
 
117
- #: admin/admin.php:197
118
  msgid "Text Only style selected. Thumbnails will not be displayed."
119
  msgstr ""
120
 
121
- #: admin/admin.php:200
122
  #, php-format
123
- msgid "Pre-built thumbnail size selected. Thumbnail set to %d x %d."
124
  msgstr ""
125
 
126
- #: admin/admin.php:215
127
  msgid "Options set to Default."
128
  msgstr ""
129
 
130
- #: admin/admin.php:222
131
  msgid "Top 10 popular posts reset"
132
  msgstr ""
133
 
134
- #: admin/admin.php:229
135
  msgid "Top 10 daily popular posts reset"
136
  msgstr ""
137
 
138
- #: admin/admin.php:237
139
  msgid "Duplicate rows cleaned from tables"
140
  msgstr ""
141
 
142
- #: admin/admin.php:245
143
  msgid "Post counts across blog IDs 0 and 1 have been merged"
144
  msgstr ""
145
 
146
- #: admin/admin.php:258
147
  msgid "Scheduled maintenance enabled / modified"
148
  msgstr ""
149
 
150
- #: admin/admin.php:262
151
  msgid "Scheduled maintenance disabled"
152
  msgstr ""
153
 
154
- #: admin/admin.php:300
155
  msgid "Counts from selected sites have been imported."
156
  msgstr ""
157
 
158
- #: admin/admin.php:325
159
  msgid ""
160
  "Selected tables have been deleted. Note that only imported tables have been "
161
  "deleted."
162
  msgstr ""
163
 
164
- #: admin/admin.php:342 admin/admin.php:362 admin/admin.php:386
165
- #: admin/main-view.php:55 admin/main-view.php:181 admin/main-view.php:286
166
- #: admin/main-view.php:495 admin/main-view.php:658 admin/main-view.php:754
167
- #: admin/main-view.php:818 admin/main-view.php:853
168
- msgid "Click to toggle"
169
- msgstr ""
170
-
171
- #: admin/admin.php:343
172
- msgid "Support the development"
173
- msgstr ""
174
-
175
- #: admin/admin.php:350
176
- msgid "Donation for Top 10"
177
- msgstr ""
178
-
179
- #: admin/admin.php:352
180
- msgid "Enter amount in USD:"
181
- msgstr ""
182
-
183
- #: admin/admin.php:356
184
- msgid "Send your donation to the author of Top 10"
185
- msgstr ""
186
-
187
- #: admin/admin.php:363
188
- msgid "Follow me"
189
- msgstr ""
190
-
191
- #: admin/admin.php:387
192
- msgid "Quick links"
193
- msgstr ""
194
-
195
- #: admin/admin.php:391
196
- msgid "Top 10 plugin page"
197
- msgstr ""
198
-
199
- #: admin/admin.php:392
200
- msgid "Top 10 Github page"
201
- msgstr ""
202
-
203
- #: admin/admin.php:393
204
- msgid "Other plugins"
205
- msgstr ""
206
-
207
- #: admin/admin.php:394
208
- msgid "FAQ"
209
- msgstr ""
210
-
211
- #: admin/admin.php:395 admin/admin.php:567
212
- msgid "Support"
213
- msgstr ""
214
-
215
- #: admin/admin.php:396
216
- msgid "Reviews"
217
- msgstr ""
218
-
219
- #: admin/admin.php:397
220
- msgid "Ajay's blog"
221
- msgstr ""
222
-
223
- #: admin/admin.php:414 admin/admin.php:417 admin/main-view.php:22
224
  msgid "Top 10 Settings"
225
  msgstr ""
226
 
227
- #: admin/admin.php:414
228
  msgid "Top 10"
229
  msgstr ""
230
 
231
- #: admin/admin.php:422
232
  msgid "View Popular Posts"
233
  msgstr ""
234
 
235
- #: admin/admin.php:544
236
  msgid "Settings"
237
  msgstr ""
238
 
239
- #: admin/admin.php:568
 
 
 
 
240
  msgid "Donate"
241
  msgstr ""
242
 
 
 
 
 
243
  #: admin/cache.php:19
244
  msgid "Top 10 cache has been cleared"
245
  msgstr ""
246
 
247
- #: admin/class-stats.php:36
248
  msgid "popular_post"
249
  msgstr ""
250
 
251
- #: admin/class-stats.php:37
252
  msgid "popular_posts"
253
  msgstr ""
254
 
255
- #: admin/class-stats.php:185
256
- msgid "No popular posts available."
257
- msgstr ""
258
-
259
- #: admin/class-stats.php:234
260
  msgid "View"
261
  msgstr ""
262
 
263
- #: admin/class-stats.php:235
264
  msgid "Edit"
265
  msgstr ""
266
 
267
- #: admin/class-stats.php:236
268
  msgid "Delete"
269
  msgstr ""
270
 
271
- #: admin/class-stats.php:258
272
  msgid "Y/m/d g:i:s a"
273
  msgstr ""
274
 
275
- #: admin/class-stats.php:265
276
  #, php-format
277
  msgid "%s ago"
278
  msgstr ""
279
 
280
- #: admin/class-stats.php:267
281
  msgid "Y/m/d"
282
  msgstr ""
283
 
284
- #: admin/class-stats.php:300 includes/modules/class-top-10-widget.php:74
285
  msgid "Title"
286
  msgstr ""
287
 
288
- #: admin/class-stats.php:301
289
  msgid "Total visits"
290
  msgstr ""
291
 
292
- #: admin/class-stats.php:302
293
  msgid "Daily visits"
294
  msgstr ""
295
 
296
- #: admin/class-stats.php:303
297
  msgid "Post type"
298
  msgstr ""
299
 
300
- #: admin/class-stats.php:304
301
  msgid "Author"
302
  msgstr ""
303
 
304
- #: admin/class-stats.php:305
305
  msgid "Date"
306
  msgstr ""
307
 
308
- #: admin/class-stats.php:339
309
  msgid "Delete Count"
310
  msgstr ""
311
 
312
- #: admin/class-stats.php:379
313
- msgid "Are you sure you want to do this"
314
- msgstr ""
315
-
316
- #: admin/class-stats.php:430
317
  msgid "Filter"
318
  msgstr ""
319
 
320
- #: admin/class-stats.php:491
321
  msgid "Search Table"
322
  msgstr ""
323
 
324
- #: admin/main-view.php:34 admin/main-view.php:56
325
- msgid "General options"
326
- msgstr ""
327
-
328
- #: admin/main-view.php:35 admin/main-view.php:182
329
- msgid "Counter and tracker options"
330
- msgstr ""
331
-
332
- #: admin/main-view.php:36 admin/main-view.php:287
333
- msgid "Popular post list options"
334
- msgstr ""
335
-
336
- #: admin/main-view.php:37 admin/main-view.php:496
337
- #: includes/modules/class-top-10-widget.php:118
338
- msgid "Thumbnail options"
339
- msgstr ""
340
-
341
- #: admin/main-view.php:38 admin/main-view.php:659
342
- msgid "Styles"
343
- msgstr ""
344
-
345
- #: admin/main-view.php:39 admin/main-view.php:755
346
- msgid "Maintenance"
347
- msgstr ""
348
-
349
- #: admin/main-view.php:72
350
- msgid "Enable trackers:"
351
- msgstr ""
352
-
353
- #: admin/main-view.php:77 includes/modules/class-top-10-widget.php:84
354
- msgid "Overall"
355
- msgstr ""
356
-
357
- #: admin/main-view.php:83 admin/main-view.php:774
358
- msgid "Daily"
359
- msgstr ""
360
-
361
- #: admin/main-view.php:89
362
- msgid "Use Ajax for tracking:"
363
- msgstr ""
364
-
365
- #: admin/main-view.php:92
366
- msgid ""
367
- "This will try to prevent W3 Total Cache and other caching plugins from "
368
- "caching the tracker script of the plugin. Try toggling this option in case "
369
- "you find that your posts are not tracked."
370
- msgstr ""
371
-
372
- #: admin/main-view.php:96
373
- msgid "Use external JS file for tracking:"
374
- msgstr ""
375
-
376
- #: admin/main-view.php:99
377
- msgid ""
378
- "This uses the external javascript file for tracking. This is a more "
379
- "efficient and less resource intensive tracker. This settings might have some "
380
- "compatibility issues on some WordPress installs or might be blocked by some "
381
- "security plugins. If you find that your posts are not being tracked then "
382
- "disable this option."
383
- msgstr ""
384
-
385
- #: admin/main-view.php:103
386
- msgid "Enable cache:"
387
- msgstr ""
388
-
389
- #: admin/main-view.php:106
390
- msgid ""
391
- "If activated, Top 10 will use the Transients API to cache the popular posts "
392
- "output for 1 hour."
393
- msgstr ""
394
-
395
- #: admin/main-view.php:107
396
- msgid "Clear cache"
397
- msgstr ""
398
-
399
- #: admin/main-view.php:111
400
- msgid "Start daily counts from midnight:"
401
- msgstr ""
402
-
403
- #: admin/main-view.php:114
404
- msgid ""
405
- "Daily counter will display number of visits from midnight. This option is "
406
- "checked by default and mimics the way most normal counters work. Turning "
407
- "this off will allow you to use the hourly setting in the next option."
408
- msgstr ""
409
-
410
- #: admin/main-view.php:118
411
- msgid "Daily popular contains top posts over:"
412
- msgstr ""
413
-
414
- #: admin/main-view.php:120
415
- msgid "day(s)"
416
- msgstr ""
417
-
418
- #: admin/main-view.php:121
419
- msgid "hour(s)"
420
- msgstr ""
421
-
422
- #: admin/main-view.php:122
423
- msgid ""
424
- "Think of Daily Popular has a custom date range applied as a global setting. "
425
- "Instead of displaying popular posts from the past day, this setting lets you "
426
- "display posts for as many days or as few hours as you want. This can be "
427
- "overridden in the widget."
428
- msgstr ""
429
-
430
- #: admin/main-view.php:126
431
- msgid "Delete options on uninstall"
432
- msgstr ""
433
-
434
- #: admin/main-view.php:129
435
- msgid ""
436
- "If this is checked, all settings related to Top 10 are removed from the "
437
- "database if you choose to uninstall/delete the plugin."
438
- msgstr ""
439
-
440
- #: admin/main-view.php:133
441
- msgid "Delete counter data on uninstall"
442
- msgstr ""
443
-
444
- #: admin/main-view.php:136
445
- msgid ""
446
- "If this is checked, the tables containing the counter statistics are removed "
447
- "from the database if you choose to uninstall/delete the plugin."
448
- msgstr ""
449
-
450
- #: admin/main-view.php:137
451
- msgid ""
452
- "Keep this unchecked if you choose to reinstall the plugin and don't want to "
453
- "lose your counter data."
454
- msgstr ""
455
-
456
- #: admin/main-view.php:140
457
- msgid "Show metabox:"
458
- msgstr ""
459
-
460
- #: admin/main-view.php:143
461
- msgid ""
462
- "This will add the Top 10 metabox on Edit Posts or Add New Posts screens. "
463
- "Also applies to Pages and Custom Post Types."
464
- msgstr ""
465
-
466
- #: admin/main-view.php:147
467
- msgid "Limit metabox to Admins only:"
468
- msgstr ""
469
-
470
- #: admin/main-view.php:150
471
- msgid ""
472
- "If this is selected, the metabox will be hidden from anyone who is not an "
473
- "Admin. Otherwise, by default, Contributors and above will be able to see the "
474
- "metabox. This applies only if the above option is selected."
475
- msgstr ""
476
-
477
- #: admin/main-view.php:155
478
- msgid "Link to Top 10 plugin page"
479
- msgstr ""
480
-
481
- #: admin/main-view.php:158
482
- msgid ""
483
- "A link to the plugin is added as an extra list item to the list of popular "
484
- "posts"
485
- msgstr ""
486
-
487
- #: admin/main-view.php:163 admin/main-view.php:268 admin/main-view.php:477
488
- #: admin/main-view.php:640 admin/main-view.php:734
489
- msgid "Save Options"
490
- msgstr ""
491
-
492
- #: admin/main-view.php:198
493
- msgid "Display number of views on:"
494
- msgstr ""
495
-
496
- #: admin/main-view.php:200
497
- msgid "Posts"
498
- msgstr ""
499
-
500
- #: admin/main-view.php:201
501
- msgid "Pages"
502
- msgstr ""
503
-
504
- #: admin/main-view.php:202
505
- msgid "Home page"
506
- msgstr ""
507
-
508
- #: admin/main-view.php:203
509
- msgid "Feeds"
510
- msgstr ""
511
-
512
- #: admin/main-view.php:204
513
- msgid "Category archives"
514
- msgstr ""
515
-
516
- #: admin/main-view.php:205
517
- msgid "Tag archives"
518
- msgstr ""
519
-
520
- #: admin/main-view.php:206
521
- msgid "Other archives"
522
- msgstr ""
523
-
524
- #: admin/main-view.php:207
525
- msgid ""
526
- "If you choose to disable this, please add <code>&lt;?php if "
527
- "( function_exists ( 'echo_tptn_post_count' ) ) echo_tptn_post_count(); ?&gt;"
528
- "</code> to your template file where you want it displayed"
529
- msgstr ""
530
-
531
- #: admin/main-view.php:211
532
- msgid "Format to display the post views:"
533
- msgstr ""
534
-
535
- #: admin/main-view.php:214
536
- msgid ""
537
- "Use <code>%totalcount%</code> to display the total count, <code>%dailycount"
538
- "%</code> to display the daily count and <code>%overallcount%</code> to "
539
- "display the overall count across all posts on the blog. e.g. the default "
540
- "options displays <code>[Visited 123 times, 23 visits today]</code>"
541
- msgstr ""
542
-
543
- #: admin/main-view.php:218
544
- msgid "What do display when there are no visits?"
545
- msgstr ""
546
-
547
- #: admin/main-view.php:221
548
- msgid ""
549
- "This text applies only when there are 0 hits for the post and it isn't a "
550
- "single page. e.g. if you display post views on the homepage or archives then "
551
- "this text will be used. To override this, just enter the same text as above "
552
- "option."
553
- msgstr ""
554
-
555
- #: admin/main-view.php:225
556
- msgid "Always display latest post count"
557
- msgstr ""
558
-
559
- #: admin/main-view.php:228
560
- msgid ""
561
- "This option uses JavaScript and will increase your page load time. Turn this "
562
- "off if you are not using caching plugins or are OK with displaying older "
563
- "cached counts."
564
- msgstr ""
565
-
566
- #: admin/main-view.php:232
567
- msgid "Track visits of authors on their own posts?"
568
- msgstr ""
569
-
570
- #: admin/main-view.php:235
571
- msgid ""
572
- "Disabling this option will stop authors visits tracked on their own posts"
573
- msgstr ""
574
-
575
- #: admin/main-view.php:239
576
- msgid "Track visits of admins?"
577
- msgstr ""
578
-
579
- #: admin/main-view.php:242
580
- msgid "Disabling this option will stop admin visits being tracked."
581
- msgstr ""
582
-
583
- #: admin/main-view.php:246
584
- msgid "Track visits of Editors?"
585
- msgstr ""
586
-
587
- #: admin/main-view.php:249
588
- msgid "Disabling this option will stop editor visits being tracked."
589
- msgstr ""
590
-
591
- #: admin/main-view.php:253
592
- msgid "Display page views on Posts and Pages in Admin"
593
- msgstr ""
594
-
595
- #: admin/main-view.php:256
596
- msgid ""
597
- "Adds three columns called Total Views, Today's Views and Views to All Posts "
598
- "and All Pages"
599
- msgstr ""
600
-
601
- #: admin/main-view.php:260
602
- msgid "Show number of views to non-admins"
603
- msgstr ""
604
-
605
- #: admin/main-view.php:263
606
- msgid ""
607
- "If you disable this then non-admins won't see the above columns or view the "
608
- "independent pages with the top posts"
609
- msgstr ""
610
-
611
- #: admin/main-view.php:303
612
- msgid "Number of popular posts to display:"
613
- msgstr ""
614
-
615
- #: admin/main-view.php:306
616
- msgid ""
617
- "Maximum number of posts that will be displayed in the list. This option is "
618
- "used if you don't specify the number of posts in the widget or shortcodes"
619
- msgstr ""
620
-
621
- #: admin/main-view.php:310
622
- msgid "Published age of posts:"
623
- msgstr ""
624
-
625
- #: admin/main-view.php:312 includes/modules/class-top-10-widget.php:91
626
- msgid "days"
627
- msgstr ""
628
-
629
- #: admin/main-view.php:313
630
- msgid ""
631
- "This options allows you to only show posts that have been published within "
632
- "the above day range. Applies to both overall posts and daily posts lists."
633
- msgstr ""
634
-
635
- #: admin/main-view.php:314
636
- msgid ""
637
- "e.g. 365 days will only show posts published in the last year in the popular "
638
- "posts lists. Enter 0 for no restriction."
639
- msgstr ""
640
-
641
- #: admin/main-view.php:318
642
- msgid "Post types to include in results (including custom post types)"
643
- msgstr ""
644
-
645
- #: admin/main-view.php:332
646
- msgid "List of post or page IDs to exclude from the results:"
647
- msgstr ""
648
-
649
- #: admin/main-view.php:334 admin/main-view.php:445
650
- msgid "Enter comma separated list of IDs. e.g. 188,320,500"
651
- msgstr ""
652
-
653
- #: admin/main-view.php:338
654
- msgid "Exclude Categories:"
655
- msgstr ""
656
-
657
- #: admin/main-view.php:353
658
- msgid ""
659
- "Comma separated list of category slugs. The field above has an autocomplete "
660
- "so simply start typing in the starting letters and it will prompt you with "
661
- "options"
662
- msgstr ""
663
-
664
- #: admin/main-view.php:357
665
- msgid "Excluded category IDs are:"
666
- msgstr ""
667
-
668
- #: admin/main-view.php:363
669
- msgid ""
670
- "These might differ from the IDs visible in the Categories page which use the "
671
- "<code>term_id</code>. Top 10 uses the <code>term_taxonomy_id</code> which is "
672
- "unique to this taxonomy."
673
- msgstr ""
674
-
675
- #: admin/main-view.php:369
676
- msgid "Title of popular posts:"
677
- msgstr ""
678
-
679
- #: admin/main-view.php:375
680
- msgid "Title of daily popular posts:"
681
- msgstr ""
682
-
683
- #: admin/main-view.php:381
684
- msgid "When there are no posts, what should be shown?"
685
- msgstr ""
686
-
687
- #: admin/main-view.php:385
688
- msgid "Blank Output"
689
- msgstr ""
690
-
691
- #: admin/main-view.php:389
692
- msgid "Display:"
693
- msgstr ""
694
-
695
- #: admin/main-view.php:394
696
- msgid "Show post excerpt in list?"
697
- msgstr ""
698
-
699
- #: admin/main-view.php:400
700
- msgid "Length of excerpt (in words):"
701
- msgstr ""
702
-
703
- #: admin/main-view.php:406
704
- msgid "Show post author in list?"
705
- msgstr ""
706
-
707
- #: admin/main-view.php:412
708
- msgid "Show post date in list?"
709
- msgstr ""
710
-
711
- #: admin/main-view.php:418
712
- msgid "Limit post title length (in characters)"
713
- msgstr ""
714
-
715
- #: admin/main-view.php:424
716
- msgid "Show view count in list?"
717
- msgstr ""
718
-
719
- #: admin/main-view.php:430
720
- msgid "Open links in new window"
721
- msgstr ""
722
-
723
- #: admin/main-view.php:436
724
- msgid "Add nofollow attribute to links in the list"
725
- msgstr ""
726
-
727
- #: admin/main-view.php:442
728
- msgid "Exclude display of related posts on these posts / pages"
729
- msgstr ""
730
-
731
- #: admin/main-view.php:449
732
- msgid "Customise the list HTML"
733
- msgstr ""
734
-
735
- #: admin/main-view.php:452
736
- msgid "HTML to display before the list of posts:"
737
- msgstr ""
738
-
739
- #: admin/main-view.php:458
740
- msgid "HTML to display before each list item:"
741
- msgstr ""
742
-
743
- #: admin/main-view.php:464
744
- msgid "HTML to display after each list item:"
745
- msgstr ""
746
-
747
- #: admin/main-view.php:470
748
- msgid "HTML to display after the list of posts:"
749
- msgstr ""
750
-
751
- #: admin/main-view.php:511
752
- msgid "Location of post thumbnail:"
753
- msgstr ""
754
-
755
- #: admin/main-view.php:515
756
- msgid "Display thumbnails inline with posts, before title"
757
- msgstr ""
758
-
759
- #: admin/main-view.php:520
760
- msgid "Display thumbnails inline with posts, after title"
761
- msgstr ""
762
-
763
- #: admin/main-view.php:525
764
- msgid "Display only thumbnails, no text"
765
- msgstr ""
766
-
767
- #: admin/main-view.php:530
768
- msgid "Do not display thumbnails, only text."
769
- msgstr ""
770
-
771
- #: admin/main-view.php:534
772
- msgid ""
773
- "This setting cannot be changed because an inbuilt style has been selected "
774
- "under the Styles section. If you would like to change this option, please "
775
- "select No styles under the Styles section."
776
- msgstr ""
777
-
778
- #: admin/main-view.php:538
779
- msgid "Thumbnail size:"
780
- msgstr ""
781
-
782
- #: admin/main-view.php:562
783
- msgid "Custom size"
784
- msgstr ""
785
-
786
- #: admin/main-view.php:565
787
- msgid ""
788
- "You can choose from existing image sizes above or create a custom size. If "
789
- "you have chosen Custom size above, then enter the width, height and crop "
790
- "settings below. For best results, use a cropped image."
791
- msgstr ""
792
-
793
- #: admin/main-view.php:566
794
- msgid ""
795
- "If you change the width and/or height below, existing images will not be "
796
- "automatically resized."
797
- msgstr ""
798
-
799
- #: admin/main-view.php:567
800
- #, php-format
801
- msgid ""
802
- "I recommend using <a href='%s' class='thickbox'>OTF Regenerate Thumbnails</"
803
- "a> or <a href='%s' class='thickbox'>Regenerate Thumbnails</a> to regenerate "
804
- "all image sizes."
805
- msgstr ""
806
-
807
- #: admin/main-view.php:570
808
- msgid ""
809
- "If you're using the Left Thumbs style below then the thumbnail width and "
810
- "height that you set here will supersede the widget. Alternatively, choose "
811
- "<strong>Style attributes</strong> under <strong>Image size attributes</"
812
- "strong> option below"
813
- msgstr ""
814
-
815
- #: admin/main-view.php:573
816
- msgid "Width of custom thumbnail:"
817
- msgstr ""
818
-
819
- #: admin/main-view.php:578
820
- msgid "Height of custom thumbnail"
821
- msgstr ""
822
-
823
- #: admin/main-view.php:583
824
- msgid "Crop mode:"
825
- msgstr ""
826
-
827
- #: admin/main-view.php:587
828
- msgid ""
829
- "By default, thumbnails will be proportionately cropped. Check this box to "
830
- "hard crop the thumbnails."
831
- msgstr ""
832
-
833
- #: admin/main-view.php:588
834
- #, php-format
835
- msgid "<a href='%s' target='_blank'>Difference between soft and hard crop</a>"
836
- msgstr ""
837
-
838
- #: admin/main-view.php:592
839
- msgid "Image size attributes:"
840
- msgstr ""
841
-
842
- #: admin/main-view.php:596
843
- msgid "Style attributes are used for width and height."
844
- msgstr ""
845
-
846
- #: admin/main-view.php:602
847
- msgid "HTML width and height attributes are used for width and height."
848
- msgstr ""
849
-
850
- #: admin/main-view.php:608
851
- msgid "No HTML or Style attributes set for width and height"
852
- msgstr ""
853
-
854
- #: admin/main-view.php:613
855
- msgid "Post thumbnail meta field name:"
856
- msgstr ""
857
-
858
- #: admin/main-view.php:616
859
- msgid ""
860
- "The value of this field should contain the image source and is set in the "
861
- "<em>Add New Post</em> screen"
862
- msgstr ""
863
-
864
- #: admin/main-view.php:619
865
- msgid ""
866
- "If the postmeta is not set, then should the plugin extract the first image "
867
- "from the post?"
868
- msgstr ""
869
-
870
- #: admin/main-view.php:622
871
- msgid ""
872
- "This could slow down the loading of your page if the first image in the "
873
- "related posts is large in file-size"
874
- msgstr ""
875
-
876
- #: admin/main-view.php:625
877
- msgid "Use default thumbnail?"
878
- msgstr ""
879
-
880
- #: admin/main-view.php:628
881
- msgid ""
882
- "If checked, when no thumbnail is found, show a default one from the URL "
883
- "below. If not checked and no thumbnail is found, no image will be shown."
884
- msgstr ""
885
-
886
- #: admin/main-view.php:631
887
- msgid "Default thumbnail:"
888
- msgstr ""
889
-
890
- #: admin/main-view.php:635
891
- msgid ""
892
- "The plugin will first check if the post contains a thumbnail. If it doesn't "
893
- "then it will check the meta field. If this is not available, then it will "
894
- "show the default image as specified above"
895
- msgstr ""
896
-
897
- #: admin/main-view.php:674
898
- msgid "Style of the related posts:"
899
- msgstr ""
900
-
901
- #: admin/main-view.php:677
902
- msgid "No styles"
903
- msgstr ""
904
-
905
- #: admin/main-view.php:679
906
- msgid "Select this option if you plan to add your own styles"
907
- msgstr ""
908
-
909
- #: admin/main-view.php:684
910
- msgid "Left Thumbnails"
911
- msgstr ""
912
-
913
- #: admin/main-view.php:687
914
- msgid ""
915
- "Enabling this option will set the post thumbnail to be before text. "
916
- "Disabling this option will not revert any settings."
917
- msgstr ""
918
-
919
- #: admin/main-view.php:688
920
- #, php-format
921
- msgid ""
922
- "You can view the default style at <a href=\"%1$s\" target=\"_blank\">%1$s</a>"
923
- msgstr ""
924
-
925
- #: admin/main-view.php:692
926
- msgid "Text only"
927
- msgstr ""
928
-
929
- #: admin/main-view.php:694
930
- msgid ""
931
- "Enabling this option will disable thumbnails and no longer include the "
932
- "default style sheet included in the plugin."
933
- msgstr ""
934
-
935
- #: admin/main-view.php:710
936
- msgid "Custom CSS to add to header:"
937
- msgstr ""
938
-
939
- #: admin/main-view.php:715
940
- msgid ""
941
- "Do not include <code>style</code> tags. Check out the <a href=\"http://"
942
- "wordpress.org/extend/plugins/top-10/faq/\" target=\"_blank\">FAQ</a> for "
943
- "available CSS classes to style."
944
- msgstr ""
945
-
946
- #: admin/main-view.php:735
947
- msgid "Default Options"
948
- msgstr ""
949
-
950
- #: admin/main-view.php:735
951
- msgid "Do you want to set options to Default?"
952
- msgstr ""
953
-
954
- #: admin/main-view.php:759
955
- msgid ""
956
- "Over time the Daily Top 10 database grows in size, which reduces the "
957
- "performance of the plugin. Cleaning the database at regular intervals could "
958
- "improve performance, especially on high traffic blogs. Enabling maintenance "
959
- "will automatically delete entries older than 90 days."
960
- msgstr ""
961
-
962
- #: admin/main-view.php:760
963
- msgid ""
964
- "Note: When scheduled maintenance is enabled, WordPress will run the cron job "
965
- "everytime the job is rescheduled (i.e. you change the settings below)."
966
- msgstr ""
967
-
968
- #: admin/main-view.php:763
969
- msgid "Enable scheduled maintenance of daily tables:"
970
- msgstr ""
971
-
972
- #: admin/main-view.php:767
973
- msgid "Time to run maintenance"
974
- msgstr ""
975
-
976
- #: admin/main-view.php:768
977
- msgid "hrs"
978
- msgstr ""
979
-
980
- #: admin/main-view.php:768
981
- msgid "min"
982
- msgstr ""
983
-
984
- #: admin/main-view.php:770
985
- msgid "How often should the maintenance be run:"
986
- msgstr ""
987
-
988
- #: admin/main-view.php:778
989
- msgid "Weekly"
990
- msgstr ""
991
-
992
- #: admin/main-view.php:782
993
- msgid "Fortnightly"
994
- msgstr ""
995
-
996
- #: admin/main-view.php:786
997
- msgid "Monthly"
998
- msgstr ""
999
-
1000
- #: admin/main-view.php:795
1001
- msgid "The cron job has been scheduled. Maintenance will run"
1002
- msgstr ""
1003
-
1004
- #: admin/main-view.php:800
1005
- msgid "The cron job is missing. Please resave this page to add the job"
1006
- msgstr ""
1007
-
1008
- #: admin/main-view.php:805
1009
- msgid "Maintenance is turned off"
1010
- msgstr ""
1011
-
1012
- #: admin/main-view.php:811
1013
- msgid "Save Maintenance Options"
1014
- msgstr ""
1015
-
1016
- #: admin/main-view.php:819
1017
- msgid "Reset count and other tools"
1018
- msgstr ""
1019
-
1020
- #: admin/main-view.php:822
1021
- msgid ""
1022
- "This cannot be reversed. Make sure that your database has been backed up "
1023
- "before proceeding"
1024
- msgstr ""
1025
-
1026
- #: admin/main-view.php:825
1027
- msgid "Reset Popular Posts"
1028
- msgstr ""
1029
-
1030
- #: admin/main-view.php:825
1031
- msgid "Are you sure you want to reset the popular posts?"
1032
- msgstr ""
1033
-
1034
- #: admin/main-view.php:826
1035
- msgid "Reset Daily Popular Posts"
1036
- msgstr ""
1037
-
1038
- #: admin/main-view.php:826
1039
- msgid "Are you sure you want to reset the daily popular posts?"
1040
- msgstr ""
1041
-
1042
- #: admin/main-view.php:829
1043
- msgid "This will merge post counts for posts with table entries of 0 and 1"
1044
- msgstr ""
1045
-
1046
- #: admin/main-view.php:832
1047
- msgid "Merge blog ID 0 and 1 post counts"
1048
- msgstr ""
1049
-
1050
- #: admin/main-view.php:832
1051
- msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1052
- msgstr ""
1053
-
1054
- #: admin/main-view.php:835
1055
- msgid ""
1056
- "In older versions, the plugin created entries with duplicate post IDs. "
1057
- "Clicking the button below will merge these duplicate IDs"
1058
- msgstr ""
1059
-
1060
- #: admin/main-view.php:838
1061
- msgid "Merge duplicates across blog IDs"
1062
- msgstr ""
1063
-
1064
- #: admin/main-view.php:838
1065
- msgid "This will delete the duplicate entries in the tables. Proceed?"
1066
- msgstr ""
1067
-
1068
- #: admin/main-view.php:854
1069
- msgid "WordPress Multisite: Migrate Top 10 v1.x counts to 2.x"
1070
- msgstr ""
1071
-
1072
- #: admin/main-view.php:857
1073
- msgid ""
1074
- "If you've been using Top 10 v1.x on multisite, you would have needed to "
1075
- "activate the plugin independently for each site. This would have resulted in "
1076
- "two tables being created for each site in the network."
1077
- msgstr ""
1078
-
1079
- #: admin/main-view.php:858
1080
- msgid ""
1081
- "Top 10 v2.x onwards uses only a single table to record the count, keeping "
1082
- "your database clean. You can use this tool to import the recorded counts "
1083
- "from v1.x tables to the new v2.x table format."
1084
- msgstr ""
1085
-
1086
- #: admin/main-view.php:861
1087
- msgid ""
1088
- "If you do not see any tables below, then it means that either all data has "
1089
- "already been imported or no relevant information has been found."
1090
- msgstr ""
1091
-
1092
- #: admin/main-view.php:864
1093
- msgid ""
1094
- "After running the importer, please verify that all the counts have been "
1095
- "successfully imported. Only then should you delete any old tables!"
1096
- msgstr ""
1097
-
1098
- #: admin/main-view.php:898
1099
- msgid "Blog ID"
1100
- msgstr ""
1101
-
1102
- #: admin/main-view.php:901
1103
- msgid "Status"
1104
- msgstr ""
1105
-
1106
- #: admin/main-view.php:904
1107
- msgid "Select to import"
1108
- msgstr ""
1109
-
1110
- #: admin/main-view.php:914
1111
- msgid "Blog #"
1112
- msgstr ""
1113
-
1114
- #: admin/main-view.php:924
1115
- msgid "Not imported"
1116
- msgstr ""
1117
-
1118
- #: admin/main-view.php:928
1119
- msgid "Imported"
1120
- msgstr ""
1121
-
1122
- #: admin/main-view.php:949
1123
- msgid "Begin import"
1124
- msgstr ""
1125
-
1126
- #: admin/main-view.php:950
1127
- msgid "Delete selected tables"
1128
- msgstr ""
1129
-
1130
- #: admin/main-view.php:951
1131
- msgid "Delete all imported tables"
1132
- msgstr ""
1133
-
1134
- #: includes/cron.php:75
1135
  msgid "Once Weekly"
1136
  msgstr ""
1137
 
1138
- #: includes/cron.php:79
1139
  msgid "Once Fortnightly"
1140
  msgstr ""
1141
 
1142
- #: includes/cron.php:83
1143
  msgid "Once Monthly"
1144
  msgstr ""
1145
 
1146
- #: includes/cron.php:87
1147
  msgid "Once quarterly"
1148
  msgstr ""
1149
 
1150
- #: includes/modules/class-top-10-widget.php:31
1151
  msgid "Popular Posts [Top 10]"
1152
  msgstr ""
1153
 
@@ -1155,75 +240,16 @@ msgstr ""
1155
  msgid "Display popular posts"
1156
  msgstr ""
1157
 
1158
- #: includes/modules/class-top-10-widget.php:79
1159
- msgid "No. of posts"
1160
- msgstr ""
1161
-
1162
- #: includes/modules/class-top-10-widget.php:85
1163
- msgid "Custom time period (Enter below)"
1164
- msgstr ""
1165
-
1166
- #: includes/modules/class-top-10-widget.php:89
1167
- msgid "In days and hours (applies only to custom option above)"
1168
- msgstr ""
1169
-
1170
- #: includes/modules/class-top-10-widget.php:94
1171
- msgid "hours"
1172
- msgstr ""
1173
-
1174
- #: includes/modules/class-top-10-widget.php:99
1175
- msgid "Show count?"
1176
- msgstr ""
1177
-
1178
- #: includes/modules/class-top-10-widget.php:104
1179
- msgid "Show excerpt?"
1180
- msgstr ""
1181
-
1182
- #: includes/modules/class-top-10-widget.php:109
1183
- msgid "Show author?"
1184
- msgstr ""
1185
-
1186
- #: includes/modules/class-top-10-widget.php:114
1187
- msgid "Show date?"
1188
- msgstr ""
1189
-
1190
- #: includes/modules/class-top-10-widget.php:120
1191
- msgid "Thumbnails inline, before title"
1192
- msgstr ""
1193
-
1194
- #: includes/modules/class-top-10-widget.php:121
1195
- msgid "Thumbnails inline, after title"
1196
- msgstr ""
1197
-
1198
- #: includes/modules/class-top-10-widget.php:122
1199
- msgid "Only thumbnails, no text"
1200
- msgstr ""
1201
-
1202
- #: includes/modules/class-top-10-widget.php:123
1203
- msgid "No thumbnails, only text."
1204
- msgstr ""
1205
-
1206
- #: includes/modules/class-top-10-widget.php:128
1207
- msgid "Thumbnail height"
1208
- msgstr ""
1209
-
1210
- #: includes/modules/class-top-10-widget.php:134
1211
- msgid "Thumbnail width"
1212
- msgstr ""
1213
-
1214
- #: includes/modules/class-top-10-widget.php:138
1215
- msgid "Post types to include:"
1216
- msgstr ""
1217
-
1218
- #: includes/public/display-posts.php:91
1219
  msgid ""
1220
  "posts_only argument has been deprecated. Use get_tptn_pop_posts() to get the "
1221
  "posts only."
1222
  msgstr ""
1223
 
1224
- #: includes/public/display-posts.php:228
1225
  #, php-format
1226
- msgid "Popular posts by <a href=\"%s\" rel=\"nofollow\" %s>Top 10 plugin</a>"
 
1227
  msgstr ""
1228
 
1229
  #: includes/public/media.php:60
@@ -1242,6 +268,23 @@ msgstr ""
1242
  msgid " by "
1243
  msgstr ""
1244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1245
  #: top-10.php:94
1246
  msgid "<h3>Popular Posts</h3>"
1247
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2016-09-22 16:24+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
  "Language-Team: Ajay DSouza <me@ajaydsouza.com>\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
  "X-Poedit-KeywordsList: __;_e;_c;__ngettext\n"
15
  "X-Poedit-Basepath: ..\n"
16
+ "X-Generator: Poedit 1.8.9\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
  "X-Poedit-SearchPathExcluded-0: ../admin/wick\n"
30
  msgid "Views"
31
  msgstr ""
32
 
33
+ #: admin/admin-dashboard.php:64
34
  msgid "View all daily popular posts"
35
  msgstr ""
36
 
37
+ #: admin/admin-dashboard.php:66
38
  msgid "View all popular posts"
39
  msgstr ""
40
 
41
+ #: admin/admin-dashboard.php:72
42
  #, php-format
43
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
44
  msgstr ""
45
 
46
+ #: admin/admin-dashboard.php:122 admin/class-stats.php:539
 
47
  msgid "Popular Posts"
48
  msgstr ""
49
 
50
+ #: admin/admin-dashboard.php:127 admin/admin.php:461
51
  msgid "Daily Popular Posts"
52
  msgstr ""
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  #: admin/admin-metabox.php:137
55
  #, php-format
56
  msgid ""
58
  "will need to make the same change in the %1$s meta box on this page."
59
  msgstr ""
60
 
61
+ #: admin/admin.php:199
62
  msgid "Options saved successfully. If enabled, the cache has been cleared."
63
  msgstr ""
64
 
65
+ #: admin/admin.php:202
66
  msgid ""
67
  "Left Thumbnails style selected. Post thumbnail location set to Inline before "
68
  "text."
69
  msgstr ""
70
 
71
+ #: admin/admin.php:205
72
  msgid "Text Only style selected. Thumbnails will not be displayed."
73
  msgstr ""
74
 
75
+ #: admin/admin.php:208
76
  #, php-format
77
+ msgid "Pre-built thumbnail size selected. Thumbnail set to %1$d x %1$d."
78
  msgstr ""
79
 
80
+ #: admin/admin.php:223
81
  msgid "Options set to Default."
82
  msgstr ""
83
 
84
+ #: admin/admin.php:230
85
  msgid "Top 10 popular posts reset"
86
  msgstr ""
87
 
88
+ #: admin/admin.php:237
89
  msgid "Top 10 daily popular posts reset"
90
  msgstr ""
91
 
92
+ #: admin/admin.php:245
93
  msgid "Duplicate rows cleaned from tables"
94
  msgstr ""
95
 
96
+ #: admin/admin.php:253
97
  msgid "Post counts across blog IDs 0 and 1 have been merged"
98
  msgstr ""
99
 
100
+ #: admin/admin.php:266
101
  msgid "Scheduled maintenance enabled / modified"
102
  msgstr ""
103
 
104
+ #: admin/admin.php:270
105
  msgid "Scheduled maintenance disabled"
106
  msgstr ""
107
 
108
+ #: admin/admin.php:308
109
  msgid "Counts from selected sites have been imported."
110
  msgstr ""
111
 
112
+ #: admin/admin.php:333
113
  msgid ""
114
  "Selected tables have been deleted. Note that only imported tables have been "
115
  "deleted."
116
  msgstr ""
117
 
118
+ #: admin/admin.php:449 admin/admin.php:452
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  msgid "Top 10 Settings"
120
  msgstr ""
121
 
122
+ #: admin/admin.php:449
123
  msgid "Top 10"
124
  msgstr ""
125
 
126
+ #: admin/admin.php:457
127
  msgid "View Popular Posts"
128
  msgstr ""
129
 
130
+ #: admin/admin.php:564
131
  msgid "Settings"
132
  msgstr ""
133
 
134
+ #: admin/admin.php:586
135
+ msgid "Support"
136
+ msgstr ""
137
+
138
+ #: admin/admin.php:587
139
  msgid "Donate"
140
  msgstr ""
141
 
142
+ #: admin/admin.php:588
143
+ msgid "Contribute"
144
+ msgstr ""
145
+
146
  #: admin/cache.php:19
147
  msgid "Top 10 cache has been cleared"
148
  msgstr ""
149
 
150
+ #: admin/class-stats.php:35
151
  msgid "popular_post"
152
  msgstr ""
153
 
154
+ #: admin/class-stats.php:36
155
  msgid "popular_posts"
156
  msgstr ""
157
 
158
+ #: admin/class-stats.php:243
 
 
 
 
159
  msgid "View"
160
  msgstr ""
161
 
162
+ #: admin/class-stats.php:244
163
  msgid "Edit"
164
  msgstr ""
165
 
166
+ #: admin/class-stats.php:245
167
  msgid "Delete"
168
  msgstr ""
169
 
170
+ #: admin/class-stats.php:267
171
  msgid "Y/m/d g:i:s a"
172
  msgstr ""
173
 
174
+ #: admin/class-stats.php:274
175
  #, php-format
176
  msgid "%s ago"
177
  msgstr ""
178
 
179
+ #: admin/class-stats.php:276
180
  msgid "Y/m/d"
181
  msgstr ""
182
 
183
+ #: admin/class-stats.php:309
184
  msgid "Title"
185
  msgstr ""
186
 
187
+ #: admin/class-stats.php:310
188
  msgid "Total visits"
189
  msgstr ""
190
 
191
+ #: admin/class-stats.php:311
192
  msgid "Daily visits"
193
  msgstr ""
194
 
195
+ #: admin/class-stats.php:312
196
  msgid "Post type"
197
  msgstr ""
198
 
199
+ #: admin/class-stats.php:313
200
  msgid "Author"
201
  msgstr ""
202
 
203
+ #: admin/class-stats.php:314
204
  msgid "Date"
205
  msgstr ""
206
 
207
+ #: admin/class-stats.php:348
208
  msgid "Delete Count"
209
  msgstr ""
210
 
211
+ #: admin/class-stats.php:441
 
 
 
 
212
  msgid "Filter"
213
  msgstr ""
214
 
215
+ #: admin/class-stats.php:514
216
  msgid "Search Table"
217
  msgstr ""
218
 
219
+ #: includes/cron.php:74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  msgid "Once Weekly"
221
  msgstr ""
222
 
223
+ #: includes/cron.php:78
224
  msgid "Once Fortnightly"
225
  msgstr ""
226
 
227
+ #: includes/cron.php:82
228
  msgid "Once Monthly"
229
  msgstr ""
230
 
231
+ #: includes/cron.php:86
232
  msgid "Once quarterly"
233
  msgstr ""
234
 
235
+ #: includes/modules/class-top-10-widget.php:30
236
  msgid "Popular Posts [Top 10]"
237
  msgstr ""
238
 
240
  msgid "Display popular posts"
241
  msgstr ""
242
 
243
+ #: includes/public/display-posts.php:92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  msgid ""
245
  "posts_only argument has been deprecated. Use get_tptn_pop_posts() to get the "
246
  "posts only."
247
  msgstr ""
248
 
249
+ #: includes/public/display-posts.php:229
250
  #, php-format
251
+ msgid ""
252
+ "Popular posts by <a href=\"%1$s\" rel=\"nofollow\" %2$s>Top 10 plugin</a>"
253
  msgstr ""
254
 
255
  #: includes/public/media.php:60
268
  msgid " by "
269
  msgstr ""
270
 
271
+ #: includes/tracker.php:248
272
+ msgid "Query variable based"
273
+ msgstr ""
274
+
275
+ #: includes/tracker.php:249
276
+ msgid "Uses query variables to record visits"
277
+ msgstr ""
278
+
279
+ #: includes/tracker.php:253
280
+ msgid "Ajaxurl based"
281
+ msgstr ""
282
+
283
+ #: includes/tracker.php:254
284
+ msgid ""
285
+ "Uses admin-ajax.php which is inbuilt within WordPress to process the tracker"
286
+ msgstr ""
287
+
288
  #: top-10.php:94
289
  msgid "<h3>Popular Posts</h3>"
290
  msgstr ""
readme.txt CHANGED
@@ -1,17 +1,17 @@
1
  === Top 10 - Popular posts plugin for WordPress ===
2
- Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
- Requires at least: 4.0
7
- Tested up to: 4.5.3
8
  License: GPLv2 or later
9
 
10
  Track daily and total visits on your blog posts. Display the count as well as popular and trending posts.
11
 
12
  == Description ==
13
 
14
- WordPress doesn't have an in-built support tracking page views or displaying popular posts. [Top 10](https://webberzone.com/plugins/top-10/) is an easy to use, yet, powerful WordPress plugin that will count the number of page views of your posts, pages and any custom post types. You can then display the page view counts as well as display your most popular posts.
15
 
16
  Top 10 will add a widget that you can use to display the popular posts list.
17
 
@@ -21,7 +21,7 @@ Top 10 also has powerful API and is fully extendable with WordPress actions and
21
 
22
  = Features =
23
 
24
- * **Page counter**: Counts page views on single posts, pages and *custom post types* on an hourly basis which can then be easily displayed automatically, using shortcodes or functions.
25
  * **Popular posts**: Display a list of popular posts either for total counts or for a custom period. You can choose how many posts are to be displayed along with loads of other customisation options
26
  * **Widget ready**: Sidebar widgets available for daily popular and overall popular posts. Highly customizable widgets to control what you want to display in the list of posts
27
  * **Shortcodes**: The plugin includes two shortcodes `[tptn_list]` and `[tptn_views]` to display the posts list and the number of views respectively
@@ -37,11 +37,10 @@ Top 10 also has powerful API and is fully extendable with WordPress actions and
37
 
38
  = Donations =
39
 
40
- I spend a significant amount of my free time maintaining, updating and more importantly supporting this plugin. Those who have sought support in the support forums know that I have done my best to answer your question and solve your problem.
41
- 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.
42
 
43
  = Translations =
44
- Top 10 is available for [translation directly on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/top-10). Check out the official [Translator Handbook](https://make.wordpress.org/polyglots/handbook/tools/glotpress-translate-wordpress-org/) to contribute.
45
 
46
 
47
  = Contribute =
@@ -166,10 +165,26 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
166
 
167
  == Changelog ==
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  = 2.3.2 =
170
 
171
  * Bug fixes:
172
- * Santized several unsanitized post and get requests
173
 
174
  * Deprecated:
175
  * External PHP file tracking option introduced in v2.3.0 in line with wordpress.org plugin repository listing requirements.
@@ -314,7 +329,7 @@ For previous changelog entries, please refer to the separate changelog.txt file
314
 
315
  == Upgrade Notice ==
316
 
317
- = 2.3.2 =
318
- * Security release. Fixes potential CSRF and also deprecates the external PHP tracker.
319
  Check the Changelog for more details
320
 
1
  === Top 10 - Popular posts plugin for WordPress ===
2
+ Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics, tracker
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
+ Requires at least: 4.1
7
+ Tested up to: 4.7
8
  License: GPLv2 or later
9
 
10
  Track daily and total visits on your blog posts. Display the count as well as popular and trending posts.
11
 
12
  == Description ==
13
 
14
+ WordPress doesn't have an in-built system to track page views or displaying popular posts. [Top 10](https://webberzone.com/plugins/top-10/) is an easy to use, yet, powerful WordPress plugin that will count the number of page views of your posts, pages and any custom post types. You can then display the page view counts as well as display your most popular posts.
15
 
16
  Top 10 will add a widget that you can use to display the popular posts list.
17
 
21
 
22
  = Features =
23
 
24
+ * **Page counter**: Counts page views on single posts, pages and *custom post types* on an hourly basis which can then be easily displayed automatically, using shortcodes or functions
25
  * **Popular posts**: Display a list of popular posts either for total counts or for a custom period. You can choose how many posts are to be displayed along with loads of other customisation options
26
  * **Widget ready**: Sidebar widgets available for daily popular and overall popular posts. Highly customizable widgets to control what you want to display in the list of posts
27
  * **Shortcodes**: The plugin includes two shortcodes `[tptn_list]` and `[tptn_views]` to display the posts list and the number of views respectively
37
 
38
  = Donations =
39
 
40
+ 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.
 
41
 
42
  = Translations =
43
+ Top 10 is available for [translation directly on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/top-10). Check out the official [Translator Handbook](https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/) to contribute.
44
 
45
 
46
  = Contribute =
165
 
166
  == Changelog ==
167
 
168
+ = 2.4.0 =
169
+
170
+ * Features:
171
+ * New tracker using a properly enqueued `.js` file. Two inbuilt options to use query variables or ajaxurl to process the counts
172
+ * Shortcode and the widget now have an added parameter for 'offset'. This is useful if you would like to display different widgets/shortcodes but not always start from the first post
173
+
174
+ * Bug fixes:
175
+ * Attachments now work with the widget and elsewhere
176
+ * New tracker now works when jQuery is loaded in the footer
177
+ * Don't add tracker code when previewing in customizer
178
+ * Doesn't report an error if no author is assigned to a post
179
+
180
+ * Deprecated:
181
+ * `tptn_add_tracker` and `tptn_add_viewed_count` have been deprecated. These should no longer be needed with the new tracker option.
182
+ * wick script in Settings page which was used for fetching category slugs. You should now use the category name (prompted automatically). Slugs will be automatically converted into names.
183
+
184
  = 2.3.2 =
185
 
186
  * Bug fixes:
187
+ * Sanitized several unsanitized post and get requests
188
 
189
  * Deprecated:
190
  * External PHP file tracking option introduced in v2.3.0 in line with wordpress.org plugin repository listing requirements.
329
 
330
  == Upgrade Notice ==
331
 
332
+ = 2.4.0 =
333
+ * Major release. New features and several bug fixes and a new tracker. Please do verify your settings after the upgrade.
334
  Check the Changelog for more details
335
 
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.3.2
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
@@ -94,9 +94,9 @@ function tptn_default_options() {
94
  $title = __( '<h3>Popular Posts</h3>', 'top-10' );
95
  $title_daily = __( '<h3>Daily Popular</h3>', 'top-10' );
96
  $blank_output_text = __( 'No top posts yet', 'top-10' );
97
- $thumb_default = plugins_url() . '/' . plugin_basename( dirname( TOP_TEN_PLUGIN_FILE ) ) . '/default.png';
98
 
99
- // get relevant post types
100
  $args = array(
101
  'public' => true,
102
  '_builtin' => true,
@@ -106,92 +106,92 @@ function tptn_default_options() {
106
  $tptn_settings = array(
107
 
108
  /* General options */
109
- 'activate_daily' => true, // Activate the daily count
110
- 'activate_overall' => true, // activate overall count
111
- 'cache' => false, // Enable Caching using Transienst API
112
- 'cache_time' => HOUR_IN_SECONDS, // Cache for 1 Hour
113
- 'cache_fix' => true, // Fix for W3 Total Cache - Uses Ajax
114
- 'daily_midnight' => true, // Start daily counts from midnight (default as old behaviour)
115
- 'daily_range' => '1', // Daily Popular will contain posts of how many days?
116
- 'hour_range' => '0', // Daily Popular will contain posts of how many days?
117
- 'uninstall_clean_options' => true, // Cleanup options
118
- 'uninstall_clean_tables' => false, // Cleanup tables
119
- 'show_metabox' => true, // Show metabox to admins
120
- 'show_metabox_admins' => false, // Limit to admins as well
121
- 'show_credit' => false, // Add link to plugin page of my blog in top posts list
122
 
123
  /* Counter and tracker options */
124
- 'add_to_content' => true, // Add post count to content (only on single posts)
125
- 'count_on_pages' => true, // Add post count to pages
126
- 'add_to_feed' => false, // Add post count to feed (full)
127
- 'add_to_home' => false, // Add post count to home page
128
- 'add_to_category_archives' => false, // Add post count to category archives
129
- 'add_to_tag_archives' => false, // Add post count to tag archives
130
- 'add_to_archives' => false, // Add post count to other archives
131
-
132
- 'count_disp_form' => '(Visited %totalcount% times, %dailycount% visits today)', // Format to display the count
133
  'count_disp_form_zero' => 'No visits yet', // What to display where there are no hits?
134
- 'dynamic_post_count' => false, // Use JavaScript for displaying the post count
135
 
136
- 'track_authors' => false, // Track Authors visits
137
- 'track_admins' => true, // Track Admin visits
138
- 'track_editors' => true, // Track Admin visits
 
139
  'pv_in_admin' => true, // Add an extra column on edit posts/pages to display page views?
140
- 'show_count_non_admins' => true, // Show counts to non-admins
141
 
142
  /* Popular post list options */
143
- 'limit' => '10', // How many posts to display?
144
- 'how_old' => '0', // How old posts? Default is no limit
145
- 'post_types' => $post_types, // WordPress custom post types
146
- 'exclude_categories' => '', // Exclude these categories
147
- 'exclude_cat_slugs' => '', // Exclude these categories (slugs)
148
- 'exclude_post_ids' => '', // Comma separated list of page / post IDs that are to be excluded in the results
149
-
150
- 'title' => $title, // Title of Popular Posts
151
- 'title_daily' => $title_daily, // Title of Daily Popular
152
- 'blank_output' => false, // Blank output? Default is "blank Output test"
153
- 'blank_output_text' => $blank_output_text, // Blank output text
154
-
155
- 'show_excerpt' => false, // Show description in list item
156
- 'excerpt_length' => '10', // Length of characters
157
- 'show_date' => false, // Show date in list item
158
- 'show_author' => false, // Show author in list item
159
- 'title_length' => '60', // Limit length of post title
160
- 'disp_list_count' => true, // Display count in popular lists?
161
-
162
- 'link_new_window' => false, // Open links in new window
163
- 'link_nofollow' => false, // Add no-follow to links
164
- 'exclude_on_post_ids' => '', // Comma separate list of page/post IDs to not display related posts on
165
-
166
- // List HTML options
167
- 'before_list' => '<ul>', // Before the entire list
168
- 'after_list' => '</ul>', // After the entire list
169
- 'before_list_item' => '<li>', // Before each list item
170
- 'after_list_item' => '</li>', // After each list item
171
 
172
  /* Thumbnail options */
173
- 'post_thumb_op' => 'text_only', // Display only text in posts
174
- 'thumb_size' => 'tptn_thumbnail', // Default thumbnail size
175
- 'thumb_width' => '150', // Max width of thumbnails
176
- 'thumb_height' => '150', // Max height of thumbnails
177
- 'thumb_crop' => true, // Crop mode. default is hard crop
178
  'thumb_html' => 'html', // Use HTML or CSS for width and height of the thumbnail?
179
 
180
- 'thumb_meta' => 'post-image', // Meta field that is used to store the location of default thumbnail image
181
- 'scan_images' => true, // Scan post for images
182
- 'thumb_default' => $thumb_default, // Default thumbnail image
183
- 'thumb_default_show' => true, // Show default thumb if none found (if false, don't show thumb at all)
184
 
185
  /* Custom styles */
186
- 'custom_CSS' => '', // Custom CSS to style the output
187
- 'include_default_style' => false, // Include default Top 10 style
188
- 'tptn_styles' => 'no_style', // Defaault style is left thubnails
189
 
190
  /* Maintenance cron */
191
  'cron_on' => false, // Run cron daily?
192
- 'cron_hour' => '0', // Cron Hour
193
- 'cron_min' => '0', // Cron Minute
194
- 'cron_recurrence' => 'weekly', // Frequency of cron
195
  );
196
 
197
  /**
@@ -209,7 +209,7 @@ function tptn_default_options() {
209
  * Function to read options from the database.
210
  *
211
  * @access public
212
- * @return void
213
  */
214
  function tptn_read_options() {
215
 
@@ -218,7 +218,7 @@ function tptn_read_options() {
218
  $defaults = tptn_default_options();
219
 
220
  $tptn_settings = array_map( 'stripslashes', (array) get_option( 'ald_tptn_settings' ) );
221
- unset( $tptn_settings[0] ); // produced by the (array) casting when there's nothing in the DB
222
 
223
  foreach ( $defaults as $k => $v ) {
224
  if ( ! isset( $tptn_settings[ $k ] ) ) {
@@ -226,7 +226,7 @@ function tptn_read_options() {
226
  $tptn_settings_changed = true;
227
  }
228
  }
229
- if ( $tptn_settings_changed == true ) {
230
  update_option( 'ald_tptn_settings', $tptn_settings );
231
  }
232
 
@@ -245,7 +245,7 @@ function tptn_read_options() {
245
  * Function to delete all rows in the posts table.
246
  *
247
  * @since 1.3
248
- * @param bool $daily Daily flag
249
  */
250
  function tptn_trunc_count( $daily = false ) {
251
  global $wpdb;
@@ -263,7 +263,8 @@ function tptn_trunc_count( $daily = false ) {
263
  /*
264
  ----------------------------------------------------------------------------*
265
  * Top 10 modules
266
- *----------------------------------------------------------------------------*/
 
267
 
268
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/activate-deactivate.php' );
269
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/public/display-posts.php' );
@@ -272,6 +273,7 @@ require_once( TOP_TEN_PLUGIN_DIR . 'includes/public/output-generator.php' );
272
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/public/media.php' );
273
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/l10n.php' );
274
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/counter.php' );
 
275
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/cron.php' );
276
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/formatting.php' );
277
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/modules/shortcode.php' );
@@ -283,7 +285,8 @@ require_once( TOP_TEN_PLUGIN_DIR . 'includes/modules/class-top-10-widget.php' );
283
  /*
284
  ----------------------------------------------------------------------------*
285
  * Dashboard and Administrative Functionality
286
- *----------------------------------------------------------------------------*/
 
287
 
288
  if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
289
 
@@ -299,7 +302,8 @@ if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
299
  /*
300
  ----------------------------------------------------------------------------*
301
  * Deprecated functions
302
- *----------------------------------------------------------------------------*/
 
303
 
304
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/deprecated.php' );
305
 
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.4.0
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
94
  $title = __( '<h3>Popular Posts</h3>', 'top-10' );
95
  $title_daily = __( '<h3>Daily Popular</h3>', 'top-10' );
96
  $blank_output_text = __( 'No top posts yet', 'top-10' );
97
+ $thumb_default = plugins_url( 'default.png' , __FILE__ );
98
 
99
+ // Get relevant post types.
100
  $args = array(
101
  'public' => true,
102
  '_builtin' => true,
106
  $tptn_settings = array(
107
 
108
  /* General options */
109
+ 'activate_daily' => true, // Activate the daily count
110
+ 'activate_overall' => true, // Activate overall count.
111
+ 'cache' => false, // Enable Caching using Transienst API.
112
+ 'cache_time' => HOUR_IN_SECONDS, // Cache for 1 Hour.
113
+ 'daily_midnight' => true, // Start daily counts from midnight (default as old behaviour).
114
+ 'daily_range' => '1', // Daily Popular will contain posts of how many days?
115
+ 'hour_range' => '0', // Daily Popular will contain posts of how many hours?
116
+ 'uninstall_clean_options' => true, // Cleanup options.
117
+ 'uninstall_clean_tables' => false, // Cleanup tables.
118
+ 'show_metabox' => true, // Show metabox to admins.
119
+ 'show_metabox_admins' => false, // Limit to admins as well.
120
+ 'show_credit' => false, // Add link to plugin page of my blog in top posts list.
 
121
 
122
  /* Counter and tracker options */
123
+ 'add_to_content' => true, // Add post count to content (only on single posts).
124
+ 'count_on_pages' => true, // Add post count to pages.
125
+ 'add_to_feed' => false, // Add post count to feed (full).
126
+ 'add_to_home' => false, // Add post count to home page.
127
+ 'add_to_category_archives' => false, // Add post count to category archives.
128
+ 'add_to_tag_archives' => false, // Add post count to tag archives.
129
+ 'add_to_archives' => false, // Add post count to other archives.
130
+
131
+ 'count_disp_form' => '(Visited %totalcount% times, %dailycount% visits today)', // Format to display the count.
132
  'count_disp_form_zero' => 'No visits yet', // What to display where there are no hits?
133
+ 'dynamic_post_count' => false, // Use JavaScript for displaying the post count.
134
 
135
+ 'tracker_type' => 'ajaxurl', // Tracker type.
136
+ 'track_authors' => false, // Track Authors visits.
137
+ 'track_admins' => true, // Track Admin visits.
138
+ 'track_editors' => true, // Track Admin visits.
139
  'pv_in_admin' => true, // Add an extra column on edit posts/pages to display page views?
140
+ 'show_count_non_admins' => true, // Show counts to non-admins.
141
 
142
  /* Popular post list options */
143
+ 'limit' => '10', // How many posts to display?
144
+ 'how_old' => '0', // How old posts? Default is no limit.
145
+ 'post_types' => $post_types, // WordPress custom post types.
146
+ 'exclude_categories' => '', // Exclude these categories.
147
+ 'exclude_cat_slugs' => '', // Exclude these categories (slugs).
148
+ 'exclude_post_ids' => '', // Comma separated list of page / post IDs that are to be excluded in the results.
149
+
150
+ 'title' => $title, // Title of Popular Posts.
151
+ 'title_daily' => $title_daily, // Title of Daily Popular.
152
+ 'blank_output' => false, // Blank output? Default is "blank Output test".
153
+ 'blank_output_text' => $blank_output_text, // Blank output text.
154
+
155
+ 'show_excerpt' => false, // Show description in list item.
156
+ 'excerpt_length' => '10', // Length of characters.
157
+ 'show_date' => false, // Show date in list item.
158
+ 'show_author' => false, // Show author in list item.
159
+ 'title_length' => '60', // Limit length of post title.
160
+ 'disp_list_count' => true, // Display count in popular lists?
161
+
162
+ 'link_new_window' => false, // Open links in new window.
163
+ 'link_nofollow' => false, // Add no-follow to links.
164
+ 'exclude_on_post_ids' => '', // Comma separate list of page/post IDs to not display related posts on.
165
+
166
+ // List HTML options.
167
+ 'before_list' => '<ul>', // Before the entire list.
168
+ 'after_list' => '</ul>', // After the entire list.
169
+ 'before_list_item' => '<li>', // Before each list item.
170
+ 'after_list_item' => '</li>', // After each list item.
171
 
172
  /* Thumbnail options */
173
+ 'post_thumb_op' => 'text_only', // Display only text in posts.
174
+ 'thumb_size' => 'tptn_thumbnail', // Default thumbnail size.
175
+ 'thumb_width' => '150', // Max width of thumbnails.
176
+ 'thumb_height' => '150', // Max height of thumbnails.
177
+ 'thumb_crop' => true, // Crop mode. default is hard crop.
178
  'thumb_html' => 'html', // Use HTML or CSS for width and height of the thumbnail?
179
 
180
+ 'thumb_meta' => 'post-image', // Meta field that is used to store the location of default thumbnail image.
181
+ 'scan_images' => true, // Scan post for images.
182
+ 'thumb_default' => $thumb_default, // Default thumbnail image.
183
+ 'thumb_default_show' => true, // Show default thumb if none found (if false, don't show thumb at all).
184
 
185
  /* Custom styles */
186
+ 'custom_CSS' => '', // Custom CSS to style the output.
187
+ 'include_default_style' => false, // Include default Top 10 style.
188
+ 'tptn_styles' => 'no_style', // Defaault style is left thubnails.
189
 
190
  /* Maintenance cron */
191
  'cron_on' => false, // Run cron daily?
192
+ 'cron_hour' => '0', // Cron Hour.
193
+ 'cron_min' => '0', // Cron Minute.
194
+ 'cron_recurrence' => 'weekly', // Frequency of cron.
195
  );
196
 
197
  /**
209
  * Function to read options from the database.
210
  *
211
  * @access public
212
+ * @return array
213
  */
214
  function tptn_read_options() {
215
 
218
  $defaults = tptn_default_options();
219
 
220
  $tptn_settings = array_map( 'stripslashes', (array) get_option( 'ald_tptn_settings' ) );
221
+ unset( $tptn_settings[0] ); // Produced by the (array) casting when there's nothing in the DB.
222
 
223
  foreach ( $defaults as $k => $v ) {
224
  if ( ! isset( $tptn_settings[ $k ] ) ) {
226
  $tptn_settings_changed = true;
227
  }
228
  }
229
+ if ( true === $tptn_settings_changed ) {
230
  update_option( 'ald_tptn_settings', $tptn_settings );
231
  }
232
 
245
  * Function to delete all rows in the posts table.
246
  *
247
  * @since 1.3
248
+ * @param bool $daily Daily flag.
249
  */
250
  function tptn_trunc_count( $daily = false ) {
251
  global $wpdb;
263
  /*
264
  ----------------------------------------------------------------------------*
265
  * Top 10 modules
266
+ *---------------------------------------------------------------------------*
267
+ */
268
 
269
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/activate-deactivate.php' );
270
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/public/display-posts.php' );
273
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/public/media.php' );
274
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/l10n.php' );
275
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/counter.php' );
276
+ require_once( TOP_TEN_PLUGIN_DIR . 'includes/tracker.php' );
277
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/cron.php' );
278
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/formatting.php' );
279
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/modules/shortcode.php' );
285
  /*
286
  ----------------------------------------------------------------------------*
287
  * Dashboard and Administrative Functionality
288
+ *---------------------------------------------------------------------------*
289
+ */
290
 
291
  if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
292
 
302
  /*
303
  ----------------------------------------------------------------------------*
304
  * Deprecated functions
305
+ *---------------------------------------------------------------------------*
306
+ */
307
 
308
  require_once( TOP_TEN_PLUGIN_DIR . 'includes/deprecated.php' );
309