當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZSys::envSeparator方法代碼示例

本文整理匯總了PHP中eZSys::envSeparator方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZSys::envSeparator方法的具體用法?PHP eZSys::envSeparator怎麽用?PHP eZSys::envSeparator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZSys的用法示例。


在下文中一共展示了eZSys::envSeparator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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);
}
開發者ID:runelangseid,項目名稱:ezpublish,代碼行數:100,代碼來源:ezsetuptests.php


注:本文中的eZSys::envSeparator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。