Post Views Counter - Version 1.0.7

Version Description

  • New: Possibility to manually set views count for each post
  • New: Plugin development moved to dFactory GitHub Repository
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Post Views Counter
Version 1.0.7
Comparing to
See all releases

Code changes from version 1.0.6 to 1.0.7

css/admin.css CHANGED
@@ -1,15 +1,92 @@
1
  /* Post Views Counter settings */
2
- .post-views-counter-settings { margin-right: 300px; }
3
- .post-views-counter-settings form { float: left; min-width: 463px; width: auto; }
4
- .post-views-counter-settings fieldset .description { font-size: 13px; margin-bottom: 8px; margin-top: 4px; display: block; }
5
- .post-views-counter-settings .chosen-container { margin: 0.25em 0 0.5em; }
6
- .post-views-counter-settings .chosen-container-multi .chosen-choices li.search-field input[type="text"] { font-family: inherit; height: inherit; line-height: 1em; margin: 0; }
7
- .post-views-counter-settings p.help, .post-views-counter-settings p.description, .post-views-counter-settings span.description { font-size: 13px; font-style: italic; }
8
- .post-views-counter-settings div.ip-box { margin-bottom: 3px; }
9
-
10
- .df-credits { float: right; width: 280px; background: #fff; margin: 20px -300px 20px 20px; position: relative; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05); }
11
- .df-credits .inner { padding-left: 10px; padding-right: 10px; }
12
- .df-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
13
- .df-credits .df-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
14
- .df-credits .df-link a { vertical-align: middle; padding: 5px 0 0 4px; }
15
- .df-credits hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /* Post Views Counter settings */
2
+ .post-views-counter-settings {
3
+ margin-right: 300px;
4
+ }
5
+
6
+ .post-views-counter-settings form {
7
+ float: left;
8
+ min-width: 463px;
9
+ width: auto;
10
+ }
11
+
12
+ .post-views-counter-settings fieldset .description {
13
+ font-size: 13px;
14
+ margin-bottom: 8px;
15
+ margin-top: 4px;
16
+ display: block;
17
+ }
18
+
19
+ .post-views-counter-settings .chosen-container {
20
+ margin: 0.25em 0 0.5em;
21
+ }
22
+
23
+ .post-views-counter-settings .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
24
+ font-family: inherit;
25
+ height: inherit;
26
+ line-height: 1em;
27
+ margin: 0;
28
+ }
29
+
30
+ .post-views-counter-settings p.help, .post-views-counter-settings p.description, .post-views-counter-settings span.description {
31
+ font-size: 13px;
32
+ font-style: italic;
33
+ }
34
+
35
+ .post-views-counter-settings div.ip-box {
36
+ margin-bottom: 3px;
37
+ }
38
+
39
+ .df-credits {
40
+ float: right;
41
+ width: 280px;
42
+ background: #fff;
43
+ margin: 20px -300px 20px 20px;
44
+ position: relative;
45
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
46
+ }
47
+
48
+ .df-credits .inner {
49
+ padding-left: 10px;
50
+ padding-right: 10px;
51
+ }
52
+
53
+ .df-credits h3 {
54
+ font-size: 14px;
55
+ line-height: 1.4;
56
+ margin: 0;
57
+ padding: 8px 12px;
58
+ border-bottom: 1px solid #eee;
59
+ }
60
+
61
+ .df-credits .df-link {
62
+ font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
63
+ font-style: italic;
64
+ padding-bottom: 10px;
65
+ margin: 0;
66
+ }
67
+
68
+ .df-credits .df-link a {
69
+ vertical-align: middle;
70
+ padding: 5px 0 0 4px;
71
+ }
72
+
73
+ .df-credits hr {
74
+ border: solid #eee;
75
+ border-width: 1px 0 0;
76
+ clear: both;
77
+ height: 0;
78
+ }
79
+
80
+ /* Single post edit screen */
81
+ #misc-publishing-actions #post-views #post-views-display:before {
82
+ display: inline-block;
83
+ font: 400 20px/1 dashicons;
84
+ left: -1px;
85
+ padding: 0 2px 0 0;
86
+ position: relative;
87
+ text-decoration: none !important;
88
+ vertical-align: top;
89
+ color: #888;
90
+ content: "\f185";
91
+ top: -1px;
92
+ }
css/frontend.css CHANGED
@@ -1,11 +1 @@
1
- .post-views.entry-meta > span {
2
- margin-right: 0!important;
3
- font: 16px/1;
4
- }
5
- .post-views.entry-meta > span.post-views-icon.dashicons {
6
- display: inline-block;
7
- font-size: 16px;
8
- line-height: 1;
9
- text-decoration: inherit;
10
- vertical-align: middle;
11
- }
12
  margin-right: 0 !important;
13
  font: 16px/1;
14
  display: inline-block;
15
  font-size: 16px;
16
  line-height: 1;
17
  text-decoration: inherit;
18
  vertical-align: middle;
1
+ /* Frontend CSS */
 
 
 
 
 
 
 
 
 
 
2
  margin-right: 0 !important;
3
  font: 16px/1;
4
  display: inline-block;
5
  font-size: 16px;
6
  line-height: 1;
7
  text-decoration: inherit;
8
  vertical-align: middle;
includes/columns.php CHANGED
@@ -8,6 +8,108 @@ class Post_Views_Counter_Columns {
8
  public function __construct() {
9
  // actions
10
  add_action('current_screen', array(&$this, 'register_new_column'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
 
13
  /**
@@ -109,7 +211,7 @@ class Post_Views_Counter_Columns {
109
  )
110
  );
111
 
112
- echo (int)$views;
113
  }
114
  }
115
  }
8
  public function __construct() {
9
  // actions
10
  add_action('current_screen', array(&$this, 'register_new_column'));
11
+ add_action('post_submitbox_misc_actions', array(&$this, 'submitbox_views'));
12
+ add_action('save_post', array(&$this, 'save_post'), 10, 2);
13
+ }
14
+
15
+ /**
16
+ * Output post views for single post.
17
+ */
18
+ public function submitbox_views() {
19
+ global $post;
20
+
21
+ $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
22
+
23
+ if (!in_array($post->post_type, (array)$post_types))
24
+ return;
25
+
26
+ global $wpdb;
27
+
28
+ // get total post views
29
+ $views = $wpdb->get_var(
30
+ $wpdb->prepare("
31
+ SELECT count
32
+ FROM ".$wpdb->prefix."post_views
33
+ WHERE id = %d AND type = 4",
34
+ absint($post->ID)
35
+ )
36
+ );
37
+ ?>
38
+
39
+ <div class="misc-pub-section" id="post-views">
40
+
41
+ <?php wp_nonce_field('post_views_count', 'pvc_nonce'); ?>
42
+
43
+ <span id="post-views-display">
44
+
45
+ <?php echo __('Post Views', 'post-views-counter') . ': <b>' . number_format_i18n((int)$views) . '</b>'; ?>
46
+
47
+ </span>
48
+
49
+ <a href="#post-views" class="edit-post-views hide-if-no-js"><?php _e('Edit', 'post-views-counter'); ?></a>
50
+
51
+ <div id="post-views-input-container" class="hide-if-js">
52
+
53
+ <p><?php _e('Adjust the views count for this post.', 'post-views-counter'); ?></p>
54
+ <input type="hidden" name="current_post_views" id="post-views-current" value="<?php echo (int)$views; ?>" />
55
+ <input type="text" name="post_views" id="post-views-input" value="<?php echo (int)$views; ?>"/><br />
56
+ <p>
57
+ <a href="#post-views" class="save-post-views hide-if-no-js button"><?php _e('OK', 'post-views-counter'); ?></a>
58
+ <a href="#post-views" class="cancel-post-views hide-if-no-js"><?php _e('Cancel', 'post-views-counter'); ?></a>
59
+ </p>
60
+
61
+ </div>
62
+
63
+ </div>
64
+ <?php
65
+ }
66
+
67
+ /**
68
+ * Save post views data
69
+ */
70
+ public function save_post($post_id, $post) {
71
+
72
+ // break if doing autosave
73
+ if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
74
+ return $post_id;
75
+
76
+ // break if current user can't edit this post
77
+ if(!current_user_can('edit_post', $post_id))
78
+ return $post_id;
79
+
80
+ // is post views set
81
+ if(!isset($_POST['post_views']))
82
+ return $post_id;
83
+
84
+ // break if post views in not one of the selected
85
+ $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
86
+
87
+ if (!in_array($post->post_type, (array)$post_types))
88
+ return $post_id;
89
+
90
+ // validate data
91
+ if(!isset($_POST['pvc_nonce']) || !wp_verify_nonce($_POST['pvc_nonce'], 'post_views_count'))
92
+ return $post_id;
93
+
94
+ global $wpdb;
95
+
96
+ $count = apply_filters('pvc_update_post_views_count', absint($_POST['post_views']), $post_id);
97
+
98
+ // insert or update db post views count
99
+ $wpdb->query(
100
+ $wpdb->prepare("
101
+ INSERT INTO " . $wpdb->prefix . "post_views (id, type, period, count)
102
+ VALUES (%d, %d, %s, %d)
103
+ ON DUPLICATE KEY UPDATE count = %d",
104
+ $post_id,
105
+ 4,
106
+ 'total',
107
+ $count,
108
+ $count
109
+ )
110
+ );
111
+
112
+ do_action('pvc_after_update_post_views_count', $post_id);
113
  }
114
 
115
  /**
211
  )
212
  );
213
 
214
+ echo number_format_i18n((int)$views);
215
  }
216
  }
217
  }
js/admin-post.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ $(document).ready(function () {
4
+
5
+ // post views input
6
+ $('#post-views .edit-post-views').click(function () {
7
+ if ($('#post-views-input-container').is(":hidden")) {
8
+ $('#post-views-input-container').slideDown('fast');
9
+ $(this).hide();
10
+ }
11
+ return false;
12
+ });
13
+
14
+ // save post views
15
+ $('#post-views .save-post-views').click(function () {
16
+
17
+ var views = $.trim($('#post-views-display b').text());
18
+
19
+ $('#post-views-input-container').slideUp('fast');
20
+ $('#post-views .edit-post-views').show();
21
+
22
+ views = parseInt($('#post-views-input').val());
23
+ // reassign value as integer
24
+ $('#post-views-input').val(views);
25
+
26
+ $('#post-views-display b').text(views);
27
+
28
+ return false;
29
+ });
30
+
31
+ // cancel post views
32
+ $('#post-views .cancel-post-views').click(function () {
33
+
34
+ var views = $.trim($('#post-views-display b').text());
35
+
36
+ $('#post-views-input-container').slideUp('fast');
37
+ $('#post-views .edit-post-views').show();
38
+
39
+ views = parseInt($('#post-views-current').val());
40
+
41
+ $('#post-views-display b').text(views);
42
+ $('#post-views-input').val(views);
43
+
44
+ return false;
45
+ });
46
+
47
+ });
48
+
49
+ })(jQuery);
js/admin-settings.js ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ $(document).ready(function () {
4
+
5
+ // default chosen
6
+ $('.pvc-chosen').chosen({
7
+ disable_search_threshold: 8,
8
+ display_selected_options: false,
9
+ search_contains: true,
10
+ width: '300px'
11
+ });
12
+
13
+ // time types and position
14
+ $('.pvc-chosen-short').chosen({
15
+ disable_search_threshold: 8,
16
+ width: '200px'
17
+ });
18
+
19
+ // ask whether to reset options to defaults
20
+ $(document).on('click', '.reset_pvc_settings', function () {
21
+ return confirm(pvcArgsSettings.resetToDefaults);
22
+ });
23
+
24
+ // remove ip box
25
+ $(document).on('click', '.remove-exclude-ip', function () {
26
+ var parent = $(this).parent(),
27
+ nextParent = parent.parent(),
28
+ addButton = parent.find('.add-exclude-ip').hide(),
29
+ addCurrentIPButton = parent.find('.add-current-ip').hide();
30
+
31
+ // remove ip box
32
+ parent.remove();
33
+
34
+ var children = nextParent.find('div');
35
+
36
+ // was there add button?
37
+ if (addButton.length === 1) {
38
+ children.last().append(addButton.show(), ' ', addCurrentIPButton.show());
39
+ // children.last().append();
40
+ }
41
+
42
+ // only one ip box left?
43
+ if (children.length === 1) {
44
+ children.find('.remove-exclude-ip').hide();
45
+ }
46
+ });
47
+
48
+ // add ip box
49
+ $(document).on('click', '.add-exclude-ip', function () {
50
+ var parent = $(this).parent(),
51
+ newBox = parent.clone().hide();
52
+
53
+ // clear value
54
+ newBox.find('input').first().val('');
55
+
56
+ // remove add buttons
57
+ $(this).remove();
58
+ parent.find('.add-current-ip').remove();
59
+
60
+ // add and display new ip box
61
+ parent.after(newBox.show());
62
+
63
+ parent.parent().find('.remove-exclude-ip').show();
64
+ });
65
+
66
+ // add current ip
67
+ $(document).on('click', '.add-current-ip', function () {
68
+ // fills input with user's current ip
69
+ $(this).parent().find('input').first().val($(this).attr('data-rel'));
70
+ });
71
+
72
+ // display user roles if needed
73
+ $(document).on('change', '.pvc-chosen-groups', function () {
74
+ var foundRoles = false;
75
+
76
+ // check whether roles are selected
77
+ $(this).find(':selected').each(function (i, item) {
78
+ if (item.value === 'roles') {
79
+ foundRoles = true;
80
+ }
81
+ });
82
+
83
+ // are roles selected?
84
+ if (foundRoles) {
85
+ $(this).parent().find('.pvc_user_roles').fadeIn(300);
86
+ } else {
87
+ $(this).parent().find('.pvc_user_roles').fadeOut(300);
88
+ }
89
+ });
90
+
91
+ });
92
+
93
+ })(jQuery);
js/admin.js CHANGED
@@ -1,99 +1,94 @@
1
- (function ($) {
2
 
3
- $(document).ready(function () {
 
 
 
 
 
 
4
 
5
- // default chosen
6
- $('.pvc-chosen').chosen({
7
- disable_search_threshold: 8,
8
- display_selected_options: false,
9
- search_contains: true,
10
- width: '300px'
11
- });
12
 
 
 
 
 
 
13
 
14
- // time types and position
15
- $('.pvc-chosen-short').chosen({
16
- disable_search_threshold: 8,
17
- width: '200px'
18
- });
19
 
 
 
 
 
20
 
21
- // ask whether to reset options to defaults
22
- $(document).on('click', '.reset_pvc_settings', function () {
23
- return confirm(pvcArgsSettings.resetToDefaults);
24
- });
25
 
 
 
 
 
 
 
26
 
27
- // remove ip box
28
- $(document).on('click', '.remove-exclude-ip', function () {
29
- var parent = $(this).parent(),
30
- nextParent = parent.parent(),
31
- addButton = parent.find('.add-exclude-ip').hide(),
32
- addCurrentIPButton = parent.find('.add-current-ip').hide();
33
 
34
- // remove ip box
35
- parent.remove();
36
 
37
- var children = nextParent.find('div');
 
 
 
 
38
 
39
- // was there add button?
40
- if (addButton.length === 1) {
41
- children.last().append(addButton.show(), ' ', addCurrentIPButton.show());
42
- // children.last().append();
43
- }
44
 
45
- // only one ip box left?
46
- if (children.length === 1) {
47
- children.find('.remove-exclude-ip').hide();
48
- }
49
- });
50
 
 
 
 
 
51
 
52
- // add ip box
53
- $(document).on('click', '.add-exclude-ip', function () {
54
- var parent = $(this).parent(),
55
- newBox = parent.clone().hide();
56
 
57
- // clear value
58
- newBox.find('input').first().val('');
 
59
 
60
- // remove add buttons
61
- $(this).remove();
62
- parent.find('.add-current-ip').remove();
63
 
64
- // add and display new ip box
65
- parent.after(newBox.show());
66
 
67
- parent.parent().find('.remove-exclude-ip').show();
68
- });
69
 
 
 
 
 
 
70
 
71
- // add current ip
72
- $(document).on('click', '.add-current-ip', function () {
73
- // fills input with user's current ip
74
- $(this).parent().find('input').first().val($(this).attr('data-rel'));
75
- });
76
 
 
 
 
77
 
78
- // display user roles if needed
79
- $(document).on('change', '.pvc-chosen-groups', function () {
80
- var foundRoles = false;
 
 
 
81
 
82
- // check whether roles are selected
83
- $(this).find(':selected').each(function (i, item) {
84
- if (item.value === 'roles') {
85
- foundRoles = true;
86
- }
87
- });
88
-
89
- // are roles selected?
90
- if (foundRoles) {
91
- $(this).parent().find('.pvc_user_roles').fadeIn(300);
92
- } else {
93
- $(this).parent().find('.pvc_user_roles').fadeOut(300);
94
- }
95
- });
96
-
97
- });
98
-
99
- })(jQuery);
1
+ jQuery(document).ready(function($) {
2
 
3
+ // default chosen
4
+ $('.pvc-chosen').chosen({
5
+ disable_search_threshold: 8,
6
+ display_selected_options: false,
7
+ search_contains: true,
8
+ width: '300px'
9
+ });
10
 
 
 
 
 
 
 
 
11
 
12
+ // time types and position
13
+ $('.pvc-chosen-short').chosen({
14
+ disable_search_threshold: 8,
15
+ width: '200px'
16
+ });
17
 
 
 
 
 
 
18
 
19
+ // ask whether reset options to defaults
20
+ $(document).on('click', '.reset_pvc_settings', function() {
21
+ return confirm(pvcArgsSettings.resetToDefaults);
22
+ });
23
 
 
 
 
 
24
 
25
+ // removes ip box
26
+ $(document).on('click', '.remove-exclude-ip', function() {
27
+ var parent = $(this).parent(),
28
+ nextParent = parent.parent(),
29
+ addButton = parent.find('.add-exclude-ip').hide(),
30
+ addCurrentIPButton = parent.find('.add-current-ip').hide();
31
 
32
+ // removes ip box
33
+ parent.remove();
 
 
 
 
34
 
35
+ var children = nextParent.find('div');
 
36
 
37
+ // was there add button?
38
+ if(addButton.length === 1) {
39
+ children.last().append(addButton.show(), ' ', addCurrentIPButton.show());
40
+ // children.last().append();
41
+ }
42
 
43
+ // only one ip box left?
44
+ if(children.length === 1) {
45
+ children.find('.remove-exclude-ip').hide();
46
+ }
47
+ });
48
 
 
 
 
 
 
49
 
50
+ // adds ip box
51
+ $(document).on('click', '.add-exclude-ip', function() {
52
+ var parent = $(this).parent(),
53
+ newBox = parent.clone().hide();
54
 
55
+ // clears value
56
+ newBox.find('input').first().val('');
 
 
57
 
58
+ // removes add buttons
59
+ $(this).remove();
60
+ parent.find('.add-current-ip').remove();
61
 
62
+ // adds and displays new ip box
63
+ parent.after(newBox.show());
 
64
 
65
+ parent.parent().find('.remove-exclude-ip').show();
66
+ });
67
 
 
 
68
 
69
+ // adds current ip
70
+ $(document).on('click', '.add-current-ip', function() {
71
+ // fills input with user's current ip
72
+ $(this).parent().find('input').first().val($(this).attr('data-rel'));
73
+ });
74
 
 
 
 
 
 
75
 
76
+ // displays user roles if needed
77
+ $(document).on('change', '.pvc-chosen-groups', function() {
78
+ var foundRoles = false;
79
 
80
+ // checks whether roles are selected
81
+ $(this).find(':selected').each(function(i, item) {
82
+ if(item.value === 'roles') {
83
+ foundRoles = true;
84
+ }
85
+ });
86
 
87
+ // are roles selected?
88
+ if(foundRoles) {
89
+ $(this).parent().find('.pvc_user_roles').fadeIn(300);
90
+ } else {
91
+ $(this).parent().find('.pvc_user_roles').fadeOut(300);
92
+ }
93
+ });
94
+ });
 
 
 
 
 
 
 
 
 
 
languages/post-views-counter-pl_PL.mo CHANGED
Binary file
languages/post-views-counter-pl_PL.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
- "POT-Creation-Date: 2015-04-07 21:48+0100\n"
5
- "PO-Revision-Date: 2015-04-07 21:52+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: pl_PL\n"
@@ -17,10 +17,27 @@ msgstr ""
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
- #: ../includes/columns.php:81 ../includes/columns.php:88
 
21
  msgid "Post Views"
22
  msgstr "Odwiedziny"
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  #: ../includes/cron.php:51
25
  msgid "Post Views Counter reset daily counts interval"
26
  msgstr ""
@@ -453,11 +470,11 @@ msgstr "WYświetlanie miniatury?"
453
  msgid "Thumbnail size"
454
  msgstr "WIelkość miniatury"
455
 
456
- #: ../post-views-counter.php:278
457
  msgid "Are you sure you want to reset these settings to defaults?"
458
  msgstr "Czy jesteś pewny, że chcesz zresetować ustawienia do domyślnych?"
459
 
460
- #: ../post-views-counter.php:310
461
  msgid "Settings"
462
  msgstr "Ustawienia"
463
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
+ "POT-Creation-Date: 2015-04-08 18:59+0100\n"
5
+ "PO-Revision-Date: 2015-04-08 19:00+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: pl_PL\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
+ #: ../includes/columns.php:45 ../includes/columns.php:183
21
+ #: ../includes/columns.php:190
22
  msgid "Post Views"
23
  msgstr "Odwiedziny"
24
 
25
+ #: ../includes/columns.php:49
26
+ msgid "Edit"
27
+ msgstr "Edytuj"
28
+
29
+ #: ../includes/columns.php:53
30
+ msgid "Adjust the views count for this post."
31
+ msgstr "Zmodyfikuj liczbę odsłon tego wpisu."
32
+
33
+ #: ../includes/columns.php:57
34
+ msgid "OK"
35
+ msgstr "OK"
36
+
37
+ #: ../includes/columns.php:58
38
+ msgid "Cancel"
39
+ msgstr "Anuluj"
40
+
41
  #: ../includes/cron.php:51
42
  msgid "Post Views Counter reset daily counts interval"
43
  msgstr ""
470
  msgid "Thumbnail size"
471
  msgstr "WIelkość miniatury"
472
 
473
+ #: ../post-views-counter.php:297
474
  msgid "Are you sure you want to reset these settings to defaults?"
475
  msgstr "Czy jesteś pewny, że chcesz zresetować ustawienia do domyślnych?"
476
 
477
+ #: ../post-views-counter.php:330
478
  msgid "Settings"
479
  msgstr "Ustawienia"
480
 
languages/post-views-counter.pot CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
- "POT-Creation-Date: 2015-04-07 21:47+0100\n"
5
- "PO-Revision-Date: 2015-04-07 21:47+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: en\n"
@@ -17,10 +17,27 @@ msgstr ""
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
- #: ../includes/columns.php:81 ../includes/columns.php:88
 
21
  msgid "Post Views"
22
  msgstr ""
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  #: ../includes/cron.php:51
25
  msgid "Post Views Counter reset daily counts interval"
26
  msgstr ""
@@ -435,10 +452,10 @@ msgstr ""
435
  msgid "Thumbnail size"
436
  msgstr ""
437
 
438
- #: ../post-views-counter.php:278
439
  msgid "Are you sure you want to reset these settings to defaults?"
440
  msgstr ""
441
 
442
- #: ../post-views-counter.php:310
443
  msgid "Settings"
444
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
+ "POT-Creation-Date: 2015-04-08 18:59+0100\n"
5
+ "PO-Revision-Date: 2015-04-08 18:59+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: en\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
+ #: ../includes/columns.php:45 ../includes/columns.php:183
21
+ #: ../includes/columns.php:190
22
  msgid "Post Views"
23
  msgstr ""
24
 
25
+ #: ../includes/columns.php:49
26
+ msgid "Edit"
27
+ msgstr ""
28
+
29
+ #: ../includes/columns.php:53
30
+ msgid "Adjust the views count for this post."
31
+ msgstr ""
32
+
33
+ #: ../includes/columns.php:57
34
+ msgid "OK"
35
+ msgstr ""
36
+
37
+ #: ../includes/columns.php:58
38
+ msgid "Cancel"
39
+ msgstr ""
40
+
41
  #: ../includes/cron.php:51
42
  msgid "Post Views Counter reset daily counts interval"
43
  msgstr ""
452
  msgid "Thumbnail size"
453
  msgstr ""
454
 
455
+ #: ../post-views-counter.php:297
456
  msgid "Are you sure you want to reset these settings to defaults?"
457
  msgstr ""
458
 
459
+ #: ../post-views-counter.php:330
460
  msgid "Settings"
461
  msgstr ""
post-views-counter.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Post Views Counter
4
  Description: Forget WP-PostViews. Display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
5
- Version: 1.0.6
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
@@ -41,7 +41,7 @@ include_once(POST_VIEWS_COUNTER_PATH.'includes/widgets.php');
41
  * Post Views Counter class
42
  *
43
  * @class Post_Views_Counter
44
- * @version 1.0.6
45
  */
46
  class Post_Views_Counter {
47
  private static $_instance;
@@ -88,7 +88,7 @@ class Post_Views_Counter {
88
  'link_to_post' => true,
89
  'icon_class' => 'dashicons-visibility'
90
  ),
91
- 'version' => '1.0.6'
92
  );
93
 
94
 
@@ -252,45 +252,65 @@ class Post_Views_Counter {
252
  * Enqueue admin scripts and styles
253
  */
254
  public function admin_scripts_styles($page) {
255
- // load on PVC settings page only
256
- if ($page === 'settings_page_post-views-counter') {
257
- wp_register_script(
258
- 'post-views-counter-admin-chosen',
259
- POST_VIEWS_COUNTER_URL.'/assets/chosen/chosen.jquery.min.js',
260
- array('jquery'),
261
- $this->defaults['version']
262
- );
263
 
264
- wp_register_script(
265
- 'post-views-counter-admin',
266
- POST_VIEWS_COUNTER_URL.'/js/admin.js',
267
- array('jquery', 'post-views-counter-admin-chosen'),
268
- $this->defaults['version']
269
- );
 
 
 
 
 
270
 
271
- wp_enqueue_script('post-views-counter-admin-chosen');
272
- wp_enqueue_script('post-views-counter-admin');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
 
274
  wp_localize_script(
275
- 'post-views-counter-admin',
276
  'pvcArgsSettings',
277
  array(
278
  'resetToDefaults' => __('Are you sure you want to reset these settings to defaults?', 'post-views-counter')
279
  )
280
  );
281
 
282
- wp_register_style(
283
- 'post-views-counter-admin',
284
- POST_VIEWS_COUNTER_URL.'/css/admin.css'
285
- );
286
-
287
- wp_register_style(
288
- 'post-views-counter-chosen',
289
- POST_VIEWS_COUNTER_URL.'/assets/chosen/chosen.min.css'
290
- );
291
-
292
- wp_enqueue_style('post-views-counter-chosen');
293
- wp_enqueue_style('post-views-counter-admin');
 
294
  }
295
  }
296
 
2
  /*
3
  Plugin Name: Post Views Counter
4
  Description: Forget WP-PostViews. Display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
5
+ Version: 1.0.7
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
41
  * Post Views Counter class
42
  *
43
  * @class Post_Views_Counter
44
+ * @version 1.0.7
45
  */
46
  class Post_Views_Counter {
47
  private static $_instance;
88
  'link_to_post' => true,
89
  'icon_class' => 'dashicons-visibility'
90
  ),
91
+ 'version' => '1.0.7'
92
  );
93
 
94
 
252
  * Enqueue admin scripts and styles
253
  */
254
  public function admin_scripts_styles($page) {
255
+
256
+ wp_register_style(
257
+ 'pvc-admin',
258
+ POST_VIEWS_COUNTER_URL.'/css/admin.css'
259
+ );
 
 
 
260
 
261
+ wp_register_style(
262
+ 'pvc-chosen',
263
+ POST_VIEWS_COUNTER_URL.'/assets/chosen/chosen.min.css'
264
+ );
265
+
266
+ wp_register_script(
267
+ 'pvc-admin-chosen',
268
+ POST_VIEWS_COUNTER_URL.'/assets/chosen/chosen.jquery.min.js',
269
+ array('jquery'),
270
+ $this->defaults['version']
271
+ );
272
 
273
+ wp_register_script(
274
+ 'pvc-admin-settings',
275
+ POST_VIEWS_COUNTER_URL.'/js/admin-settings.js',
276
+ array('jquery', 'pvc-admin-chosen'),
277
+ $this->defaults['version']
278
+ );
279
+
280
+ wp_register_script(
281
+ 'pvc-admin-post',
282
+ POST_VIEWS_COUNTER_URL.'/js/admin-post.js',
283
+ array('jquery'),
284
+ $this->defaults['version']
285
+ );
286
+
287
+ // load on PVC settings page
288
+ if ($page === 'settings_page_post-views-counter') {
289
+
290
+ wp_enqueue_script('pvc-admin-chosen');
291
+ wp_enqueue_script('pvc-admin-settings');
292
 
293
  wp_localize_script(
294
+ 'pvc-admin-settings',
295
  'pvcArgsSettings',
296
  array(
297
  'resetToDefaults' => __('Are you sure you want to reset these settings to defaults?', 'post-views-counter')
298
  )
299
  );
300
 
301
+ wp_enqueue_style('pvc-chosen');
302
+ wp_enqueue_style('pvc-admin');
303
+
304
+ // load on single post page
305
+ } elseif ($page = 'post.php') {
306
+
307
+ $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
308
+
309
+ if (!in_array(get_post_type(), (array)$post_types))
310
+ return;
311
+
312
+ wp_enqueue_style('pvc-admin');
313
+ wp_enqueue_script('pvc-admin-post');
314
  }
315
  }
316
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.dfactory.eu/
4
  Tags: counter, hits, postviews, post views, views, count
5
  Requires at least: 3.8.0
6
  Tested up to: 4.1.1
7
- Stable tag: 1.0.6
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -20,6 +20,7 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
20
 
21
  * Option to select post types for which post views will be counted and displayed.
22
  * 2 methods of collecting post views data: PHP and Javascript, for greater flexibility
 
23
  * Option to set time between counts
24
  * Excluding counts from visitors: bots, logged in users, selected user roles
25
  * Excluding users by IPs
@@ -27,6 +28,8 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
27
  * One-click data import from WP-PostViews
28
  * Post views display position, automatic or manual via shortcode
29
  * W3 Cache/WP SuperCache compatible
 
 
30
  * WPML and Polylang compatible
31
  * .pot file for translations included
32
 
@@ -57,6 +60,10 @@ No questions yet.
57
 
58
  == Changelog ==
59
 
 
 
 
 
60
  = 1.0.6 =
61
  * New: Object cache support, thanks to [Tomas Trkulja](http://zytzagoo.net/blog/)
62
  * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
@@ -80,6 +87,5 @@ Initial release
80
 
81
  == Upgrade Notice ==
82
 
83
- = 1.0.6 =
84
- * New: Object cache support, thanks to [Tomas Trkulja](http://zytzagoo.net/blog/)
85
- * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
4
  Tags: counter, hits, postviews, post views, views, count
5
  Requires at least: 3.8.0
6
  Tested up to: 4.1.1
7
+ Stable tag: 1.0.7
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
20
 
21
  * Option to select post types for which post views will be counted and displayed.
22
  * 2 methods of collecting post views data: PHP and Javascript, for greater flexibility
23
+ * Possibility to manually set views count for each post
24
  * Option to set time between counts
25
  * Excluding counts from visitors: bots, logged in users, selected user roles
26
  * Excluding users by IPs
28
  * One-click data import from WP-PostViews
29
  * Post views display position, automatic or manual via shortcode
30
  * W3 Cache/WP SuperCache compatible
31
+ * Optional object cache support
32
+ * Post views admin column
33
  * WPML and Polylang compatible
34
  * .pot file for translations included
35
 
60
 
61
  == Changelog ==
62
 
63
+ = 1.0.7 =
64
+ * New: Possibility to manually set views count for each post
65
+ * New: Plugin development moved to [dFactory GitHub Repository](https://github.com/dfactoryplugins)
66
+
67
  = 1.0.6 =
68
  * New: Object cache support, thanks to [Tomas Trkulja](http://zytzagoo.net/blog/)
69
  * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
87
 
88
  == Upgrade Notice ==
89
 
90
+ = 1.0.7 =
91
+ * New: Possibility to manually set views count for each post