本文整理汇总了PHP中Lib::normalizePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Lib::normalizePath方法的具体用法?PHP Lib::normalizePath怎么用?PHP Lib::normalizePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lib
的用法示例。
在下文中一共展示了Lib::normalizePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyDirectory
public static function copyDirectory($from, $to)
{
if (self::$_files) {
return 'Can\'t write storage in commit mode';
}
$to = Lib::normalizePath($to);
if (is_file($from)) {
return 'Origin path is a file';
}
if (!is_dir($from)) {
return 'File not found';
}
if (is_file($to)) {
return 'Destination path is a file';
}
if (is_dir($to)) {
return 'Destination path already exists';
}
try {
Lib::recurseCopy($from, $to);
} catch (Exception $e) {
return 'Internal server error';
}
return 'true';
}
示例2: createUserLinkedProject
public static function createUserLinkedProject($toUser, $fromUser, $fromProject, $confidentialityLevel = 'private')
{
chdir(__DIR__);
global $shark;
global $db;
$toUser = Lib::normalizePath($toUser);
$fromUser = Lib::normalizePath($fromUser);
if ($confidentialityLevel !== 'public' && $confidentialityLevel !== 'private') {
return $shark['msg']['bad-request'];
}
if (!self::existsUser($fromUser) && $fromUser !== '.model') {
return 'User doesn\'t exists';
}
if (!is_dir('users/' . $fromUser . '/public/' . $fromProject)) {
return 'Project not found';
}
try {
mkdir('users/' . $toUser . '/' . $confidentialityLevel . '/' . $fromProject);
Lib::recurseCopy('users/' . $fromUser . '/public/' . $fromProject, 'users/' . $toUser . '/' . $confidentialityLevel . '/' . $fromProject);
} catch (Exception $e) {
return $shark['msg']['API-error'];
}
return $shark['msg']['API-done'];
}
示例3: chdir
<?php
chdir(__DIR__);
require_once '../framework/lib.php';
require_once 'config.php';
//require_once('API.php');
if (!isset($_GET['name']) || empty($_GET['name'])) {
die($shark['msg']['bad-request']);
}
$path = 'compilers/' . Lib::normalizePath($_GET['name']);
if (!is_dir($path)) {
die($shark['msg']['not-found']);
}
$json = json_decode(file_get_contents($path . '/package.json'), true);
$json['compiler'] = file_get_contents($path . '/' . $json['package']['compiler']);
if (isset($json['runner'])) {
$json['runner'] = file_get_contents($path . '/' . $json['package']['runner']);
}
$json['files'] = array();
foreach ($json['package']['require'] as $i => $file) {
$json['files'][$file] = file_get_contents($path . '/' . $file);
}
die(json_encode($json));