本文整理汇总了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;
}
示例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 );
}
//.........这里部分代码省略.........