本文整理汇总了PHP中gTxt函数的典型用法代码示例。如果您正苦于以下问题:PHP gTxt函数的具体用法?PHP gTxt怎么用?PHP gTxt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gTxt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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;
}
示例4: __construct
/**
* {@inheritdoc}
*/
public function __construct($callable)
{
if (!is_callable($callable)) {
throw new Textpattern_Filter_Exception(gTxt('assert_callable'));
}
parent::__construct($callable);
}
示例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;
}
示例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();
}
示例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 ";
}
示例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'));
}
示例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));
}
}
}
示例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);
}
}
示例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')));
}
示例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);
}
}
示例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();
}
示例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) : '';
}
示例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) : '';
}