本文整理汇总了PHP中SEFTools类的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools类的具体用法?PHP SEFTools怎么用?PHP SEFTools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SEFTools类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
// Get data from the model
$extension =& $this->get('extension');
$this->assignRef('extension', $extension);
$this->langs = $this->get('languages');
$this->strings = $this->get('strings');
$this->translation = $this->get('translation');
$this->subdomains = $this->get('subdomains');
$this->menus = $this->get('menus');
$filters =& SEFTools::getExtFilters($extension->option, false);
$this->assignRef('filters', $filters);
$acceptVars =& SEFTools::getExtAcceptVars($extension->option, false);
sort($acceptVars, SORT_STRING);
$this->assignRef('acceptVars', $acceptVars);
// Root domain for subdomains configuration
$rootDomain = JFactory::getURI()->getHost();
if (substr($rootDomain, 0, 4) == 'www.') {
$rootDomain = substr($rootDomain, 4);
}
$this->assign('rootDomain', $rootDomain);
JToolBarHelper::title(JText::_('SEF Extension') . ' <small>' . JText::_('Edit') . ' [ ' . (strlen($extension->name) ? $extension->name : $extension->component->name) . ' ]</small>', 'plugin.png');
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::spacer();
JToolBarHelper::cancel();
JHTML::_('behavior.tooltip');
$redir = JRequest::getVar('redirto', '');
$this->assignRef('redirto', $redir);
parent::display($tpl);
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:31,代码来源:view.html.php
示例2: getFeedTitle
function getFeedTitle($id)
{
$title = array();
$field = 'name';
if (SEFTools::UseAlias($this->params, 'feed_alias')) {
$field = 'alias';
}
$id = intval($id);
$query = "SELECT `id`, `{$field}` AS `name`, `catid`, `language`, `metadesc`, `metakey`, `metadata` FROM `#__newsfeeds` WHERE `id` = '{$id}'";
$this->_db->setQuery($query);
$row = $this->_db->loadObject('stdClass', $this->config->translateItems);
if (is_null($row)) {
JoomSefLogger::Log("Feed with ID {$id} could not be found.", $this, 'com_newsfeeds');
return array();
}
if ($this->params->get('show_category', 2) != 0) {
$catInfo = $this->getCategoryInfo($row->catid);
if ($catInfo === false) {
JoomSefLogger::Log("Category with ID {$row->catid} could not be found.", $this, 'com_newsfeeds');
}
if (is_array($catInfo->path)) {
$title = array_merge($title, $catInfo->path);
}
}
$this->getMetaData($row);
$title[] = ($this->params->get('feedid', '0') == 0 ? '' : $id . '-') . $row->name;
return $title;
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:28,代码来源:com_newsfeeds.php
示例3: create
function create(&$uri)
{
$vars = $uri->getQuery(true);
extract($vars);
$this->params =& SEFTools::getExtParams('com_search');
$newUri = $uri;
if (!(isset($task) ? @$task : null)) {
$title[] = JoomSEF::_getMenuTitle($option, isset($task) ? $task : null);
if (isset($searchword) && $this->params->get('nonsefphrase', '1') != '1') {
$title[] = $searchword;
}
if (count($title) > 0) {
$this->_createNonSefVars($uri);
if (!isset($searchword) || $this->params->get('nonsefphrase', '1') != '1') {
// Generate meta tags
$desc = array();
if (isset($searchword)) {
$desc[] = $searchword;
}
if (isset($searchphrase)) {
$desc[] = $searchphrase;
}
$this->metadesc = implode(', ', $desc);
unset($desc);
}
$metatags = $this->getMetaTags();
$newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$vars['lang'], $this->nonSefVars, null, $metatags);
}
}
return $newUri;
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:31,代码来源:com_search.php
示例4: display
function display($tpl = null)
{
JToolBarHelper::title(JText::_('JoomSEF'), 'artio.png');
// Get number of URLs for purge warning
$model =& JModel::getInstance('URLs', 'SEFModel');
$this->assign('purgeCount', $model->getCount(0));
// Get newest version available
$sefConfig =& SEFConfig::getConfig();
if ($sefConfig->versionChecker) {
$model2 =& JModel::getInstance('Upgrade', 'SEFModel');
$newVer = $model2->getNewSEFVersion();
$sefinfo = SEFTools::getSEFInfo();
if (strnatcasecmp($newVer, $sefinfo['version']) > 0 || strnatcasecmp($newVer, substr($sefinfo['version'], 0, strpos($sefinfo['version'], '-'))) == 0) {
$newVer = '<span style="font-weight: bold; color: red;">' . $newVer . '</span> <input type="button" onclick="showUpgrade();" value="' . JText::_('Go to Upgrade page') . '" />';
}
$newVer .= ' <input type="button" onclick="disableStatus(\'versioncheck\');" value="' . JText::_('Disable version checker') . '" />';
$this->assign('newestVersion', $newVer);
} else {
$newestVersion = JText::_('Version checker disabled') . ' <input type="button" onclick="enableStatus(\'versioncheck\');" value="' . JText::_('Enable') . '" />';
$this->assign('newestVersion', $newestVersion);
}
// Get statistics
$stats = $model->getStatistics();
$this->assignRef('stats', $stats);
// Get feed
$feed = $this->get('Feed');
$this->assignRef('feed', $feed);
JHTML::_('behavior.tooltip');
parent::display($tpl);
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:30,代码来源:view.html.php
示例5: display
function display($tpl = null)
{
JToolBarHelper::title(JText::_('COM_SEF_JOOMSEF'), 'artio.png');
$user = JFactory::getUser();
if ($user->authorise('core.admin', 'com_sef')) {
JToolBarHelper::preferences('com_sef');
}
// Get number of URLs for purge warning
$model = SEFModel::getInstance('URLs', 'SEFModel');
$this->assign('purgeCount', $model->getCount(0));
// Get newest version available
$sefConfig = SEFConfig::getConfig();
if ($sefConfig->versionChecker) {
$model2 = SEFModel::getInstance('Upgrade', 'SEFModel');
$newVer = $model2->getNewSEFVersion();
$sefinfo = SEFTools::getSEFInfo();
if (strnatcasecmp($newVer, $sefinfo['version']) > 0 || strnatcasecmp($newVer, substr($sefinfo['version'], 0, strpos($sefinfo['version'], '-'))) == 0) {
$newVer = '<span style="font-weight: bold; color: red;">' . $newVer . '</span> <input type="button" class="btn btn-small" onclick="showUpgrade();" value="' . JText::_('COM_SEF_GO_TO_UPGRADE_PAGE') . '" />';
}
$newVer .= ' <input type="button" class="btn btn-danger btn-small" onclick="disableStatus(\'versioncheck\');" value="' . JText::_('COM_SEF_DISABLE_VERSION_CHECKER') . '" />';
$this->assign('newestVersion', $newVer);
} else {
$newestVersion = JText::_('COM_SEF_VERSION_CHECKER_DISABLED') . ' <input type="button" class="btn btn-success btn-small" onclick="enableStatus(\'versioncheck\');" value="' . JText::_('COM_SEF_ENABLE') . '" />';
$this->assign('newestVersion', $newestVersion);
}
// Get statistics
$stats = $model->getStatistics();
$this->assignRef('stats', $stats);
// Get feed
$feed = $this->get('Feed');
$this->assignRef('feed', $feed);
// Check language filter plugin
$this->getModel('sef')->checkLanguagePlugins();
parent::display($tpl);
}
开发者ID:01J,项目名称:bealtine,代码行数:35,代码来源:view.html.php
示例6: display
function display()
{
$model =& $this->getModel('extensions');
$view =& $this->getView('sef', 'html', 'sefview');
$view->setModel($model);
SEFTools::checkExtVersions();
parent::display();
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:8,代码来源:controller.php
示例7: create
function create(&$uri)
{
$sefConfig =& SEFConfig::getConfig();
$database =& JFactory::getDBO();
$this->params =& SEFTools::getExtParams('com_weblinks');
// JF translate extension.
$jfTranslate = $sefConfig->translateNames ? ', `id`' : '';
$vars = $uri->getQuery(true);
extract($vars);
$title = array();
$title[] = JoomSEF::_getMenuTitle($option, @$this_task);
if (@$view == 'category') {
$title[] = $this->getCategoryTitle($id, SEFTools::UseAlias($this->params, 'category_alias'));
} elseif (empty($this_task) && @$view == 'weblink') {
if (isset($catid)) {
if ($this->params->get('show_category', '1')) {
$title[] = $this->getCategoryTitle($catid, SEFTools::UseAlias($this->params, 'category_alias'));
}
}
if (!empty($id)) {
$field = 'title';
if (SEFTools::UseAlias($this->params, 'weblink_alias')) {
$field = 'alias';
}
$id = intval($id);
$database->setQuery("SELECT `{$field}` AS `title` {$jfTranslate} FROM `#__weblinks` WHERE `id` = '{$id}'");
$row = $database->loadObject();
if (is_null($row)) {
JoomSefLogger::Log("Weblink with ID {$id} could not be found.", $this, 'com_weblinks');
} elseif (!empty($row->title)) {
$name = $row->title;
if ($this->params->get('weblink_id', '0')) {
$name = $id . '-' . $name;
}
$title[] = $name;
}
} else {
$title[] = JText::_('Submit');
}
}
if (isset($task) && $task == 'new') {
$title[] = 'new' . $sefConfig->suffix;
}
$newUri = $uri;
if (count($title) > 0) {
// Generate meta tags
$metatags = $this->getMetaTags();
$priority = $this->getPriority($uri);
$sitemap = $this->getSitemapParams($uri);
$newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$vars['lang'], null, null, $metatags, $priority, false, null, $sitemap);
}
return $newUri;
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:53,代码来源:com_weblinks.php
示例8: GetExts
function GetExts()
{
static $exts;
if (!isset($exts)) {
$exts = array();
$db =& JFactory::getDBO();
$query = "SELECT DISTINCT `extension` FROM `#__sefexttexts`";
$db->setQuery($query);
$extensions = $db->loadResultArray();
if (count($extensions) > 0) {
foreach ($extensions as $ext) {
$exts[$ext] = SEFTools::getExtName($ext);
}
}
}
return $exts;
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:17,代码来源:translationJsextensionFilter.php
示例9: _parseLinks
function _parseLinks($url, &$found)
{
// Get response, follow 5 redirections
$redirs = 0;
do {
$redirect = false;
$response = SEFTools::PostRequest($url, null, null, 'get', null);
if ($response === false) {
// Error
return;
}
if ($redirs < 5 && $response->code >= 300 && $response->code < 400) {
// Parse redirect URL
$pos = stripos($response->header, 'location:');
if ($pos !== false) {
$pos += 9;
// Skip header name
$pos2 = strpos($response->header, "\r", $pos);
$url = substr($response->header, $pos, $pos2 - $pos);
$url = trim($url);
$redirect = true;
$redirs++;
}
}
} while ($redirect);
// Check code
if ($response->code == 200) {
// Parse URLs
$matches = array();
if (preg_match_all('#<a\\s[^>]*href=["\']([^"\']+)#i', $response->content, $matches) > 0) {
// Loop through found URLs
foreach ($matches[1] as $link) {
$link = str_replace(JURI::root(), '', $link);
if (strpos($link, '://') !== false) {
// Absolute external link, skip
continue;
}
// Internal link
$link = JURI::root() . ltrim(html_entity_decode(urldecode($link)), '/');
if (!in_array($link, $found)) {
$found[] = $link;
}
}
}
}
}
开发者ID:01J,项目名称:bealtine,代码行数:46,代码来源:crawler.php
示例10: beforeCreate
function beforeCreate(&$uri)
{
// Remove the part after ':' from variables
if (!is_null($uri->getVar('id'))) {
SEFTools::fixVariable($uri, 'id');
}
if (!is_null($uri->getVar('catid'))) {
SEFTools::fixVariable($uri, 'catid');
}
if ($uri->getVar('id') == 0) {
$uri->delVar('id');
}
if ($uri->getVar('w_id') == 0) {
$uri->delVar('w_id');
}
return;
}
开发者ID:01J,项目名称:bealtine,代码行数:17,代码来源:com_weblinks.php
示例11: create
function create(&$uri)
{
$sefConfig =& SEFConfig::getConfig();
$params = SEFTools::GetExtParams('com_content');
$vars = $uri->getQuery(true);
extract($vars);
// Set title.
$title = array();
$title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid);
if (!empty($tmpl)) {
$title[] = $tmpl;
}
$newUri = $uri;
if (count($title) > 0) {
$this->_createNonSefVars($uri);
$newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, $this->ignoreVars);
}
return $newUri;
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:19,代码来源:com_mailto.php
示例12: create
function create(&$uri)
{
$sefConfig =& SEFConfig::getConfig();
$this->params =& SEFTools::getExtParams('com_banners');
$vars = $uri->getQuery(true);
extract($vars);
$title[] = JoomSEF::_getMenuTitleLang(@$option, @$task, @$Itemid);
switch (@$task) {
case 'click':
$title[] = $this->GetBannerName($id);
unset($task);
break;
}
$newUri = $uri;
if (isset($this->lang)) {
$lang = $this->lang;
}
if (count($title) > 0) {
$newUri = JoomSEF::_sefGetLocation($uri, $title, @$task, null, null, @$lang);
}
return $newUri;
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:22,代码来源:com_banners.php
示例13: create
function create(&$uri)
{
$vars = $uri->getQuery(true);
extract($vars);
// Don't SEF opensearch links
if (isset($format) && $format == 'opensearch') {
return $uri;
}
$this->params =& SEFTools::getExtParams('com_search');
$newUri = $uri;
if (!(isset($task) ? @$task : null)) {
$title[] = JoomSEF::_getMenuTitleLang($option, $lang, @$Itemid);
if (isset($searchword) && $this->params->get('nonsefphrase', '1') != '1') {
$title[] = $searchword;
}
if (isset($view) && ($view != 'search' || $this->params->get('add_search', '0') == '1')) {
$title[] = $view;
}
if (isset($format)) {
$title[] = $format;
}
$this->_createNonSefVars($uri);
if (!isset($searchword) || $this->params->get('nonsefphrase', '1') != '1') {
// Generate meta tags
$desc = array();
if (isset($searchword)) {
$desc[] = $searchword;
}
if (isset($searchphrase)) {
$desc[] = $searchphrase;
}
$this->metadesc = implode(', ', $desc);
unset($desc);
}
$metatags = $this->getMetaTags();
$newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars, null, $metatags, null, true);
}
return $newUri;
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:39,代码来源:com_search.php
示例14: _checkRow
/**
* Checks the found row
*
*/
function _checkRow(&$row, $ignoreSource, $Itemid, $url, &$metadata, $temploc, $priority, $option, $host, $sitemapParams)
{
$realloc = null;
$db =& JFactory::getDBO();
$sefConfig =& SEFConfig::getConfig();
$numberDuplicates = $sefConfig->numberDuplicates;
if (!empty($option)) {
$params =& SEFTools::getExtParams($option);
$extDuplicates = $params->get('numberDuplicates', '2');
if ($extDuplicates != '2') {
$numberDuplicates = $extDuplicates;
}
}
if ($row != false && !is_null($row)) {
if ($ignoreSource || !$ignoreSource && (empty($Itemid) || $row->Itemid == $Itemid)) {
// ... check that it matches original URL
if ($row->origurl == $url) {
// found the matching object
// it probably should have been found sooner
// but is checked again here just for CYA purposes
// and to end the loop
$realloc = $row->sefurl;
} else {
if ($sefConfig->langPlacement == _COM_SEF_LANG_DOMAIN) {
// check if the urls differ only by lang variable
if (SEFTools::removeVariable($row->origurl, 'lang') == SEFTools::removeVariable($url, 'lang')) {
$db->setQuery("UPDATE `#__sefurls` SET `origurl` = " . $db->Quote(SEFTools::removeVariable($row->origurl, 'lang')) . " WHERE `id` = '{$row->id}' LIMIT 1");
// if error occured.
if (!$db->query()) {
$msg = JText::_('Could not update SEF URL in database');
if (JDEBUG) {
$msg .= ': ' . $db->getErrorMsg();
}
JError::raiseError('JoomSEF Error', $msg);
}
$realloc = $row->sefurl;
}
}
}
}
// The found URL is not the same
if (!$numberDuplicates) {
// But duplicates management is turned on
// so we can save the same SEF URL for different non-SEF URL
JoomSEF::_saveNewURL($Itemid, $metadata, $priority, $temploc, $url, false, $host, $sitemapParams);
$realloc = $temploc;
}
} else {
// Save URL in the database
JoomSEF::_saveNewURL($Itemid, $metadata, $priority, $temploc, $url, true, $host, $sitemapParams);
$realloc = $temploc;
}
return $realloc;
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:58,代码来源:joomsef.php
示例15: onAfterInitialise
function onAfterInitialise()
{
$sefConfig = SEFConfig::getConfig();
$mainframe = JFactory::getApplication();
// Enable menu associations if set to
$joomlaVersion = new JVersion();
if ($joomlaVersion->isCompatible('3.0')) {
$mainframe->item_associations = $sefConfig->langMenuAssociations ? 1 : 0;
} else {
$mainframe->set('menu_associations', $sefConfig->langMenuAssociations ? 1 : 0);
}
// Register installer and updater adapters in admin area
$this->registerAdapters();
// Check if JoomSEF should be run
if (!self::_isEnabled()) {
return true;
}
// Store the router for later use
$router = $mainframe->getRouter();
JoomSEF::set('sef.global.jrouter', $router);
// Load JoomSEF language file
$jLang = JFactory::getLanguage();
$jLang->load('com_sef', JPATH_ADMINISTRATOR);
require_once JPATH_ROOT . '/components/com_sef/sef.router.php';
$jsRouter = new JRouterJoomsef();
$router->attachParseRule(array($jsRouter, 'parse'));
$router->attachBuildRule(array($jsRouter, 'build'));
// Disable global "Add suffix to URLs" before parsing and store current config
$config = JFactory::getConfig();
$oldSuffix = $config->get('sef_suffix', 0);
$config->set('sef_suffix', 0);
JoomSEF::set('sef.global.orig_sef_suffix', $oldSuffix);
// Get all configured subdomains
$subdomains = SEFTools::getAllSubdomains();
// Redirect only when there's no POST variables
if ($sefConfig->wwwHandling != _COM_SEF_WWW_NONE && empty($_POST)) {
// Handle www and non-www domain
$uri = JURI::getInstance();
$host = $uri->getHost();
$redirect = false;
// Check if host is only IP
$isIP = preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\z/', $host);
if ($sefConfig->wwwHandling == _COM_SEF_WWW_USE_WWW && !$isIP && strpos($host, 'www.') !== 0) {
// Check if host starts with one of our subdomains
if (isset($subdomains['*']) && count($subdomains['*']) > 0) {
$parts = explode('.', $host);
$domain = $parts[0];
$found = false;
foreach ($subdomains['*'] as $sub) {
if ($domain == $sub->subdomain) {
$found = true;
break;
}
}
if (!$found) {
// Redirect to www form
$redirect = true;
$uri->setHost('www.' . $host);
}
} else {
// Redirect to www form
$redirect = true;
$uri->setHost('www.' . $host);
}
} else {
if ($sefConfig->wwwHandling == _COM_SEF_WWW_USE_NONWWW && strpos($host, 'www.') === 0) {
// host must not begin with www.
$redirect = true;
$uri->setHost(substr($host, 4));
}
}
// Redirect if needed
if ($redirect) {
$url = $uri->toString();
header('Location: ' . $url, true, 301);
jexit();
}
}
// Load custom files only if needed for language or subdomains
if ($sefConfig->langPlacementJoomla == _COM_SEF_LANG_DOMAIN || count($subdomains) > 0) {
JLoader::register("JRoute", JPATH_SITE . '/components/com_sef/helpers/methods.php', true);
JLoader::register("JText", JPATH_SITE . '/components/com_sef/helpers/methods.php', true);
}
return true;
}
开发者ID:01J,项目名称:bealtine,代码行数:85,代码来源:joomsef.php
示例16: _getPackageFromServer
function _getPackageFromServer($extension)
{
// Make sure that zlib is loaded so that the package can be unpacked
if (!extension_loaded('zlib')) {
JError::raiseWarning(100, JText::_('WARNINSTALLZLIB'));
return false;
}
// build the appropriate paths
$sefConfig =& SEFConfig::getConfig();
$config =& JFactory::getConfig();
if (empty($extension)) {
$tmp_dest = $config->getValue('config.tmp_path') . DS . 'joomsef.zip';
} else {
$tmp_dest = $config->getValue('config.tmp_path') . DS . $extension . '.zip';
}
// Validate the upgrade on server
$data = array();
$data['username'] = $sefConfig->artioUserName;
$data['password'] = $sefConfig->artioPassword;
if (empty($extension)) {
$data['download_id'] = $sefConfig->artioDownloadId;
$data['file'] = 'com_joomsef';
} else {
$params =& SEFTools::getExtParams($extension);
$data['download_id'] = $params->get('downloadId', '');
$data['file'] = 'ext_joomsef3_' . substr($extension, 4);
}
$uri = parse_url(JURI::root());
$url = $uri['host'] . $uri['path'];
$url = trim($url, '/');
$data['site'] = $url;
$data['ip'] = $_SERVER['SERVER_ADDR'];
$lang =& JFactory::getLanguage();
$data['lang'] = $lang->getTag();
$data['cat'] = 'joomsef3';
// Get the server response
$response = SEFTools::PostRequest($sefConfig->serverAutoUpgrade, JURI::root(), $data);
// Check the response
if ($response === false || $response->code != 200) {
JError::raiseWarning(100, JText::_('Connection to server could not be established.'));
return false;
}
// Response OK, check what we got
if (strpos($response->header, 'Content-Type: application/zip') === false) {
JError::raiseWarning(100, $response->content);
return false;
}
// Seems we got the ZIP installation package, let's save it to disk
if (!JFile::write($tmp_dest, $response->content)) {
JError::raiseWarning(100, JText::_('Unable to save installation file in temp directory.'));
return false;
}
// Unpack the downloaded package file
$package = JInstallerHelper::unpack($tmp_dest);
// Delete the package file
JFile::delete($tmp_dest);
return $package;
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:58,代码来源:upgrade.php
示例17: create
//.........这里部分代码省略.........
$tmp = '';
if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
$menu =& shRouter::shGetMenu();
$item = $menu->getItem($vars['Itemid']);
if (is_object($item) && $vars['option'] == $item->component) {
$title[] = $item->route;
}
}
if (empty($title)) {
//$title[] = 'comp';
$title[] = substr($vars['option'], 4);
}
// add user defined prefix
$prefix = shGetComponentPrefix($option);
if (!empty($prefix)) {
array_unshift($title, $prefix);
}
// now process the resulting title string
$string = shFinalizePlugin($string, $title, $shAppendString, '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
break;
// use sh404sef plugins, either in ext. dir or in sh404sef dir
// use sh404sef plugins, either in ext. dir or in sh404sef dir
case Sh404sefClassBaseextplugin::TYPE_SH404SEF_ROUTER:
_log('Loading sh404SEF plugin in ' . $extPluginPath);
include $extPluginPath;
break;
case Sh404sefClassBaseextplugin::TYPE_JOOMSEF_ROUTER:
Sh404sefHelperExtplugins::loadJoomsefCompatLibs();
include_once $extPluginPath;
$className = 'SefExt_' . $option;
$plugin = new $className();
if (!shIsHomepage($string)) {
// make sure the plugin does not try to calculate pagination
$params =& SEFTools::GetExtParams('com_content');
$params->set('pagination', '1');
// ask plugin to build url
$plugin->beforeCreate($originalUri);
$result = $plugin->create($originalUri);
$title = empty($result['title']) ? array() : $result['title'];
$plugin->afterCreate($originalUri);
// make sure we have a url
if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
$menu =& shRouter::shGetMenu();
$item = $menu->getItem($vars['Itemid']);
if (is_object($item) && $vars['option'] == $item->component) {
$title[] = $item->route;
}
}
$prefix = shGetComponentPrefix($option);
if (!empty($prefix)) {
array_unshift($title, $prefix);
}
if (empty($title) && !shIsHomepage($string)) {
$title[] = substr($vars['option'], 4);
}
list($usedVars, $ignore) = $plugin->getNonSefVars($result);
if (!empty($ignore)) {
$usedVars = array_merge($usedVars, $ignore);
}
} else {
$string = '';
$title[] = '/';
$usedVars = array();
}
// post process result to adjust to our workflow
if (!empty($vars)) {
开发者ID:sangkasi,项目名称:joomla,代码行数:67,代码来源:sef_ext.php
示例18: beforeCreate
public function beforeCreate(&$uri)
{
// remove the limitstart and limit variables if they point to the first page
if (!is_null($uri->getVar('limitstart')) && $uri->getVar('limitstart') == '0') {
$uri->delVar('limitstart');
$uri->delVar('limit');
}
// Remove empty variables
if ($uri->getVar('limitstart') == '') {
$uri->delVar('limitstart');
}
if ($uri->getVar('showall') == '') {
$uri->delVar('showall');
}
// Try to guess the correct Itemid if set to
if ($this->params->get('guessId', '0') != '0') {
if (!is_null($uri->getVar('Itemid')) && !is_null($uri->getVar('id'))) {
$itemid = SefExtContentRouteHelper::getItemid($uri->getVar('id'));
if (!is_null($itemid)) {
$uri->setVar('Itemid', $itemid);
}
}
}
// Remove the part after ':' from variables
if (!is_null($uri->getVar('id'))) {
SEFTools::fixVariable($uri, 'id');
}
if (!is_null($uri->getVar('catid'))) {
SEFTools::fixVariable($uri, 'catid');
}
// TODO: We should remove this, as it generates 1 unnecessary SQL query for each article link,
// instead the catid should just be always removed from article URL (but when updating JoomSEF,
// we'll need to update URLs already in database to reflect such change = remove catid from them!)
// If catid not given, try to find it
$catid = $uri->getVar('catid');
if (!is_null($uri->getVar('view')) && $uri->getVar('view') == 'article' && !is_null($uri->getVar('id')) && empty($catid)) {
$id = $uri->getVar('id');
$query = "SELECT `catid` FROM `#__content` WHERE `id` = '{$id}'";
$this->_db->setQuery($query);
$catid = $this->_db->loadResult();
if (is_null($catid)) {
JoomSefLogger::Log("Article with ID {$id} could not be found.", $this, 'com_content');
}
if (!empty($catid)) {
$uri->setVar('catid', $catid);
}
}
// remove empty id in categories list
if ($uri->getVar('view') == 'categories' && !(int) $uri->getVar('id')) {
$uri->delVar('id');
}
return;
}
开发者ID:01J,项目名称:bealtine,代码行数:53,代码来源:com_content.php
示例19: getCategoryInfo
protected function getCategoryInfo($id)
{
$field = 'title';
if (SEFTools::UseAlias($this->params, 'category_alias')) {
$field = 'alias';
}
$addId = (bool) $this->params->get('categoryid', '0');
$catInfo = new stdClass();
$titles = array();
$path = array();
$id = intval($id);
$this->_db->setQuery("SELECT `lft`, `rgt` FROM `#__categories` WHERE `id` = '{$id}'");
$idx = $this->_db->loadObject();
if (!$idx) {
return false;
}
$query = "SELECT `id`, `title`, `alias`, `description`, language, `metakey`, `metadesc`, `metadata`, `parent_id` FROM `#__categories` WHERE `lft` <= '{$idx->lft}' AND `rgt` >= '{$idx->rgt}' AND id!=1 ORDER BY `lft` DESC";
if ($this->params->get('show_category', 2) != 2) {
$query .= " LIMIT 1";
}
$this->_db->setQuery($query);
$cats = $this->_db->loadObjectList('', 'stdClass', $this->config->translateItems);
$result = null;
$this->metatags = array();
foreach ($cats as $cat) {
// Get only last category metas
if (is_null($result)) {
$result = new stdClass();
$this->lang = $cat->language;
$this->metadesc = $cat->description;
$this->metatags["metakey"] = $cat->metakey;
$this->metatags["metadesc"] = $cat->metadesc;
$metadata = new JRegistry($cat->metadata);
$this->metatags["metaauthor"] = $metadata->get('author');
$this->metatags["metarobots"] = $metadata->get('robots');
$this->metadesc = $cat->description;
$this->origmetadesc = $cat->metadesc;
$this->metakeysource = $cat->description;
$this->origmetakey = $cat->metakey;
$this->pageTitle = $cat->title;
}
$name = $addId ? $id . '-' . $cat->{$field} : $cat->{$field};
array_unshift($path, $name);
array_unshift($titles, $cat->title);
if (empty($this->metatags["metadesc"])) {
$this->metatags["metadesc"] = $cat->description;
}
$id = $cat->parent_id;
if ($id <= 1) {
break;
}
}
$catInfo->titles = $titles;
$catInfo->path = $path;
return $catInfo;
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:56,代码来源:sef.ext.php
示例20: getPageSpeed
function getPageSpeed($url)
{
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'config.php';
$url = str_replace("/administrator", "", JFactory::getURI()->base()) . $url;
$config = SEFConfig::getConfig();
$ndata = new stdClass();
if (strlen($config->google_apikey) == 0) {
return false;
}
$google_url = 'https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=' . urlencode($url) . '&key=' . $config->google_apikey;
if (function_exists('curl_init')) {
$c = curl_init($google_url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_ENCODING, "utf-8");
$data = curl_exec($c);
curl_close($c);
} else {
// Try to use our own method
$data = SEFTools::PostRequest($google_url, null, null, 'get');
if ($data !== false) {
$data = $data->content;
}
}
if ($data === false) {
// Could not connect
return false;
}
$data = json_decode($data);
$ndata = new stdClass();
if (isset($data->error)) {
$ndata->message = $data->error->errors[0]->message;
return $ndata;
}
@($ndata->pageStats = $data->pageStats);
@($ndata->score = $data->score);
$reg = new JRegistry();
$reg->loadObject($ndata);
return $reg->toString("ini");
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:39,代码来源:google.php
注:本文中的SEFTools类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论