示例#1
0
function smart_getModuleName($withLink = true, $forBreadCrumb = false, $moduleName = false)
{
    if (!$moduleName) {
        global $xoopsModule;
        $moduleName = $xoopsModule->getVar('dirname');
    }
    $smartModule =& smart_getModuleInfo($moduleName);
    $smartModuleConfig =& smart_getModuleConfig($moduleName);
    if (!isset($smartModule)) {
        return '';
    }
    if ($forBreadCrumb && (isset($smartModuleConfig['show_mod_name_breadcrumb']) && !$smartModuleConfig['show_mod_name_breadcrumb'])) {
        return '';
    }
    if (!$withLink) {
        return $smartModule->getVar('name');
    } else {
        $seoMode = smart_getModuleModeSEO($moduleName);
        if ($seoMode == 'rewrite') {
            $seoModuleName = smart_getModuleNameForSEO($moduleName);
            $ret = XOOPS_URL . '/' . $seoModuleName . '/';
        } elseif ($seoMode == 'pathinfo') {
            $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/';
        } else {
            $ret = XOOPS_URL . '/modules/' . $moduleName . '/';
        }
        return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>';
    }
}
 /**
  * Retreive the object user side link
  *
  * @param object $smartObj reference to the object from which we want the user side link
  * @param bool $onlyUrl wether or not to return a simple URL or a full <a> link
  * @return string user side link to the object
  */
 function getItemLink(&$smartObj, $onlyUrl = false)
 {
     $seoMode = smart_getModuleModeSEO($this->handler->_moduleName);
     $seoModuleName = smart_getModuleNameForSEO($this->handler->_moduleName);
     /**
      * $seoIncludeId feature is not finished yet, so let's put it always to true
      */
     //$seoIncludeId = smart_getModuleIncludeIdSEO($this->handler->_moduleName);
     $seoIncludeId = true;
     if ($seoMode == 'rewrite') {
         $ret = XOOPS_URL . '/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
     } else {
         if ($seoMode == 'pathinfo') {
             $ret = SMARTOBJECT_URL . 'seo.php/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html';
         } else {
             $ret = $this->handler->_moduleUrl . $this->handler->_page . "?" . $this->handler->keyName . "=" . $smartObj->getVar($this->handler->keyName);
         }
     }
     if (!$onlyUrl) {
         $ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . "</a>";
     }
     return $ret;
 }