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


PHP Article::getId方法代码示例

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


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

示例1: addEditorial

 /**
  * Add the single most recent editorial file to the deposit package.
  * @return boolean true iff a file was successfully added to the package
  */
 function addEditorial()
 {
     // Move through signoffs in reverse order and try to use them.
     foreach (array('SIGNOFF_LAYOUT', 'SIGNOFF_COPYEDITING_FINAL', 'SIGNOFF_COPYEDITING_AUTHOR', 'SIGNOFF_COPYEDITING_INITIAL') as $signoffName) {
         assert(false);
         // Signoff implementation has changed; needs fixing.
         $file = $this->article->getFileBySignoffType($signoffName);
         if ($file) {
             $this->_addFile($file);
             return true;
         }
         unset($file);
     }
     // If that didn't work, try the Editor Version.
     $sectionEditorSubmissionDao = DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $sectionEditorSubmission = $sectionEditorSubmissionDao->getSectionEditorSubmission($this->article->getId());
     $file = $sectionEditorSubmission->getEditorFile();
     if ($file) {
         $this->_addFile($file);
         return true;
     }
     unset($file);
     // Try the Review Version.
     /* FIXME for OJS 3.0
     		$file = $sectionEditorSubmission->getReviewFile();
     		if ($file) {
     			$this->_addFile($file);
     			return true;
     		}
     		unset($file); */
     // Otherwise, don't add anything (best not to go back to the
     // author version, as it may not be vetted)
     return false;
 }
开发者ID:mariojp,项目名称:ojs,代码行数:38,代码来源:OJSSwordDeposit.inc.php

