本文整理汇总了PHP中Redaxscript\Registry类的典型用法代码示例。如果您正苦于以下问题:PHP Registry类的具体用法?PHP Registry怎么用?PHP Registry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scriptsStart
/**
* scriptsStart
*
* @since 2.2.0
*/
public static function scriptsStart()
{
if (Registry::get('loggedIn') === Registry::get('token') && Registry::get('firstParameter') === 'admin') {
$output = '<script src="//google-analytics.com/ga.js"></script>';
echo $output;
}
}
示例2: render
/**
* render
*
* @since 2.2.0
*
* @param mixed $src
* @param array $options
*
* @return string
*/
public static function render($src = null, $options = array())
{
$output = null;
/* device related images */
if (is_array($src)) {
/* process source */
foreach ($src as $key => $value) {
if (in_array($key, self::$_config['device']) && Registry::get('my' . ucfirst($key))) {
$src = $value;
}
}
}
/* collect output */
if (file_exists($src)) {
$imageElement = new Html\Element();
$imageElement->init('img', array('alt' => $options['alt'], 'class' => self::$_config['className']['image'] . ' ' . $options['className'], 'src' => self::$_config['placeholder']));
/* collect output */
$output = $imageElement->copy()->attr('data-src', $src);
/* placeholder */
if (self::$_config['placeholder']) {
/* calculate image ratio */
$imageDimensions = getimagesize($src);
$imageRatio = $imageDimensions[1] / $imageDimensions[0] * 100;
/* placeholder */
$placeholderElement = new Html\Element();
$placeholderElement->init('div', array('class' => self::$_config['className']['placeholder'], 'style' => 'padding-bottom:' . $imageRatio . '%'));
/* collect output */
$output = $placeholderElement->html($output);
}
/* noscript fallback */
$output .= '<noscript>' . $imageElement . '</noscript>';
}
return $output;
}
示例3: centerStart
/**
* centerStart
*
* @since 2.2.0
*/
public static function centerStart()
{
if (Registry::get('firstParameter') === 'qunit') {
$output = '<div id="qunit" class="wrapper_qunit"></div><div id="qunit-fixture"></div>';
echo $output;
}
}
示例4: renderStart
/**
* renderStart
*
* @since 3.0.0
*/
public static function renderStart()
{
if (Registry::get('loggedIn') === Registry::get('token') && Registry::get('firstParameter') === 'admin') {
$script = Head\Script::getInstance();
$script->init('foot')->appendFile('//google-analytics.com/analytics.js')->appendFile('modules/CallHome/assets/scripts/init.js')->appendFile('modules/CallHome/assets/scripts/call_home.js');
}
}
示例5: scriptEnd
/**
* scriptEnd
*
* @since 2.6.0
*/
public static function scriptEnd()
{
if (Registry::get('loggedIn') === Registry::get('token')) {
$output = '<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script>';
echo $output;
}
}
示例6: _writeXML
/**
* @param object $categories
* @param object $articles
*
* @return string
*/
protected static function _writeXML($categories = null, $articles = null)
{
$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(true);
$writer->setIndentString(' ');
$writer->startDocument('1.0', Db::getSetting('charset'));
$writer->startElement('urlset');
$writer->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$writer->startElement('url');
$writer->writeElement('loc', Registry::get('root'));
$writer->endElement();
/* process categories */
foreach ($categories as $value) {
$writer->startElement('url');
$writer->writeElement('loc', Registry::get('root') . Registry::get('parameterRoute') . build_route('categories', $value->id));
$writer->writeElement('lastmod', date('c', strtotime($value->date)));
$writer->endElement();
}
/* process articles */
foreach ($articles as $value) {
$writer->startElement('url');
$writer->writeElement('loc', Registry::get('root') . Registry::get('parameterRoute') . build_route('articles', $value->id));
$writer->writeElement('lastmod', date('c', strtotime($value->date)));
$writer->endElement();
}
$writer->endElement();
$writer->endDocument();
return $writer->outputMemory(true);
}
示例7: renderTemplate
/**
* renderTemplate
*
* @since 3.0.0
*
* @return mixed
*/
public static function renderTemplate()
{
$registry = Registry::getInstance();
$request = Request::getInstance();
$language = Language::getInstance();
/* handle notification */
if (!is_dir(self::$_configArray['directory']) && !mkdir(self::$_configArray['directory'])) {
self::setNotification('error', $language->get('directory_not_found') . $language->get('colon') . ' ' . self::$_configArray['directory'] . $language->get('point'));
}
/* prevent as needed */
if ($request->getPost() || $registry->get('noCache')) {
return false;
}
/* cache as needed */
$cache = new Cache();
$cache->init(self::$_configArray['directory'], self::$_configArray['extension']);
$fullRoute = $registry->get('fullRoute');
/* load from cache */
if ($cache->validate($fullRoute, self::$_configArray['lifetime'])) {
$raw = $cache->retrieve($fullRoute);
$content = preg_replace('/' . self::$_configArray['tokenPlaceholder'] . '/', $registry->get('token'), self::_uncompress($raw));
return ['header' => function_exists('gzdeflate') ? 'content-encoding: deflate' : null, 'content' => self::_compress($content)];
} else {
$raw = Template\Tag::partial('templates/' . $registry->get('template') . '/index.phtml');
$content = preg_replace('/' . $registry->get('token') . '/', self::$_configArray['tokenPlaceholder'], $raw);
$cache->store($fullRoute, self::_compress($content));
return ['content' => $raw];
}
}
示例8: renderStart
/**
* renderStart
*
* @since 3.0.0
*/
public static function renderStart()
{
if (Registry::get('firstParameter') === 'tinymce' && Registry::get('secondParameter') === 'upload' && Registry::get('lastParameter') === Registry::get('token')) {
Registry::set('renderBreak', true);
echo self::_upload();
}
}
示例9: setUp
/**
* setUp
*
* @since 3.0.0
*/
public function setUp()
{
$this->_registry = Registry::getInstance();
$this->_request = Request::getInstance();
$this->_config = Config::getInstance();
$this->_configArray = $this->_config->get();
}
示例10: scriptsEnd
/**
* scriptsEnd
*
* @since 2.2.0
*/
public static function scriptsEnd()
{
if (!Registry::get('adminParameter')) {
$output = '<script src="' . self::$_config['apiUrl'] . '?key=' . self::$_config['apiKey'] . '&sensor=' . self::$_config['sensor'] . '"></script>';
echo $output;
}
}
示例11: contentFragmentEnd
/**
* contentFragmentEnd
*
* @since 3.0.0
*/
public static function contentFragmentEnd()
{
if (Registry::get('lastTable') === 'articles') {
$url = Registry::get('root') . Registry::get('parameterRoute') . Registry::get('fullRoute');
return self::render($url);
}
}
示例12: renderStart
/**
* renderStart
*
* @since 3.0.0
*/
public static function renderStart()
{
if (Registry::get('loggedIn') !== Registry::get('token')) {
$script = Head\Script::getInstance();
$script->init('foot')->appendFile('//google-analytics.com/analytics.js')->appendFile('modules/Analytics/assets/scripts/init.js')->appendFile('modules/Analytics/assets/scripts/analytics.js');
}
}
示例13: renderStart
/**
* renderStart
*
* @since 3.0.0
*/
public static function renderStart()
{
if (Registry::get('loggedIn') !== Registry::get('token')) {
$script = Head\Script::getInstance();
$script->init('foot')->appendFile('//google-analytics.com/cx/api.js?experiment=' . self::$_configArray['id'])->appendFile('modules/Experiments/assets/scripts/init.js')->appendFile('modules/Experiments/assets/scripts/experiments.js');
}
}
示例14: scriptStart
/**
* scriptStart
*
* @since 2.2.0
*/
public static function scriptStart()
{
if (Registry::get('loggedIn') !== Registry::get('token')) {
$output = '<script src="//google-analytics.com/ga.js"></script>';
echo $output;
}
}
示例15: renderStart
/**
* renderStart
*
* @since 2.2.0
*/
public static function renderStart()
{
if (Registry::get('firstParameter') === 'manifest_webapp') {
Registry::set('renderBreak', true);
header('content-type: application/x-web-app-manifest+json');
include_once 'modules/WebApp/files/manifest.json';
}
}