本文整理汇总了PHP中kXml::setNodeValue方法的典型用法代码示例。如果您正苦于以下问题:PHP kXml::setNodeValue方法的具体用法?PHP kXml::setNodeValue怎么用?PHP kXml::setNodeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kXml
的用法示例。
在下文中一共展示了kXml::setNodeValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setNodeValueFieldConfigId
/**
* @param string $xpath
* @param string $fieldConfigId
*/
public function setNodeValueFieldConfigId($xpath, $fieldConfigId)
{
if (isset($this->_fieldValues[$fieldConfigId])) {
kXml::setNodeValue($this->_xpath, $xpath, $this->_fieldValues[$fieldConfigId]);
}
}
示例2: setItemsPerPage
public function setItemsPerPage($v)
{
kXml::setNodeValue($this->xpath, '/rss/channel/openSearch:itemsPerPage', $v);
}
示例3: setBackgroudImage
public function setBackgroudImage($widedBackgroundImageUrl = null, $standardBackgroundImageUrl = null)
{
if ($widedBackgroundImageUrl) {
kXml::setNodeValue($this->xpath, 'background_image/@wide', $widedBackgroundImageUrl);
}
if ($standardBackgroundImageUrl) {
kXml::setNodeValue($this->xpath, 'background_image/@standard', $standardBackgroundImageUrl);
}
}
示例4: setThumbAsset
/**
* @param array $thumbAssets
*/
public function setThumbAsset(DOMElement $item, array $thumbAssets)
{
/** @var $thumbAsset thumbAsset */
$thumbAsset = $thumbAssets[0];
$url = $this->getAssetUrl($thumbAsset);
kXml::setNodeValue($this->xpath, 'media:thumbnail/@url', $url, $item);
kXml::setNodeValue($this->xpath, 'media:thumbnail/@width', $thumbAsset->getWidth(), $item);
kXml::setNodeValue($this->xpath, 'media:thumbnail/@height', $thumbAsset->getHeight(), $item);
}
示例5: setThumbAssets
/**
* @param array $flavorAssets
*/
public function setThumbAssets(DOMElement $item, array $thumbAssets)
{
foreach ($thumbAssets as $thumbAsset) {
/* @var $flavorAsset flavorAsset */
$content = $this->thumbnail->cloneNode(true);
$mediaGroup = $this->xpath->query('media:group', $item)->item(0);
$mediaGroup->appendChild($content);
$url = $this->getAssetUrl($thumbAsset);
kXml::setNodeValue($this->xpath, '@url', $url, $content);
kXml::setNodeValue($this->xpath, '@width', $thumbAsset->getWidth(), $content);
kXml::setNodeValue($this->xpath, '@height', $thumbAsset->getHeight(), $content);
}
}
示例6: setItemIgnore
public function setItemIgnore()
{
$itemNode = $this->xpath->query('/msdp:rss/msdp:channel/msdp:item')->item(0);
kXml::setNodeValue($this->xpath, 'msdp:type', $this->getValueForField(KalturaMetroPcsDistributionField::ITEM_TYPE), $itemNode);
kXml::setNodeValue($this->xpath, '@ignore', "Y", $itemNode);
}
示例7: setOrRemoveNodeValueFieldConfigId
/**
* @param string $xpath
* @param string $fieldConfigId
*/
public function setOrRemoveNodeValueFieldConfigId($xpath, $fieldConfigId)
{
if (isset($this->_fieldValues[$fieldConfigId]) && $this->_fieldValues[$fieldConfigId]) {
kXml::setNodeValue($this->_xpath, $xpath, $this->_fieldValues[$fieldConfigId]);
} else {
$node = $this->_xpath->query($xpath)->item(0);
if ($node) {
$node->parentNode->removeChild($node);
}
}
}
示例8: setThumbAssetUrl
public function setThumbAssetUrl($item, $thumbnailUrl, $thumbnailCredit)
{
kXml::setNodeValue($this->xpath, 'media:thumbnail/@url', $thumbnailUrl, $item);
kXml::setNodeValue($this->xpath, 'media:thumbnail/@width', '320', $item);
kXml::setNodeValue($this->xpath, 'media:thumbnail/@height', '240', $item);
if (!empty($thumbnailCredit)) {
kXml::setNodeValue($this->xpath, 'media:thumbnail/@credit', $thumbnailCredit, $item);
}
}
示例9: getItem
/**
* @param array $values
*/
public function getItem(array $values, flavorAsset $flavorAsset = null, thumbAsset $thumbAsset = null, array $additionalAssets = null)
{
$item = $this->item->cloneNode(true);
$pubDate = date('c', $values[TVComDistributionField::ITEM_PUB_DATE]);
$expDate = date('c', $values[TVComDistributionField::ITEM_EXP_DATE]);
$node = kXml::setNodeValue($this->xpath, 'guid', $values[TVComDistributionField::GUID_ID], $item);
$node = kXml::setNodeValue($this->xpath, 'pubDate', $pubDate, $item);
$node = kXml::setNodeValue($this->xpath, 'expDate', $expDate, $item);
$node = kXml::setNodeValue($this->xpath, 'link', $values[TVComDistributionField::ITEM_LINK], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:title', $values[TVComDistributionField::MEDIA_TITLE], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:description', $values[TVComDistributionField::MEDIA_DESCRIPTION], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:keywords', $values[TVComDistributionField::MEDIA_KEYWORDS], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:copyright', $values[TVComDistributionField::MEDIA_COPYRIGHT], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:rating', $values[TVComDistributionField::MEDIA_RATING], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:restriction/@relationship', $values[TVComDistributionField::MEDIA_RESTRICTION_TYPE], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:restriction', $values[TVComDistributionField::MEDIA_RESTRICTION_COUNTRIES], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:show-tmsid\']', $values[TVComDistributionField::MEDIA_CATEGORY_SHOW_TMSID], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:show-tmsid\']/@label', $values[TVComDistributionField::MEDIA_CATEGORY_SHOW_TMSID_LABEL], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:episode-tmsid\']', $values[TVComDistributionField::MEDIA_CATEGORY_EPISODE_TMSID], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:episode-tmsid\']/@label', $values[TVComDistributionField::MEDIA_CATEGORY_EPISODE_TMSID_LABEL], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:episodetype\']', $values[TVComDistributionField::MEDIA_CATEGORY_EPISODE_TYPE], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:original_air_date\']', $values[TVComDistributionField::MEDIA_CATEGORY_ORIGINAL_AIR_DATE], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:video_format\']', $values[TVComDistributionField::MEDIA_CATEGORY_VIDEO_FORMAT], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:season_number\']', $values[TVComDistributionField::MEDIA_CATEGORY_SEASON_NUMBER], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:category[@scheme=\'urn:tvcom:episode_number\']', $values[TVComDistributionField::MEDIA_CATEGORY_EPISODE_NUMBER], $item);
$dcTerms = "start={$pubDate}; end={$expDate}; scheme=W3C-DTF";
$node = kXml::setNodeValue($this->xpath, 'dcterms:valid', $dcTerms, $item);
if ($flavorAsset) {
$node = kXml::setNodeValue($this->xpath, 'media:group/media:content/@url', $this->getAssetUrl($flavorAsset), $item);
$type = '';
switch ($flavorAsset->getFileExt()) {
case 'mp4':
$type = 'video/mp4';
break;
case 'flv':
$type = 'video/x-flv';
break;
}
$node = kXml::setNodeValue($this->xpath, 'media:group/media:content/@type', $type, $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:content/@fileSize', $flavorAsset->getSize(), $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:content/@expression', $values[TVComDistributionField::MEDIA_CATEGORY_EPISODE_TYPE], $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:content/@duration', floor($flavorAsset->getentry()->getDuration()), $item);
}
if ($thumbAsset) {
$node = kXml::setNodeValue($this->xpath, 'media:group/media:thumbnail/@url', $this->getAssetUrl($thumbAsset), $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:thumbnail/@width', $thumbAsset->getWidth(), $item);
$node = kXml::setNodeValue($this->xpath, 'media:group/media:thumbnail/@height', $thumbAsset->getHeight(), $item);
}
if (is_array($additionalAssets)) {
foreach ($additionalAssets as $additionalAsset) {
/* @var $additionalAsset asset */
$assetType = $additionalAsset->getType();
switch ($assetType) {
case CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION):
/* @var $captionPlugin CaptionPlugin */
$captionPlugin = KalturaPluginManager::getPluginInstance(CaptionPlugin::PLUGIN_NAME);
$dummyElement = new SimpleXMLElement('<dummy/>');
$captionPlugin->contributeCaptionAssets($additionalAsset, $dummyElement);
$dummyDom = dom_import_simplexml($dummyElement);
$captionDom = $dummyDom->getElementsByTagName('subTitle');
$captionDom = $this->doc->importNode($captionDom->item(0), true);
$captionDom = $item->appendChild($captionDom);
break;
case AttachmentPlugin::getAssetTypeCoreValue(AttachmentAssetType::ATTACHMENT):
/* @var $attachmentPlugin AttachmentPlugin */
$attachmentPlugin = KalturaPluginManager::getPluginInstance(AttachmentPlugin::PLUGIN_NAME);
$dummyElement = new SimpleXMLElement('<dummy/>');
$attachmentPlugin->contributeAttachmentAssets($additionalAsset, $dummyElement);
$dummyDom = dom_import_simplexml($dummyElement);
$attachmentDom = $dummyDom->getElementsByTagName('attachment');
$attachmentDom = $this->doc->importNode($attachmentDom->item(0), true);
$attachmentDom = $item->appendChild($attachmentDom);
break;
}
}
}
return $item;
}
示例10: getItem
/**
* @param array $values
*/
public function getItem(array $values, flavorAsset $flavorAsset = null, thumbAsset $thumbAsset = null)
{
$item = $this->item->cloneNode(true);
kXml::setNodeValue($this->xpath, 'guid', $values[AvnDistributionField::GUID], $item);
kXml::setNodeValue($this->xpath, 'pubDate', $values[AvnDistributionField::PUB_DATE], $item);
kXml::setNodeValue($this->xpath, 'title', $values[AvnDistributionField::TITLE], $item);
kXml::setNodeValue($this->xpath, 'description', $values[AvnDistributionField::DESCRIPTION], $item);
kXml::setNodeValue($this->xpath, 'link', $values[AvnDistributionField::LINK], $item);
kXml::setNodeValue($this->xpath, 'category', $values[AvnDistributionField::CATEGORY], $item);
kXml::setNodeValue($this->xpath, 'amg:passthru', $this->getPassthruJsonObj($values), $item);
if ($flavorAsset) {
$url = $this->getAssetUrl($flavorAsset);
$type = $this->getContentTypeFromUrl($url);
kXml::setNodeValue($this->xpath, 'media:content/@url', $url, $item);
kXml::setNodeValue($this->xpath, 'media:content/@type', $type, $item);
if ($values[AvnDistributionField::ORDER_SUB] == '1') {
kXml::setNodeValue($this->xpath, 'media:content/@isDefault', 'true', $item);
} else {
kXml::setNodeValue($this->xpath, 'media:content/@isDefault', 'false', $item);
}
}
if ($thumbAsset) {
kXml::setNodeValue($this->xpath, 'media:thumbnail/@url', $this->getAssetUrl($thumbAsset), $item);
}
return $item;
}
示例11: setReplaceAirDates
protected function setReplaceAirDates()
{
if ($this->_distributionProfile->replaceAirDates === false) {
kXml::setNodeValue($this->_xpath, '/FWCoreContainer/FWVideoDocument/fwReplaceAirDates', 'false');
} else {
kXml::setNodeValue($this->_xpath, '/FWCoreContainer/FWVideoDocument/fwReplaceAirDates', 'true');
}
}
示例12: getItem
/**
* @param array $values
* @param array $flavorAssets
* @param array $thumbAssets
*/
public function getItem(array $values, entry $entry, array $flavorAssets = null, array $thumbAssets = null, array $additionalAssets = null)
{
$item = $this->item->cloneNode(true);
kXml::setNodeValue($this->xpath, 'atom:title', $values[SynacorHboDistributionField::ENTRY_TITLE], $item);
kXml::setNodeValue($this->xpath, 'atom:summary', $values[SynacorHboDistributionField::ENTRY_SUMMARY], $item);
$updatedTime = $this->formatSynacorHboTime($values[SynacorHboDistributionField::ENTRY_UPDATED]);
kXml::setNodeValue($this->xpath, 'atom:updated', $updatedTime, $item);
kXml::setNodeValue($this->xpath, 'atom:author/atom:name', $values[SynacorHboDistributionField::ENTRY_AUTHOR_NAME], $item);
$categoryValue = $values[SynacorHboDistributionField::ENTRY_CATEGORY_TERM];
if (strlen($categoryValue) > 0) {
kXml::setNodeValue($this->xpath, 'atom:category/@term', $categoryValue, $item);
} else {
$this->removeNode('atom:category', $item);
}
$genreValue = $values[SynacorHboDistributionField::ENTRY_GENRE_TERM];
if (strlen($genreValue) > 0) {
kXml::setNodeValue($this->xpath, 'atom:genre/@term', $genreValue, $item);
} else {
$this->removeNode('atom:genre', $item);
}
kXml::setNodeValue($this->xpath, 'atom:assetType', $values[SynacorHboDistributionField::ENTRY_ASSET_TYPE], $item);
kXml::setNodeValue($this->xpath, 'atom:assetId', $values[SynacorHboDistributionField::ENTRY_ASSET_ID], $item);
$startTime = $this->formatSynacorHboTime($values[SynacorHboDistributionField::ENTRY_OFFERING_START]);
kXml::setNodeValue($this->xpath, 'atom:offering/atom:start', $startTime, $item);
$endTime = $this->formatSynacorHboTime($values[SynacorHboDistributionField::ENTRY_OFFERING_END]);
kXml::setNodeValue($this->xpath, 'atom:offering/atom:end', $endTime, $item);
$ratingValue = $values[SynacorHboDistributionField::ENTRY_RATING];
if (strlen($ratingValue) > 0) {
kXml::setNodeValue($this->xpath, 'atom:rating', $ratingValue, $item);
$ratingType = stripos($ratingValue, 'tv') === '0' ? 'tv' : 'theatrical';
kXml::setNodeValue($this->xpath, 'atom:rating/@type', $ratingType, $item);
} else {
$this->removeNode('atom:rating', $item);
}
$durationInSeconds = ceil($entry->getDuration());
$durationInMinuesRoundedUp = ceil($durationInSeconds / 60);
kXml::setNodeValue($this->xpath, 'atom:runtime', $durationInMinuesRoundedUp, $item);
kXml::setNodeValue($this->xpath, 'atom:runtime/@timeInSeconds', $durationInSeconds, $item);
kXml::setNodeValue($this->xpath, 'go:series/go:title', $values[SynacorHboDistributionField::ENTRY_SERIES_TITLE], $item);
kXml::setNodeValue($this->xpath, 'atom:brand', $values[SynacorHboDistributionField::ENTRY_BRAND], $item);
if (!is_null($flavorAssets) && is_array($flavorAssets) && count($flavorAssets) > 0) {
$flavorAsset = $flavorAssets[0];
/* @var $flavorAsset flavorAsset */
$flavorUrl = $this->getAssetUrl($flavorAsset);
// we don't have a way to identify the mime type of the file
// as there is no guarantee that the file exists in the current data center
// so we will just use those hardcoded conditions
$mimeType = '';
switch ($flavorAsset->getFileExt()) {
case 'flv':
$mimeType = 'video/x-flv';
break;
case 'mp4':
$mimeType = 'video/mp4';
break;
case 'mpeg':
case 'mpg':
$mimeType = 'video/mpeg';
break;
default:
$mimeType = 'video/x-flv';
// default requested by synacor
}
kXml::setNodeValue($this->xpath, 'atom:link[@type=\'VIDEO_MIME_TYPE\']/@href', $flavorUrl, $item);
kXml::setNodeValue($this->xpath, 'atom:link[@type=\'VIDEO_MIME_TYPE\']/@type', $mimeType, $item);
}
if (!is_null($thumbAssets) && is_array($thumbAssets) && count($thumbAssets) > 0) {
$thumbAsset = $thumbAssets[0];
/* @var $thumbAssets thumbAssets */
$thumbUrl = $this->getAssetUrl($thumbAsset);
kXml::setNodeValue($this->xpath, 'atom:link[@type=\'image/jpeg\']/@href', $thumbUrl, $item);
}
if (is_array($additionalAssets)) {
foreach ($additionalAssets as $additionalAsset) {
/* @var $additionalAsset asset */
$assetType = $additionalAsset->getType();
switch ($assetType) {
case CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION):
/* @var $captionPlugin CaptionPlugin */
$captionPlugin = KalturaPluginManager::getPluginInstance(CaptionPlugin::PLUGIN_NAME);
$dummyElement = new SimpleXMLElement('<dummy/>');
$captionPlugin->contributeCaptionAssets($additionalAsset, $dummyElement);
$dummyDom = dom_import_simplexml($dummyElement);
$captionDom = $dummyDom->getElementsByTagName('subTitle');
$captionDom = $this->doc->importNode($captionDom->item(0), true);
$captionDom = $item->appendChild($captionDom);
break;
case AttachmentPlugin::getAssetTypeCoreValue(AttachmentAssetType::ATTACHMENT):
/* @var $attachmentPlugin AttachmentPlugin */
$attachmentPlugin = KalturaPluginManager::getPluginInstance(AttachmentPlugin::PLUGIN_NAME);
$dummyElement = new SimpleXMLElement('<dummy/>');
$attachmentPlugin->contributeAttachmentAssets($additionalAsset, $dummyElement);
$dummyDom = dom_import_simplexml($dummyElement);
$attachmentDom = $dummyDom->getElementsByTagName('attachment');
$attachmentDom = $this->doc->importNode($attachmentDom->item(0), true);
//.........这里部分代码省略.........
示例13: setThumbAsset
/**
* @param DOMElement $item
* @param array $thumbAssets
* @param array $remoteThumbailFileUrls
*/
public function setThumbAsset($item, array $thumbAssets, $remoteThumbailFileUrls)
{
$node = $this->xpath->query('thumbnail', $item)->item(0);
if (count($thumbAssets)) {
foreach ($thumbAssets as $thumbAsset) {
/* @var $thumbAsset thumbAsset */
$thumbAssetId = $thumbAsset->getId();
$url = '';
if (!is_null($remoteThumbailFileUrls)) {
$url = $remoteThumbailFileUrls[$thumbAssetId];
}
$thumbnailNode = $this->thumbnail->cloneNode(true);
$item->insertBefore($thumbnailNode, $node);
kXml::setNodeValue($this->xpath, '@url', $url, $thumbnailNode);
kXml::setNodeValue($this->xpath, '@height', $thumbAsset->getHeight(), $thumbnailNode);
kXml::setNodeValue($this->xpath, '@width', $thumbAsset->getWidth(), $thumbnailNode);
}
}
$node->parentNode->removeChild($node);
}
示例14: setMovieTmsId
public function setMovieTmsId($value)
{
kXml::setNodeValue($this->xpath, '/rss/channel/item/yt:movie_metadata/yt:tms_id', $value);
}
示例15: setThumbnailsPath
public function setThumbnailsPath($smallThumbPath, $largeThumbPath)
{
kXml::setNodeValue($this->xpath, "/CMSFEED/FEEDITEM/IMAGE[@USE='SMALLTHUMB']", $smallThumbPath);
kXml::setNodeValue($this->xpath, "/CMSFEED/FEEDITEM/IMAGE[@USE='LARGETHUMB']", $largeThumbPath);
}