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


PHP Article::setTitle方法代码示例

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


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

示例1: loadOne

 protected function loadOne($file)
 {
     $xml = new SimpleXMLElement($file, 0, true);
     if ((string) $xml->head->title == null) {
         return null;
     }
     $article = new Article();
     foreach ($xml->head->meta as $meta) {
         $name = (string) $meta['name'];
         $content = (string) $meta['content'];
         switch ($name) {
             case 'date':
                 $article->setPublicationDate(new DateTime($content));
                 break;
             case 'author':
                 $article->setAuthor($content);
                 break;
         }
     }
     $article->setTitle((string) $xml->head->title);
     $article->setHash($this->getHash($article->getTitle()));
     $content = "";
     foreach ($xml->body->children() as $child) {
         $content .= $child->asXml();
     }
     $article->setContent($content);
     return $article;
 }
开发者ID:nbrignol,项目名称:PhpLayeredApplicationFramework,代码行数:28,代码来源:ArticleDaoFileSystem.php

示例2: getArticle

 function getArticle()
 {
     $article = new Article();
     if (!$this->domLiteDocument) {
         die("not domLiteDocument...");
     }
     $temp =& $this->domLiteDocument->getElementsByPath("/SERIAL");
     for ($i = 0; $i < $temp->getLength(); $i++) {
         $item = $temp->item($i);
         $article->setSerial($this->getNodeText($item, 'TITLEGROUP/TITLE'));
     }
     $temp =& $this->domLiteDocument->getElementsByPath("//ISSUEINFO");
     for ($i = 0; $i < $temp->getLength(); $i++) {
         $item = $temp->item($i);
         $article->setVolume($this->getNodeAttribute($item, 'VOL'));
         $article->setNumber($this->getNodeAttribute($item, 'NUM'));
         $article->setSuppl($this->getNodeAttribute($item, 'SUPPL'));
         $article->setYear($this->getNodeAttribute($item, 'YEAR'));
     }
     $temp =& $this->domLiteDocument->getElementsByPath("//ARTICLE");
     for ($i = 0; $i < $temp->getLength(); $i++) {
         $item = $temp->item($i);
         $article->setPublicationDate($this->getNodeText($item, 'publication-date'));
         $article->setTitle($this->getNodeXML($item, 'TITLES'));
         $article->setAuthorXML($this->getNodeXML($item, 'AUTHORS'));
         $article->setKeywordXML($this->getNodeXML($item, 'KEYWORDS'));
         $article->setAbstractXML($this->getNodeXML($item, 'ABSTRACT'));
     }
     return $article;
 }
开发者ID:Ethennoob,项目名称:Web,代码行数:30,代码来源:ArticleServicesResult.php

示例3: getArticles

 function getArticles()
 {
     $xml = $this->getXML();
     $XML_XSL = new XSL_XML();
     $content = $XML_XSL->xml_xsl($xml, dirname(__FILE__) . "/../../xsl/similarToArray.xsl");
     $content = str_replace('<?xml version="1.0" encoding="ISO-8859-1"?>', '', $content);
     $articles = split('\\|SIMILAR_SPLIT\\|', $content);
     $article = new Article();
     for ($i = 0; $i < count($articles) - 1; $i++) {
         $articles[$i] = split('\\|ITEM_SPLIT\\|', $articles[$i]);
         if (trim($articles[$i][0]) != '') {
             $article->setPID(trim($articles[$i][0]));
             $article->setPublicationDate(trim($articles[$i][1]));
             $article->setRelevance(trim($articles[$i][2]));
             $article->setURL(trim($articles[$i][3]));
             $article->setTitle(trim($articles[$i][4]));
             $article->setSerial(trim($articles[$i][5]));
             $article->setVolume(trim($articles[$i][6]));
             $article->setNumber(trim($articles[$i][7]));
             $article->setYear(trim($articles[$i][8]));
             $article->setSuppl(trim($articles[$i][9]));
             $article->setAuthorXML(str_replace("\n", "", trim($articles[$i][10])));
             $article->setKeywordXML(trim($articles[$i][11]));
             $arrArticles[$i] = $article;
         }
     }
     //	die(print_r($arrArticles));
     return $arrArticles;
 }
