static function getInstance() { if (!isset(self::$instance)) { if (class_exists('RedCat\\Wire\\Di')) { self::$instance = \RedCat\Wire\Di::getInstance()->create(__CLASS__); } else { self::$instance = new self(); } } return self::$instance; }
static function _init() { if (!isset(self::$bases)) { if (class_exists('RedCat\\Wire\\Di') && self::$useWireDi) { self::$bases = \RedCat\Wire\Di::getInstance()->create('RedCat\\DataMap\\Bases'); if (isset(self::$bases[0])) { self::selectDatabase(0); } } else { self::$bases = new Bases(); } } }
function load() { $this->remapAttr('domains'); $this->attr('domains', eval('return ' . $this->domains . ';')); if ($this->attr('no-cache')) { $href = "<?php echo \\RedCat\\Wire\\Di::getInstance()->create('RedCat\\Route\\Url')->getCanonical(" . var_export($this->attr('domains'), true) . ',' . ($this->attr('http-substitution') ? 'true' : 'false') . ',' . ($this->attr('static') ? 'true' : 'false') . ');?>'; } else { $url = Di::getInstance()->create('RedCat\\Route\\Url'); $canonical = $url->getCanonical($this->attr('domains'), !!$this->attr('http-substitution'), $this->attr('static')); $canonical2 = $url->getCanonical($this->attr('domains'), '%s', $this->attr('static')); if ($this->attr('http-substitution')) { $href = '<?php echo http_response_code()===200?' . var_export($canonical, true) . ':sprintf(' . var_export($canonical2, true) . ',http_response_code());?>'; } else { $href = $canonical; } } $this->write('<link rel="canonical" href="' . $href . '">'); }