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


PHP eZURLAliasML::convertToAlias方法代码示例

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


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

示例1: convertPathToAlias

 public static function convertPathToAlias($pathURL)
 {
     $result = array();
     $elements = explode('/', $pathURL);
     foreach ($elements as $element) {
         $element = eZURLAliasML::convertToAlias($element);
         $result[] = $element;
     }
     return implode('/', $result);
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:10,代码来源:ezurlaliasml.php

示例2: testConvertToAlias_Compat

 public function testConvertToAlias_Compat()
 {
     // We set the below ini settings to make sure they are not accidentally
     // overriden in somewhere in the test installation.
     ezpINIHelper::setINISetting('site.ini', 'URLTranslator', 'WordSeparator', 'underscore');
     ezpINIHelper::setINISetting('site.ini', 'URLTranslator', 'TransformationGroup', 'urlalias_compat');
     // ---------------------------------------------------------------- //
     // Not safe characters, all of these should be removed.
     $e1 = " &;/:=?[]()+#/{}\$*',^§±@.!_";
     $e1Result = "_1";
     // Safe characters. No char should be removed.
     $e2 = "abcdefghijklmnopqrstuvwxyz0123456789";
     $e2Result = $e2;
     // Random selection of funky characters. All chars should be removed.
     $e3 = "ウңҏѫあギᄍㄇᠢ⻲㆞ญ฿";
     $e3Result = "_1";
     // Make sure uppercase chars gets converted to lowercase.
     $e4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     $e4Result = "abcdefghijklmnopqrstuvwxyz";
     // Make sure multiple dots are turned into a seperator (-) (dot is
     // allowed exepct beginning/end of url).
     $e5 = "..a...........b..";
     $e5Result = "a_b";
     self::assertEquals($e1Result, eZURLAliasML::convertToAlias($e1));
     self::assertEquals($e2Result, eZURLAliasML::convertToAlias($e2));
     self::assertEquals($e3Result, eZURLAliasML::convertToAlias($e3));
     self::assertEquals($e4Result, eZURLAliasML::convertToAlias($e4));
     self::assertEquals($e5Result, eZURLAliasML::convertToAlias($e5));
     // ---------------------------------------------------------------- //
     ezpINIHelper::restoreINISettings();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:urlaliasml_test.php

示例3: updateSubTreePath

 function updateSubTreePath($updateParent = true, $nodeMove = false)
 {
     $changeCount = 0;
     $nodeID = $this->attribute('node_id');
     $parentNodeID = $this->attribute('parent_node_id');
     // Avoid recursion due to database inconsistencies
     if ($nodeID === $parentNodeID) {
         eZDebug::writeError("Parent node ID equals node ID for node: {$nodeID}. The node cannot be a parent of itself!", __METHOD__);
         return false;
     }
     // Only set name if current node is not the content root
     $ini = eZINI::instance('content.ini');
     $contentRootID = $ini->variable('NodeSettings', 'RootNode');
     $obj = $this->object();
     $alwaysMask = $obj->attribute('language_mask') & 1;
     $languages = $obj->allLanguages();
     $nameList = array();
     $initialLanguageID = $obj->attribute('initial_language_id');
     $pathIdentificationName = false;
     foreach ($languages as $language) {
         $nodeName = '';
         if ($nodeID != $contentRootID) {
             $objClass = $obj->attribute('content_class');
             $nodeName = $objClass->urlAliasName($obj, false, $language->attribute('locale'));
             $nodeName = eZURLAliasFilter::processFilters($nodeName, $language, $this);
             $nodeName = eZURLAliasML::convertToAlias($nodeName, 'node_' . $nodeID);
             $nodeName = $this->adjustPathElement($nodeName, $nodeMove);
             // Compatibility mode:
             // Store name for the 'path_identification_string' column.
             if ($initialLanguageID == $language->attribute('id')) {
                 $pathIdentificationName = eZURLAliasML::convertToAliasCompat($nodeName, 'node_' . $nodeID);
             }
         }
         $nameList[] = array('text' => $nodeName, 'language' => $language);
     }
     $parentActionName = "eznode";
     $parentActionValue = $parentNodeID;
     $parentElementID = false;
     $existingElements = eZURLAliasML::fetchByAction("eznode", $nodeID);
     $existingElementID = null;
     if (count($existingElements) > 0) {
         $existingElementID = $existingElements[0]->attribute('id');
         $parentElementID = $existingElements[0]->attribute('parent');
     }
     // If we have parent element it means the node is already published
     // and we have to see if it has been moved
     if ($parentNodeID != 1 and $updateParent) {
         $parents = eZURLAliasML::fetchByAction("eznode", $parentNodeID);
         if (count($parents) == 0) {
             $parentNode = $this->fetchParent();
             if (!$parentNode) {
                 return false;
             }
             $result = $parentNode->updateSubTreePath();
             if (!$result) {
                 return false;
             }
             $parents = eZURLAliasML::fetchByAction($parentActionName, $parentActionValue);
             if (count($parents) == 0) {
                 return false;
             }
             $oldParentElementID = $parentElementID;
             foreach ($parents as $paren) {
                 $parentElementID = 0;
                 if ($paren->attribute('text') != '') {
                     $parentElementID = (int) $paren->attribute('link');
                     break;
                 }
             }
         } else {
             $oldParentElementID = $parentElementID;
             $parentElementID = 0;
             foreach ($parents as $paren) {
                 if ($paren->attribute('text') != '') {
                     $parentElementID = (int) $paren->attribute('link');
                     break;
                 }
             }
         }
     } else {
     }
     $this->updatePathIdentificationString($pathIdentificationName);
     $languageID = $obj->attribute('initial_language_id');
     $cleanup = false;
     foreach ($nameList as $nameEntry) {
         $text = $nameEntry['text'];
         $language = $nameEntry['language'];
         $result = eZURLAliasML::storePath($text, 'eznode:' . $nodeID, $language, false, $alwaysMask, $parentElementID, $cleanup);
         if ($result['status'] === true) {
             $changeCount++;
         }
     }
     return $changeCount;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:94,代码来源:ezcontentobjecttreenode.php

示例4: fetchSectionsInformations

    /**
     * @param bool $stats
     * @return array
     */
    public static function fetchSectionsInformations($stats = true)
    {
        $cluster = ClusterTool::clusterIdentifier();
        if ( isset(self::$sectionsInformations[$cluster][(int) $stats]) )
        {
            return array('result' => self::$sectionsInformations[$cluster][(int) $stats]);
        }

        $trigramRemoteToName = FacetFilteringTool::getTaxonomyTranslation('trigram_section');
        $sectionRemoteToName = FacetFilteringTool::getTaxonomyTranslation('section');

        uasort( $sectionRemoteToName, function($a, $b) {
            return strcmp( StringTool::CJK2Pinyin($a), StringTool::CJK2Pinyin($b) );
        });

        $informations = array();
        foreach ( $sectionRemoteToName as $remote => $name )
        {
            $trigram = false;
            if ( isset($trigramRemoteToName['trigram_' . $remote]) )
            {
                $trigram = $trigramRemoteToName['trigram_' . $remote];
            }

            $url = eZURLAliasML::convertToAlias($name);
            if ( $url == '_1' )
            {
                $url = str_replace('section_v', '', $remote);
            }
            $informations[$remote] = array(
                'remote'        => $remote,
                'url'           => $url,
                'name'          => $name,
                'trigram'       => $trigram,
                'topic_count'   => 0,
                'chapter_count' => 0
            );
        }

        if ( $stats )
        {
            $rootNodeId         = MerckManualShowcase::rootNodeId();

            $fields = array('subattr_section___source_id____s', 'subattr_symptom___source_id____s');
            $fq = array(
                'meta_class_identifier_ms:"article"',
                'meta_path_si:' . $rootNodeId,
            );

            $defaultsParams = array(
                'q'              => '',
                'start'          => 0,
                'rows'           => 0,
                'fq'             => implode(' AND ', $fq),
                'fl'             => implode(',', $fields),
                'qt'             => 'ezpublish',
                'explainOther'   => '',
                'hl'             => 'false',
                'facet'          => 'true',
                'facet.field'    => array('subattr_section___source_id____s'),
                'facet.limit'    => array(-1),
                'facet.mincount' => array(1),
                'facet.sort'     => array('alpha')
            );

            // Count chapter
            $params = $defaultsParams;
            $params['fq'] .= ' AND attr_relative_depth_i:0';
            $result = SolrTool::rawSearch($params);

            foreach ( $result['facet_counts']['facet_fields']['subattr_section___source_id____s'] as $section => $count )
                if ( isset($informations[$section]) )
                    $informations[$section]['chapter_count'] = $count;

            // Count topic
            $params = $defaultsParams;
            $params['fq'] .= ' AND attr_relative_depth_i:1';
            $result = self::rawSearch($params);

            foreach ( $result['facet_counts']['facet_fields']['subattr_section___source_id____s'] as $section => $count )
                if ( isset($informations[$section]) )
                    $informations[$section]['topic_count'] = $count;
        }

        if ( !isset(self::$sectionsInformations[$cluster]) )
            self::$sectionsInformations[$cluster] = array();

        self::$sectionsInformations[$cluster][(int) $stats] = $informations;

        return array('result' => $informations);
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:95,代码来源:merckmanualfunctioncollection.php

示例5: sanitize

 /**
  *  Removes any non-alphanumeric characters.
  *
  * @param  String
  * @return String sanitized string
  */
 static function sanitize($string)
 {
     $infos = pathinfo($string);
     $fileName = $infos['filename'] . '.pdf';
     return eZURLAliasML::convertToAlias($fileName);
 }
开发者ID:informaticatrentina,项目名称:paradoxpdf,代码行数:12,代码来源:paradoxpdf.php


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