开发者ID:padlrosa,项目名称:Regional-2,代码行数:29,代码来源:TrigramaSimilar.php

示例4: upload_article_handler

function upload_article_handler(&$request, &$session, &$files) {
	$publication = Input::Get('Pub', 'int', 0);
	$issue = Input::Get('Issue', 'int', 0);
	$section = Input::Get('Section', 'int', 0);
	$language = Input::Get('Language', 'int', 0);
	$sLanguage = Input::Get('sLanguage', 'int', 0);
	$articleNumber = Input::Get('Article', 'int', 0);

	if (!Input::IsValid()) {
		echo "Input Error: Missing input";
		return;
	}

	// Unzip the sxw file to get the content.
	$zip = zip_open($files["filename"]["tmp_name"]);
	if ($zip) {
		$xml = null;
		while ($zip_entry = zip_read($zip)) {
			if (zip_entry_name($zip_entry) == "content.xml") {
		       	if (zip_entry_open($zip, $zip_entry, "r")) {
		           	$xml = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
			        zip_entry_close($zip_entry);
		       	}
			}
		}
		zip_close($zip);

		if (!is_null($xml)) {
			// Write the XML to a file because the XSLT functions
			// require it to be in a file in order to be processed.
			$tmpXmlFilename = tempnam("/tmp", "ArticleImportXml");
			$tmpXmlFile = fopen($tmpXmlFilename, "w");
			fwrite($tmpXmlFile, $xml);
			fclose($tmpXmlFile);

			// Transform the OpenOffice document to DocBook format.
			$xsltProcessor = xslt_create();
			$docbookXml = xslt_process($xsltProcessor,
									   $tmpXmlFilename,
									   "sxwToDocbook.xsl");
			unlink($tmpXmlFilename);

			// Parse the docbook to get the data.
			$docBookParser = new DocBookParser();
			$docBookParser->parseString($docbookXml, true);

			$article = new Article($articleNumber, $language);
			$article->setTitle($docBookParser->getTitle());
			$article->setIntro($docBookParser->getIntro());
			$article->setBody($docBookParser->getBody());

			// Go back to the "Edit Article" page.
			header("Location: /$ADMIN/articles/edit.php?Pub=$publication&Issue=$issue&Section=$section&Article=$articleNumber&Language=$language&sLanguage=$sLanguage");
		} // if (!is_null($xml))
	} // if ($zip)

	// Some sort of error occurred - show the upload page again.
	include("index.php");
} // fn upload_article_handler
开发者ID:nistormihai,项目名称:Newscoop,代码行数:59,代码来源:CommandProcessor.php

示例5: testSave

 public function testSave()
 {
     $article = new Article();
     $article->setCreatedAt(time());
     $article->setTitle('test');
     $article->setText('test text');
     $this->assertTrue($this->db->save($article));
 }
开发者ID:andrew45105,项目名称:simple-framework-core,代码行数:8,代码来源:DBManagerTest.php

示例6: __invoke

 public function __invoke($args)
 {
     if (count($args) < 2) {
         throw new OrongoScriptParseException("Arguments missing for Articles.SetTitle()");
     }
     $article = new Article($args[0]);
     $article->setTitle($args[1]);
 }
开发者ID:JacoRuit,项目名称:orongocms,代码行数:8,代码来源:orongopackage_Articles.php

示例7: executeAddArticleAndSave

 public function executeAddArticleAndSave(sfWebRequest $request)
 {
     $article = new Article();
     $article->setTitle(__METHOD__ . '()');
     $category = CategoryPeer::retrieveByPK($request->getParameter('category_id'));
     $category->addArticle($article);
     $category->save();
     return sfView::NONE;
 }
开发者ID:laiello,项目名称:tesiscdfeg12,代码行数:9,代码来源:actions.class.php

示例8: testGetInsertingData

 public function testGetInsertingData()
 {
     $article = new Article();
     $article->setCreatedAt(time());
     $article->setTitle('test');
     $article->setText('test text');
     $data = $this->helper->getInsertingData($article);
     $this->assertCount(3, $data);
     $this->assertArrayHasKey('created_at', $data);
     $this->assertArrayHasKey('title', $data);
     $this->assertArrayHasKey('text', $data);
 }
