You are here

class CustomFilter in Custom filter 6.2

@file Allow users to define custom filters.

Hierarchy

Expanded class hierarchy of CustomFilter

File

./customfilter.module, line 8
Allow users to define custom filters.

View source
class CustomFilter implements ArrayAccess {
  const API_VERSION = '2.1';
  const API_MINIMUM_VERSION = '2.1';
  private static $instance;
  private $vars = array();
  public function __call($name, $arguments) {
    $flist = array();
    foreach (module_implements('customfilter_api') as $module) {
      $result = module_invoke($module, 'customfilter_api');
      $bool = array(
        isset($result) && is_array($result) && isset($result['version']) && version_compare($result['version'], self::API_MINIMUM_VERSION, '>') && version_compare($result['version'], self::API_VERSION, '<'),
      );
      if ($bool) {
        $result = module_invoke($module, 'customfilter_function_info');
        if (isset($result) && is_array($result)) {
          $flist = array_merge($flist, $result);
        }
      }
    }
    if (isset($flist[$name])) {
      $result = call_user_func_array($flist[$name]['function'], $arguments);
      if (isset($result)) {
        return $result;
      }
      else {
        return '';
      }
    }
    else {
      return '';
    }
  }
  private function __clone() {
  }
  private function __construct() {
  }
  public function __get($name) {
    return isset($this->vars[$name]) ? $this->vars[$name] : NULL;
  }
  public function __isset($name) {
    return isset($this->vars[$name]);
  }
  public function __set($name, $value) {
    $this->vars[$name] = $value;
  }
  public function __unset($name) {
    unset($this->vars[$name]);
  }
  public function offsetExists($offset) {
    return isset($this->vars[$offset]);
  }
  public function offsetGet($offset) {
    return isset($this->vars[$offset]) ? $this->vars[$offset] : NULL;
  }
  public function offsetSet($offset, $value) {
    $this->vars[$offset] = $value;
  }
  public function offsetUnset($offset) {
    unset($this->vars[$offset]);
  }
  public static function singleton() {
    if (!isset(self::$instance)) {
      self::$instance = new CustomFilter();
    }
    return self::$instance;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CustomFilter::$instance private static property
CustomFilter::$vars private property
CustomFilter::API_MINIMUM_VERSION constant
CustomFilter::API_VERSION constant
CustomFilter::offsetExists public function
CustomFilter::offsetGet public function
CustomFilter::offsetSet public function
CustomFilter::offsetUnset public function
CustomFilter::singleton public static function
CustomFilter::__call public function
CustomFilter::__clone private function
CustomFilter::__construct private function
CustomFilter::__get public function
CustomFilter::__isset public function
CustomFilter::__set public function
CustomFilter::__unset public function