本文整理汇总了PHP中JRegistry::get方法的典型用法代码示例。如果您正苦于以下问题:PHP JRegistry::get方法的具体用法?PHP JRegistry::get怎么用?PHP JRegistry::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRegistry
的用法示例。
在下文中一共展示了JRegistry::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public function test(SimpleXMLElement $element, $value, $group = NULL, JRegistry $input = NULL, JForm $form = NULL)
{
$pmax = (int) $element['pmax'] ? $element['pmax'] : self::DEFAULT_MAX_PERCENT;
$pmin = (int) $element['pmin'] ? $element['pmin'] : self::DEFAULT_MIN_PERCENT;
$max = (int) $element['max'] ? $element['max'] : self::DEFAULT_MAX_SIZE;
$min = (int) $element['min'] ? $element['min'] : self::DEFAULT_MIN_SIZE;
if (strpos($value, '%')) {
$intValue = intval(str_replace('%', '', $value));
$maxValue = $pmax;
$minValue = $pmin;
} else {
$maxValue = $max;
$minValue = $min;
$intValue = intval($value);
}
if ($input->get('params.full_height') == 0 && $input->get('params.full_width') == 0) {
return new Exception(JText::_('MOSIMAGE_INVALID_FULL_WIDTH_AND_HEIGHT_ARE_ZERO'));
}
$name = $element['name'];
if ($name == 'full_height') {
if ($intValue == 0) {
return new Exception(JText::_('MOSIMAGE_INVALID_FULL_HEIGHT_IS_ZERO'));
}
}
if ($intValue < $minValue && $intValue != 0 || $intValue > $maxValue) {
return new Exception(JText::sprintf('MOSIMAGE_INVALID_' . strtoupper($name), $value, $min, $max, $pmin, $pmax));
}
return true;
}
示例2: onContentPrepare
/**
* Prepare content method
*
* Method is called by the view
*
* @param string $context The context of the content being passed to the plugin.
* @param object &$row The article object. Note $article->text is also available
* @param object &$params The article params
* @param int $page The 'page' number
*
* @return void
*/
public function onContentPrepare($context, &$row, &$params, $page = 0)
{
jimport('joomla.html.parameter');
jimport('joomla.filesystem.file');
// Load fabrik language
$lang = JFactory::getLanguage();
$lang->load('com_fabrik', JPATH_BASE . '/components/com_fabrik');
if (!defined('COM_FABRIK_FRONTEND')) {
JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
}
// Get plugin info
$plugin = JPluginHelper::getPlugin('content', 'fabrik');
// $$$ hugh had to rename this, it was stomping on com_content and friends $params
// $$$ which is passed by reference to us!
$fparams = new JRegistry($plugin->params);
// Simple performance check to determine whether bot should process further
$botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
if (JString::strpos($row->text, $botRegex) === false) {
return true;
}
require_once COM_FABRIK_FRONTEND . '/helpers/parent.php';
/* $$$ hugh - hacky fix for nasty issue with IE, which (for gory reasons) doesn't like having our JS content
* wrapped in P tags. But the default WYSIWYG editor in J! will automagically wrap P tags around everything.
* So let's just look for obvious cases of <p>{fabrik ...}</p>, and replace the P's with DIV's.
* Yes, it's hacky, but it'll save us a buttload of support work.
*/
$pregex = "/<p>\\s*{" . $botRegex . "\\s*.*?}\\s*<\\/p>/i";
$row->text = preg_replace_callback($pregex, array($this, 'preplace'), $row->text);
// $$$ hugh - having to change this to use {[]}
$regex = "/{" . $botRegex . "\\s*.*?}/i";
$row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
}
示例3: submit
public function submit()
{
// Check for request forgeries.
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Initialise variables.
$app = JFactory::getApplication();
$model = $this->getModel('manageavailability');
$view = $this->getView('manageavailability', 'html');
$view->setModel($model, true);
// Get the data from the form POST
$input = JFactory::getApplication()->input;
$data = new JRegistry($input->get('jform', '', 'array'));
// The returned data only includes the dates when the leader IS available (unchecked checkboxes don't exist)
// So get an array of all dates, set them all to not available, and apply the given availability on top.
$model->setProgramme($data->get("programmeid"));
// TODO: Check if programme exists
$dates = $model->getProgramme()->dates;
$availability = array();
foreach ($dates as $date) {
$availability[$date] = (bool) $data->get("availability_" . $date, false);
}
$model->getProgramme()->setLeaderAvailability($model->getLeader()->id, $availability);
$view->saved = true;
$view->display();
return true;
}
示例4: plgSh404sefofflinecode
/**
* Output a correct response code when site is offline
* to let know search engines that site data
* should not be discarded or discounted
*/
function plgSh404sefofflinecode()
{
$app = JFactory::getApplication();
// are we in the backend, or not offline ?
if (!defined('SH404SEF_IS_RUNNING') || $app->isAdmin() || !$app->getCfg('offline')) {
return;
}
// get plugin params
$plugin =& JPluginHelper::getPlugin('sh404sefcore', 'sh404sefofflinecode');
$pluginParams = new JRegistry();
$pluginParams->loadString($plugin->params);
$disallowAdminAccess = $pluginParams->get('disallowAdminAccess', 0);
if (!$disallowAdminAccess) {
// admins are allowed, lets check if current user
// is an admin, or if user is trying to log in
$user =& JFactory::getUser();
$option = JRequest::getCmd('option');
$task = JRequest::getCmd('task');
if ($option == 'com_users' && $task == 'user.login') {
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$loggingIn = true;
} else {
$loggingIn = false;
}
// if already logged inadmin, or admin logging in, let it go
if ($user->authorize('core.manage', 'com_sh404sef') || $loggingIn) {
return;
}
}
// need to render offline screen
if ($disallowAdminAccess) {
// admins not allowed, use our own
// simplified template. Most likely being hacked so
// close doors as much as possible
$template = '';
$file = 'sh404sef_offline_template.php';
$directory = JPATH_ROOT . DS . 'plugins' . DS . 'sh404sefcore';
} else {
// admin can access, use Joomla! offline template,
// that includes a login form
$template = $app->getTemplate();
$file = 'offline.php';
$directory = JPATH_THEMES;
}
$params = array('template' => $template, 'file' => $file, 'directory' => $directory);
$document =& JFactory::getDocument();
$data = $document->render($app->getCfg('caching'), $params);
// header : service unavailable
JResponse::setHeader('HTTP/1.0 503', true);
// give it some time
$retryAfter = $pluginParams->get('retry_after_delay', 7400);
// set header
Jresponse::setheader('Retry-After', gmdate('D, d M Y H:i:s', time() + $retryAfter) . ' GMT');
// echo document
JResponse::setBody($data);
echo JResponse::toString($app->getCfg('gzip'));
// and terminate
$app->close();
}
示例5: execphp
function execphp($matches)
{
$siteurl = JURI::base();
$doc = JFactory::getDocument();
if (!$this->styleAndScript) {
$doc->addStyleSheet($siteurl . "plugins/content/plg_fen_viewer/css/chess.css");
$doc->addScript($siteurl . "plugins/content/plg_fen_viewer/js/ChessFen.js");
$this->styleAndScript = true;
}
$plugin = JPluginHelper::getPlugin('content', 'plg_fen_viewer');
$pluginParams = new JRegistry($plugin->params);
$style = $pluginParams->get('style', 'merida');
if ($style != "merida" && $style != "alpha" && $style != "cases" && $style != "leipzig" && $style != "motif" && $style != "smart") {
$style = "merida";
}
$groesse = $pluginParams->get('groesse', 30);
if (!is_numeric($groesse)) {
$groesse = 30;
}
$now = time() + mt_rand();
$url = $siteurl . "plugins/content/plg_fen_viewer/images/";
$script = "<script>var chessObj = new DHTMLGoodies.ChessFen({ pieceType:'" . $style . "',squareSize:'" . $groesse . "' }); chessObj.loadFen('" . $matches[1] . "','" . $now . "','" . $url . "');</script>";
$script .= '<noscript>You have JavaScript disabled and you are not seeing a graphical interactive chessboard!</noscript>';
// Ausgabe
$output = '<div id="' . $now . '"></div>' . $script;
return $output;
}
示例6: _prepareDocument
/**
* Prepares the document
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = NULL;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu) {
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
}
$title = $this->params->get('page_title', '');
$title .= " - " . JText::_('COM_EVENTGALLERY_ORDERS_PATH');
// Check for empty title and add site name if param is set
if (empty($title)) {
$title = $app->getCfg('sitename');
} elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
}
if ($this->document) {
$this->document->setTitle($title);
}
}
示例7: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
jimport('joomla.plugin.helper');
$plugin = JPluginHelper::getPlugin('system', 'jqueryeasy');
$params = $plugin->params;
$registry = new JRegistry();
$registry->loadString($params);
$jQueryIsSet = false;
if ($registry->get('jqueryinfrontend') != 0) {
$jQueryIsSet = true;
}
$jQueryUIIsSet = false;
if ($registry->get('jqueryuiinfrontend') != 0) {
$jQueryUIIsSet = true;
}
$html = '';
$html .= '<script type="text/javascript">';
$html .= 'jQuery(document).ready(function($) {';
$html .= ' $("#jform_params_jqueryinfrontend").change(function() { if ( $("#jform_params_jqueryinfrontend input:checked").val() == 0 && $("#jform_params_jqueryuiinfrontend input:checked").val() > 0) { alert("' . JText::_('PLG_SYSTEM_JQUERYEASY_WARNING_CANNOTUSEJQUERYUIWITHOUTJQUERY') . '"); } });';
$html .= ' $("#jform_params_jqueryuiinfrontend").change(function() { if ( $("#jform_params_jqueryuiinfrontend input:checked").val() > 0 && $("#jform_params_jqueryinfrontend input:checked").val() == 0) { alert("' . JText::_('PLG_SYSTEM_JQUERYEASY_WARNING_CANNOTUSEJQUERYUIWITHOUTJQUERY') . '"); } });';
$html .= '});';
$html .= '</script>';
if (!$jQueryIsSet && $jQueryUIIsSet) {
$html .= '<div class="alert alert-error"><span>' . JText::_('PLG_SYSTEM_JQUERYEASY_WARNING_CANNOTUSEJQUERYUIWITHOUTJQUERY') . '</span></div>';
}
return $html;
}
示例8: display
function display($tpl = null)
{
$this->canDo = JCKHelper::getActions();
$this->app = JFactory::getApplication();
$this->user = JFactory::getUser();
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JCKHelper::error(implode("\n", $errors));
return false;
}
// Check if there are no matching items
if (!count($this->items)) {
JCKHelper::error(JText::_('COM_JCK_LAYOUT_MANAGER_NO_TOOLBARS_FOUND'));
}
//now lets get default toolbars
$editor = JPluginHelper::getPlugin('editors', 'jckeditor');
$params = new JRegistry($editor->params);
$this->default = $params->get('toolbar', 'Publisher');
$this->defaultFT = $params->get('toolbar_ft', 'Basic');
$this->addToolbar();
parent::display($tpl);
}
示例9: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$id = (int) $app->input->get('id', 0);
$params = $app->getPageParameters();
// Count how often the newsletter has been viewed
$newsletter = JTable::getInstance('newsletters', 'BwPostmanTable');
$newsletter->load($id);
$newsletter->hit($id);
// Get document object, set document title and add css
$templateName = $app->getTemplate();
$css_filename = '/templates/' . $templateName . '/css/com_bwpostman.css';
$document = JFactory::getDocument();
if ($params->get('page_heading') != '') {
$document->setTitle($params->get('page_title'));
} else {
$document->setTitle($newsletter->subject);
}
$document->addStyleSheet(JURI::root(true) . '/components/com_bwpostman/assets/css/bwpostman.css');
if (file_exists(JPATH_BASE . $css_filename)) {
$document->addStyleSheet(JURI::root(true) . $css_filename);
}
// Get the global list params and preset them
$globalParams = JComponentHelper::getParams('com_bwpostman', true);
$this->attachment_enabled = $globalParams->get('attachment_single_enable');
$this->page_title = $globalParams->get('subject_as_title');
$menuParams = new JRegistry();
if ($menu = $app->getMenu()->getActive()) {
$menuParams->loadString($menu->params);
}
// if we came from list view to show single newsletter, then params of list view shall take effect
if (is_object($menu)) {
if (stristr($menu->link, 'view=newsletter&') == false) {
// Get the menu item state
$nls_state = $app->getUserState('com_bwpostman.newsletters.params');
// if we have a menu state, use this and overwrite global settings
if ($nls_state->get('attachment_enable') !== null) {
$this->attachment_enabled = $nls_state->get('attachment_enable');
}
} else {
// we come from single menu link, use menu params if set, otherwise global details params are used
if ($menuParams->get('attachment_single_enable') !== null) {
$this->attachment_enabled = $menuParams->get('attachment_single_enable');
} else {
$this->attachment_enabled = $globalParams->get('attachment_single_enable');
}
}
}
if ($newsletter->published == 0) {
$app->enqueueMessage(JText::_('COM_BWPOSTMAN_ERROR_NL_NOT_AVAILABLE'), 'error');
}
// Setting the backlink
$backlink = $_SERVER['HTTP_REFERER'];
// Save a reference into the view
$this->assignRef('backlink', $backlink);
$this->assignRef('newsletter', $newsletter);
$this->assignRef('params', $params);
// Set parent display
parent::display($tpl);
}
示例10: display
/**
* Display module contents.
*/
public final function display()
{
// Load CSS only once
if (static::$css) {
$this->document->addStyleSheet(JURI::root(true) . static::$css);
static::$css = null;
}
// Use caching also for registered users if enabled.
if ($this->params->get('owncache', 0)) {
/** @var $cache JCacheControllerOutput */
$cache = JFactory::getCache('com_kunena', 'output');
$me = KunenaFactory::getUser();
$cache->setLifeTime($this->params->get('cache_time', 180));
$hash = md5(serialize($this->params));
if ($cache->start("display.{$me->userid}.{$hash}", 'mod_kunenalatest')) {
return;
}
}
// Initialize Kunena.
KunenaForum::setup();
// Display module.
$this->_display();
// Store cached page.
if (isset($cache)) {
$cache->end();
}
}
示例11: bind
/**
* Overloaded bind function
*
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = array())
{
if (isset($array['params']) && is_array($array['params'])) {
$registry = new JRegistry();
$registry->loadArray($array['params']);
if ((int) $registry->get('width', 0) < 0) {
$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_WIDTH_LABEL')));
return false;
}
if ((int) $registry->get('height', 0) < 0) {
$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_HEIGHT_LABEL')));
return false;
}
// Converts the width and height to an absolute numeric value:
$width = abs((int) $registry->get('width', 0));
$height = abs((int) $registry->get('height', 0));
// Sets the width and height to an empty string if = 0
$registry->set('width', $width ? $width : '');
$registry->set('height', $height ? $height : '');
$array['params'] = (string) $registry;
}
if (isset($array['imptotal'])) {
$array['imptotal'] = abs((int) $array['imptotal']);
}
return parent::bind($array, $ignore);
}
示例12: JRegistry
function get_category($catid)
{
if (!is_object($this->_item)) {
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new JRegistry();
if ($active) {
$params->loadString($active->params);
}
$options = array();
$options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0);
$catid = $catid > 0 ? $catid : 'root';
$categories = JCategories::getInstance('CommunitySurveys', $options);
$this->_item = $categories->get($catid);
if (is_object($this->_item)) {
$user = JFactory::getUser();
$userId = $user->get('id');
$asset = 'com_content.category.' . $this->_item->id;
if ($user->authorise('core.create', $asset)) {
$this->_item->getParams()->set('access-create', true);
}
}
}
return $this->_item;
}
示例13: render
/**
* Renders a module script and returns the results as a string
*
* @param string $name The name of the module to render
* @param array $attribs Associative array of values
*
* @return string The output of the script
* @since 1.0
*/
public function render($module, $attribs = array(), $content = null)
{
// add the environment data to attributes of module
$registry = JRegistry::getInstance('document.environment');
$env = $registry->getValue('params', array());
$attribs = array_merge($env, $attribs);
if (!is_object($module)) {
$title = isset($attribs['title']) ? $attribs['title'] : null;
$module = MigurModuleHelper::getModule($module, $title);
if (!is_object($module)) {
if (is_null($content)) {
return '';
} else {
/**
* If module isn't found in the database but data has been pushed in the buffer
* we want to render it
*/
$tmp = $module;
$module = new stdClass();
$module->params = null;
$module->module = $tmp;
$module->id = 0;
$module->user = 0;
}
}
}
// get the user and configuration object
//$user = JFactory::getUser();
$conf = JFactory::getConfig();
// set the module content
if (!is_null($content)) {
$module->content = $content;
}
//get module parameters
$params = new JRegistry();
$params->loadJSON($module->params);
// use parameters from template
if (isset($attribs['params'])) {
$template_params = new JRegistry();
$template_params->loadJSON(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8'));
$params->merge($template_params);
$module = clone $module;
$module->params = (string) $params;
}
$contents = '';
$cachemode = $params->get('cachemode', 'oldstatic');
// default for compatibility purposes. Set cachemode parameter or use JModuleHelper::moduleCache from within the module instead
if ($params->get('cache', 0) == 1 && $conf->get('caching') >= 1 && $cachemode != 'id' && $cachemode != 'safeuri') {
// default to itemid creating mehod and workarounds on
$cacheparams = new stdClass();
$cacheparams->cachemode = $cachemode;
$cacheparams->class = 'JModuleHelper';
$cacheparams->method = 'renderModule';
$cacheparams->methodparams = array($module, $attribs);
$contents = MigurModuleHelper::ModuleCache($module, $params, $cacheparams);
} else {
$contents = MigurModuleHelper::renderModule($module, $attribs);
}
return $contents;
}
示例14: install
public function install($adapter)
{
/** @var $plugin JTableExtension */
$plugin = JTable::getInstance('extension');
if (!$plugin->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'communitybuilder'))) {
return false;
}
/** @var $legacy JTableExtension */
$legacy = JTable::getInstance('extension');
if ($legacy->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'cbcoreredirect'))) {
$pluginParams = new JRegistry();
$pluginParams->loadString($plugin->get('params'));
$legacyParams = new JRegistry();
$legacyParams->loadString($legacy->get('params'));
$pluginParams->set('rewrite_urls', $legacyParams->get('rewrite_urls', 1));
$pluginParams->set('itemids', $legacyParams->get('itemids', 1));
$plugin->set('params', $pluginParams->toString());
$installer = new JInstaller();
try {
$installer->uninstall('plugin', $legacy->get('extension_id'));
} catch (RuntimeException $e) {
}
}
$plugin->set('enabled', 1);
return $plugin->store();
}
示例15: getCatPluginParamRecursive
public static function getCatPluginParamRecursive($pluginName, $catId, $param, $default = '', $inheritParam = '', $globalParam = '', $inherit = '-1', $global = '-2')
{
$inheritParam = $inheritParam ? $inheritParam : $param;
$globalParam = $globalParam ? $globalParam : $param;
$path = JUDirectoryHelper::getCategoryPath($catId);
$rootCat = $path[0];
$plugin = JPluginHelper::getPlugin('judirectory', $pluginName);
$pluginParamsStr = isset($plugin->params) ? $plugin->params : '{}';
$pluginParams = new JRegistry($pluginParamsStr);
$pathCatToRoot = array_reverse($path);
foreach ($pathCatToRoot as $category) {
$plugin_params = $category->plugin_params;
if ($plugin_params) {
$plugins = new JRegistry($plugin_params);
$pluginObject = $plugins->get($pluginName, "");
$pluginRegistry = new JRegistry($pluginObject);
if ($pluginRegistry->get($inheritParam, '') !== $inherit) {
if ($pluginRegistry->get($globalParam, '') === $global) {
return $pluginParams->get($param, $default);
} else {
return $pluginRegistry->get($param, $default);
}
} else {
if ($category->parent_id == $rootCat->id) {
return $pluginParams->get($param, $default);
} else {
continue;
}
}
} else {
return $default;
}
}
return $default;
}