Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
conversionhandlers.php
1
<?php
2
3
namespace
Bitrix\Blog\Internals
;
4
5
use
Bitrix\Conversion\Config
;
6
use
Bitrix\Conversion\DayContext
;
7
use
Bitrix\Main\Loader
;
8
use
Bitrix\Main\Localization\Loc
;
9
10
Loc::loadMessages
(__FILE__);
11
12
final
class
ConversionHandlers
13
{
14
20
public
static
function
onGetCounterTypes
()
21
{
22
return
array(
23
'blog_post_add_day'
=> array(
'MODULE'
=>
'blog'
,
'GROUP'
=>
'day'
,
'NAME'
=>
'Post'
),
24
);
25
}
26
32
public
static
function
onGetRateTypes
()
33
{
34
$scale = array(0.5, 1, 1.5, 2, 5);
35
36
return
array(
37
'blog_post'
=> array(
38
'NAME'
=>
Loc::getMessage
(
'BLOG_CONVERSION_RATE_POST_TITLE'
),
39
'SCALE'
=> $scale,
40
'MODULE'
=>
'blog'
,
41
'SORT'
=> 4000,
42
'COUNTERS'
=> array(
'conversion_visit_day'
,
'blog_post_add_day'
),
43
'CALCULATE'
=>
function
(array $counters)
44
{
45
$denominator = $counters[
'conversion_visit_day'
] ?: 0;
46
$numerator = $counters[
'blog_post_add_day'
] ?: 0;
47
48
return
array(
49
'DENOMINATOR'
=> $denominator,
50
'NUMERATOR'
=> $numerator,
51
'RATE'
=> $denominator ? $numerator / $denominator : 0,
52
);
53
},
54
),
55
);
56
}
57
65
public
static
function
onPostAdd
($id, $fields)
66
{
67
if
(Loader::includeModule(
'conversion'
))
68
{
69
$context = DayContext::getInstance();
70
$context->addDayCounter(
'blog_post_add_day'
, 1);
71
}
72
}
73
74
}
Bitrix\Blog\Internals\ConversionHandlers
Definition
conversionhandlers.php:13
Bitrix\Blog\Internals\ConversionHandlers\onGetRateTypes
static onGetRateTypes()
Definition
conversionhandlers.php:32
Bitrix\Blog\Internals\ConversionHandlers\onPostAdd
static onPostAdd($id, $fields)
Definition
conversionhandlers.php:65
Bitrix\Blog\Internals\ConversionHandlers\onGetCounterTypes
static onGetCounterTypes()
Definition
conversionhandlers.php:20
Bitrix\Conversion\Config
Definition
config.php:9
Bitrix\Conversion\DayContext
Definition
daycontext.php:14
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Blog\Internals
Definition
bloguser.php:2
modules
blog
lib
internals
conversionhandlers.php
Создано системой
1.10.0