本文整理汇总了PHP中HTML::strong方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::strong方法的具体用法?PHP HTML::strong怎么用?PHP HTML::strong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::strong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: summaryAsHTML
function summaryAsHTML($rev)
{
if (!($summary = $this->summary($rev))) {
return '';
}
return HTML::strong(array('class' => 'wiki-summary'), "(", TransformLinks($summary, $rev->get('markup'), $rev->getPageName()), ")");
}
示例2: highlight_line
function highlight_line($line, $hilight_re)
{
while (preg_match("/^(.*?)({$hilight_re})/i", $line, $m)) {
$line = substr($line, strlen($m[0]));
$html[] = $m[1];
// prematch
$html[] = HTML::strong(array('class' => 'search-term'), $m[2]);
// match
}
$html[] = $line;
// postmatch
return $html;
}
示例3: showForm
function showForm(&$dbi, &$request, $args)
{
$action = $request->getPostURL();
$hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's', 'direction'));
$pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
$query = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this link. These are pagenames. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
$dirsign_switch = JavaScript("\nfunction dirsign_switch() {\n var d = document.getElementById('dirsign')\n d.innerHTML = (d.innerHTML == ' => ') ? ' <= ' : ' => '\n}\n");
$dirsign = " => ";
$in = $out = array('name' => 'direction', 'type' => 'radio', 'onChange' => 'dirsign_switch()');
$out['value'] = 'out';
$out['id'] = 'dir_out';
if ($args['direction'] == 'out') {
$out['checked'] = 'checked';
}
$in['value'] = 'in';
$in['id'] = 'dir_in';
if ($args['direction'] == 'in') {
$in['checked'] = 'checked';
$dirsign = " <= ";
}
$direction = HTML(HTML::input($out), HTML::label(array('for' => 'dir_out'), _("outgoing")), HTML::input($in), HTML::label(array('for' => 'dir_in'), _("incoming")));
/*
$direction = HTML::select(array('name'=>'direction',
'onChange' => 'dirsign_switch()'));
$out = array('value' => 'out');
if ($args['direction']=='out') $out['selected'] = 'selected';
$in = array('value' => 'in');
if ($args['direction']=='in') {
$in['selected'] = 'selected';
$dirsign = " <= ";
}
$direction->pushContent(HTML::option($out, _("outgoing")));
$direction->pushContent(HTML::option($in, _("incoming")));
*/
$submit = Button('submit:search', _("LinkSearch"), false);
$instructions = _("Search in pages for links with the matching name.");
$form = HTML::form(array('action' => $action, 'method' => 'GET', 'accept-charset' => $GLOBALS['charset']), $dirsign_switch, $hiddenfield, $instructions, HTML::br(), $pagefilter, HTML::strong(HTML::tt(array('id' => 'dirsign'), $dirsign)), $query, HTML::raw(' '), $direction, HTML::raw(' '), $submit);
return $form;
}
示例4: format_revision
function format_revision($rev)
{
static $doublettes = array();
if (isset($doublettes[$rev->getPageName()])) {
return;
}
$doublettes[$rev->getPageName()] = 1;
$args =& $this->_args;
$class = 'rc-' . $this->importance($rev);
$time = $this->time($rev);
if (!$rev->get('is_minor_edit')) {
$time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
}
$line = HTML::li(array('class' => $class));
if ($args['difflinks']) {
$line->pushContent($this->diffLink($rev), ' ');
}
if ($args['historylinks']) {
$line->pushContent($this->historyLink($rev), ' ');
}
$line->pushContent($this->pageLink($rev), ' ', $time, ' ', ' . . . . ', _("latest comment by "), $this->authorLink($rev));
return $line;
}
示例5: showWatchList
function showWatchList($pagelist)
{
return HTML::strong(HTML::tt(empty($pagelist) ? _("<empty>") : $pagelist));
}
示例6: isSpam
/**
* Handle AntiSpam here. How? http://wikiblacklist.blogspot.com/
* Need to check dynamically some blacklist wikipage settings
* (plugin WikiAccessRestrictions) and some static blacklist.
* DONE:
* Always: More then 20 new external links
* ENABLE_SPAMASSASSIN: content patterns by babycart (only php >= 4.3 for now)
* ENABLE_SPAMBLOCKLIST: content domain blacklist
*/
function isSpam()
{
$current =& $this->current;
$request =& $this->request;
$oldtext = $current->getPackedContent();
$newtext =& $this->_content;
// FIXME: in longer texts the NUM_SPAM_LINKS number should be increased.
// better use a certain text : link ratio.
// 1. Not more then 20 new external links
if (defined("NUM_SPAM_LINKS")) {
if ($this->numLinks($newtext) - $this->numLinks($oldtext) >= NUM_SPAM_LINKS) {
// Allow strictly authenticated users?
// TODO: mail the admin?
$this->tokens['PAGE_LOCKED_MESSAGE'] = HTML($this->getSpamMessage(), HTML::p(HTML::strong(_("Too many external links."))));
return true;
}
}
// 2. external babycart (SpamAssassin) check
// This will probably prevent from discussing sex or viagra related topics. So beware.
if (ENABLE_SPAMASSASSIN) {
include_once "lib/spam_babycart.php";
if ($babycart = check_babycart($newtext, $request->get("REMOTE_ADDR"), $this->user->getId())) {
// TODO: mail the admin
if (is_array($babycart)) {
$this->tokens['PAGE_LOCKED_MESSAGE'] = HTML($this->getSpamMessage(), HTML::p(HTML::em(_("SpamAssassin reports: "), join("\n", $babycart))));
}
return true;
}
}
// 3. extract (new) links and check surbl for blocked domains
if (ENABLE_SPAMBLOCKLIST and $this->numLinks($newtext)) {
include_once "lib/SpamBlocklist.php";
include_once "lib/InlineParser.php";
$parsed = TransformLinks($newtext);
foreach ($parsed->_content as $link) {
if (isa($link, 'Cached_ExternalLink')) {
$uri = $link->_getURL($this->page->getName());
if ($res = IsBlackListed($uri)) {
// TODO: mail the admin
$this->tokens['PAGE_LOCKED_MESSAGE'] = HTML($this->getSpamMessage(), HTML::p(HTML::strong(_("External links contain blocked domains:")), HTML::ul(HTML::li(sprintf(_("%s is listed at %s"), $res[2], $res[0])))));
return true;
}
}
}
}
return false;
}
示例7: displayPage
//.........这里部分代码省略.........
$beforeHeader->pushContent(HTML::raw($ref_html));
$toks['BEFORE_HEADER'] = $beforeHeader;
} else {
$beforeHeader = HTML();
$beforeHeader->pushContent(HTML::raw($ref_html));
$toks['BEFORE_HEADER'] = $beforeHeader;
}
// }}} /Codendi hook
$pagetitle = SplitPagename($pagename);
if ($redirect_from = $request->getArg('redirectfrom')) {
$redirect_message = HTML::span(array('class' => 'redirectfrom'), fmt("(Redirected from %s)", RedirectorLink($redirect_from)));
// abuse the $redirected template var for some status update notice
} elseif ($request->getArg('errormsg')) {
$redirect_message = $request->getArg('errormsg');
$request->setArg('errormsg', false);
}
$request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
/*
// FIXME: This is also in the template...
if ($request->getArg('action') != 'pdf' and !headers_sent()) {
// FIXME: enable MathML/SVG/... support
if (ENABLE_XHTML_XML
and (!isBrowserIE()
and strstr($request->get('HTTP_ACCEPT'),'application/xhtml+xml')))
header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']);
else
header("Content-Type: text/html; charset=" . $GLOBALS['charset']);
}
*/
$page_content = $revision->getTransformedContent();
// if external searchengine (google) referrer, highlight the searchterm
// FIXME: move that to the transformer?
// OR: add the searchhightplugin line to the content?
if ($result = isExternalReferrer($request)) {
if (DEBUG and !empty($result['query'])) {
//$GLOBALS['SearchHighlightQuery'] = $result['query'];
/* simply add the SearchHighlight plugin to the top of the page.
This just parses the wikitext, and doesn't highlight the markup */
include_once 'lib/WikiPlugin.php';
$loader = new WikiPluginLoader();
$xml = $loader->expandPI('<' . '?plugin SearchHighlight s="' . $result['query'] . '"?' . '>', $request, $markup);
if ($xml and is_array($xml)) {
foreach (array_reverse($xml) as $line) {
array_unshift($page_content->_content, $line);
}
array_unshift($page_content->_content, HTML::div(_("You searched for: "), HTML::strong($result['query'])));
}
if (0) {
/* Parse the transformed (mixed HTML links + strings) lines?
This looks like overkill.
*/
require_once "lib/TextSearchQuery.php";
$query = new TextSearchQuery($result['query']);
$hilight_re = $query->getHighlightRegexp();
//$matches = preg_grep("/$hilight_re/i", $revision->getContent());
// FIXME!
for ($i = 0; $i < count($page_content->_content); $i++) {
$found = false;
$line = $page_content->_content[$i];
if (is_string($line)) {
while (preg_match("/^(.*?)({$hilight_re})/i", $line, $m)) {
$found = true;
$line = substr($line, strlen($m[0]));
$html[] = $m[1];
// prematch
$html[] = HTML::strong(array('class' => 'search-term'), $m[2]);
// match
}
}
if ($found) {
$html[] = $line;
// postmatch
$page_content->_content[$i] = HTML::span(array('class' => 'search-context'), $html);
}
}
}
}
}
$toks['CONTENT'] = new Template('browse', $request, $page_content);
$toks['TITLE'] = $pagetitle;
// <title> tag
$toks['HEADER'] = $pageheader;
// h1 with backlink
$toks['revision'] = $revision;
if (!empty($redirect_message)) {
$toks['redirected'] = $redirect_message;
}
$toks['ROBOTS_META'] = 'index,follow';
$toks['PAGE_DESCRIPTION'] = $page_content->getDescription();
$toks['PAGE_KEYWORDS'] = GleanKeywords($page);
if (!$template) {
$template = new Template('html', $request);
}
$template->printExpansion($toks);
$page->increaseHitCount();
if ($request->getArg('action') != 'pdf') {
$request->checkValidators();
}
flush();
}
示例8: run
function run($dbi, $argstr, &$request, $basepage)
{
if ($request->getArg('action') != 'browse') {
if (!$request->getArg('action') == _("PhpWikiAdministration/Markup")) {
return $this->disabled("(action != 'browse')");
}
}
$args = $this->getArgs($argstr, $request);
$this->_args = $args;
$this->preSelectS($args, $request);
$p = $request->getArg('p');
if (!$p) {
$p = $this->_list;
}
$post_args = $request->getArg('admin_markup');
if (!$request->isPost() and empty($post_args['markup'])) {
$post_args['markup'] = $args['markup'];
}
$next_action = 'select';
$pages = array();
if ($p && !$request->isPost()) {
$pages = $p;
}
if ($p && $request->isPost() && !empty($post_args['button']) && empty($post_args['cancel'])) {
// without individual PagePermissions:
if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
$request->_notAuthorized(WIKIAUTH_ADMIN);
$this->disabled("! user->isAdmin");
}
// DONE: error message if not allowed.
if ($post_args['action'] == 'verify') {
// Real action
return $this->chmarkupPages($dbi, $request, array_keys($p), $post_args['markup']);
}
if ($post_args['action'] == 'select') {
if (!empty($post_args['markup'])) {
$next_action = 'verify';
}
foreach ($p as $name => $c) {
$pages[$name] = 1;
}
}
}
if ($next_action == 'select' and empty($pages)) {
$pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
}
if ($next_action == 'select') {
$pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args);
} else {
$pagelist = new PageList_Unselectable($args['info'], $args['exclude'], $args);
}
$pagelist->addPageList($pages);
$header = HTML::fieldset();
if ($next_action == 'verify') {
$button_label = _("Yes");
$header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently change the markup type of the selected files?"))));
$header = $this->chmarkupForm($header, $post_args);
} else {
$button_label = _("Change markup type");
$header->pushContent(HTML::legend(_("Select the pages to change the markup type")));
$header = $this->chmarkupForm($header, $post_args);
}
$buttons = HTML::p(Button('submit:admin_markup[button]', $button_label, 'wikiadmin'), Button('submit:admin_markup[cancel]', _("Cancel"), 'button'));
$header->pushContent($buttons);
return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_markup')), HiddenInputs(array('admin_markup[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)));
}
示例9: summaryAsHTML
function summaryAsHTML($rev)
{
if (!($summary = $this->summary($rev))) {
return '';
}
return HTML::strong(array('class' => 'wiki-summary'), "[", $summary, "]");
}
示例10: run
function run($dbi, $argstr, &$request, $basepage)
{
if ($request->getArg('action') != 'browse') {
if ($request->getArg('action') != _("PhpWikiAdministration/Rename")) {
return $this->disabled("(action != 'browse')");
}
}
$args = $this->getArgs($argstr, $request);
$this->_args = $args;
$this->preSelectS($args, $request);
$p = $request->getArg('p');
if (!$p) {
$p = $this->_list;
}
$post_args = $request->getArg('admin_rename');
$next_action = 'select';
$pages = array();
if ($p && !$request->isPost()) {
$pages = $p;
}
if ($p && $request->isPost() && !empty($post_args['rename']) && empty($post_args['cancel'])) {
// without individual PagePermissions:
if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
$request->_notAuthorized(WIKIAUTH_ADMIN);
$this->disabled("! user->isAdmin");
}
// DONE: error message if not allowed.
if ($post_args['action'] == 'verify') {
// Real action
return $this->renamePages($dbi, $request, array_keys($p), $post_args['from'], $post_args['to'], !empty($post_args['updatelinks']));
}
if ($post_args['action'] == 'select') {
if (!empty($post_args['from'])) {
$next_action = 'verify';
}
foreach ($p as $name => $c) {
$pages[$name] = 1;
}
}
}
if ($next_action == 'select' and empty($pages)) {
// List all pages to select from.
$pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
}
if ($next_action == 'verify') {
$args['info'] = "checkbox,pagename,renamed_pagename";
}
$pagelist = new PageList_Selectable($args['info'], $args['exclude'], array('types' => array('renamed_pagename' => new _PageList_Column_renamed_pagename('rename', _("Rename to")))));
$pagelist->addPageList($pages);
$header = HTML::p();
if ($next_action == 'verify') {
$button_label = _("Yes");
$header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently rename the selected files?"))));
$header = $this->renameForm($header, $post_args);
} else {
$button_label = _("Rename selected pages");
$header->pushContent(HTML::p(_("Select the pages to rename:")));
if (!$post_args and count($pages) == 1) {
list($post_args['from'], ) = array_keys($pages);
$post_args['to'] = $post_args['from'];
}
$header = $this->renameForm($header, $post_args);
}
$buttons = HTML::p(Button('submit:admin_rename[rename]', $button_label, 'wikiadmin'), Button('submit:admin_rename[cancel]', _("Cancel"), 'button'));
return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_rename')), HiddenInputs(array('admin_rename[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons);
}
示例11: setaclForm
function setaclForm(&$header, $post_args, $pagehash)
{
$acl = $post_args['acl'];
//FIXME: find intersection of all pages perms, not just from the last pagename
$pages = array();
foreach ($pagehash as $name => $checked) {
if ($checked) {
$pages[] = $name;
}
}
$perm_tree = pagePermissions($name);
$table = pagePermissionsAclFormat($perm_tree, !empty($pages));
$header->pushContent(HTML::strong(_("Selected Pages: ")), HTML::tt(join(', ', $pages)), HTML::br());
$first_page = $GLOBALS['request']->_dbi->getPage($name);
$owner = $first_page->getOwner();
list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
//if (DEBUG) $header->pushContent(HTML::pre("Permission tree for $name:\n",print_r($perm_tree,true)));
if ($type == 'inherited') {
$type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
} elseif ($type == 'page') {
$type = _("individual page permission");
} elseif ($type == 'default') {
$type = _("default page permission");
}
$header->pushContent(HTML::strong(_("Type") . ': '), HTML::tt($type), HTML::br());
$header->pushContent(HTML::strong(_("ACL") . ': '), HTML::tt($perm->asAclLines()), HTML::br());
$header->pushContent(HTML::p(HTML::strong(_("Description") . ': '), _("Selected Grant checkboxes allow access, unselected checkboxes deny access."), _("To ignore delete the line."), _("To add check 'Add' near the dropdown list.")));
$header->pushContent($table);
//
// display array of checkboxes for existing perms
// and a dropdown for user/group to add perms.
// disabled if inherited,
// checkbox to disable inheritance,
// another checkbox to progate new permissions to all childs (if there exist some)
//Todo:
// warn if more pages are selected and they have different perms
//$header->pushContent(HTML::input(array('name' => 'admin_setacl[acl]',
// 'value' => $post_args['acl'])));
$header->pushContent(HTML::br());
if (!empty($pages) and defined('EXPERIMENTAL') and EXPERIMENTAL) {
$checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_setacl[updatechildren]', 'value' => 1));
if (!empty($post_args['updatechildren'])) {
$checkbox->setAttr('checked', 'checked');
}
$header->pushContent($checkbox, _("Propagate new permissions to all subpages?"), HTML::raw(" "), HTML::em(_("(disable individual page permissions, enable inheritance)?")), HTML::br(), HTML::em(_("(Currently not working)")));
}
$header->pushContent(HTML::hr());
return $header;
}
示例12: run
function run($dbi, $argstr, &$request, $basepage)
{
$this->_args = $this->getArgs($argstr, $request);
extract($this->_args);
if (!$page) {
return '';
}
$hidden_pagemeta = array('_cached_html');
$readonly_pagemeta = array('hits');
$dbi = $request->getDbh();
$p = $dbi->getPage($page);
$pagemeta = $p->getMetaData();
// Look at arguments to see if submit was entered. If so,
// process this request before displaying.
//
if ($request->isPost() and $request->_user->isAdmin() and $request->getArg('metaedit')) {
$metafield = trim($request->getArg('metafield'));
$metavalue = trim($request->getArg('metavalue'));
if (!in_array($metafield, $readonly_pagemeta)) {
if (preg_match('/^(.*?)\\[(.*?)\\]$/', $metafield, $matches)) {
list(, $array_field, $array_key) = $matches;
$array_value = $pagemeta[$array_field];
$array_value[$array_key] = $metavalue;
$p->set($array_field, $array_value);
} else {
$p->set($metafield, $metavalue);
}
}
$dbi->touch();
$url = $request->getURLtoSelf(false, array('metaedit', 'metafield', 'metavalue'));
$request->redirect($url);
// The rest of the output will not be seen due to the
// redirect.
}
// Now we show the meta data and provide entry box for new data.
$html = HTML();
$html->pushContent(fmt("Existing page-level metadata for %s:", $page));
$dl = HTML::dl();
foreach ($pagemeta as $key => $val) {
if (is_string($val) and substr($val, 0, 2) == 'a:') {
$dl->pushContent(HTML::dt("\n{$key} => {$val}\n", $dl1 = HTML::dl()));
foreach (unserialize($val) as $akey => $aval) {
$dl1->pushContent(HTML::dt(HTML::strong("{$key}" . '[' . $akey . "] => {$aval}\n")));
}
$dl->pushContent($dl1);
} elseif (is_array($val)) {
$dl->pushContent(HTML::dt("\n{$key}:\n", $dl1 = HTML::dl()));
foreach ($val as $akey => $aval) {
$dl1->pushContent(HTML::dt(HTML::strong("{$key}" . '[' . $akey . "] => {$aval}\n")));
}
$dl->pushContent($dl1);
} elseif (in_array($key, $hidden_pagemeta)) {
} elseif (in_array($key, $readonly_pagemeta)) {
$dl->pushContent(HTML::dt(array('style' => 'background: #dddddd'), "{$key} => {$val}\n"));
} else {
$dl->pushContent(HTML::dt(HTML::strong("{$key} => {$val}\n")));
}
}
$html->pushContent($dl);
if ($request->_user->isAdmin()) {
$action = $request->getPostURL();
$hiddenfield = HiddenInputs($request->getArgs());
$instructions = _("Add or change a page-level metadata 'key=>value' pair. Note that you can remove a key by leaving the value-box empty.");
$keyfield = HTML::input(array('name' => 'metafield'), '');
$valfield = HTML::input(array('name' => 'metavalue'), '');
$button = Button('submit:metaedit', _("Submit"), false);
$form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $hiddenfield, $instructions, HTML::br(), $keyfield, ' => ', $valfield, HTML::raw(' '), $button);
$html->pushContent(HTML::br(), $form);
} else {
$html->pushContent(HTML::em(_("Requires WikiAdmin privileges to edit.")));
}
return $html;
}
示例13: setaclForm
function setaclForm(&$header, $pagehash)
{
$pages = array();
foreach ($pagehash as $name => $checked) {
if ($checked) {
$pages[] = $name;
}
}
$header->pushContent(HTML::strong(_("Selected Pages: ")), HTML::tt(join(', ', $pages)), HTML::br());
return $header;
}
示例14: error
function error($message)
{
return HTML::div(array('class' => 'errors'), HTML::strong(fmt("Plugin %s failed.", $this->getName())), ' ', $message);
}
示例15: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
if (!$lang) {
return $this->error(_("This internal action page cannot viewed.") . "\n" . _("You can only use it via the _WikiTranslation plugin."));
}
$this->lang = $lang;
//action=save
if (!empty($translate) and isset($translate['submit']) and $request->isPost()) {
$trans = $translate["content"];
if (empty($trans) or $trans == $pagename) {
$header = HTML(HTML::h2(_("Translation Error!")), HTML::p(_("Your translated text is either empty or equal to the untranslated text. Please try again.")));
} else {
//save translation in a users subpage
$user = $request->getUser();
$homepage = $user->_HomePagehandle;
$transpagename = $homepage->getName() . SUBPAGE_SEPARATOR . _("ContributedTranslations");
$page = $dbi->getPage($transpagename);
$current = $page->getCurrentRevision();
$version = $current->getVersion();
if ($version) {
$text = $current->getPackedContent() . "\n";
$meta = $current->_data;
} else {
$text = '';
$meta = array('markup' => 2.0, 'author' => $user->getId());
}
$text .= $user->getId() . " " . Iso8601DateTime() . "\n" . "* " . sprintf(_("Translate '%s' to '%s' in *%s*"), $pagename, $trans, $lang);
$text .= "\n <verbatim>locale/po/{$lang}.po:\n msgid \"" . $pagename . "\"\n msgstr \"" . $trans . "\"\n </verbatim>";
$meta['summary'] = sprintf(_("Translate %s to %s in %s"), substr($pagename, 0, 15), substr($trans, 0, 15), $lang);
$page->save($text, $version + 1, $meta);
// TODO: admin notification
return HTML(HTML::h2(_("Thanks for adding this translation!")), HTML::p(fmt("Your translated text doesn't yet appear in this %s, but the Administrator will pick it up and add to the installation.", WIKI_NAME)), fmt("Your translation is stored in %s", WikiLink($transpagename)));
}
}
$trans = $this->translate($pagename, $lang, 'en');
//Todo: google lookup or at least a google lookup button.
if (isset($header)) {
$header = HTML($header, fmt("From english to %s: ", HTML::strong($lang)));
} else {
$header = fmt("From english to %s: ", HTML::strong($lang));
}
$button_label = _("Translate");
$buttons = HTML::p(Button('submit:translate[submit]', $button_label, 'wikiadmin'), Button('submit:translate[cancel]', _("Cancel"), 'button'));
return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, HTML::textarea(array('class' => 'wikiedit', 'name' => 'translate[content]', 'id' => 'translate[content]', 'rows' => 4, 'cols' => $request->getPref('editWidth'), 'wrap' => 'virtual'), $trans), HiddenInputs($request->getArgs(), false, array('translate')), HiddenInputs(array('translate[action]' => $pagename, 'require_authority_for_post' => WIKIAUTH_BOGO)), $buttons);
}