本文整理汇总了PHP中template_replace函数的典型用法代码示例。如果您正苦于以下问题:PHP template_replace函数的具体用法?PHP template_replace怎么用?PHP template_replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template_replace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template
function template()
{
global $self;
global $html;
global $translationAdminPages;
if (!isset($translationAdminPages)) {
$translation = 'Admin Pages';
}
$html = template_replace("plugin:ADMINPAGES", "<a href='{$self}" . "action=admin_pages'>{$translationAdminPages}</a>", $html);
}
示例2: template
function template()
{
global $CON;
$footnotes = array("<ol id=\"footnotes\">");
foreach ($this->ft as $idx => $f) {
$footnotes[] = "<li><a name=\"ft_down_" . ($idx + 1) . "\" href=\"#ft_up_" . ($idx + 1) . "\">↑</a>{$f}</li>";
}
$footnotes[] = "</ol>";
$CON = template_replace("plugin:FOOT_NOTES", implode("\n", $footnotes), $CON);
}
示例3: template
function template()
{
global $html, $page, $START_PAGE, $WIKI_TITLE, $TITLE, $self;
if (!empty($page) && $this->link_page_title) {
$page_nolang = preg_replace("/\\.[A-Za-z]{2}(-[A-Za-z]{2})?\$/", "", $page);
$html = template_replace("plugin:WHAT_LINKS_HERE", "<a href=\"{$self}?action=whatlinkshere&page=" . u($page_nolang) . "\" rel=\"nofollow\">What links here?</a>", $html);
$html = template_replace("PAGE_TITLE", "<a href=\"{$self}?action=whatlinkshere&page=" . u($page_nolang) . "\" rel=\"nofollow\" title=\"What links to this page?\">" . h($page == $START_PAGE && $page == $TITLE ? $WIKI_TITLE : $TITLE) . "</a>", $html);
}
if ($_GET["action"] == "whatlinkshere") {
$html = template_replace("SHOW_PAGE", "<a href=\"{$self}?page=" . u($page_nolang) . "\" rel=\"nofollow\">{$GLOBALS['T_SHOW_PAGE']}</a>", $html);
}
}
示例4: template
function template()
{
global $html, $page, $action, $TEMPLATE, $CON;
$select = "\r\n<form action=\"{$self}\" method=\"get\">\r\n<input type=\"hidden\" name=\"page\" value=\"" . h($page) . "\" />\r\n<input type=\"hidden\" name=\"action\" value=\"" . h($action) . "\" />\r\n<input type=\"hidden\" name=\"permanent\" value=\"1\" />\r\n<select name=\"template\" id=\"selectTemplate\" onchange=\"this.form.submit();\">\r\n";
foreach ($this->tpls as $t_file => $t_name) {
$selected = $TEMPLATE == $t_file ? " selected " : "";
$select .= "<option value=\"{$t_file}\"{$selected}>" . h($t_name) . "</option>\n";
}
$select .= "</select></form>\n";
$html = template_replace("plugin:SELECT_TEMPLATE", $select, $html);
$CON = template_replace("SELECT_TEMPLATE", $select, $CON);
}
示例5: template
function template()
{
global $html;
global $PG_DIR;
$side_menu = '';
if (file_exists($PG_DIR . "side_menu.txt")) {
$side_menu = file_get_contents($PG_DIR . "side_menu.txt");
} else {
$file = @fopen($PG_DIR . "side_menu.txt", 'w');
fwrite($file, '');
fclose($file);
}
$html = template_replace("plugin:SIDEMENU", $side_menu, $html);
}
示例6: formatFinished
function formatFinished()
{
global $CON, $content, $self, $showsource, $page, $esum, $error, $preview, $action, $html;
global $T_PASSWORD, $T_EDIT_SUMMARY, $T_PREVIEW, $T_DONE, $T_DISCARD_CHANGES;
if (!$_REQUEST["ajax"]) {
return;
} else {
if ($action != "edit" && !$preview) {
$CON = substr($CON, strpos($CON, ">") + 1);
// $CON contains <div class="pre-div"> ... </div> and we don't want this "wrapper"
$CON = substr($CON, 0, strlen($CON) - 6);
die($CON);
}
}
$rows = count(explode("\n", $CON));
if ($this->rows_min > $rows) {
$rows = $this->rows_min;
} else {
if ($this->rows_max < $rows) {
$rows = $this->rows_max;
}
}
if (!authentified() && !$showsource) {
// if not logged on, require password
$FORM_PASSWORD = $T_PASSWORD;
$FORM_PASSWORD_INPUT = "<input class=\"ajaxPasswordInput\" type=\"password\" name=\"sc\" />";
}
$CON_FORM_BEGIN = "<form action=\"{$self}\" class=\"ajaxForm\" method=\"post\"><input type=\"hidden\" name=\"action\" value=\"save\" /><input class=\"ajaxShowSource\" type=\"hidden\" name=\"showsource\" value=\"{$showsource}\" />";
$CON_FORM_END = "</form>";
$CON_TEXTAREA = "<textarea name=\"content\" class=\"ajaxContentTextarea contentTextarea\" cols=\"83\" rows=\"{$rows}\">" . h($content ? $content : $CON) . "</textarea><input type=\"hidden\" id=\"ajaxPage\" name=\"page\" value=\"" . h($page) . "\" />";
if (!$showsource) {
$CON_SUBMIT = "<input class=\"submit ajaxContentSubmit\" onclick=\"ajaxAction('save', this);return false;\" type=\"submit\" value=\"{$T_DONE}\" />";
$EDIT_SUMMARY_TEXT = $T_EDIT_SUMMARY;
$EDIT_SUMMARY = "<input type=\"text\" name=\"esum\" class=\"ajaxEsum\" value=\"" . h($esum) . "\" />";
}
$CON_PREVIEW = "<input class=\"ajaxContentPreview\" class=\"submit\" onclick=\"ajaxAction('save&preview=1', this);return false;\" type=\"submit\" name=\"preview\" value=\"{$T_PREVIEW}\" /> <input type=\"submit\" onclick=\"ajaxAction('', this);return false;\" value=\"{$T_DISCARD_CHANGES}\" />";
$subs = array(array("CONTENT_FORM", $CON_FORM_BEGIN), array("\\/CONTENT_FORM", $CON_FORM_END), array("CONTENT_TEXTAREA", $CON_TEXTAREA), array("FORM_PASSWORD", $FORM_PASSWORD), array("FORM_PASSWORD_INPUT", $FORM_PASSWORD_INPUT), array("EDIT_SUMMARY_TEXT", $EDIT_SUMMARY_TEXT), array("EDIT_SUMMARY_INPUT", $EDIT_SUMMARY), array("CONTENT_SUBMIT", $CON_SUBMIT), array("CONTENT_PREVIEW", $CON_PREVIEW), array("ERROR", $error));
$html = @file_get_contents($GLOBALS["PLUGINS_DIR"] . "/AjaxEditing/template.html");
plugin("template");
// plugin specific template substitutions
foreach ($subs as $s) {
$html = template_replace($s[0], $s[1], $html);
}
$html = preg_replace("/\\{([^}]* )?plugin:.+( [^}]*)?\\}/U", "", $html);
// getting rid of absent plugin tags
die(($preview ? $CON : "") . $html);
}
示例7: template
function template()
{
global $self, $html, $LANG, $LANG_DIR, $CON, $action, $page;
$langs = array();
if (is_dir($LANG_DIR) && ($dir = opendir($LANG_DIR))) {
// common plugins
while (($file = readdir($dir)) !== false) {
if (!is_dir($LANG_DIR . $file)) {
$langs[] = basename($file, ".php");
}
}
}
sort($langs);
$select = "\n<form action=\"{$self}\" id=\"formSelectLanguage\" method=\"get\">\n<input type=\"hidden\" name=\"page\" value=\"" . basename($page, ".{$LANG}") . "\" />\n<input type=\"hidden\" name=\"action\" value=\"" . h($action) . "\" />\n<select name=\"lang\" id=\"selectLanguage\" onchange=\"this.form.submit();\">\n";
foreach ($langs as $l) {
$selected = $l == $LANG ? " selected=\"selected\" " : "";
$select .= "<option value=\"" . h($l) . "\"{$selected}>" . h($this->lang_names[$l]) . "</option>\n";
}
$select .= "</select></form>\n";
$html = template_replace("plugin:SELECT_LANGUAGE", $select, $html);
$CON = str_replace("{SELECT_LANGUAGE}", $select, $CON);
}
示例8: template
function template()
{
global $CON, $html, $page, $PG_DIR, $action, $self;
if (!empty($action)) {
return;
}
if (($pos = strpos($page, ".")) !== false) {
$p = preg_quote(substr($page, 0, $pos));
} else {
$p = preg_quote($page);
}
$versions = array();
if ($dir = @opendir($PG_DIR)) {
while ($file = readdir($dir)) {
if (preg_match("/{$p}\\.([a-z\\-]+)\\.txt|{$p}\\.txt/", $file, $match)) {
$versions[isset($match[1]) ? $match[1] : $this->default_lang] = $p;
}
}
}
ksort($versions);
if (count($versions) == 1) {
array_pop($versions);
}
$arr_versions = array();
foreach ($versions as $code => $art) {
$arr_versions[] = "<a href=\"{$self}?page=" . u(basename($art, ".txt") . ".{$code}") . "\">" . h(trim($this->lang_names[$code])) . "</a>";
}
if (!empty($arr_versions)) {
$ul_list = "<ul class=\"subpage\"><li>\n" . implode("</li><li>\n", $arr_versions) . "</li></ul>";
}
$CON = template_replace("VERSIONS", $ul_list, $CON);
$html = template_replace("plugin:VERSIONS", $ul_list, $html);
if (!empty($arr_versions)) {
$p_list = implode(", ", $arr_versions);
}
$CON = template_replace("VERSIONS_LIST", $p_list, $CON);
$html = template_replace("plugin:VERSIONS_LIST", $p_list, $html);
}
示例9: toHtml
public function toHtml($_version)
{
if ($this->getIsEnable() != 1) {
return '';
}
if (!$this->hasRight('r')) {
return '';
}
$_version = jeedom::versionAlias($_version);
$replace = array('#id#' => $this->getId(), '#name#' => $this->getIsEnable() ? $this->getName() : '<del>' . $this->getName() . '</del>', '#background_color#' => $this->getBackgroundColor($_version), '#eqLink#' => $this->getLinkToConfiguration());
$Departs = $this->getCmd(null, 'Departs');
$replace['#Departs#'] = is_object($Departs) ? $Departs->execCmd() : '';
$RefreshAction = $this->getCmd(null, 'RefreshAction');
$replace['#refresh_id#'] = is_object($RefreshAction) ? $RefreshAction->getId() : '';
return template_replace($replace, getTemplate('core', $_version, 'eqlogic', 'trains'));
}
示例10: toHtml
public function toHtml($_version = 'dashboard')
{
if ($this->getConfiguration('noSpecifyWidget', 0) == 1) {
return parent::toHtml($_version);
}
if ($_version == '') {
throw new Exception(__('La version demandée ne peut pas être vide (mobile, dashboard ou scénario)', __FILE__));
}
if (!$this->hasRight('r')) {
return '';
}
$version = jeedom::versionAlias($_version);
if ($this->getDisplay('hideOn' . $version) == 1) {
return '';
}
$cmd_html = '';
$version = jeedom::versionAlias($_version);
$vcolor = 'cmdColor';
if ($version == 'mobile') {
$vcolor = 'mcmdColor';
}
if ($this->getPrimaryCategory() == '') {
$cmdColor = '';
} else {
$cmdColor = jeedom::getConfiguration('eqLogic:category:' . $this->getPrimaryCategory() . ':' . $vcolor);
}
$maps = array();
$dynamic = array();
$cmd_html = '';
if ($this->getIsEnable()) {
foreach ($this->getCmd(null, null, true) as $cmd) {
if ($cmd->getConfiguration('mode') == 'travelTime') {
$from = $cmd->getConfiguration('from');
$to = $cmd->getConfiguration('to');
if (!isset($maps[$from . '_' . $to])) {
$maps[$from . '_' . $to] = array();
}
$maps[$from . '_' . $to]['travelTime'] = $cmd->execCmd();
}
if ($cmd->getConfiguration('mode') == 'distance') {
$from = $cmd->getConfiguration('from');
$to = $cmd->getConfiguration('to');
if (!isset($maps[$from . '_' . $to])) {
$maps[$from . '_' . $to] = array();
}
$maps[$from . '_' . $to]['distance'] = $cmd->execCmd();
}
if ($cmd->getConfiguration('mode') == 'travelDistance') {
$from = $cmd->getConfiguration('from');
$to = $cmd->getConfiguration('to');
if (!isset($maps[$from . '_' . $to])) {
$maps[$from . '_' . $to] = array();
}
$maps[$from . '_' . $to]['travelDistance'] = $cmd->execCmd();
}
if ($cmd->getConfiguration('mode') == 'dynamic') {
$dynamic[$cmd->getId()] = $cmd;
}
}
}
foreach ($maps as $key => $map) {
$key = explode('_', $key);
if (count($key) != 2) {
continue;
}
foreach ($dynamic as $id => $cmd) {
if (in_array($id, $key)) {
unset($dynamic[$id]);
}
}
$from_cmd = cmd::byId($key[0]);
$to_cmd = cmd::byId($key[1]);
if (!is_object($from_cmd) || !is_object($to_cmd)) {
contine;
}
$from = $from_cmd->execCmd();
$to = $to_cmd->execCmd();
$replace = array('#name#' => $from_cmd->getName() . ' <i class="fa fa-arrow-right"></i> ' . $to_cmd->getName(), '#from#' => $from, '#collectDate#' => $from_cmd->getCollectDate() > $to_cmd->getCollectDate() ? $from_cmd->getCollectDate() : $to_cmd->getCollectDate(), '#to#' => $to, '#travelDistance#' => isset($map['travelDistance']) ? $map['travelDistance'] : __('Inconnue', __FILE__), '#distance#' => isset($map['distance']) ? $map['distance'] : __('Inconnue', __FILE__), '#travelTime#' => isset($map['travelTime']) ? $map['travelTime'] : __('Inconnue', __FILE__));
$cmd_html .= template_replace($replace, getTemplate('core', $version, 'geoloc', 'geoloc'));
}
foreach ($dynamic as $id => $cmd) {
$replace = array('#state#' => $cmd->execCmd(), '#name#' => $cmd->getName(), '#collectDate#' => $cmd->getCollectDate(), '#id#' => $cmd->getId());
$cmd_html .= template_replace($replace, getTemplate('core', $_version, 'geoloc_single', 'geoloc'));
}
$replace = array('#id#' => $this->getId(), '#name#' => $this->getName(), '#eqLink#' => $this->hasRight('w') ? $this->getLinkToConfiguration() : '#', '#category#' => $this->getPrimaryCategory(), '#background_color#' => $this->getBackgroundColor($version), '#cmd#' => $cmd_html, '#style#' => '', '#noResize#' => 1, '#max_width#' => '650px', '#logicalId#' => $this->getLogicalId(), '#battery#' => $this->getConfiguration('batteryStatus', -2), '#batteryDatetime#' => $this->getConfiguration('batteryStatusDatetime', __('inconnue', __FILE__)));
if (($_version == 'dview' || $_version == 'mview') && $this->getDisplay('doNotShowObjectNameOnView', 0) == 0) {
$object = $this->getObject();
$replace['#object_name#'] = is_object($object) ? '(' . $object->getName() . ')' : '';
} else {
$replace['#object_name#'] = '';
}
if (($_version == 'dview' || $_version == 'mview') && $this->getDisplay('doNotShowNameOnView') == 1) {
$replace['#name#'] = '';
}
if (($_version == 'mobile' || $_version == 'dashboard') && $this->getDisplay('doNotShowNameOnDashboard') == 1) {
$replace['#name#'] = '';
}
if (($_version == 'dview' || $_version == 'mview') && $this->getDisplay('doNotDisplayBatteryLevelOnView') == 1) {
$replace['#battery#'] = -1;
}
//.........这里部分代码省略.........
示例11: formatBegin
function formatBegin()
{
global $CON;
$CON = template_replace("INDEX_COMMA", $this->pagesList("comma"), $CON);
$CON = template_replace("INDEX_LIST", $this->pagesList("list"), $CON);
}
示例12: toHtml
public function toHtml($_version = 'dashboard')
{
if ($this->getIsEnable() != 1) {
return '';
}
if (!$this->hasRight('r')) {
return '';
}
$version = jeedom::versionAlias($_version);
if ($this->getDisplay('hideOn' . $version) == 1) {
return '';
}
$mc = cache::byKey('porkfolioWidget' . jeedom::versionAlias($_version) . $this->getId());
if ($mc->getValue() != '') {
return preg_replace("/" . preg_quote(self::UIDDELIMITER) . "(.*?)" . preg_quote(self::UIDDELIMITER) . "/", self::UIDDELIMITER . mt_rand() . self::UIDDELIMITER, $mc->getValue());
}
$background = $this->getBackgroundColor($_version);
if ($this->getCmd(null, 'derniervers')->execCmd() < 0) {
$humeur = 'triste';
} else {
$humeur = 'content';
}
if ($this->getCmd(null, 'somme')->execCmd() >= $this->getCmd(null, 'objectif')->execCmd()) {
$humeur = 'jeedom';
$background = '#34a729';
}
if ($this->getCmd(null, 'somme')->execCmd() == 0) {
$background = '#e54016';
$humeur = 'very_triste';
}
$replace = array('#name#' => $this->getName(), '#id#' => $this->getId(), '#background_color#' => $background, '#uid#' => 'porkfolio' . $this->getId() . self::UIDDELIMITER . mt_rand() . self::UIDDELIMITER, '#eqLink#' => $this->getLinkToConfiguration(), '#porky_humeur#' => $humeur);
foreach ($this->getCmd('info') as $cmd) {
$replace['#' . $cmd->getLogicalId() . '_history#'] = '';
if ($cmd->getIsVisible() == 1) {
$replace['#' . $cmd->getLogicalId() . '_id#'] = $cmd->getId();
if ($cmd->getName() == 'Date dépot' || $cmd->getName() == 'Date retournement' || $cmd->getName() == 'Date mouvement') {
$replace['#' . $cmd->getLogicalId() . '#'] = date("d/m/y H:i:s", $cmd->execCmd());
} else {
$replace['#' . $cmd->getLogicalId() . '#'] = $cmd->execCmd();
}
$replace['#' . $cmd->getLogicalId() . '_collect#'] = $cmd->getCollectDate();
if ($cmd->getIsHistorized() == 1) {
$replace['#' . $cmd->getLogicalId() . '_history#'] = 'history cursor';
}
} else {
$replace['#' . $cmd->getLogicalId() . '#'] = '';
}
}
$refresh = $this->getCmd(null, 'refresh');
$replace['#refresh_id#'] = $refresh->getId();
$parameters = $this->getDisplay('parameters');
if (is_array($parameters)) {
foreach ($parameters as $key => $value) {
$replace['#' . $key . '#'] = $value;
}
}
$html = template_replace($replace, getTemplate('core', $_version, 'porkfolio', 'porkfolio'));
cache::set('porkfolioWidget' . $_version . $this->getId(), $html, 0);
return $html;
}
示例13: dns_start
public static function dns_start()
{
if (config::byKey('ngrok::addr') == '') {
return;
}
network::dns_stop();
$config_file = '/tmp/ngrok_jeedom';
$logfile = log::getPathToLog('ngrok');
$uname = posix_uname();
if (strrpos($uname['machine'], 'arm') !== false) {
$cmd = dirname(__FILE__) . '/../../script/ngrok/ngrok-arm';
} else {
if ($uname['machine'] == 'x86_64') {
$cmd = dirname(__FILE__) . '/../../script/ngrok/ngrok-x64';
} else {
$cmd = dirname(__FILE__) . '/../../script/ngrok/ngrok-x86';
}
}
exec('chmod +x ' . $cmd);
$cmd .= ' -config=' . $config_file . ' start jeedom';
if (!self::dns_run()) {
$replace = array('#server_addr#' => 'dns.jeedom.com:4443', '#name#' => 'jeedom', '#proto#' => 'https', '#port#' => 80, '#remote_port#' => '', '#token#' => config::byKey('ngrok::token'), '#auth#' => '', '#subdomain#' => 'subdomain : ' . config::byKey('ngrok::addr'));
$config = template_replace($replace, file_get_contents(dirname(__FILE__) . '/../../script/ngrok/config'));
if (file_exists($config_file)) {
unlink($config_file);
}
file_put_contents($config_file, $config);
log::remove('ngrok');
log::add('ngork', 'debug', 'Lancement de ngork : ' . $cmd);
exec($cmd . ' >> /dev/null 2>&1 &');
}
return true;
}
示例14: array
* Limesurvey functions
*/
include "functions/functions.limesurvey.php";
$js = array("js/popup.js", "include/jquery/jquery-1.4.2.min.js", "include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) {
$js[] = "js/childnap.js";
}
xhtml_head(T_("Respondent Selection") . " - " . T_("Call back"), true, array("include/bootstrap/css/bootstrap.min.css", "css/rs.css"), $js);
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_callback\r\n\tFROM questionnaire\r\n\tWHERE questionnaire_id = '{$questionnaire_id}'";
$r = $db->GetRow($sql);
if (!empty($r['rs_callback'])) {
print "<div class='rstext well rs'>" . template_replace($r['rs_callback'], $operator_id, $case_id) . "</div>";
}
print "<p class='rstext alert alert-info'>" . T_("Survey is") . " " . round(limesurvey_percent_complete($case_id), 1) . " % " . T_("complete") . "</p>";
print "<div class=' '>\r\n\t\t<div class='col-lg-2'><p><a class='btn btn-default' href=\"rs_intro.php\" >" . T_("Go Back") . "</a></p></div>";
//filter displayed outcomes
if ($questionnaire_id) {
$outcomes = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q WHERE q.questionnaire_id = {$questionnaire_id}");
//
$outcomes = explode(",", $outcomes);
if (in_array(8, $outcomes)) {
$des = $db->GetAll("SELECT description FROM outcome WHERE outcome_id = 8");
print "<div class='col-lg-4'><p class=''><h4 class=' '>" . T_("End call with outcome:") . "</h4></p>\r\n\t\t\t\t\t<p><a class='btn btn-primary' ";
if (ALTERNATE_INTERFACE) {
print "href=\"javascript:parent.location.href = 'index_interface2.php?outcome=8&endcase=endcase'\">";
} else {
print "href=\"javascript:parent.poptastic('call.php?defaultoutcome=8');\">";
示例15: template
function template()
{
global $CON, $html, $action, $preview, $page, $PG_DIR, $HEAD, $self, $comments_html, $comment_captcha_failed;
/*
* Include comments if:
* - {plugin:COMMENTS} is in template and {NO_COMMENTS} is not in page content
* - {COMMENTS} is in page content
*/
if ($action == "" && !$preview && (template_match("plugin:COMMENTS", $html, $null) && strpos($CON, "{NO_COMMENTS}") === false || strpos($CON, "{COMMENTS}") !== false)) {
$HEAD .= '<script type="text/javascript" src="plugins/Comments/comments.js"></script>';
$HEAD .= '<style type="text/css" media="all">@import url("plugins/Comments/comments.css");</style>';
$tmpl = file_get_contents($this->data_dir . $this->template);
$tmpl = strtr($tmpl, array("{FORM_NAME}" => $this->TP_FORM_NAME, "{FORM_EMAIL}" => $this->TP_FORM_EMAIL, "{FORM_CONTENT}" => $this->TP_FORM_CONTENT, "{FORM_NAME_VALUE}" => $comment_captcha_failed ? h($_POST["name"]) : "", "{FORM_EMAIL_VALUE}" => $comment_captcha_failed ? h($_POST["email"]) : "", "{FORM_CONTENT_VALUE}" => $comment_captcha_failed ? h($_POST["content"]) : "", "{FORM_SUBMIT}" => $this->TP_FORM_SUBMIT, "{FORM_SELF}" => h($self), "{FORM_PAGE}" => h($page), "{COMMENTS}" => $this->TP_COMMENTS));
$items_str = "";
if ($dir = @opendir($this->comments_dir . $page)) {
$item_tmpl = "";
if (preg_match("/\\{item\\}(.*)\\{\\/item\\}/Us", $tmpl, $m)) {
$item_tmpl = $m[1];
}
$filenames = array();
while ($filename = @readdir($dir)) {
if (preg_match("/([0-9]{8}-[0-9]{4}-[0-9]{2})\\.txt/", $filename, $m)) {
$filenames[] = $filename;
}
}
if ($this->sorting_order == "asc") {
sort($filenames);
} else {
if ($this->sorting_order == "desc") {
rsort($filenames);
}
}
$comment_num = 0;
foreach ($filenames as $filename) {
$comment_num++;
$file = file_get_contents($this->comments_dir . $page . "/" . $filename);
$delimiter = strpos($file, "\n");
$meta = substr($file, 0, $delimiter);
$content = substr($file, $delimiter + 1);
list($ip, $name, $email) = explode("\t", $meta);
$processed_content = $this->processComment($content);
$items_str .= strtr($item_tmpl, array("{CONTENT}" => $processed_content, "{NAME}" => h($name), "{EMAIL}" => h($email), "{NAME_TO_EMAIL}" => $email == "" ? $name : "<a href=\"mailto:" . h($email) . "\">" . h($name) . "</a>", "{IP}" => $ip, "{DATE}" => rev_time(basename($filename, ".txt")), "{ID}" => basename($filename, ".txt"), "{NUMBER}" => $comment_num, "{DELETE}" => h($this->TP_DELETE), "{DELETE_LINK}" => "{$self}?action=admin-deletecomment&page=" . u($page) . "&filename=" . u($filename), "{DELETE_CONFIRM}" => h($this->TP_DELETE_CONFIRM)));
}
}
$tmpl = str_replace("{NUMBER_OF_COMMENTS}", count($filenames), $tmpl);
$comments_html = preg_replace("/\\{item\\}.*\\{\\/item\\}/Us", $items_str, $tmpl);
plugin("commentsTemplate");
$html = template_replace("plugin:COMMENTS", $comments_html, $html);
$CON = str_replace("{COMMENTS}", $comments_html, $CON);
}
$CON = str_replace("{NO_COMMENTS}", "", $CON);
$HEAD .= "\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS " . h($this->TP_COMMENTS) . "\" href=\"{$this->rss_file}\" />\n";
}