protected static function _getMetadataForUrl($uri = null) { if (!$uri) { $uri = lmbToolkit::instance()->getRequest()->getUri(); } $count_path = $uri->countPath(); $meta = null; $sql = 'SELECT keywords, description, title FROM lmb_cms_seo WHERE url = \'/\' OR '; for ($i = 1; $i < $count_path; $i++) { $sql .= ' url = \'' . self::getDefaultConnection()->escape($uri->getPathToLevel($i)) . '\'' . ($i < $count_path - 1 ? ' OR ' : ''); } $sql .= ' ORDER BY url DESC LIMIT 1'; $meta = lmbDBAL::fetchOneRow($sql); if (!empty($meta)) { self::$_meta = $meta; } else { self::$_meta = new lmbObject(array('title' => '', 'description' => '', 'keywords' => '')); } }
protected function _createRootElementIfNotExists() { if (!($root = lmbDBAL::fetchOneRow('SELECT * FROM ' . $this->_table->getName()))) { lmbDBAL::execute('INSERT INTO ' . $this->_table->getName() . ' (parent_id, level, priority, is_published, path, identifier, ctime, utime) VALUES (0,0,0,0,\'/1/\',\'\',0,0)'); } }