当前位置: 首页>>代码示例>>PHP>>正文


PHP Site::resolvePath方法代码示例

本文整理汇总了PHP中Site::resolvePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::resolvePath方法的具体用法?PHP Site::resolvePath怎么用?PHP Site::resolvePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Site的用法示例。


在下文中一共展示了Site::resolvePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: httpGetInterceptor

 public function httpGetInterceptor($method, $uri)
 {
     if ($method !== 'GET' || DevelopRequestHandler::getResponseMode() != 'json') {
         return true;
     }
     $pathParts = \Site::splitPath($uri);
     $rootPath = RootCollection::filterName($pathParts[0]);
     if (count($pathParts) && array_key_exists($rootPath, RootCollection::$siteDirectories)) {
         $className = RootCollection::$siteDirectories[$rootPath];
         $node = new $className($pathParts[0]);
         if (count($pathParts) > 1) {
             $node = $node->resolvePath(array_splice($pathParts, 1));
         }
     } else {
         $node = \Site::resolvePath($uri, false);
     }
     if (!$node) {
         throw new \Sabre\DAV\Exception\FileNotFound();
     }
     $children = array();
     foreach ($node->getChildren() as $child) {
         $children[] = $child->getData();
     }
     $this->server->httpResponse->sendStatus(200);
     $this->server->httpResponse->setHeader('Content-Type', 'application/json');
     $this->server->httpResponse->sendBody(json_encode(array('path' => $uri, 'children' => $children)));
     return false;
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:28,代码来源:ServerPlugin.php

示例2: handleRequest

 public static function handleRequest()
 {
     // build file path
     $filePath = Site::$pathStack;
     array_unshift($filePath, static::$libraryCollection);
     // try to get node
     $fileNode = Site::resolvePath($filePath);
     if ($fileNode) {
         $fileNode->outputAsResponse();
     } else {
         Site::respondNotFound('Resource not found');
     }
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:13,代码来源:ExtLibraryRequestHandler.class.php

示例3: loadPlugin

 public function loadPlugin($pluginName, $forceRehash = true)
 {
     if ($pluginName == 'array') {
         $pluginName = 'helper.array';
     }
     foreach (static::$searchPaths as $path) {
         if ($pluginNode = \Site::resolvePath("dwoo-plugins/{$path}{$pluginName}.php")) {
             break;
         }
     }
     if ($pluginNode && file_exists($pluginNode->RealPath)) {
         require $pluginNode->RealPath;
     } else {
         throw new \Dwoo_Exception('Plugin "' . $pluginName . '" can not be found in the Emergence VFS.');
     }
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:16,代码来源:PluginLoader.php

示例4: handleRequest

 public static function handleRequest()
 {
     if (!($accessKey = Site::getHostConfig('AccessKey'))) {
         Site::respondUnauthorized('Remote emergence access is disabled');
     } elseif (empty($_REQUEST['accessKey']) || $_REQUEST['accessKey'] != $accessKey) {
         Site::respondUnauthorized('Remote emergence access denied');
     }
     //Debug::dumpVar(Site::$requestPath, false);
     //Debug::dumpVar(Site::$pathStack, false);
     if ($node = Site::resolvePath(Site::$pathStack, false)) {
         //Debug::dumpVar($node);
         //header('X-Emergence-Site-ID: '.static::$ID);
         if (method_exists($node, 'outputAsResponse')) {
             $node->outputAsResponse();
         } else {
             Site::respondBadRequest();
         }
     } else {
         Site::respondNotFound('File not found');
     }
 }
开发者ID:JarvusInnovations,项目名称:Emergence-preview,代码行数:21,代码来源:Emergence.class.php

示例5: handleRequest

 public static function handleRequest()
 {
     if (extension_loaded('newrelic')) {
         newrelic_disable_autorum();
     }
     if (!Site::getConfig('inheritance_key')) {
         Site::respondUnauthorized('Remote emergence access is disabled');
     } elseif (empty($_REQUEST['accessKey']) || $_REQUEST['accessKey'] != Site::getConfig('inheritance_key')) {
         // attempt to authenticate via developer session
         if (!UserSession::getFromRequest()->hasAccountLevel('Developer')) {
             Site::respondUnauthorized('Remote emergence access denied');
         }
     }
     if ($_REQUEST['remote'] == 'parent') {
         set_time_limit(1800);
         $remoteParams = array();
         if (!empty($_REQUEST['exclude'])) {
             $remoteParams['exclude'] = $_REQUEST['exclude'];
         }
         HttpProxy::relayRequest(array('url' => static::buildUrl(Site::$pathStack, $remoteParams), 'autoAppend' => false, 'autoQuery' => false, 'timeout' => 500));
     }
     if (empty(Site::$pathStack[0])) {
         return static::handleTreeRequest();
     } elseif ($node = Site::resolvePath(Site::$pathStack)) {
         if (method_exists($node, 'outputAsResponse')) {
             $node->outputAsResponse(true);
         } elseif (is_a($node, 'SiteCollection')) {
             return static::handleTreeRequest($node);
         } else {
             Site::respondBadRequest();
         }
     } else {
         header('HTTP/1.0 404 Not Found');
         die('File not found');
     }
 }
开发者ID:JarvusInnovations,项目名称:Emergence,代码行数:36,代码来源:Emergence.class.php

示例6: die

// check if there is an existing repo
if (!is_dir("{$repoPath}/.git")) {
    die("{$repoPath} does not contain .git");
}
// get repo
chdir($repoPath);
// sync trees
foreach ($repoCfg['trees'] as $srcPath => $treeOptions) {
    if (is_string($treeOptions)) {
        $treeOptions = array('path' => $treeOptions);
    }
    $treeOptions = array_merge($exportOptions, $treeOptions, ['dataPath' => false]);
    if (!is_string($srcPath)) {
        $srcPath = $treeOptions['path'];
    } elseif (!$treeOptions['path']) {
        $treeOptions['path'] = $srcPath;
    }
    $srcFileNode = Site::resolvePath($srcPath);
    if (is_a($srcFileNode, 'SiteFile')) {
        $destDir = dirname($treeOptions['path']);
        if ($destDir && !is_dir($destDir)) {
            mkdir($destDir, 0777, true);
        }
        copy($srcFileNode->RealPath, $treeOptions['path']);
        Benchmark::mark("exported file {$srcPath} to {$treeOptions['path']}");
    } else {
        $exportResult = Emergence_FS::exportTree($srcPath, $treeOptions['path'], $treeOptions);
        Benchmark::mark("exported directory {$srcPath} to {$treeOptions['path']}: " . http_build_query($exportResult));
    }
}
Benchmark::mark("wrote all changes");
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:31,代码来源:export.php

示例7: http_build_query

Benchmark::mark("exported {$appPath} to {$appTmpPath}: " . http_build_query($exportResult));
// ... last production build
mkdir($buildTmpPath, 0777, true);
$exportResult = Emergence_FS::exportTree($buildPath, $buildTmpPath);
Benchmark::mark("exported {$buildPath} to {$buildTmpPath}: " . http_build_query($exportResult));
// write any libraries from classpath
$classPaths = explode(',', $App->getBuildCfg('app.classpath'));
foreach ($classPaths as $classPath) {
    if (strpos($classPath, '${workspace.dir}/x/') === 0) {
        $extensionPath = substr($classPath, 19);
        $classPathSource = "ext-library/{$extensionPath}";
        $classPathDest = "{$tmpPath}/x/{$extensionPath}";
        Benchmark::mark("importing classPathSource: {$classPathSource}");
        #		$cachedFiles = Emergence_FS::cacheTree($classPathSource);
        #		Benchmark::mark("precached $cachedFiles files in $classPathSource");
        $sourceNode = Site::resolvePath($classPathSource);
        if (is_a($sourceNode, SiteFile)) {
            mkdir(dirname($classPathDest), 0777, true);
            copy($sourceNode->RealPath, $classPathDest);
            Benchmark::mark("copied file {$classPathSource} to {$classPathDest}");
        } else {
            $exportResult = Emergence_FS::exportTree($classPathSource, $classPathDest);
            Benchmark::mark("exported {$classPathSource} to {$classPathDest}: " . http_build_query($exportResult));
        }
    }
}
// write archive
if (!empty($_GET['archive'])) {
    try {
        $exportResult = Emergence_FS::exportTree($archivePath, $archiveTmpPath);
        Benchmark::mark("exported {$archivePath} to {$archiveTmpPath}: " . http_build_query($exportResult));
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:31,代码来源:sass-build.php

示例8: getSourceNodes

 public static function getSourceNodes($paths, $root, $contentType = null)
 {
     $paths = static::splitMultipath($paths);
     if (is_string($root)) {
         $root = Site::splitPath($root);
     }
     $sourceFiles = array();
     foreach ($paths as $path) {
         $path = array_merge($root, $path);
         list($filename) = array_slice($path, -1);
         if ($filename == '*') {
             array_pop($path);
             Emergence_FS::cacheTree($path);
             foreach (Emergence_FS::getTreeFiles($path, false, $contentType ? array('Type' => $contentType) : null) as $path => $fileData) {
                 $sourceFiles[$path] = $fileData;
             }
         } else {
             $node = Site::resolvePath($path);
             if (!$node || !is_a($node, 'SiteFile')) {
                 throw new Exception('Source file "' . implode('/', $path) . '" does not exist', self::ERROR_NOT_FOUND);
             }
             if ($node->Type != $contentType) {
                 throw new Exception('Source file "' . implode('/', $path) . '" does not match requested content type "' . $contentType . '"', self::ERROR_TYPE_MISMATCH);
             }
             $sourceFiles[join('/', $path)] = array('ID' => $node->ID, 'SHA1' => $node->SHA1);
         }
     }
     return $sourceFiles;
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:29,代码来源:MinifiedRequestHandler.class.php

示例9: set_time_limit

<?php

$GLOBALS['Session']->requireAccountLevel('Developer');
set_time_limit(0);
RequestHandler::$responseMode = 'json';
if (empty($_REQUEST['path'])) {
    RequestHandler::throwError('path required');
}
if (empty($_REQUEST['host'])) {
    RequestHandler::throwError('host required');
}
if (!($sourceCollection = Site::resolvePath($_REQUEST['path']))) {
    RequestHandler::throwError('path not found locally');
}
// create stream context for remote server
$syncer = new EmergenceSyncer(array('host' => $_REQUEST['host'], 'authUsername' => $_SERVER['PHP_AUTH_USER'], 'authPassword' => $_SERVER['PHP_AUTH_PW']));
$diff = $syncer->diffCollection($sourceCollection, !empty($_REQUEST['deep']));
if (empty($_REQUEST['push'])) {
    RequestHandler::respond('diff', array('diff' => $diff));
} else {
    $result = $syncer->pushDiff($diff);
    RequestHandler::respond('pushComplete', array('result' => $result));
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:23,代码来源:emergence-push.php

示例10: foreach

$repo->git("pull origin {$repoCfg['workingBranch']}");
Benchmark::mark("pulled from origin/{$repoCfg['workingBranch']}");
// sync trees
foreach ($repoCfg['trees'] as $srcPath => $treeOptions) {
    if (is_string($treeOptions)) {
        $treeOptions = array('path' => $treeOptions);
    }
    if (!is_string($srcPath)) {
        $srcPath = $treeOptions['path'];
    } elseif (!$treeOptions['path']) {
        $treeOptions['path'] = $srcPath;
    }
    $treeOptions['exclude'][] = '#(^|/)\\.git(/|$)#';
    if (is_file($treeOptions['path'])) {
        $sha1 = sha1_file($treeOptions['path']);
        $existingNode = Site::resolvePath($srcPath);
        if (!$existingNode || $existingNode->SHA1 != $sha1) {
            $fileRecord = SiteFile::createFromPath($srcPath, null, $existingNode ? $existingNode->ID : null);
            SiteFile::saveRecordData($fileRecord, fopen($treeOptions['path'], 'r'), $sha1);
            Benchmark::mark("importing file {$srcPath} from {$treeOptions['path']}");
        } else {
            Benchmark::mark("skipped unchanged file {$srcPath} from {$treeOptions['path']}");
        }
    } else {
        $cachedFiles = Emergence_FS::cacheTree($srcPath);
        Benchmark::mark("precached {$srcPath}: " . $cachedFiles);
        $exportResult = Emergence_FS::importTree($treeOptions['path'], $srcPath, $treeOptions);
        Benchmark::mark("importing directory {$srcPath} from {$treeOptions['path']}: " . http_build_query($exportResult));
    }
}
// commit changes
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:31,代码来源:pull.php

示例11: getAsset

 public function getAsset($filePath, $useCache = true)
 {
     if (is_string($filePath)) {
         $filePath = Site::splitPath($filePath);
     }
     $appName = $this->getName();
     $framework = $this->getFramework();
     $frameworkVersion = $this->getFrameworkVersion();
     if ($filePath[0] == 'x') {
         array_shift($filePath);
         array_unshift($filePath, 'ext-library');
     } elseif ($filePath[0] == 'sdk' || $filePath[0] == $framework) {
         array_shift($filePath);
         array_unshift($filePath, 'sencha-workspace', "{$framework}-{$frameworkVersion}");
     } elseif ($filePath[0] == 'packages') {
         array_shift($filePath);
         array_unshift($filePath, 'sencha-workspace', 'packages');
     } elseif ($filePath[0] == 'microloaders') {
         array_shift($filePath);
         array_unshift($filePath, 'sencha-workspace', 'microloaders', $framework);
     } elseif ($filePath[0] == 'build') {
         if ($filePath[1] == 'sdk' || $filePath[1] == $framework) {
             array_shift($filePath);
             array_shift($filePath);
             array_unshift($filePath, 'sencha-workspace', "{$framework}-{$frameworkVersion}");
         } else {
             array_shift($filePath);
             array_unshift($filePath, 'sencha-build', $appName);
         }
     } else {
         array_unshift($filePath, 'sencha-workspace', $appName);
     }
     return Site::resolvePath($filePath, true, $useCache);
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:34,代码来源:Sencha_App.class.php

示例12: array

<?php

$GLOBALS['Session']->requireAccountLevel('Developer');
$requestData = JSON::getRequestData();
if (!is_array($requestData['nodes'])) {
    JSON::error('Expecting array under nodes key');
}
// TODO: something more elegant to prevent non-specified classes from being inherited?
Site::$autoPull = true;
$succeeded = array();
$failed = array();
foreach ($requestData['nodes'] as $updateData) {
    $Node = Site::resolvePath($updateData['path']);
    if ($Node->Collection->Site == 'Local') {
        $failed[] = array('path' => $updateData['path'], 'error' => 'CURRENT_IS_LOCAL', 'message' => 'Current node is local and blocks any remote updates');
        continue;
    }
    if ($Node->SHA1 != $updateData['localSHA1']) {
        $failed[] = array('path' => $updateData['path'], 'error' => 'LOCAL_SHA1_MISMATCH', 'message' => 'Current node\'s SHA1 hash does not match that which this update was requested for');
        continue;
    }
    if (empty($updateData['remoteSHA1'])) {
        $Node->delete();
    } else {
        $NewNode = Emergence::resolveFileFromParent($Node->Collection, $Node->Handle, true);
        if (!$NewNode) {
            $failed[] = array('path' => $updateData['path'], 'error' => 'DOWNLOAD_FAILED', 'message' => 'The remote file failed to download');
            continue;
        }
        if ($NewNode->SHA1 != $updateData['remoteSHA1']) {
            $NewNode->destroyRecord();
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:31,代码来源:pull-remote-changes.php

示例13: handleCacheManifestRequest

 public static function handleCacheManifestRequest(Sencha_App $App)
 {
     $templateNode = Emergence\Dwoo\Template::findNode($App->getFramework() . '.tpl');
     $cacheConfig = $App->getAppCfg('appCache');
     header('Content-Type: text/cache-manifest');
     echo "CACHE MANIFEST\n";
     echo "# {$templateNode->SHA1}\n";
     if (!empty($cacheConfig['cache']) && is_array($cacheConfig['cache'])) {
         foreach ($cacheConfig['cache'] as $path) {
             if ($path != 'index.html') {
                 $path = "build/production/{$path}";
                 echo "{$path}\n";
                 if ($assetNode = $App->getAsset($path)) {
                     echo "#{$assetNode->SHA1}\n";
                 }
             }
         }
     }
     if (!empty($_GET['platform']) && !empty($cacheConfig['platformCache']) && !empty($cacheConfig['platformCache'][$_GET['platform']]) && is_array($cacheConfig['platformCache'][$_GET['platform']])) {
         echo "\n# {$_GET['platform']}:\n";
         foreach ($cacheConfig['platformCache'][$_GET['platform']] as $path) {
             $path = "build/production/{$path}";
             if ($assetNode = $App->getAsset($path)) {
                 echo "{$path}\n";
                 echo "#{$assetNode->SHA1}\n";
             }
         }
     }
     echo "\nFALLBACK:\n";
     if (!empty($cacheConfig['fallback']) && is_array($cacheConfig['fallback'])) {
         foreach ($cacheConfig['fallback'] as $path) {
             echo "{$path}\n";
         }
     }
     echo "\nNETWORK:\n";
     if (!empty($cacheConfig['network']) && is_array($cacheConfig['network'])) {
         foreach ($cacheConfig['network'] as $path) {
             echo "{$path}\n";
         }
     }
     echo "\n# TRIGGERS:\n";
     $templateNode = Emergence\Dwoo\Template::findNode($App->getFramework() . '.tpl');
     echo "#template: {$templateNode->SHA1}\n";
     if (!empty($cacheConfig['triggers']) && is_array($cacheConfig['triggers'])) {
         foreach ($cacheConfig['triggers'] as $path) {
             $assetNode = $path[0] == '/' ? Site::resolvePath($path) : $App->getAsset($path);
             if ($assetNode) {
                 echo "#{$assetNode->SHA1}\n";
             }
         }
     }
     exit;
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:53,代码来源:Sencha_RequestHandler.class.php

示例14: getWorkspaceCfg

 public static function getWorkspaceCfg($key = null)
 {
     if (!static::$_workspaceCfg) {
         // get from filesystem
         $configPath = array('sencha-workspace', '.sencha', 'workspace', 'sencha.cfg');
         if ($configNode = Site::resolvePath($configPath, true, false)) {
             static::$_workspaceCfg = Sencha::loadProperties($configNode->RealPath);
         } else {
             static::$_workspaceCfg = array();
         }
     }
     return $key ? static::$_workspaceCfg[$key] : static::$_workspaceCfg;
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:13,代码来源:Sencha.class.php

示例15: die

<?php

if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    die('POST method required');
}
$GLOBALS['Session']->requireAccountLevel('Developer');
set_time_limit(0);
Benchmark::startLive();
// get requested test suite
$testSuite = empty($_GET['suite']) ? 'emergence.read-only' : $_GET['suite'];
// set paths
$testsPath = "phpunit-tests";
$suitePath = "{$testsPath}/{$testSuite}";
if (!Site::resolvePath($suitePath)) {
    die('Requested test suite not found');
}
// get temporary directory and set paths
$tmpPath = Emergence_FS::getTmpDir();
$suiteTmpPath = "{$tmpPath}/{$testSuite}";
$configTmpPath = "{$tmpPath}/phpunit.xml";
Benchmark::mark("created tmp: {$tmpPath}");
// export tests
Emergence_FS::cacheTree($suitePath);
$exportResult = Emergence_FS::exportTree($suitePath, $suiteTmpPath);
Benchmark::mark("exported {$suitePath} to {$suiteTmpPath}: " . http_build_query($exportResult));
// write phpunit configuration
$timezone = date_default_timezone_get();
// bootstrap path
$bootstrapPath = dirname($_SERVER['SCRIPT_FILENAME']) . '/phpunit.php';
file_put_contents($configTmpPath, <<<EOT
<?xml version="1.0" encoding="UTF-8" ?>
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:31,代码来源:run.php


注:本文中的Site::resolvePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。