本文整理汇总了PHP中Article::view方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::view方法的具体用法?PHP Article::view怎么用?PHP Article::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* Called on every video page view.
*/
public function view()
{
$this->video = new Video($this->getTitle(), $this->getContext());
$out = $this->getContext()->getOutput();
$videoLinksHTML = '<br />' . Xml::element('h2', array('id' => 'filelinks'), wfMsg('video-links')) . "\n";
$sk = $this->getContext()->getSkin();
// No need to display noarticletext, we use our own message
if ($this->getID()) {
parent::view();
} else {
// Just need to set the right headers
$out->setArticleFlag(true);
$out->setRobotPolicy('index,follow');
$out->setPageTitle($this->mTitle->getPrefixedText());
}
if ($this->video->exists()) {
// Display flash video
$out->addHTML($this->video->getEmbedCode());
// Force embed this code to have width of 300
$this->video->setWidth(300);
$out->addHTML($this->getEmbedThisTag());
$this->videoHistory();
//$wgOut->addHTML( $videoLinksHTML );
//$this->videoLinks();
} else {
// Video doesn't exist, so give a link allowing user to add one with this name
$title = SpecialPage::getTitleFor('AddVideo');
$link = $sk->linkKnown($title, wfMsgHtml('video-novideo-linktext'), array(), array('wpTitle' => $this->video->getName()));
$out->addHTML(wfMsgWikiHtml('video-novideo', $link));
//$wgOut->addHTML( $videoLinksHTML );
//$this->videoLinks();
$this->viewUpdates();
}
}
示例2: view
/**
* Overwrite view() from Article.php to add additional HTML to the
* output.
*/
public function view()
{
global $wgRequest, $wgUser, $wgOut;
if (!ApplicationFactory::getInstance()->getSettings()->get('smwgSemanticsEnabled')) {
$wgOut->setPageTitle($this->getTitle()->getPrefixedText());
$wgOut->addHTML(wfMessage('smw-semantics-not-enabled')->text());
return;
}
if ($this->getTitle()->getNamespace() === SMW_NS_PROPERTY) {
$this->findBasePropertyToRedirectFor($this->getTitle()->getText());
}
$this->initParameters();
if (!isset($diff) || !$diffOnly) {
// MW 1.25+
if (method_exists($wgOut, 'setIndicators')) {
$wgOut->setIndicators(array($this->getTopIndicator()));
}
$wgOut->addHTML($this->getIntroductoryText());
}
parent::view();
// Copied from CategoryPage
$diff = $wgRequest->getVal('diff');
$diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
if (!isset($diff) || !$diffOnly) {
$this->showList();
}
}
示例3: view
/**
* Render Quiz namespace page
*/
public function view()
{
global $wgOut, $wgUser, $wgTitle, $wgRequest;
wfProfileIn(__METHOD__);
// let MW handle basic stuff
parent::view();
// don't override history pages
$action = $wgRequest->getVal('action');
if (in_array($action, array('history', 'historysubmit'))) {
wfProfileOut(__METHOD__);
return;
}
// quiz doesn't exist
if (!$wgTitle->exists() || empty($this->mQuiz)) {
wfProfileOut(__METHOD__);
return;
}
// set page title
$title = $this->mQuiz->getTitle();
$wgOut->setPageTitle($title);
// add CSS/JS
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
// render quiz page
$wgOut->clearHTML();
$wgOut->addHTML($this->mQuiz->render());
wfProfileOut(__METHOD__);
}
示例4: view
public function view() {
global $wgOut, $wgShowEXIF, $wgRequest, $wgUser;
$diff = $wgRequest->getVal( 'diff' );
$diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
if ( $this->mTitle->getNamespace() != NS_TIMEDTEXT || ( isset( $diff ) && $diffOnly ) ) {
return parent::view();
}
$titleParts = explode( '.', $this->mTitle->getDBKey() );
$srt = array_pop( $titleParts );
$lanugaeKey = array_pop( $titleParts );
$videoTitle = Title::newFromText( implode('.', $titleParts ), NS_FILE );
// Look up the language name:
$languages = Language::getTranslatedLanguageNames( 'en' );
if( isset( $languages[ $lanugaeKey ] ) ) {
$languageName = $languages[ $lanugaeKey ];
} else {
$languageName = $lanugaeKey;
}
// Set title
$wgOut->setPageTitle( wfMsg('mwe-timedtext-language-subtitles-for-clip', $languageName, $videoTitle) );
// Get the video with with a max of 600 pixel page
$wgOut->addHTML(
xml::tags( 'table', array( 'style'=> 'border:none' ),
xml::tags( 'tr', null,
xml::tags( 'td', array( 'valign' => 'top', 'width' => self::$videoWidth ), $this->getVideoHTML( $videoTitle ) ) .
xml::tags( 'td', array( 'valign' => 'top' ) , $this->getSrtHTML( $languageName ) )
)
)
);
}
示例5: view
/**
* overwritten Article::view function
*/
public function view()
{
global $wgOut, $wgUser, $wgRequest, $wgTitle, $wgContLang;
global $wgStylePath, $wgLang;
global $wgProblemReportsEnable, $wgNotificationEnableSend;
$feed = $wgRequest->getText("feed", false);
if ($feed && in_array($feed, array("rss", "atom"))) {
$this->showFeed($feed);
} elseif ($wgTitle->isSubpage()) {
/**
* blog article, show if exists
*/
$oldPrefixedText = $this->mTitle->mPrefixedText;
list($author, $prefixedText) = explode('/', $this->mTitle->getPrefixedText(), 2);
if (isset($prefixedText) && !empty($prefixedText)) {
$this->mTitle->mPrefixedText = $prefixedText;
}
$this->mTitle->mPrefixedText = $oldPrefixedText;
$this->mProps = self::getProps($this->mTitle->getArticleID());
Article::view();
} else {
/**
* blog listing
*/
$wgOut->setHTMLTitle($wgOut->getWikiaPageTitle($this->mTitle->getPrefixedText()));
$this->showBlogListing();
}
}
示例6: onUnknownAction
public static function onUnknownAction($action, $article)
{
global $wgOut, $wgRequest, $wgUser, $wgParser, $wgBlikiPostGroup;
if ($action == 'blog' && in_array($wgBlikiPostGroup, $wgUser->getEffectiveGroups())) {
$newtitle = $wgRequest->getText('newtitle');
$title = Title::newFromText($newtitle);
$error = false;
if (!is_object($title)) {
$wgOut->addWikitext('<div class="previewnote">Error: Bad title!</div>');
$error = true;
} elseif ($title->exists()) {
$wgOut->addWikitext('<div class="previewnote">Error: Title already exists!</div>');
$error = true;
}
if (!$error) {
$summary = $wgRequest->getText('summary');
$content = $wgRequest->getText('content');
$user = $wgUser->getName();
$date = date('U');
$sig = '<div class="blog-sig">{{BlogSig|' . "{$user}|@{$date}" . '}}</div>';
$type = $wgRequest->getText('type');
switch ($type) {
// Preview the item
case "Full preview":
$wikitext = "{$sig}\n{$summary}\n\n{$content}";
self::preview($type, $title, $wikitext);
$article->view();
break;
// Preview the item in news/blog format
// Preview the item in news/blog format
case "Summary preview":
$wikitext = "{|class=\"blog\"\n|\n== [[Post a blog item|{$newtitle}]] ==\n|-\n!{$sig}\n|-\n|{$summary}\n|}__NOEDITSECTION__";
$title = Title::newFromText('Blog');
self::preview($type, $title, $wikitext);
$article->view();
break;
// Create the item with tags as category links
// Create the item with tags as category links
case "Post":
$wikitext = '{{' . "Blog|1={$summary}|2={$content}" . '}}';
$wikitext .= "<noinclude>[[Category:Blog items]][[Category:Posts by {$user}]]";
foreach (array_keys($_POST) as $k) {
if (preg_match("|^tag(.+)\$|", $k, $m)) {
$wikitext .= '[[Category:' . str_replace('_', ' ', $m[1]) . ']]';
}
}
$wikitext .= "</noinclude>";
$article = new Article($title);
$article->doEdit($wikitext, 'Blog item created via post form', EDIT_NEW);
$wgOut->redirect($title->getFullURL());
break;
}
} else {
$article->view();
}
return false;
}
return true;
}
示例7: view
function view()
{
global $wgOut, $wgRequest, $wgUser, $wgTitle, $wgHooks;
if (!$wgTitle->exists()) {
parent::view();
return;
}
if (count($wgRequest->getVal('diff')) > 0) {
return Article::view();
}
$restAction = $wgRequest->getVal('restaction');
if ($restAction == 'pull-chunk') {
$wgOut->setArticleBodyOnly(true);
$start = $wgRequest->getInt('start');
if (!$start) {
return;
}
$categoryViewer = new WikihowCategoryViewer($wgTitle);
$this->catStream = new WikihowArticleStream($categoryViewer, $start);
$html = $this->catStream->getChunks(4, WikihowCategoryPage::SINGLE_WIDTH, WikihowCategoryPage::SINGLE_SPACING, WikihowCategoryPage::SINGLE_HEIGHT);
$ret = json_encode(array('html' => $html));
$wgOut->addHTML($ret);
} else {
$wgOut->setRobotPolicy('index,follow', 'Category Page');
$wgOut->setPageTitle($wgTitle->getText());
$from = $wgRequest->getVal('from');
$until = $wgRequest->getVal('until');
$viewer = new WikihowCategoryViewer($this->mTitle, $from, $until);
$viewer->clearState();
$viewer->doQuery();
$viewer->finaliseCategoryState();
if ($wgRequest->getVal('viewMode', 0)) {
$wgOut->addHtml('<div class="section minor_section">');
$wgOut->addHtml('<ul><li>');
$wgOut->addHtml(implode("</li>\n<li>", $viewer->articles));
$wgOut->addHtml('</li></ul>');
$wgOut->addHtml('</div>');
} else {
$wgHooks['BeforePageDisplay'][] = array('WikihowCategoryPage::addCSSAndJs');
$categoryViewer = new WikihowCategoryViewer($wgTitle);
$this->catStream = new WikihowArticleStream($categoryViewer, 0);
$html = $this->catStream->getChunks(self::STARTING_CHUNKS, WikihowCategoryPage::SINGLE_WIDTH, WikihowCategoryPage::SINGLE_SPACING, WikihowCategoryPage::SINGLE_HEIGHT);
$wgOut->addHTML($html);
}
$sk = $wgUser->getSkin();
$subCats = $viewer->shortListRD($viewer->children, $viewer->children_start_char);
if ($subCats != "") {
$subCats = "<h3>{$this->mTitle->getText()}</h3>{$subCats}";
$sk->addWidget($subCats);
}
$furtherEditing = $viewer->getArticlesFurtherEditing($viewer->articles, $viewer->article_info);
if ($furtherEditing != "") {
}
$sk->addWidget($furtherEditing);
}
}
示例8: view
/**
* Overwrite view() from Article.php to add additional HTML to the
* output.
*/
public function view()
{
global $wgRequest, $wgUser;
parent::view();
// Copied from CategoryPage
$diff = $wgRequest->getVal('diff');
$diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
if (!isset($diff) || !$diffOnly) {
$this->showList();
}
}
示例9: view
function view()
{
global $wgOut, $wgTitle;
$wgOut->setPageTitle($this->mTitle->getPrefixedText());
// No need to display noarticletext, we use our own message
if (!$this->user_id) {
parent::view();
return '';
}
$wgOut->addHTML('<div id="profile-top">');
$wgOut->addHTML($this->getProfileTop($this->user_id, $this->user_name));
$wgOut->addHTML('<div class="cleared"></div></div>');
// User does not want social profile for User:user_name, so we just
// show header + page content
if ($wgTitle->getNamespace() == NS_USER && $this->profile_data['user_id'] && $this->profile_data['user_page_type'] == 0) {
parent::view();
return '';
}
// Left side
$wgOut->addHTML('<div id="user-page-left" class="clearfix">');
if (!wfRunHooks('UserProfileBeginLeft', array(&$this))) {
wfDebug(__METHOD__ . ": UserProfileBeginLeft messed up profile!\n");
}
$wgOut->addHTML($this->getRelationships($this->user_name, 1));
$wgOut->addHTML($this->getRelationships($this->user_name, 2));
$wgOut->addHTML($this->getGifts($this->user_name));
$wgOut->addHTML($this->getAwards($this->user_name));
$wgOut->addHTML($this->getCustomInfo($this->user_name));
$wgOut->addHTML($this->getInterests($this->user_name));
$wgOut->addHTML($this->getFanBoxes($this->user_name));
$wgOut->addHTML($this->getUserStats($this->user_id, $this->user_name));
if (!wfRunHooks('UserProfileEndLeft', array(&$this))) {
wfDebug(__METHOD__ . ": UserProfileEndLeft messed up profile!\n");
}
$wgOut->addHTML('</div>');
wfDebug("profile start right\n");
// Right side
$wgOut->addHTML('<div id="user-page-right" class="clearfix">');
if (!wfRunHooks('UserProfileBeginRight', array(&$this))) {
wfDebug(__METHOD__ . ": UserProfileBeginRight messed up profile!\n");
}
$wgOut->addHTML($this->getPersonalInfo($this->user_id, $this->user_name));
$wgOut->addHTML($this->getActivity($this->user_name));
// Hook for BlogPage
if (!wfRunHooks('UserProfileRightSideAfterActivity', array($this))) {
wfDebug(__METHOD__ . ": UserProfileRightSideAfterActivity hook messed up profile!\n");
}
$wgOut->addHTML($this->getCasualGames($this->user_id, $this->user_name));
$wgOut->addHTML($this->getUserBoard($this->user_id, $this->user_name));
if (!wfRunHooks('UserProfileEndRight', array(&$this))) {
wfDebug(__METHOD__ . ": UserProfileEndRight messed up profile!\n");
}
$wgOut->addHTML('</div><div class="cleared"></div>');
}
示例10: view
function view() {
// From CategoryPage::view()
if( NS_CATEGORY == $this->mTitle->getNamespace() ) {
$this->openShowCategory();
}
Article::view();
// Customization
if( NS_CATEGORY == $this->mTitle->getNamespace() ) {
$this->closeShowCategory();
}
}
示例11: view
public function view()
{
global $wgRequest, $wgUser, $wgOut;
// @@TODO fix stream view() for old versions ... will likely have to replicate Article::view()
// include the metavid headers (for embedding video in the page)
// copied from CategoryPage ...
$diff = $wgRequest->getVal('diff');
$diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
if (isset($diff) && $diffOnly) {
return Article::view();
}
$text = $this->getContent();
$this->outputWikiText($text);
}
示例12: view
/**
* @desc Render hubs page
*/
public function view()
{
wfProfileIn(__METHOD__);
// let MW handle basic stuff
parent::view();
//render hub page
$app = F::app();
if (!empty($this->verticalId)) {
RequestContext::getMain()->getRequest()->setVal('verticalid', $this->verticalId);
}
$app->wg->Out->clearHTML();
$app->wg->Out->addHTML($app->sendRequest('SpecialWikiaHubsV2Controller', 'index'));
wfProfileOut(__METHOD__);
}
示例13: view
/**
* @desc Render hubs page
*/
public function view()
{
wfProfileIn(__METHOD__);
// Don't show the category bar
F::app()->wg->SuppressArticleCategories = true;
// Get all the MW stuff out of the way first
parent::view();
$out = $this->getContext()->getOutput();
$html = F::app()->renderView('VideoHomePageController', 'index');
$out->clearHTML();
$html .= F::app()->renderView('VideoHomePage', 'partners');
$out->addHTML($html);
wfProfileOut(__METHOD__);
}
示例14: view
/**
* Overwrite view() from Article.php to add additional HTML to the
* output.
*/
public function view()
{
global $wgRequest, $wgUser;
if ($this->getTitle()->getNamespace() === SMW_NS_PROPERTY) {
$this->findBasePropertyToRedirectFor($this->getTitle()->getText());
}
parent::view();
// Copied from CategoryPage
$diff = $wgRequest->getVal('diff');
$diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
if (!isset($diff) || !$diffOnly) {
$this->showList();
}
}
示例15: view
function view()
{
global $wgOut, $wgShowEXIF;
$this->img = new Image($this->mTitle);
if ($this->mTitle->getNamespace() == NS_IMAGE) {
if ($wgShowEXIF && $this->img->exists()) {
$exif = $this->img->getExifData();
$showmeta = count($exif) ? true : false;
} else {
$exif = false;
$showmeta = false;
}
if ($this->img->exists()) {
$wgOut->addHTML($this->showTOC($showmeta));
}
$this->openShowImage();
# No need to display noarticletext, we use our own message, output in openShowImage()
if ($this->getID()) {
Article::view();
} else {
# Just need to set the right headers
$wgOut->setArticleFlag(true);
$wgOut->setRobotpolicy('index,follow');
$wgOut->setPageTitle($this->mTitle->getPrefixedText());
$this->viewUpdates();
}
# Show shared description, if needed
if ($this->mExtraDescription) {
$fol = wfMsg('shareddescriptionfollows');
if ($fol != '-') {
$wgOut->addWikiText($fol);
}
$wgOut->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . '</div>');
}
$this->closeShowImage();
$this->imageHistory();
$this->imageLinks();
if ($exif) {
global $wgStylePath;
$expand = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-expand')));
$collapse = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-collapse')));
$wgOut->addHTML("<h2 id=\"metadata\">" . wfMsgHtml('metadata') . "</h2>\n");
$wgOut->addWikiText($this->makeMetadataTable($exif));
$wgOut->addHTML("<script type=\"text/javascript\" src=\"{$wgStylePath}/common/metadata.js\"></script>\n" . "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '{$expand}', '{$collapse}');</script>\n");
}
} else {
Article::view();
}
}