示例#1
0
 function title($format = "S")
 {
     $myts =& MyTextSanitizer::getInstance();
     if (strtolower($format) == 's' || strtolower($format) == 'show') {
         return $myts->undoHtmlSpecialChars($this->content_text->getVar("title", 'e'), 1);
     } elseif (strtolower($format) == 'clean') {
         return smartmedia_metagen_html2text($myts->undoHtmlSpecialChars($this->content_text->getVar("title")));
     } else {
         return $this->content_text->getVar("title", $format);
     }
 }
示例#2
0
function smartmedia_createMetaTags($title, $categoryPath = '', $description = '', $minChar = 4)
{
    global $xoopsTpl, $xoopsModule, $xoopsModuleConfig;
    $myts =& MyTextSanitizer::getInstance();
    $ret = '';
    $title = $myts->displayTarea($title);
    $title = $myts->undoHtmlSpecialChars($title);
    if (isset($categoryPath)) {
        $categoryPath = $myts->displayTarea($categoryPath);
        $categoryPath = $myts->undoHtmlSpecialChars($categoryPath);
    }
    // Creating Meta Keywords
    if (isset($title) && $title != '') {
        $keywords = smartmedia_findMetaKeywords($title, $minChar);
        if (isset($xoopsModuleConfig) && isset($xoopsModuleConfig['moduleMetaKeywords']) && $xoopsModuleConfig['moduleMetaKeywords'] != '') {
            $moduleKeywords = explode(",", $xoopsModuleConfig['moduleMetaKeywords']);
            foreach ($moduleKeywords as $moduleKeyword) {
                if (!in_array($moduleKeyword, $keywords)) {
                    $keywords[] = trim($moduleKeyword);
                }
            }
        }
        $keywordsCount = count($keywords);
        for ($i = 0; $i < $keywordsCount; $i++) {
            $ret .= $keywords[$i];
            if ($i < $keywordsCount - 1) {
                $ret .= ', ';
            }
        }
        $xoopsTpl->assign('xoops_meta_keywords', $ret);
    }
    // Creating Meta Description
    if ($description != '') {
        $xoopsTpl->assign('xoops_meta_description', smartmedia_createMetaDescription($description));
    }
    // Creating Page Title
    $moduleName = '';
    $titleTag = array();
    if (isset($xoopsModule)) {
        $moduleName = $myts->displayTarea($xoopsModule->name());
        $titleTag['module'] = $moduleName;
    }
    if (isset($title) && $title != '' && strtoupper($title) != strtoupper($moduleName)) {
        $titleTag['title'] = $title;
    }
    if (isset($categoryPath) && $categoryPath != '') {
        $titleTag['category'] = $categoryPath;
    }
    $ret = '';
    if (isset($titleTag['title']) && $titleTag['title'] != '') {
        $ret .= smartmedia_metagen_html2text($titleTag['title']);
    }
    if (isset($titleTag['category']) && $titleTag['category'] != '') {
        if ($ret != '') {
            $ret .= ' - ';
        }
        $ret .= $titleTag['category'];
    }
    if (isset($titleTag['module']) && $titleTag['module'] != '') {
        if ($ret != '') {
            $ret .= ' - ';
        }
        $ret .= $titleTag['module'];
    }
    $xoopsTpl->assign('xoops_pagetitle', $ret);
}
示例#3
0
 function makeMySelBox($title, $order = "", $preset_id = 0, $none = 0, $sel_name = "", $onchange = "", $disabled = false)
 {
     if ($sel_name == "") {
         $sel_name = $this->id;
     }
     $myts =& MyTextSanitizer::getInstance();
     echo "<select name='" . $sel_name . "'";
     if ($onchange != "") {
         echo " onchange='" . $onchange . "'";
     }
     if ($disabled) {
         echo " disabled='disabled'";
     }
     echo ">\n";
     $sql = "SELECT item." . $this->id . ", text." . $title . " FROM " . $this->table . " AS item INNER JOIN " . $this->table . "_text" . " AS text ON item." . $this->id . "= text." . $this->id . " AND item.default_languageid = text.languageid ";
     if ($this->pid) {
         $sql .= "WHERE item." . $this->pid . "=0";
     }
     if ($order != "") {
         $sql .= " ORDER BY {$order}";
     }
     //echo "<br />$sql</br />";
     //exit;
     $result = $this->db->query($sql);
     if ($none) {
         echo "<option value='0'>----</option>\n";
     }
     include_once SMARTMEDIA_ROOT_PATH . "include/metagen.php";
     while (list($catid, $name) = $this->db->fetchRow($result)) {
         $sel = "";
         if ($catid == $preset_id) {
             $sel = " selected='selected'";
         }
         // MT hack added by hsalazar //
         $name = $myts->htmlSpecialChars($name);
         // MT hack added by hsalazar //
         echo "<option value='{$catid}'{$sel}>" . smartmedia_metagen_html2text($name) . "</option>\n";
         $sel = "";
         $arr = $this->getChildTreeArray($catid, $order);
         foreach ($arr as $option) {
             $option['prefix'] = str_replace(".", "--", $option['prefix']);
             $catpath = $option['prefix'] . "&nbsp;" . $myts->htmlSpecialChars($option[$title]);
             if ($option[$this->id] == $preset_id) {
                 $sel = " selected='selected'";
             }
             echo "<option value='" . $option[$this->id] . "'{$sel}>{$catpath}</option>\n";
             $sel = "";
         }
     }
     echo "</select>\n";
 }