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


PHP Article类代码示例

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


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

示例1: ArticleMessage

    /**
     * Log article related event.
     *
     * @param Article $p_article
     * @param string $p_text
     * @param int $p_userId
     * @param int $p_eventId
     * @param bool $p_short
     *
     * @return void
     */
    public static function ArticleMessage(Article $p_article, $p_text, $p_userId = NULL, $p_eventId = 0, $p_short = FALSE)
    {
        ob_start();

        echo getGS('Article'), ': ', $p_article->getTitle();

        if (!$p_short) { // add publication, issue, section
            echo ' (';
            echo getGS('Publication'), ': ', $p_article->getPublicationId();
            echo ', ';
            echo getGS('Issue'), ': ', $p_article->getIssueNumber();
            echo ', ';
            echo getGS('Section'), ': ', $p_article->getSectionNumber();
            echo ")\n";
        }

        // generate url
        $url = ShortURL::GetURL($p_article->getPublicationId(),
            $p_article->getLanguageId(),
            $p_article->getIssueNumber(),
            $p_article->getSectionNumber(),
            $p_article->getArticleNumber());
        if (strpos($url, 'http') !== FALSE) { // no url for deleted
            echo getGS('Article URL'), ': ', $url, "\n";
        }

        echo getGS('Article Number'), ': ', $p_article->getArticleNumber(), "\n";
        echo getGS('Language'), ': ', $p_article->getLanguageName(), "\n";

        echo "\n";
        echo getGS('Action') . ': ', $p_text;

        $message = ob_get_clean();
        self::Message($message, $p_userId, $p_eventId);
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:46,代码来源:Log.php

示例2: convert

 function convert($newFormat, $pageName, $calName, $redirect, $go)
 {
     $search = "{$pageName}/{$calName}";
     $pages = PrefixSearch::titleSearch($search, 1000000);
     //search upto 1,000,000 events (no performace issue)
     $count = $erroredCount = 0;
     foreach ($pages as $page) {
         $retval = false;
         $newPage = $this->convertToNewPage($page, $newFormat);
         $article = new Article(Title::newFromText($page));
         if ($newPage != '') {
             $fromTitle = Title::newFromText($page);
             $toTitle = Title::newFromText($newPage);
             $articleNew = new Article(Title::newFromText($newPage));
             if (!$article->isRedirect() && !$articleNew->exists()) {
                 if ($go) {
                     $retval = $fromTitle->moveTo($toTitle, true, 'CalendarConversion', $redirect);
                 } else {
                     if ($count < 10) {
                         $testRun .= '&nbsp;&nbsp;' . $page . '  &rarr;&rarr;  ' . $newPage . '<br>';
                     }
                 }
             }
         }
     }
     unset($pages);
     if ($go) {
         $ret = "Conversion completed.";
     } else {
         $ret = "<b>Test Results, add '<i>go</i>' to the <i>dateConverter</i> tag to convert:</b><br>{$testRun}";
     }
     return $ret;
 }
开发者ID:mediawiki-extensions,项目名称:mw-calendar,代码行数:33,代码来源:DateConverter.php

示例3: deleteArticle

 public static function deleteArticle($id)
 {
     if (isset($id)) {
         $article = new Article($id);
         $article->delete();
     }
 }
开发者ID:AJIACTOP,项目名称:MVC-Framework,代码行数:7,代码来源:ControllerArticle.php

示例4: execute

 function execute()
 {
     global $wgRequest, $wgOut, $wgUser, $wgArticle;
     $sitting_of = $wgRequest->getVal('sitting_of');
     $session_number = $wgRequest->getVal('session_number');
     $sitting_start_date_time = $wgRequest->getVal('sitting_start_date_and_time');
     $sitting_end_date_time = $wgRequest->getVal('sitting_end_date_and_time');
     $sitting_session_number = $wgRequest->getVal('sitting_session_number');
     $wpEditToken = $wgRequest->getVal('wpEditToken');
     $sitting_desc = $wgRequest->getVal('sitting_desc');
     $sitting_start_date = substr($sitting_start_date_time, 0, strpos($sitting_start_date_time, ' '));
     $sitting_start_time = substr($sitting_start_date_time, strpos($sitting_start_date_time, ' ') + 1);
     $sitting_end_date = substr($sitting_end_date_time, 0, strpos($sitting_end_date_time, ' '));
     $sitting_end_time = substr($sitting_end_date_time, strpos($sitting_end_date_time, ' ') + 1);
     $sitting_name = $sitting_of . '-' . $sitting_start_date;
     //$sitting_of.'-'.$sitting_start_date_time.'-'
     $title = Title::newFromText($sitting_name, MV_NS_SITTING);
     $wgArticle = new Article($title);
     $wgArticle->doEdit($sitting_desc, wfMsg('mv_summary_add_sitting'));
     $dbkey = $title->getDBKey();
     $sitting = new MV_Sitting(array('name' => $dbkey, 'start_date' => $sitting_start_date, 'start_time' => $sitting_start_time, 'end_date' => $sitting_end_date, 'end_time' => $sitting_end_time));
     //$sitting->db_load_sitting();
     //$sitting->db_load_streams();
     if ($sitting->insertSitting()) {
         if ($wgArticle->exists()) {
             $wgOut->redirect($title->getLocalURL("action=staff"));
         } else {
             $html .= 'Article ' . $sitting_name . ' does not exist';
             $wgOut->addHtml($html);
         }
     } else {
         $WgOut->addHTML('Error: Duplicate Sitting Name?');
     }
 }
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:34,代码来源:MV_SpecialEditSitting.php

示例5: run

 /**
  * Run a createPage job
  * @return boolean success
  */
 function run()
 {
     if (is_null($this->title)) {
         $this->error = "createPage: Invalid title";
         return false;
     }
     $article = new Article($this->title, 0);
     if (!$article) {
         $this->error = 'createPage: Article not found "' . $this->title->getPrefixedDBkey() . '"';
         return false;
     }
     $page_text = $this->params['page_text'];
     // change global $wgUser variable to the one
     // specified by the job only for the extent of this
     // replacement
     global $wgUser;
     $actual_user = $wgUser;
     $wgUser = User::newFromId($this->params['user_id']);
     $edit_summary = '';
     if (array_key_exists('edit_summary', $this->params)) {
         $edit_summary = $this->params['edit_summary'];
     }
     $article->doEdit($page_text, $edit_summary);
     $wgUser = $actual_user;
     return true;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:30,代码来源:SF_CreatePageJob.php

示例6: generateFeed

 public function generateFeed()
 {
     $articles = $this->getArticles();
     $feed = Feed::make();
     // set your feed's title, description, link, pubdate and language
     $feed->title = 'cnBeta1';
     $feed->description = '一个干净、现代、开放的cnBeta';
     $feed->logo = 'http://cnbeta1.com/assets/img/cnbeta1.png';
     $feed->link = URL::to('feed');
     $feed->pubdate = $articles[0]['date'];
     $feed->lang = 'zh-cn';
     foreach ($articles as $article) {
         $articleModel = new Article($article['article_id']);
         try {
             $articleModel->load();
         } catch (Exception $ex) {
             Log::error('feed: fail to fetch article: ' . $article['article_id'] . ', error: ' . $ex->getMessage());
         }
         $content = $article['intro'];
         $content .= $articleModel->data['content'] ? $articleModel->data['content'] : '';
         // set item's title, author, url, pubdate, description and content
         $feed->add($article['title'], 'cnBeta1', URL::to($article['article_id']), $article['date'], $content, $content);
     }
     $this->data = $feed->render('atom', -1);
     $this->saveToCache();
 }
开发者ID:undownding,项目名称:cnBeta1,代码行数:26,代码来源:ArticleFeed.php

示例7: testGetsReadableMetaData

 public function testGetsReadableMetaData()
 {
     $article = new Article();
     $article->title = 'My first Article';
     $article->author = 'Huang Yu Kai';
     $this->assertEquals('"My first Article" was written by Huang Yu Kai', $article->meta());
 }
开发者ID:joyhuang-note,项目名称:laravel-testing-decoded,代码行数:7,代码来源:ArticleTest.php

示例8: execute

 public function execute()
 {
     $params = $this->extractRequestParams();
     $titleObj = null;
     if (!isset($params['title'])) {
         $this->dieUsageMsg(array('missingparam', 'title'));
     }
     if (!isset($params['user'])) {
         $this->dieUsageMsg(array('missingparam', 'user'));
     }
     $titleObj = Title::newFromText($params['title']);
     if (!$titleObj) {
         $this->dieUsageMsg(array('invalidtitle', $params['title']));
     }
     if (!$titleObj->exists()) {
         $this->dieUsageMsg(array('notanarticle'));
     }
     // We need to be able to revert IPs, but getCanonicalName rejects them
     $username = User::isIP($params['user']) ? $params['user'] : User::getCanonicalName($params['user']);
     if (!$username) {
         $this->dieUsageMsg(array('invaliduser', $params['user']));
     }
     $articleObj = new Article($titleObj);
     $summary = isset($params['summary']) ? $params['summary'] : "";
     $details = null;
     $retval = $articleObj->doRollback($username, $summary, $params['token'], $params['markbot'], $details);
     if ($retval) {
         // We don't care about multiple errors, just report one of them
         $this->dieUsageMsg(reset($retval));
     }
     $info = array('title' => $titleObj->getPrefixedText(), 'pageid' => intval($details['current']->getPage()), 'summary' => $details['summary'], 'revid' => intval($details['newid']), 'old_revid' => intval($details['current']->getID()), 'last_revid' => intval($details['target']->getID()));
     $this->getResult()->addValue(null, $this->getModuleName(), $info);
 }
开发者ID:rocLv,项目名称:conference,代码行数:33,代码来源:ApiRollback.php

示例9: onArticleSaveComplete

 /**
  * Hook entry when article is change
  *
  * @param Article $article
  */
 public static function onArticleSaveComplete(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect)
 {
     $title = $article->getTitle();
     $ce = new CategoryExhibitionSection(null);
     $ce->setTouched($title);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:CategoryExhibitionHelper.class.php

示例10: actionCreate

 /**
  * 文章添加
  */
 public function actionCreate()
 {
     $model = new Article();
     $addonarticle = new Addonarticle();
     if (isset($_POST['Article'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $model->attributes = $_POST['Article'];
             if (!$model->save()) {
                 Tool::logger('article', var_export($model->getErrors(), true));
                 throw new CException('文章生成失败');
             }
             $aid = $model->primaryKey;
             $addonarticle->attributes = $_POST['Addonarticle'];
             if (!$addonarticle->save()) {
                 Tool::logger('article', var_export($addonarticle->getErrors(), true));
                 throw new CException('文章附表生成失败');
             }
             $this->redirect(array('list'));
         } catch (Exception $e) {
             Tool::logger('article', $e->getMessage());
             $transaction->rollback();
         }
     }
     $this->render('create', array('model' => $model, 'addonarticle' => $addonarticle));
 }
开发者ID:njz817,项目名称:ycms,代码行数:29,代码来源:ArticleController.php

示例11: execute

 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest;
     // Set page title and other stuff
     $this->setHeaders();
     # Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     # If user is blocked, s/he doesn't need to access this page
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     $title = $wgRequest->getVal('wpTitle');
     $category = $wgRequest->getVal('wpCategory');
     if (empty($title) || empty($category)) {
         return;
     }
     $oTitle = Title::newFromText($title);
     if (!is_object($oTitle)) {
         return;
     }
     $oArticle = new Article($oTitle);
     if ($oTitle->exists()) {
         $text = $oArticle->getContent();
     } else {
         $text = self::getCreateplate($category);
     }
     $text .= "\n[[Category:" . $category . ']]';
     $oArticle->doEdit($text, wfMsgForContent('createincategory-comment', $category));
     $wgOut->redirect($oTitle->getFullUrl());
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:38,代码来源:SpecialCreateInCategory_body.php

示例12: 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

示例13: getArticleQuality

 /**
  * Returns percentile quality of articleId or null if not found
  * @return int|null
  */
 public function getArticleQuality()
 {
     $cacheKey = wfMemcKey(__CLASS__, self::CACHE_BUSTER, $this->articleId);
     $percentile = $this->app->wg->Memc->get($cacheKey);
     if ($percentile === false) {
         $title = Title::newFromID($this->articleId);
         if ($title === null) {
             return null;
         }
         $article = new Article($title);
         $parserOutput = $article->getParserOutput();
         if (!$parserOutput) {
             //MAIN-3592
             $this->error(__METHOD__, ['message' => 'Article::getParserOutput returned false', 'articleId' => $this->articleId]);
             return null;
         }
         $inputs = ['outbound' => 0, 'inbound' => 0, 'length' => 0, 'sections' => 0, 'images' => 0];
         /**
          *  $title->getLinksTo() and  $title->getLinksFrom() function are
          * too expensive to call it here as we want only the number of links
          */
         $inputs['outbound'] = $this->countOutboundLinks($this->articleId);
         $inputs['inbound'] = $this->countInboundLinks($this->articleId);
         $inputs['sections'] = count($parserOutput->getSections());
         $inputs['images'] = count($parserOutput->getImages());
         $inputs['length'] = $this->getCharsCountFromHTML($parserOutput->getText());
         $quality = $this->computeFormula($inputs);
         $percentile = $this->searchPercentile($quality);
         $this->app->wg->Memc->set($cacheKey, $percentile, self::MEMC_CACHE_TIME);
     }
     return $percentile;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:36,代码来源:ArticleQualityService.php

示例14: getContent

 function getContent()
 {
     $err_msg = $_SESSION['LOGIN_RESULT'];
     $_SESSION['LOGIN_RESULT'] = "";
     $p = array();
     $d = new News($this->db_conn);
     //$d->debug = 1;
     $limit_str = " LIMIT 0, 5";
     $p['news_type'] = 1;
     $lists1 = $d->getListArray($p, $limit_str);
     $p['news_type'] = 2;
     $lists2 = $d->getListArray($p, $limit_str);
     $a = new Article($this->db_conn);
     $p['article_type'] = 1;
     $art1 = $a->getListArray($p, " LIMIT 0, 1");
     $p['article_type'] = 2;
     $art2 = $a->getListArray($p, " LIMIT 0, 1");
     $this->assign('data', $d);
     $this->assign('lists1', $lists1);
     $this->assign('lists2', $lists2);
     $this->assign('art1', $art1[0]);
     $this->assign('art2', $art2[0]);
     $this->assign('errmsg', $err_msg);
     //$this->assign('content_page', $this->template.$this->list_tpl);
 }
开发者ID:jcandrew1966,项目名称:as_woodhouse,代码行数:25,代码来源:IndexController.php

示例15: run

	/**
	 * Run a pageSchemasCreatePage job
	 * @return boolean success
	 */
	function run() {
		wfProfileIn( __METHOD__ );

		if ( is_null( $this->title ) ) {
			$this->error = "pageSchemasCreatePage: Invalid title";
			wfProfileOut( __METHOD__ );
			return false;
		}
		$article = new Article( $this->title );
		if ( !$article ) {
			$this->error = 'pageSchemasCreatePage: Article not found "' . $this->title->getPrefixedDBkey() . '"';
			wfProfileOut( __METHOD__ );
			return false;
		}

		$page_text = $this->params['page_text'];
		// change global $wgUser variable to the one
		// specified by the job only for the extent of this
		// replacement
		global $wgUser;
		$actual_user = $wgUser;
		$wgUser = User::newFromId( $this->params['user_id'] );
		$edit_summary = wfMsgForContent( 'ps-generatepages-editsummary' );
		$article->doEdit( $page_text, $edit_summary );
		$wgUser = $actual_user;
		wfProfileOut( __METHOD__ );
		return true;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:32,代码来源:PS_CreatePageJob.php


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