本文整理汇总了PHP中JFactory::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getUri方法的具体用法?PHP JFactory::getUri怎么用?PHP JFactory::getUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFactory
的用法示例。
在下文中一共展示了JFactory::getUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onUserTwofactorShowConfiguration
/**
* Shows the configuration page for this two factor authentication method.
*
* @param object $otpConfig The two factor auth configuration object
* @param integer $user_id The numeric user ID of the user whose form we'll display
*
* @return boolean|string False if the method is not ours, the HTML of the configuration page otherwise
*
* @see UsersModelUser::getOtpConfig
* @since 3.2
*/
public function onUserTwofactorShowConfiguration($otpConfig, $user_id = null)
{
// Create a new TOTP class with Google Authenticator compatible settings
$totp = new FOFEncryptTotp(30, 6, 10);
if ($otpConfig->method == $this->methodName) {
// This method is already activated. Reuse the same secret key.
$secret = $otpConfig->config['code'];
} else {
// This methods is not activated yet. Create a new secret key.
$secret = $totp->generateSecret();
}
// These are used by Google Authenticator to tell accounts apart
$username = JFactory::getUser($user_id)->username;
$hostname = JFactory::getUri()->getHost();
// This is the URL to the QR code for Google Authenticator
$url = $totp->getUrl($username, $hostname, $secret);
// Is this a new TOTP setup? If so, we'll have to show the code validation field.
$new_totp = $otpConfig->method != 'totp';
// Start output buffering
@ob_start();
// Include the form.php from a template override. If none is found use the default.
$path = FOFPlatform::getInstance()->getTemplateOverridePath('plg_twofactorauth_totp', true);
JLoader::import('joomla.filesystem.file');
if (JFile::exists($path . '/form.php')) {
include_once $path . '/form.php';
} else {
include_once __DIR__ . '/tmpl/form.php';
}
// Stop output buffering and get the form contents
$html = @ob_get_clean();
// Return the form contents
return array('method' => $this->methodName, 'form' => $html);
}
示例2: display
function display($tpl = null)
{
$option = JRequest::getCmd('option');
$mainframe = JFactory::getApplication();
$uri = JFactory::getUri();
// Get data from the model
$items = $this->get('Items');
$this->assignRef('items', $items);
foreach ($this->items as $item) {
$item->count_projectdivisions = 0;
$mdlProjectDivisions = JModel::getInstance("divisions", "JoomleagueModel");
$item->count_projectdivisions = $mdlProjectDivisions->getProjectDivisionsCount($item->id);
$item->count_projectpositions = 0;
$mdlProjectPositions = JModel::getInstance("Projectposition", "JoomleagueModel");
$item->count_projectpositions = $mdlProjectPositions->getProjectPositionsCount($item->id);
$item->count_projectreferees = 0;
$mdlProjectReferees = JModel::getInstance("Projectreferees", "JoomleagueModel");
$item->count_projectreferees = $mdlProjectReferees->getProjectRefereesCount($item->id);
$item->count_projectteams = 0;
$mdlProjecteams = JModel::getInstance("Projectteams", "JoomleagueModel");
$item->count_projectteams = $mdlProjecteams->getProjectTeamsCount($item->id);
$item->count_matchdays = 0;
$mdlRounds = JModel::getInstance("Rounds", "JoomleagueModel");
$item->count_matchdays = $mdlRounds->getRoundsCount($item->id);
}
$this->addToolbar();
parent::display($tpl);
}
示例3: onAfterRoute
function onAfterRoute()
{
// init vars
$app =& JFactory::getApplication();
$uri =& JFactory::getUri();
$option = JRequest::getCmd('option');
$task = JRequest::getCmd('task');
$check = false;
$redirect = $uri->toString();
// assign check to true for matching conditions
if ($this->params->get('enabled_site_contact', 1) && $app->isSite() && $option == 'com_contact' && $task == 'submit') {
$check = true;
}
if ($this->params->get('enabled_site_registration', 1) && $app->isSite() && $option == 'com_user' && $task == 'register_save') {
$redirect = JRoute::_('index.php?option=com_user&view=register');
$check = true;
}
if ($this->params->get('enabled_administrator_login', 0) && $app->isAdmin() && $option == 'com_login' && $task == 'login') {
$check = true;
}
if ($check) {
if (!$this->onCaptchaFormSubmit()) {
$app->redirect($redirect);
die;
}
}
}
示例4: getInput
protected function getInput()
{
$db = JFactory::getDBO();
$user = JFactory::getUser(JRequest::getInt('cat_user_id'));
$section_id = JRequest::getInt('section_id');
$sql = "SELECT id AS value, name AS text FROM `#__js_res_category_user`\n\t\t\t\tWHERE published = 1 AND user_id = {$user->get('id')} AND section_id = {$section_id}\n\t\t\t\tORDER BY ordering";
$db->setQuery($sql);
$categories = $db->loadObjectList();
$html = '<div class="form-inline">';
$html .= JHtml::_('select.genericlist', $categories, $this->name, 'class="inputbox"', 'value', 'text', $this->value, $this->id);
if ($this->required) {
$uri = JFactory::getUri();
$return = base64_encode($uri);
$html .= '<a class="btn" href="' . JRoute::_('index.php?option=com_cobalt&view=category§ion_id=' . JRequest::getInt('section_id') . '&task=usercategory.add&return=' . $return) . '">
<img src="' . JURI::root() . 'media/mint/icons/16/plus-button.png" align="absmiddle" alt="' . JText::_('Add New') . '" /> ' . JText::_('Add New') . '
</a></div>';
}
return $html;
}
示例5: display
/**
* Collect all data to show on the template
*
* @author RolandD, Max Milbers
*/
function display($tpl = null)
{
$user = JFactory::getUser();
$app = JFactory::getApplication();
if (!$user->id) {
$uri = JFactory::getUri();
$current_link = $uri->toString();
$current_link = base64_encode($current_link);
$app->redirect('index.php?option=com_virtuemart&view=user&layout=login&return=' . $current_link);
return false;
}
$input = $app->input;
$order_id = $input->get('id', 0);
$order_mode = tmsModel::getModel('orders');
$orderTable = $order_mode->getTable('orders');
$orderTable->load($order_id);
$this->order = $orderTable->getProperties();
$this->order = JArrayHelper::toObject($this->order);
$order_data = $this->order->order_data;
$this->order_data = json_decode($order_data);
require_once JPATH_ROOT . '/libraries/php-loremipsum-master/src/LoremIpsum.php';
$this->lipsum = new joshtronic\LoremIpsum();
parent::display($tpl);
}
示例6: Element
}
}
}).send();
}
<?php
if ($params->get('preloader', 0) == 1) {
?>
window.addEvent('domready',function() {
var preloader=new Element('div',{
'id':'preloader'
});
document.getElementsByTagName('body')[0].appendChild(preloader);
var img=new Element('img',{
'src':'<?php
echo JFactory::getUri()->base();
?>
plugins/system/onepage/images/loader.gif',
'id':'preloader_img'
});
preloader.grab(img);
preloader.setStyle('display','none');
});
<?php
}
?>
function create_preloader() {
<?php
if ($params->get('preloader', 0) == 1) {
?>
示例7: getSocialBookMarkUri
public static function getSocialBookMarkUri($uri = null)
{
if ($uri === null) {
$uri = JFactory::getUri()->toString();
}
static $cached_uri = array();
$type = Tienda::getInstance()->get('display_bookmark_uri', 0);
switch ($type) {
case 0:
return $uri;
case 1:
if (!isset($cached_uri[$type][$uri])) {
$key = Tienda::getInstance()->get('bitly_key', '');
$logn = Tienda::getInstance()->get('bitly_login', '');
$link = 'http://api.bit.ly/v3/shorten?apiKey=' . $key . '&login=' . $login . '&longURL=' . urlencode($uri);
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $link);
$request = curl_exec($c);
curl_close($c);
$uri_short = json_decode($request)->data->url;
$cached_uri[$type][$uri] = $uri_short;
}
return $cached_uri[$type][$uri];
}
}
示例8: _prepare
/**
* Preparing template parameters for the template
*
* @return void
*/
private function _prepare($loadTemplateCSS, $loadTemplateJS)
{
$this->_loadTemplateCSS = $loadTemplateCSS;
$this->_loadTemplateJS = $loadTemplateJS;
$templateParams = isset($this->_document->params) ? $this->_document->params : null;
$templateName = isset($this->_document->template) ? $this->_document->template : null;
if (empty($templateParams) or empty($templateName) or $templateName == 'system') {
$templateDetails = JFactory::getApplication()->getTemplate(true);
$templateParams = $templateDetails->params;
$templateName = $templateDetails->template;
}
// Update show content on frontpage parameter
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive();
$lang = JFactory::getLanguage();
$lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR);
$manifest = JSNTplHelper::getManifest($templateName);
$this->_document->app = JFactory::getApplication();
$this->_document->template = $templateName;
$this->_document->version = JSNTplHelper::getTemplateVersion($templateName);
$this->_document->isFree = !isset($manifest->edition) || $manifest->edition == 'FREE';
$this->_document->uri = JFactory::getUri();
$this->_document->rootUrl = $this->_document->uri->root(true);
$this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template;
$columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright');
// Find customizable columns
$customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]');
if (count($customColumns) > 0) {
$columns = array();
foreach (end($customColumns)->children() as $column) {
$columns[] = (string) $column['name'];
}
}
// Add columns to overriable parameter list
foreach ($columns as $column) {
$className = $column;
if (strpos($column, 'column') === 0) {
$className = substr($column, 6);
}
$this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'integer', 'name' => $column);
}
// Load template parameters
$params = $this->loadParams($templateParams->toArray(), $templateName, true);
// Detect browser information
$this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo();
$this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie';
$this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7;
// Custom direction from url parameter
$direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction);
$this->_document->direction = $direction;
// Apply custom params
$params = $this->_overrideCustomParams($params);
$params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true;
if ($this->_document->isFree === true) {
$params['mobileSupport'] = false;
$params['useCSS3Effect'] = false;
}
// Prepare logo parameter
if ($params['logoColored']) {
$params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png";
}
if ($params['mobileSupport'] == false) {
$params['desktopSwitcher'] = false;
}
if (!preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) {
$params['logoFile'] = JUri::root(true) . '/' . $params['logoFile'];
}
// Prepare color variation to show in site tool
if ($params['colorSelector'] and !@count($params['sitetoolsColorsItems'])) {
$params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option');
if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) {
$xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml');
$params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option');
}
foreach ($params['sitetoolsColorsItems'] as &$color) {
$color = (string) $color['value'];
}
}
// Prepare Google Analytics code
$params['codeAnalytic'] = trim($params['codeAnalytic']);
if (!empty($params['codeAnalytic'])) {
if (strpos($params['codeAnalytic'], '<script') === false) {
$params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic'];
}
if (strpos($params['codeAnalytic'], '</script>') === false) {
$params['codeAnalytic'] = $params['codeAnalytic'] . '</script>';
}
}
// Binding parameters to document object
$this->_document->params = new JRegistry();
foreach ($params as $key => $value) {
$this->_document->params->set($key, $value);
$this->_document->{$key} = $value;
}
// Assign helper object
//.........这里部分代码省略.........
示例9: _forceRelativeUrl
/**
* _forceRelativeUrl
*
* @param string $site_url Param
*
* @return string
*/
private function _forceRelativeUrl($site_url)
{
$pattern = '//' . JFactory::getUri($this->root_url)->getHost();
// If starts with '//qqq.com', avoid '//qqq.com/qqq'
if (JString::strpos($site_url, $pattern) === 0) {
$site_url = str_replace($pattern, '', $site_url);
}
if ($this->hasPath($site_url)) {
$path = $this->root_url_path;
$l = JString::strlen($path);
$site_url = JString::substr($site_url, $l);
}
// Just in case
if (JString::strpos($site_url, '/administrator') === 0) {
$site_url = JString::substr($site_url, 14);
}
// If starts with '//', avoid 'qqq.com///qqq'
if (JString::substr($site_url, 0, 2) == '//') {
$site_url = JString::substr($site_url, 2);
}
// If starts with '/', avoid 'qqq.com//qqq'
if (JString::substr($site_url, 0, 1) == '/') {
$site_url = JString::substr($site_url, 1);
}
return $site_url;
}
示例10: getLists
function getLists()
{
$db =& JFactory::getDBO();
$sefConfig = SEFConfig::getConfig();
$std_opt = 'class="inputbox" size="2"';
$lists['enabled'] = $this->booleanRadio('enabled', $std_opt, $sefConfig->enabled);
$lists['professionalMode'] = $this->booleanRadio('professionalMode', $std_opt, $sefConfig->professionalMode);
$lists['lowerCase'] = $this->booleanRadio('lowerCase', $std_opt, $sefConfig->lowerCase);
$lists['disableNewSEF'] = $this->booleanRadio('disableNewSEF', $std_opt, $sefConfig->disableNewSEF);
$lists['dontRemoveSid'] = $this->booleanRadio('dontRemoveSid', $std_opt, $sefConfig->dontRemoveSid);
$lists['setQueryString'] = $this->booleanRadio('setQueryString', $std_opt, $sefConfig->setQueryString);
$lists['parseJoomlaSEO'] = $this->booleanRadio('parseJoomlaSEO', $std_opt, $sefConfig->parseJoomlaSEO);
$lists['checkJunkUrls'] = $this->booleanRadio('checkJunkUrls', $std_opt, $sefConfig->checkJunkUrls);
$lists['preventNonSefOverwrite'] = $this->booleanRadio('preventNonSefOverwrite', $std_opt, $sefConfig->preventNonSefOverwrite);
$basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_HOMEPAGE, JText::_('COM_SEF_ONLY_BASE_URL'));
$basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_CURRENT, JText::_('COM_SEF_FULL_SEO_URL'));
$basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_NONE, JText::_('COM_SEF_DISABLE_BASE_HREF'));
$basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_IGNORE, JText::_('COM_SEF_LEAVE_ORIGINAL'));
$lists['check_base_href'] = JHTML::_('select.genericlist', $basehrefs, 'check_base_href', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->check_base_href);
// www and non-www handling
$wwws[] = JHTML::_('select.option', _COM_SEF_WWW_NONE, JText::_('COM_SEF_DONT_HANDLE'));
$wwws[] = JHTML::_('select.option', _COM_SEF_WWW_USE_WWW, JText::_('COM_SEF_USE_WWW'));
$wwws[] = JHTML::_('select.option', _COM_SEF_WWW_USE_NONWWW, JText::_('COM_SEF_USE_NON_WWW'));
$lists['wwwHandling'] = JHTML::_('select.genericlist', $wwws, 'wwwHandling', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->wwwHandling);
$lists['langEnable'] = $this->booleanRadio('langEnable', $std_opt, $sefConfig->langEnable);
$langPlacement = array();
$langPlacement[] = JHTML::_('select.option', _COM_SEF_LANG_PATH, JText::_('COM_SEF_INCLUDE_IN_PATH'));
//$langPlacement[] = JHTML::_('select.option', _COM_SEF_LANG_SUFFIX, JText::_('COM_SEF_ADD_AS_SUFFIX'));
$langPlacement[] = JHTML::_('select.option', _COM_SEF_LANG_DOMAIN, JText::_('COM_SEF_USE_DIFFERENT_DOMAINS'));
$lists['langPlacementJoomla'] = JHTML::_('select.genericlist', $langPlacement, 'langPlacementJoomla', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->langPlacementJoomla);
$lists['alwaysUseLangJoomla'] = $this->booleanRadio('alwaysUseLangJoomla', $std_opt, $sefConfig->alwaysUseLangJoomla);
$lists['alwaysUseLangHomeJoomla'] = $this->booleanRadio('alwaysUseLangHomeJoomla', $std_opt, $sefConfig->alwaysUseLangHomeJoomla);
$lists['addLangMulti'] = $this->booleanRadio('addLangMulti', $std_opt, $sefConfig->addLangMulti);
$lists['translateItems'] = $this->booleanRadio('translateItems', $std_opt, $sefConfig->translateItems);
$lists['browserLangJoomla'] = $this->booleanRadio('browserLangJoomla', $std_opt, $sefConfig->browserLangJoomla);
$lists['langCookieJoomla'] = $this->booleanRadio('langCookieJoomla', $std_opt, $sefConfig->langCookieJoomla);
$langs = JLanguageHelper::getLanguages();
$subdomains = array();
$sitemaps = array();
$mainlangs = array();
foreach ($langs as $lang) {
$l = new stdClass();
$l->title = $lang->title;
$l->sef = $lang->sef;
$l->value = isset($sefConfig->subDomainsJoomla[$l->sef]) ? $sefConfig->subDomainsJoomla[$l->sef] : JFactory::getUri()->getHost();
$subdomains[] = $l;
$mainlangs[] = JHTML::_('select.option', $lang->sef, $lang->title, 'id', 'title');
$s = new stdClass();
$s->title = $lang->title;
$s->sef = $lang->sef;
$s->value = isset($sefConfig->multipleSitemapsFilenames[$lang->sef]) ? $sefConfig->multipleSitemapsFilenames[$lang->sef] : 'sitemap_' . $lang->sef;
$sitemaps[] = $s;
}
$lists['mainLanguageJoomla'] = JHTML::_('select.genericlist', $mainlangs, 'mainLanguageJoomla', 'class="inputbox"', 'id', 'title', $sefConfig->mainLanguageJoomla);
$lists['subdomainsJoomla'] = $subdomains;
$lists['multipleSitemapsFilenames'] = $sitemaps;
// Options for automatic VM currency selection according to language
if (JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart')) {
$lists['vm_installed'] = true;
$lists['vmCurrencyEnable'] = $this->booleanRadio('vmCurrencyEnable', $std_opt, $sefConfig->vmCurrencyEnable);
// Prepare array of available currencies (used modified SQL from mod_virtuemart_currencies)
try {
$query = "SELECT `vendor_accepted_currencies`, `vendor_currency` FROM `#__virtuemart_vendors` LIMIT 1";
$db->setQuery($query);
$vendor_currency = $db->loadAssoc();
} catch (RuntimeException $e) {
$vendor_currency = null;
}
if (!is_array($vendor_currency)) {
$lists['vm_installed'] = false;
} else {
$accepted = trim($vendor_currency['vendor_accepted_currencies']);
$currency = trim($vendor_currency['vendor_currency']);
$allCurrencies = $accepted;
if ($currency) {
$allCurrencies .= ($allCurrencies ? ',' : '') . $currency;
}
try {
$query = "SELECT `virtuemart_currency_id` AS `id`, CONCAT_WS(' ', `currency_name`, `currency_symbol`) AS `title`" . " FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id` IN (" . $allCurrencies . ") AND published = '1' ORDER BY `ordering`, `currency_name`";
$db->setQuery($query);
$currencies = $db->loadObjectList();
} catch (RuntimeException $e) {
$currencies = null;
}
if (!is_array($currencies)) {
$lists['vm_installed'] = false;
} else {
$lists['vmCurrency'] = array();
foreach ($langs as $lang) {
$obj = new stdClass();
$def = isset($sefConfig->vmCurrency[$lang->sef]) ? $sefConfig->vmCurrency[$lang->sef] : null;
$obj->list = JHTML::_('select.genericlist', $currencies, 'vmCurrency[' . $lang->sef . ']', 'class="inputbox"', 'id', 'title', $def);
$obj->lang = $lang->title;
$lists['vmCurrency'][] = $obj;
}
}
}
} else {
$lists['vm_installed'] = false;
}
//.........这里部分代码省略.........
示例11: testGetUri
/**
* Tests the JFactory::getURI method.
*
* @return void
*
* @since 12.1
*/
public function testGetUri()
{
$this->assertInstanceOf('JUri', JFactory::getUri('https://www.joomla.org'), 'Line: ' . __LINE__);
}
示例12:
?>
<div id="j-sidebar-container" class="span2">
<?php
echo $this->sidebar;
?>
</div>
<div id="j-main-container" class="span10">
<?php
} else {
?>
<div id="j-main-container">
<?php
}
?>
<form action="<?php
echo JRoute::_(JFactory::getUri());
?>
" method="post" name="adminForm" id="adminForm" class="">
<div class="page-header">
<h1><?php
echo JText::_('COM_MARKETPLACE_TEXT_PURCHASES');
?>
</h1>
<div class="input-append">
<input type="text" value="<?php
echo $this->escape($this->state->get('filter.search'));
?>
" id="filter_search" placeholder="<?php
echo JText::_('COM_MARKETPLACE_' . $this->getName() . '_FILTER_SEARCH_DESC');
?>
" name="filter_search" class="input-xxlarge">
示例13: _prepare
/**
* Preparing template parameters for the template
*
* @return void
*/
private function _prepare($loadTemplateCSS, $loadTemplateJS)
{
$this->_loadTemplateCSS = $loadTemplateCSS;
$this->_loadTemplateJS = $loadTemplateJS;
$templateParams = isset($this->_document->params) ? $this->_document->params : null;
$templateName = isset($this->_document->template) ? $this->_document->template : null;
if (empty($templateParams) or empty($templateName) or $templateName == 'system') {
$templateDetails = JFactory::getApplication()->getTemplate(true);
$templateParams = $templateDetails->params;
$templateName = $templateDetails->template;
}
// Get template information
$this->_template = JSNTplTemplateRecognization::detect($templateName);
// Update show content on frontpage parameter
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive();
$lang = JFactory::getLanguage();
$lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR);
$manifest = JSNTplHelper::getManifest($templateName);
$this->_document->app = JFactory::getApplication();
$this->_document->template = $templateName;
$this->_document->version = JSNTplHelper::getTemplateVersion($templateName);
$this->_document->isFree = empty($manifest->edition) || $manifest->edition == 'FREE';
$this->_document->uri = JFactory::getUri();
$this->_document->rootUrl = $this->_document->uri->root(true);
$this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template;
$columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright');
// Find customizable columns
$customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]');
if (count($customColumns) > 0) {
$columns = array();
foreach (end($customColumns)->children() as $column) {
$columns[] = (string) $column['name'];
}
}
// Add columns to overriable parameter list
foreach ($columns as $column) {
$className = $column;
if (strpos($column, 'column') === 0) {
$className = substr($column, 6);
}
$this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'string', 'name' => $column);
}
// Load template parameters
$params = $this->loadParams($templateParams->toArray(), $templateName, true);
// Detect browser information
$this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo();
$this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie';
$this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7;
// Custom direction from url parameter
$direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction);
$this->_document->direction = $direction;
// Apply custom params
$params = $this->_overrideCustomParams($params);
$params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true;
// Prepare logo parameter
if ($params['logoColored']) {
$params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png";
}
if (!empty($params['logoFile']) and !preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) {
$params['logoFile'] = JUri::root(true) . '/' . $params['logoFile'];
}
// Prepare color variation to show in site tool
if (!isset($params['sitetoolsColorsItems']) and $colorSettings = json_decode($params['sitetoolsColors'])) {
if (!count($colorSettings->colors)) {
$params['sitetoolsColorsItems'] = array();
}
}
if ($params['sitetoolsColors'] and !isset($params['sitetoolsColorsItems'])) {
$params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option');
if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) {
$xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml');
$params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option');
}
if ($params['sitetoolsColorsItems']) {
foreach ($params['sitetoolsColorsItems'] as &$color) {
$color = (string) $color['value'];
}
}
$params['sitetoolsColorsItems'] != false or $params['sitetoolsColorsItems'] = array();
}
$params['colorSelector'] = count($params['sitetoolsColorsItems']) ? true : false;
// Check if site tools has tool to show
if ($params['sitetoolStyle']) {
$visible = count($params['sitetoolsColorsItems']);
if (!$visible) {
$params['sitetoolStyle'] = false;
}
}
// Prepare Google Analytics code
$params['codeAnalytic'] = trim($params['codeAnalytic']);
if (!empty($params['codeAnalytic'])) {
if (strpos($params['codeAnalytic'], '<script') === false) {
$params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic'];
}
//.........这里部分代码省略.........
示例14: _storeLocation
//.........这里部分代码省略.........
$rightPart = $suffix;
} else {
$temploc = $location . $suffix;
$leftPart = $location . $sefConfig->pagerep;
$rightPart = $suffix;
}
} else {
$temploc = $location . $suffix;
$leftPart = $location . $sefConfig->pagerep;
$rightPart = $suffix;
}
} else {
$temploc = $location . ($suffixMust ? $sefConfig->pagerep . $suffix : '');
$leftPart = $location . $sefConfig->pagerep;
$rightPart = $suffix;
}
// add language to path
if ($sefConfig->langEnable && isset($lang) && $sefConfig->langPlacementJoomla == _COM_SEF_LANG_PATH) {
if ($sefConfig->alwaysUseLang || $lang != $sefConfig->mainLanguageJoomla) {
$slash = $temploc != '' && $temploc[0] == '/';
$temploc = $lang . ($slash || strlen($temploc) > 0 ? '/' : '') . $temploc;
$leftPart = $lang . '/' . $leftPart;
}
}
if ($sefConfig->addFile) {
//if (!eregi($regexSuffix . '$', $temploc) && substr($temploc, -1) == '/') {
if (!preg_match('/' . $pregSuffix . '$/i', $temploc) && substr($temploc, -1) == '/') {
$temploc .= $sefConfig->addFile;
}
}
// convert to lowercase if set to
if ($sefConfig->lowerCase) {
$temploc = JoomSEF::_toLowerCase($temploc);
$leftPart = JoomSEF::_toLowerCase($leftPart);
$rightPart = JoomSEF::_toLowerCase($rightPart);
}
$url = JoomSEF::_uriToUrl($uri);
// see if we have a result for this location
$sql = "SELECT `id`, `origurl`, `Itemid`, `sefurl` FROM `#__sefurls` WHERE `sefurl` = '{$temploc}' AND `origurl` != ''";
$db->setQuery($sql);
$row = $db->loadObject();
if ($itemidIgnored) {
$Itemid = null;
}
$realloc = JoomSEF::_checkRow($row, $ignoreSource, @$Itemid, $url, $metadata, $temploc, $priority, $uri->getVar('option'), $check, $host, $sitemapParams);
// the correct URL could not be used, we must find the first free number
if (is_null($realloc)) {
// let's get all the numbered pages
$sql = "SELECT `id`, `origurl`, `Itemid`, `sefurl` FROM `#__sefurls` WHERE `sefurl` LIKE '{$leftPart}%{$rightPart}'";
$db->setQuery($sql);
$pages = $db->loadObjectList();
// create associative array of form number => URL info
$urls = array();
if (!empty($pages)) {
$leftLen = strlen($leftPart);
$rightLen = strlen($rightPart);
foreach ($pages as $page) {
$sefurl = $page->sefurl;
// separate URL number
$urlnum = substr($sefurl, $leftLen, strlen($sefurl) - $leftLen - $rightLen);
// use only if it's really numeric
if (is_numeric($urlnum)) {
$urls[intval($urlnum)] = $page;
}
}
}
$i = 2;
do {
$temploc = $leftPart . $i . $rightPart;
$row = null;
if (isset($urls[$i])) {
$row = $urls[$i];
}
$realloc = JoomSEF::_checkRow($row, $ignoreSource, @$Itemid, $url, $metadata, $temploc, $priority, $uri->getVar('option'), false, $host, $sitemapParams);
$i++;
} while (is_null($realloc));
}
}
}
// return found URL with non-SEF part appended
if ($nonSefUrl != '' && strstr($realloc, '?')) {
$nonSefUrl = str_replace('?', '&', $nonSefUrl);
}
if (!strlen($host)) {
$root = JFactory::getUri()->toString(array('host', 'port'));
} else {
$root = $host;
}
$url = JFactory::getURI()->getScheme() . "://" . $root . JURI::root(true);
if (substr($url, -1) != '/') {
$url .= '/';
}
$url .= $realloc . $nonSefUrl;
$fragment = $uri->getFragment();
if (!empty($fragment)) {
$url .= '#' . $fragment;
}
JoomSefUri::updateUri($origUri, $url);
return $origUri;
}
示例15: _replaceLink
private function _replaceLink($matches)
{
$host = JFactory::getUri()->getHost();
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('Itemid')->from('#__sefurls')->where('sefurl=' . $db->quote(ltrim(str_replace(JFactory::getUri()->base(true), "", $matches[3]), "/")));
$db->setQuery($query);
$Itemid = $db->loadResult();
//echo $matches[3]."\t".$Itemid."<br>";
if (strlen($Itemid)) {
$query = $db->getQuery(true);
$query->select('subdomain')->from('#__sef_subdomains')->where('Itemid=' . $Itemid);
$db->setQuery($query);
$subdomain = $db->loadResult();
if (strlen($subdomain)) {
$host = $subdomain . "." . $host;
}
}
switch ($matches[1]) {
case 'a':
return '<a' . $matches[2] . 'href="http://' . $host . $matches[3] . '"' . $matches[4] . '>';
break;
case 'form':
return '<form' . $matches[2] . 'action="http://' . $host . $matches[3] . '"' . $matches[4] . '>';
break;
}
}