本文整理汇总了PHP中Template::assign_var方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::assign_var方法的具体用法?PHP Template::assign_var怎么用?PHP Template::assign_var使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::assign_var方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$template = new Template();
$template->load("plugins");
$plugins = new PluginList();
$plugins->loadAll();
foreach ($plugins->plugins as $plugin) {
$index = $template->add_loop_item("PLUGINS");
if (isset($_GET['activate']) && $_GET['activate'] == $plugin->path) {
$plugin->activate();
} elseif (isset($_GET['deactivate']) && $_GET['deactivate'] == $plugin->path) {
$plugin->deactivate();
}
$template->assign_loop_var("PLUGINS", $index, "NAME", htmlentities($plugin->name));
$template->assign_loop_var("PLUGINS", $index, "PATH", htmlentities($plugin->path));
$template->assign_loop_var("PLUGINS", $index, "DESCRIPTION", htmlentities($plugin->getDescription()));
$template->assign_loop_var("PLUGINS", $index, "VERSION", $plugin->version);
$template->assign_loop_var("PLUGINS", $index, "AUTHORLINK", $plugin->authorLink);
$template->assign_loop_var("PLUGINS", $index, "AUTHORNAME", htmlentities($plugin->authorName));
$template->assign_loop_var("PLUGINS", $index, "LICENSE", htmlentities($plugin->license));
$template->assign_loop_var("PLUGINS", $index, "LICENSEURL", htmlentities($plugin->licenseUrl));
if ($plugin->isActivated()) {
$myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "deactivate=" . urlencode($plugin->path));
$disable = Language::DirectTranslateHtml("DISABLE");
$template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $disable . "</a>");
} else {
$myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "activate=" . urlencode($plugin->path));
$enable = Language::DirectTranslateHtml("ENABLE");
$template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $enable . "</a>");
}
}
$template->assign_var("HOST", Settings::getValue("host"));
$template->assign_var("APIKEY", Settings::getValue("apikey"));
$template->output();
}
示例2: display
public function display()
{
$template = new Template();
$template->load("plugin_contactform_contactform");
$template->show_if('SHOWFORM', true);
$template->show_if('SHOWMESSAGE', false);
if (isset($_POST["contactformsubmit"]) && $_POST["url"] == "" && $_POST["inputspamcontrol"] == $_SESSION["plugin_contactform_result"]) {
$settings = Settings::getRootInstance()->specify("plugin", "contactform");
$plugin_contactform_receiver = $settings->get("contactform_mail");
$plugin_contactform_sendername = $_POST['inputname'];
$plugin_contactform_sendermail = $_POST['inputmail'];
$plugin_contactform_text = $_POST['inputtext'];
$plugin_contactform_subject = Language::DirectTranslate("plugin_contactform_pagetypetitle") . " " . Settings::getInstance()->get("title");
mail($plugin_contactform_receiver, $plugin_contactform_subject, $plugin_contactform_text, "From: {$plugin_contactform_sendername} <{$plugin_contactform_sendermail}>");
$_SESSION['plugin_contactform_result'] = "";
$template->show_if('SHOWFORM', false);
$template->show_if('SHOWMESSAGE', true);
$template->assign_var("SUCCESSMESSAGE", $settings->get("contactform_successmessage"));
}
$plugin_contactform_numberone = rand(1, 10);
$plugin_contactform_numbertwo = rand(1, 10);
$_SESSION['plugin_contactform_result'] = $plugin_contactform_numberone + $plugin_contactform_numbertwo;
$template->assign_var('FORMURL', UrlRewriting::GetUrlByAlias($this->page->alias));
$template->assign_var('NUMBER1', $plugin_contactform_numberone);
$template->assign_var('NUMBER2', $plugin_contactform_numbertwo);
Cache::clear();
echo $template->getCode();
}
示例3: load
public function load()
{
$this->headline = Language::DirectTranslate("plugin_menulistwidget_menus");
if (Cache::contains("menu", "widget_" . $_GET['dir'])) {
$this->content = Cache::getData("menu", "widget_" . $_GET['dir']);
} else {
if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
$_GET['dir'] = "";
}
$template = new Template();
$template->load("plugin_menulistwidget_menulist");
$newmenuurl = UrlRewriting::GetUrlByAlias("admin/newmenu");
$template->assign_var("NEWMENUURL", $newmenuurl);
$menus = sys::getMenues($_GET['dir']);
foreach ($menus as $menu) {
$index = $template->add_loop_item("MENUS");
$template->assign_loop_var("MENUS", $index, "ID", $menu->id);
$template->assign_loop_var("MENUS", $index, "TITLE", $menu->name);
$template->assign_loop_var("MENUS", $index, "PAGES", $menu->count);
$editurl = UrlRewriting::GetUrlByAlias("admin/editmenu", "menu=" . $menu->id);
$template->assign_loop_var("MENUS", $index, "EDITURL", $editurl);
$deleteurl = UrlRewriting::GetUrlByAlias("admin/deletemenu", "menu=" . $menu->id);
$template->assign_loop_var("MENUS", $index, "DELETEURL", $deleteurl);
}
if (!$menus) {
$template->assign_var("NOMENUS", Language::DirectTranslate("plugin_menulistwidget_no_menus"));
} else {
$template->assign_var("NOMENUS", "");
}
$this->content = $template->getCode();
Cache::setData("menu", "widget_" . $_GET['dir'], $this->content);
}
}
示例4: getCode
/**
*
* @return string
*/
public function getCode()
{
if (isset($_POST['save'])) {
foreach ($_POST as $property => $value) {
if ($property != "save" && $property != "roles") {
$settings = Settings::getRootInstance()->specify($this->areaType, $this->area);
if ($this->dir != "" && $this->dir != "/") {
$settings = $settings->dir($this->dir);
}
$settings->set($property, $value, $this->role);
}
}
Settings::forceReload();
Cache::clear();
Language::GetGlobal()->ClearCache();
if (@header("Location:" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']))) {
exit;
} else {
die("<script>window.location.href = '" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']) . "';</script>");
}
$changed = true;
}
$template = new Template();
$template->load($this->template);
if ($this->area != "global" || $this->areaType != "global") {
$roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
} else {
$roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
}
$roles = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}roles ORDER BY name");
if ($roles) {
foreach ($roles as $role) {
if ($this->role == $role->id) {
$roleselector .= "<option value=\"" . $role->id . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>";
} else {
$roleselector .= "<option value=\"" . $role->id . "\">" . $role->name . "</option>";
}
}
}
$roleselector .= "</select>";
$template->assign_var("ROLES", $roleselector);
if ($this->area != "global" || $this->areaType != "global") {
$template->assign_var("URL", $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=" . $this->role . "&save_settings=1");
} else {
$template->assign_var("URL", $this->url . $this->getQuerySeperator() . "role=" . $this->role . "&save_settings=1");
}
$rows = Settings::getRootInstance()->specify($this->areaType, $this->area)->dir($this->dir)->getRows($this->role);
if ($rows) {
foreach ($rows as $row) {
$index = $template->add_loop_item("SETTINGS");
$template->assign_loop_var("SETTINGS", $index, "PROPERTY", $row['name']);
$template->assign_loop_var("SETTINGS", $index, "DESCRIPTION", htmlentities($row['description']));
$control = new $row['type']();
$control->name = $row['name'];
$control->value = $row['value'];
$template->assign_loop_var("SETTINGS", $index, "CONTROL", $control->getCode());
}
}
return $template->getCode();
}
示例5: display
public function display()
{
$language = new Language($_GET['language']);
if (isset($_POST['translation'])) {
$language->updateTranslation($_GET['token'], $_POST['translation']);
Cache::clear("language");
}
$template = new Template();
$template->load("translationtokeneditor");
$template->assign_var("ORIGINAL", Language::DirectTranslate($_GET['token']));
$template->assign_var("TRANSLATION", $language->getString($_GET['token']));
$template->output();
}
示例6: load
public function load()
{
$dir = '';
if (isset($_GET['dir']) && substr($_GET['dir'], 0, 1) != '.') {
$dir = $_GET['dir'];
}
$this->headline = Language::DirectTranslate("plugin_pagelistwidget_pages");
if (Cache::contains("page", "widget_" . $dir)) {
$this->content = Cache::getData("page", "widget_" . $dir);
} else {
$template = new Template();
$template->load("plugin_pagelistwidget_pagelist");
$pages = Page::getPagesByDir($dir);
if (substr($dir, 0, 1) == "/") {
$shortdir = substr($dir, 1);
} else {
$shortdir = $dir;
}
if ($pages) {
foreach ($pages as $page) {
$shortalias = substr($page->alias, strlen($shortdir));
if (substr($shortalias, 0, 1) == "/") {
$shortalias = substr($shortalias, 1);
} else {
$shortalias = $shortalias;
}
if (!strpos($shortalias, "/")) {
$host = Settings::getInstance()->get("host");
$index = $template->add_loop_item("PAGES");
$template->assign_loop_var("PAGES", $index, "TITLE", $page->title);
$template->assign_loop_var("PAGES", $index, "ALIAS", $shortalias);
$editurl = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias);
$template->assign_loop_var("PAGES", $index, "EDITURL", $editurl);
$deleteurl = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . $page->alias);
$template->assign_loop_var("PAGES", $index, "DELETEURL", $deleteurl);
$showurl = UrlRewriting::GetUrlByAlias($page->alias);
$template->assign_loop_var("PAGES", $index, "SHOWURL", $showurl);
}
}
$template->assign_var("NOPAGES", "");
} else {
$template->assign_var("NOPAGES", Language::DirectTranslate("plugin_pagelistwidget_no_pages"));
}
$this->content = $template->getCode();
if (isset($_GET['dir'])) {
Cache::setData("page", "widget_" . $_GET['dir'], $this->content);
}
}
}
示例7: display
public function display()
{
$rolelist = new Template();
$rolelist->load("role_list");
$actions = ActionList::get("rolelist");
if (isset($_POST['insert'])) {
$role = new Role();
$role->name = $_POST['insert'];
$role->insert();
}
if (isset($_GET['delete'])) {
$role = new Role();
$role->ID = $_GET['delete'];
$role->delete();
}
$table = new Table();
$id = new TableColumn("id", Language::DirectTranslate("ID"));
$id->autoWidth = true;
$name = new TableColumn("name", Language::DirectTranslate("NAME"));
$table->columns->add($id);
$table->columns->add($name);
$table->name = "{'dbprefix'}roles";
$table->actions = "rolelist";
$table->orderBy = "name";
$table->cacheName = "rolelist";
$rolelist->assign_var("TABLE", $table->getCode());
$rolelist->output();
}
示例8: display
public function display()
{
$template = new Template();
$template->load("plugin_changepassword_changepassword");
$template->show_if('PASSWORD_WRONG', false);
$template->show_if('SUCCESSFUL', false);
$template->show_if('OLD_PASSWORD_WRONG', false);
if (isset($_REQUEST['old_password']) && !empty($_REQUEST['old_password']) && is_string($_REQUEST['old_password']) && isset($_REQUEST['new_password']) && !empty($_REQUEST['new_password']) && is_string($_REQUEST['new_password']) && isset($_REQUEST['confirm_password']) && !empty($_REQUEST['confirm_password']) && is_string($_REQUEST['confirm_password'])) {
$old_password = DataBase::Current()->EscapeString($_REQUEST['old_password']);
$new_password = DataBase::Current()->EscapeString($_REQUEST['new_password']);
$confirm_password = DataBase::Current()->EscapeString($_REQUEST['confirm_password']);
if ($new_password != $confirm_password) {
$template->show_if('PASSWORD_WRONG', true);
} else {
$password = DataBase::Current()->EscapeString(md5($new_password . Settings::getInstance()->get("salt")));
$old_password = DataBase::Current()->EscapeString(md5($old_password . Settings::getInstance()->get("salt")));
$db_password = DataBase::Current()->ReadField("SELECT `password` FROM `{'dbprefix'}user` WHERE `id` = '" . User::Current()->id . "'; ");
if ($db_password && $db_password != null) {
if ($db_password != $old_password) {
$template->show_if('OLD_PASSWORD_WRONG', true);
} else {
DataBase::Current()->Execute("UPDATE `{'dbprefix'}user` SET `password` = '" . $password . "' WHERE `id` = '" . User::Current()->id . "'; ");
$template->show_if('SUCCESSFUL', true);
EventManager::raiseEvent("plugin_changepassword_change", array('old_password' => $old_password, 'new_password' => $password, 'userid' => User::Current()->id));
Cache::clear("tables", "userlist");
}
} else {
//Der User ist nicht in der Datenbank aufgeführt.
}
}
}
$template->assign_var('ACTION', UrlRewriting::GetUrlByAlias($this->page->alias));
echo $template->getCode();
}
示例9: display
public function display()
{
$template = new Template();
$template->load("message");
if (ImageServer::insert($_POST['path'], $_POST['name'], $_POST['description'])) {
$template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_ADDED"));
$redirect = UrlRewriting::GetUrlByAlias("admin/home", "dir=" . urlencode($_SESSION['dir']));
if (isset($_POST['referrer'])) {
$redirect = $_POST['referrer'];
}
echo "<script type='text/javascript'>setTimeout('window.location.href= \\'" . $redirect . "\\'', 1000)</script>";
} else {
$template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_NOT_ADDED"));
}
$template->output();
}
示例10: display
public function display()
{
$template = new Template();
if (!isset($_GET['delete'])) {
$template->load("menu_delete");
$template->assign_var("CANCELURL", "javascript:history.back()");
$template->assign_var("DELETEURL", $this->page->GetUrl("menu=" . urlencode($_GET['menu']) . "&delete=true"));
} else {
$template->load("message");
if (Menu::delete(DataBase::Current()->EscapeString($_GET['menu']))) {
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_DELETED"));
} else {
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_DELETED"));
}
}
$template->output();
}
示例11: getCode
/**
*
* @return string
*/
public function getCode()
{
$template = new Template();
$template->load("control_skinselector");
$template->assign_var("NAME", $this->name);
$template->assign_var("SELECTORNAME", $this->type);
$template->assign_var("VALUE", $this->value);
$template->assign_var("HOST", Settings::getValue("host"));
$template->assign_var("CURRENTSKINNAME", SkinController::getSkinName($this->value));
$i = 0;
foreach (SkinController::getInstalledSkins() as $skin) {
$index = $template->add_loop_item("SKINS");
$template->assign_loop_var("SKINS", $index, "SELECTORNAME", $this->type);
$template->assign_loop_var("SKINS", $index, "INDEX", $i);
$template->assign_loop_var("SKINS", $index, "SKINID", $skin->id);
$template->assign_loop_var("SKINS", $index, "SKINNAME", $skin->name);
$i++;
}
return $template->getCode();
}
示例12: display
public function display()
{
$template = new Template();
$template->load("menu_new");
$template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false);
$template->show_if("SUCCEEDED", false);
if ($_GET['blank'] == true) {
$template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu", "blank=true"));
} else {
$template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu"));
}
if (isset($_POST['name'])) {
$template->show_if("SUCCEEDED", true);
$id = Menu::create($_POST['name'], $_SESSION['dir']);
if (!$id) {
$template->load("message");
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_CREATED"));
}
}
$template->output();
}
示例13: upload
protected function upload()
{
$template = new Template();
$template->load("upload");
$template->assign_var("REFERRER", $_POST['referrer']);
$template->show_if("SHOW_MEDIALIBARY", false);
if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) {
mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']);
}
if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) {
$name = $_FILES['file']['name'];
$template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED")));
$path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) {
$template->show_if("SHOW_MEDIALIBARY", true);
$template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage"));
$template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
}
} else {
if (FileServer::$uploadFailure != "") {
$template->assign_var("MESSAGE", FileServer::$uploadFailure);
} else {
$template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED"));
}
}
$template->output();
}
示例14: display
public function display()
{
$template = new Template();
$template->load("new_form");
$template->show_if("SUCCEEDED", false);
$template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false);
if ($_GET['blank'] == true) {
$url = UrlRewriting::GetUrlByAlias("admin/newform", "blank=true");
} else {
$url = UrlRewriting::GetUrlByAlias("admin/newform");
}
$template->assign_var("URL", $url);
if (isset($_POST['name'])) {
$template->show_if("SUCCEEDED");
$id = Form::create($_POST['name'], $_SESSION['dir']);
if (!$id) {
$template->load("message");
$template->assign_var("MESSAGE", $language->getString("FORM_NOT_CREATED"));
}
}
$template->output();
}
示例15: getEditableCode
/**
*
* @param Actionlist $actions
* @return string
*/
public function getEditableCode(Actionlist $actions)
{
$template = new Template();
$template->load("menuentry_editable");
$template->assign_var("ID", $this->id);
$template->assign_var("TITLE", $this->title);
if ($this->type == 0) {
$template->assign_var("SELECTEDINTERNAL", " selected=\"1\"");
$selector = new PageSelector();
$selector->name = $this->id . '_href';
$selector->value = $this->href;
$template->assign_var("VALUECONTROL", $selector->getCode());
$template->assign_var("SELECTEDEXTERNAL", "");
$template->assign_var("SELECTEDSUBMENU", "");
} else {
if ($this->type == 1) {
$template->assign_var("SELECTEDEXTERNAL", " selected=\"1\"");
$template->assign_var("SELECTEDINTERNAL", "");
$template->assign_var("SELECTEDSUBMENU", "");
$template->assign_var("VALUECONTROL", "<input name=\"" . $this->id . "_href\" value=\"" . $this->href . "\" />");
} else {
if ($this->type == 2) {
$template->assign_var("SELECTEDSUBMENU", " selected=\"1\"");
$template->assign_var("SELECTEDINTERNAL", "");
$template->assign_var("SELECTEDEXTERNAL", "");
$selector = new MenueSelector();
$selector->name = $this->id . '_href';
$selector->value = $this->href;
$template->assign_var("VALUECONTROL", $selector->getCode());
}
}
}
$params = array();
$params['menu'] = $this->menu;
$params['ID'] = $this->id;
$template->assign_var("ACTIONS", $actions->getCode($params));
return $template->getCode();
}