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


PHP Zend_Gdata_App_Extension_Element类代码示例

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


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

示例1: takeChildFromDOM

 protected function takeChildFromDOM($child)
 {
     if ($child->nodeType == XML_TEXT_NODE) {
         $this->_text = $child->nodeValue;
     } else {
         $extensionElement = new Zend_Gdata_App_Extension_Element();
         $extensionElement->transferFromDOM($child);
         $this->_extensionElements[] = $extensionElement;
     }
 }
开发者ID:hackingman,项目名称:TubeX,代码行数:10,代码来源:Base.php

示例2: _insert

 private function _insert($productId, &$params)
 {
     $dryRun = Axis::config()->gbase->main->dryRun;
     $tableLanguage = Axis::single('locale/language');
     $currentLanguage = $tableLanguage->find($params['language'])->current();
     /* Get local product data */
     $tableProduct = Axis::single('catalog/product');
     $tableManufacture = Axis::single('catalog/product_manufacturer');
     $currencyModel = Axis::single('locale/currency');
     $zendCurrency = $currencyModel->getCurrency($params['currency']);
     $rate = $currencyModel->getData($params['currency'], 'rate');
     $currencyOptions = array('position' => Zend_Currency::RIGHT, 'display' => Zend_Currency::USE_SHORTNAME);
     $product = $tableProduct->find($productId)->current();
     $productUrl = $product->getHumanUrl();
     $productDescription = $product->getDescription($params['language']);
     if ($product->manufacturer_id != '0') {
         $productManufacture = $tableManufacture->find($product->manufacturer_id)->current();
     }
     $productCategories = $product->getCategories($params['language']);
     $entry = $this->_service->newItemEntry();
     /* Atom namespace */
     $entry->title = $this->_service->newTitle(trim($productDescription['name']));
     $content = $productDescription['description'] == '' ? Axis::translate('catalog')->__('No description available') : trim($productDescription['description']);
     $entry->content = $this->_service->newContent($content);
     $entry->content->type = 'text';
     $entry->itemType = Axis::config()->gbase->main->itemType;
     if (Axis::config()->gbase->main->link == 'Website' && ($siteUrl = $this->_getSiteUrl($params['site']))) {
         $link = new Zend_Gdata_App_Extension_Link();
         $link->setHref(preg_replace('/\\s+/', '%20', trim($siteUrl . '/' . $this->view->catalogUrl . '/' . $productUrl)));
         $link->setRel('alternate');
         $link->setType('text/html');
         $link->setTitle(trim($productDescription['name']));
         $linkArray[] = $link;
         $entry->setLink($linkArray);
     } else {
         $entry->addGbaseAttribute('payment_accepted', 'Google Checkout', 'text');
     }
     /* G namespace */
     //$price = $zendCurrency->toCurrency($product->price * $rate, $currencyOptions);
     $price = $product->price * $rate;
     $entry->addGbaseAttribute('price', $price, 'floatUnit');
     $entry->addGbaseAttribute('condition', 'new', 'text');
     $entry->addGbaseAttribute('id', $product->sku . '_' . $params['country'], 'text');
     $entry->addGbaseAttribute('quantity', (int) $product->quantity, 'int');
     $entry->addGbaseAttribute('weight', "{$product->weight} lbs", 'numberUnit');
     //@TODO get weight unit
     if ($productManufacture) {
         $entry->addGbaseAttribute('brand', $productManufacture->name, 'text');
     }
     $entry->addGbaseAttribute('target_country', $params['country'], 'text');
     $entry->addGbaseAttribute('item_language', $currentLanguage->code, 'text');
     if ($siteUrl) {
         $entry->addGbaseAttribute('image_link', preg_replace('/\\s+/', '%20', trim($siteUrl . '/media' . '/product' . $product->image_base)), 'url');
     }
     foreach ($productCategories as $category) {
         $entry->addGbaseAttribute('product_type', $category['name'], 'text');
     }
     foreach (Axis::config()->gbase->main->payment as $payment) {
         if ($payment != '') {
             $entry->addGbaseAttribute('payment', $payment, 'text');
         }
     }
     if (Axis::config()->gbase->main->notes != '') {
         $entry->addGbaseAttribute('payment_notes', Axis::config()->gbase->main->notes, 'text');
     }
     if (Axis::config()->gbase->main->application != '') {
         $entry->addGbaseAttribute('application', Axis::config()->gbase->main->application, 'text');
     }
     $attributes = $this->_getProductAttributes($product, $params['language']);
     foreach ($attributes as $attr_id => $attribute) {
         $attrName = $attribute['optionName'];
         $attrValue = isset($attribute['valueName']) ? $attribute['valueName'] : $attribute['values'];
         $entry->addGbaseAttribute(preg_replace('/\\s+/', '_', $attrName), $attrValue, 'text');
     }
     /* Private attributes */
     $entry->addGbaseAttribute('site', $params['site'], 'int');
     $array = $entry->getExtensionElements();
     $privateAttr = array();
     $privateAttr[0]['name'] = 'access';
     $privateAttr[0]['value'] = 'private';
     $privateAttr[1]['name'] = 'type';
     $privateAttr[1]['value'] = 'int';
     $localId = new Zend_Gdata_App_Extension_Element('local_id', 'g', 'http://base.google.com/ns/1.0', $product->id);
     $localId->setExtensionAttributes($privateAttr);
     $array[count($array)] = $localId;
     $entry->setExtensionElements($array);
     Axis::session('gbase')->last_exported = $productId;
     Axis::session('gbase')->processed_count++;
     try {
         $this->_service->insertGbaseItem($entry, $dryRun);
         Axis::session('gbase')->imported_count++;
     } catch (Exception $e) {
         Axis::message()->addError($this->view->escape($e->getMessage()));
         try {
             $log = new Zend_Log(new Zend_Log_Writer_Stream(Axis::config()->system->path . '/var/logs/gbase.log'));
             $log->err($e->getMessage());
         } catch (Exception $e) {
             Axis::message()->addError($e->getMessage());
         }
     }
//.........这里部分代码省略.........
开发者ID:rommmka,项目名称:axiscommerce,代码行数:101,代码来源:IndexController.php

示例3: _addBatchProperties

 /**
  * Helper method for batch requests
  *
  */
 private function _addBatchProperties($entry, $id, $operation)
 {
     $extElementId1 = new Zend_Gdata_App_Extension_Element('id', 'batch', 'http://schemas.google.com/gdata/batch', $id);
     $extElementOp1 = new Zend_Gdata_App_Extension_Element('operation', 'batch', 'http://schemas.google.com/gdata/batch');
     $extElementOp1->setExtensionAttributes(array(array('namespaceUri' => 'http://schemas.google.com/gdata/batch', 'name' => 'type', 'value' => $operation)));
     $entry->setExtensionElements(array($extElementId1, $extElementOp1));
     return $entry;
 }
开发者ID:GEANT,项目名称:CORE,代码行数:12,代码来源:GoogleEvent.php

示例4: fetch_youtube_uploadform

 public function fetch_youtube_uploadform($yt, $videotitle, $videodescription)
 {
     global $CFG, $USER;
     // create a new VideoEntry object
     $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
     $myVideoEntry->setVideoTitle($videotitle);
     $myVideoEntry->setVideoDescription($videodescription);
     // The category must be a valid YouTube category!
     $myVideoEntry->setVideoCategory('Education');
     //This sets videos private, but then can't view if not logged in as the account owner
     //$myVideoEntry->setVideoPrivate();
     //So instead we set them to unlisted(but its more complex)
     $unlisted = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
     $unlisted->setExtensionAttributes(array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied')));
     $myVideoEntry->setExtensionElements(array($unlisted));
     // Set keywords. This must be a comma-separated string
     // Individual keywords cannot contain whitespace
     // We are not doing this, but it would be possible
     //$myVideoEntry->SetVideoTags('cars, funny');
     //data is all set, so we get our upload token from google
     $tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
     $tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
     $tokenValue = $tokenArray['token'];
     $postUrl = $tokenArray['url'];
     //Set the URL YouTube should redirect user to after upload
     //that will be the same iframe
     $nextUrl = $CFG->httpswwwroot . '/mod/assign/submission/youtube/uploader.php';
     // Now that we have the token, we build the form
     $form = '<form action="' . $postUrl . '?nexturl=' . $nextUrl . '" method="post" enctype="multipart/form-data">' . '<input name="file" type="file"/>' . '<input name="token" type="hidden" value="' . $tokenValue . '"/>' . '<input value="Upload Video File" type="submit" onclick="document.getElementById(\'id_uploadanim\').style.display=\'block\';" />' . '</form>';
     // We tag on a hidden uploading icon. YouTube gives us no progress events, sigh.
     // So its the best we can do to show an animated gif.
     // But if it fails, user will wait forever.
     $form .= '<img id="id_uploadanim" style="display: none;margin-left: auto;margin-right: auto;" src="' . $CFG->httpswwwroot . '/mod/assign/submission/youtube/pix/uploading.gif"/>';
     return $form;
 }
开发者ID:upegh,项目名称:youtube,代码行数:35,代码来源:locallib.php

示例5: displayYouTubeUploadFilePage

 /**
  * displayYouTubeUploadFilePage 
  * 
  * Takes the post data from the previous form, sends to youtube, creates new entry,
  * and prints the video file upload form.
  * 
  * @return void
  */
 function displayYouTubeUploadFilePage()
 {
     $this->displayHeader();
     $videoTitle = '';
     $videoDescription = '';
     if (isset($_POST['title'])) {
         $videoTitle = strip_tags($_POST['title']);
     }
     if (isset($_POST['description'])) {
         $videoDescription = strip_tags($_POST['description']);
     }
     $videoCategory = isset($_POST['category']) ? $_POST['category'] : '';
     $videoUnlisted = isset($_POST['unlisted']) ? true : false;
     // Create fcms video - we update after the youtube video is created
     $sql = "INSERT INTO `fcms_video` (\n                    `source_id`, \n                    `title`, \n                    `description`, \n                    `source`, \n                    `created`, \n                    `created_id`, \n                    `updated`, \n                    `updated_id`\n                )\n                VALUES\n                    ('0', ?, ?, 'youtube', NOW(), ?, NOW(), ?)";
     $params = array($videoTitle, $videoDescription, $this->fcmsUser->id, $this->fcmsUser->id);
     $lastId = $this->fcmsDatabase->insert($sql, $params);
     if ($lastId === false) {
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     // Save fcms video id
     $_SESSION['fcmsVideoId'] = $lastId;
     $sessionToken = $this->getSessionToken($this->fcmsUser->id);
     $youtubeConfig = getYouTubeConfigData();
     $httpClient = getYouTubeAuthSubHttpClient($youtubeConfig['youtube_key'], $sessionToken);
     if ($httpClient === false) {
         // Error message was already displayed by getYouTubeAuthSubHttpClient()
         $this->displayFooter();
         die;
     }
     $youTubeService = new Zend_Gdata_YouTube($httpClient);
     $newVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
     $newVideoEntry->setVideoTitle($videoTitle);
     $newVideoEntry->setVideoDescription($videoDescription);
     $newVideoEntry->setVideoCategory($videoCategory);
     // make video unlisted
     if ($videoUnlisted) {
         $unlisted = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
         $unlisted->setExtensionAttributes(array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied')));
         $newVideoEntry->setExtensionElements(array($unlisted));
     }
     try {
         $tokenArray = $youTubeService->getFormUploadToken($newVideoEntry, 'http://gdata.youtube.com/action/GetUploadToken');
     } catch (Exception $e) {
         echo '
         <div class="error-alert">
             <p>' . T('Could not retrieve token for syndicated upload.') . '</p>
             <p>' . $e->getMessage() . '</p>
         </div>';
         $this->displayFooter();
         return;
     }
     $tokenValue = $tokenArray['token'];
     $postUrl = $tokenArray['url'];
     $nextUrl = getDomainAndDir() . 'video.php?upload=youtube';
     echo '
     <form action="' . $postUrl . '?nexturl=' . $nextUrl . '" method="post" enctype="multipart/form-data">
         <fieldset>
             <legend><span>' . T_('Upload YouTube Video') . '</span></legend>
             <div class="field-row">
                 <div class="field-label"><label><b>' . T_('Title') . '</b></label></div>
                 <div class="field-widget"><b>' . $videoTitle . '</b></div>
             </div>
             <div class="field-row">
                 <div class="field-label"><label><b>' . T_('Video') . '</b></label></div>
                 <div class="field-widget">
                     <input type="file" name="file" size="50"/>
                 </div>
             </div>
             <input name="token" type="hidden" value="' . $tokenValue . '"/>
             <input class="sub1" type="submit" id="upload_file" name="upload_file" value="' . T_('Upload') . '"/>
         </fieldset>
     </form>';
     $this->displayFooter();
 }
开发者ID:sauravpratihar,项目名称:fcms,代码行数:85,代码来源:video.php

示例6: takeChildFromDOM

 /**
  * Given a child DOMNode, tries to determine how to map the data into
  * object instance members.  If no mapping is defined, Extension_Element
  * objects are created and stored in an array.
  *
  * @param DOMNode $child The DOMNode needed to be handled
  */
 protected function takeChildFromDOM($child)
 {
     if ($child->nodeType == XML_ELEMENT_NODE) {
         $this->_shippingInfo[$child->localName] = $child->textContent;
     }
     parent::takeChildFromDOM($child);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:14,代码来源:Shipping.php

示例7: takeChildFromDOM

 /**
  * Given a child DOMNode, tries to determine how to map the data into
  * object instance members.  If no mapping is defined, Extension_Element
  * objects are created and stored in an array.
  *
  * @param DOMNode $child The DOMNode needed to be handled
  */
 protected function takeChildFromDOM($child)
 {
     if ($child->nodeType == XML_ELEMENT_NODE) {
         $name = 'attribute' == $child->localName ? $child->getAttribute('name') : $child->localName;
         $this->_taxInfo[$name] = $child->textContent;
     }
     parent::takeChildFromDOM($child);
 }
开发者ID:relue,项目名称:magento2,代码行数:15,代码来源:Tax.php

示例8: __construct

 /**
  * Create a new instance.
  *
  * @param string $name (optional) The name of the Base attribute
  * @param string $text (optional) The text value of the Base attribute
  * @param string $text (optional) The type of the Base attribute
  */
 public function __construct($name = null, $text = null, $type = null)
 {
     $this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces);
     if ($type !== null) {
         $attr = array('name' => 'type', 'value' => $type);
         $typeAttr = array('type' => $attr);
         $this->setExtensionAttributes($typeAttr);
     }
     parent::__construct($name, $this->_rootNamespace, $this->lookupNamespace($this->_rootNamespace), $text);
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:17,代码来源:BaseAttribute.php


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