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; }
/** * 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); }
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; }
/** * 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(); }
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; }
/** * 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); } }
public function display($tpl = null) { $uri = JFactory::getURI(); $this->setLayout('default'); $lists = array(); $detail = $this->get('data'); $isNew = $detail->extension_id < 1; $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_SHIPPING') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_shipping48'); $adminpath = JPATH_ROOT . '/plugins'; $shippingpath = $adminpath . '/' . $detail->folder . '/' . $detail->element . '/' . $detail->element . '.xml'; $shippingcfg = $adminpath . '/' . $detail->folder . '/' . $detail->element . '/' . $detail->element . '.cfg.php'; if (file_exists($shippingcfg)) { include_once $shippingcfg; } $myparams = new JRegistry($detail->params, $shippingpath); $is_shipper = $myparams->get('is_shipper'); $shipper_location = $myparams->get('shipper_location'); if ($is_shipper) { JToolBarHelper::custom('shipping_rate', 'redshop_shipping_rates32', JText::_('COM_REDSHOP_SHIPPING_RATE_LBL'), JText::_('COM_REDSHOP_SHIPPING_RATE_LBL'), false, false); } elseif ($shipper_location) { JToolBarHelper::custom('shipping_rate', 'redshop_shipping_rates32', JText::_('COM_REDSHOP_SHIPPING_LOCATION'), JText::_('COM_REDSHOP_SHIPPING_LOCATION'), false, false); } JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->enabled); $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }
/** * 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', ''); if ($this->folder->getDisplayName()) { $title = $this->folder->getDisplayName(); } // 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 (empty($title)) { $title = $this->folder->getDisplayName(); } $this->document->setTitle($title); if ($this->folder->getText()) { $this->document->setDescription($this->folder->getText()); } elseif (!$this->folder->getText() && $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } }
/** * 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; }
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); }
/** * 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); }
/** * 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(); } }
/** * 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); }
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; }
/** * 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; }
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(); }
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; }
/** * Get list of payment methods * * @return array */ public static function getPaymentMethods($loadOffline = true, $onlyRecurring = false) { static $methods; if (!$methods) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*')->from('#__osmembership_plugins')->where('published = 1'); if (!$loadOffline) { $query->where('name != "os_offline"'); } if ($onlyRecurring) { $query->where('support_recurring_subscription = 1'); } $db->setQuery($query); $rows = $db->loadObjectList(); foreach ($rows as $row) { if (file_exists(JPATH_ROOT . '/components/com_osmembership/plugins/' . $row->name . '.php')) { require_once JPATH_ROOT . '/components/com_osmembership/plugins/' . $row->name . '.php'; $params = new JRegistry($row->params); $method = new $row->name($params); $method->title = $row->title; if ($params->get('payment_fee_amount') > 0 || $params->get('payment_fee_percent')) { $method->paymentFee = true; } $methods[] = $method; } } } return $methods; }
/** * 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); $jQueryFromTemplateIsSet = false; if ($registry->get('jqueryinfrontend') == 2) { $jQueryFromTemplateIsSet = true; } $jQueryNoConflictSetToNo = false; if ($registry->get('addnoconflictfrontend') == 0) { $jQueryNoConflictSetToNo = true; } $html = ''; $html .= '<script type="text/javascript">'; $html .= 'jQuery(document).ready(function($) {'; $html .= ' $("#jform_params_addnoconflictfrontend").change(function() { if ( $("#jform_params_jqueryinfrontend input:checked").val() == 2 && $("#jform_params_addnoconflictfrontend input:checked").val() > 0) { alert("' . JText::_('PLG_SYSTEM_JQUERYEASY_WARNING_NOCONFLICTADDEDBYTEMPLATE') . '"); } });'; $html .= '});'; $html .= '</script>'; if ($jQueryFromTemplateIsSet && !$jQueryNoConflictSetToNo) { $html .= '<div class="alert alert-info"><span>' . JText::_('PLG_SYSTEM_JQUERYEASY_WARNING_NOCONFLICTADDEDBYTEMPLATE') . '</span></div>'; } return $html; }
protected function preprocessForm(\JForm $form, $data, $group = 'content') { // if no data, grab the posted form data. if (!$data instanceof JObject) { $data = JFactory::getApplication()->input->get('jform', $data, 'array'); $data = JArrayHelper::toObject($data); } $params = new JRegistry(); $params->loadArray($data->params); if ($params->get('discovery.url')) { $plugin = $params->get('discovery.type'); $language = JFactory::getLanguage(); $language->load('plg_harvest_' . $plugin); $path = JPATH_ROOT . '/plugins/harvest/' . $plugin . '/forms/harvest.xml'; $form->loadFile($path, false); foreach (JPluginHelper::getPlugin('ingest') as $plugin) { $language->load('plg_ingest_' . $plugin->name); $path = JPATH_ROOT . '/plugins/ingest/' . $plugin->name . '/forms/ingest.xml'; $form->loadFile($path, false); } $form->removeField('originating_url'); $form->removeField('harvester'); // hide the run_once value (users cannot set it after discovery) $form->setFieldAttribute("run_once", 'type', 'hidden'); $form->setFieldAttribute("run_once", 'class', ''); } else { $form->removeField('state'); $form->removeField('harvested'); $form->removeField('url', 'params.discovery'); $form->removeField('type', 'params.discovery'); } parent::preprocessForm($form, $data, $group); }
/** * Override by loading Profile Picture parameters. * * @param JForm $form The form to attach to the form field object. * * @since 2.0 */ public function __construct($form = null) { $plugin = JPluginHelper::getPlugin('user', 'profilepicture'); $this->params = new JRegistry($plugin->params); $this->maxUploadSizeInBytes = $this->params->get('maxUploadSizeInBytes', 800000); parent::__construct($form); }
private function _getPlgRoistatSettings() { $plugin = JPluginHelper::getPlugin('system', 'roistat'); $plgRoistat = new JRegistry($plugin->params); self::$instance->login = $plgRoistat->get('login', null); self::$instance->password = $plgRoistat->get('password', null); self::$instance->project = $plgRoistat->get('project', null); }
/** * setOpenGraph * * @param string $context * @param object $article * * @return void */ public static function setOpenGraph($context, $article) { $es = \Ezset::getInstance(); $input = \JFactory::getApplication()->input; $view = $input->get('view'); if (empty($article->id)) { return; } if (!$es->params->get('ogGetInnerPageImage', 1)) { return; } if ('article' == $view) { $images = new \JRegistry($article->images); $ignoreFirst = false; $imgs = array(); $img = $images->get('image_fulltext', $images->get('image_intro')); if ($img) { $imgs[] = $img; } if ($imgs) { $ignoreFirst = true; } $dom = new Dom(); // If first image = main image, delete this paragraph. $dom->load($article->text); $images = $dom->find('img'); foreach ($images as $image) { if ($ignoreFirst) { continue; } $imgs[] = $image->src; } if (!$imgs && isset($article->catid)) { $cat = \JTable::getInstance('category'); $cat->load($article->catid); $cat->params = new \JRegistry($cat->params); $imgs[] = $cat->params->get('image'); } if (!$imgs && !$es->params->get('ogDefaultImageOnlyFrontPage', 1)) { $imgs[] = UriHelper::pathAddHost($es->params->get('ogDefaultImage')); } $es->data->ogImages = $imgs; } elseif ('category' == $view) { if (static::$once) { $cat = \JTable::getInstance('category'); $cat->load($input->get('id')); $cat->params = new \JRegistry($cat->params); $img = $cat->params->get('image'); if ($img) { $es->ogImage = $img; } elseif (!$es->params->get('ogDefaultImageOnlyFrontPage', 1)) { $es->ogImage = $es->params->get('ogDefaultImage'); } $es->ogImage = UriHelper::pathAddHost($es->data->ogImage); } static::$once = 0; } }
public static function getPhocaPDFContentIcon($item, $params, $attribs = array()) { $lang = JFactory::getLanguage(); $lang->load('plg_phocapdf_content', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false); // Plugin Parameters jimport('joomla.html.parameter'); //$pluginP = new JParameter( $plugin->params ); $plugin = JPluginHelper::getPlugin('phocapdf', 'content'); $pluginP = new JRegistry(); $pluginP->loadString($plugin->params); $include_articles = $pluginP->get('include_articles', ''); $include_categories = $pluginP->get('include_categories', ''); $include_articles = explode(',', $include_articles); $include_categories = explode(',', $include_categories); $include_articles = array_filter($include_articles); $include_categories = array_filter($include_categories); if (!empty($include_articles)) { if (isset($item->id) && !in_array($item->id, $include_articles)) { return ""; } } if (!empty($include_categories)) { if (isset($item->catid) && !in_array($item->catid, $include_categories)) { return ""; } } $exclude_articles = $pluginP->get('exclude_articles', ''); $exclude_categories = $pluginP->get('exclude_categories', ''); $exclude_articles = explode(',', $exclude_articles); $exclude_categories = explode(',', $exclude_categories); if (isset($item->catid) && in_array($item->catid, $exclude_categories)) { return ""; } if (isset($item->id) && in_array($item->id, $exclude_articles)) { return ""; } $pdfDest = $pluginP->get('pdf_destination', 'S'); $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,' . 'resizable=yes,width=820,height=480,directories=no,location=no'; if ($pdfDest == 'I' || $pdfDest == 'D') { $attribs['onclick'] = ''; } else { $browser = PhocaPDFHelperBrowser::browserDetection('browser'); if ($browser == 'msie7' || $browser == 'msie8') { $attribs['onclick'] = ''; $attribs['target'] = '_blank'; } else { $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; } } $url = ContentHelperRoute::getArticleRoute($item->slug, $item->catid); $url .= '&tmpl=component&format=pdf'; //&page='.@ $request->limitstart; $attribs['title'] = JText::_('PLG_PHOCAPDF_CONTENT_PDF'); $attribs['rel'] = 'nofollow'; $output = JHTML::_('link', JRoute::_($url), JText::_('PLG_PHOCAPDF_CONTENT_PDF'), $attribs); return $output; }
/** * Gets the IP address of the client machine, translates it to a compatiable * eDirectory netadress and queries it against the LDAP server using a filter. * * @return mixed Username of detected user or False. * * @since 1.0 */ public function detectRemoteUser() { // Import languages for frontend errors $this->loadLanguage(); /* * When legacy flag is true, it ensures compatibility with JSSOMySite 1.x by * only returning a string username or false can be returned. This also means * keeping compatibility with Joomla 1.6. * When it is set to False, it can return an array and compatible with Joomla 2.5. */ $legacy = $this->params->get('use_legacy', false); if ($legacy) { // Use legacy way of getting paramters $authParams = new JRegistry(); $authName = $this->params->get('auth_plugin', 'jmapmyldap'); $authPlugin = JPluginHelper::getPlugin('authentication', $authName); $authParams->loadString($authPlugin->params); $ldapUid = $authParams->get('ldap_uid', 'uid'); // Attempt to load up a LDAP instance using the legacy method jimport('shmanic.jldap2'); $ldap = new JLDAP2($authParams); // Lets try to bind using proxy user if (!$ldap->connect() || !$ldap->bind($ldap->connect_username, $ldap->connect_password)) { JError::raiseWarning('SOME_ERROR_CODE', JText::_('PLG_EDIR_ERROR_LDAP_BIND')); return; } // Get IP of client machine $myip = JRequest::getVar('REMOTE_ADDR', 0, 'server'); // Convert this to some net address thing that edir likes $na = JLDAPHelper::ipToNetAddress($myip); // Find the network address and return the uid for it $filter = "(networkAddress={$na})"; $dn = $authParams->get('base_dn'); // Do the LDAP filter search now $result = new JLDAPResult($ldap->search($dn, $filter, array($ldapUid))); $ldap->close(); } else { try { // We will only check the first LDAP config $ldap = SHLdap::getInstance(); $ldap->proxyBind(); $ldapUid = $ldap->getUid; // Get the IP address of this client and convert to netaddress for LDAP searching $input = new JInput($_SERVER); $myIp = $input->get('REMOTE_ADDR', false, 'string'); $na = SHLdapHelper::ipToNetAddress($myIp); $result = $ldap->search(null, "(networkAddress={$na})", array($ldapUid)); } catch (Exception $e) { SHLog::add($e, 16010, JLog::ERROR, 'sso'); return; } } if ($value = $result->getValue(0, $ldapuid, 0)) { // Username was found logged in on this client machine return $value; } }
function load($oid = NULL, $reset = true) { parent::load($oid); $params = new JRegistry($this->params); $this->color = $params->get("catcolour", "#000000"); $this->overlaps = $params->get("overlaps", 0); $this->admin = $params->get("admin", 0); $this->image = $params->get("image", ""); }
/** * Prepare topic reply form. * * @return void * * @throws RuntimeException * @throws KunenaExceptionAuthorise */ protected function before() { parent::before(); $catid = $this->input->getInt('catid'); $id = $this->input->getInt('id'); $mesid = $this->input->getInt('mesid'); $quote = $this->input->getBool('quote', false); $saved = $this->app->getUserState('com_kunena.postfields'); $this->me = KunenaUserHelper::getMyself(); $this->template = KunenaFactory::getTemplate(); if (!$mesid) { $this->topic = KunenaForumTopicHelper::get($id); $parent = KunenaForumMessageHelper::get($this->topic->first_post_id); } else { $parent = KunenaForumMessageHelper::get($mesid); $this->topic = $parent->getTopic(); } $this->category = $this->topic->getCategory(); if ($parent->isAuthorised('reply') && $this->me->canDoCaptcha()) { if (JPluginHelper::isEnabled('captcha')) { $plugin = JPluginHelper::getPlugin('captcha'); $params = new JRegistry($plugin[0]->params); $captcha_pubkey = $params->get('public_key'); $catcha_privkey = $params->get('private_key'); if (!empty($captcha_pubkey) && !empty($catcha_privkey)) { JPluginHelper::importPlugin('captcha'); $dispatcher = JDispatcher::getInstance(); $result = $dispatcher->trigger('onInit', 'dynamic_recaptcha_1'); $this->captchaEnabled = $result[0]; } } else { $this->captchaEnabled = false; } } $parent->tryAuthorise('reply'); // Run event. $params = new JRegistry(); $params->set('ksource', 'kunena'); $params->set('kunena_view', 'topic'); $params->set('kunena_layout', 'reply'); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('kunena'); $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0)); // Can user edit topic icons? if ($this->config->topicicons && $this->topic->isAuthorised('edit')) { $this->topicIcons = $this->template->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id); } list($this->topic, $this->message) = $parent->newReply($saved ? $saved : $quote); $this->action = 'post'; $this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category); $this->post_anonymous = $saved ? $saved['anonymous'] : !empty($this->category->post_anonymous); $this->subscriptionschecked = $saved ? $saved['subscribe'] : $this->config->subscriptionschecked == 1; $this->app->setUserState('com_kunena.postfields', null); $this->canSubscribe = $this->canSubscribe(); $this->headerText = JText::_('COM_KUNENA_BUTTON_MESSAGE_REPLY') . ' ' . $this->topic->subject; }
/** * * @param type $name * @param type $array * @return \CParserMetas */ private function _addArray($name, $array) { if (!is_array($array)) { $array = array($array); } $data = $this->_extracted->get($name, array()); $data = is_array($data) ? array_unique(array_merge_recursive($data, $array)) : $array; $this->_add($name, $data); return $this; }
/** * 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->get('page_heading', $this->params->get('page_title', $menu->title)); } $title = $this->params->get('page_title', ''); 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')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } }
protected function &_getPresentationImage(RokGallery_Model_Slice &$slice, JRegistry &$params) { $image = new stdClass(); $image->id = $slice->id; $image->title = $params->get('gallery_use_title_from', 'slice') == 'slice' ? $slice->title : $slice->File->title; $image->caption = $params->get('gallery_use_caption_from', 'slice') == 'slice' ? $slice->caption : $slice->File->description; $image->slug = $slice->slug; $image->created_at = date('j M Y', strtotime($slice->File->created_at)); $image->updated_at = date('j M Y', strtotime($slice->updated_at)); $image->views = $slice->File->Views->count; $image->loves = $slice->File->Loves->count; $image->thumburl = $slice->thumburl; $image->xsize = $slice->xsize; $image->ysize = $slice->ysize; $image->doilove = $slice->doilove; $image->filesize = $slice->filesize; $image->imageurl = $slice->imageurl; $image->rel = ''; if (!RokGallery_Link::isJson($slice->link)) { $link = new RokGallery_Link(json_encode(new RokGallery_Link_Type_Manual_Info($slice->link))); } else { $link = new RokGallery_Link($slice->link); } switch ($params->get('link')) { case 'rokbox': $gallery_name = preg_replace("/(\\s|_|-|!)/i", '', $slice->Gallery->name); $image->link = $slice->imageurl; $image->rel = 'rel="rokbox[' . $image->xsize . ' ' . $image->ysize . '](' . $gallery_name . ')" title="' . $image->title . ' :: ' . $image->caption . '" '; break; case 'rokbox_full': $image->link = $slice->File->imageurl; $image->rel = 'rel="rokbox[' . $slice->File->xsize . ' ' . $slice->File->ysize . '](' . str_replace(' ', '', $slice->Gallery->name) . ')" title="' . $image->title . ' :: ' . $image->caption . '" '; break; case 'slice_link': switch ($link->getType()) { case 'manual': if ($link->getUrl() == '') { $menu =& JSite::getMenu(); $activeenuitem = $menu->getActive(); $menuItem =& $menu->getItem($params->get('default_menuitem', $activeenuitem->id)); $image->link = JRoute::_($menuItem->link . '&Itemid=' . $menuItem->id); } else { $image->link = $link->getUrl(); } break; case 'article': $image->link = JRoute::_($link->getUrl()); break; } break; default: $image->link = null; } return $image; }