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


PHP eZURL::registerURL方法代码示例

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


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

示例1: publishHandlerObject

 function publishHandlerObject($element, &$params)
 {
     $ret = null;
     $objectID = $element->getAttribute('id');
     // protection from self-embedding
     if ($objectID == $this->contentObjectID) {
         $this->isInputValid = false;
         $this->Messages[] = ezpI18n::tr('kernel/classes/datatypes', 'Object %1 can not be embeded to itself.', false, array($objectID));
         return $ret;
     }
     if (!in_array($objectID, $this->relatedObjectIDArray)) {
         $this->relatedObjectIDArray[] = $objectID;
     }
     // If there are any image object with links.
     $href = $element->getAttributeNS($this->Namespaces['image'], 'ezurl_href');
     //washing href. single and double quotes inside url replaced with their urlencoded form
     $href = str_replace(array('\'', '"'), array('%27', '%22'), $href);
     $urlID = $element->getAttributeNS($this->Namespaces['image'], 'ezurl_id');
     if ($href != null) {
         $urlID = eZURL::registerURL($href);
         $element->setAttributeNS($this->Namespaces['image'], 'image:ezurl_id', $urlID);
         $element->removeAttributeNS($this->Namespaces['image'], 'ezurl_href');
     }
     if ($urlID != null) {
         $this->urlIDArray[] = $urlID;
     }
     $this->convertCustomAttributes($element);
     return $ret;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:29,代码来源:ezsimplifiedxmlinputparser.php

示例2: modify


//.........这里部分代码省略.........
                         } else {
                             if ($checkExistence) {
                                 $operatorValue = false;
                                 return;
                             }
                             $tpl->error($operatorName, "Unknown get variable '{$httpName}'");
                         }
                         break;
                     case eZURLOperator::HTTP_OPERATOR_TYPE_SESSION:
                         if ($http->hasSessionVariable($httpName)) {
                             $operatorValue = !$checkExistence ? $http->sessionVariable($httpName) : true;
                         } else {
                             if ($checkExistence) {
                                 $operatorValue = false;
                                 return;
                             }
                             $tpl->error($operatorName, "Unknown session variable '{$httpName}'");
                         }
                         break;
                     case eZURLOperator::HTTP_OPERATOR_TYPE_COOKIE:
                         if (array_key_exists($httpName, $_COOKIE)) {
                             $operatorValue = !$checkExistence ? $_COOKIE[$httpName] : true;
                         } else {
                             if ($checkExistence) {
                                 $operatorValue = false;
                                 return;
                             }
                             $tpl->error($operatorName, "Unknown cookie variable '{$httpName}'");
                         }
                         break;
                 }
             } else {
                 $operatorValue = $http;
             }
             return;
             break;
         case $this->URLName:
             eZURI::transformURI($operatorValue, false, $namedParameters['server_url']);
             break;
         case $this->URLRootName:
             if (preg_match("#^[a-zA-Z0-9]+:#", $operatorValue) or substr($operatorValue, 0, 2) == '//') {
                 break;
             }
             if (strlen($operatorValue) > 0 and $operatorValue[0] != '/') {
                 $operatorValue = '/' . $operatorValue;
             }
             // Same as "ezurl" without "index.php" and the siteaccess name in the returned address.
             eZURI::transformURI($operatorValue, true, $namedParameters['server_url']);
             break;
         case $this->SysName:
             if (count($operatorParameters) == 0) {
                 $tpl->warning('eZURLOperator' . $operatorName, 'Requires attributename');
             } else {
                 $sysAttribute = $tpl->elementValue($operatorParameters[0], $rootNamespace, $currentNamespace);
                 if (!$this->Sys->hasAttribute($sysAttribute)) {
                     $tpl->warning('eZURLOperator' . $operatorName, "No such attribute '{$sysAttribute}' for eZSys");
                 } else {
                     $operatorValue = $this->Sys->attribute($sysAttribute);
                 }
             }
             return;
             break;
         case $this->ImageName:
             if (count($operatorParameters) == 2 && $tpl->elementValue($operatorParameters[1], $rootNamespace, $currentNamespace) == true && strlen($this->Sys->wwwDir()) == 0) {
                 $skipSlash = true;
             } else {
                 $skipSlash = false;
             }
             $operatorValue = $this->eZImage($tpl, $operatorValue, $operatorName, $skipSlash);
             break;
         case $this->ExtName:
             $urlMD5 = md5($operatorValue);
             $url = eZURL::urlByMD5($urlMD5);
             if ($url === false) {
                 eZURL::registerURL($operatorValue);
             } else {
                 $operatorValue = $url;
             }
             break;
         case $this->DesignName:
             $operatorValue = $this->eZDesign($tpl, $operatorValue, $operatorName);
             break;
     }
     $quote = "\"";
     $val = $namedParameters['quote_val'];
     if ($val == 'single') {
         $quote = "'";
     } else {
         if ($val == 'no') {
             $quote = false;
         }
     }
     $http = eZHTTPTool::instance();
     if (isset($http->UseFullUrl) and $http->UseFullUrl and strncasecmp($operatorValue, '/', 1) === 0) {
         $operatorValue = $http->createRedirectUrl($operatorValue, array('pre_url' => false));
     }
     if ($quote !== false) {
         $operatorValue = $quote . $operatorValue . $quote;
     }
 }
