/** * 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 Error object. * * @since 1.0 */ public function display($tpl = null) { $app = JFactory::getApplication(); if (!$app->isAdmin()) { return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); } // Do not allow cache $app->allowCache(false); $images = $this->get('images'); $documents = $this->get('documents'); $folders = $this->get('folders'); $videos = $this->get('videos'); $state = $this->get('state'); // Check for invalid folder name if (empty($state->folder)) { $dirname = JFactory::getApplication()->input->getPath('folder', ''); if (!empty($dirname)) { $dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8'); JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname)); } } $this->baseURL = JUri::root(); $this->images =& $images; $this->documents =& $documents; $this->folders =& $folders; $this->state =& $state; $this->videos =& $videos; parent::display($tpl); }
/** * Load common assets. * * @param boolean $inline Whether to load assets inline or load in header? * * @return void */ public static function loadAssets($inline = false) { // Define common stylesheets $stylesheets = array(); if (JSNVersion::isJoomlaCompatible('3.0')) { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css'; if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery.ui.1.9.0.ie.css'; } } else { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/bootstrap/css/bootstrap.min.css'; $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.custom.css'; if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.ie.css'; } } $stylesheets[] = JSN_URL_ASSETS . '/joomlashine/css/jsn-gui.css'; // Load stylesheets if (!$inline) { JSNHtmlAsset::addStyle($stylesheets); } else { foreach ($stylesheets as $stylesheet) { $html[] = '<link type="text/css" href="' . $stylesheet . '" rel="stylesheet" />'; } echo implode("\n", $html); } // Load scripts if (JSNVersion::isJoomlaCompatible('3.2')) { JSNHtmlAsset::addScript(JUri::root(true) . '/media/jui/js/jquery.min.js'); } }
function onPromoteData($id) { $db = JFactory::getDBO(); $Itemid = JRequest::getInt('Itemid'); $jschk = $this->_chkextension(); if (!empty($jschk)) { $query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id; $db->setQuery($query); $fieldid = $db->loadresult(); $query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id; if ($fieldid) { $query .= " AND cfv.field_id=" . $fieldid; } $db->setQuery($query); $previewdata = $db->loadObjectlist(); if (!$fieldid) { $previewdata[0]->bodytext = ''; } // Include Jomsocial core $jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community'; include_once $jspath . DS . 'libraries' . DS . 'core.php'; $previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1); if ($previewdata[0]->image == '') { $previewdata[0]->image = 'components/com_community/assets/user-Male.png'; } return $previewdata; } else { return ''; } }
public function display($tpl = null) { $app = JFactory::getApplication(); if (!$app->isAdmin()) { return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); } // Do not allow cache $app->allowCache(false); JHtml::_('behavior.framework', true); JFactory::getDocument()->addScriptDeclaration("\r\n\t\twindow.addEvent('domready', function()\r\n\t\t{\r\n\t\t\twindow.parent.document.updateUploader();\r\n\t\t\t\$\$('a.img-preview').each(function(el)\r\n\t\t\t{\r\n\t\t\t\tel.addEvent('click', function(e)\r\n\t\t\t\t{\r\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});"); $images = $this->get('images'); $documents = $this->get('documents'); $folders = $this->get('folders'); $state = $this->get('state'); // Check for invalid folder name if (empty($state->folder)) { $dirname = JRequest::getVar('folder', '', '', 'string'); if (!empty($dirname)) { $dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8'); JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname)); } } $this->baseURL = JUri::root(); $this->images =& $images; $this->documents =& $documents; $this->folders =& $folders; $this->state =& $state; parent::display($tpl); }
/** * Method to get the field input markup for a generic list. * Use the multiple attribute to enable multiselect. * * @return string The field input markup. * * @since 1.0 */ protected function getInput() { // Receive ajax URL $ajaxUrl = isset($this->element['url']) ? (string) $this->element['url'] : null; if ($ajaxUrl) { $siteUrl = JUri::root(); $adminUrl = $siteUrl . 'administrator'; $this->ajaxchildOptions['ajaxUrl'] = str_replace(array('{admin}', '{backend}', '{site}', '{frontend}'), array($adminUrl, $adminUrl, $siteUrl, $siteUrl), $ajaxUrl); } // Receive child field selector $childSelector = isset($this->element['child_selector']) ? (string) $this->element['child_selector'] : null; if ($childSelector) { $this->ajaxchildOptions['childSelector'] = $childSelector; } // Receive parent field selector $parentSelector = isset($this->element['parent_selector']) ? (string) $this->element['parent_selector'] : null; if ($parentSelector) { $this->ajaxchildOptions['parentSelector'] = $parentSelector; } // Receive parent request var $parentVarName = isset($this->element['parent_varname']) ? (string) $this->element['parent_varname'] : null; if ($parentVarName) { $this->ajaxchildOptions['parentVarName'] = $parentVarName; } return parent::getInput(); }
function onDisplay($name) { $js = "\r\n\t\tfunction oziofunction(menu_id) {\r\n\t\t\tvar tag = '{oziogallery ' + menu_id + '}';\r\n\t\t\tjInsertEditorText(tag, '" . $name . "');\r\n\t\t\tSqueezeBox.close();\r\n\t\t}"; require_once JPATH_SITE . "/components/com_oziogallery3/oziogallery.inc"; $style = ""; $postfix = ""; if (!$GLOBALS["oziogallery3"]["registered"]) { $style = ".button2-left .oziogallery a { color: #f03030; }"; $postfix = " (Unregistered)"; } $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $document->addStyleSheet(JUri::root(true) . "/plugins/" . $this->_type . "/" . $this->_name . "/css/style.css"); $document->addStyleDeclaration($style); JHtml::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->class = 'btn'; $application = JFactory::getApplication(); $prefix = 'administrator/'; if ($application->isAdmin()) { $prefix = ''; } $button->set('link', $prefix . 'index.php?option=com_oziogallery3&view=galleries&layout=modal&tmpl=component&function=oziofunction'); $button->set('text', JText::_('BTN_OZIOGALLERY_BUTTON_LABEL') . $postfix); $button->set('name', 'camera'); $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}"); return $button; }
/** * Utility method to act on a user after it has been saved. * * This method sends a registration email to new users created in the backend. * * @param array $user Holds the new user data. * @param boolean $isnew True if a new user is stored. * @param boolean $success True if user was succesfully stored in the database. * @param string $msg Message. * * @return void * @since 1.6 */ public function onUserAfterSave($user, $isnew, $success, $msg) { // Initialise variables. $app = JFactory::getApplication(); $config = JFactory::getConfig(); $mail_to_user = $this->params->get('mail_to_user', 1); if ($isnew) { // TODO: Suck in the frontend registration emails here as well. Job for a rainy day. if ($app->isAdmin()) { if ($mail_to_user) { // Load user_joomla plugin language (not done automatically). $lang = JFactory::getLanguage(); $lang->load('plg_user_joomla', JPATH_ADMINISTRATOR); // Compute the mail subject. $emailSubject = JText::sprintf('PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT', $user['name'], $config->get('sitename')); // Compute the mail body. $emailBody = JText::sprintf('PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY', $user['name'], $config->get('sitename'), JUri::root(), $user['username'], $user['password_clear']); // Assemble the email data...the sexy way! $mail = JFactory::getMailer()->setSender(array($config->get('mailfrom'), $config->get('fromname')))->addRecipient($user['email'])->setSubject($emailSubject)->setBody($emailBody); if (!$mail->Send()) { // TODO: Probably should raise a plugin error but this event is not error checked. JError::raiseWarning(500, JText::_('ERROR_SENDING_EMAIL')); } } } } else { // Existing user - nothing to do...yet. } }
protected function getInput() { $document = JFactory::getDocument(); $document->addScript(JUri::root() . 'modules/mod_jxtc_ytpwall/elements/ytplaylist.min.js'); $html = ' <div class="input-append"> <input type="text" class="input-xlarge" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" /> <div class="btn-group"> <button class="btn dropdown-toggle" data-toggle="dropdown"> <i class="icon icon-cog"></i> </button> <div class="dropdown-menu keep-open well well-small"> Select playlists from a channel:<br><br> <input type="text" id="userName" placeholder="YouTube channel name"> <button type="button" class="btn" onClick="ytplquery();" />Query</button> <div id="ytplerror" style="color:#F00"></div> <div id="ytplresult"></div> </div> </div> </div> <script type="text/javascript"> jQuery(function() { jQuery(".keep-open").click(function(e) { e.stopPropagation(); }); }); </script> '; return $html; }
public function getInput() { $app = JFactory::getApplication(); $heatmapforcecheck = JRequest::getInt('heatmapforcecheck', 0); if ($app->isAdmin() && $heatmapforcecheck) { $cache = JFactory::getCache(); $result = $cache->clean('plg_system_heatmap:accountcheck'); $refresh_uri = JUri::getInstance(); $refresh_uri->delVar('heatmapforcecheck'); $refresh_uri = $refresh_uri->toString(); $app->redirect($refresh_uri); } $cache = JFactory::getCache('plg_system_heatmap:accountcheck'); $cache->setCaching(true); $cache->setLifeTime(86400); //24h $domain = urlencode(JUri::root(false)); //$accountCheck = HeatmapAccountChecker::check($domain); $accountCheck = $cache->call(array('HeatmapAccountChecker', 'check'), $domain); if ($accountCheck['valid']) { $msg .= '<span class="text-success">' . JText::_('PLG_HEATMAP_CHECK_ACCOUNT_VALID') . '</span>'; } else { $msg .= '<span class="text-error">' . JText::_('PLG_HEATMAP_CHECK_ACCOUNT_NOT_FOUND') . '</span>'; } $refresh_uri = JUri::getInstance(); $refresh_uri->setVar('heatmapforcecheck', 1); $refresh_uri = $refresh_uri->toString(); $msg .= '<br><a class="btn" href="' . $refresh_uri . '">' . JText::_('PLG_HEATMAP_CHECK_ACCOUNT') . '</a>'; $lastcheck = isset($accountCheck['lastcheck']) ? $accountCheck['lastcheck'] : JText::_('PLG_HEATMAP_NEVER'); $msg .= '<br>' . JText::_('PLG_HEATMAP_LAST_CHECK') . ' ' . $lastcheck; if (isset($accountCheck['error']) && $accountCheck['error']) { $msg .= '<br>' . JText::_('PLG_HEATMAP_ERROR_MSG') . ' <em>' . $accountCheck['error'] . '</em>'; } return $msg; }
/** * CP Values view display method * @return void **/ function display($tpl = null) { global $option; $this->_context = $option . 'tags'; // nombre del contexto $this->cid = JRequest::getVar('cid', 0, '', 'int'); $document = JFactory::getDocument(); $script = JUri::root() . '/administrator/components/com_customproperties/includes/customproperties_ext.js'; $document->addScript($script); $app =& JFactory::getApplication(); $user = JFactory::getUser(); $aid = $user->get('aid', 0); $gid = $user->get('gid', 0); $ce_file = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_customproperties' . DS . 'contentelement.class.php'; require_once $ce_file; // get the content element $option = JRequest::getVar('contentname'); if (!$option) { $ce = getContentElementByName("content"); } else { $ce = getContentElementByOption($option); } $this->assignRef('ce', $ce); $query = " SELECT DISTINCT f.id AS fid, f.label AS name, v.id AS vid, v.label, v.access_group AS ag\r\n FROM #__custom_properties AS cp\r\n\t\t\tINNER JOIN #__custom_properties_fields AS f\r\n\t\t\tON (cp.field_id = f.id)\r\n\t\t\tINNER JOIN #__custom_properties_values AS v\r\n\t\t\tON (cp.value_id = v.id)\r\n WHERE cp.ref_table = '" . $ce->table . "'\r\n\t\t\tAND cp.content_id = '{$this->cid}'\r\n\t\t\tAND f.published = '1'\r\n\t\t\tAND f.access <= '{$aid}'\r\n ORDER BY f.ordering, v.ordering "; $database = JFactory::getDBO(); $database->setQuery($query); $database->getErrorMsg(); $this->assignRef('tags', $database->loadObjectList()); $this->assignRef('app', $app); $this->assignRef('gid', $gid); parent::display($tpl); }
public function getList() { if (!$this->_list) { $this->_list = array('sitemapindex' => array()); $configs = $this->getService('com://site/sitemap.model.configs')->limit(0)->getList(); foreach ($configs as $config) { // Get model identifier $identifier = clone $this->getIdentifier(); $identifier->package = $config->package; $identifier->name = $config->name; // Get total $model = $this->getService($identifier); $total = $model->getTotal(); $model->sort('modified_on')->direction('desc')->limit(1); for ($i = 0; $i < $total;) { // Get first item for lastmod $item = $model->offset($i)->getList()->top(); $sitemap = new stdClass(); $sitemap->loc = JUri::root() . 'index.php?option=com_sitemap&view=sitemap&urlset_offset=' . $i . '&urlset_limit=500&package=' . $identifier->package . '&name=' . $identifier->name . '&format=xml'; $sitemap->lastmod = self::getLastMod(array('item' => $item)); array_push($this->_list['sitemapindex'], $sitemap); $i += 500; } } } return $this->_list; }
protected function getInput() { if (version_compare(JVERSION, '3.0.0') == -1) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); if (version_compare(PHP_VERSION, '5.2.4') == -1) { $app->enqueueMessage(JText::sprintf('MOD_PWEBCONTACT_CONFIG_MSG_PHP_VERSION', '5.2.4'), 'error'); } // jQuery and Bootstrap in Joomla 2.5 if (!class_exists('JHtmlJquery')) { $error = null; if (!is_file(JPATH_PLUGINS . '/system/pwebj3ui/pwebj3ui.php')) { $error = JText::sprintf('MOD_PWEBCONTACT_CONFIG_INSTALL_PWEBLEGACY', '<a href="http://www.perfect-web.co/blog/joomla/62-jquery-bootstrap-in-joomla-25" target="_blank">', '</a>'); } elseif (!JPluginHelper::isEnabled('system', 'pwebj3ui')) { $error = JText::sprintf('MOD_PWEBCONTACT_CONFIG_ENABLE_PWEBLEGACY', '<a href="index.php?option=com_plugins&view=plugins&filter_search=' . urlencode('Perfect Joomla! 3 User Interface') . '" target="_blank">', '</a>'); } else { JLoader::import('cms.html.jquery', JPATH_PLUGINS . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . 'pwebj3ui' . DIRECTORY_SEPARATOR . 'libraries'); } if ($error) { $app->enqueueMessage($error, 'error'); $doc->addScriptDeclaration('window.addEvent("domready", function(){' . 'new Element("div", {class: "pweb-fields-tip", html: \'<span class="badge badge-important">' . $error . '</span>\'}).inject(document.id("jform_params_fields"),"top");' . '});'); } } $doc->addStyleSheet(JUri::root(true) . '/media/mod_pwebcontact/css/admin_j25.css'); } return null; }
public function display($tpl = null) { $user = JFactory::getUser(); $document = JFactory::getDocument(); $url = JUri::root(); $settings = JEMHelper::globalattribs(); // Initialise variables. $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); $this->settings = $settings; $params = $this->state->get('params'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Load css JHtml::_('stylesheet', 'com_jem/backend.css', array(), true); $this->user = $user; # add toolbar $this->addToolbar(); parent::display($tpl); }
/** * Affichage de la vue par défaut * @see JView::display() */ function display($tpl = null) { //Chargement des scripts $document = JFactory::getDocument(); $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); $document->addScript(JUri::root() . 'media/com_owncloudconnect/js/owncloudconnect.js'); //On récupère les variables de session $session = JFactory::getSession(); //On récupère le nom du HOST pour connexion sécurisée via iFrame $this->ref = urlencode(OwncloudconnectHelper::stringEncrypt($_SERVER['HTTP_HOST'])); //On récupère l'adresse de la plateforme ownCloud $param = JComponentHelper::getParams('com_owncloudconnect'); $this->owncloud_platformurl = $param->get('owncloud_platformurl'); //On va chercher si l'utilisateur connecté est enregistré dans la table du composant $this->oc_user = $this->get('Utilisateur'); //Si l'utilisateur peut se connecter à ownCloud, on regarde si d'autres identifiants sont définis, sinon l'utilisateur accède à la plateforme via ses ident en session if (!isset($this->oc_user->forbid_public) || $this->oc_user->forbid_public == 0) { if ($this->oc_user && $this->oc_user->oc_login && $this->oc_user->oc_password) { $this->login = urlencode(OwncloudconnectHelper::stringEncrypt(json_encode(array('login' => $this->oc_user->oc_login, 'pass' => OwncloudconnectHelper::stringDecrypt($this->oc_user->oc_password))))); } else { $this->login = urlencode(OwncloudconnectHelper::stringEncrypt(json_encode(array('login' => $session->get('oc_user'), 'pass' => $session->get('oc_password'))))); } } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } parent::display($tpl); }
public function __construct() { parent::__construct(); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_rsmembership/tables'); $document = JFactory::getDocument(); $config = RSMembershipConfig::getInstance(); $version = (string) new RSMembershipVersion(); // Load our CSS $document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/rsmembership.css?v=' . $version); // Load our JS $document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/rsmembership.js?v=' . $version); if (!RSMembershipHelper::isJ3()) { // Load 2.5 CSS $document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/j2.css?v=' . $version); // Load Bootstrap on 2.5.x if ($config->get('load_bootstrap')) { $document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/bootstrap.min.css?v=' . $version); $document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/jquery.min.js?v=' . $version); $document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/jquery.noconflict.js?v=' . $version); $document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/bootstrap.min.js?v=' . $version); } } else { // Load 3.x CSS $document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/j3.css?v=' . $version); // Load Bootstrap on 3.x if ($config->get('load_bootstrap')) { JHtml::_('bootstrap.framework'); } } }
/** * route * * @return void * * @throws \Exception */ public static function quickRouting() { $app = \JFactory::getApplication(); $input = $app->input; if ($app->isSite()) { $closure = function (\JRouterSite $router, \JUri $uri) use($input, $app) { $route = $uri->getPath(); $route = trim($route, '/'); // Admin if ($route == 'admin') { $uri = \JUri::getInstance(); $target = new \JUri(\JUri::root() . 'administrator'); $target->setQuery($uri->getQuery()); $app->redirect($target); } return array(); }; $router = $app::getRouter(); $router->attachParseRule($closure, JVERSION >= 3.4 ? $router::PROCESS_BEFORE : null); } else { if ($input->get('goezset') !== null) { $plugin = \JTable::getInstance('Extension'); if ($plugin->load(array('name' => 'plg_system_ezset'))) { $extId = $plugin->extension_id; $app->redirect(\JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $extId, false)); exit; } } } }
protected function getInput() { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); JHtml::_('behavior.modal'); $app = JFactory::getApplication(); $document = JFactory::getDocument(); $document->addStyleDeclaration('.tmpl_button{padding: 2px; font-size: 110%;}.tmpl_button img { padding: 0 2px 0 0; margin: 0px;}'); $document->addScript(JUri::base(true) . '/components/com_cobalt/library/js/main.js'); $tmpltype = $this->element['tmpltype']; $invite_label = $this->element['invite_label']; $tmpl_select = $this->element['tmpl_select']; $noparams = $this->element['noparams']; $options = array(); if ((string) $this->element['select'] == '1') { $options[] = JHTML::_('select.option', '', JText::_('CSELECTTEMPLATE')); } $options = array_merge($options, $this->getTmplObjectList($tmpltype)); $options = array_merge($this->getOptions(), $options); $multi = $this->element['multi'] ? 'size="5" multiple="multiple"' : NULL; $script = "<script type='text/javascript'>\n\t\t\tCobalt.addTmplEditLink('{$tmpltype}', '{$this->id}', '" . $app->input->get('tmpl') . "', '" . JUri::root() . "');\n\t\t</script>"; $javascript = " onchange=\"Cobalt.addTmplEditLink('{$tmpltype}', '{$this->id}', '" . $app->input->get('tmpl') . "', '" . JUri::root() . "')\""; if ($noparams) { $script = $javascript = null; } $out = sprintf('<div class="row-fluid"><div class="span8">%s</div><div class="span4" id="%s_link"></div></div>%s', JHTML::_('select.genericlist', $options, $this->name . ($multi ? '[]' : NULL), $multi . $javascript, 'value', 'text', $this->value, "{$this->id}"), str_replace(array(']', '['), '', $this->id), $script); return $out; }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $app = JFactory::getApplication(); if ($app->isSSLConnection()) { $msg = new AimySitemapMessageHelper(); $msg->notice(JText::_('AIMY_SM_CRAWL_HINT_SSL_ONLY')); } if ($this->get_config($app, 'offline')) { $msg = new AimySitemapMessageHelper(); $msg->error(JText::_('AIMY_SM_ERR_SITE_OFFLINE')); $this->addToolbar(); return false; } if (defined('JDEBUG') && JDEBUG) { $msg = new AimySitemapMessageHelper(); $msg->notice(JText::sprintf('AIMY_SM_MSG_CRAWL_DEBUG_ENABLED', AimySitemapLogger::get_path())); } $rights = AimySitemapRightsHelper::getRights(); $this->allow_crawl = $rights->get('aimysitemap.crawl'); $this->allow_config = $rights->get('core.admin'); $this->addToolbar(); if ($this->allow_crawl) { JFactory::getDocument()->addScript(JUri::root() . 'administrator/components/' . 'com_aimysitemap/helpers/crawl.js' . '?r=3.16.0'); } else { $msg = new AimySitemapMessageHelper(); $msg->error(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } parent::display($tpl); }
public function display($tpl = null) { $this->params = JUDownloadHelper::getParams(); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } if (!$this->params->get('activate_maintenance', 0)) { $app = JFactory::getApplication(); $app->redirect(JUri::root()); } $this->_prepareDocument(); $this->_setBreadcrumb(); 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) { // Do not allow cache JFactory::getApplication()->allowCache(false); $jinput = JFactory::getApplication()->input; $mediaParams = JComponentHelper::getParams('com_media'); $mediaModel = JModelLegacy::getInstance('List', 'MediaModel'); $view = $jinput->get('view'); // Set the path definitions $popup_upload = $jinput->get('pop_up', null); $path = 'file_path'; if (substr(strtolower($view), 0, 6) == 'images' || $popup_upload == 1) { $path = 'image_path'; } $media_path = $mediaParams->get($path, 'images'); define('COM_MEDIA_BASE', JPATH_ROOT . '/' . $media_path); define('COM_MEDIA_BASEURL', JUri::root() . $media_path); $lang = JFactory::getLanguage(); JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true); } $document = JFactory::getDocument(); $document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;"); $images = $mediaModel->getImages(); $documents = $mediaModel->getDocuments(); $folders = $mediaModel->getFolders(); $state = $mediaModel->getState(); $this->baseURL = COM_MEDIA_BASEURL; $this->images =& $images; $this->documents =& $documents; $this->folders =& $folders; $this->state =& $state; parent::display($tpl); }
/** * render MegaMene * * @return string */ public static function render() { $tempParams = self::$_templateParameters; $html = ''; $uri = JUri::root(true); if ((string) $tempParams->get('enableMegamenu') == '1') { $doc = JFactory::getDocument(); $doc->addStyleSheet($uri . '/plugins/system/jsntplframework/assets/3rd-party/bootstrap3/css/bootstrap.css'); $doc->addStyleSheet($uri . '/plugins/system/jsntplframework/assets/joomlashine/css/jsn-megamenu-frontend.css'); $doc->addScript($uri . '/plugins/system/jsntplframework/assets/joomlashine/js/megamenu/megamenu-frontend.js'); $templateName = isset($doc->template) ? $doc->template : null; if (empty($templateName) or $templateName == 'system') { $templateDetails = JFactory::getApplication()->getTemplate(true); $templateName = $templateDetails->template; } $templateUrl = $uri . '/templates/' . $templateName; // Load megamenu Template CSS if (is_readable(JPATH_ROOT . '/templates/' . $templateName . '/css/megamenu/jsn_megamenu.css')) { $doc->addStylesheet($templateUrl . '/css/megamenu/jsn_megamenu.css'); } $mmItems = self::megamenuItems(); $renderShortcodeItems = self::renderShortcode($mmItems); $items = self::getMenuList(); $html .= self::beginMegamenu(); if (count($items)) { $html .= self::middleMegamenu($items, $mmItems, $renderShortcodeItems); } $html .= self::endMegamenu(); } return $html; }
/** * Load up all published moods on startup */ public function __construct() { $this->enabled = CFactory::getConfig()->get("enablemood"); $db = JFactory::getDBO(); $sql = 'SELECT * FROM ' . $db->quoteName('#__community_moods') . ' ORDER BY ' . $db->quoteName('ordering') . ' ASC'; $db->setQuery($sql); $result = $db->loadObjectList(); // build and pre-parse assoc result array foreach ($result as $mood) { // legacy - predefined (non-custom) moods use untraslated mood strings as identifiers if (!$mood->custom) { $mood->id = $mood->title; $mood->title = JText::_('COM_COMMUNITY_MOOD_SHORT_' . strtoupper($mood->title)); } // apply description translations for frontend $mood->description = JText::_($mood->description); if ($mood->custom) { $mood->title = JText::_($mood->title); $filename = "mood_" . $mood->id . "." . $mood->image; if (file_exists(COMMUNITY_PATH_ASSETS . $filename)) { $mood->image = JUri::root() . str_replace(JPATH_ROOT, '', COMMUNITY_PATH_ASSETS) . $filename; } else { $mood->image = ''; } } $this->moods[$mood->id] = $mood; } unset($result); }
public static function getPermalink($types = 'canonical', $object = 'joomla_article') { $lang_code = JFactory::getLanguage()->getTag(); $permalink = ''; $root = substr(JUri::root(), 0, -1); if (!is_array($types)) { $types = array(0 => $types); } if (count($types)) { foreach ($types as $type) { if ($permalink != '') { break; } if ($type == 'canonical') { if (isset(JFactory::getApplication()->cck_canonical_url)) { $permalink = $root . JFactory::getApplication()->cck_canonical_url; } } elseif ($type == 'current') { $properties = array('routes'); require_once JPATH_SITE . '/plugins/cck_storage_location/' . $object . '/' . $object . '.php'; $properties = JCck::callFunc('plgCCK_Storage_Location' . $object, 'getStaticProperties', $properties); if (isset($properties['routes'][$lang_code]) && $properties['routes'][$lang_code] != '') { $permalink = $root . JRoute::_($properties['routes'][$lang_code]); } } } } return $permalink; }
/** * Method to get the field input markup for a generic list. * Use the multiple attribute to enable multiselect. * * @return string The field input markup. */ protected function getInput() { // Get the relative path to the assets to avoid tpl dependencies $relativePath = trim(str_replace(JPATH_SITE, '', dirname(__DIR__)), '/'); $tplUrl = JUri::root() . $relativePath; $asset = isset($this->element['asset']) ? $this->element['asset'] : null; if (!empty($asset)) { $extension = pathinfo($asset, PATHINFO_EXTENSION); if (!empty($extension)) { $filePath = JPATH_SITE . '/' . $relativePath . '/' . $extension . '/' . $asset; $versionPreffix = version_compare(JVERSION, '3.0', '<') ? '.j25' : '.j3'; $versionedFile = str_replace('.' . $extension, $versionPreffix . '.' . $extension, $filePath); if (file_exists($versionedFile)) { $asset = str_replace('.' . $extension, $versionPreffix . '.' . $extension, $asset); } $doc = JFactory::getDocument(); switch ($extension) { case 'js': $doc->addScript($tplUrl . '/' . $extension . '/' . $asset); break; case 'css': $doc->addStyleSheet($tplUrl . '/' . $extension . '/' . $asset); break; default: // Asset extension not supported break; } } } return; }
/** * Retrieve path to file in hard disk based from file URL * * @param string $file URL to the file * @return string */ public static function getFilePath($file) { // Located file from root if (strpos($file, '/') === 0) { if (file_exists($tmp = realpath(str_replace(JUri::root(true), JPATH_ROOT, $file)))) { return $tmp; } elseif (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $file))) { return $tmp; } elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $file))) { return $tmp; } } if (strpos($file, '://') !== false && JURI::isInternal($file)) { $path = parse_url($file, PHP_URL_PATH); if (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $path))) { return $tmp; } elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $path))) { return $tmp; } } $rootURL = JUri::root(); $currentURL = JUri::current(); $currentPath = JPATH_ROOT . '/' . substr($currentURL, strlen($rootURL)); $currentPath = str_replace(DIRECTORY_SEPARATOR, '/', $currentPath); $currentPath = dirname($currentPath); return JPath::clean($currentPath . '/' . $file); }
function layout($block, $index) { $icon = JUri::root(true) . $this->directory . $block['icon']; $title = $block['title']; $link = $block['link']; return ' <div class="quicklinks-block"> <div class="quicklinks-icon"><img src="' . $icon . '" /></div> <div class="quicklinks-title"> <span>' . JTEXT::_('MC_RQL_TITLE') . '</span> <input class="text_area quick-input" id="jform_params_title-' . $index . '" name="jform[params][title-' . $index . ']" value="' . $title . '" type="text" /> </div> <div class="quicklinks-link"> <span>' . JTEXT::_('MC_RQL_LINK') . '</span> <input class="text_area quick-input" id="jform_params_link-' . $index . '" name="jform[params][link-' . $index . ']" value="' . $link . '" type="text" /> </div> <div class="quicklinks-iconslist"> <span>' . JTEXT::_('MC_RQL_ICON') . '</span> <select class="inputbox quicklinks-select" id="jform_params_icon-' . $index . '" name="jform[params][icon-' . $index . ']"> ' . $this->populateIcons($icon) . ' </select> </div> <div class="quicklinks-controls"> <div class="quicklinks-add"></div> <div class="quicklinks-remove"></div> </div> <div class="quicklinks-move"></div> </div> '; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { JHtml::_('jquery.framework'); $itemid = JFactory::getApplication()->input->getInt('id', 0); $document = JFactory::getDocument(); $document->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/customfield.js'); JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_NO_FIELDS'); JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_LOAD_FIELDS'); JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_BTN_EDIT_GROUP'); $html = '<div id="' . $this->id . '" class="form-horizontal customfield" data-fieldname="' . $this->fieldname . '" data-controller="' . $this->element['controller'] . '" data-itemid="' . $itemid . '"> <div class="form-container"></div> <img class="img-loading" src="' . JUri::root() . '/media/system/images/modal/spinner.gif" /> <div class="control-group"> <div class="controls"> <button class="btn btn-primary btn-reload"><span class="icon-refresh"></span> ' . JText::_('COM_DZPRODUCT_RELOAD_FIELDS') . '</button> </div> </div> </div>'; return $html; }
protected function setDocument() { $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_JUDOWNLOAD_SEARCH_DOCUMENTS')); $document->addStyleSheet(JUri::root() . "administrator/components/com_judownload/assets/css/reset_css.css"); $document->addStyleSheet(JUri::root() . "administrator/components/com_judownload/assets/css/jquery-spliter.css"); $document->addScript(JUri::root() . "administrator/components/com_judownload/assets/js/bootstrap-multiselect.js"); $document->addScript(JUri::root() . "administrator/components/com_judownload/assets/js/jquery.splitter.js"); $multiSelect = 'jQuery(document).ready(function($) { $("#search-in").multiselect({ buttonClass: "btn btn-mini", buttonContainer: "<div class=\\"select-fields btn-group pull-left\\" />", maxHeight: 250, enableFiltering: false }); }); '; $splitter = ' jQuery(document).ready(function($) { $("#splitterContainer").splitter({name: "judownload", minAsize:150, maxAsize:500, splitVertical:true, A:$("#leftPane"), B:$("#rightPane"), slave:$("#rightSplitterContainer"), closeableto:0}); }); '; $document->addScriptDeclaration($multiSelect); $document->addScriptDeclaration($splitter); }
protected function getInput() { $this->params = $this->element->attributes(); JHtml::_('jquery.framework'); NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/script.min.js'); if ($file = $this->get('file')) { $label = $this->get('label', 'the main extension'); NNFieldDependency::setMessage($file, $label); return ''; } $path = $this->get('path') == 'site' ? '' : '/administrator'; $label = $this->get('label'); $file = $this->get('alias', $label); $file = preg_replace('#[^a-z-]#', '', strtolower($file)); $extension = $this->get('extension'); switch ($extension) { case 'com': $file = $path . '/components/com_' . $file . '/com_' . $file . '.xml'; break; case 'mod': $file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml'; break; case 'plg_editors-xtd': $file = '/plugins/editors-xtd/' . $file . '.xml'; break; default: $file = '/plugins/system/' . $file . '.xml'; break; } $label = JText::_($label) . ' (' . JText::_('NN_' . strtoupper($extension)) . ')'; NNFieldDependency::setMessage($file, $label); return ''; }
function __construct() { JViewLegacy::__construct(); $this->smarty=new BidsSmarty(); JHtml::_('behavior.mootools'); JHTML::script(JUri::root().'components/'.APP_EXTENSION.'/js/auctions.js'); }