本文整理汇总了PHP中PSU::cdn方法的典型用法代码示例。如果您正苦于以下问题:PHP PSU::cdn方法的具体用法?PHP PSU::cdn怎么用?PHP PSU::cdn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSU
的用法示例。
在下文中一共展示了PSU::cdn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cdn_postprocess
function cdn_postprocess($css)
{
$file = $_SERVER['SCRIPT_FILENAME'];
$css_dir = dirname($file);
if (!preg_match_all('/url\\s*\\(\\s*[\'"]?(.+?)[\'"]?\\s*\\)/', $css, $matches, PREG_PATTERN_ORDER)) {
return $css;
}
$paths = $matches[1];
$css_footer = "\n/*\ncss.prepend.php translations:\n\n";
$search = array();
$replace = array();
foreach ($paths as $index => $path) {
$orig_path = $path;
$orig_match = $matches[0][$index];
if (isset($search[$orig_match])) {
continue;
}
$path = cdn_relative_path($css_dir, $path);
$path = PSU::cdn($path, $file);
if ($path != $orig_path) {
$search[$orig_match] = $orig_match;
// the complete original match
$replace[$orig_match] = 'url(' . $path . ')';
}
}
foreach ($search as $key => $path) {
$css_footer .= "{$path} -> " . $replace[$key] . "\n";
}
$css_footer .= "*/";
$css = str_replace($search, $replace, $css);
if (false) {
$css .= $css_footer;
}
return $css;
}
示例2: ignore_user_abort
ignore_user_abort(true);
// Call Log Web Home
$HOST = 'https://' . $_SERVER['SERVER_NAME'];
$GLOBALS['BASE_URL'] = $HOST . '/webapp/calllog';
$GLOBALS['BASE_DIR'] = __DIR__;
define('CALL_LOG_WEB_HOME', $GLOBALS['BASE_URL']);
$GLOBALS['DEVELOPMENT'] = PSU::isdev();
$GLOBALS['uploads'] = '/web/uploads/webapp/calllog/attachments';
// Call Log Administrative Web Home
define('TEMPLATE_DIR', __DIR__ . '/templates');
define('TEMPLATE_ADMIN_DIR', TEMPLATE_DIR . '/admin');
$GLOBALS['TEMPLATES'] = TEMPLATE_DIR;
// Absolute Path To Cascading Style Sheet (CSS) Files
define('CSS_DIR', __DIR__ . '/css');
// Web Path To CSS Files
define('CSS_WEB_DIR', PSU::cdn($GLOBALS['BASE_URL'] . '/css'));
$GLOBALS['CSS_WEB_DIR'] = CSS_WEB_DIR;
// Web Path To JS Files
define('JS_WEB_DIR', $GLOBALS['BASE_URL'] . '/js');
$GLOBALS['JS_WEB_DIR'] = JS_WEB_DIR;
$GLOBALS['HELPDESK_EMAIL'] = 'helpdesk@plymouth.edu';
define('INCLUDES_DIR', __DIR__ . '/includes');
define('FUNCTIONS_DIR', INCLUDES_DIR . '/functions');
// Callog functions
$INCLUDES = __DIR__ . "/includes";
// use the include variable to reference all app specific includes
$IMAGES = $GLOBALS['BASE_URL'] . '/images';
// End variable definitions
define('MAGPIE_CACHE_ON', false);
require_once 'magpierss/rss_fetch.inc';
require_once 'functions.php';
示例3: __construct
/**
* __construct
*
* Initial object setup.
*
* @param string|boolean $uid_or_auto indicates how cache and template directories should be set. uid specifies a unique id to build names, true generates paths automatically. leave blank or false to specify these paths yourself.
*/
function __construct($params = null, $fluid = false, $uid_or_auto = true)
{
static::$GLOBAL_STYLE = PSU_BASE_DIR . '/app/core/templates';
parent::__construct($uid_or_auto);
if ($_SESSION['impersonate']) {
\PSU::get('log/impersonate')->write('Impersonation' . (\PSU::isDev() ? ' on dev server' : '') . ': accessing ' . $_SERVER['REQUEST_URI'] . ($_SERVER['HTTP_REFERER'] ? ' via ' . $_SERVER['HTTP_REFERER'] : ''), $_SESSION['username'], serialize($_REQUEST));
}
//end if
if ($GLOBALS['TEMPLATES']) {
$this->template_dir = $GLOBALS['TEMPLATES'];
}
if (!isset($GLOBALS['USE_APPLICATION_STYLE'])) {
$GLOBALS['USE_APPLICATION_STYLE'] = true;
}
if ($params) {
parse_str($params, $params);
$key = key($params);
if (!$params[$key]) {
$params['page_title'] = str_replace('_', ' ', $key);
}
//end if
}
//end if
$this->page_title = $params['page_title'];
$this->app_title = $params['app_title'] ? $params['app_title'] : ($GLOBALS['TITLE'] ? $GLOBALS['TITLE'] : 'PSU Webapp');
$this->fluid = $params['fluid'] ? $params['fluid'] : $fluid;
// register any custom functions
$this->register_block('box', array($this, 'psu_box'));
$this->register_block('col', array($this, 'psu_col'));
$this->register_block('message', array($this, 'psu_message'));
$this->register_modifier('yesno', array($this, 'yesno'));
$this->register_modifier('pluralize', array($this, 'pluralize'));
$this->register_modifier('query_string', 'http_build_query');
$this->register_function('myrel_access', array($this, 'myrel_access'));
$this->register_function('myrel_list', array($this, 'myrel_list'));
$this->register_function('randomid', array($this, 'randomid'));
$this->register_function('nav', array($this, 'nav'));
$this->register_function('navselect', array($this, 'navselect'));
$this->register_modifier('bool2str', array($this, 'bool2str'));
$this->content_classes = array(\PSU::isDev() ? 'webapp-dev' : 'webapp-prod');
$this->body_style_classes = array();
$this->body_style_classes[] = strtolower('month-' . date('F'));
$this->body_style_classes[] = strtolower('weekday-' . date('l'));
$this->body_style_classes[] = 'week-' . date('W');
$this->body_style_classes[] = 'day-of-year-' . date('z');
$this->body_style_classes[] = 'day-of-month-' . date('j');
$this->body_style_classes[] = 'hour-' . date('H');
$this->body_style_classes[] = 'minute-' . date('i');
if ($_SESSION['username']) {
$this->body_style_classes[] = 'user-' . $_SESSION['username'];
}
//end if
if ($_SESSION['wp_id']) {
$this->body_style_classes[] = 'user-' . $_SESSION['wp_id'];
}
//end if
if ($GLOBALS['FANCY_TPL']) {
$this->body_style_classes[] = 'extra-tag-styles';
}
$this->assign('facebook_api', \PSU::fbAPI());
$this->assign('facebook_enable', $GLOBALS['FACEBOOK_ENABLE'] == true);
$go = new \go($_SESSION['wp_id'] ? $_SESSION['wp_id'] : $_SESSION['username']);
$hot_links = $go->cacheGetSites($_SESSION['wp_id'] || $_SESSION['username'] ? 'popular-me' : 'popular-everyone');
if (sizeof($hot_links) < 5 && $_SESSION['username']) {
$everyone_links = $go->cacheGetSites('popular-everyone');
$hot_links = array_merge($hot_links, $everyone_links);
$hot_links = array_unique($hot_links);
}
//end if
$this->assign('webapp_hot_links', $hot_links);
// cdn base url; omit trailing slash
$this->assign('cdn', substr(\PSU::cdn(), 0, -1));
if (\PSU::mobile() && $_COOKIE['psumobile'] != 'disable' || $_COOKIE['psumobile'] == 'force') {
$this->mobile = true;
}
//end if
}
示例4: cdn
/**
* Modify a link to point to the CDN.
*/
function cdn($url)
{
return PSU::cdn($url);
}