You are here

private static function CleantalkFuncs::_apbct_getcookie in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 7.4 src/CleantalkFuncs.php \CleantalkFuncs::_apbct_getcookie()

Get our variables from cookies OR sessions

Parameters

$name string Name of necessary variable to get:

Return value

string|null

4 calls to CleantalkFuncs::_apbct_getcookie()
CleantalkFuncs::_cleantalk_apbct_cookies_set in src/CleantalkFuncs.php
CleantalkFuncs::_cleantalk_apbct_cookies_test in src/CleantalkFuncs.php
Cookie test
CleantalkFuncs::_cleantalk_check_spam in src/CleantalkFuncs.php
Cleantalk inner function - performs antispam checking.
CleantalkFuncs::_cleantalk_get_submit_time in src/CleantalkFuncs.php

File

src/CleantalkFuncs.php, line 116

Class

CleantalkFuncs
Cleantalk class create request

Code

private static function _apbct_getcookie($name) {
  if (variable_get('cleantalk_alternative_cookies_session', 0)) {

    // From database
    $value = db_query("SELECT value FROM {cleantalk_sessions} WHERE id = :id AND name = :name", array(
      ':id' => self::_apbct_alt_session__id__get(),
      ':name' => $name,
    ))
      ->fetchField();
    if (false !== $value) {
      return $value;
    }
    else {
      return null;
    }
  }
  else {

    // From cookies
    if (isset($_COOKIE[$name])) {
      return $_COOKIE[$name];
    }
    else {
      return null;
    }
  }
}