当前位置: 首页>>代码示例>>PHP>>正文


PHP Article::getTimestamp方法代码示例

本文整理汇总了PHP中Article::getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getTimestamp方法的具体用法?PHP Article::getTimestamp怎么用?PHP Article::getTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Article的用法示例。


在下文中一共展示了Article::getTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAuthor

 /**
  * Get the last author with the last modification time
  * @param $article Article object
  */
 protected static function getAuthor(Article $article)
 {
     global $wgLang, $wgAllowRealName;
     $user = User::newFromId($article->getUser());
     $timestamp = $article->getTimestamp();
     if ($timestamp) {
         $d = $wgLang->date($article->getTimestamp(), true);
         $t = $wgLang->time($article->getTimestamp(), true);
     } else {
         $d = '';
         $t = '';
     }
     return wfMsg('lastmodifiedatby', $d, $t, self::userLink($user));
 }
开发者ID:ui-libraries,项目名称:TIRW,代码行数:18,代码来源:Credits.php

示例2: newAttachmentData

 function newAttachmentData($id)
 {
     $obj = $this->cacheManager->retrieveAtachmentData($id);
     if ($obj instanceof \PageAttachment\Attachment\AttachmentData) {
         $pageAttachmentData = $obj;
     } else {
         $title = \Title::newFromID($id);
         $article = new \Article($title, NS_FILE);
         $file = \wfFindFile($title);
         $size = $file->getSize();
         $description = $this->replaceHtmlTags($file->getDescriptionText());
         $dateUploaded = $article->getTimestamp();
         $uploadedBy = null;
         if ($this->runtimeConfig->isShowUserRealName()) {
             $uploadedBy = \User::whoIsReal($article->getUser());
         }
         if ($uploadedBy == null) {
             $uploadedBy = \User::whoIs($article->getUser());
         }
         $attachedToPages = null;
         if ($this->securityManager->isRemoveAttachmentPermanentlyEnabled()) {
             $attachedToPages = $this->getAttachedToPages($id);
         }
         $pageAttachmentData = new AttachmentData($id, $title, $size, $description, $dateUploaded, $uploadedBy, $attachedToPages);
         $this->cacheManager->storeAttachmentData($pageAttachmentData);
     }
     return $pageAttachmentData;
 }
开发者ID:mediawiki-extensions,项目名称:mediawiki-page-attachment,代码行数:28,代码来源:AttachmentDataFactory.php

