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
eb9577f0
Commit
eb9577f0
authored
Feb 11, 2020
by
Vadim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version: 2.8.4
* Исправлено отображение статистики на главной странице (page) * Учитывает в количестве записей в виджете посты и страницы
parent
89ffce7b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
bg_az-counter.php
bg_az-counter.php
+4
-3
counter.php
inc/counter.php
+5
-3
widgets.php
inc/widgets.php
+1
-0
No files found.
bg_az-counter.php
View file @
eb9577f0
...
...
@@ -3,7 +3,7 @@
Plugin Name: Bg Az-Counter
Plugin URI: https://bogaiskov.ru
Description: Подсчет количества посещений страниц на базе stat.azbyka.ru
Version: 2.8.
2
Version: 2.8.
4
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.8.
2
'
);
define
(
'BG_COUNTER_VERSION'
,
'2.8.
4
'
);
define
(
'BG_COUNTER_LOG'
,
dirname
(
__FILE__
)
.
'/bg_counter.log'
);
define
(
'BG_COUNTER_STAT_COUNTERS'
,
'https://stat.azbyka.ru/counters'
);
...
...
@@ -64,7 +64,8 @@ if (!isset($project)) {
$project
=
wp_parse_url
(
site_url
(),
PHP_URL_PATH
);
$project
=
ltrim
(
$project
,
'/'
);
if
(
!
$project
)
$project
=
'main'
;
// Главный сайт
else
list
(
$project
)
=
explode
(
'/'
,
$project
);
// else list($project) = explode ('/', $project);
else
$project
=
str_replace
(
'/'
,
'_'
,
$project
);
}
else
{
$project
=
site_url
();
$project
=
wp_parse_url
(
$project
,
PHP_URL_HOST
)
.
wp_parse_url
(
$project
,
PHP_URL_PATH
);
...
...
inc/counter.php
View file @
eb9577f0
...
...
@@ -244,10 +244,12 @@ function bg_az_counter_views ($type=null, $id=null, $now=null, $rate=null, $view
$link
=
get_permalink
(
$id
);
// Получить имя проекта по ссылке
if
(
wp_parse_url
(
$link
,
PHP_URL_HOST
)
==
'azbyka.ru'
)
{
$proj
=
wp_parse_url
(
dirname
(
$link
),
PHP_URL_PATH
);
$proj
=
ltrim
(
$proj
,
'/'
);
if
(
is_front_page
()
&&
!
is_home
())
$proj
=
wp_parse_url
(
$link
,
PHP_URL_PATH
);
else
$proj
=
wp_parse_url
(
dirname
(
$link
),
PHP_URL_PATH
);
$proj
=
trim
(
$proj
,
'/'
);
if
(
!
$proj
)
$proj
=
'main'
;
// Главный сайт
else
list
(
$proj
)
=
explode
(
'/'
,
$proj
);
// else list($proj) = explode ('/', $proj);
else
$proj
=
str_replace
(
'/'
,
'_'
,
$proj
);
}
else
{
$proj
=
dirname
(
$link
);
$proj
=
wp_parse_url
(
$proj
,
PHP_URL_HOST
)
.
wp_parse_url
(
$proj
,
PHP_URL_PATH
);
...
...
inc/widgets.php
View file @
eb9577f0
...
...
@@ -99,6 +99,7 @@ class bg_counter_OnlineNowWidget extends WP_Widget {
$post_types_count
=
0
;
$post_types
=
get_post_types
(
[
'publicly_queryable'
=>
1
]
);
$post_types
[
'page'
]
=
'page'
;
// встроенный тип не имеет publicly_queryable
unset
(
$post_types
[
'attachment'
]
);
// удалим attachment
foreach
(
$post_types
as
$post_type
)
{
$post_types_count
+=
wp_count_posts
(
$post_type
)
->
publish
;
...
...
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