本文整理汇总了PHP中Parser::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::getUser方法的具体用法?PHP Parser::getUser怎么用?PHP Parser::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parser
的用法示例。
在下文中一共展示了Parser::getUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderGallery
/**
* Parser hook handler for {{#articletype}}
*
* @param Parser $parser : Parser instance available to render
* wikitext into html, or parser methods.
*
* @return string: HTML to insert in the page.
*/
public static function renderGallery($input, array $args, Parser $parser, PPFrame $frame)
{
$parser->getOutput()->addModules('ext.promoter.gallery');
$pageName = $parser->getTitle()->getText();
try {
$renderedAds = array();
$adChooser = new AdChooser($pageName, !$parser->getUser()->isLoggedIn());
$ads = $adChooser->getAds();
foreach ($ads as $ad) {
$renderedAds[] = Ad::fromName($ad['name'])->renderHtml();
}
} catch (AdCampaignExistenceException $e) {
wfDebugLog('Promoter', $e->getMessage());
//@todo i18n
return '<span class="error">No campaign for this page</span>';
} catch (MWException $e) {
wfDebugLog('Promoter', $e->getMessage());
return '<span class="error text-danger">An error occurred [' . $e->getMessage() . ']</span>';
}
$html = '<div class="promotion-gallery hidden hidden-print">' . '<h5 class="sr-only">זוהי גלריה המקדמת ערכים שונים באתר.</h5>' . '<div class="gallery-controls">' . '<span class="sr-only">בכל רגע מוצגות 3 ידיעות בגלריה. ניתן להציג ידיעה נוספת או לחזור לאחור באמצעות הכפתורים הבאים, או באמצעות מקשי החיצים כאשר הפוקוס הוא על הגלריה</span>' . '<a href="#" class="owl-prev"><span class="fa fa-chevron-right fa-lg" title="הקודם"></span><span class="sr-only">הצגת הידיעה הקודמת</span></a>' . '<a href="#" class="owl-next"><span class="fa fa-chevron-left fa-lg" title="הבא"></span><span class="sr-only">הצגת הידיעה הבאה</span></a>' . '</div>';
if ($args['title']) {
$html .= '<div class="header">' . $args['title'] . '</div>';
}
$html .= '<div class="owl-carousel clearfix" tabindex="0">' . implode('', $renderedAds) . '</div>' . '</div>';
return $html;
}
示例2: render
/**
* @param Parser $parser
* @return string
*/
public static function render($parser)
{
$user = $parser->getUser();
$title = $parser->getTitle();
if (!$title || !$title->exists()) {
return '';
}
$author = self::getPageAuthor($title);
if (!$author) {
return '';
}
$html = '<span class="author-rating-wrapper">';
// Add user link
$html .= $parser->insertStripItem(' <a target="_blank" href="' . $author->getUserPage()->getFullURL() . '">' . $author->getName() . '</a>');
$html .= ' <i style="display: none;" class="fa fa-thumbs-o-up author-thumbs-up" title="' . wfMessage('authorrating-rate-title')->plain() . '"></i>';
$html .= ' <span class="label label-success">?</span>';
$html .= '</span>';
$parser->getOutput()->addModules('ext.authorrating.foo');
return array($html, 'markerType' => 'nowiki');
}
示例3: fixTemplate
/**
* fixTemplate
*
* This code ensures that the version of the Template that was in existence
* at the same time as the Memento gets loaded and displayed with the
* Memento.
*
* @fixme make this compatible with parser cache
* @param Title $title
* @param Parser $parser
* @param integer $id
*
* @return array containing the text, finalTitle, and deps
*/
public function fixTemplate(Title $title, Parser $parser, &$id)
{
// stopgap measure until we can find a better way
// to work with parser cache
$parser->disableCache();
$request = $parser->getUser()->getRequest();
if ($request->getHeader('ACCEPT-DATETIME')) {
$requestDatetime = $request->getHeader('ACCEPT-DATETIME');
$mwMementoTimestamp = $this->parseRequestDateTime($requestDatetime);
$firstRev = $title->getFirstRevision();
// if the template no longer exists, return gracefully
if ($firstRev != null) {
if ($firstRev->getTimestamp() < $mwMementoTimestamp) {
$pgID = $title->getArticleID();
$this->db->begin();
$res = $this->db->selectRow('revision', array('rev_id'), array('rev_page' => $pgID, 'rev_timestamp <=' . $this->db->addQuotes($mwMementoTimestamp)), __METHOD__, array('ORDER BY' => 'rev_id DESC', 'LIMIT' => '1'));
$id = $res->rev_id;
} else {
// if we get something prior to the first memento, just
// go with the first one
$id = $firstRev->getId();
}
}
}
}
示例4: Parser
<?php
include '../class/Parser.php';
include '../class/imapClass.php';
$parser = new Parser();
$mail = new imapClass($parser->getServer(), $parser->getUser(), $parser->getPassword());
$unread = $mail->totalUnread();
$total = $mail->totalMessages();
$unreadMess = array_reverse($mail->getUnreadMessages());
$mess = array_reverse($mail->getMessage(1, $total));
if (isset($_GET['mail'])) {
$emails = $mail->readMessage($_GET['mail']);
}
if (isset($_GET['delete'])) {
$mail->deleteMessage($_GET['delete']);
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A layout example that shows off a responsive email layout.">
<title>BMail - Nicolas Charvoz & Antoine Garcia</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">