當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。