function modifyAttrs($lnkAttrs, $imgAttrs, $group, $params) { $lnkAttrs['rel'] = 'sexylightbox'; if ($group) { $lnkAttrs['rel'] .= '[' . $group . ']'; } $link = $lnkAttrs['href']; $bgColor = $params->get('lightbox_bgColor'); if ($this->isLink($link)) { $uri = new JURI($link); $uri->setVar('TB_iframe', 'true'); $uri->setVar('height', intval($params->get('lightbox_height'), 10)); $uri->setVar('width', intval($params->get('lightbox_width'), 10)); if ($bgColor) { $uri->setVar('background', $bgColor); } $lnkAttrs['href'] = $uri->toString(); } else { if ($bgColor) { $uri = new JURI($link); $uri->setVar('background', $bgColor); $lnkAttrs['href'] = $uri->toString(); } } return parent::modifyAttrs($lnkAttrs, $imgAttrs, $group, $params); }
static function _($plainURL) { $config = JFactory::getConfig(); $addSuffix = $config->get('sef_suffix', 0) == 1; $url = JRoute::_($plainURL); if ($addSuffix) { $uri = new JURI($plainURL); $format = $uri->getVar('format', 'html'); $format = strtolower($format); if (!in_array($format, array('html', 'raw'))) { // Save any query parameters if (strstr($url, '?')) { list($url, $qparams) = explode('?', $url, 2); $qparams = '?' . $qparams; } else { $qparams = ''; } // Remove the suffix $basename = basename($url); $exploded = explode(".", $basename); $extension = end($exploded); $realbase = basename($url, '.' . $extension); $url = str_replace($basename, $realbase, $url) . $qparams; // Add a format parameter $uri = new JURI($url); $uri->setVar('format', $format); $url = $uri->toString(); } } return $url; }
/** * * Ajax render to store in session */ public function ajaxGetRender() { /** load libraries for the system rener **/ JSNFactory::localimport('libraries.joomlashine.mode.rawmode'); JSNFactory::localimport('libraries.joomlashine.menu.menuitems'); /** get url **/ $render_url = JRequest::getVar('render_url', ''); $urlRender = base64_decode($render_url); $session = JSession::getInstance('files', array('name' => 'jsnpoweradmin')); if ($render_url == '') { $urlRender = JSNDatabase::getDefaultPage()->link; } $currUri = new JURI($urlRender); if (!$currUri->hasVar('Itemid')) { $currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id); } $urlString = $currUri->toString(); $session->set('rawmode_render_url', base64_encode($urlString)); $parts = JString::parse_url($urlString); if (!empty($parts['query'])) { parse_str($parts['query'], $params); } else { $params = array(); } $jsntemplate = JSNFactory::getTemplate(); $jsnrawmode = JSNRawmode::getInstance($params); $jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions()); $jsnrawmode->renderAll(); $session = JSession::getInstance('files', array('name' => 'jsnajaxgetrender')); $session->set('component', $jsnrawmode->getHTML('component')); $session->set('jsondata', $jsnrawmode->getScript('positions', 'JSON')); jexit('success'); }
function checkLogin() { global $mainframe; DEFINE('GOTOSTARTPAGE_COOKIE', 'ap_gotostartpage'); DEFINE('LOGINPAGELOCATION_COOKIE', 'ap_loginpagelocation'); DEFINE('STARTPAGE_COOKIE', 'ap_startpage'); $gotostartpage = @$_COOKIE[GOTOSTARTPAGE_COOKIE]; if ($gotostartpage) { setcookie(GOTOSTARTPAGE_COOKIE, 0); $uri = JFactory::getURI(); $url = $uri->toString(); $loginpagelocation = @$_COOKIE[LOGINPAGELOCATION_COOKIE]; $loginpagelocationuri = new JURI($loginpagelocation); $query = $loginpagelocationuri->getQuery(); if ($query && strpos($query, 'com_login') === FALSE) { if ($loginpagelocation && $url != $loginpagelocation) { $mainframe->redirect($loginpagelocation); } } else { $startpage = @$_COOKIE[STARTPAGE_COOKIE]; if ($startpage && $url != $startpage) { $mainframe->redirect($startpage); } } } }
/** * Function for getting the list of languages * * @return array Language list */ public static function getList() { $app = JFactory::getApplication(); $languages = JLanguageHelper::getLanguages(); $db = JFactory::getDbo(); $Itemid = $app->input->getInt('Itemid', 0); $uri = new JURI(Juri::current()); $uri->delVar('lang'); $uri->delVar('Itemid'); $location = htmlspecialchars($uri->getQuery()); if (!empty($location)) { $location .= '&'; } if (!$Itemid) { $active = $app->getMenu()->getActive(); if ($active) { $Itemid = $active->id; } } // For every language we load menu items language specific alias and params foreach ($languages as $i => $language) { $db->forceLanguageTranslation = $language->lang_code; RMenu::resetJoomlaMenuItems(); $db->forceLanguageTranslation = false; $languages[$i]->active = $language->lang_code == JFactory::getLanguage()->getTag(); $languages[$i]->link = RRoute::_('index.php?' . $location . 'lang=' . $language->sef . ($Itemid > 0 ? '&Itemid=' . $Itemid : '')); } // After we are done we reset it the way it was RMenu::resetJoomlaMenuItems(); return $languages; }
public static function getUri($layout = null) { $uri = new JURI('index.php?option=com_kunena&view=announcement'); if ($layout) { $uri->setVar('layout', $layout); } return $uri; }
/** * Update the current walk with passed in form data */ public function updateWeekend(array $formData) { $this->loadWeekend($formData['id']); // Update all basic fields // Fields that can't be saved are just ignored // Invalid fields throw an exception - display this to the user and continue foreach ($formData as $name => $value) { try { $this->weekend->{$name} = $value; } catch (UnexpectedValueException $e) { // TODO: Error message echo "<p>"; var_dump($name); var_dump($value); var_dump($e->getMessage()); echo "</p>"; } } // Date fields need to be converted if (!empty($formData['startdate'])) { $this->weekend->start = strtotime($formData['startdate']); } else { $this->weekend->start = null; } if (!empty($formData['enddate'])) { $this->weekend->endDate = strtotime($formData['enddate']); } else { $this->weekend->endDate = null; } // Alterations $this->weekend->alterations->incrementVersion(); $this->weekend->alterations->setDetails(!empty($formData['alterations_details'])); $this->weekend->alterations->setCancelled(!empty($formData['alterations_cancelled'])); $this->weekend->alterations->setOrganiser(!empty($formData['alterations_organiser'])); $this->weekend->alterations->setDate(!empty($formData['alterations_date'])); if ($this->weekend->isValid()) { $this->weekend->save(); // Redirect to the list page $itemid = JRequest::getInt('returnPage'); if (empty($itemid)) { return false; } $item = JFactory::getApplication()->getMenu()->getItem($itemid); $link = new JURI("/" . $item->route); // Jump to the event? if (JRequest::getBool('jumpToEvent')) { $link->setFragment("weekend_" . $this->weekend->id); } JFactory::getApplication()->redirect($link, "Weekend saved"); } }
/** * Update the current walk with passed in form data */ public function updateWI(array $formData) { // Load an existing walk instance (if any) if (!empty($formData['id'])) { $factory = SWG::walkInstanceFactory(); $this->wi = $factory->getSingle($formData['id']); } else { $this->wi = new WalkInstance(); } // Update all basic fields // Fields that can't be saved are just ignored // Invalid fields throw an exception - display this to the user and continue foreach ($formData as $name => $value) { try { $this->wi->{$name} = $value; } catch (UnexpectedValueException $e) { echo "<p>"; var_dump($name); var_dump($value); var_dump($e->getMessage()); echo "</p>"; } } // Now do the fields that have to be done separately // Date & time $this->wi->start = strtotime($formData['date'] . " " . $formData['meetTime']); // Alterations $this->wi->alterations->incrementVersion(); $this->wi->alterations->setDetails($formData['alterations_details']); $this->wi->alterations->setCancelled($formData['alterations_cancelled']); $this->wi->alterations->setPlaceTime($formData['alterations_placeTime']); $this->wi->alterations->setOrganiser($formData['alterations_organiser']); $this->wi->alterations->setDate($formData['alterations_date']); if ($this->wi->isValid()) { $this->wi->save(); // Redirect to the list page $itemid = JRequest::getInt('returnPage'); if (empty($itemid)) { return false; } $item = JFactory::getApplication()->getMenu()->getItem($itemid); $link = new JURI("/" . $item->route); // Jump to the event? if (JRequest::getBool('jumpToEvent')) { $link->setFragment("walk_" . $this->wi->id); } JFactory::getApplication()->redirect($link, "Walk scheduled"); } else { } }
public static function fetchHead($params, $module) { $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $template = $mainframe->getTemplate(); JHTML::_('behavior.framework'); $language = JFactory::getLanguage(); $mapApi = 'http://maps.google.com/maps/api/js?sensor=true&language=' . $language->getTag(); if ($params->get('weather')) { $mapApi .= '&libraries=weather'; } $document->addScript($mapApi); if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/js/default.js')) { $document->addScript(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/js/default.js'); } else { $document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/btbase64.min.js'); if ($params->get('enable-custom-infobox')) { $document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/infobox.js'); } $document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/default.js'); } if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/css/styles.css')) { $document->addStyleSheet(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/css/style.css'); } else { $document->addStyleSheet(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/css/style.css'); } }
/** * fetch Element */ function fetchElement($name, $values, &$node, $control_name) { $mediaPath = JURI::root() . str_replace(DS, '/', str_replace(JPATH_ROOT, '', dirname(dirname(dirname(__FILE__))))) . '/assets/'; JHTML::stylesheet('form.css', $mediaPath); $attributes = $node->attributes(); $class = isset($attributes['group']) && trim($attributes['group']) == 'end' ? 'lof-end-group' : 'lof-group'; $title = isset($attributes['title']) ? JText::_($attributes['title']) : 'Group'; $title = isset($attributes['title']) ? JText::_($attributes['title']) : ''; $for = isset($attributes['for']) ? $attributes['for'] : ''; if (isset($attributes['onoff'])) { // echo $control_name; die; // echo $name; die; // echo '<pre>'.print_r($values,1); die; $string = '<div ' . ($title ? "" : 'style="display:none"') . ' class="' . $class . '" title="' . $for . '">'; $checked = $values ? 'checked="checked"' : ""; // echo $checked; die; $string .= '<input type="checkbox" class="lof-onoff" id="params' . $for . '" value="" ' . $checked . ' name="' . $control_name . '[' . $for . ']" /><b>' . $title . '</b></div>'; return $string; } else { $string = '<div ' . ($title ? "" : 'style="display:none"') . ' class="' . $class . '" title="' . $for . '">' . $title . '</div>'; if (!defined('LOF_ADDED_TIME')) { $string .= '<input type="hidden" class="text_area" value="' . time() . '" id="paramsmain_lof_added_time" name="params[lof_added_time]">'; define('LOF_ADDED_TIME', 1); } } if (!defined('ADD_MEDIA_CONTROL')) { define('ADD_MEDIA_CONTROL', 1); $uri = str_replace(DS, "/", str_replace(JPATH_SITE, JURI::base(), dirname(__FILE__))); $uri = str_replace("/administrator/", "", $uri); JHTML::stylesheet('form.css', $uri . "/media/"); JHTML::script('form.js', $uri . "/media/"); } return $string; }
function fetchButton($type = 'Acyactions') { $url = JURI::base() . "index.php?option=com_acymailing&ctrl=filter&tmpl=component"; $top = 0; $left = 0; $width = 700; $height = 500; $text = JText::_('ACTIONS'); if (!ACYMAILING_J30) { $class = "icon-32-acyaction"; } else { $class = "icon-14-acyaction"; } $js = "\r\nfunction getAcyActionUrl() {\r\n\ti = 0;\r\n\tmylink = 'index.php?option=com_acymailing&ctrl=filter&tmpl=component&subid=';\r\n\twhile(window.document.getElementById('cb'+i)){\r\n\t\tif(window.document.getElementById('cb'+i).checked)\r\n\t\t\tmylink += window.document.getElementById('cb'+i).value+',';\r\n\t\ti++;\r\n\t}\r\n\treturn mylink;\r\n}\r\n"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); if (!ACYMAILING_J30) { JHTML::_('behavior.modal', 'a.modal'); return '<a href="' . $url . '" class="modal" onclick="this.href=getAcyActionUrl();" rel="{handler: \'iframe\', size: {x: ' . $width . ', y: ' . $height . '}}"><span class="' . $class . '" title="' . $text . '"></span>' . $text . '</a>'; } $html = '<button class="btn btn-small modal" data-toggle="modal" data-target="#modal-' . $type . '"><i class="' . $class . '"></i> ' . $text . '</button>'; $params['title'] = $text; $params['url'] = '\'+getAcyActionUrl()+\''; //$url; $params['height'] = $height; $params['width'] = $width; $modalHtml = JHtml::_('bootstrap.renderModal', 'modal-' . $type, $params); $html .= str_replace(array('id="modal-' . $type . '"'), array('id="modal-' . $type . '" style="width:' . ($width + 20) . 'px;height:' . ($height + 90) . 'px;margin-left:-' . ($width + 20) / 2 . 'px"'), $modalHtml); $html .= '<script>' . "\r\n" . 'jQuery(document).ready(function(){jQuery("#modal-' . $type . '").appendTo(jQuery(document.body));});' . "\r\n" . '</script>'; return $html; }
function &getItem($translation = null) { $table = clone parent::getItem(); // I could pick up the URL here or treat as a special content element field type? if ($table->type == 'component') { // Note that to populate the initial value of the urlparams $conf = JFactory::getConfig(); $elementTable = $conf->get('falang.elementTable', false); foreach ($elementTable->Fields as $efield) { if ($efield->Name == "link" && isset($efield->translationContent->value) && $efield->translationContent->value !== "") { $uri = new JURI($efield->translationContent->value); if ($uri->getVar("option", false)) { $table->link = $efield->translationContent->value; } } } $url = str_replace('index.php?', '', $table->link); $url = str_replace('&', '&', $url); $table->linkparts = null; if (strpos($url, '&') !== false) { $url = str_replace('&', '&', $url); } parse_str($url, $table->linkparts); $db = $this->getDBO(); if ($component = @$table->linkparts['option']) { $query = 'SELECT `extension_id`' . ' FROM `#__extensions`' . ' WHERE `element` = "' . $db->escape($component) . '"'; $db->setQuery($query); $table->componentid = $db->loadResult(); } } $item = $table; return $item; }
public function checkAclViolation($data) { $redirectUrl = XiptRoute::_($this->getRedirectUrl()); $redirectURI = new JURI($redirectUrl); $redirectVar = $redirectURI->getQuery(true); foreach ($redirectVar as $key => $value) { if (array_key_exists($key, $data)) { if ($value != $data[$key]) { return true; } } } return false; }
public function __construct($component, $componentParams, $article, $articleParams, $properties) { parent::__construct($component, $componentParams, $article, $articleParams); $this->print = isset($properties['print']) ? $properties['print'] : ''; $this->pageHeading = $this->_componentParams->get('show_page_heading', 1) ? $this->_componentParams->get('page_heading') : ''; $this->titleLink = $this->_articleParams->get('link_titles') && !empty($this->_article->readmore_link) ? $this->_article->readmore_link : ''; $this->emailIconVisible = $this->emailIconVisible && !$this->print; $this->editIconVisible = $this->editIconVisible && !$this->print; $this->categoryLink = $this->_articleParams->get('link_category') && $this->_article->catslug ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->catslug)) : ''; $this->category = $this->_articleParams->get('show_category') ? $this->_article->category_title : ''; $this->categoryLink = $this->_articleParams->get('link_category') && $this->_article->catslug ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->catslug)) : ''; $this->parentCategory = $this->_articleParams->get('show_parent_category') && $this->_article->parent_slug != '1:root' ? $this->_article->parent_title : ''; $this->parentCategoryLink = $this->_articleParams->get('link_parent_category') && $this->_article->parent_slug ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->parent_slug)) : ''; $this->author = $this->_articleParams->get('show_author') && !empty($this->_article->author) ? $this->_article->created_by_alias ? $this->_article->created_by_alias : $this->_article->author : ''; if (strlen($this->author) && $this->_articleParams->get('link_author')) { $needle = 'index.php?option=com_contact&view=contact&id=' . $this->_article->contactid; $menu = JFactory::getApplication()->getMenu(); $item = $menu->getItems('link', $needle, true); $this->authorLink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle; } else { $this->authorLink = ''; } $this->toc = isset($this->_article->toc) ? $this->_article->toc : ''; $this->text = $this->_articleParams->get('access-view') ? $this->_article->text : ''; $user = JFactory::getUser(); $this->introVisible = !$this->_articleParams->get('access-view') && $this->_articleParams->get('show_noauth') && $user->get('guest'); $this->intro = $this->_article->introtext; if (!$this->_articleParams->get('access-view') && $this->_articleParams->get('show_noauth') && $user->get('guest') && $this->_articleParams->get('show_readmore') && $this->_article->fulltext != null) { $attribs = json_decode($this->_article->attribs); if ($attribs->alternative_readmore == null) { $this->readmore = JText::_('COM_CONTENT_REGISTER_TO_READ_MORE'); } elseif ($this->readmore = $this->_article->alternative_readmore) { if ($this->_articleParams->get('show_readmore_title', 0) != 0) { $this->readmore .= JHtml::_('string.truncate', $this->_article->title, $this->_articleParams->get('readmore_limit')); } } elseif ($this->_articleParams->get('show_readmore_title', 0) == 0) { $this->readmore = JText::sprintf('COM_CONTENT_READ_MORE_TITLE'); } else { $this->readmore = JText::_('COM_CONTENT_READ_MORE') . JHtml::_('string.truncate', $this->_article->title, $this->_articleParams->get('readmore_limit')); } $link = new JURI(JRoute::_('index.php?option=com_users&view=login')); $this->readmoreLink = $link->__toString(); } else { $this->readmore = ''; $this->readmoreLink = ''; } $this->paginationPosition = isset($this->_article->pagination) && $this->_article->pagination && isset($this->_article->paginationposition) ? ($this->_article->paginationposition ? 'below' : 'above') . ' ' . ($this->_article->paginationrelative ? 'full article' : 'text') : ''; $this->showLinks = isset($this->_article->urls) && is_string($this->_article->urls) && !empty($this->_article->urls); }
/** * Method to parse the router * * @param JRouter $router JRouter instance * @param JURI $uri Current JURI instance * * @return array */ public function parseRoute($router, $uri) { $path = $uri->getPath(); $segments = explode('/', $path); $alias = end($segments); if (preg_match('/^([0-9])\\-/', $alias) == false) { $alias = preg_replace('/\\-$/', '', $alias); $slug = $this->getSlugByAlias($alias); if (!empty($slug)) { $path = str_replace($alias, $slug, $path); $uri->setPath($path); } } return array(); }
function getBlogItemLink($item) { if ($item->params->get('access-view')) { $link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language)); } else { $menu = JFactory::getApplication()->getMenu(); $active = $menu->getActive(); $itemId = $active->id; $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId); $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language)); $link = new JURI($link1); $link->setVar('return', base64_encode(urlencode($returnURL))); } return $link; }
/** * RETURN PAY HTML FORM * */ function onTP_GetHTML($vars) { $vars = $this->preFormatingData($vars); $plgPaymentEpaydkHelper = new plgPaymentEpaydkHelper(); // Split the name in first and last name $user = JFactory::getUser(); $nameParts = $user->name; // explode(' ', $user->name, 2); $firstName = $user->name; $lastName = $user->name; // Get the base URL without the path $rootURL = rtrim(JURI::base(), '/'); $subpathURL = JURI::base(true); if (!empty($subpathURL) && $subpathURL != '/') { $rootURL = substr($rootURL, 0, -1 * strlen($subpathURL)); } // Separate URL variable as it cannot be a part of the md5 checksum $url = $this->getPaymentURL(); $data = array('merchant' => $this->getMerchantID(), 'success' => $vars->return, 'cancel' => $vars->cancel_return, 'postback' => $vars->notify_url, 'orderid' => $vars->order_id, 'currency' => strtoupper($vars->currency_code), 'amount' => $vars->amount * 100, 'cardtypes' => implode(',', $this->params->get('cardtypes', array())), 'instantcapture' => '1', 'instantcallback' => '1', 'language' => $this->params->get('language', '0'), 'ordertext' => 'Order id' . ' - [ ' . $vars->order_id . ' ]', 'windowstate' => '3', 'ownreceipt' => '0', 'md5' => $this->params->get('secret', '')); if ($this->params->get('md5', 1)) { // Security hash - must be compiled from ALL inputs sent $data['md5'] = md5(implode('', $data)); } else { $data['md5'] = ''; } $data['actionURL'] = $url; // dont make md5 $data['submiturl'] = $vars->submiturl; // Set array as object for compatability $data = (object) $data; $html = $this->buildLayout($data); return $html; }
/** * 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 11.1 */ protected function getInput() { $document = JFactory::getDocument(); $jsPath = JURI::root(true) . '/modules/mod_currentdatetime/js'; $joomlaVersion = new JVersion(); if ($joomlaVersion->isCompatible('3')) { JHtml::_('jquery.ui', array('core', 'sortable')); } else { $document->addStyleSheet($jsPath . '/25/css/chosen.min.css'); $document->addScript($jsPath . '/25/jquery.min.js'); $document->addScript($jsPath . '/25/jquery-noconflict.js'); $document->addScript($jsPath . '/25/chosen.jquery.min.js'); $document->addScript($jsPath . '/25/jquery.ui.core.min.js'); $document->addScript($jsPath . '/25/jquery.ui.widget.min.js'); $document->addScript($jsPath . '/25/jquery.ui.mouse.min.js'); $document->addScript($jsPath . '/25/jquery.ui.sortable.min.js'); } $document->addScript($jsPath . '/jquery-chosen-sortable.min.js'); $script = 'jQuery(function(){jQuery(".chzn-sortable").chosen().chosenSortable();});'; $document->addScriptDeclaration($script); if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $html = parent::getInput(); return $html; }
function getMessage($extension = '', $xml = '', $version = '', $addmargin = 0) { if (!$extension || !$xml && !$version) { return; } $alias = preg_replace('#[^a-z\\-]#', '', str_replace('?', '-', strtolower($extension))); if ($xml) { $xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . str_replace('/', DS, $xml)); if ($xml && isset($xml['version'])) { $version = $xml['version']; } } if (!$version) { return; } JHTML::_('behavior.mootools'); $document =& JFactory::getDocument(); $document->addScript(JURI::root(true) . '/plugins/system/nonumberelements/js/script.js?v=' . $this->_version); $url = 'http://www.nonumber.nl/ext/version.php?ext=' . $alias . '&version=' . $version; $script = "\n\t\t\twindow.addEvent( 'domready', function() {\n\t\t\t\tnnScripts.loadajax(\n\t\t\t\t\t'" . $url . "',\n\t\t\t\t\t'nnScripts.displayVersion( \\'" . $alias . "\\', data )',\n\t\t\t\t\t'nnScripts.displayVersion( \\'" . $alias . "\\', \\'\\' )'\n\t\t\t\t);\n\t\t\t});\n\t\t"; $document->addScriptDeclaration($script); $msg = html_entity_decode(JText::sprintf('NN_A_NEWER_VERSION_IS_AVAILABLE', 'http://www.nonumber.nl/' . $alias . '/download', '<span id="nonumber_newversionnumber_' . $alias . '"></span>', $version), ENT_COMPAT, 'UTF-8'); $margin = $addmargin ? '10px;' : '3px;'; $msg = '<div style="border:3px solid #F0DC7E;color:#CC0000;margin-bottom:' . $margin . '"><div style="padding: 2px 5px;background-color:#EFE7B8">' . $msg . '</div></div>'; $msg = '<div id="nonumber_version_' . $alias . '" style="display: none;">' . $msg . '</div>'; return $msg; }
function sendMemberDaytimeToAdmin($member_id, $service_id, $daytime_id) { define("BodyMemberDaytimeToAdmin", "<h1>Nouvelle inscription à une tranche horaire</h1><p>Un bénévole s'est inscrit à un secteur / tranche horaire.</p><p><strong>Nom :</strong> %s <br /><strong>Secteur :</strong> %s<br /><strong>Date :</strong> %s<br /><strong>Tranche horaire :</strong> %s</p><p><a href=\"" . JURI::root() . "/administrator/index.php?option=com_estivole&view=member&layout=edit&member_id=%s\">Cliquez ici</a> pour valider l'inscription et/ou recontacter le bénévole.</p>"); define("SubjectMemberDaytimeToAdmin", "Nouvelle inscription à une tranche horaire"); $db = JFactory::getDBO(); $query = $db->getQuery(TRUE); $this->user = JFactory::getUser(); // Get the dispatcher and load the user's plugins. $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('user'); $data = new JObject(); $data->id = $this->user->id; // Trigger the data preparation event. $dispatcher->trigger('onContentPrepareData', array('com_users.profilestivole', &$data)); $userProfilEstivole = $data; $userName = $userProfilEstivole->profilestivole['firstname'] . ' ' . $userProfilEstivole->profilestivole['lastname']; $query->select('*'); $query->from('#__estivole_members as b, #__estivole_services as s, #__estivole_daytimes as d'); $query->where('b.member_id = ' . (int) $member_id); $query->where('s.service_id = ' . (int) $service_id); $query->where('d.daytime_id = ' . (int) $daytime_id); $db->setQuery($query); $mailModel = $db->loadObject(); $mail = JFactory::getMailer(); $mail->setBody(sprintf(constant("BodyMemberDaytimeToAdmin"), $userName, $mailModel->service_name, date('d-m-Y', strtotime($mailModel->daytime_day)), date('H:i', strtotime($mailModel->daytime_hour_start)) . ' - ' . date('H:i', strtotime($mailModel->daytime_hour_end)), $mailModel->member_id)); $mail->setSubject(constant("SubjectMemberDaytimeToAdmin")); $mail->isHtml(); $recipient = array('*****@*****.**', $mailModel->email_responsable); $mail->addRecipient($recipient); $mail->Send('*****@*****.**'); }
/** * Routes URLs * * @access public */ function onAfterInitialise() { global $mainframe; $uri =& JURI::getInstance(); $router =& $mainframe->getRouter(); $router->attachParseRule('parseJumiRouter'); }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function render($name) { $mainframe =& JFactory::getApplication(); $button = new JObject(); if ($mainframe->isSite()) { $enable_frontend = $this->params->enable_frontend; if (!$enable_frontend) { return $button; } } JHTML::_('behavior.modal'); $document =& JFactory::getDocument(); $button_style = 'modulesanywhere'; if (!$this->params->button_icon) { $button_style = 'blank blank_modulesanywhere'; } $document->addStyleSheet(JURI::root(true) . '/plugins/editors-xtd/modulesanywhere/css/style.css'); $link = 'index.php?nn_qp=1' . '&folder=plugins.editors-xtd.modulesanywhere' . '&file=modulesanywhere.inc.php' . '&name=' . $name; $text = JText::_(str_replace(' ', '_', $this->params->button_text)); if ($text == str_replace(' ', '_', $this->params->button_text)) { $text = JText::_($this->params->button_text); } $button->set('modal', true); $button->set('link', $link); $button->set('text', $text); $button->set('name', $button_style); $button->set('options', "{handler: 'iframe', size: {x:window.getSize().x-100, y: window.getSize().y-100}}"); return $button; }
public function fetchElement($name, $value, &$node, $control_name) { $application = JFactory::getApplication(); $document = JFactory::getDocument(); $fieldName = $control_name . '[' . $name . ']'; $link = JURI::root() . COLOR_PICKER_URL . 'index.php?object=' . $name . '&color=' . preg_replace('/([^a-zA-Z0-9]?)/', '', $value); JHTML::script('colorpicker.js', COLOR_PICKER_URL); JHTML::_('behavior.modal', 'a.modal'); $title = JText::_('Select a Color'); $short_title = JText::_('Select'); $name_value = !empty($value) ? $value : $title; $background_color = !empty($value) ? $value : '#ffffff'; $html = <<<EOF <div style="float:left;"> <input style="background-color:#ffffff;" type="text" id="{$name}_name" value="{$name_value}" disabled="disabled" size="12" /> </div> <div style="float:left;"> <div style="background-color: {$background_color}; width:15px; height:15px; border: 1px solid #a3a3a3; margin-left:2px" id="{$name}_preview"></div> </div> <div class="button2-left"> <div class="blank"> <a class="modal" title="{$title}" href="{$link}" rel="{handler:'iframe', size: {x: 450, y: 375}}">{$short_title}</a> </div> </div> <input type="hidden" id="{$name}_id" name="{$fieldName}" value="{$value}" /> EOF; return $html; }
private function _initDefaultPage() { $document = JFactory::getDocument(); $document->addCustomTag('<link href="' . JURI::root(true) . '/media/cbcc/js/jstree/themes/default/style.css" rel="stylesheet" />'); $document->addScript(JURI::root(true) . '/media/jui/js/jquery.min.js'); $document->addScript(JURI::root(true) . '/media/cbcc/js/jstree/jquery.jstree.js'); }
public static function getLink($params, $fields = array('simple', 'menu', 'article'), $content_item = false, $isJoomlaArticle = true) { $simple = $fields[0]; $menu = $fields[1]; $article = $fields[2]; $link = ''; if ($params->get($simple, '') != '') { $link = str_ireplace('{SITE}/', JURI::root(), $params->get($simple)); } elseif ($params->get($menu, '') != '') { $application = JFactory::getApplication(); $cms_menu = $application->getMenu(); $menu_item = $cms_menu->getItem($params->get($menu)); $link = JRoute::_($menu_item->link . '&Itemid=' . $menu_item->id); } elseif ($params->get($article, '') != '') { if (self::getjVersion() > 2) { $link = JRoute::_('index.php?option=com_content&view=article&id=' . $params->get($article, '')); } else { $link = JRoute::_(ContentHelperRoute::getArticleRoute($params->get($article, ''))); } } elseif ($content_item && $isJoomlaArticle) { if (self::getjVersion() > 2) { $link = JRoute::_('index.php?option=com_content&view=article&id=' . $content_item->id); } else { $link = JRoute::_(ContentHelperRoute::getArticleRoute($content_item->id, $content_item->catid)); } } elseif ($content_item) { if (@isset($content_item->link)) { $link = $content_item->link; } } return $link; }
/** * This renders the necessary bootstrap data into the html headers. */ public function bootstrap() { static $isRendered = false; $doc = JFactory::getDocument(); if( !$isRendered && $doc->getType() == 'html' ) { // @task: Include dependencies from foundry. require_once( JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'foundry' . DIRECTORY_SEPARATOR . '3.1' . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'configuration.php' ); $config = Komento::getConfig(); $environment = JRequest::getVar( 'komento_environment' , $config->get( 'komento_environment' ) ); $folder = 'scripts'; // @task: Let's see if we should load the dev scripts. if( $environment == 'development' ) { $folder = 'scripts_'; } $doc->addScript( rtrim( JURI::root() , '/' ) . '/media/com_komento/' . $folder . '/abstract.js' ); $isRendered = true; } return $isRendered; }
/** * This event is triggered after the framework has loaded and the application initialise method has been called. * * @return void */ public function onAfterDispatch() { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $input = $app->input; // Check to make sure we are loading an HTML view and there is a main component area if ($document->getType() !== 'html' || $input->get('tmpl', '', 'cmd') === 'component' || $app->isAdmin()) { return true; } // Get additional data to send $attrs = array(); $attrs['title'] = $document->title; $attrs['language'] = $document->language; $attrs['referrer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : JUri::current(); $attrs['url'] = JURI::getInstance()->toString(); $user = JFactory::getUser(); // Get info about the user if logged in if (!$user->guest) { $attrs['email'] = $user->email; $name = explode(' ', $user->name); if (isset($name[0])) { $attrs['firstname'] = $name[0]; } if (isset($name[count($name) - 1])) { $attrs['lastname'] = $name[count($name) - 1]; } } $encodedAttrs = urlencode(base64_encode(serialize($attrs))); $buffer = $document->getBuffer('component'); $image = '<img style="display:none" src="' . trim($this->params->get('base_url'), ' \\t\\n\\r\\0\\x0B/') . '/mtracking.gif?d=' . $encodedAttrs . '" />'; $buffer .= $image; $document->setBuffer($buffer, 'component'); return true; }
/** * @param $cData * @param $shipTo */ function __construct($cData, $shipTo) { $this->shipTo = $shipTo; $this->country = $cData['country_code']; $this->country_code_3 = $cData['country_code_3']; $this->currency = $cData['currency_code']; $this->virtuemart_currency_id = $cData['virtuemart_currency_id']; //$this->currency = $vendor_currency; // Get EID and Secret $this->eid = $cData['eid']; $this->secret = $cData['secret']; $this->lang = $cData['language_code']; // Is Invoice enabled? $this->enabled = TRUE; // Set modes $this->mode = $cData['mode']; $this->ssl = KlarnaHandler::getKlarnaSSL($this->mode); $this->web_root = JURI::base(); try { $this->klarna = new Klarna_virtuemart(); $this->klarna->config($this->eid, $this->secret, $this->country, $this->lang, $this->currency, $this->mode, VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), $this->ssl); } catch (Exception $e) { VmError('klarna_payments', $e); unset($this->klarna); } }
protected function getInput() { JHTML::_('behavior.framework'); $document =& JFactory::getDocument(); if (!version_compare(JVERSION, '3.0', 'ge')) { $checkJqueryLoaded = false; $header = $document->getHeadData(); foreach ($header['scripts'] as $scriptName => $scriptData) { if (substr_count($scriptName, '/jquery')) { $checkJqueryLoaded = true; } } //Add js if (!$checkJqueryLoaded) { $document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.min.js'); } $document->addScript(JURI::root() . $this->element['path'] . 'js/chosen.jquery.min.js'); $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/chosen.css'); } $document->addScript(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.js'); $document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.lightbox-0.5.min.js'); $document->addScript(JURI::root() . $this->element['path'] . 'js/btbase64.min.js'); $document->addScript(JURI::root() . $this->element['path'] . 'js/bt.js'); $document->addScript(JURI::root() . $this->element['path'] . 'js/script.js'); //Add css $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/bt.css'); $document->addStyleSheet(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.css'); $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/jquery.lightbox-0.5.css'); return null; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { global $JElementJSComboJSWritten; if (!$JElementJSComboJSWritten) { $jsFile = dirname(__FILE__) . DS . "jscombobox.js"; $jsUrl = str_replace(JPATH_ROOT, JURI::root(true), $jsFile); $jsUrl = str_replace(DS, "/", $jsUrl); $document = JFactory::getDocument(); $document->addScript($jsUrl); $document->addstylesheet(str_replace('jscombobox.js', 'jscombobox.css', $jsUrl)); $JElementJSComboJSWritten = TRUE; } $html = array(); $attr = ''; // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="combobox ' . (string) $this->element['class'] . '"' : ' class="combobox"'; // To avoid user's confusion, readonly="true" should imply disabled="true". if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') { $attr .= ' disabled="disabled"'; } $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; // Get the field options. $options = (array) $this->getOptions(); //store saved value for textbox $attr .= $this->value ? ' data-value="' . $this->value . '"' : ''; // Create a regular list. $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); return implode($html); }