XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
Switch.php
Go to the documentation of this file.
1 <?php
2 
7 {
8 
9  protected $tag;
10  protected $withTag, $withoutTag;
11 
17  public function __construct($tag, $with_tag, $without_tag) {
18  $this->tag = $tag;
19  $this->withTag = $with_tag;
20  $this->withoutTag = $without_tag;
21  }
22 
23  public function validate($string, $config, $context) {
24  $token = $context->get('CurrentToken', true);
25  if (!$token || $token->name !== $this->tag) {
26  return $this->withoutTag->validate($string, $config, $context);
27  } else {
28  return $this->withTag->validate($string, $config, $context);
29  }
30  }
31 
32 }
33 
34 // vim: et sw=4 sts=4