本文整理汇总了PHP中ClassRegistry::setObject方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassRegistry::setObject方法的具体用法?PHP ClassRegistry::setObject怎么用?PHP ClassRegistry::setObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassRegistry
的用法示例。
在下文中一共展示了ClassRegistry::setObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: js
function js($files, $inline = false, $duress = false)
{
// Register in header to prevent duplicates
$registry = ClassRegistry::getObject('javascript');
if (is_array($files)) {
$out = '';
foreach ($files as $i) {
if ($duress || !isset($registry[$i])) {
$out .= "\n\t" . $this->js($i, $inline, $duress);
}
}
if ($out != '' && $inline) {
echo $out . "\n";
}
return;
}
ClassRegistry::setObject($files, 1, 'javascript');
if (substr($files, -3) != '.js') {
$files = $files . '.js';
}
if (false !== strpos($files, MVC_ADMIN)) {
// Automatic routing to admin path
$files = str_replace(MVC_ADMIN . '/', '', $files);
$jsUrl = $this->locateScript($files, true);
} else {
$jsUrl = $this->locateScript($files);
}
if ($jsUrl) {
$out = sprintf($this->tags['javascriptlink'], $jsUrl);
cmsFramework::addScript($out, $inline, $duress);
}
}
示例2: addScript
function addScript($text, $inline = false, $duress = false)
{
$scripts = ClassRegistry::getObject('scripts');
if ($text != '' && ($duress || !isset($scripts[md5($text)]))) {
if ($inline) {
echo $text;
} else {
global $mainframe;
$mainframe->addCustomHeadTag($text);
}
$scripts[md5($text)] = true;
ClassRegistry::setObject('scripts', $scripts);
}
}
示例3: onContentBeforeDisplay
function onContentBeforeDisplay($context, &$article, &$params)
{
/***********************************************************************
* BELOW BLOCK HERE BECAUSE J16 DOESN'T MAKE THE WHOLE ARTICLE OBJECT
* AVAILABLE IN THE ONCONTENTPREPARE CALLBACK IN BLOG LAYOUT PAGES
***********************************************************************/
if (!class_exists('cmsFramework') || !class_exists('Sanitize')) {
return;
}
$this->setCmsVersion();
// Check whether to perform the replacement or not
$option = Sanitize::getString($_REQUEST, 'option', '');
$view = Sanitize::getString($_REQUEST, 'view', '');
$layout = Sanitize::getString($_REQUEST, 'layout', '');
$id = Sanitize::getInt($_REQUEST, 'id');
if ($option == 'com_content' && ($layout == 'blog' || $view == 'featured')) {
$row =& $article;
$row->text =& $row->introtext;
if ((isset($row->params) || isset($row->parameters)) && isset($row->id) && $row->id > 0 && isset($row->catid) && $row->catid > 0) {
$Dispatcher = new S2Dispatcher('jreviews', true);
if ($option == 'com_content' && $view == 'article' & $id > 0) {
$_GET['url'] = 'com_content/com_content_view';
} elseif ($option == 'com_content' && ($layout == 'blog' && $view == 'category' || $view == 'featured')) {
$_GET['url'] = 'com_content/com_content_blog';
}
$passedArgs = array('params' => $params, 'row' => $row, 'component' => 'com_content');
$passedArgs['cat'] = $row->catid;
$passedArgs['listing_id'] = $row->id;
$output = $Dispatcher->dispatch($passedArgs);
if ($output) {
$row =& $output['row'];
unset($params);
$params =& $output['params'];
}
/**
* Store a copy of the $listing and $crumbs arrays in memory for use in the onBeforeDisplayContent method
*/
ClassRegistry::setObject(array('listing' => &$output['listing'], 'crumbs' => &$output['crumbs']), 'jreviewsplugin');
// Destroy pathway
if (!empty($output['crumbs'])) {
cmsFramework::setPathway(array());
}
unset($output, $passedArgs, $Dispatcher);
}
}
/***********************************************************************
* ABOVE BLOCK HERE BECAUSE J16 DOESN'T MAKE THE WHOLE ARTICLE OBJECT
* AVAILABLE IN THE ONCONTENTPREPARE CALLBACK IN BLOG LAYOUT PAGES
***********************************************************************/
return $this->onBeforeDisplayContent($article, $params);
}
示例4: addScript
function addScript($text, $inline = false, $duress = false)
{
$scripts = ClassRegistry::getObject('scripts');
if ($text != '' && ($duress || !isset($scripts[md5($text)]))) {
if ($inline) {
echo $text;
} else {
$doc =& JFactory::getDocument();
method_exists($doc, 'addCustomTag') and $doc->addCustomTag($text);
}
$scripts[md5($text)] = true;
ClassRegistry::setObject('scripts', $scripts);
}
}