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


PHP eZURL::urlByURL方法代码示例

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


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

示例1: validateUniqueURLHTTPInput

 /**
  * This method validates unique URL.
  *
  * @param string $data
  * @param object $contentObjectAttribute
  * @return boolean
  */
 public static function validateUniqueURLHTTPInput($data, $contentObjectAttribute)
 {
     $ini = eZINI::instance('uniquedatatypes.ini');
     $uniqueURLINI = $ini->group('UniqueURLSettings');
     if (count($uniqueURLINI['AllowedSchemaList'])) {
         if (!eregi("^(" . implode('|', $uniqueURLINI['AllowedSchemaList']) . ")", $data)) {
             $contentObjectAttribute->setValidationError(ezpI18n::tr('extension/ezuniquedatatypes', 'Only URLs beginning with  "%schemas" are accepted!', '', array('%schemas' => implode('", "', $uniqueURLINI['AllowedSchemaList']))));
             return eZInputValidator::STATE_INVALID;
         }
     }
     $url = eZURL::urlByURL($data);
     if (is_object($url)) {
         $contentObjectID = $contentObjectAttribute->ContentObjectID;
         $contentClassAttributeID = $contentObjectAttribute->ContentClassAttributeID;
         $db = eZDB::instance();
         if ($uniqueURLINI['CurrentVersionOnly'] == 'true') {
             $query = "SELECT COUNT(*) AS row_counter\n\t\t\t\t\tFROM ezcontentobject co, ezcontentobject_attribute coa\n\t\t\t\t\tWHERE co.id = coa.contentobject_id\n\t\t\t\t\tAND co.current_version = coa.version\n\t\t\t\t\tAND coa.contentclassattribute_id = " . $db->escapeString($contentClassAttributeID) . "\n\t\t\t\t\tAND coa.contentobject_id <> " . $db->escapeString($contentObjectID) . "\n                    AND coa.data_int = " . $db->escapeString($url->ID);
         } else {
             $query = "SELECT COUNT(*) AS row_counter\n\t\t\t\t\tFROM ezcontentobject_attribute coa\n\t\t\t\t\tWHERE coa.contentclassattribute_id = " . $db->escapeString($contentClassAttributeID) . "\n\t\t\t\t\tAND coa.contentobject_id <> " . $db->escapeString($contentObjectID) . "\n                    AND coa.data_int = " . $db->escapeString($url->ID);
         }
         if (self::EZUNIQUEURL_DEBUG) {
             eZDebug::writeDebug('Query: ' . $query, 'eZUniqueURLType::validateUniqueURLHTTPInput');
         }
         $rows = $db->arrayQuery($query);
         $rowCount = (int) $rows[0]['row_counter'];
         if ($rowCount >= 1) {
             $contentObjectAttribute->setValidationError(ezpI18n::tr('extension/ezuniquedatatypes', 'Given URL already exists in another content object of this type!'));
             return eZInputValidator::STATE_INVALID;
         }
     }
     return eZInputValidator::STATE_ACCEPTED;
 }
开发者ID:Opencontent,项目名称:ezuniquedatatypes,代码行数:39,代码来源:ezuniqueurltype.php

示例2: 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;
         }
     }
 }
开发者ID:nlescure,项目名称:ezpublish,代码行数:33,代码来源:ezxmltexttype.php


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