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
c44f8fc1
Commit
c44f8fc1
authored
Dec 13, 2019
by
Vadim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version 2.7.4
* Добавлены в виджеты пользовательские типы записей
parent
7a7e7cb0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
bg_az-counter.php
bg_az-counter.php
+2
-2
counter.php
inc/counter.php
+12
-3
widgets.php
inc/widgets.php
+8
-1
No files found.
bg_az-counter.php
View file @
c44f8fc1
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Plugin Name: Bg Az-Counter
Plugin Name: Bg Az-Counter
Plugin URI: https://bogaiskov.ru
Plugin URI: https://bogaiskov.ru
Description: Подсчет количества посещений страниц на базе stat.azbyka.ru
Description: Подсчет количества посещений страниц на базе stat.azbyka.ru
Version: 2.7.
3
Version: 2.7.
4
Author: VBog
Author: VBog
Author URI: https://bogaiskov.ru
Author URI: https://bogaiskov.ru
License: GPL2
License: GPL2
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
if
(
!
defined
(
'ABSPATH'
)
)
{
if
(
!
defined
(
'ABSPATH'
)
)
{
die
(
'Sorry, you are not allowed to access this page directly.'
);
die
(
'Sorry, you are not allowed to access this page directly.'
);
}
}
define
(
'BG_COUNTER_VERSION'
,
'2.7.
3
'
);
define
(
'BG_COUNTER_VERSION'
,
'2.7.
4
'
);
define
(
'BG_COUNTER_LOG'
,
dirname
(
__FILE__
)
.
'/bg_counter.log'
);
define
(
'BG_COUNTER_LOG'
,
dirname
(
__FILE__
)
.
'/bg_counter.log'
);
define
(
'BG_COUNTER_STAT_COUNTERS'
,
'https://stat.azbyka.ru/counters'
);
define
(
'BG_COUNTER_STAT_COUNTERS'
,
'https://stat.azbyka.ru/counters'
);
...
...
inc/counter.php
View file @
c44f8fc1
...
@@ -260,11 +260,20 @@ function bg_counter_top_posts_shortcode( $atts ) {
...
@@ -260,11 +260,20 @@ function bg_counter_top_posts_shortcode( $atts ) {
function
bg_counter_number_format
(
$num
)
{
function
bg_counter_number_format
(
$num
)
{
$num
=
floatval
(
$num
);
$num
=
floatval
(
$num
);
if
(
$num
>
1000000000.0
)
{
if
(
$num
>
1000000000.0
)
{
$num
=
round
(
$num
/
1000000000.0
,
1
)
.
" млрд."
;
if
(
$num
>
10000000000.0
)
$num
=
round
(
$num
/
1000000000.0
,
0
)
.
" млрд."
;
else
$num
=
round
(
$num
/
1000000000.0
,
1
)
.
" млрд."
;
}
elseif
(
$num
>
1000000.0
)
{
}
elseif
(
$num
>
1000000.0
)
{
$num
=
round
(
$num
/
1000000.0
,
1
)
.
" млн."
;
if
(
$num
>
10000000.0
)
$num
=
round
(
$num
/
1000000.0
,
0
)
.
" млн."
;
else
$num
=
round
(
$num
/
1000000.0
,
1
)
.
" млн."
;
}
elseif
(
$num
>
10000.0
)
{
}
elseif
(
$num
>
10000.0
)
{
$num
=
round
(
$num
/
1000.0
,
1
)
.
" тыс."
;
if
(
$num
>
100000.0
)
$num
=
round
(
$num
/
1000.0
,
0
)
.
" тыс."
;
else
$num
=
round
(
$num
/
1000.0
,
1
)
.
" тыс."
;
}
else
{
}
else
{
$num
=
number_format
(
$num
,
0
,
','
,
' '
);
$num
=
number_format
(
$num
,
0
,
','
,
' '
);
}
}
...
...
inc/widgets.php
View file @
c44f8fc1
...
@@ -96,6 +96,13 @@ class bg_counter_OnlineNowWidget extends WP_Widget {
...
@@ -96,6 +96,13 @@ class bg_counter_OnlineNowWidget extends WP_Widget {
if
(
!
empty
(
$title
)
)
if
(
!
empty
(
$title
)
)
echo
$args
[
'before_title'
]
.
$title
.
$args
[
'after_title'
];
echo
$args
[
'before_title'
]
.
$title
.
$args
[
'after_title'
];
$post_types_count
=
0
;
$post_types
=
get_post_types
(
[
'publicly_queryable'
=>
1
]
);
unset
(
$post_types
[
'attachment'
]
);
// удалим attachment
foreach
(
$post_types
as
$post_type
)
{
$post_types_count
+=
wp_count_posts
(
$post_type
)
->
publish
;
}
?>
?>
<div
class=
"widget-item"
>
<div
class=
"widget-item"
>
...
@@ -103,7 +110,7 @@ class bg_counter_OnlineNowWidget extends WP_Widget {
...
@@ -103,7 +110,7 @@ class bg_counter_OnlineNowWidget extends WP_Widget {
<span
class=
"bg-az-counter"
>
<span
class=
"bg-az-counter"
>
<p>
<?php
echo
$subtitle1
;
?>
:
<span
class=
"bg-az-counter-now"
></span>
<?php
echo
$unit1
;
?>
</p>
<p>
<?php
echo
$subtitle1
;
?>
:
<span
class=
"bg-az-counter-now"
></span>
<?php
echo
$unit1
;
?>
</p>
<p>
<?php
echo
$subtitle2
;
?>
:
<span
class=
"bg-az-counter-views"
></span></p>
<p>
<?php
echo
$subtitle2
;
?>
:
<span
class=
"bg-az-counter-views"
></span></p>
<p>
<?php
echo
$subtitle3
;
?>
:
<span
class=
"bg-az-counter-posts"
>
<?php
echo
wp_count_posts
()
->
publish
;
?>
</span></p>
<p>
<?php
echo
$subtitle3
;
?>
:
<span
class=
"bg-az-counter-posts"
>
<?php
echo
$post_types_count
;
?>
</span></p>
</span>
</span>
</div>
</div>
...
...
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