Counter_Controller
extends Core_Servant_Properties
in package
Counters.
Tags
Table of Contents
Properties
- $instance : mixed
- The singleton instances.
- $_allowedProperties : array<string|int, mixed>
- Allowed object properties
- $_config : array<string|int, mixed>
- Config value
- $_propertiesValues : array<string|int, mixed>
- Properties values
- $_unlimitedProperties : bool
- Object has unlimited number of properties
Methods
- __construct() : mixed
- Constructor.
- addAllowedProperties() : self
- Add additional allowed properties
- addAllowedProperty() : self
- Add additional allowed property
- alignTextSpace() : string
- Выравнивание текста по центру с помощью пробелов
- applyData() : self
- Сохранение основных данных о посещении
- buildCounter() : self
- Построение счетчика
- checkBot() : bool
- Проверка user-agent на принадлежность к ботам
- getAllSession() : int
- Определение числа сессий для сайта за весь период подсчета статистики.
- getBrowser() : string
- Get browser name
- getDayInformation() : mixed
- Получение данных посещаемости за определенный день. Метод использует кэш "COUNTER_DAY_INFORMATION"
- getDevice() : int
- Get device type by User Agent
- getOs() : string
- Get OS name
- getPrimaryKeyByDate() : mixed
- insertOnUpdate() : mixed
- insertSession() : int
- Get correspond Counter_Session or insert new one
- instance() : object
- Register an existing instance as a singleton.
- ipIsNew() : int
- Определение наличия записи за сегодняшний день для переданного IP адреса для переданного сайта
- isSearchSystem() : mixed
- Определение запроса из поисковой системы. Метод работает с поисковыми системами: - Yandex - Google - Mail.Ru - Aport - Yahoo.com - Metabot - bing.com
- mailReport() : bool
- Отправка письма с отчетом администратору сайта
- set() : self
- Run when writing data to inaccessible properties
- setUnlimitedProperties() : self
- Set unlimitedProperties
- showCounterCode() : Counter_Controller
- Отображение кода счетчика
- update() : mixed
- Update row. If row does not exit, call insertOnUpdate()
- updateData() : self
- Обновление расширенными данными по счетчику
- _clearOldData() : self
- Clear Old Data
- _formatNumber() : string
- Format number
- _getColoredValue() : mixed
Properties
$instance
The singleton instances.
public
static mixed
$instance
= \NULL
$_allowedProperties
Allowed object properties
protected
array<string|int, mixed>
$_allowedProperties
= array('site', 'referrer', 'page', 'cookies', 'java', 'colorDepth', 'display', 'js', 'counterId', 'updateCounter', 'ip', 'userAgent', 'bBot', 'bNewUser', 'bNewSession', 'sessionId', 'siteuserId', 'cleaningFrequency', 'sessionLifeTime')
$_config
Config value
protected
array<string|int, mixed>
$_config
= array()
$_propertiesValues
Properties values
protected
array<string|int, mixed>
$_propertiesValues
= array()
$_unlimitedProperties
Object has unlimited number of properties
protected
bool
$_unlimitedProperties
= \FALSE
Methods
__construct()
Constructor.
public
__construct() : mixed
addAllowedProperties()
Add additional allowed properties
public
addAllowedProperties(array<string|int, mixed> $array) : self
Parameters
- $array : array<string|int, mixed>
-
array of properties' names
Return values
selfaddAllowedProperty()
Add additional allowed property
public
addAllowedProperty(string $property) : self
Parameters
- $property : string
-
property name
Return values
selfalignTextSpace()
Выравнивание текста по центру с помощью пробелов
public
alignTextSpace(int $count_all, string $text) : string
Parameters
- $count_all : int
-
общее Кол-во символов
- $text : string
-
текст
Return values
string —строка с выровненным текстом
applyData()
Сохранение основных данных о посещении
public
applyData() : self
Tags
Return values
selfbuildCounter()
Построение счетчика
public
buildCounter() : self
Return values
selfcheckBot()
Проверка user-agent на принадлежность к ботам
public
static checkBot(string $agent) : bool
Parameters
- $agent : string
-
user-agent
Return values
bool —true, если это бот, false в противном случае
getAllSession()
Определение числа сессий для сайта за весь период подсчета статистики.
public
getAllSession(int $site_id) : int
Parameters
- $site_id : int
-
идентификатор сайта
Return values
int —число сессий для сайта
getBrowser()
Get browser name
public
static getBrowser(string $userAgent) : string
Parameters
- $userAgent : string
-
User agent
Return values
stringgetDayInformation()
Получение данных посещаемости за определенный день. Метод использует кэш "COUNTER_DAY_INFORMATION"
public
getDayInformation(string $date) : mixed
Parameters
- $date : string
-
дата в формате ГГГГ-ММ-ДД
Return values
mixed —array с данными или false, если данные отсутствуют
getDevice()
Get device type by User Agent
public
static getDevice(string $userAgent) : int
Parameters
- $userAgent : string
Return values
int —0 - desktop, 1 - tablet, 2 - phone, 3 - tv, 4 - watch
getOs()
Get OS name
public
static getOs(string $userAgent) : string
Parameters
- $userAgent : string
-
User agent
Return values
stringgetPrimaryKeyByDate()
public
static getPrimaryKeyByDate(mixed $date) : mixed
Parameters
- $date : mixed
insertOnUpdate()
public
insertOnUpdate(mixed $tableName, array<string|int, mixed> $aValues) : mixed
Parameters
- $tableName : mixed
- $aValues : array<string|int, mixed>
insertSession()
Get correspond Counter_Session or insert new one
public
insertSession() : int
Return values
int —sessionId
instance()
Register an existing instance as a singleton.
public
static instance() : object
Return values
objectipIsNew()
Определение наличия записи за сегодняшний день для переданного IP адреса для переданного сайта
public
ipIsNew(string $hexIp, string $sCurrentDate, int $site_id) : int
Parameters
- $hexIp : string
-
упакованный IP-адрес
- $sCurrentDate : string
-
текущая дата
- $site_id : int
-
идентификатор сайта
Return values
int —1 - новый, 0 - не новый
isSearchSystem()
Определение запроса из поисковой системы. Метод работает с поисковыми системами: - Yandex - Google - Mail.Ru - Aport - Yahoo.com - Metabot - bing.com
public
static isSearchSystem(string $str) : mixed
Parameters
- $str : string
-
адрес ссылающейся страницы
Return values
mixed —поисковый запрос или FALSE
mailReport()
Отправка письма с отчетом администратору сайта
public
mailReport(string $date) : bool
Parameters
- $date : string
-
дата отчета
Tags
Return values
bool —false в случае ошибки, в случае успеной отправки метод не возвращет никаких значений
set()
Run when writing data to inaccessible properties
public
set(string $property, string $value) : self
Parameters
- $property : string
-
property name
- $value : string
-
property value
Return values
selfsetUnlimitedProperties()
Set unlimitedProperties
public
setUnlimitedProperties([bool $value = TRUE ]) : self
Parameters
- $value : bool = TRUE
-
default TRUR
Return values
selfshowCounterCode()
Отображение кода счетчика
public
showCounterCode(int $counterId, string $alias_name[, string $get_update_counter = '' ]) : Counter_Controller
Parameters
- $counterId : int
-
тип выводимого счетчика (файл счетчика должен быть расположен в директории /counter/ и представлять собой изображение с именем {НОМЕР}.gif)
- $alias_name : string
-
наименование домена сайта, например www.site.ru
- $get_update_counter : string = ''
-
переменная с информацией о необходимости обновления счетчика, не обязательный параметр, по умолчанию равен пустоте
Return values
Counter_Controller —
showCounterCode(1, Core_Entity::factory('Site', CURRENT_SITE)->getCurrentAlias()->name);
$sCode = ob_get_clean();
?>
update()
Update row. If row does not exit, call insertOnUpdate()
public
update(string $tableName, array<string|int, mixed> $aValues) : mixed
Parameters
- $tableName : string
- $aValues : array<string|int, mixed>
updateData()
Обновление расширенными данными по счетчику
public
updateData() : self
Return values
self_clearOldData()
Clear Old Data
protected
_clearOldData(int $site_id) : self
Parameters
- $site_id : int
Return values
self_formatNumber()
Format number
protected
_formatNumber(int $int) : string
Parameters
- $int : int
Return values
string_getColoredValue()
protected
_getColoredValue(mixed $value) : mixed
Parameters
- $value : mixed