本文整理汇总了PHP中gTxt函数的典型用法代码示例。如果您正苦于以下问题:PHP gTxt函数的具体用法?PHP gTxt怎么用?PHP gTxt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gTxt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: header
function header()
{
global $txp_user;
$out[] = '<div id="masthead"><ul id="nav">';
foreach ($this->menu as $tab) {
$class = $tab['active'] ? 'tabup active' : 'tabdown inactive';
$out[] = "<li class='primary {$class}'><a href='?event={$tab['event']}'>{$tab['label']}</a>";
if (!empty($tab['items'])) {
$out[] = '<ul>';
foreach ($tab['items'] as $item) {
$class = $item['active'] ? 'tabup active' : 'tabdown2 inactive';
$out[] = "<li class='secondary {$class}'><a href='?event={$item['event']}'>{$item['label']}</a></li>";
}
$out[] = '</ul>';
}
$out[] = '</li>';
}
$out[] = '<li id="view-site" class="primary tabdown inactive"><a href="' . hu . '" target="_blank">' . gTxt('tab_view_site') . '</a></li>';
if ($txp_user) {
$out[] = '<li id="logout" class="primary tabdown inactive"><a href="index.php?logout=1" onclick="return verify(\'' . gTxt('are_you_sure') . '\')">' . gTxt('logout') . '</a></li>';
}
$out[] = '</ul></div>';
$out[] = '<div id="messagepane">' . $this->announce($this->message) . '</div>';
return join(n, $out);
}
开发者ID:psic,项目名称:websites,代码行数:25,代码来源:remora.php
示例2: announce
function announce($thing)
{
// $thing[0]: message text
// $thing[1]: message type, defaults to "success" unless empty or a different flag is set
if ($thing === '') {
return '';
}
if (!is_array($thing) || !isset($thing[1])) {
$thing = array($thing, 0);
}
switch ($thing[1]) {
case E_ERROR:
$class = 'error';
break;
case E_WARNING:
$class = 'warning';
break;
default:
$class = 'success';
break;
}
$html = "<span id='message' class='{$class}'>" . gTxt($thing[0]) . '</span>';
// Try to inject $html into the message pane no matter when announce()'s output is printed
$js = addslashes($html);
$js = <<<EOS
\t\t\$(document).ready( function(){
\t \t\t\$("#messagepane").html("{$js}");
\t\t\t\$('#messagepane #message.error').fadeOut(800).fadeIn(800);
\t\t\t\$('#messagepane #message.warning').fadeOut(800).fadeIn(800);
\t\t} )
EOS;
return script_js(str_replace('</', '<\\/', $js), $html);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:33,代码来源:classic.php
示例3: set_state
function set_state($area, $event, $is_popup, $message)
{
$this->is_popup = $is_popup;
$this->message = $message;
if ($is_popup) {
return $this;
}
// use legacy areas() for b/c
$areas = areas();
$tabs = array('content' => array('label' => gTxt('tab_content'), 'event' => 'article'), 'presentation' => array('label' => gTxt('tab_presentation'), 'event' => 'page'), 'admin' => array('label' => gTxt('tab_admin'), 'event' => 'admin'));
if (empty($areas['extensions'])) {
unset($areas['extensions']);
} else {
$tabs = $tabs + array('extensions' => array('label' => gTxt('tab_extensions'), 'event' => reset($areas['extensions'])));
}
foreach ($areas as $ar => $items) {
if (has_privs('tab.' . $ar)) {
$this->menu[$ar] = array('label' => $tabs[$ar]['label'], 'event' => $tabs[$ar]['event'], 'active' => $ar == $area);
foreach ($items as $a => $b) {
if (has_privs($b)) {
$this->menu[$ar]['items'][] = array('label' => $a, 'event' => $b, 'active' => $b == $event);
}
}
}
}
return $this;
}
开发者ID:joebushi,项目名称:textpattern,代码行数:27,代码来源:txplib_theme.php
示例4: __construct
/**
* {@inheritdoc}
*/
public function __construct($callable)
{
if (!is_callable($callable)) {
throw new Textpattern_Filter_Exception(gTxt('assert_callable'));
}
parent::__construct($callable);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:10,代码来源:Callable.php
示例5: register
/**
* {@inheritdoc}
*/
public function register($alias, $class)
{
if (isset($this->registered[$alias])) {
throw new InvalidArgumentException(gTxt('alias_is_taken'));
}
$this->registered[$alias] = $class;
return $this;
}
开发者ID:scar45,项目名称:textpattern,代码行数:11,代码来源:Container.php
示例6: ui
/**
* User interface
*/
static function ui($event, $step)
{
global $step;
pagetop(gTxt(__CLASS__));
$available_steps = array('export');
if (!$step or !in_array($step, $available_steps)) {
$step = 'export';
}
self::$step();
}
开发者ID:rwetzlmayr,项目名称:wet_sql2php,代码行数:13,代码来源:wet_sql2php.php
示例7: export
function export($message = '')
{
global $prefs;
extract($prefs);
$template = new template();
pagetop(gTxt('template'), $message);
print "\n <style type='text/css'>\n .success { color: #009900; }\n .failure { color: #FF0000; }\n </style>\n\t\t\t\n <table cellpadding='0' cellspacing='0' border='0' id='list' align='center'>\n <tr>\n <td>\n ";
$dir = ps('export_dir');
$dir = str_replace(array(" "), array("-"), $dir);
$template->export($dir);
print "\n </td>\n </tr>\n </table>\n ";
}
开发者ID:nope,项目名称:Tipattern,代码行数:12,代码来源:txp_template.php
示例8: __construct
/**
* Constructor.
*
* @param string|null $doctype The output doctype
*/
public function __construct($doctype = null)
{
if ($doctype === null) {
$doctype = get_pref('doctype', 'html5');
}
parent::__construct($doctype);
$this->setRelativeImagePrefix(hu);
$this->setSymbol('quote_single_open', gTxt('txt_quote_single_open'));
$this->setSymbol('quote_single_close', gTxt('txt_quote_single_close'));
$this->setSymbol('quote_double_open', gTxt('txt_quote_double_open'));
$this->setSymbol('quote_double_close', gTxt('txt_quote_double_close'));
}
开发者ID:hcgtv,项目名称:textpattern,代码行数:17,代码来源:Parser.php
示例9: show_mentions
function show_mentions()
{
global $id;
if ($id) {
$rs = safe_rows("*", "txp_log_mention", "article_id='{$id}'");
if ($rs) {
foreach ($rs as $a) {
extract($a);
$out[] = '<a href="http://' . $refpage . '" title="' . $excerpt . '">' . $reftitle . '</a>';
}
return hed(gTxt('mentions'), 3) . graf(join(br, $out));
}
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:14,代码来源:mention.php
示例10: reset_author_pass
function reset_author_pass($name)
{
$email = safe_field('email', 'txp_users', "name = '" . doSlash($name) . "'");
$new_pass = doSlash(generate_password(6));
$rs = safe_update('txp_users', "pass = password(lower('{$new_pass}'))", "name = '" . doSlash($name) . "'");
if ($rs) {
if (send_new_password($new_pass, $email, $name)) {
return gTxt('password_sent_to') . ' ' . $email;
} else {
return gTxt('could_not_mail') . ' ' . $email;
}
} else {
return gTxt('could_not_update_author') . ' ' . htmlspecialchars($name);
}
}
开发者ID:nope,项目名称:Tipattern,代码行数:15,代码来源:txplib_admin.php
示例11: setLocale
/**
* Sets the locale.
*
* This method wraps around system setlocale. It takes an IETF language code
* and sets the locale accordingly.
*
* The following would set the locale to English:
*
* <code>
* Txp::get('Textpattern\L10n\Locale')->setLocale(LC_ALL, 'en-GB');
* </code>
*
* This would format currencies according to the French localisation:
*
* <code>
* Txp::get('Textpattern\L10n\Locale')->setLocale(LC_MONETARY, 'fr-FR');
* echo money_format('%i', 51.99);
* </code>
*
* The '51.99' would be returned as '51,99 EUR' if you have up to date
* French locale installed on your system.
*
* If an array of locales is provided, the first one that works is used.
*
* @param int $category The localisation category to change
* @param string|array $locale The language code
* @return Locale
* @throws \Exception
* @see setlocale()
*/
public function setLocale($category, $locale)
{
foreach ((array) $locale as $name) {
$code = strtolower($name);
if (isset($this->locales[$code])) {
if (@setlocale($category, $this->locales[$code])) {
return $this;
}
}
}
if (@setlocale($category, $name)) {
return $this;
}
throw new \Exception(gTxt('invalid_argument', array('{name}' => 'locale')));
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:45,代码来源:Locale.php
示例12: reset_author_pass
function reset_author_pass($name)
{
$email = safe_field('email', 'txp_users', "name = '" . doSlash($name) . "'");
$new_pass = generate_password(PASSWORD_LENGTH);
$hash = doSlash(txp_hash_password($new_pass));
$rs = safe_update('txp_users', "pass = '{$hash}'", "name = '" . doSlash($name) . "'");
if ($rs) {
if (send_new_password($new_pass, $email, $name)) {
return gTxt('password_sent_to') . ' ' . $email;
} else {
return gTxt('could_not_mail') . ' ' . $email;
}
} else {
return gTxt('could_not_update_author') . ' ' . txpspecialchars($name);
}
}
开发者ID:balcides,项目名称:Cathartic_server,代码行数:16,代码来源:txplib_admin.php
示例13: element_list
function element_list($event, $step)
{
$message = '';
pagetop(gTxt('element'), $message);
echo startTable('list') . assHead('element', 'version', 'date', 'active', 'checksum');
$rs = safe_rows('*', 'txp_element', '1=1');
foreach ($rs as $row) {
extract($row);
if ($hash) {
$checksum = md5_file(txpath . '/elements/' . $name . '.php') == $hash ? gTxt('ok') : gTxt('modified');
} else {
$checksum = gTxt('unknown');
}
echo tr(td($name) . td($version) . td($modified) . td($status ? gTxt('yes') : gTxt('no')) . td($checksum));
}
echo endTable();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:17,代码来源:txp_element.php
示例14: search
/**
* Performs searching and returns results.
*
* This is now performed by doArticles().
*
* @param string $q
* @deprecated in 4.0.4
* @see doArticles()
*/
function search($q)
{
global $prefs;
$url = $prefs['siteurl'];
extract($prefs);
$s_filter = filterSearch();
$form = fetch('form', 'txp_form', 'name', 'search_results');
// Lose this eventually - only used if search_results form is missing.
$form = !$form ? legacy_form() : $form;
$rs = safe_rows("*, ID AS thisid, UNIX_TIMESTAMP(Posted) AS posted, Title AS title,\n MATCH (Title,Body) AGAINST ('{$q}') AS score", 'textpattern', "(Title RLIKE '{$q}' OR Body RLIKE '{$q}') {$s_filter}\n AND Status = 4 AND Posted <= " . now('posted') . " ORDER BY score DESC LIMIT 40");
if ($rs) {
$result_rows = count($rs);
$text = $result_rows == 1 ? gTxt('article_found') : gTxt('articles_found');
} else {
$result_rows = 0;
$text = gTxt('articles_found');
}
$results[] = graf($result_rows . ' ' . $text);
if ($result_rows > 0) {
foreach ($rs as $a) {
extract($a);
$result_date = safe_strftime($archive_dateformat, $posted);
$uTitle = $url_title ? $url_title : stripSpace($Title);
$hurl = permlinkurl($a);
$result_url = '<a href="' . $hurl . '">' . $hurl . '</a>';
$result_title = '<a href="' . $hurl . '">' . $Title . '</a>';
$result = preg_replace("/>\\s*</", "> <", $Body_html);
preg_match_all("/\\s.{1,50}" . preg_quote($q) . ".{1,50}\\s/i", $result, $concat);
$concat = join(" ... ", $concat[0]);
$concat = strip_tags($concat);
$concat = preg_replace('/^[^>]+>/U', "", $concat);
$concat = preg_replace("/({$q})/i", "<strong>\$1</strong>", $concat);
$result_excerpt = $concat ? "... " . $concat . " ..." : '';
$glob['search_result_title'] = $result_title;
$glob['search_result_excerpt'] = $result_excerpt;
$glob['search_result_url'] = $result_url;
$glob['search_result_date'] = $result_date;
$GLOBALS['this_result'] = $glob;
$thisresult = $form;
$results[] = parse($thisresult);
}
}
return is_array($results) ? join('', $results) : '';
}
开发者ID:scar45,项目名称:textpattern,代码行数:53,代码来源:search.php
示例15: search
function search($q)
{
global $prefs;
$url = $prefs['siteurl'];
extract($prefs);
$s_filter = filterSearch();
$form = fetch('form', 'txp_form', 'name', 'search_results');
// lose this eventually - only used if search_results form is missing
$form = !$form ? legacy_form() : $form;
$rs = safe_rows("*, ID as thisid, unix_timestamp(Posted) as posted, Title as title,\n\t\t\tmatch (Title,Body) against ('{$q}') as score", "textpattern", "(Title rlike '{$q}' or Body rlike '{$q}') {$s_filter}\n\t\t\tand Status = 4 and Posted <=now() order by score desc limit 40");
if ($rs) {
$result_rows = count($rs);
$text = $result_rows == 1 ? gTxt('article_found') : gTxt('articles_found');
} else {
$result_rows = 0;
$text = gTxt('articles_found');
}
$results[] = graf($result_rows . ' ' . $text);
if ($result_rows > 0) {
foreach ($rs as $a) {
extract($a);
$result_date = safe_strftime($archive_dateformat, $posted);
$uTitle = $url_title ? $url_title : stripSpace($Title);
$hurl = permlinkurl($a);
$result_url = '<a href="' . $hurl . '">' . $hurl . '</a>';
$result_title = '<a href="' . $hurl . '">' . $Title . '</a>';
$result = preg_replace("/>\\s*</", "> <", $Body_html);
preg_match_all("/\\s.{1,50}" . preg_quote($q) . ".{1,50}\\s/i", $result, $concat);
$concat = join(" ... ", $concat[0]);
$concat = strip_tags($concat);
$concat = preg_replace('/^[^>]+>/U', "", $concat);
$concat = preg_replace("/({$q})/i", "<strong>\$1</strong>", $concat);
$result_excerpt = $concat ? "... " . $concat . " ..." : '';
$glob['search_result_title'] = $result_title;
$glob['search_result_excerpt'] = $result_excerpt;
$glob['search_result_url'] = $result_url;
$glob['search_result_date'] = $result_date;
$GLOBALS['this_result'] = $glob;
$thisresult = $form;
$results[] = parse($thisresult);
}
}
return is_array($results) ? join('', $results) : '';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:44,代码来源:search.php
示例16: log_list
function log_list()
{
pagetop(gTxt('visitor_logs'));
extract(get_prefs());
safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)");
safe_optimize("txp_log");
safe_repair("txp_log");
$page = gps('page');
$total = getCount('txp_log', "1");
$limit = 50;
$numPages = ceil($total / $limit);
$page = !$page ? 1 : $page;
$offset = ($page - 1) * $limit;
$nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : '';
$nav[] = sp . small($page . '/' . $numPages) . sp;
$nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : '';
$rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}");
if ($rs) {
echo startTable('list'), assHead('time', 'host', 'page', 'referrer');
$stamp = '';
while ($a = nextRow($rs)) {
extract($a);
if ($refer) {
$referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50));
$referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>';
} else {
$referprint = ' ';
}
$pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1)));
$pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>';
if ($method == 'POST') {
$pageprint = '<b>' . $pageprint . '</b>';
}
$fstamp = date("n/j g:i a", $stamp + tz_offset());
$hostprint = chunk($host, 40);
echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint));
unset($refer, $referprint, $page, $pageprint);
}
echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable();
} else {
echo graf(gTxt('no_refers_recorded'), ' align="center"');
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:43,代码来源:txp_log.php
示例17: _announce
private function _announce($thing, $async, $modal)
{
// $thing[0]: message text
// $thing[1]: message type, defaults to "success" unless empty or a different flag is set
if (!is_array($thing) || !isset($thing[1])) {
$thing = array($thing, 0);
}
// still nothing to say?
if (trim($thing[0]) === '') {
return '';
}
switch ($thing[1]) {
case E_ERROR:
$class = 'error';
break;
case E_WARNING:
$class = 'warning';
break;
default:
$class = 'success';
break;
}
if ($modal) {
$html = '';
// TODO: Say what?
$js = 'window.alert("' . escape_js(strip_tags($thing[0])) . '")';
} else {
$html = '<span id="message" class="' . $class . '">' . gTxt($thing[0]) . ' <a href="#close" class="close">×</a></span>';
// Try to inject $html into the message pane no matter when _announce()'s output is printed
$js = escape_js($html);
$js = <<<EOS
\t\t\t\t\$(document).ready(function() {
\t\t\t\t\t\$("#messagepane").html("{$js}");
\t\t\t\t\t\$('#message.success, #message.warning, #message.error').fadeOut('fast').fadeIn('fast');
\t\t\t\t});
EOS;
}
if ($async) {
return $js;
} else {
return script_js(str_replace('</', '<\\/', $js), $html);
}
}
开发者ID:balcides,项目名称:Cathartic_server,代码行数:43,代码来源:classic.php
示例18: search
function search($q)
{
global $prefs;
$url = $prefs['siteurl'];
extract($prefs);
$s_filter = filterSearch();
$form = fetch('form', 'txp_form', 'name', 'search_results');
// lose this eventually - only used if search_results form is missing
$form = !$form ? legacy_form() : $form;
$rs = safe_rows("ID, Title, Body_html, Section, unix_timestamp(Posted) as uPosted, \n\t\t\tmatch (Title,Body) against ('{$q}') as score", "textpattern", "Title rlike '{$q}' or Body rlike '{$q}' {$s_filter}\n\t\t\tand Status = 4 and Posted <=now() order by score desc limit 40");
if ($rs) {
$result_rows = count($rs);
$text = $result_rows == 1 ? gTxt('article_found') : gTxt('articles_found');
} else {
$result_rows = 0;
$text = gTxt('articles_found');
}
$results[] = graf($result_rows . ' ' . $text);
if ($result_rows > 0) {
foreach ($rs as $a) {
extract($a);
$result_date = date("j M Y", $uPosted);
$hurl = $url_mode ? $siteurl . $path_from_root . $Section . '/' . $ID . '/' . stripSpace($Title) : $siteurl . $path_from_root . 'index.php?id=' . $ID;
$result_url = '<a href="http://' . $hurl . '">' . $hurl . '</a>';
$result_title = '<a href="http://' . $hurl . '">' . $Title . '</a>';
$result = preg_replace("/>\\s*</", "> <", $Body_html);
preg_match_all("/\\s.{0,50}" . $q . ".{0,50}\\s/i", $result, $concat);
$concat = implode(" ... ", $concat[0]);
$concat = strip_tags($concat);
$concat = preg_replace('/^[^>]+>/U', "", $concat);
$concat = preg_replace("/({$q})/i", "<strong>\$1</strong>", $concat);
$result_excerpt = $concat ? "... " . $concat . " ..." : '';
$glob['search_result_title'] = $result_title;
$glob['search_result_excerpt'] = $result_excerpt;
$glob['search_result_url'] = $result_url;
$glob['search_result_date'] = $result_date;
$GLOBALS['this_result'] = $glob;
$thisresult = $form;
$results[] = parse($thisresult);
}
}
return is_array($results) ? join('', $results) : '';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:43,代码来源:search.php
示例19: page_edit_form
function page_edit_form($name)
{
global $step;
if ($step == 'div_edit') {
list($html_array, $html, $start_pos, $stop_pos) = extract_div();
$html_array = serialize($html_array);
$outstep = 'div_save';
} else {
$html = safe_field('user_html', 'txp_page', "name='{$name}'");
$outstep = 'page_save';
}
$out[] = textarea('500', '600', $html, 'html') . graf(fInput('submit', 'save', gTxt('save'), 'publish') . eInput('page') . sInput($outstep) . hInput('name', $name));
if ($step == 'div_edit') {
$out[] = hInput('html_array', $html_array) . hInput('start_pos', $start_pos) . hInput('stop_pos', $stop_pos) . hInput('name', $name);
} else {
$out[] = graf(gTxt('copy_page_as') . fInput('text', 'newname', '', 'edit') . fInput('submit', 'copy', gTxt('copy'), 'smallerbox'));
}
return form(join('', $out));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:19,代码来源:txp_page.php
示例20: jmd_dashboard
/**
* Parses the form "jmd_dashboard".
*
* @param string $event
* @param string $step
*/
function jmd_dashboard($event, $step)
{
pageTop(gTxt('jmd_dashboard_tab'));
include_once txpath . DS . 'publish.php';
if (empty($GLOBALS['pretext'])) {
$GLOBALS['pretext'] = array('id' => '', 'q' => '');
}
$contents = safe_field("Form", "txp_form", "name = 'jmd_dashboard'");
if ($contents === FALSE) {
$contents = <<<FORM
<h1 style="text-align:center">
Hey, you haven’t customized jmd_dashboard yet.
<a href="?event=form&step=form_edit&name=jmd_dashboard">
Do it now!
</a>
</h1>
<div style="margin: 0 auto; width: 400px;">
<h1>
<txp:site_name/>: Last modified on <txp:jmd_dashboard_lastmod/>
</h1>
<h2>Recently published articles</h2>
<txp:article_custom break="li" wraptag="ul">
<txp:title/> –
<txp:jmd_dashboard_edit>
edit #<txp:article_id/>
</txp:jmd_dashboard_edit>
</txp:article_custom>
<h2>Recent comments</h2>
<txp:recent_comments break="li" wraptag="ul">
<txp:comment_message/> – <txp:comment_name link="0"/>
(<txp:jmd_dashboard_edit type="comment">edit</txp:jmd_dashboard_edit>)
</txp:recent_comments>
</div>
FORM;
safe_insert("txp_form", "Form='" . doSlash($contents) . "',\n type='misc', name='jmd_dashboard'");
}
echo parse($contents);
}
开发者ID:jmdeldin,项目名称:jmd_dashboard,代码行数:47,代码来源:dashboard.php
注:本文中的gTxt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论