public static function filePath($val) { $p = '/^'; $p .= '(\\/' . Sitengine_Regex::getFileName() . ')*\\/' . Sitengine_Regex::getFileName(); $p .= '$/'; return preg_match($p, $val); }
public static function text2mailto($data) { $email = '/('; $email .= Sitengine_Regex::getMailbox(); $email .= Sitengine_Regex::getServerName(); $email .= ')/'; return preg_replace($email, '<a href="mailto:\\1">\\1</a>', $data); }
protected function _fetchSnippets($pid, $transcriptIndex, $defaultIndex, $obfuscateEmail) { try { require_once 'Sitengine/String.php'; require_once 'Sitengine/Regex.php'; require_once 'Sitengine/Sitemap.php'; $snippets = array(); $q = 'SELECT'; $q .= ' id,'; $q .= ' keyword,'; $q .= ' IF(htmlLang' . $transcriptIndex . ' = "", htmlLang' . $defaultIndex . ', htmlLang' . $transcriptIndex . ') AS html'; $q .= ' FROM ' . $this->_table; $q .= ' WHERE pid = "' . $pid . '"'; $q .= ' AND type = "' . Sitengine_Sitemap::ITEMTYPE_SNIPPET . '"'; $statement = $this->_database->prepare($q); $statement->execute(); $result = $statement->fetchAll(Zend_Db::FETCH_ASSOC); foreach ($result as $snippet) { if ($obfuscateEmail) { $snippet['html'] = preg_replace_callback('/(' . Sitengine_Regex::getEmail() . ')/', create_function('$matches', 'return Sitengine_String::obfuscateEmail($matches[0]);'), $snippet['html']); } $snippets[$snippet['keyword']] = $snippet['html']; } return $snippets; } catch (Exception $exception) { require_once 'Sitengine/Sitemap/Exception.php'; throw new Sitengine_Sitemap_Exception('fetch snippets error', $exception); } }