You are here

class SuperGlobalVariables in Anti Spam by CleanTalk 8.4

Same name and namespace in other branches
  1. 9.1.x src/lib/Cleantalk/Common/Variables/SuperGlobalVariables.php \Cleantalk\Common\Variables\SuperGlobalVariables

Class ServerVariables Safety handler for ${_SOMETHING}

@depends \Cleantalk\Common\Templates\Singleton

@usage \CleantalkSP\Variables\{SOMETHING}::get( $name );

@package \CleantalkSP\Variables

Hierarchy

Expanded class hierarchy of SuperGlobalVariables

File

src/lib/Cleantalk/Common/Variables/SuperGlobalVariables.php, line 17

Namespace

Cleantalk\Common\Variables
View source
class SuperGlobalVariables {
  use Singleton;

  /**
   * @var array Contains saved variables
   */
  public $variables = [];

  /**
   * Gets variable from ${_SOMETHING}
   *
   * @param string $name Variable name
   *
   * @return string
   */
  public static function get($name) {
    return static::getInstance()
      ->get_variable($name);
  }

  /**
   * BLUEPRINT
   * Gets given ${_SOMETHING} variable and seva it to memory
   * @param $name
   *
   * @return mixed|string
   */
  protected function get_variable($name) {
    return true;
  }

  /**
   * Save variable to $this->variables[]
   *
   * @param string $name
   * @param string $value
   */
  protected function remember_variable($name, $value) {
    static::$instance->variables[$name] = $value;
  }

  /**
   * Checks if variable contains given string
   *
   * @param string $var    Haystack to search in
   * @param string $string Needle to search
   *
   * @return bool|int
   */
  static function has_string($var, $string) {
    return stripos(self::get($var), $string) !== false;
  }

  /**
   * Checks if variable equal to $param
   *
   * @param string $var   Variable to compare
   * @param string $param Param to compare
   *
   * @return bool|int
   */
  static function equal($var, $param) {
    return self::get($var) == $param;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Singleton::$instance public static property 5
Singleton::getInstance public static function Constructor
Singleton::init protected function Alternative constructor
Singleton::__clone public function
Singleton::__construct public function
Singleton::__wakeup public function
SuperGlobalVariables::$variables public property *
SuperGlobalVariables::equal static function * Checks if variable equal to $param * *
SuperGlobalVariables::get public static function * Gets variable from ${_SOMETHING} * *
SuperGlobalVariables::get_variable protected function * BLUEPRINT * Gets given ${_SOMETHING} variable and seva it to memory * 5
SuperGlobalVariables::has_string static function * Checks if variable contains given string * *
SuperGlobalVariables::remember_variable protected function * Save variable to $this->variables[] * *