本文整理汇总了PHP中e107::getParser方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getParser方法的具体用法?PHP e107::getParser怎么用?PHP e107::getParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getParser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nodejs_forum_event_user_forum_post_created_callback
/**
* Event callback after triggering "user_forum_post_created".
*
* @param array $info
* Details about forum post.
*/
function nodejs_forum_event_user_forum_post_created_callback($info)
{
$postID = intval(vartrue($info['data']['post_id'], 0));
$postUserID = intval(vartrue($info['data']['post_user'], 0));
$postThreadID = intval(vartrue($info['data']['post_thread'], 0));
if ($postID === 0 || $postThreadID === 0) {
return;
}
// Get forum plugin preferences.
$plugForumPrefs = e107::getPlugConfig('forum')->getPref();
$db = e107::getDb();
// Load thread.
$thread = $db->retrieve('forum_thread', '*', 'thread_id = ' . $postThreadID);
$threadUser = intval(vartrue($thread['thread_user'], 0));
// Load forum to check (read) permission.
$forum = $db->retrieve('forum', '*', 'forum_id = ' . intval(vartrue($thread['thread_forum_id'], 0)));
// Author of the forum post.
$authorPost = e107::user($postUserID);
// Author of the forum topic.
$authorThread = e107::user($threadUser);
e107_require_once(e_PLUGIN . 'nodejs/nodejs.main.php');
$template = e107::getTemplate('nodejs_forum');
$sc = e107::getScBatch('nodejs_forum', true);
$tp = e107::getParser();
// Get topic page number.
$postNum = $db->count('forum_post', '(*)', "WHERE post_id <= " . $postID . " AND post_thread = " . $postThreadID . " ORDER BY post_id ASC");
$postPage = ceil($postNum / vartrue($plugForumPrefs['postspage'], 10));
// Push rendered row item into Latest Forum Posts menu.
$sc_vars = array('author' => $authorPost, 'post' => $info['data'], 'thread' => $thread, 'topicPage' => $postPage);
$sc->setVars($sc_vars);
$markup = $tp->parseTemplate($template['MENU']['RECENT']['ITEM'], true, $sc);
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsForumMenu', 'type' => 'latestForumPosts', 'markup' => $markup);
nodejs_enqueue_message($message);
// Broadcast logged in users to inform about new forum post created.
if ($authorPost) {
$sc->setVars($sc_vars);
$markup = $tp->parseTemplate($template['NOTIFICATION']['POST_ALL'], true, $sc);
// It's a public forum, so broadcast every online user.
if (intval(vartrue($forum['forum_class'], 0)) === 0) {
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsForum', 'type' => 'newForumPostAny', 'markup' => $markup, 'exclude' => $postUserID);
nodejs_enqueue_message($message);
} else {
$forumClass = vartrue($forum['forum_class'], 0);
$db->select('nodejs_presence');
while ($row = $db->fetch()) {
if (isset($row['uid']) && check_class($forumClass, null, $row['uid'])) {
$message = (object) array('channel' => 'nodejs_user_' . $row['uid'], 'callback' => 'nodejsForum', 'type' => 'newForumPostAny', 'markup' => $markup, 'exclude' => $postUserID);
nodejs_enqueue_message($message);
}
}
}
}
// Broadcast logged in (thread-author) user to inform about new forum post created in his/her topic.
if (isset($authorThread['user_id'])) {
$sc->setVars($sc_vars);
$markup = $tp->parseTemplate($template['NOTIFICATION']['POST_OWN'], true, $sc);
$message = (object) array('channel' => 'nodejs_user_' . $authorThread['user_id'], 'callback' => 'nodejsForum', 'type' => 'newForumPostOwn', 'markup' => $markup, 'exclude' => $postUserID);
nodejs_enqueue_message($message);
}
}
示例2: unanswered
function unanswered()
{
$sql = e107::getDb();
$tp = e107::getParser();
$limit = 25;
$count = $sql->retrieve('faqs', 'faq_id', "faq_answer='' ", true);
$existing = $sql->retrieve('faqs', 'faq_id,faq_question,faq_datestamp', "faq_answer='' ORDER BY faq_datestamp DESC LIMIT " . $limit, true);
if (empty($existing)) {
return;
}
$questions = array();
foreach ($existing as $row) {
$questions[] = "<i>" . $row['faq_question'] . "</i><br /><small>" . $tp->toDate($row['faq_datestamp'], 'short') . "</small>\n";
// $questions[] = $row['faq_question'];
}
//
// $questions = array( "<i>Test Question</i><br /><small>".$tp->toDate(time(),'short')."</small>");
$name = SITENAME . " Automation";
$email = e107::pref('core', 'siteadminemail');
$name = e107::pref('core', 'siteadmin');
$link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full');
$body = "<h2>" . count($count) . " Unuanswered Questions at " . SITENAME . "</h2>To answer these questions, please login to " . SITENAME . " and then <a href='{$link}'>click here</a>.<br />\n\t\t\tThe " . $limit . " most recent questions are displayed below.\n\t\t\t<ul><li>" . implode("</li><li>", $questions) . "</li></ul>";
$eml = array('subject' => count($count) . " Unuanswered Question as of " . date('d-M-Y') . " ", 'sender_name' => SITENAME . " Automation", 'html' => true, 'template' => 'default', 'body' => $body);
e107::getEmail()->sendEmail($email, $name, $eml);
}
示例3: showImages
function showImages($cat)
{
$mes = e107::getMessage();
$tp = e107::getParser();
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', TRUE);
if (defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) {
$template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
}
$sc->total = e107::getMedia()->countImages($cat);
$sc->amount = 12;
// TODO Add Pref. amount per page.
$sc->curCat = $cat;
$sc->from = $_GET['frm'] ? intval($_GET['frm']) : 0;
$list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount);
$catname = $tp->toHtml($this->catList[$cat]['media_cat_title'], false, 'defs');
$inner = "";
foreach ($list as $row) {
$sc->setVars($row);
$inner .= $tp->parseTemplate($template['list_item'], TRUE, $sc);
}
$text = $tp->parseTemplate($template['list_start'], TRUE, $sc);
$text .= $inner;
$text .= $tp->parseTemplate($template['list_end'], TRUE, $sc);
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render() . $text);
}
示例4: renderMenu
/**
* Render menu.
*/
function renderMenu()
{
$tpl = e107::getTemplate('nodejs_comment');
$sc = e107::getScBatch('nodejs_comment', true);
$tp = e107::getParser();
$cm = e107::getComment();
$amount = (int) vartrue($this->plugPrefs['comment_display'], 10);
/**
* getCommentData() returns with array, which contains:
* - comment_datestamp
* - comment_author_id
* - comment_author
* - comment_comment
* - comment_subject
* - comment_type
* - comment_title
* - comment_url
*/
$items = $cm->getCommentData($amount);
$text = $tp->parseTemplate($tpl['MENU']['LATEST']['HEADER'], true, $sc);
foreach ($items as $item) {
$sc->setVars($item);
$text .= $tp->parseTemplate($tpl['MENU']['LATEST']['ITEM'], true, $sc);
}
if (empty($items)) {
$text .= '<a href="#" class="list-group-item no-posts text-center">' . LAN_PLUGIN_NODEJS_COMMENT_FRONT_05 . '</a>';
}
$text .= $tp->parseTemplate($tpl['MENU']['LATEST']['FOOTER'], true, $sc);
e107::getRender()->tablerender(LAN_PLUGIN_NODEJS_COMMENT_FRONT_04, $text);
unset($text);
}
示例5: user_avatar_shortcode
function user_avatar_shortcode($parm = '')
{
global $loop_uid;
$height = e107::getPref("im_height");
$width = e107::getPref("im_width");
$tp = e107::getParser();
if (intval($loop_uid) > 0 && trim($parm) == "") {
$parm = $loop_uid;
}
if (is_numeric($parm)) {
if ($parm == USERID) {
$image = USERIMAGE;
} else {
$row = get_user_data(intval($parm));
$image = $row['user_image'];
}
} elseif ($parm) {
$image = $parm;
} elseif (USERIMAGE) {
$image = USERIMAGE;
} else {
$image = "";
}
if (vartrue($image)) {
$img = strpos($image, "://") !== false ? $image : $tp->thumbUrl(e_MEDIA . "avatars/" . $image, "aw=" . $width . "&ah=" . $height);
$text = "<img class='user-avatar e-tip' src='" . $img . "' alt='' style='width:" . $width . "px; height:" . $height . "px' />\n\t\t";
} else {
$img = $tp->thumbUrl(e_IMAGE . "generic/blank_avatar.jpg", "aw=" . $width . "&ah=" . $height);
$text = "<img class='user-avatar' src='" . $img . "' alt='' />";
}
return $text;
}
示例6: iconpicker_shortcode
function iconpicker_shortcode($parm)
{
$parms = array();
parse_str($parm, $parms);
$name = varset($parms['id']);
$sql = e107::getDb();
$frm = e107::getForm();
$tp = e107::getParser();
// $sc_parameters is currently being used to select the media-category.
$qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (" . USERCLASS_LIST . ") ";
$qry .= vartrue($sc_parameters) ? " AND media_category = '" . $sc_parameters . "' " : " AND `media_category` REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
$qry .= "ORDER BY media_category,media_name";
$str = "";
$size_section = array();
$lastsize = "16";
if ($sql->db_Select_gen($qry)) {
while ($row = $sql->db_Fetch()) {
list($tmp, $tmp2, $size) = explode("_", $row['media_category']);
if ($str != '' && $size != $lastsize) {
$size_section[] = $str;
$str = "";
}
$str .= "<a href='#" . $row['media_url'] . "' title='{$filepath}' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='" . $tp->replaceConstants($row['media_url'], 'abs') . "' alt='{$row['media_name']}' /></a>";
$lastsize = $size;
}
return '<div id="' . $name . '-iconpicker-ajax"><div class="field-spacer iconpicker">' . str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $size_section)) . '</div></div>';
}
}
示例7: chapterIdByTitle
/**
* chapter/index and book/index by name callback
* @param eRequest $request
*/
public function chapterIdByTitle(eRequest $request)
{
$name = $request->getRequestParam('name');
if ($id = $request->getRequestParam('id')) {
$request->setRequestParam('name', $id);
return;
} elseif (!$name || is_numeric($name)) {
if (ADMIN) {
e107::getMessage()->addError("One of your page-chapters is missing a SEF URL value");
}
return;
}
$sql = e107::getDb('url');
$name = e107::getParser()->toDB($name);
if ($sql->select('page_chapters', 'chapter_id', "chapter_sef='{$name}'")) {
$name = $sql->fetch();
$request->setRequestParam('id', $name['chapter_id']);
$request->setRequestParam('type', 'bk');
e107::getMessage()->addDebug("Set CHAPTER ID = '" . $name['chapter_id'] . "'");
} elseif ($sql->select('page', 'page_id', "page_sef='{$name}'")) {
$name = $sql->fetch();
$request->setRequestParam('id', $name['page_id']);
$request->setRequestParam('type', 'id');
e107::getMessage()->addDebug("Set PAGE ID = '" . $name['page_id'] . "'");
} else {
if (ADMIN) {
e107::getMessage()->addError("Couldn't find a book, chapter or page with a SEF URL value of '" . $name . "'");
}
$request->setRequestParam('id', 0);
}
}
示例8: renderBanner
public function renderBanner($row)
{
$sql = e107::getDb('banner');
$tp = e107::getParser();
if (!$row['banner_image']) {
return "<a href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external'>no image assigned to this banner</a>";
}
$fileext1 = substr(strrchr($row['banner_image'], '.'), 1);
$sql->update('banner', 'banner_impressions=banner_impressions+1 WHERE banner_id=' . (int) $row['banner_id']);
switch ($fileext1) {
case 'swf':
return "\n\t\t\t\t\t<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"468\" height=\"60\">\n\n\t\t\t\t\t<param name=\"movie\" value=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\">\n\n\t\t\t\t\t<param name=\"quality\" value=\"high\">\n\n\t\t\t\t\t<param name=\"SCALE\" value=\"noborder\">\n\n\t\t\t\t\t<embed src=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\" width=\"468\" height=\"60\" scale=\"noborder\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>\n\t\t\t\t\t</object>\n\t\t\t\t\t";
break;
case 'html':
case 'js':
case 'php':
// Code - may 'echo' text, or may return it as a value
$file_data = file_get_contents(e_IMAGE . 'banners/' . $row['banner_image']);
return $file_data;
break;
default:
$src = $row['banner_image'][0] == '{' ? $tp->thumbUrl($row['banner_image']) : e_IMAGE_ABS . 'banners/' . $row['banner_image'];
$ban_ret = "<img class='e-banner img-responsive' src='" . $src . "' alt='" . $row['banner_clickurl'] . "' style='border:0' />";
break;
}
return "<a class='e-tip' href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external' title=\"" . $tp->toAttribute($row['banner_description']) . "\">" . $ban_ret . '</a>';
}
示例9: adnav_main
function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $params, $cat_open = FALSE)
{
$tp = e107::getParser();
$cat_link = strpos($cat_link, '://') === FALSE ? e_HTTP . $cat_link : $cat_link;
$cat_link = $tp->replaceConstants($cat_link, TRUE, TRUE);
if ($cat_open == 4 || $cat_open == 5) {
$dimen = $cat_open == 4 ? "600,400" : "800,600";
$href = " href=\"javascript:open_window('" . $cat_link . "'," . $dimen . ")\"";
} else {
$href = "href='" . $cat_link . "'";
}
$text = "<a class='menuItem' " . $href . " ";
if ($cat_id) {
if (isset($params[2]) && $params[2] == 'link') {
$text .= "onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\"";
} else {
$text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\"";
}
}
if ($cat_open == 1) {
$text .= " rel='external' ";
}
$text .= ">";
if ($cat_img != 'no_icons') {
$text .= "<span class='menuItemBuffer'>" . $cat_img . "</span>";
}
$text .= "<span class='menuItemText'>" . $tp->toHTML($cat_title, "", "defs, no_hook") . "</span>";
if ($cat_id) {
$text .= "<span class=\"menuItemArrow\">▶</span>";
}
$text .= "</a>";
return $text;
}
示例10: plugin_shortcode
function plugin_shortcode($parm = '')
{
$tp = e107::getParser();
@(list($menu, $parms) = explode('|', $parm . '|', 2));
$path = $tp->toDB(dirname($menu));
$name = $tp->toDB(basename($menu));
//BC Fix for v2.x
$changeMenuPaths = array(array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'latestnews_menu'), array('oldpath' => 'compliance_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'powered_by_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'sitebutton_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'counter_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'), array('oldpath' => 'usertheme_menu', 'newpath' => 'user_menu', 'menu' => 'usertheme_menu'), array('oldpath' => 'userlanguage_menu', 'newpath' => 'user_menu', 'menu' => 'userlanguage_menu'), array('oldpath' => 'lastseen_menu', 'newpath' => 'online', 'menu' => 'lastseen_menu'), array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news_menu'), array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news2_menu'));
foreach ($changeMenuPaths as $k => $v) {
if ($v['oldpath'] == $path && $v['menu'] == $name) {
$path = $v['newpath'];
continue;
}
}
if ($path == '.') {
$path = $menu;
}
/**
* @todo check if plugin is installed when installation required
*/
/**
* fixed todo: $mode is provided by the menu itself, return is always true, added optional menu parameters
*/
return e107::getMenu()->renderMenu($path, $name, trim($parms, '|'), true);
}
示例11: getListData
function getListData()
{
$sql = e107::getDb();
$tp = e107::getParser();
$list_caption = $this->parent->settings['caption'];
$list_display = $this->parent->settings['open'] ? "" : "none";
if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") {
$lvisit = $this->parent->getlvisit();
$qry = "cb_datestamp>" . $lvisit;
} else {
$qry = "cb_id != '0' ";
}
$qry .= " ORDER BY cb_datestamp DESC LIMIT 0," . intval($this->parent->settings['amount']);
$bullet = $this->parent->getBullet($this->parent->settings['icon']);
if (!($chatbox_posts = $this->parent->e107->sql->gen("SELECT * FROM #chatbox WHERE " . $qry))) {
$list_data = LIST_CHATBOX_2;
} else {
while ($row = $this->parent->e107->sql->fetch()) {
$cb_id = substr($row['cb_nick'], 0, strpos($row['cb_nick'], "."));
$cb_nick = substr($row['cb_nick'], strpos($row['cb_nick'], ".") + 1);
$cb_message = $row['cb_blocked'] ? CHATBOX_L6 : str_replace("<br />", " ", $tp->toHTML($row['cb_message']));
$rowheading = $this->parent->parse_heading($cb_message);
$record['icon'] = $bullet;
$record['heading'] = $rowheading;
$record['author'] = $this->parent->settings['author'] ? $cb_id != 0 ? "<a href='" . e_BASE . "user.php?id.{$cb_id}'>" . $cb_nick . "</a>" : $cb_nick : "";
$record['category'] = "";
$record['date'] = $this->parent->settings['date'] ? $row['cb_datestamp'] ? $this->parent->getListDate($row['cb_datestamp']) : "" : "";
$record['info'] = "";
$list_data[] = $record;
}
}
//return array with 'records', (global)'caption', 'display'
return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display);
}
示例12: avatar
/**
* @DEPRECATED
* Use e107::getParser()->parseTemplate("{USER_AVATAR=".$avatar."}",true); instead.
*/
function avatar($avatar)
{
return e107::getParser()->parseTemplate("{USER_AVATAR=" . $avatar . "}", true);
/*
global $tp;
if (stristr($avatar, '-upload-') !== false)
{
return e_AVATAR_UPLOAD.str_replace('-upload-', '', $avatar);
}
elseif (stristr($avatar, 'Binary') !== false)
{
$sqla = new db;
preg_match("/Binary\s(.*?)\//", $avatar, $result);
$sqla->db_Select('rbinary', '*', "binary_id='".$tp->toDB($result[1])."' ");
$row = $sqla->db_Fetch();
return $row['binary_data'];
}
elseif (strpos($avatar, 'http://') === false)
{
return SITEURLBASE.e_IMAGE_ABS."avatars/".$avatar;
}
else
{
return $avatar;
}
*/
}
示例13: getLink
function getLink($id)
{
if ($this->row == '') {
$this->row = $this->getRecord($id);
}
$url = e_BASE . "download.php?view." . $this->row['download_id'];
return "<a href='" . $url . "'>" . e107::getParser()->toHTML($this->row['download_name'], TRUE, '') . "</a>";
}
示例14: getLink
function getLink($id)
{
if ($this->row == '') {
$this->row = $this->getRecord($id);
}
$url = e_BASE . "page.php?" . $this->row['page_id'];
$url = e107::getUrl()->create('page/view', $this->row, 'allow=page_id,page_title,page_sef');
return "<a href='" . $url . "'>" . e107::getParser()->toHTML($this->row['page_title'], TRUE, '') . "</a>";
}
示例15: beforeUpdate
public function beforeUpdate($new_data, $old_data, $id)
{
if ($old_data['quote'] == "") {
$new_data['quote'] = e107::getParser()->toDb($old_data['quote'], true, false, 'no_html');
} else {
$new_data['quote'] = $old_data['quote'];
}
return $new_data;
}