17 require_once SQ_CORE_PACKAGE_PATH.
'/system/conditions/condition/condition.inc';
44 parent::__construct($assetid);
69 if (isset($_COOKIE[
'user_frequency_cond_'.$condition_data[
'id_name']]) && (FALSE !== strpos($_COOKIE[
'user_frequency_cond_'.$condition_data[
'id_name']],
'__'))) {
71 list($data[
'value'], $data[
'last_date']) = explode(
'__', $_COOKIE[
'user_frequency_cond_'.$condition_data[
'id_name']]);
75 'last_date' => time(),
80 $difference = (time() - $data[
'last_date']) / 86400;
84 if ($condition_data[
'units'] ==
'hits') {
85 $hits = (int) $condition_data[
'value'];
87 if (($hits != 0) && (($data[
'value'] % $hits) == 0)) {
97 if ($condition_data[
'units'] ==
'session') {
98 $hits = (int) $condition_data[
'value'];
101 if (($data[
'value'] % $hits) == 0) {
108 if ((
int) $difference) $data[
'value']++;
115 if ($condition_data[
'units'] ==
'days' || $condition_data[
'units'] ==
'hours' || $condition_data[
'units'] ==
'minutes') {
116 if ($condition_data[
'units'] ==
'hours') {
120 if ($condition_data[
'units'] ==
'minutes') {
125 if (((
int) $difference) > $condition_data[
'value']) {
132 $data[
'last_date'] = time();
133 $root_url = str_replace(Array(
'http://',
'https://'),
'', sq_web_path(
'root_url'));
136 if (FALSE !== ($slashpos = strpos($root_url,
'/'))) {
137 $domain = substr($root_url, 0, $slashpos);
138 $path = substr($root_url, $slashpos);
140 setcookie(
'user_frequency_cond_'.$condition_data[
'id_name'], $data[
'value'].
'__'.$data[
'last_date'], strtotime(
'+3 months'), $path, $domain);