本文整理汇总了PHP中SEFConfig类的典型用法代码示例。如果您正苦于以下问题:PHP SEFConfig类的具体用法?PHP SEFConfig怎么用?PHP SEFConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SEFConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterDispatch
function onAfterDispatch()
{
if (JFactory::getApplication()->isAdmin()) {
return;
}
if (JFactory::getApplication()->getCfg('sef') == 0) {
return;
}
if (JFactory::getURI()->getVar('tmpl') == 'component') {
return;
}
$config = SEFConfig::getConfig();
if (!$config->enabled) {
return;
}
if ($config->google_enable == 0) {
return;
}
if (JRequest::getInt('google_analytics_exclude', 0, 'cookie') == 1) {
return;
}
$ips_exclude = explode("\r\n", $config->google_exclude_ip);
if (in_array(IPAddressHelper::getip(), $ips_exclude)) {
return;
}
$user = JFactory::getUser();
if (in_array($user->gid, $config->google_exclude_level)) {
return;
}
JFactory::getDocument()->addScriptDeclaration(" var _gaq = _gaq || [];\n _gaq.push(['_setAccount', '" . $config->google_id . "']);\n _gaq.push(['_trackPageview']);\n\n (function() {\n var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n })();\n");
}
示例2: 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);
}
示例3: getContactName
function getContactName($id)
{
$sefConfig =& SEFConfig::getConfig();
$title = array();
$field = 'name';
if (SEFTools::UseAlias($this->params, 'contact_alias')) {
$field = 'alias';
}
$id = intval($id);
$query = "SELECT `id`, `{$field}` AS `name`, `catid`, `metakey`, `metadesc`, `metadata`, `language`,`misc` FROM `#__contact_details` WHERE `id` = '{$id}'";
$this->_db->setQuery($query);
$row = $this->_db->loadObject('stdClass', $this->config->translateItems);
if (is_null($row)) {
JoomSefLogger::Log("Contact with ID {$id} could not be found.", $this, 'com_contact');
return array();
}
$name = ($this->params->get('contactid', '0') != '0' ? $id . '-' : '') . $row->name;
// use contact description as page meta tags if available
if ($row->misc = JString::trim($row->misc)) {
$this->metadesc = $row->misc;
}
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_contact');
}
if (is_array($catInfo->path)) {
$title = array_merge($title, $catInfo->path);
}
}
$title[] = $row->name;
$this->getMetaData($row);
return $title;
}
示例4: getFeed
function getFeed()
{
$sefConfig =& SEFConfig::getConfig();
if (!$sefConfig->artioFeedDisplay) {
return '';
}
$rssDoc = JFactory::getFeedParser($sefConfig->artioFeedUrl);
if ($rssDoc === false) {
return JText::_('COM_SEF_ERROR_CONNECTING_TO_RSS_FEED');
}
$items = $rssDoc->get_items();
if (count($items) == 0) {
return JText::_('COM_SEF_NO_ITEMS_TO_DISPLAY');
}
$txt = '';
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$title = $item->get_title();
$link = $item->get_link();
$desc = $item->get_description();
$date = $item->get_date('j. F Y');
$author = $item->get_author();
$txt .= '<div class="feed-item">';
$txt .= '<div class="feed-title"><a href="' . $link . '" target="_blank">' . $title . '</a></div>';
$txt .= '<div class="feed-text">' . $desc . '</div>';
$txt .= '</div>';
}
return $txt;
}
示例5: 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);
}
示例6: getFeed
function getFeed()
{
$sefConfig =& SEFConfig::getConfig();
if (!$sefConfig->artioFeedDisplay) {
return '';
}
$options = array();
$options['rssUrl'] = $sefConfig->artioFeedUrl;
$options['cache_time'] = null;
$rssDoc =& JFactory::getXMLparser('RSS', $options);
if ($rssDoc == false) {
return JText::_('Error connecting to RSS feed.');
}
$items = $rssDoc->get_items();
if (count($items) == 0) {
return JText::_('No items to display.');
}
$txt = '';
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$title = $item->get_title();
$link = $item->get_link();
$desc = $item->get_description();
$date = $item->get_date('j. F Y');
$author = $item->get_author();
$txt .= '<div class="feed-item">';
$txt .= '<div class="feed-title"><a href="' . $link . '" target="_blank">' . $title . '</a></div>';
$txt .= '<div class="feed-text">' . $desc . '</div>';
$txt .= '</div>';
}
return $txt;
}
示例7: getContactName
function getContactName($id)
{
$database =& JFactory::getDBO();
$sefConfig =& SEFConfig::getConfig();
$field = 'name';
if (SEFTools::UseAlias($this->params, 'contact_alias')) {
$field = 'alias';
}
$jfTranslate = $sefConfig->translateNames ? ', `id`' : '';
$id = intval($id);
$database->setQuery("SELECT `{$field}` AS `name`, `catid` {$jfTranslate} FROM `#__contact_details` WHERE `id` = '{$id}'");
$contact = $database->loadObject();
if (is_null($contact)) {
JoomSefLogger::Log("Contact with ID {$id} could not be found.", $this, 'com_contact');
return array();
}
if ($contact) {
$name = ($this->params->get('contactid', '0') != '0' ? $id . '-' : '') . $contact->name;
if ($this->params->get('category', '1') != '1') {
return array($name);
} else {
return array($this->getCategoryTitle($contact->catid), $name);
}
}
}
示例8: getStatistics
function getStatistics()
{
$sefConfig =& SEFConfig::getConfig();
$stats = array();
$stat = new stdClass();
$stat->text = 'Automatic SEF URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_AUTOMATIC);
$stat->link = 'index.php?option=com_sef&controller=sefurls&viewmode=0';
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Custom SEF URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_CUSTOM);
$stat->link = 'index.php?option=com_sef&controller=sefurls&viewmode=2';
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Trashed SEF URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_TRASHED);
$stat->link = 'index.php?option=com_sef&controller=sefurls&viewmode=6';
$stats[] = $stat;
$stat = new stdClass();
$stat->text = '404 URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_404);
$stat->link = 'index.php?option=com_sef&controller=sefurls&viewmode=1';
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Moved URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_MOVED);
$stat->link = 'index.php?option=com_sef&controller=movedurls';
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Total URLs';
$stat->value = $stats[0]->value + $stats[1]->value + $stats[2]->value + $stats[3]->value + $stats[4]->value;
$stats[] = $stat;
$stat = new stdClass();
$stat->text = '';
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Disabled URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_DISABLED);
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Not SEFed URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_NOT_SEFED);
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Locked URLs';
$stat->value = $this->getCount(_COM_SEF_COUNT_LOCKED);
$stats[] = $stat;
$stat = new stdClass();
$stat->text = 'Cache entries';
if ($sefConfig->useCache) {
$cache =& sefCache::getInstance();
$stat->value = $cache->getCount();
} else {
$stat->value = JText::_('Cache disabled');
}
$stats[] = $stat;
return $stats;
}
示例9: stdClass
function &getData()
{
// Load the data
if (empty($this->_data)) {
if ($this->_id != 0) {
$query = "SELECT * FROM `#__sefurls` WHERE `id` = '{$this->_id}'";
$this->_db->setQuery($query);
$this->_data = $this->_db->loadObject();
if (isset($this->_data->metacustom)) {
$this->_data->metacustom = @unserialize($this->_data->metacustom);
}
}
}
if (!$this->_data) {
$sefConfig =& SEFConfig::getConfig();
$this->_data = new stdClass();
$this->_data->id = 0;
$this->_data->cpt = null;
$this->_data->sefurl = null;
$this->_data->origurl = null;
$this->_data->Itemid = null;
$this->_data->metadesc = null;
$this->_data->metakey = null;
$this->_data->metatitle = null;
$this->_data->metalang = null;
$this->_data->metarobots = null;
$this->_data->metagoogle = null;
$this->_data->metacustom = null;
$this->_data->canonicallink = null;
$this->_data->dateadd = null;
$this->_data->enabled = 1;
$this->_data->locked = 0;
$this->_data->sef = 1;
$this->_data->sm_indexed = $sefConfig->sitemap_indexed ? 1 : 0;
$this->_data->sm_date = date('Y-m-d');
$this->_data->sm_frequency = $sefConfig->sitemap_frequency;
$this->_data->sm_priority = $sefConfig->sitemap_priority;
$this->_data->trace = null;
$this->_data->aliases = null;
} else {
// Get the aliases
$query = "SELECT * FROM `#__sefaliases` WHERE `url` = '{$this->_id}'";
$this->_db->setQuery($query);
$objs = $this->_db->loadObjectList();
$aliases = array();
if ($objs) {
foreach ($objs as $obj) {
$aliases[] = $this->_aliasToString($obj);
}
}
$this->_data->aliases = implode("\n", $aliases);
}
return $this->_data;
}
示例10: 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;
}
示例11: setinfotext
function setinfotext()
{
// Get new state
$state = JRequest::getVar('state');
if (is_null($state)) {
jexit();
}
$sefConfig =& SEFConfig::getConfig();
$sefConfig->showInfoTexts = $state ? true : false;
$sefConfig->saveConfig(0);
jexit();
}
示例12: display
function display($tpl = null)
{
JToolBarHelper::title(JText::_('COM_SEF_JOOMSEF_CONFIGURATION'), 'config.png');
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::spacer();
JToolBarHelper::cancel();
// Get data from the model
$lists =& $this->get('Lists');
$this->assignRef('lists', $lists);
$this->langs = $this->get('langs');
$this->subdomains = $this->get('subdomains');
// Which tabs to show?
$sefConfig =& SEFConfig::getConfig();
$tabs = array('basic');
if ($sefConfig->professionalMode) {
$tabs[] = 'advanced';
}
$tabs[] = 'cache';
$tabs[] = 'metatags';
$tabs[] = 'seo';
$tabs[] = 'sitemap';
$tabs[] = 'language';
$tabs[] = 'analytics';
$tabs[] = 'subdomains';
$tabs[] = '404';
$tabs[] = 'registration';
$tab = JRequest::getVar('tab', 'basic');
$tabIdx = array_search($tab, $tabs);
if ($tabIdx === false) {
$tabIdx = 0;
}
$this->assignRef('tabs', $tabs);
$this->assign('tab', $tabIdx);
// Root domain for subdomains configuration
$rootDomain = JFactory::getURI()->getHost();
if (substr($rootDomain, 0, 4) == 'www.') {
$rootDomain = substr($rootDomain, 4);
}
$this->assign('rootDomain', $rootDomain);
JHTML::_('behavior.tooltip');
JHTML::_('behavior.framework');
$doc =& JFactory::getDocument();
$doc->addStyleDeclaration('form#adminForm div.current { width: auto; }');
$sefConfig =& SEFConfig::getConfig();
if (!$sefConfig->professionalMode) {
$mainframe =& JFactory::getApplication();
$mainframe->enqueueMessage(JText::_('COM_SEF_BEGINNER_MODE_INFO'));
}
parent::display($tpl);
}
示例13: onAfterDispatch
function onAfterDispatch()
{
if (JFactory::getApplication()->isAdmin()) {
return;
}
if (JFactory::getApplication()->getCfg('sef') == 0) {
return;
}
if (JFactory::getURI()->getVar('tmpl') == 'component') {
return;
}
$config = SEFConfig::getConfig();
if (!$config->enabled) {
return;
}
if ($config->google_enable == 0) {
return;
}
if (JRequest::getInt('google_analytics_exclude', 0, 'cookie') == 1) {
return;
}
$ips_exclude = explode("\r\n", $config->google_exclude_ip);
if (in_array(IPAddressHelper::getip(), $ips_exclude)) {
return;
}
$groups = null;
$user = JFactory::getUser();
if ($user) {
$groups = $user->get('groups');
}
if (is_array($groups)) {
foreach ($groups as $group) {
if (in_array($group, $config->google_exclude_level)) {
return;
}
}
}
$script = " (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\r\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\r\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\r\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\r\n\r\n ga('create', '" . htmlspecialchars($config->google_id) . "', 'auto');\n";
if ($config->google_demographic_reports) {
$script .= " ga('require', 'displayfeatures');\n";
}
if ($config->google_link_attribution) {
$script .= " ga('require', 'linkid', 'linkid.js');\n";
}
$script .= " ga('send', 'pageview');\n";
JFactory::getDocument()->addScriptDeclaration($script);
}
示例14: _getVars
function _getVars()
{
$app =& JFactory::getApplication();
$this->filterMessage = $app->getUserStateFromRequest("sef.logger.filterMessage", 'filterMessage', '');
$this->filterComponent = $app->getUserStateFromRequest("sef.logger.filterComponent", 'comFilter', '');
$this->filterPage = $app->getUserStateFromRequest("sef.logger.filterPage", 'filterPage', '');
$this->filterUrl = $app->getUserStateFromRequest("sef.logger.filterUrl", 'filterUrl', '');
$this->filterOrder = $app->getUserStateFromRequest('sef.logger.filter_order', 'filter_order', 'time');
$this->filterOrderDir = $app->getUserStateFromRequest('sef.logger.filter_order_Dir', 'filter_order_Dir', 'desc');
$this->limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int');
$this->limitstart = $app->getUserStateFromRequest('sef.logger.limitstart', 'limitstart', 0, 'int');
// in case limit has been changed, adjust limitstart accordingly
$this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0;
// enabled?
$config =& SEFConfig::getConfig();
$this->enabled = $config->logErrors;
}
示例15: create
function create(&$uri)
{
$sefConfig =& SEFConfig::getConfig();
$database =& JFactory::getDBO();
$vars = $uri->getQuery(true);
extract($vars);
$title = array();
$title[] = JoomSEF::_getMenuTitleLang($option, $this->lang);
switch (@$view) {
case 'categories':
break;
case 'category':
$catInfo = $this->getCategoryInfo($id);
if ($catInfo === false) {
JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_newsfeeds');
}
if (is_array($catInfo->path)) {
$title = array_merge($title, $catInfo->path);
}
break;
case 'newsfeed':
$title = array_merge($title, $this->getFeedTitle($id));
break;
}
if (isset($format)) {
if ($format == 'feed' && isset($type)) {
$title[] = $type;
} else {
$title[] = $format;
}
}
$newUri = $uri;
if (count($title) > 0) {
// Generate meta tags
$this->metatags = $this->getMetaTags();
$priority = $this->getPriority($uri);
$sitemap = $this->getSitemapParams($uri);
if (isset($this->lang)) {
$lang = $this->lang;
}
$newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, null, $this->metatags, $priority, false, null, $sitemap);
}
return $newUri;
}