示例3: timestamp

 function timestamp(&$parser, &$ts)
 {
     if (isset($parser->mTagHooks['citation'])) {
         $ts = wfTimestamp(TS_UNIX, $this->mArticle->getTimestamp());
     }
     return true;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:7,代码来源:SpecialCite_body.php

示例4: createComment

function createComment($title = null, $commenter = null, $text = null)
{
    global $wgTitle;
    $text = $text ? $text : 'The quick brown fox jumps over the lazy dog';
    $commentTitle = Title::newFromText(sprintf("%s/%s-%s", $title->getText(), $commenter, wfTimestampNow()), NS_BLOG_ARTICLE_TALK);
    $wgTitle = $commentTitle;
    /**
     * add article using EditPage class (for hooks)
     */
    $result = null;
    $article = new Article($commentTitle, 0);
    $editPage = new EditPage($article);
    $editPage->edittime = $article->getTimestamp();
    $editPage->textbox1 = $text;
    $retval = $editPage->internalAttemptSave($result);
    $value = $retval->value;
    Wikia::log(__METHOD__, "editpage", "Returned value {$value}");
    return array($value, $article);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:createComments.php

示例5: wfWikiArticleFeedsAction

/**
 * Injects handling of the 'feed' action.
 * Usage: $wgHooks['UnknownAction'][] = 'wfWikiArticleFeedsAction';
 * @param $action Handle to an action string (presumably same as global $action).
 * @param $article Article to be converted to rss or atom feed
 */
function wfWikiArticleFeedsAction( $action, $article ) {

	# If some other action is in the works, cut and run!
	if ( $action != 'feed' ) return true;

	global $wgOut, $wgRequest, $wgFeedClasses, $wgFeedCacheTimeout, $wgDBname, $messageMemc, $wgSitename;

	# Get query parameters
	$feedFormat = $wgRequest->getVal( 'feed', 'atom' );
	$filterTags = $wgRequest->getVal( 'tags', null );

	# Process requested tags for use in keys
	if ( $filterTags ) {
		$filterTags = explode( ',', $filterTags );
		array_walk( $filterTags, 'trim' );
		sort( $filterTags );
	}

	if ( !isset( $wgFeedClasses[$feedFormat] ) ) {
		wfHttpError( 500, "Internal Server Error", "Unsupported feed type." );
		return false;
	}

	# Setup cache-checking vars
	$title = $article->getTitle();
	$titleDBkey = $title->getPrefixedDBkey();
	$tags = ( is_array( $filterTags ) ? ':' . implode( ',', $filterTags ):'' );
	$key = "{$wgDBname}:wikiarticlefeedsextension:{$titleDBkey}:{$feedFormat}{$tags}";
	$timekey = $key . ":timestamp";
	$cachedFeed = false;
	$feedLastmod = $messageMemc->get( $timekey );

	# Dermine last modification time for either the article itself or an included template
	$lastmod = $article->getTimestamp();
	$templates = $article->getUsedTemplates();
	foreach ( $templates as $tTitle ) {
		$tArticle = new Article( $tTitle );
		$tmod = $tArticle->getTimestamp();
		$lastmod = ( $lastmod > $tmod ? $lastmod:$tmod );
	}

	# Check for availability of existing cached version
	if ( ( $wgFeedCacheTimeout > 0 ) && $feedLastmod ) {
		$feedLastmodTS = wfTimestamp( TS_UNIX, $feedLastmod );
		if (
			time() - $feedLastmodTS < $wgFeedCacheTimeout ||
			$feedLastmodTS > wfTimestamp( TS_UNIX, $lastmod )
			) {
			wfDebug( "WikiArticleFeedsExtension: Loading feed from cache ($key; $feedLastmod; $lastmod)...\n" );
			$cachedFeed = $messageMemc->get( $key );
		} else {
			wfDebug( "WikiArticleFeedsExtension: Cached feed timestamp check failed ($feedLastmod; $lastmod)\n" );
		}
	}

	# Display cachedFeed, or generate one from scratch
	global $wgWikiArticleFeedsSkipCache;
	if ( !$wgWikiArticleFeedsSkipCache && is_string( $cachedFeed ) ) {
		wfDebug( "WikiArticleFeedsExtension: Outputting cached feed\n" );
		$feed = new $wgFeedClasses[$feedFormat]( $wgSitename . ' - ' . $title->getText(), '', $title->getFullURL() );
		$feed->httpHeaders();
		echo $cachedFeed;
	} else {
		wfDebug( "WikiArticleFeedsExtension: Rendering new feed and caching it\n" );
		ob_start();
		wfGenerateWikiFeed( $article, $feedFormat, $filterTags );
		$cachedFeed = ob_get_contents();
		ob_end_flush();

		$expire = 3600 * 24; # One day
		$messageMemc->set( $key, $cachedFeed );
		$messageMemc->set( $timekey, wfTimestamp( TS_MW ), $expire );
	}

	# False to indicate that other action handlers should not process this page
	return false;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:83,代码来源:WikiArticleFeeds.php

示例6: doSaveAsArticle

 /**
  * doSaveAsArticle store comment as article
  *
  * @static
  *
  * @param String $text
  * @param Article|WikiPage $article
  * @param User $user
  * @param array $metadata
  * @param string $summary
  *
  * @return Status TODO: Document
  */
 protected static function doSaveAsArticle($text, $article, $user, $metadata = array(), $summary = '')
 {
     $result = null;
     $editPage = new EditPage($article);
     $editPage->edittime = $article->getTimestamp();
     $editPage->textbox1 = self::removeMetadataTag($text);
     $editPage->summary = $summary;
     $editPage->watchthis = $user->isWatched($article->getTitle());
     if (!empty($metadata)) {
         $editPage->textbox1 = $text . Xml::element('ac_metadata', $metadata, ' ');
     }
     $bot = $user->isAllowed('bot');
     return $editPage->internalAttemptSave($result, $bot);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:ArticleComment.class.php

示例7: printRedirectForm

	/**
	 * Prints the mini-form contained at the bottom of various pages, that
	 * allows pages to spoof a normal edit page, that can preview, save,
	 * etc.
	 */
	static function printRedirectForm( $title, $page_contents, $edit_summary, $is_save, $is_preview, $is_diff, $is_minor_edit, $watch_this ) {
		$article = new Article( $title );
		$new_url = $title->getLocalURL( 'action=submit' );
		$starttime = wfTimestampNow();
		$edittime = $article->getTimestamp();
		global $wgUser;
		if ( $wgUser->isLoggedIn() )
			$token = htmlspecialchars( $wgUser->editToken() );
		else
			$token = EDIT_TOKEN_SUFFIX;

		if ( $is_save )
			$action = "wpSave";
		elseif ( $is_preview )
			$action = "wpPreview";
		else // $is_diff
			$action = "wpDiff";

		$text = <<<END
	<form id="editform" name="editform" method="post" action="$new_url">
	<input type="hidden" name="wpTextbox1" id="wpTextbox1" value="$page_contents" />
	<input type="hidden" name="wpSummary" value="$edit_summary" />
	<input type="hidden" name="wpStarttime" value="$starttime" />
	<input type="hidden" name="wpEdittime" value="$edittime" />
	<input type="hidden" name="wpEditToken" value="$token" />
	<input type="hidden" name="$action" />

END;
		if ( $is_minor_edit )
			$text .= '    <input type="hidden" name="wpMinoredit">' . "\n";
		if ( $watch_this )
			$text .= '    <input type="hidden" name="wpWatchthis">' . "\n";
		$text .= <<<END
	</form>
	<script type="text/javascript">
	document.editform.submit();
	</script>

END;
		return $text;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:46,代码来源:SD_Utils.php

示例8: execute


//.........这里部分代码省略.........
         if ($undoRev->getPage() != $articleObj->getID()) {
             $this->dieUsageMsg(array('revwrongpage', $undoRev->getID(), $titleObj->getPrefixedText()));
         }
         if ($undoafterRev->getPage() != $articleObj->getID()) {
             $this->dieUsageMsg(array('revwrongpage', $undoafterRev->getID(), $titleObj->getPrefixedText()));
         }
         $newtext = $articleObj->getUndoText($undoRev, $undoafterRev);
         if ($newtext === false) {
             $this->dieUsageMsg(array('undo-failure'));
         }
         $params['text'] = $newtext;
         // If no summary was given and we only undid one rev,
         // use an autosummary
         if (is_null($params['summary']) && $titleObj->getNextRevisionID($undoafterRev->getID()) == $params['undo']) {
             $params['summary'] = wfMsgForContent('undo-summary', $params['undo'], $undoRev->getUserText());
         }
     }
     // See if the MD5 hash checks out
     if (!is_null($params['md5']) && md5($toMD5) !== $params['md5']) {
         $this->dieUsageMsg(array('hashcheckfailed'));
     }
     $ep = new EditPage($articleObj);
     // EditPage wants to parse its stuff from a WebRequest
     // That interface kind of sucks, but it's workable
     $reqArr = array('wpTextbox1' => $params['text'], 'wpEditToken' => $params['token'], 'wpIgnoreBlankSummary' => '');
     if (!is_null($params['summary'])) {
         $reqArr['wpSummary'] = $params['summary'];
     }
     // Watch out for basetimestamp == ''
     // wfTimestamp() treats it as NOW, almost certainly causing an edit conflict
     if (!is_null($params['basetimestamp']) && $params['basetimestamp'] != '') {
         $reqArr['wpEdittime'] = wfTimestamp(TS_MW, $params['basetimestamp']);
     } else {
         $reqArr['wpEdittime'] = $articleObj->getTimestamp();
     }
     if (!is_null($params['starttimestamp']) && $params['starttimestamp'] != '') {
         $reqArr['wpStarttime'] = wfTimestamp(TS_MW, $params['starttimestamp']);
     } else {
         $reqArr['wpStarttime'] = wfTimestampNow();
         // Fake wpStartime
     }
     if ($params['minor'] || !$params['notminor'] && $wgUser->getOption('minordefault')) {
         $reqArr['wpMinoredit'] = '';
     }
     if ($params['recreate']) {
         $reqArr['wpRecreate'] = '';
     }
     if (!is_null($params['section'])) {
         $section = intval($params['section']);
         if ($section == 0 && $params['section'] != '0' && $params['section'] != 'new') {
             $this->dieUsage("The section parameter must be set to an integer or 'new'", "invalidsection");
         }
         $reqArr['wpSection'] = $params['section'];
     } else {
         $reqArr['wpSection'] = '';
     }
     $watch = $this->getWatchlistValue($params['watchlist'], $titleObj);
     // Deprecated parameters
     if ($params['watch']) {
         $watch = true;
     } elseif ($params['unwatch']) {
         $watch = false;
     }
     if ($watch) {
         $reqArr['wpWatchthis'] = '';
     }
开发者ID:GodelDesign,项目名称:Godel,代码行数:67,代码来源:ApiEditPage.php

示例9: updateArticleByRule


//.........这里部分代码省略.........
             $instructions = array();
             if ($instructionPage != '') {
                 $instructionTitle = '';
                 global $wgParser, $wgUser;
                 $parser = clone $wgParser;
                 DPLInclude::text($parser, $instructionPage, $instructionTitle, $instructionText);
                 $instructions = $this->getTemplateParmValues($instructionText, 'Template field');
             }
             // construct an edit form containing all template invocations
             $form = "<html><form method=post action=\"{$action}\" {$editForm}>\n";
             foreach ($tpv as $call => $tplValues) {
                 $form .= "<table {$table}>\n";
                 foreach ($parameter as $nr => $parm) {
                     // try to extract legend from the docs of the template
                     $myToolTip = '';
                     if (array_key_exists($nr, $tooltip)) {
                         $myToolTip = $tooltip[$nr];
                     }
                     $myInstruction = '';
                     $myType = '';
                     foreach ($instructions as $instruct) {
                         if (array_key_exists('field', $instruct) && $instruct['field'] == $parm) {
                             if (array_key_exists('doc', $instruct)) {
                                 $myInstruction = $instruct['doc'];
                             }
                             if (array_key_exists('type', $instruct)) {
                                 $myType = $instruct['type'];
                             }
                             break;
                         }
                     }
                     $myFormat = '';
                     if (array_key_exists($nr, $format)) {
                         $myFormat = $format[$nr];
                     }
                     $myOptional = array_key_exists($nr, $optional);
                     if ($legendText != '' && $myToolTip == '') {
                         $myToolTip = preg_replace('/^.*\\<section\\s+begin\\s*=\\s*' . preg_quote($parm, '/') . '\\s*\\/\\>/s', '', $legendText);
                         if (strlen($myToolTip) == strlen($legendText)) {
                             $myToolTip = '';
                         } else {
                             $myToolTip = preg_replace('/\\<section\\s+end\\s*=\\s*' . preg_quote($parm, '/') . '\\s*\\/\\>.*/s', '', $myToolTip);
                         }
                     }
                     $myValue = '';
                     if (array_key_exists($parm, $tpv[$call])) {
                         $myValue = $tpv[$call][$parm];
                     }
                     $form .= $this->editTemplateCall($text, $template, $call, $parm, $myType, $myValue, $myFormat, $myToolTip, $myInstruction, $myOptional, $fieldFormat);
                 }
                 $form .= "</table>\n<br /><br />";
             }
             foreach ($hidden as $hide) {
                 $form .= "<input type=hidden " . $hide . " />";
             }
             $form .= "<input type=hidden name=\"token\" value=\"" . $wgUser->editToken() . "\" />";
             foreach ($preview as $prev) {
                 $form .= "<input type=submit " . $prev . " /> ";
             }
             $form .= "</form></html>\n";
             return $form;
         } elseif ($exec == 'set' || $exec == 'preview') {
             // loop over all invocations and parameters, this could be improved to enhance performance
             $matchCount = 10;
             for ($call = 0; $call < 10; $call++) {
                 foreach ($parameter as $nr => $parm) {
                     // set parameters to values specified in the dpl source or get them from the http request
                     if ($exec == 'set') {
                         $myvalue = $value[$nr];
                     } else {
                         if ($call >= $matchCount) {
                             break;
                         }
                         $myValue = $wgRequest->getVal(urlencode($call . '_' . $parm), '');
                     }
                     $myOptional = array_key_exists($nr, $optional);
                     $myAfterParm = array();
                     if (array_key_exists($nr, $afterparm)) {
                         $myAfterParm = $afterparm[$nr];
                     }
                     $text = $this->updateTemplateCall($matchCount, $text, $template, $call, $parm, $myValue, $myAfterParm, $myOptional);
                 }
                 if ($exec == 'set') {
                     break;
                     // values taken from dpl text only populate the first invocation
                 }
             }
         }
     }
     if ($exec == 'set') {
         return $this->updateArticle($title, $text, $summary);
     } elseif ($exec == 'preview') {
         global $wgScriptPath, $wgRequest;
         $titleX = Title::newFromText($title);
         $articleX = new Article($titleX);
         $form = '<html><form id="editform" name="editform" method="post" action="' . $wgScriptPath . '/index.php?title=' . urlencode($title) . '&action=submit" ' . 'enctype="multipart/form-data">' . "\n" . '<input type="hidden" value="" name="wpSection" />' . "\n" . '<input type="hidden" value="' . wfTimestampNow() . '" name="wpStarttime" />' . "\n" . '<input type="hidden" value="' . $articleX->getTimestamp() . '" name="wpEdittime" />' . "\n" . '<input type="hidden" value="" name="wpScrolltop" id="wpScrolltop" />' . "\n" . '<textarea tabindex="1" accesskey="," name="wpTextbox1" id="wpTextbox1" rows="' . $wgUser->getIntOption('rows') . '" cols="' . $wgUser->getIntOption('cols') . '" >' . htmlspecialchars($text) . '</textarea>' . "\n" . '<input type="hidden" name="wpSummary value="' . $summary . '" id="wpSummary" />' . '<input name="wpAutoSummary" type="hidden" value="" />' . '<input id="wpSave" name="wpSave" type="submit" value="Save page" accesskey="s" title="Save your changes [s]" />' . '<input type="hidden" value="' . $wgRequest->getVal('token') . '" name="wpEditToken" />' . "\n" . '</form></html>' . "\n";
         return $form;
     }
     return 'exec must be one of the following: edit, preview, set';
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:DPL.php

示例10: lw_createPage

function lw_createPage($titleObj, $content, $summary = "Page created using [[LyricWiki:SOAP|LyricWiki's SOAP Webservice]]")
{
    global $wgUser;
    wfProfileIn(__METHOD__);
    $retVal = "";
    if ($titleObj == null) {
        $retVal = "Title object was null in lw_createPage. This probably means that the string used to create it was invalid (which could be caused by bad unicode characters).";
    } else {
        if (is_string($titleObj)) {
            $retVal = "Passed a string into lw_createPage() for the pageTitle instead of passing a Title object. Tip: use Title::newFromDBkey() to convert strings into titles.";
        } else {
            if (!is_object($titleObj)) {
                $retVal = "Title object not an object. Please pass a title object into lw_createPage().";
            } else {
                // Create the Article object.
                $article = new Article($titleObj);
                /* @var $article WikiPage */
                $result = null;
                $editPage = new EditPage($article);
                $editPage->edittime = $article->getTimestamp();
                $editPage->textbox1 = $content;
                $bot = $wgUser->isAllowed('bot');
                //this function calls Article::onArticleCreate which clears cache for article and it's talk page - NOTE: I don't know what this comment refers to... it was coppied from /extensions/wikia/ArticleComments/ArticleComment.class.php
                $status = $editPage->internalAttemptSave($result, $bot);
                $value = $status->value;
                if ($value == EditPage::AS_SUCCESS_NEW_ARTICLE || $value == EditPage::AS_SUCCESS_UPDATE) {
                    $retVal = true;
                } else {
                    $retVal = $status->getMessage();
                }
            }
        }
    }
    wfProfileOut(__METHOD__);
    return $retVal;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:36,代码来源:server.php

示例11: createOrEditBoard

 /**
  *  create or edit board, if $board = null then we are creating new one
  */
 protected function createOrEditBoard($board, $titletext, $body, $bot = false)
 {
     wfProfileIn(__METHOD__);
     $id = null;
     if (!empty($board)) {
         $id = $board->getId();
     }
     if (self::LEN_OK !== $this->validateLength($titletext, 'title') || self::LEN_OK !== $this->validateLength($body, 'desc')) {
         wfProfileOut(__METHOD__);
         return false;
     }
     Forum::$allowToEditBoard = true;
     if ($id == null) {
         $title = Title::newFromText($titletext, NS_WIKIA_FORUM_BOARD);
     } else {
         $title = Title::newFromId($id, Title::GAID_FOR_UPDATE);
         $nt = Title::newFromText($titletext, NS_WIKIA_FORUM_BOARD);
         $title->moveTo($nt, true, '', false);
         $title = $nt;
     }
     $article = new Article($title);
     $editPage = new EditPage($article);
     $editPage->edittime = $article->getTimestamp();
     $editPage->textbox1 = $body;
     $result = array();
     $retval = $editPage->internalAttemptSave($result, $bot);
     if ($id == null) {
         $title = Title::newFromText($titletext, NS_WIKIA_FORUM_BOARD);
         if (!empty($title)) {
             wfSetWikiaPageProp(WPP_WALL_ORDER_INDEX, $title->getArticleId(), $title->getArticleId());
         }
     }
     Forum::$allowToEditBoard = false;
     wfProfileOut(__METHOD__);
     return $retval;
 }
开发者ID:yusufchang,项目名称:app,代码行数:39,代码来源:Forum.class.php

示例12: CategorySelectAjaxSaveCategories

/**
 * Save categories sent via AJAX into article
 *
 * @author Maciej Błaszkowski <marooned at wikia-inc.com>
 */
function CategorySelectAjaxSaveCategories($articleId, $categories)
{
    global $wgUser;
    if (wfReadOnly()) {
        $result['error'] = wfMsg('categoryselect-error-db-locked');
        return json_encode($result);
    }
    wfProfileIn(__METHOD__);
    Wikia::setVar('EditFromViewMode', 'CategorySelect');
    $categories = CategorySelectChangeFormat($categories, 'json', 'wiki');
    if ($categories == '') {
        $result['info'] = 'Nothing to add.';
    } else {
        $title = Title::newFromID($articleId);
        if (is_null($title)) {
            $result['error'] = wfMsg('categoryselect-error-not-exist', $articleId);
        } else {
            if ($title->userCan('edit') && !$wgUser->isBlocked()) {
                $result = null;
                $article = new Article($title);
                $article_text = $article->fetchContent();
                $article_text .= $categories;
                $dbw = wfGetDB(DB_MASTER);
                $dbw->begin();
                $editPage = new EditPage($article);
                $editPage->edittime = $article->getTimestamp();
                $editPage->recreate = true;
                $editPage->textbox1 = $article_text;
                $editPage->summary = wfMsgForContent('categoryselect-edit-summary');
                $editPage->watchthis = $editPage->mTitle->userIsWatching();
                $bot = $wgUser->isAllowed('bot');
                $status = $editPage->internalAttemptSave($result, $bot);
                $retval = $status->value;
                Wikia::log(__METHOD__, "editpage", "Returned value {$retval}");
                switch ($retval) {
                    case EditPage::AS_SUCCESS_UPDATE:
                    case EditPage::AS_SUCCESS_NEW_ARTICLE:
                        $dbw->commit();
                        $title->invalidateCache();
                        Article::onArticleEdit($title);
                        $skin = RequestContext::getMain()->getSkin();
                        // return HTML with new categories
                        // OutputPage::tryParserCache become deprecated in MW1.17 and removed in MW1.18 (BugId:30443)
                        $parserOutput = ParserCache::singleton()->get($article, $article->getParserOptions());
                        if ($parserOutput !== false) {
                            $skin->getOutput()->addParserOutput($parserOutput);
                        }
                        $cats = $skin->getCategoryLinks();
                        $result['info'] = 'ok';
                        $result['html'] = $cats;
                        break;
                    case EditPage::AS_SPAM_ERROR:
                        $dbw->rollback();
                        $result['error'] = wfMsg('spamprotectiontext') . '<p>( Case #8 )</p>';
                        break;
                    default:
                        $dbw->rollback();
                        $result['error'] = wfMsg('categoryselect-edit-abort');
                }
            } else {
                $result['error'] = wfMsg('categoryselect-error-user-rights');
            }
        }
    }
    wfProfileOut(__METHOD__);
    return json_encode($result);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:72,代码来源:CategorySelect.php

示例13: __construct

 /**
  * Constructor for a single item in the vcard. Requires the URI of the item.
  */
 public function __construct(Title $t, $prefix, $firstname, $lastname, $additionalname, $suffix, $fullname, $tels, $addresses, $emails, $birthday, $jobtitle, $role, $organization, $department, $category, $url, $note)
 {
     $this->uri = $t->getFullURL();
     $this->url = $url;
     // read fullname or guess it in a simple way from other names that are given
     if ($fullname != '') {
         $this->label = $fullname;
     } elseif ($firstname . $lastname != '') {
         $this->label = $firstname . ($firstname != '' && $lastname != '' ? ' ' : '') . $lastname;
     } else {
         $this->label = $t->getText();
     }
     $this->label = SRFVCardEntry::vCardEscape($this->label);
     // read firstname and lastname, or guess it from other names that are given
     if ($firstname . $lastname == '') {
         // guessing needed
         $nameparts = explode(' ', $this->label);
         // Accepted forms for guessing:
         // "Lastname"
         // "Firstname Lastname"
         // "Firstname <Additionalnames> Lastname"
         $this->lastname = SRFvCardEntry::vCardEscape(array_pop($nameparts));
         if (count($nameparts) > 0) {
             $this->firstname = SRFvCardEntry::vCardEscape(array_shift($nameparts));
         }
         foreach ($nameparts as $name) {
             $this->additionalname .= ($this->additionalname != '' ? ',' : '') . SRFvCardEntry::vCardEscape($name);
         }
     } else {
         $this->firstname = SRFvCardEntry::vCardEscape($firstname);
         $this->lastname = SRFvCardEntry::vCardEscape($lastname);
     }
     if ($additionalname != '') {
         $this->additionalname = $additionalname;
     }
     // no escape, can be a value list
     // ^ overwrite above guessing in that case
     $this->prefix = SRFvCardEntry::vCardEscape($prefix);
     $this->suffix = SRFvCardEntry::vCardEscape($suffix);
     $this->tels = $tels;
     $this->addresses = $addresses;
     $this->emails = $emails;
     $this->birthday = $birthday;
     $this->title = SRFvCardEntry::vCardEscape($jobtitle);
     $this->role = SRFvCardEntry::vCardEscape($role);
     $this->organization = SRFvCardEntry::vCardEscape($organization);
     $this->department = SRFvCardEntry::vCardEscape($department);
     $this->category = $category;
     // allow non-escaped "," in here for making a list of categories
     $this->note = SRFvCardEntry::vCardEscape($note);
     $article = new Article($t);
     $this->dtstamp = $article->getTimestamp();
 }
开发者ID:yusufchang,项目名称:app,代码行数:56,代码来源:SRF_vCard.php

示例14: showHeader

 protected function showHeader()
 {
     global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang;
     if ($this->isConflict) {
         $wgOut->wrapWikiMsg("<div class='mw-explainconflict'>\n\$1\n</div>", 'explainconflict');
         $this->edittime = $this->mArticle->getTimestamp();
     } else {
         if ($this->section != '' && !$this->isSectionEditSupported()) {
             // We use $this->section to much before this and getVal('wgSection') directly in other places
             // at this point we can't reset $this->section to '' to fallback to non-section editing.
             // Someone is welcome to try refactoring though
             $wgOut->showErrorPage('sectioneditnotsupported-title', 'sectioneditnotsupported-text');
             return false;
         }
         if ($this->section != '' && $this->section != 'new') {
             $matches = array();
             if (!$this->summary && !$this->preview && !$this->diff) {
                 preg_match("/^(=+)(.+)\\1/mi", $this->textbox1, $matches);
                 if (!empty($matches[2])) {
                     global $wgParser;
                     $this->summary = "/* " . $wgParser->stripSectionName(trim($matches[2])) . " */ ";
                 }
             }
         }
         if ($this->missingComment) {
             $wgOut->wrapWikiMsg("<div id='mw-missingcommenttext'>\n\$1\n</div>", 'missingcommenttext');
         }
         if ($this->missingSummary && $this->section != 'new') {
             $wgOut->wrapWikiMsg("<div id='mw-missingsummary'>\n\$1\n</div>", 'missingsummary');
         }
         if ($this->missingSummary && $this->section == 'new') {
             $wgOut->wrapWikiMsg("<div id='mw-missingcommentheader'>\n\$1\n</div>", 'missingcommentheader');
         }
         if ($this->hookError !== '') {
             $wgOut->addWikiText($this->hookError);
         }
         if (!$this->checkUnicodeCompliantBrowser()) {
             $wgOut->addWikiMsg('nonunicodebrowser');
         }
         if (isset($this->mArticle) && isset($this->mArticle->mRevision)) {
             // Let sysop know that this will make private content public if saved
             if (!$this->mArticle->mRevision->userCan(Revision::DELETED_TEXT)) {
                 $wgOut->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'rev-deleted-text-permission');
             } elseif ($this->mArticle->mRevision->isDeleted(Revision::DELETED_TEXT)) {
                 $wgOut->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'rev-deleted-text-view');
             }
             if (!$this->mArticle->mRevision->isCurrent()) {
                 $this->mArticle->setOldSubtitle($this->mArticle->mRevision->getId());
                 $wgOut->addWikiMsg('editingold');
             }
         }
     }
     if (wfReadOnly()) {
         $wgOut->wrapWikiMsg("<div id=\"mw-read-only-warning\">\n\$1\n</div>", array('readonlywarning', wfReadOnlyReason()));
     } elseif ($wgUser->isAnon()) {
         if ($this->formtype != 'preview') {
             $wgOut->wrapWikiMsg("<div id=\"mw-anon-edit-warning\">\n\$1</div>", 'anoneditwarning');
         } else {
             $wgOut->wrapWikiMsg("<div id=\"mw-anon-preview-warning\">\n\$1</div>", 'anonpreviewwarning');
         }
     } else {
         if ($this->isCssJsSubpage) {
             # Check the skin exists
             if ($this->isWrongCaseCssJsPage) {
                 $wgOut->wrapWikiMsg("<div class='error' id='mw-userinvalidcssjstitle'>\n\$1\n</div>", array('userinvalidcssjstitle', $this->getContextTitle()->getSkinFromCssJsSubpage()));
             }
             if ($this->formtype !== 'preview') {
                 if ($this->isCssSubpage) {
                     $wgOut->wrapWikiMsg("<div id='mw-usercssyoucanpreview'>\n\$1\n</div>", array('usercssyoucanpreview'));
                 }
                 if ($this->isJsSubpage) {
                     $wgOut->wrapWikiMsg("<div id='mw-userjsyoucanpreview'>\n\$1\n</div>", array('userjsyoucanpreview'));
                 }
             }
         }
     }
     if ($this->mTitle->getNamespace() != NS_MEDIAWIKI && $this->mTitle->isProtected('edit')) {
         # Is the title semi-protected?
         if ($this->mTitle->isSemiProtected()) {
             $noticeMsg = 'semiprotectedpagewarning';
         } else {
             # Then it must be protected based on static groups (regular)
             $noticeMsg = 'protectedpagewarning';
         }
         LogEventsList::showLogExtract($wgOut, 'protect', $this->mTitle->getPrefixedText(), '', array('lim' => 1, 'msgKey' => array($noticeMsg)));
     }
     if ($this->mTitle->isCascadeProtected()) {
         # Is this page under cascading protection from some source pages?
         list($cascadeSources, ) = $this->mTitle->getCascadeProtectionSources();
         $notice = "<div class='mw-cascadeprotectedwarning'>\n\$1\n";
         $cascadeSourcesCount = count($cascadeSources);
         if ($cascadeSourcesCount > 0) {
             # Explain, and list the titles responsible
             foreach ($cascadeSources as $page) {
                 $notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
             }
         }
         $notice .= '</div>';
         $wgOut->wrapWikiMsg($notice, array('cascadeprotectedwarning', $cascadeSourcesCount));
     }
//.........这里部分代码省略.........
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:101,代码来源:EditPage.php

示例15: Article

 function __construct($file)
 {
     $title = $file->getTitle();
     // og:type
     $this->properties['og:type'] = $this->translateType($this->defaultType);
     // og:url
     $this->properties['og:url'] = $title->getFullURL();
     // og:updated_time
     $article = new Article($title, 0);
     $timestamp = $article->getTimestamp(TS_UNIX, $article->getTimestamp());
     $this->properties['og:updated_time'] = $timestamp;
     // og:locale
     global $wgVersion;
     if (version_compare($wgVersion, '1.18', '>=')) {
         // Title::getPageLanguage() is since 1.18
         $langCode = $title->getPageLanguage()->getCode();
     } else {
         global $wgContLang;
         $langCode = $wgContLang->getCode();
     }
     $this->properties['og:locale'] = FacebookLanguage::getFbLocaleForLangCode($langCode);
     // og:title
     $this->properties['og:title'] = $file->getName();
     // og:image
     if ($file->getMediaType() == MEDIATYPE_BITMAP) {
         $this->properties['og:image'] = $file->getCanonicalUrl();
     } else {
         global $wgServer;
         $this->properties['og:image'] = $wgServer . $file->iconThumb()->url;
     }
     // og:description
     // TODO: This crashes MediaWiki because messages cannot be loaded or some bullshit
     // The problem is that message decoding calls MessageCache::parse(), which calls
     // message decoding, which again calls MessageCache::parse(). To provide reentrancy,
     // MessageCache::parse() violates its signature by returning a string instead of an
     // object. You dirty little bastard, you.
     //$this->properties['og:description'] = $file->getLongDesc();
     parent::__construct();
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:39,代码来源:FacebookOpenGraph.php


注:本文中的Article::getTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。