开发者ID:stevoland,项目名称:ez_patch,代码行数:101,代码来源:ezurloperator.php

示例3: unserializeContentObjectAttribute

 function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
 {
     $urlNode = $attributeNode->getElementsByTagName('url')->item(0);
     if (is_object($urlNode)) {
         unset($url);
         $url = urldecode($urlNode->textContent);
         $urlID = eZURL::registerURL($url);
         if ($urlID) {
             $urlObject = eZURL::fetch($urlID);
             $urlObject->setAttribute('original_url_md5', $urlNode->getAttribute('original-url-md5'));
             $urlObject->setAttribute('is_valid', $urlNode->getAttribute('is-valid'));
             $urlObject->setAttribute('last_checked', $urlNode->getAttribute('last-checked'));
             $urlObject->setAttribute('created', time());
             $urlObject->setAttribute('modified', time());
             $urlObject->store();
             $objectAttribute->setAttribute('data_int', $urlID);
         }
     }
     $textNode = $attributeNode->getElementsByTagName('text')->item(0);
     if ($textNode) {
         $objectAttribute->setAttribute('data_text', $textNode->textContent);
     }
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:23,代码来源:ezurltype.php

示例4: publishHandlerLink

 /**
  * publishHandlerLink (Publish handler, pass 2 after schema validation)
  * Publish handler for link element, converts href to [object|node|link]_id.
  *
  * @param DOMElement $element
  * @param array $param parameters for xml element
  * @return null|array changes structure if it contains 'result' key
  */
 function publishHandlerLink($element, &$params)
 {
     $ret = null;
     $href = $element->getAttribute('href');
     if ($href) {
         $objectID = false;
         if (strpos($href, 'ezobject') === 0 && preg_match("@^ezobject://([0-9]+)/?(#.+)?@i", $href, $matches)) {
             $objectID = $matches[1];
             if (isset($matches[2])) {
                 $anchorName = substr($matches[2], 1);
             }
             $element->setAttribute('object_id', $objectID);
             if (!eZContentObject::exists($objectID)) {
                 $this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Object %1 does not exist.', false, array($objectID));
             }
         } elseif (strpos($href, 'eznode') === 0 && preg_match("@^eznode://([^#]+)(#.+)?@i", $href, $matches)) {
             $nodePath = trim($matches[1], '/');
             if (isset($matches[2])) {
                 $anchorName = substr($matches[2], 1);
             }
             if (is_numeric($nodePath)) {
                 $nodeID = $nodePath;
                 $node = eZContentObjectTreeNode::fetch($nodeID);
                 if (!$node instanceof eZContentObjectTreeNode) {
                     $this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node %1 does not exist.', false, array($nodeID));
                 }
             } else {
                 $node = eZContentObjectTreeNode::fetchByURLPath($nodePath);
                 if (!$node instanceof eZContentObjectTreeNode) {
                     $this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node '%1' does not exist.', false, array($nodePath));
                 } else {
                     $nodeID = $node->attribute('node_id');
                 }
                 $element->setAttribute('show_path', 'true');
             }
             if (isset($nodeID) && $nodeID) {
                 $element->setAttribute('node_id', $nodeID);
             }
             if (isset($node) && $node instanceof eZContentObjectTreeNode) {
                 $objectID = $node->attribute('contentobject_id');
             }
         } elseif (strpos($href, '#') === 0) {
             $anchorName = substr($href, 1);
         } else {
             $temp = explode('#', $href);
             $url = $temp[0];
             if (isset($temp[1])) {
                 $anchorName = $temp[1];
             }
             if ($url) {
                 // Protection from XSS attack
                 if (preg_match("/^(java|vb)script:.*/i", $url)) {
                     $this->isInputValid = false;
                     $this->Messages[] = "Using scripts in links is not allowed, '{$url}' has been removed";
                     $element->removeAttribute('href');
                     return $ret;
                 }
                 // Check mail address validity following RFC 5322 and RFC 5321
                 if (preg_match("/^mailto:([^.][a-z0-9!#\$%&'*+-\\/=?`{|}~^]+@([a-z0-9.-]+))/i", $url, $mailAddr)) {
                     if (!eZMail::validate($mailAddr[1])) {
                         $this->isInputValid = false;
                         if ($this->errorLevel >= 0) {
                             $this->Messages[] = ezpI18n::tr('kernel/classes/datatypes/ezxmltext', "Invalid e-mail address: '%1'", false, array($mailAddr[1]));
                         }
                         $element->removeAttribute('href');
                         return $ret;
                     }
                 }
                 // Store urlID instead of href
                 $url = str_replace(array('&', '%28', '%29'), array('&', '(', ')'), $url);
                 $urlID = eZURL::registerURL($url);
                 if ($urlID) {
                     if (!in_array($urlID, $this->urlIDArray)) {
                         $this->urlIDArray[] = $urlID;
                     }
                     $element->setAttribute('url_id', $urlID);
                 }
             }
         }
         if ($objectID && !in_array($objectID, $this->linkedObjectIDArray)) {
             $this->linkedObjectIDArray[] = $objectID;
         }
         if (isset($anchorName) && $anchorName) {
             $element->setAttribute('anchor_name', $anchorName);
         }
     }
     return $ret;
 }
开发者ID:legende91,项目名称:ez,代码行数:96,代码来源:ezoeinputparser.php

示例5: testUrlCaseSensitivity

 /**
  * Test scenario for issue #018211: URL datatype is not case sensitive
  *
  * @link http://issues.ez.no/18211
  * @group issue18211
  */
 public function testUrlCaseSensitivity()
 {
     $url = 'http://ez.no/EZPUBLISH';
     $urlId = eZURL::registerURL($url);
     $urlObject = eZURL::fetch($urlId);
     self::assertEquals($url, $urlObject->attribute('url'));
     unset($urlId, $urlObject);
     $url2 = 'http://ez.no/ezpublish';
     $url2Id = eZURL::registerURL($url2);
     $url2Object = eZURL::fetch($url2Id);
     self::assertEquals($url2, $url2Object->attribute('url'));
     self::assertEquals(md5($url2), $url2Object->attribute('original_url_md5'));
     unset($url2Id, $url2Object);
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:20,代码来源:ezurl_regression.php

示例6: importAttribute

/**
 * Imports a value to an attribute adapting it to the proper type.
 * Not written by me, downloaded from ez.no! Extended it only!
 * @param data The value (string/int/float).
 * @param contentObjectAttribute The attribute to modify.
 */
function importAttribute($data, &$contentObjectAttribute)
{
    $contentClassAttribute = $contentObjectAttribute->attribute('contentclass_attribute');
    $dataTypeString = $contentClassAttribute->attribute('data_type_string');
    ezDebug::writeDebug("Converting " . $data . " to expected " . $dataTypeString);
    switch ($dataTypeString) {
        case 'ezfloat':
        case 'ezprice':
            $contentObjectAttribute->setAttribute('data_float', $data);
            $contentObjectAttribute->store();
            break;
        case 'ezboolean':
        case 'ezdate':
        case 'ezdatetime':
        case 'ezinteger':
        case 'ezsubtreesubscription':
        case 'eztime':
            $contentObjectAttribute->setAttribute('data_int', $data);
            $contentObjectAttribute->store();
            break;
        case 'ezobjectrelation':
            // $data is contentobject_id to relate to
            //            $oldData = $contentObjectAttribute->attribute( 'data_int' );
            $contentObjectAttribute->setAttribute('data_int', $data);
            $contentObjectAttribute->store();
            $object = $contentObjectAttribute->object();
            $contentObjectVersion = $contentObjectAttribute->attribute('version');
            $contentClassAttributeID = $contentObjectAttribute->attribute('contentclassattribute_id');
            // Problem with translations if removing old relations ?!
            //            $object->removeContentObjectRelation( $oldData, $contentObjectVersion, $contentClassAttributeID, eZContentObject::RELATION_ATTRIBUTE );
            $object->addContentObjectRelation($data, $contentObjectVersion, $contentClassAttributeID, RELATION_ATTRIBUTE);
            break;
        case 'ezurl':
            $urlID = eZURL::registerURL($data);
            $contentObjectAttribute->setAttribute('data_int', $urlID);
            // Fall through to set data_text
        // Fall through to set data_text
        case 'ezemail':
        case 'ezisbn':
        case 'ezstring':
        case 'eztext':
            $contentObjectAttribute->setAttribute('data_text', $data);
            $contentObjectAttribute->store();
            break;
        case 'ezxmltext':
            /*            $parser = new eZXMLInputParser();
                    $document = $parser->process( $data );
                    $data = eZXMLTextType::domString( $document );
                    $contentObjectAttribute->fromString( $data );*/
            $contentObjectAttribute->setAttribute('data_text', $data);
            $contentObjectAttribute->store();
            break;
            //    case 'ezimage':
            //        $this->saveImage( $data, $contentObjectAttribute );
            //        break;
            //    case 'ezbinaryfile':
            //        $this->saveFile( $data, $contentObjectAttribute );
            //        break;
            //    case 'ezenum':
            //removed enum - function can be found at ez.no
            //        break;
        //    case 'ezimage':
        //        $this->saveImage( $data, $contentObjectAttribute );
        //        break;
        //    case 'ezbinaryfile':
        //        $this->saveFile( $data, $contentObjectAttribute );
        //        break;
        //    case 'ezenum':
        //removed enum - function can be found at ez.no
        //        break;
        case 'ezuser':
            // $data is assumed to be an associative array( login, password, email );
            $user = new eZUser($contentObjectAttribute->attribute('contentobject_id'));
            if (isset($data['login'])) {
                $user->setAttribute('login', $data['login']);
            }
            if (isset($data['email'])) {
                $user->setAttribute('email', $data['email']);
            }
            if (isset($data['password'])) {
                $hashType = eZUser::hashType() . '';
                $newHash = $user->createHash($data['login'], $data['password'], eZUser::site(), $hashType);
                $user->setAttribute('password_hash_type', $hashType);
                $user->setAttribute('password_hash', $newHash);
            }
            $user->store();
            break;
        default:
            die('Can not store ' . $data . ' as datatype: ' . $dataTypeString);
    }
}
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:97,代码来源:lib.php

示例7: testLinkEscape

    /**
     * Bug in link rendering related to GET parameters (& double encoded to &)
     *
     * @link http://issues.ez.no/016668: links in ezxmltext double escapes.
     * @note Test depends on template output!!
     */
    public function testLinkEscape()
    {
        $url = '/index.php?c=6&kat=company';
        $urlID = eZURL::registerURL( $url );
        $XMLString = '<?xml version="1.0" encoding="utf-8"?>
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"><link url_id="' . $urlID . '">My link</link></paragraph></section>';

        $outputHandler = new eZXHTMLXMLOutput( $XMLString, false );
        $result = $outputHandler->outputText();

        $expected = '<p><a href="/index.php?c=6&amp;kat=company" target="_self">My link</a></p>';

        $this->assertEquals( $expected, $result );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:20,代码来源:ezxhtmlxmloutput_regression.php


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