Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bg-az-counter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
azbyka_bg
bg-az-counter
Commits
07e57030
Commit
07e57030
authored
May 04, 2020
by
Vadim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version: 2.10.1
* Исправлен NOTES * Поддержка старых страниц вне WP
parent
0368e208
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
bg_az-counter.php
bg_az-counter.php
+6
-3
counter.js
js/counter.js
+2
-1
No files found.
bg_az-counter.php
View file @
07e57030
...
...
@@ -3,7 +3,7 @@
Plugin Name: Bg Az-Counter
Plugin URI: https://bogaiskov.ru
Description: Подсчет количества посещений страниц на базе stat.azbyka.ru
Version: 2.10.
0
Version: 2.10.
1
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.10.
0
'
);
define
(
'BG_COUNTER_VERSION'
,
'2.10.
1
'
);
define
(
'BG_COUNTER_LOG'
,
dirname
(
__FILE__
)
.
'/bg_counter.log'
);
define
(
'BG_COUNTER_STAT_COUNTERS'
,
'https://stat.azbyka.ru/counters'
);
...
...
@@ -93,12 +93,15 @@ function bg_counter_enqueue_frontend_scripts () {
$theID
=
''
;
$type
=
''
;
$countviews
=
'on'
;
if
(
is_single
()
||
is_page
())
{
// Только записи и страницы
$post
=
get_post
();
if
(
$post
->
post_status
==
'publish'
)
{
// Только опубликованные
$theID
=
$post
->
ID
;
$type
=
'post'
;
$countviews
=
get_post_meta
(
$theID
,
'отключить_счетчик'
,
true
)
?
''
:
'on'
;
}
else
$countviews
=
''
;
}
elseif
(
is_category
())
{
$theID
=
get_query_var
(
'cat'
);
$type
=
'category'
;
...
...
@@ -125,7 +128,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'
,
'countviews'
=>
$countviews
,
'votes5'
=>
'голосов'
,
'votes2'
=>
'голоcа'
,
'vote1'
=>
'голос'
,
...
...
js/counter.js
View file @
07e57030
...
...
@@ -10,7 +10,8 @@ jQuery( document ).ready(function() {
**********************************************************************************/
if
(
bg_counter
.
ID
)
{
if
(
bg_counter
.
countviews
)
SendOnce
(
bg_counter
.
type
,
bg_counter
.
ID
);
if
(
typeof
bg_counter
.
countviews
===
'undefined'
)
bg_counter
.
countviews
=
'on'
;
// Поддержка старых страниц вне WP
if
(
bg_counter
.
countviews
==
'on'
)
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)
// для переподключения сокета при разрыве соединения.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment