Commit 0368e208 authored by Vadim's avatar Vadim

Version: 2.10.0

* возможность отключить счетчик посещений на странице
parent 08f6405c
......@@ -3,7 +3,7 @@
Plugin Name: Bg Az-Counter
Plugin URI: https://bogaiskov.ru
Description: Подсчет количества посещений страниц на базе stat.azbyka.ru
Version: 2.9.2
Version: 2.10.0
Author: VBog
Author URI: https://bogaiskov.ru
License: GPL2
......@@ -38,7 +38,7 @@
if ( !defined('ABSPATH') ) {
die( 'Sorry, you are not allowed to access this page directly.' );
}
define('BG_COUNTER_VERSION', '2.9.2');
define('BG_COUNTER_VERSION', '2.10.0');
define('BG_COUNTER_LOG', dirname(__FILE__ ).'/bg_counter.log');
define('BG_COUNTER_STAT_COUNTERS','https://stat.azbyka.ru/counters');
......@@ -125,6 +125,7 @@ function bg_counter_enqueue_frontend_scripts () {
'project' => $project, // Имя текущего проекта, например, '/propovedi'
'type' => $type, // Тип объекта 'post', 'category', 'tag', 'index' или пусто
'ID' => $theID, // ID объекта
'countviews' => get_post_meta($post->ID, 'отключить_счетчик',true)?'':'on',
'votes5' => 'голосов',
'votes2' => 'голоcа',
'vote1' => 'голос',
......@@ -183,6 +184,7 @@ function azbyka_falsification_box_func( $post ){
<input type="number" name="azbyka_falsh_counts" value="" min=1 /><br>и нажмите кнопку "Опубликовать/Обновить".
</label>
<i>Если оставить поле пустым, счетчик сохранит свое истинное значение.</i><br>
<label><input type="checkbox" name="bg_az_counter_not_counting"<?php echo (get_post_meta($post->ID, 'отключить_счетчик',true)?' checked="checked"':'');?> /> Отключить счетчик посещений</label><br>
<label><input type="checkbox" name="bg_az_counter_not_rating"<?php echo (get_post_meta($post->ID, 'не_отображать_рейтинг',true)?' checked="checked"':'');?> /> Не отображать рейтинг</label>
<?php
}
......@@ -205,6 +207,7 @@ function azbyka_falsification_update( $post_id ){
$path = '/post/'.$post_id;
if ($counter > 0) setCount ($path, $counter);
}
update_post_meta($post_id, 'отключить_счетчик', $_POST['bg_az_counter_not_counting']);
update_post_meta($post_id, 'не_отображать_рейтинг', $_POST['bg_az_counter_not_rating']);
}
......@@ -240,6 +240,7 @@ function bg_az_counter_views ($type=null, $id=null, $now=null, $rate=null, $view
}
if ($type != 'post') $rate = null;
if (get_post_meta($id, 'не_отображать_рейтинг',true)) $rate = null;
if (get_post_meta($id, 'отключить_счетчик',true)) $views = null;
if ($id) {
$link = get_permalink($id);
......
......@@ -10,7 +10,7 @@ jQuery( document ).ready(function() {
**********************************************************************************/
if (bg_counter.ID) {
SendOnce(bg_counter.type, bg_counter.ID);
if (bg_counter.countviews) SendOnce(bg_counter.type, bg_counter.ID);
var request = bg_counter.websocket+bg_counter.project+"/"+bg_counter.type+"/"+bg_counter.ID;
// Используется библиотека ReconnectingWebSocket (https://github.com/joewalnes/reconnecting-websocket)
// для переподключения сокета при разрыве соединения.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment