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


PHP Zend_Feed_Writer类代码示例

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


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

示例1: googleproductsAction

 /**
  * Export the products by the Google Product Atom Export
  * @author Shine Software
  * @return xml 
  */
 public function googleproductsAction()
 {
     // Calling Google Product Extension
     Zend_Feed_Writer::addPrefixPath('Shineisp_Feed_Writer_Extension_', 'Shineisp/Feed/Writer/Extension/');
     Zend_Feed_Writer::registerExtension('Google');
     $isp = Shineisp_Registry::get('ISP');
     $feed = new Zend_Feed_Writer_Feed();
     $feed->setTitle($isp->company);
     $feed->setLink($isp->website);
     $feed->setFeedLink($isp->website . '/atom/products', 'atom');
     $feed->addAuthor(array('name' => $isp->manager, 'email' => $isp->email, 'uri' => $isp->website));
     $feed->setDateModified(time());
     $feed->setGenerator("ShineISP Atom Extension");
     $products = Products::getAllRss();
     // 		print_r($products);
     // 		die;
     foreach ($products as $product) {
         // Get the google categories
         $categories = ProductsCategories::getGoogleCategories($product['categories']);
         $cattype = Products::get_text_categories($product['categories']);
         // Create the product entries
         $entry = $feed->createEntry();
         $entry->setTitle($product['ProductsData'][0]['name']);
         $entry->setProductType(Products::get_text_categories($product['categories']));
         $entry->setBrand($isp->company);
         $entry->setAvailability(true);
         $entry->setLink($isp->website . "/" . $product['uri'] . ".html");
         // Custom Attributes Google Product Extension
         if (!empty($product['ProductsMedia'][0]['path'])) {
             $entry->setImageLink($isp->website . str_replace(" ", "%20", $product['ProductsMedia'][0]['path']));
         }
         if (!empty($product['uri'])) {
             $entry->setProductId($product['uri']);
         }
         if (!empty($categories[0]['googlecategs'])) {
             $entry->setCategory($categories[0]['googlecategs']);
         }
         $price = Products::getPriceSuggested($product['product_id'], true);
         $entry->setPrice($price);
         $entry->setCondition('new');
         $entry->setDateModified(time());
         $entry->setDescription(strip_tags($product['ProductsData'][0]['shortdescription']));
         $feed->addEntry($entry);
     }
     $feed = $feed->export('atom');
     // Feed Fixing for google products
     $feed = $this->googlefixes($feed);
     Shineisp_Commons_Utilities::writefile($feed, "documents", "googleproducts.xml");
     die($feed);
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:55,代码来源:AtomController.php

示例2: _loadExtensions

 /**
  * Load extensions from Zend_Feed_Writer
  *
  * @return void
  */
 protected function _loadExtensions()
 {
     $all = Zend_Feed_Writer::getExtensions();
     $exts = $all['feed'];
     foreach ($exts as $ext) {
         $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext);
         $this->_extensions[$ext] = new $className();
         $this->_extensions[$ext]->setEncoding($this->getEncoding());
     }
 }
开发者ID:sepano,项目名称:open-social-media-monitoring,代码行数:15,代码来源:FeedAbstract.php

示例3: __call

 /**
  * Overloading to itunes specific setters
  *
  * @param  string $method
  * @param  array $params
  * @return mixed
  */
 public function __call($method, array $params)
 {
     $point = Zend_Feed_Writer::lcfirst(substr($method, 9));
     if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point))) {
         #require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php';
         throw new Zend_Feed_Writer_Exception_InvalidMethodException('invalid method: ' . $method);
     }
     if (!array_key_exists($point, $this->_data) || empty($this->_data[$point])) {
         return null;
     }
     return $this->_data[$point];
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:19,代码来源:Entry.php

示例4: _loadExtensions

 /**
  * Load extensions from Zend_Feed_Writer
  *
  * @return void
  */
 protected function _loadExtensions()
 {
     Zend_Feed_Writer::registerCoreExtensions();
     $all = Zend_Feed_Writer::getExtensions();
     if (stripos(get_class($this), 'entry')) {
         $exts = $all['entryRenderer'];
     } else {
         $exts = $all['feedRenderer'];
     }
     foreach ($exts as $extension) {
         $className = Zend_Feed_Writer::getPluginLoader()->getClassName($extension);
         $this->_extensions[$extension] = new $className($this->getDataContainer());
         $this->_extensions[$extension]->setEncoding($this->getEncoding());
     }
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:20,代码来源:RendererAbstract.php

示例5: testAddsAndOrdersEntriesByDateIfRequested

 public function testAddsAndOrdersEntriesByDateIfRequested()
 {
     $writer = new Zend_Feed_Writer();
     $entry = $writer->createEntry();
     $entry->setDateCreated(1234567890);
     $entry2 = $writer->createEntry();
     $entry2->setDateCreated(1230000000);
     $writer->addEntry($entry);
     $writer->addEntry($entry2);
     $writer->orderByDate();
     $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Zend_Date::TIMESTAMP));
 }
开发者ID:padraic,项目名称:zfproposals,代码行数:12,代码来源:WriterTest.php

示例6: reset

 /**
  * Reset class state to defaults
  *
  * @return void
  */
 public static function reset()
 {
     self::$_pluginLoader = null;
     self::$_prefixPaths = array();
     self::$_extensions = array('entry' => array(), 'feed' => array(), 'entryRenderer' => array(), 'feedRenderer' => array());
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:11,代码来源:Writer.php


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