本文整理汇总了PHP中eZURL::create方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURL::create方法的具体用法?PHP eZURL::create怎么用?PHP eZURL::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURL
的用法示例。
在下文中一共展示了eZURL::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFetchByUrl
/**
* @group ezurl
*/
public function testFetchByUrl()
{
$url = 'http://ez.no/ezpublish';
$urlObj = eZURL::create($url);
$urlObj->store();
$urlObj2 = eZURL::fetchByUrl($url);
self::assertInstanceOf('eZURL', $urlObj2);
}
示例2: registerURLArray
static function registerURLArray( $urlArray )
{
$db = eZDB::instance();
foreach( $urlArray as $key => $url )
{
$urlArrayTmp[$key] = $db->escapeString( $url );
}
// Fetch the already existing URL's
$inURLSQL = implode( '\', \'', $urlArrayTmp );
$checkURLQuery = "SELECT id, url FROM ezurl WHERE url IN ( '$inURLSQL' )";
$urlRowArray = $db->arrayQuery( $checkURLQuery );
$registeredURLArray = array();
foreach ( $urlRowArray as $urlRow )
{
$registeredURLArray[$urlRow['url']] = $urlRow['id'];
}
// Check for URL's which are not registered, and register them
foreach ( $urlArray as $url )
{
if ( !isset( $registeredURLArray[$url] ) )
{
$url = eZURL::create( $url );
$url->store();
$urlID = $url->attribute( 'id' );
$urlText = $url->attribute('url' );
$registeredURLArray[$urlText] = $urlID;
}
}
return $registeredURLArray;
}
示例3: unserializeContentObjectAttribute
function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
{
/* For all links found in the XML, do the following:
* Search for url specified in 'href' link attribute (in ezurl table).
* If the url not found then create a new one.
* Then associate the found (or created) URL with the object attribute by creating new url-object link.
* After that, remove "href" attribute, add new "id" attribute.
* This new 'id' will always refer to the existing url object.
*/
$linkNodes = $attributeNode->getElementsByTagName('link');
foreach ($linkNodes as $linkNode) {
$href = $linkNode->getAttribute('href');
if (!$href) {
continue;
}
$urlObj = eZURL::urlByURL($href);
if (!$urlObj) {
$urlObj = eZURL::create($href);
$urlObj->store();
}
$linkNode->removeAttribute('href');
$linkNode->setAttribute('url_id', $urlObj->attribute('id'));
$urlObjectLink = eZURLObjectLink::create($urlObj->attribute('id'), $objectAttribute->attribute('id'), $objectAttribute->attribute('version'));
$urlObjectLink->store();
}
foreach ($attributeNode->childNodes as $childNode) {
if ($childNode->nodeType == XML_ELEMENT_NODE) {
$xmlString = $childNode->ownerDocument->saveXML($childNode);
$objectAttribute->setAttribute('data_text', $xmlString);
break;
}
}
}