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


PHP eZDir::separator方法代码示例

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


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

示例1: path

 static function path( $names, $includeEndSeparator = false, $type = self::SEPARATOR_UNIX )
 {
     $separator = eZDir::separator( $type );
     $path = implode( $separator, $names );
     $path = eZDir::cleanPath( $path, $type );
     $pathLen = strlen( $path );
     $hasEndSeparator = ( $pathLen > 0 and
                      $path[$pathLen - 1] == $separator );
     if ( $includeEndSeparator and
          !$hasEndSeparator )
         $path .= $separator;
     else if ( !$includeEndSeparator &&
               $hasEndSeparator &&
               $pathLen > 1 )
         $path = substr( $path, 0, $pathLen - 1 );
     return $path;
 }
开发者ID:nottavi,项目名称:ezpublish,代码行数:17,代码来源:ezdir.php

示例2: execute

    function execute( $xml )
    {
        $settingsFileList = $xml->getElementsByTagName( 'SettingsFile' );
        foreach ( $settingsFileList as $settingsFile )
        {
            $fileName = $settingsFile->getAttribute( 'name' );
            $location = $settingsFile->getAttribute( 'location' );

            eZDir::mkdir( $location );
            $fileNamePath = $location . eZDir::separator( eZDir::SEPARATOR_LOCAL ) . $fileName;

            $this->writeMessage( "\tSetting settings: $fileNamePath", 'notice' );

            if ( !file_exists( $fileNamePath ) )
            {
                if ( !is_writeable( $location ) )
                {
                    $this->writeMessage( "\tFile $fileNamePath can not be created. Skipping.", 'notice' );
                    continue;
                }
            }
            else
            {
                if ( !is_readable( $fileName ) )
                {
                    $this->writeMessage( "\tFile $fileNamePath is not readable. Skipping.", 'notice' );
                    continue;
                }
                if ( !is_writeable( $fileName ) )
                {
                    $this->writeMessage( "\tFile $fileNamePath is not writeable. Skipping.", 'notice' );
                    continue;
                }
            }
            $ini = eZINI::instance( $fileName, $location, null, null, null, true, true );
            $settingsBlockList = $settingsFile->getElementsByTagName( 'SettingsBlock' );
            foreach ( $settingsBlockList as $settingsBlock )
            {
                $blockName = $settingsBlock->getAttribute( 'name' );
                $values = $settingsBlock->childNodes;
                $settingValue = false;
                foreach ( $values as $value )
                {
                    $variableName = $value->nodeName;
                    if ( $value->nodeName == "#text" )
                    {
                        continue;
                    }

                    if ( get_class($value) == 'DOMElement' && $value->hasAttribute( 'value' ) )
                    {
                        $settingValue = $value->getAttribute( 'value' );
                    }
                    elseif ( get_class($value) == 'DOMElement' && $value->hasChildNodes() )
                    {
                        if ( $value->firstChild->nodeName == $value->lastChild->nodeName && $value->childNodes->length>1 )
                        {
                            $variableName = $value->tagName;
                            $vals = $value->getElementsByTagName( 'value' );
                            $settingValue = array();
                            foreach ( $vals as $val )
                            {
                                $key = $val->getAttribute( 'key' );
                                if ( $key )
                                {
                                    $settingValue[$key] = $this->parseAndReplaceStringReferences( $val->textContent );
                                }
                                else
                                {
                                    $settingValue[] = $this->parseAndReplaceStringReferences( $val->textContent );
                                }
                            }
                        }
                        else
                        {
                            $settingValue  = $this->parseAndReplaceStringReferences( $value->nodeValue );
                       }
                    }
                    elseif ( $value->textContent )
                    {
                        $settingValue = $value->textContent;
                    }
                    else
                    {
                        $settingValue = $this->parseAndReplaceStringReferences( $value->textContent );
                    }
                    $existingVar = false;
                    if ( $ini->hasVariable( $blockName, $variableName ) )
                    {
                        $existingVar = $ini->variable( $blockName, $variableName );
                    }
                    if ( is_string( $existingVar ) && is_string( $settingValue ) )
                    {
                        $ini->setVariable( $blockName, $variableName, $settingValue );
                    }
                    elseif ( is_array( $existingVar ) && is_string( $settingValue ) )
                    {
                        $existingVar[] = $settingValue;
                        $ini->setVariable( $blockName, $variableName, $existingVar );
                    }
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezsetsettings.php


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