示例2: processArticle

 /**
  * @desc Process Artist article page
  *
  * @param Article $article
  *
  * @return array
  */
 public function processArticle(Article $article)
 {
     $name = $article->getTitle()->getText();
     $artistData = ['article_id' => $article->getId(), 'name' => $name, 'name_lowercase' => LyricsUtils::lowercase($name)];
     $artistData = array_merge($artistData, $this->getHeader($article));
     $artistData = array_merge($artistData, $this->getFooter($article));
     $artistData['genres'] = $this->getGenres($article);
     return $this->sanitizeData($artistData, $this->getDataMap());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:ArtistScraper.class.php

示例3: processArticle

 /**
  * @desc Process Album article page
  *
  * @param Article $article
  * @return array
  */
 public function processArticle(Article $article)
 {
     $albumData = ['article_id' => $article->getId()];
     $albumData = array_merge($albumData, $this->getHeader($article));
     $albumData['album_lowercase'] = LyricsUtils::lowercase($albumData['Album']);
     $albumData['genres'] = $this->getGenres($article);
     if (isset($albumData['Genre']) && !in_array($albumData['Genre'], $albumData['genres'])) {
         $albumData['genres'][] = $albumData['Genre'];
     }
     return array_merge($albumData, $this->getFooter($article));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:AlbumScraper.class.php

示例4: test_multilingual_setting_by_reference

 public function test_multilingual_setting_by_reference()
 {
     $Article = new Article();
     $Article->set('headline', array('en' => 'New PHP Framework re-released', 'es' => 'Se ha re-liberado un nuevo Framework para PHP'));
     $Article->set('body', array('en' => 'The Akelos Framework has been re-released...', 'es' => 'Un equipo de programadores españoles ha re-lanzado un entorno de desarrollo para PHP...'));
     $Article->set('excerpt_limit', array('en' => 7, 'es' => 3));
     $this->assertTrue($Article->save());
     $Article =& $Article->find($Article->getId());
     $this->assertEqual($Article->get('en_headline'), 'New PHP Framework re-released');
     $this->assertEqual($Article->get('es_body'), 'Un equipo de programadores españoles ha re-lanzado un entorno de desarrollo para PHP...');
     $this->assertEqual($Article->get('en_excerpt_limit'), 7);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:12,代码来源:_AkActiveRecord_i18n.php

示例5: update

 public function update(Article $article)
 {
     $id = $article->getId();
     $content = mysqli_real_escape_string($article->getContent());
     $id_author = $article->getUser()->getId();
     $query = "UPDATE article SET content='" . $content . "', id_user='" . $id_user . "' WHERE id='" . $id . "'";
     $res = mysqli_query($this->db, $query);
     if ($res) {
         return $this->findById($id);
     } else {
         return "Internal Server Error";
     }
 }
开发者ID:Hollux,项目名称:Fennec,代码行数:13,代码来源:ArticleManager.class.php

示例6: userWasLastToEdit

 /**
  * Check if no edits were made by other users since
  * the time a user started editing the page. Limit to
  * 50 revisions for the sake of performance.
  *
  * @param $id int
  * @param $edittime string
  *
  * @return bool
  */
 protected function userWasLastToEdit($id, $edittime)
 {
     if (!$id) {
         return false;
     }
     $dbw = wfGetDB(DB_MASTER);
     $res = $dbw->select('revision', 'rev_user', array('rev_page' => $this->mArticle->getId(), 'rev_timestamp > ' . $dbw->addQuotes($dbw->timestamp($edittime))), __METHOD__, array('ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50));
     foreach ($res as $row) {
         if ($row->rev_user != $id) {
             return false;
         }
     }
     return true;
 }
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:24,代码来源:EditPage.php

示例7: update

 public function update(Article $object)
 {
     $id = intval($object->getId());
     $data = $object->getData();
     $set_arr = array();
     foreach ($data as $field => $value) {
         if (!is_null($value)) {
             $set_arr[] = "`{$field}`='{$value}'";
         }
     }
     $set_str = implode(',', $set_arr);
     $query = "UPDATE `{$this->_table}`" . " SET {$set_str} WHERE `id`='{$id}'";
     return $this->_connect->query($query);
 }
开发者ID:AleksandrMishchaniuk,项目名称:homework_64_OOP-Articles,代码行数:14,代码来源:DBAdapter.php

示例8: getAverageRating

	/**
	 * @param Article $article
	 * @param string $tag
	 * @param bool $forUpdate, use master?
	 * @return array(real,int)
	 * Get article rating for this tag for the last few days
	 */
	public static function getAverageRating( $article, $tag, $forUpdate=false ) {
		global $wgFeedbackAge;
		$db = $forUpdate ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
		$cutoff_unixtime = time() - $wgFeedbackAge;
		// rfh_date is always MW format on all dbms
		$encCutoff = $db->addQuotes( wfTimestamp( TS_MW, $cutoff_unixtime ) );
		$row = $db->selectRow( 'reader_feedback_history', 
			array('SUM(rfh_total)/SUM(rfh_count) AS ave, SUM(rfh_count) AS count'),
			array( 'rfh_page_id' => $article->getId(), 'rfh_tag' => $tag,
				"rfh_date >= {$encCutoff}" ),
			__METHOD__ );
		$data = $row && $row->count ?
			array($row->ave,$row->count) : array(0,0);
		return $data;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:22,代码来源:ReaderFeedback.class.php

示例9: getArticleType

 /**
  * Gets the article type using Solr.
  * Since SolrDocumentService uses memoization, we will NOT do an additional Solr request
  * because of this method - both snippet and article type can use the same memoized
  * result
  *
  * @return string The plain text as stored in solr. Will be empty if we don't have a result.
  */
 public function getArticleType()
 {
     if (!$this->article instanceof Article) {
         return '';
     }
     $service = new SolrDocumentService();
     $service->setArticleId($this->article->getId());
     $document = $service->getResult();
     $text = '';
     if ($document !== null) {
         if (!empty($document[static::SOLR_ARTICLE_TYPE_FIELD])) {
             $text = $document[static::SOLR_ARTICLE_TYPE_FIELD];
         }
     }
     return $text;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:ArticleService.class.php

示例10: processArticle

 /**
  * @desc Process Song article page
  *
  * @param Article $article
  * @return array
  */
 public function processArticle(Article $article)
 {
     $songArticleId = $article->getId();
     $songData = ['article_id' => $songArticleId];
     $songData = array_merge($songData, $this->getFooter($article));
     $songData['lyrics'] = $this->getLyrics($article);
     // MOB-1367 - make sure the song name is the same as song's article title
     $songTitle = $article->getTitle();
     $songName = !is_null($songTitle) ? $this->getSongFromArtistTitle($songTitle->getText()) : null;
     if (!is_null($songName)) {
         $songData['song'] = $songName;
         $songData['song_lowercase'] = LyricsUtils::lowercase($songName);
     } else {
         wfDebugLog(__METHOD__, sprintf('Scraped song without title (%d) or with invalid name', $songArticleId));
     }
     return $songData;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:SongScraper.class.php

示例11: updatePage

 /**
  */
 protected function updatePage(&$article, &$data)
 {
     $pageTitle = $article->mTitle->getText() . '.meta';
     $title = Title::newFromText($pageTitle, $article->mTitle->getNamespace());
     $a = new Article($title);
     $new = $a->getId() == 0 ? true : false;
     if (is_null($a)) {
         // this shouldn't happen anyways.
         throw new MWException(__METHOD__);
     } else {
         if ($new) {
             $flags = EDIT_NEW | EDIT_DEFER_UPDATES;
         } else {
             $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES;
         }
         $a->doEdit($data, ' ', $flags);
     }
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:20,代码来源:PageMetaData.body.php

示例12: getForArticle

 static function getForArticle(Article $article)
 {
     $targetPageId = $article->getId();
     if (!$targetPageId) {
         return array();
     }
     try {
         $dbr = wfGetDb(DB_SLAVE);
         $res = $dbr->select(self::TABLE_NAME, array('backlink_text', 'SUM(count)'), array('target_page_id' => $targetPageId), __METHOD__, array('GROUP BY' => array('target_page_id', 'backlink_text')));
         $resultArray = array();
         while ($row = $res->fetchRow()) {
             $resultArray[$row['backlink_text']] = $row['SUM(count)'];
         }
         return $resultArray;
     } catch (Exception $e) {
         // should probably log this
         return array();
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:19,代码来源:Backlinks.class.php

示例13: update

    public function update(Article $article)
    {
        $id = $article->getId();
        $title = $this->db->quote($title->getTitle());
        $content = $this->db->quote($content->getContent());
        $image = $this->db->quote($image->getImage());
        $idAuthor = $_SESSION['id'];
        $query = '	UPDATE article
						SET title 		=' . $title . ',
							content 	=' . $content . ',
							image 		=' . $image . ',
							$idAuthor 	=' . $idAuthor . '
						WHERE id=' . $id;
        $res = $this->db->exec($query);
        if ($res) {
            $id = $this->db->lastInsertId();
            if ($id) {
                return $this->findById($id);
            } else {
                throw new Exception('Internal server Error');
            }
        }
    }
开发者ID:Hollux,项目名称:mvcBase2,代码行数:23,代码来源:ArticleManager.class.php

示例14: getText

 protected function getText($title)
 {
     $titleObject = Title::newFromText($title);
     $article = new Article($titleObject);
     // make sure the article exists.
     if ($article->getId() == 0) {
         return null;
     }
     // prepare the parser cache for action.
     $parserCache =& ParserCache::singleton();
     global $wgUser;
     $parserOutput = $parserCache->get($article, $wgUser);
     // did we find it in the parser cache?
     if ($parserOutput !== false) {
         return $parserOutput->getText();
     }
     // no... that's too bad; go the long way then.
     $rev = Revision::newFromTitle($titleObject);
     if (is_object($rev)) {
         return $this->parse($titleObject, $rev->getText());
     }
     return null;
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:23,代码来源:ToolboxExtender.body.php

示例15: importOldRevision

 function importOldRevision()
 {
     $fname = "WikiImporter::importOldRevision";
     $dbw =& wfGetDB(DB_MASTER);
     # Sneak a single revision into place
     $user = User::newFromName($this->getUser());
     if ($user) {
         $userId = IntVal($user->getId());
         $userText = $user->getName();
     } else {
         $userId = 0;
         $userText = $this->getUser();
     }
     // avoid memory leak...?
     global $wgLinkCache;
     $wgLinkCache->clear();
     $article = new Article($this->title);
     $pageId = $article->getId();
     if ($pageId == 0) {
         # must create the page...
         $pageId = $article->insertOn($dbw);
     }
     # FIXME: Check for exact conflicts
     # FIXME: Use original rev_id optionally
     # FIXME: blah blah blah
     #if( $numrows > 0 ) {
     #	return wfMsg( "importhistoryconflict" );
     #}
     # Insert the row
     $revision = new Revision(array('page' => $pageId, 'text' => $this->getText(), 'comment' => $this->getComment(), 'user' => $userId, 'user_text' => $userText, 'timestamp' => $this->timestamp, 'minor_edit' => $this->minor));
     $revId = $revision->insertOn($dbw);
     $article->updateIfNewerOn($dbw, $revision);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:34,代码来源:SpecialImport.php


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