本文整理汇总了PHP中EBR::isSefEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP EBR::isSefEnabled方法的具体用法?PHP EBR::isSefEnabled怎么用?PHP EBR::isSefEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EBR
的用法示例。
在下文中一共展示了EBR::isSefEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAlias
/**
* Retrieves alias for the category
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getAlias()
{
$config = EB::config();
$alias = $this->alias;
if ($config->get('main_sef_unicode') || !EBR::isSefEnabled()) {
$alias = $this->id . ':' . $this->alias;
}
return $alias;
}
示例2: getRoutedURL
/**
* Retrieves the external url
*
* @since 5.0
* @access public
* @param string
* @return
*/
public static function getRoutedURL($url, $xhtml = false, $external = false, $isCanonical = false)
{
// If this is not an external link, just pass it to joomla's router
if (!$external) {
return EBR::_($url, $xhtml, null, false, $isCanonical);
}
$app = JFactory::getApplication();
$uri = JURI::getInstance();
$dashboard = false;
// Check if the current menu view is pointing to the dashboard view
if (!$app->isAdmin()) {
$menu = JFactory::getApplication()->getMenu()->getActive();
if (isset($menu->link) && $menu->link) {
$pos = strpos($menu->link, 'view=dashboard');
if ($pos !== false) {
$dashboard = true;
}
}
}
// Address issues with JRoute as it will include the /administrator/ portion in the url if this link
// is being generated from the back end.
if ($app->isAdmin() && EBR::isSefEnabled()) {
$oriURL = $url;
// We need to render our own router file.
require_once JPATH_ROOT . '/components/com_easyblog/router.php';
if (!EB::isJoomla30()) {
// below is required for joomla 2.5
require_once JPATH_ROOT . '/includes/router.php';
require_once JPATH_ROOT . '/includes/application.php';
}
// Here we are tricking Joomla to assume that we are on the front end now.
JFactory::$application = JApplication::getInstance('site');
$router = new JRouterSite(array('mode' => JROUTER_MODE_SEF));
$url = str_replace('/administrator', '/', EBR::_($oriURL, $xhtml, null, $dashboard, $isCanonical));
$url = rtrim(JURI::root(), '/') . '/' . ltrim(str_replace('/administrator/', '/', $url), '/');
$container = explode('/', $url);
$container = array_unique($container);
$url = implode('/', $container);
// Update the "application" back so that it knows it's in the administrator area.
JFactory::$application = JApplication::getInstance('administrator');
return $url;
}
$url = EBR::_($url, $xhtml, null, $dashboard, $isCanonical);
$url = str_replace('/administrator/', '/', $url);
$url = ltrim($url, '/');
// var_dump($url);
// We need to use $uri->toString() because JURI::root() may contain a subfolder which will be duplicated
// since $url already has the subfolder.
return $uri->toString(array('scheme', 'host', 'port')) . '/' . $url;
}
示例3: getAlias
/**
* Retrieves the alias for this author
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getAlias()
{
static $permalinks = array();
if (!isset($permalinks[$this->id])) {
$config = EB::config();
if (!$this->user && $this->id) {
$this->user = JFactory::getuser($this->id);
}
// If the username is invalid
if (!$this->user->username) {
return JText::_('COM_EASYBLOG_INVALID_PERMALINK_BLOGGER');
}
// If user doesn't have a permalink, generate it for them
if (!$this->permalink) {
$this->permalink = EBR::normalizePermalink($this->user->username);
$this->store();
}
$permalink = $this->permalink;
if ($config->get('main_sef_unicode') || !EBR::isSefEnabled()) {
$permalink = $this->id . '-' . $this->permalink;
}
$permalinks[$this->id] = $permalink;
}
return $permalinks[$this->id];
}
示例4: getPrintLink
/**
* Retrieves the print link for a post
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getPrintLink()
{
$url = 'index.php?option=com_easyblog&view=entry&id=' . $this->id;
$url = EBR::_($url, false);
if (EBR::isSefEnabled()) {
$url .= '?tmpl=component&print=1&format=print';
} else {
$url .= '&tmpl=component&print=1&format=print';
}
return $url;
}
示例5: getAlias
/**
* Retrieves the alias of a post
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getAlias()
{
static $permalinks = array();
if (!isset($permalinks[$this->id])) {
$date = EB::date($this->created);
// Default permalink
$permalink = $this->permalink;
// Ensure that the permalink is valid.
$permalink = EBR::normalizePermalink($permalink);
if ($this->config->get('main_sef_unicode') || !EBR::isSefEnabled()) {
$permalink = $this->id . '-' . $permalink;
}
// Date based permalink
$datePermalink = $date->format('Y') . '/' . $date->format('m') . '/' . $date->format('d');
// Date based SEF settings
if ($this->config->get('main_sef') == 'date') {
$permalink = $datePermalink . '/' . $permalink;
}
// Category based permalink type
if ($this->config->get('main_sef') == 'datecategory' || $this->config->get('main_sef') == 'category') {
// Get the current primary category
$category = $this->getPrimaryCategory();
$categoryPermalink = $category->getAlias();
// Date and category based permalink type
if ($this->config->get('main_sef') == 'datecategory') {
$permalink = $categoryPermalink . '/' . $datePermalink . '/' . $permalink;
} else {
$permalink = $categoryPermalink . '/' . $permalink;
}
}
// Custom based permalink type
if ($this->config->get('main_sef') == 'custom') {
$permalink = EBR::getCustomPermalink($this);
}
$permalinks[$this->id] = $permalink;
}
return $permalinks[$this->id];
}