本文整理汇总了PHP中PhabricatorEnv::getCDNURI方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEnv::getCDNURI方法的具体用法?PHP PhabricatorEnv::getCDNURI怎么用?PHP PhabricatorEnv::getCDNURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorEnv
的用法示例。
在下文中一共展示了PhabricatorEnv::getCDNURI方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$root = dirname(phutil_get_library_root('phabricator'));
require_once $root . '/support/phame/libskin.php';
$this->cssResources = array();
$css = $this->getPath('css/');
if (Filesystem::pathExists($css)) {
foreach (Filesystem::listDirectory($css) as $path) {
if (!preg_match('/.css$/', $path)) {
continue;
}
$this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $this->getResourceURI('css/' . $path)));
}
}
$map = CelerityResourceMap::getNamedInstance('phabricator');
$resource_symbol = 'syntax-highlighting-css';
$resource_uri = $map->getURIForSymbol($resource_symbol);
$this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => PhabricatorEnv::getCDNURI($resource_uri)));
$this->cssResources = phutil_implode_html("\n", $this->cssResources);
$request = $this->getRequest();
// Render page parts in order so the templates execute in order, if we're
// using templates.
$header = $this->renderHeader();
$content = $this->renderContent($request);
$footer = $this->renderFooter();
if (!$content) {
$content = $this->render404Page();
}
$content = array($header, $content, $footer);
$response = new AphrontWebpageResponse();
$response->setContent(phutil_implode_html("\n", $content));
return $response;
}
示例2: getViewURI
public function getViewURI()
{
if (!$this->getPHID()) {
throw new Exception("You must save a file before you can generate a view URI.");
}
$name = phutil_escape_uri($this->getName());
$path = '/file/data/' . $this->getSecretKey() . '/' . $this->getPHID() . '/' . $name;
return PhabricatorEnv::getCDNURI($path);
}
示例3: getProfileImageVersion
/**
* Get a version identifier for a user's profile image.
*
* This version will change if the image changes, or if any of the
* environment configuration which goes into generating a URI changes.
*
* @return string Cache version.
* @task image-cache
*/
private function getProfileImageVersion()
{
$parts = array(PhabricatorEnv::getCDNURI('/'), PhabricatorEnv::getEnvConfig('cluster.instance'), $this->getProfileImagePHID());
$parts = serialize($parts);
return PhabricatorHash::digestForIndex($parts);
}
示例4: getURI
public function getURI(CelerityResourceMap $map, $name, $use_primary_domain = false)
{
$uri = $map->getURIForName($name);
// If we have a postprocessor selected, add it to the URI.
$postprocessor_key = $this->getPostprocessorKey();
if ($postprocessor_key) {
$uri = preg_replace('@^/res/@', '/res/' . $postprocessor_key . 'X/', $uri);
}
// In developer mode, we dump file modification times into the URI. When a
// page is reloaded in the browser, any resources brought in by Ajax calls
// do not trigger revalidation, so without this it's very difficult to get
// changes to Ajaxed-in CSS to work (you must clear your cache or rerun
// the map script). In production, we can assume the map script gets run
// after changes, and safely skip this.
if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
$mtime = $map->getModifiedTimeForName($name);
$uri = preg_replace('@^/res/@', '/res/' . $mtime . 'T/', $uri);
}
if ($use_primary_domain) {
return PhabricatorEnv::getURI($uri);
} else {
return PhabricatorEnv::getCDNURI($uri);
}
}
示例5: getTransformedURI
private function getTransformedURI($transform)
{
$parts = array();
$parts[] = 'file';
$parts[] = 'xform';
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
if (strlen($instance)) {
$parts[] = '@' . $instance;
}
$parts[] = $transform;
$parts[] = $this->getPHID();
$parts[] = $this->getSecretKey();
$path = implode('/', $parts);
$path = $path . '/';
return PhabricatorEnv::getCDNURI($path);
}
示例6: getResourceURI
public final function getResourceURI($resource)
{
$root = $this->getSpecification()->getRootDirectory();
$path = $root . DIRECTORY_SEPARATOR . $resource;
$data = Filesystem::readFile($path);
$hash = PhabricatorHash::digest($data);
$hash = substr($hash, 0, 6);
$id = $this->getBlog()->getID();
$uri = '/phame/r/' . $id . '/' . $hash . '/' . $resource;
$uri = PhabricatorEnv::getCDNURI($uri);
return $uri;
}