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


PHP eZURLAliasML::convertPathToAlias方法代码示例

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


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

示例1: fetchParentNodeByTranslation

 /**
  * Attempts to fetch a possible node by translating the provided
  * string/path to a node-number.
  *
  * The last section of the path is removed before the actual
  * translation: hence, the PARENT node is returned.
  *
  * @param string $nodePathString Eg. 'Folder1/file1.txt'
  * @return eZContentObject Eg. the node of 'Folder1'
  */
 protected function fetchParentNodeByTranslation($nodePathString)
 {
     // Strip extensions. E.g. .jpg
     $nodePathString = $this->fileBasename($nodePathString);
     // Strip away last slash
     if (strlen($nodePathString) > 0 and $nodePathString[strlen($nodePathString) - 1] === '/') {
         $nodePathString = substr($nodePathString, 0, strlen($nodePathString) - 1);
     }
     $nodePathString = $this->splitLastPathElement($nodePathString, $element);
     if (strlen($nodePathString) === 0) {
         $nodePathString = '/';
     }
     $nodePathString = eZURLAliasML::convertPathToAlias($nodePathString);
     // Attempt to translate the URL to something like "/content/view/full/84".
     $translateResult = eZURLAliasML::translate($nodePathString);
     // handle redirects
     while ($nodePathString === 'error/301') {
         $nodePathString = $translateResult;
         $translateResult = eZURLAliasML::translate($nodePathString);
     }
     // Get the ID of the node (which is the last part of the translated path).
     if (preg_match("#^content/view/full/([0-9]+)\$#", $nodePathString, $matches)) {
         $nodeID = $matches[1];
     } else {
         $ini = eZINI::instance('webdav.ini');
         if ($ini->hasVariable('GeneralSettings', 'StartNode')) {
             $nodeID = $ini->variable('GeneralSettings', 'StartNode');
         }
     }
     // Attempt to fetch the node.
     $node = eZContentObjectTreeNode::fetch($nodeID);
     // Return the node.
     return $node;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:44,代码来源:ezwebdavcontentbackend.php

示例2: fetchParentNodeByTranslation

    function fetchParentNodeByTranslation( $nodePathString )
    {
        // Strip extensions. E.g. .jpg
        $nodePathString = $this->fileBasename( $nodePathString );

        // Strip away last slash
        if ( strlen( $nodePathString ) > 0 and
             $nodePathString[strlen( $nodePathString ) - 1] == '/' )
        {
            $nodePathString = substr( $nodePathString, 0, strlen( $nodePathString ) - 1 );
        }

        $nodePathString = $this->splitLastPathElement( $nodePathString, $element );

        if ( strlen( $nodePathString ) == 0 )
            $nodePathString = '/';

        $nodePathString = eZURLAliasML::convertPathToAlias( $nodePathString );

        // Attempt to translate the URL to something like "/content/view/full/84".
        $translateResult = eZURLAliasML::translate( $nodePathString );

        // handle redirects
        while ( $nodePathString == 'error/301' )
        {
            $nodePathString = $translateResult;

            $translateResult = eZURLAliasML::translate( $nodePathString );
        }

        // Get the ID of the node (which is the last part of the translated path).
        if ( preg_match( "#^content/view/full/([0-9]+)$#", $nodePathString, $matches ) )
        {
            $nodeID = $matches[1];
            $this->appendLogEntry( "NodeID: $nodeID", 'CS:fetchParentNodeByTranslation' );
        }
        else
        {
            $this->appendLogEntry( "Root node", 'CS:fetchParentNodeByTranslation' );
            $nodeID = 2;
        }

        // Attempt to fetch the node.
        $node = eZContentObjectTreeNode::fetch( $nodeID );

        // Return the node.
        return $node;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:48,代码来源:ezwebdavcontentserver.php


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