本文整理汇总了PHP中eZDir::cleanPath方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDir::cleanPath方法的具体用法?PHP eZDir::cleanPath怎么用?PHP eZDir::cleanPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDir
的用法示例。
在下文中一共展示了eZDir::cleanPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ParadoxPDF
function ParadoxPDF()
{
$paradoxPDFINI = eZINI::instance('paradoxpdf.ini');
$this->cacheEnabled = $paradoxPDFINI->variable('CacheSettings', 'PDFCache') == 'enabled';
$this->debugEnabled = $paradoxPDFINI->variable('DebugSettings', 'DebugPDF') == 'enabled';
$this->debugVerbose = $paradoxPDFINI->variable('DebugSettings', 'Verbose') == 'enabled';
$this->javaExec = $paradoxPDFINI->variable('BinarySettings', 'JavaExecutable');
$this->cacheTTL = $paradoxPDFINI->variable('CacheSettings', 'TTL');
$this->paradoxPDFExec = eZDir::cleanPath('extension/paradoxpdf/bin/paradoxpdf.jar');
$this->tmpDir = eZDir::path(array(eZINI::instance()->variable('FileSettings', 'VarDir'), 'paradoxpdf'));
}
示例2: nameFromPath
/**
* eZExtension::nameFromPath( __FILE__ ) executed in any file of an extension
* can help you to find the path to additional resources
*
* @param $path Path to check.
* @return Name of the extension a path belongs to.
* @deprecated Since 4.3, use {@link eZExtension::nameFromPath()} instead
*/
function nameFromPath($path)
{
$path = eZDir::cleanPath($path);
$base = eZExtension::baseDirectory() . '/';
$base = preg_quote($base, '/');
$pattern = '/' . $base . '([^\\/]+)/';
if (preg_match($pattern, $path, $matches)) {
return $matches[1];
} else {
false;
}
}
示例3: eZSetupCheckExecutable
function eZSetupCheckExecutable($type)
{
$http = eZHTTPTool::instance();
$filesystemType = eZSys::filesystemType();
$envSeparator = eZSys::envSeparator();
$programs = eZSetupConfigVariableArray($type, $filesystemType . '_Executable');
$systemSearchPaths = explode($envSeparator, eZSys::path(true));
$additionalSearchPaths = eZSetupConfigVariableArray($type, $filesystemType . '_SearchPaths');
$excludePaths = eZSetupConfigVariableArray($type, $filesystemType . '_ExcludePaths');
$imageIniPath = eZSetupImageConfigVariableArray('ShellSettings', 'ConvertPath');
/*
We save once entered extra path in the persistent data list
to keep it within setup steps.
This trick is needed, for example, in "registration" step,
where user has no chance to enter extra path again
due to missing input field for this purpose.
*/
// compute extra path
$extraPath = array();
if ($http->hasPostVariable($type . '_ExtraPath')) {
$GLOBALS['eZSetupCheckExecutable_' . $type . '_ExtraPath'] = $http->postVariable($type . '_ExtraPath');
$extraPath = explode($envSeparator, $http->postVariable($type . '_ExtraPath'));
} else {
if (isset($GLOBALS['eZSetupCheckExecutable_' . $type . '_ExtraPath'])) {
$extraPath = explode($envSeparator, $GLOBALS['eZSetupCheckExecutable_' . $type . '_ExtraPath']);
}
}
// if extra path was given in any way
if ($extraPath) {
// remove program from path name if entered
foreach ($extraPath as $path) {
foreach ($programs as $program) {
if (strpos($path, $program) == strlen($path) - strlen($program)) {
$extraPath[] = substr($path, strpos($path, $program));
}
}
}
}
$searchPaths = array_merge($systemSearchPaths, $additionalSearchPaths, $extraPath, $imageIniPath);
$result = false;
$correctPath = false;
$correctProgram = false;
foreach ($programs as $program) {
foreach ($searchPaths as $path) {
$pathProgram = eZDir::path(array($path, $program));
if (file_exists($pathProgram)) {
if ($filesystemType == 'unix') {
$relativePath = $path;
if (preg_match("#^/(.+)\$#", $path, $matches)) {
$relativePath = $matches[1];
}
$relativePath = eZDir::cleanPath($relativePath);
} else {
$relativePath = $path;
if (preg_match("#^[a-zA-Z]:[/\\\\](.+)\$#", $path, $matches)) {
$relativePath = $matches[1];
}
$relativePath = eZDir::cleanPath($relativePath);
}
$exclude = false;
foreach ($excludePaths as $excludePath) {
$excludePath = strtolower($excludePath);
$match = strtolower($program . "@" . $relativePath);
if ($match == $excludePath) {
$exclude = true;
break;
} else {
if ($relativePath == $excludePath) {
$exclude = true;
break;
}
}
}
if ($exclude) {
continue;
}
if (function_exists("is_executable")) {
if (is_executable($pathProgram)) {
$result = true;
$correctPath = $path;
$correctProgram = $program;
break;
}
} else {
// Windows system
$result = true;
$correctPath = $path;
$correctProgram = $program;
break;
}
}
}
if ($result) {
break;
}
}
$extraPathAsString = implode($envSeparator, $extraPath);
return array('result' => $result, 'persistent_data' => array('path' => array('value' => $correctPath), 'program' => array('value' => $correctProgram), 'extra_path' => array('value' => $extraPathAsString, 'merge' => TRUE), 'result' => array('value' => $result)), 'env_separator' => $envSeparator, 'filesystem_type' => $filesystemType, 'extra_path' => $extraPath, 'correct_path' => $correctPath, 'system_search_path' => $systemSearchPaths, 'additional_search_path' => $additionalSearchPaths);
}
示例4: 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;
}
示例5: foreach
#$connection = eZClusterSMTP::connect( $parameters );
$connection = eZClusterSMTP::instance($parameters);
if (count($connection->errors) == 0) {
$cli->output("Connected to " . $parameters['host']);
return true;
} else {
$cli->output("ERROR while connecting to " . $parameters['host']);
foreach ($connection->errors as $error) {
$cli->output("Server Respond: " . $error);
}
return false;
}
$connection->quit();
}
// check if another instance of this script is already running and prevent execution if so
$pidfilename = eZDir::cleanPath(eZSys::varDirectory() . '/run/eznewsletter.pid');
if (file_exists($pidfilename)) {
$pid = file_get_contents($pidfilename);
$cli->error("A newsletter cronjob is already running.");
$cli->error("Please wait until the process (PID: {$pid}) is finished.");
$cli->error("If the script crashed during sendout, delete the PID file {$pidfilename} and restart the script.");
exit;
}
if (false == file_exists(dirname($pidfilename))) {
eZDir::mkdir(dirname($pidfilename), false, true);
}
if (!is_writeable(dirname($pidfilename))) {
$cli->error("PID file not writeable ( {$pidfilename} ). Please add write access for cronjob.");
exit(1);
}
$pidfile = fopen($pidfilename, 'w');