本文整理汇总了PHP中Path::Combine方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::Combine方法的具体用法?PHP Path::Combine怎么用?PHP Path::Combine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::Combine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCustomTemplate
public function GetCustomTemplate($part, $mode, $defaultValue, &$params = null)
{
$result = null;
if (!$mode) {
// for PageList
$mode = $this->GetCurrentPageMode();
}
if (!$params) {
$params = array();
}
$this->OnGetCustomTemplate->Fire(array($part, $mode, &$result, &$params, $this));
if ($result) {
return Path::Combine('custom_templates', $result);
} else {
return $defaultValue;
}
}
示例2: RenderEditor
private function RenderEditor(CustomEditor $editor, $nameInTemplate, $templateFile, $additionalParams = array())
{
$validatorsInfo = array();
$validatorsInfo['InputAttributes'] = $editor->GetValidationAttributes();
$validatorsInfo['InputAttributes'] .= StringUtils::Format(' data-legacy-field-name="%s" data-pgui-legacy-validate="true"', $editor->GetFieldName());
$this->DisplayTemplate(Path::Combine('editors', $templateFile), array($nameInTemplate => $editor), array_merge(array('Validators' => $validatorsInfo, $nameInTemplate == 'Editor' ? 'EditControl' : 'Editor' => $editor->GetViewData()), $additionalParams));
}
示例3: NuGetDb
require_once __ROOT__ . "/inc/commons/url.php";
require_once __ROOT__ . "/inc/commons/http.php";
require_once __ROOT__ . "/inc/api_nuget.php";
$id = UrlUtils::GetRequestParamOrDefault("id", null);
$version = UrlUtils::GetRequestParamOrDefault("version", null);
if ($id == null || $version == null) {
HttpUtils::ApiError(500, "Wrong data. Missing param.");
}
if (strlen($id) == 0 || strlen($version) == 0) {
HttpUtils::ApiError(500, "Wrong data. Empty id or version.");
}
$query = "Id eq '" . $id . "' and Version eq '" . $version . "'";
$db = new NuGetDb();
$os = new PhpNugetObjectSearch();
$os->Parse($query, $db->GetAllColumns());
$allRows = $db->GetAllRows(1, 0, $os);
if (sizeof($allRows) == 0) {
HttpUtils::ApiError(404, "Not found.");
}
$file = $allRows[0]->Id . "." . $allRows[0]->Version . ".nupkg";
$path = Path::Combine(Settings::$PackagesRoot, $file);
if (!file_exists($path)) {
HttpUtils::ApiError(404, "Not found " . $file);
}
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename=' . basename($path));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($path));
readfile($path);
示例4: define
<?php
if (!defined('__ROOT__')) {
define('__ROOT__', dirname(dirname(__FILE__)));
}
require_once __ROOT__ . "/inc/commons/smalltxtdb.php";
require_once __ROOT__ . "/inc/commons/utils.php";
require_once __ROOT__ . "/inc/commons/objectsearch.php";
require_once __ROOT__ . "/inc/db_usersentity.php";
define('__MYTXTDB_USR__', Path::Combine(Settings::$DataRoot, "nugetdb_usrs.txt"));
define('__MYTXTDBROWS_USR__', "UserId:|:Name:|:Company:|:Md5Password:|:Packages:|:Enabled:|:Email:|:Token:|:Admin:|:Id");
define('__MYTXTDBROWS_USR_TYP__', "string:|:string:|:string:|:string:|:string:|:boolean:|:string:|:string:|:boolean:|:string");
class UserDb
{
public function EntityName()
{
return "UserEntity";
}
public function __construct()
{
$this->initialize();
}
public function UserDbSortUserId()
{
$this->initialize();
}
private function initialize()
{
}
public static function RowTypes()
{
示例5: GetCustomTemplate
public function GetCustomTemplate($part, $defaultValue, &$params = null)
{
$result = null;
if (!$params) {
$params = array();
}
$this->OnGetCustomTemplate->Fire(array($part, null, &$result, &$params));
if ($result) {
return Path::Combine('custom_templates', $result);
} else {
return $defaultValue;
}
}
示例6: _metadata
function _metadata($action)
{
if ($action != "metadata") {
return;
}
HttpUtils::WriteFile(Path::Combine($this->_path, "metadata.xml"), "application/xml");
}
示例7: Delete
/**
* Deletes a folder and all of its contents
* @param string $dir
*/
static function Delete($dir)
{
$files = self::GetFileSystemEntries($dir);
foreach ($files as $file) {
$path = Path::Combine($dir, $file);
switch (self::GetFileSystemEntryType($path)) {
case FileSystemEntryType::File():
case FileSystemEntryType::Link():
unlink($path);
break;
case FileSystemEntryType::Folder():
self::Delete($path);
break;
}
}
rmdir($dir);
}
示例8: _loadNupkg
private function _loadNupkg($file, $userId)
{
$r = new SingleResult();
$r->Success = true;
try {
$nugetReader = new NugetManager();
$parsedNuspec = $nugetReader->LoadNuspecFromFile($file);
$r->Id = $parsedNuspec->Id;
$r->Version = $parsedNuspec->Version;
$pathInfo = basename($file);
$realPath = Path::Combine(Settings::$PackagesRoot, $r->Id . "." . $r->Version . ".nupkg");
if ($realPath != $file) {
if (file_exists($realPath) && DIRECTORY_SEPARATOR == '/') {
unlink($realPath);
}
rename($file, $realPath);
$file = $realPath;
}
$parsedNuspec->UserId = $userId;
$nuspecData = $nugetReader->SaveNuspec($file, $parsedNuspec);
} catch (Exception $ex) {
$r->Success = false;
$r->Reason = $ex->getMessage();
}
return $r;
}
示例9: GetThumbnailFileName
private function GetThumbnailFileName($original_file_name, $original_file_extension, $file_size)
{
$result = '';
$handled = false;
$this->generateFileNameDelegate->CallFromArray(array(&$result, &$handled, $original_file_name, $original_file_extension, $file_size));
$targetFolder = FormatDatasetFieldsTemplate($this->GetDataset(), $this->directoryToSaveThumbnails);
FileUtils::ForceDirectories($this->directoryToSaveThumbnails);
if (!$handled) {
$filename = FileUtils::AppendFileExtension(rand(), $original_file_extension);
$result = Path::Combine($targetFolder, $filename);
while (file_exists($result)) {
$filename = FileUtils::AppendFileExtension(rand(), $original_file_extension);
$result = Path::Combine($targetFolder, $filename);
}
}
return $result;
}
示例10: dirname
<?php
require_once dirname(__FILE__) . "/../root.php";
require_once __ROOT__ . "/settings.php";
require_once __ROOT__ . "/inc/commons/smalltxtdb.php";
require_once __ROOT__ . "/inc/commons/url.php";
require_once __ROOT__ . "/inc/commons/objectsearch.php";
require_once __ROOT__ . "/inc/db_nugetpackagesentity.php";
define('__MYTXTDB_PKG__', Path::Combine(Settings::$DataRoot, "nugetdb_pkg.txt"));
define('__MYTXTDBROWS_PKG__', "Version:|:Title:|:Id:|:Author:|:IconUrl:|:LicenseUrl:|:ProjectUrl:|:DownloadCount:|:" . "RequireLicenseAcceptance:|:Description:|:ReleaseNotes:|:Published:|:Dependencies:|:" . "PackageHash:|:PackageHashAlgorithm:|:PackageSize:|:Copyright:|:Tags:|:IsAbsoluteLatestVersion:|:" . "IsLatestVersion:|:Listed:|:VersionDownloadCount:|:References:|:TargetFramework:|:Summary:|:IsPreRelease:|:Owners:|:UserId");
define('__MYTXTDBROWS_PKG_TYPES__', "string:|:string:|:string:|:object:|:string:|:string:|:string:|:number:|:" . "boolean:|:string:|:string:|:date:|:object:|:" . "string:|:string:|:number:|:string:|:string:|:boolean:|:" . "boolean:|:boolean:|:number:|:array:|:string:|:string:|:boolean:|:string:|:string");
define('__MYTXTDBROWS_PKG_EDITABLE__', "Tags:|:IsAbsoluteLatestVersion:|:Title:|:Title:|:IconUrl:|:LicenseUrl:|:ProjectUrl:|:" . "RequireLicenseAcceptance:|:Description:|:ReleaseNotes:|:Copyright:|:" . "IsLatestVersion:|:Listed:|:TargetFramework:|:Summary:|:IsPreRelease:|:Owners:|:UserId");
function nugetDbPackageBuilder()
{
return new PackageDescriptor();
}
class NuGetDb
{
public function EntityName()
{
return "PackageDescriptor";
}
public function NuGetDb()
{
$this->initialize();
}
private function initialize()
{
}
public static function RowTypes()
{
示例11: trim
public static $MaxUploadBytes = __MAXUPLOAD_BYTES__;
public static $Version = "3.0.12.2";
public static $ResultsPerPage = __RESULTS_PER_PAGE__;
public static $SiteRoot = __SITE_ROOT__;
public static $DataRoot = "";
public static $PackagesRoot = "";
public static $SitePath = "";
public static $AdminId = "";
public static $AdminPassword = "";
public static $AdminEmail = "";
public static $AllowUserAdd = false;
public static $LimitUsersPackages = false;
}
Settings::$SitePath = Path::CleanUp(__ROOT__);
Settings::$DataRoot = Path::Combine(Settings::$SitePath, __DATABASE_DIR__);
Settings::$PackagesRoot = Path::Combine(Settings::$SitePath, __UPLOAD_DIR__);
Settings::$PackageHash = __PACKAGEHASH__;
Settings::$MaxUploadBytes = __MAXUPLOAD_BYTES__;
$sr = trim(__SITE_ROOT__, "/\\");
if ($sr != "") {
Settings::$SiteRoot = "/" . $sr . "/";
} else {
Settings::$SiteRoot = "/";
}
Settings::$AllowUserAdd = __ALLOWUSERADD__;
Settings::$AdminId = __ADMINID__;
Settings::$AdminPassword = __ADMINPASSWORD__;
Settings::$AdminEmail = __ADMINMAIL__;
Settings::$LimitUsersPackages = __LIMITUSERSPACKAGES__;
if (!is_dir(Settings::$DataRoot)) {
mkdir(Settings::$DataRoot, __RW_ADMIN_R_ALL__);
示例12: picture_GenerateFileName_insert
public function picture_GenerateFileName_insert(&$filepath, &$handled, $original_file_name, $original_file_extension, $file_size)
{
$targetFolder = FormatDatasetFieldsTemplate($this->GetDataset(), 'images');
FileUtils::ForceDirectories($targetFolder);
$filename = ApplyVarablesMapToTemplate('%original_file_name%', array('original_file_name' => $original_file_name, 'original_file_extension' => $original_file_extension, 'file_size' => $file_size));
$filepath = Path::Combine($targetFolder, $filename);
$handled = true;
}
示例13: UserDb
$r["@HtAccess.V1@"] = Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/htaccess.v1"), $r);
$r["@HtAccess.V2@"] = Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/htaccess.v2"), $r);
$r["@HtAccess.V3@"] = Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/htaccess.v3"), $r);
//Write the root htacces
Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/htaccess.root", $r), $r, Path::Combine(__ROOT__, ".htaccess"));
echo "<li>Htaccess initialized with path '" . $r["@ApplicationPath@"] . "'.</li>";
//Setup the web.config for api v2 and v1
$r["@WebConfig.PHPEXE@"] = UrlUtils::GetRequestParamOrDefault("phpCgi", "", "post");
$r["@WebConfig.V1@"] = Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/webconfig.v1"), $r);
$r["@WebConfig.V2@"] = Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/webconfig.v2"), $r);
$r["@WebConfig.V3@"] = Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/webconfig.v3"), $r);
//Write the root web.config
if ($r["@WebConfig.PHPEXE@"] != "") {
Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/webconfig.root", $r), $r, Path::Combine(__ROOT__, "web.config"));
} else {
Utils::ReplaceInFile(Path::Combine(__ROOT__, "inc/setup/webconfignophpexe.root", $r), $r, Path::Combine(__ROOT__, "web.config"));
}
echo "<li>Web.config initialized with path '" . $r["@ApplicationPath@"] . "'.</li>";
require_once __ROOT__ . "/settings.php";
require_once __ROOT__ . "/inc/db_users.php";
$usersDb = new UserDb();
//Create user
$userEntity = new UserEntity();
$userEntity->UserId = $r["@AdminUserId@"];
$userEntity->Md5Password = md5($r["@AdminPassword@"]);
$userEntity->Enabled = "true";
$userEntity->Admin = "true";
$userEntity->Name = "Administrator";
$userEntity->Company = "";
$userEntity->Email = $r["@AdminEmail@"];
$usersDb->AddRow($userEntity, true);
示例14: MoveTo
/**
* moves the temporary, uploaded file to another destination
* @param string $targetFolder The target folder
* @param string $targetFilename If omitted, the user given file name is taken
*/
function MoveTo($targetFolder, $targetFilename = '')
{
if (!$targetFilename) {
$targetFilename = $this->Filename();
}
$destination = Path::Combine($targetFolder, $targetFilename);
$result = @move_uploaded_file($this->TempPath(), $destination);
if (!$result) {
throw new \Exception('Uploaded file could not be moved to target');
}
}
示例15: SaveNuspec
public function SaveNuspec($nupkgFile, $e)
{
global $loginController;
$nugetDb = new NuGetDb();
$os = new PhpNugetObjectSearch();
$query = "Id eq '" . $e->Id . "' orderby Version desc";
$os->Parse($query, $nugetDb->GetAllColumns());
$res = $nugetDb->GetAllRows(999999, 0, $os);
if (sizeof($res) > 0 && !$loginController->Admin) {
$id = $res[0]->UserId;
if ($id != $e->UserId) {
throw new Exception("Unauthorized!");
}
} else {
if (sizeof($res) > 0 && $loginController->Admin) {
$e->UserId = $res[0]->UserId;
}
}
$e->IsPreRelease = indexOf($e->Version, "-") > 0;
if ($nugetDb->AddRow($e, false)) {
$destination = Path::Combine(Settings::$PackagesRoot, $e->Id . "." . $e->Version . ".nupkg");
if (strtolower($nupkgFile) != strtolower($destination)) {
if (file_exists($destination)) {
unlink($destination);
}
rename($nupkgFile, $destination);
}
} else {
if (strtlower($nupkgFile) != strtlower($destination)) {
if (file_exists($nupkgFile)) {
unlink($nupkgFile);
}
}
}
}