本文整理汇总了PHP中tlocal::get方法的典型用法代码示例。如果您正苦于以下问题:PHP tlocal::get方法的具体用法?PHP tlocal::get怎么用?PHP tlocal::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tlocal
的用法示例。
在下文中一共展示了tlocal::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterpost
public function filterpost(tpost $post, $s)
{
$cancel = false;
$this->callevent('beforecontent', array($post, &$s, &$cancel));
if ($cancel) {
return $this->aftercontent($post);
}
$moretag = ' <!--more-->';
if (preg_match('/<!--more(.*?)?-->/', $s, $matches) || preg_match('/\\[more(.*?)?\\]/', $s, $matches) || preg_match('/\\[cut(.*?)?\\]/', $s, $matches)) {
$parts = explode($matches[0], $s, 2);
$excerpt = $this->filter(trim($parts[0]) . $moretag);
$post->filtered = $excerpt . $this->extract_pages($post, trim($parts[1]));
$this->setexcerpt($post, $excerpt, self::gettitle($matches[1]));
if ($post->moretitle == '') {
$post->moretitle = tlocal::get('default', 'more');
}
} else {
if ($this->automore) {
$post->filtered = $this->extract_pages($post, $s);
$this->setexcerpt($post, $this->filter(trim(self::GetExcerpt($post->pagescount == 1 ? $s : $post->filtered, $this->automorelength)) . $moretag), tlocal::get('default', 'more'));
} else {
$post->filtered = $this->extract_pages($post, $s);
$this->setexcerpt($post, $post->filtered, '');
}
}
$post->description = self::getpostdescription($post->excerpt);
$this->aftercontent($post);
}
示例2: autherror
public static function autherror($email, $password)
{
tlocal::admin();
if (empty($email) || empty($password)) {
return tlocal::get('login', 'empty');
}
$iduser = litepublisher::$options->emailexists($email);
if (!$iduser) {
if (self::confirm_reg($email, $password)) {
return;
}
return tlocal::get('login', 'unknownemail');
}
if (litepublisher::$options->authpassword($iduser, $password)) {
return;
}
if (self::confirm_restore($email, $password)) {
return;
}
//check if password is empty and neet to restore password
if ($iduser == 1) {
if (!litepublisher::$options->password) {
return tlocal::get('login', 'torestorepass');
}
} else {
if (!tusers::i()->getpassword($iduser)) {
return tlocal::get('login', 'torestorepass');
}
}
return tlocal::get('login', 'error');
}
示例3: getlist
private function getlist()
{
$foaf = tfoaf::i();
$perpage = 20;
$total = $foaf->getcount();
$from = $this->getfrom($perpage, $total);
if ($foaf->dbversion) {
$items = $foaf->select('', " order by status asc, added desc limit {$from}, {$perpage}");
if (!$items) {
$items = array();
}
} else {
$items = array_slice(array_keys($foaf->items), $from, $perpage);
}
$html = $this->html;
$result = $html->tableheader();
$args = targs::i();
$args->adminurl = $this->adminurl;
foreach ($items as $id) {
$item = $foaf->getitem($id);
$args->add($item);
$args->id = $id;
$args->status = tlocal::get('foaf', $item['status']);
$result .= $html->itemlist($args);
}
$result .= $html->tablefooter();
$theme = ttheme::i();
$result .= $theme->getpages('/admin/foaf/', litepublisher::$urlmap->page, ceil($total / $perpage));
return $result;
}
示例4: getcont
public function getcont()
{
$result = '<h4>' . tlocal::get('default', 'sitemap') . '</h4><ul>';
$theme = $this->view->theme;
$perpage = 1000;
$count = 0;
$from = (litepublisher::$urlmap->page - 1) * $perpage;
$siteurl = litepublisher::$site->url;
$classes = litepublisher::$urlmap->page == 1 ? $this->classes : 'tposts';
foreach ($classes as $class) {
$instance = getinstance($class);
$links = $instance->getsitemap($from, $perpage - $count);
$count += count($links);
foreach ($links as $item) {
$pages = '';
if ($item['pages'] > 1) {
$url = rtrim($item['url'], '/');
for ($i = 2; $i < $link['pages']; $i++) {
$pages = "<a href=\"{$siteurl}{$url}/page/{$i}/\">{$i}</a>,";
}
}
$result .= "<li><a href=\"{$siteurl}{$item['url']}\" title=\"{$item['title']}\">{$item['title']}</a>{$pages}</li>";
}
if ($count > $perpage) {
break;
}
}
$result .= '</ul>';
// $result .=$theme->getpages('/sitemap.htm', litepublisher::$urlmap->page, ceil($posts->archivescount / $perpage));
return $result;
}
示例5: getcontent
public function getcontent()
{
$result = '';
$this->basename = 'downloaditems';
$html = $this->inihtml();
$lang = tlocal::admin('downloaditems');
$lang->ini['downloaditems'] = $lang->ini['downloaditem'] + $lang->ini['downloaditems'];
$html->push_section('editor');
$downloaditem = tdownloaditem::i($this->idpost);
ttheme::$vars['downloaditem'] = $downloaditem;
$args = new targs();
$this->getpostargs($downloaditem, $args);
$html->pop_section();
$args->downloadurl = $downloaditem->downloadurl;
$args->authorname = $downloaditem->authorname;
$args->authorurl = $downloaditem->authorurl;
$args->version = $downloaditem->version;
$types = array('theme' => tlocal::get('downloaditem', 'theme'), 'plugin' => tlocal::get('downloaditem', 'plugin'));
$args->type = tadminhtml::array2combo($types, $downloaditem->type);
if ($downloaditem->id > 0) {
$result .= $html->headeditor();
}
$result .= $html->form($args);
$result = $html->fixquote($result);
unset(ttheme::$vars['downloaditem']);
return $result;
}
示例6: processform
public function processform()
{
if (!isset($_POST['contactvalue'])) {
return '';
}
$time = substr($_POST['contactvalue'], strlen('_contactform'));
if (time() > $time) {
return $this->errmesg;
}
$email = trim($_POST['email']);
if (!tcontentfilter::ValidateEmail($email)) {
return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
}
$url = trim($_POST['site']);
if (empty($url) || strbegin($url, litepublisher::$site->url)) {
return $this->errmesg;
}
if ($s = http::get($url)) {
if (!strpos($s, '<meta name="generator" content="Lite Publisher')) {
return $this->errmesg;
}
} else {
return $this->errmesg;
}
$content = trim($_POST['content']);
if (strlen($content) <= 15) {
return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
}
$content = "{$url}\n" . $_POST['sitetitle'] . "\n\n" . $content;
tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
return $this->success;
}
示例7: tlocalmergerInstall
/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function tlocalmergerInstall($self)
{
$dir = litepublisher::$paths->data . 'languages';
if (!is_dir($dir)) {
@mkdir($dir, 0777);
}
@chmod($dir, 0777);
$lang = litepublisher::$options->language;
$self->lock();
$self->add('default', "lib/languages/{$lang}/default.ini");
$self->add('admin', "lib/languages/{$lang}/admin.ini");
$self->add('mail', "lib/languages/{$lang}/mail.ini");
if (litepublisher::$options->language != 'en') {
$self->add('translit', "lib/languages/{$lang}/translit.ini");
} else {
$self->items['translit'] = array('files' => array(), 'texts' => array());
}
$self->add('install', "lib/languages/{$lang}/install.ini");
$self->addhtml('lib/languages/adminhtml.ini');
$self->addhtml('lib/languages/posteditor.ini');
$self->unlock();
//after install
litepublisher::$options->timezone = tlocal::get('installation', 'timezone');
date_default_timezone_set(tlocal::get('installation', 'timezone'));
$html = tadminhtml::i();
$html->loadinstall();
}
示例8: processform
public function processform()
{
if (!isset($_POST['contactvalue'])) {
return '';
}
$time = substr($_POST['contactvalue'], strlen('_contactform'));
if (time() > $time) {
return $this->errmesg;
}
$email = trim($_POST['email']);
if (!tcontentfilter::ValidateEmail($email)) {
return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
}
$content = trim($_POST['content']);
if (strlen($content) <= 10) {
return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
}
if (false !== strpos($content, '<a href')) {
return $this->errmesg;
}
foreach ($this->data['extra'] as $name => $title) {
if (isset($_POST[$name])) {
$content .= sprintf("\n\n%s:\n%s", $title, trim($_POST[$name]));
}
}
tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
return $this->success;
}
示例9: getcomboitems
public static function getcomboitems($idperm)
{
$result = sprintf('<option value="0" %s>%s</option>', $idperm == 0 ? 'selected="selected"' : '', tlocal::get('perms', 'nolimits'));
$perms = tperms::i();
foreach ($perms->items as $id => $item) {
$result .= sprintf('<option value="%d" %s>%s</option>', $id, $idperm == $id ? 'selected="selected"' : '', $item['name']);
}
return $result;
}
示例10: checkattack
public static function checkattack()
{
if (litepublisher::$options->xxxcheck && self::is_xxx()) {
tlocal::usefile('admin');
if ($_POST) {
die(tlocal::get('login', 'xxxattack'));
}
if ($_GET) {
die(tlocal::get('login', 'confirmxxxattack') . sprintf(' <a href="%1$s">%1$s</a>', $_SERVER['REQUEST_URI']));
}
}
return false;
}
示例11: tsitemapInstall
/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function tsitemapInstall($self)
{
tcron::i()->addnightly(get_class($self), 'Cron', null);
litepublisher::$urlmap->add('/sitemap.xml', get_class($self), 'xml');
litepublisher::$urlmap->add('/sitemap.htm', get_class($self), null);
$robots = trobotstxt::i();
array_splice($robots->items, 1, 0, "Sitemap: " . litepublisher::$site->url . "/sitemap.xml");
$robots->save();
$self->add('/sitemap.htm', 4);
$self->createfiles();
$meta = tmetawidget::i();
$meta->add('sitemap', '/sitemap.htm', tlocal::get('default', 'sitemap'));
}
示例12: getwidget
public function getwidget($id, $sidebar)
{
$links = '';
$theme = ttheme::i();
$tml = $theme->getwidgetitem('widget', $sidebar);
tlocal::usefile('admin');
if (litepublisher::$urlmap->context instanceof tpost) {
$post = litepublisher::$urlmap->context;
$lang = tlocal::i('posts');
$title = $lang->adminpost;
$action = tadminhtml::getadminlink('/admin/posts/', "id={$post->id}&action");
$links = $this->getitem($tml, tadminhtml::getadminlink('/admin/posts/editor/', 'id=' . $post->id), $lang->edit);
$links .= $this->getitem($tml, "{$action}=delete", $lang->delete);
} else {
switch (get_class(litepublisher::$urlmap->context)) {
case 'tcategories':
case 'ttags':
$tags = litepublisher::$urlmap->context;
$name = $tags instanceof ttags ? 'tags' : 'categories';
$adminurl = litepublisher::$site->url . "/admin/posts/{$name}/";
$lang = tlocal::i('tags');
$title = $lang->{$name};
$links = $this->getitem($tml, $adminurl, $lang->add);
$adminurl .= litepublisher::$site->q . "id={$tags->id}";
$links .= $this->getitem($tml, $adminurl, $lang->edit);
$links .= $this->getitem($tml, "{$adminurl}&action=delete", $lang->delete);
$links .= $this->getitem($tml, "{$adminurl}&full=1", $lang->fulledit);
break;
case 'thomepage':
$lang = tlocal::i('options');
$title = $lang->home;
$links .= $this->getitem($tml, "/admin/options/home/", $lang->title);
break;
}
if (litepublisher::$urlmap->context instanceof tmenu && !litepublisher::$urlmap->context instanceof tadminmenu) {
$menu = litepublisher::$urlmap->context;
$lang = tlocal::i('menu');
$title = $lang->title;
$adminurl = litepublisher::$site->url . "/admin/menu/edit/";
$links .= $this->getitem($tml, $adminurl, $lang->addmenu);
$links .= $this->getitem($tml, $adminurl . litepublisher::$site->q . "id={$menu->id}", $lang->edit);
}
}
if ($links == '') {
return '';
}
$links .= $this->getitem($tml, '/admin/logout/', tlocal::get('login', 'logout'));
$links = $theme->getwidgetcontent($links, 'widget', $sidebar);
return $theme->getwidget($this->gettitle($id), $links, 'widget', $sidebar);
}
示例13: tforumInstall
/**
* Lite Publisher
* Copyright (C) 2010 - 2013 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function tforumInstall($self)
{
litepublisher::$options->reguser = true;
tadminoptions::i()->usersenabled = true;
$name = basename(dirname(__FILE__));
tlocalmerger::i()->addplugin($name);
$lang = tlocal::admin('forum');
//prevent double create view
$idview = 0;
$views = tviews::i();
foreach ($views->items as $id => $item) {
if ('forum' == $item['themename']) {
$idview = $id;
break;
}
}
if (!$idview) {
$view = new tview();
$view->name = $lang->forum;
$view->themename = 'forum';
$idview = $views->addview($view);
}
$lang->section = 'forum';
$cats = tcategories::i();
$idcat = $cats->add(0, $lang->forum);
$cats->setvalue($idcat, 'includechilds', 1);
$cats->setvalue($idcat, 'idview', $idview);
$cats->contents->setcontent($idcat, $lang->intro . sprintf(' <a href="%s/admin/plugins/forum/">%s</a>', litepublisher::$site->url, tlocal::get('names', 'adminpanel')));
$self->rootcat = $idcat;
$self->idview = $idview;
$self->categories_changed();
$self->save();
$cat = $cats->getitem($idcat);
tmenus::i()->addfake($cat['url'], $cat['title']);
tjsmerger::i()->add('default', '/plugins/forum/forum.min.js');
$linkgen = tlinkgenerator::i();
$linkgen->data['forum'] = '/forum/[title].htm';
$linkgen->save();
$cats = tcategories::i();
$cats->lock();
$cats->changed = $self->categories_changed;
$cats->added = $self->catadded;
$cats->unlock();
tthemeparser::i()->parsed = $self->themeparsed;
ttheme::clearcache();
litepublisher::$classes->add('tforumeditor', 'admin.forumeditor.class.php', $name);
$adminmenus = tadminmenus::i();
$adminmenus->createitem($adminmenus->url2id('/admin/plugins/'), 'forum', 'author', 'tforumeditor');
}
示例14: trssInstall
/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function trssInstall($self)
{
litepublisher::$urlmap->add('/rss.xml', get_class($self), 'posts');
$self->idcomments = litepublisher::$urlmap->add('/comments.xml', get_class($self), 'comments');
$self->idpostcomments = litepublisher::$urlmap->add('/comments/', get_class($self), null, 'tree');
litepublisher::$urlmap->add('/rss/categories/', get_class($self), 'categories', 'tree');
litepublisher::$urlmap->add('/rss/tags/', get_class($self), 'tags', 'tree');
tcomments::i()->changed = $self->commentschanged;
$self->save();
$meta = tmetawidget::i();
$meta->lock();
$meta->add('rss', '/rss.xml', tlocal::get('default', 'rss'));
$meta->add('comments', '/comments.xml', tlocal::get('default', 'rsscomments'));
$meta->unlock();
}
示例15: trssMultimediaInstall
/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function trssMultimediaInstall($self)
{
$urlmap = turlmap::i();
$urlmap->lock();
$urlmap->add('/rss/multimedia.xml', get_class($self), '');
$urlmap->add('/rss/images.xml', get_class($self), 'image');
$urlmap->add('/rss/audio.xml', get_class($self), 'audio');
$urlmap->add('/rss/video.xml', get_class($self), 'video');
$urlmap->unlock();
$files = tfiles::i();
$files->changed = $self->fileschanged;
$self->save();
$meta = tmetawidget::i();
$meta->add('media', '/rss/multimedia.xml', tlocal::get('default', 'rssmedia'));
}