开发者ID:andrew45105,项目名称:simple-framework-core,代码行数:12,代码来源:DBHelperTest.php

示例9: getMyProfileArticleList

 function getMyProfileArticleList($article_profile)
 {
     // 1 - SELECT nos profiles do Usuarios
     // 2 - Pra cada Profile: pego a lista de artigos (olho na profiele_article
     // 3 - devolvo array de perfis com os artigos
     $this->setMyProfiles($article_profile->getUserID());
     $profiles_result = $this->getMyProfiles();
     //$articleProfileList[] = array();
     for ($p = 0; $p < count($profiles_result); $p++) {
         $profile_id = $profiles_result[$p]['profile_id'];
         $profile_name = $profiles_result[$p]['profile_name'];
         $articleProfileList[intval($profile_id)] = array();
         $order = $_GET['order'];
         switch ($order) {
             case "date":
                 $order_by = " ORDER BY articles.publication_date desc";
                 break;
             case "relevance":
                 $order_by = " ORDER BY relevance desc";
                 break;
             default:
                 $order_by = null;
         }
         $where_new = isset($_GET['new']) ? ' and is_new=1' : null;
         $strsql = "SELECT profile_article.*,articles.publication_date FROM profile_article,articles WHERE articles.PID = profile_article.PID and profile_id = '" . $profile_id . "'" . $where_new . " " . $order_by;
         $result = $this->_db->databaseQuery($strsql);
         for ($i = 0; $i < count($result); $i++) {
             $relevance = $result[$i]['relevance'];
             $query_article = "SELECT * FROM articles WHERE PID = '" . $result[$i]['PID'] . "' LIMIT 1";
             $article_result = $this->_db->databaseQuery($query_article);
             $articleProfile = new MyProfileArticle();
             $article = new Article();
             $article->setPID($article_result[0]['PID']);
             $article->setURL($article_result[0]['url']);
             $article->setTitle($article_result[0]['title']);
             $article->setSerial($article_result[0]['serial']);
             $article->setVolume($article_result[0]['volume']);
             $article->setNumber($article_result[0]['number']);
             $article->setSuppl($article_result[0]['suppl']);
             $article->setYear($article_result[0]['year']);
             $article->setAuthorXML($article_result[0]['authors_xml']);
             $article->setKeywordXML($article_result[0]['keywords_xml']);
             $article->setRelevance($relevance);
             $article->setPublicationDate($article_result[0]['publication_date']);
             array_push($articleProfileList[$profile_id], array($profile_name, $article));
             //die(var_dump($articleProfileList));
         }
     }
     //var_dump($articleProfileList);die;
     return $articleProfileList;
 }
开发者ID:Ethennoob,项目名称:Web,代码行数:51,代码来源:MyProfileArticleDAO.php

示例10: loadArticle

 /**
 * Carrega nos campos da classe os valores que estão armazenados no Banco de Dados
 * chamada pela getArticle para devolver o objeto artigo para a classe Article
 * @param integer $ID IDentificador do usuário
 * @returns integer $sucess 1 em caso de sucesso, 0 em caso de erro
 */
 function loadArticle($p)
 {
     $article = new Article();
     $article->setPID($p['PID']);
     $article->setTitle($p['title']);
     $article->setSerial($p['serial']);
     $article->setVolume($p['volume']);
     $article->setNumber($p['number']);
     $article->setSuppl($p['suppl']);
     $article->setYear($p['year']);
     $article->setUrl($p['url']);
     $article->setAuthorXML($p['authors_xml']);
     $article->setKeywordXML($p['keywords_xml']);
     return $article;
 }
开发者ID:robertatakenaka,项目名称:Proceedings,代码行数:21,代码来源:ArticleDAO.php

示例11: getArticleDetail

 public function getArticleDetail($id)
 {
     $sqlHelper = new SqlHelper();
     $article = new Article();
     $sql = "select * from lavender_article where id={$id}";
     $res = $sqlHelper->dql_arr($sql);
     $article->setId($res[0]['id']);
     $article->setPraise($res[0]['praise']);
     $article->setContent($res[0]['content']);
     $article->setDate($res[0]['date']);
     $article->setReadTime($res[0]['read_time']);
     $article->setImg($res[0]['img']);
     $article->setNoPraise($res[0]['no_praise']);
     $article->setTitle($res[0]['title']);
     return $article;
 }
开发者ID:justfu,项目名称:lavender,代码行数:16,代码来源:ArticleService.class.php

示例12: executeRandomArticle

 function executeRandomArticle()
 {
     $post = new Article();
     $arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
     for ($i = 0; $i < 6; $i = $i + 1) {
         $index = rand(0, Count($arr));
         $title = $title . $arr[$index];
     }
     $post->setTitle($title);
     for ($i = 0; $i < 30; $i = $i + 1) {
         $index = rand(0, Count($arr));
         $content = $content . $arr[$index];
     }
     $post->setContent($content);
     $post->save();
     $this->redirect('adminblog/index');
 }
开发者ID:rfeizi,项目名称:sample-codes,代码行数:17,代码来源:actions.class.php

示例13: testAction

 public function testAction()
 {
     $article = new Article();
     $article->setTitle("L'histoire d'un bon weekend !");
     $article->setContent("Le weekend était vraiment trop bien !");
     $article->setCreatedAt(new \DateTime('now', new \DateTimeZone('Europe/Paris')));
     $article->setEnabled(true);
     $em = $this->getDoctrine()->getManager();
     $user = $this->getUser();
     if ($user) {
         $article->setUser($user);
     }
     $em->persist($article);
     $em->flush();
     $url = $this->generateUrl('suplol_user_homepage');
     return $this->redirect($url);
 }
开发者ID:jean-lou,项目名称:techies,代码行数:17,代码来源:DefaultController.php

示例14: fromXML

 /**
  * Create an Article object from XML
  *
  * @param SimpleXMLElement $xml simpleXML element containing a single article XML
  *
  * @static
  *
  * @return phpOpenNOS\Model\Article
  */
 public static function fromXML(\SimpleXMLElement $xml)
 {
     $article = new Article();
     $article->setId((int) $xml->id);
     $article->setTitle((string) $xml->title);
     $article->setDescription((string) $xml->description);
     $article->setPublished((string) $xml->published);
     $article->setLastUpdate((string) $xml->last_update);
     $article->setThumbnailXS((string) $xml->thumbnail_xs);
     $article->setThumbnailS((string) $xml->thumbnail_s);
     $article->setThumbnailM((string) $xml->thumbnail_m);
     $article->setLink((string) $xml->link);
     $keywords = array();
     foreach ($xml->keywords->keyword as $keyword) {
         $keywords[] = (string) $keyword;
     }
     $article->setKeywords($keywords);
     return $article;
 }
开发者ID:ingewikkeld,项目名称:phpopennos,代码行数:28,代码来源:Article.php

示例15: oldgetArticles

 function oldgetArticles()
 {
     $tmp =& $this->domLiteDocument->getElementsByPath("/related/relatedlist/article");
     for ($i = 0; $i < $tmp->getLength(); $i++) {
         $item = $tmp->item($i);
         $article = new Article();
         $article->setPID($this->getNodeAttribute($item, 'pid'));
         $article->setURL($this->getURL($this->getNodeAttribute($item, 'source'), $this->getNodeAttribute($item, 'country'), $article->getPID()));
         $article->setTitle($this->getNodeXML($item, 'titles'));
         $article->setSerial($this->getNodeText($item, 'serial'));
         $article->setVolume($this->getNodeText($item, 'volume'));
         $article->setNumber($this->getNodeText($item, 'number'));
         $article->setSuppl($this->getNodeText($item, 'supplement'));
         $article->setYear($this->getNodeText($item, 'year'));
         $article->setAuthorXML($this->getNodeXML($item, 'authors'));
         $article->setKeywordXML($this->getNodeXML($item, 'keywords'));
         $articles[] = $article;
     }
     return $articles;
 }
开发者ID:robertatakenaka,项目名称:Proceedings,代码行数:20,代码来源:TrigramaServiceResult.php


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