Ejemplo n.º 1
0
function get_struct_alias($start_id = 0)
{
    if ($start_id == 0) {
        return '';
    }
    $start_id = intval($start_id);
    $sql = "SELECT acat_id, acat_struct, acat_name, acat_pagetitle FROM " . DB_PREPEND . "phpwcms_articlecat ";
    $sql .= "WHERE acat_trash=0 ORDER BY acat_struct, acat_sort";
    $result = _dbQuery($sql);
    $struct_array = array();
    if (isset($result[0]['acat_id'])) {
        foreach ($result as $value) {
            $value['acat_id'] = intval($value['acat_id']);
            $value['acat_struct'] = intval($value['acat_struct']);
            $struct_array[$value['acat_id']] = $value;
        }
    }
    $data = array();
    while ($start_id && isset($struct_array[$start_id])) {
        if (!empty($struct_array[$start_id]['acat_pagetitle']) && strlen($struct_array[$start_id]['acat_name']) > strlen($struct_array[$start_id]['acat_pagetitle'])) {
            $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_pagetitle']));
        } else {
            $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_name']));
        }
        $start_id = $struct_array[$start_id]["acat_struct"];
    }
    if (!empty($struct_array[$start_id]['acat_pagetitle']) && strlen($struct_array[$start_id]['acat_name']) > strlen($struct_array[$start_id]['acat_pagetitle'])) {
        $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_pagetitle']));
    } elseif (!empty($struct_array[$start_id]['acat_name'])) {
        $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_name']));
    }
    return implode($GLOBALS['phpwcms']['alias_allow_slash'] ? '/' : '-', array_reverse($data));
}
Ejemplo n.º 2
0
     $g['wrap'][] = '</div>';
     // Custom CP group wrapper
 } elseif (isset($template_default['attributes']['cpgroup_custom'][$content['cptab_types'][$CNT_TAB]])) {
     foreach ($trow as $tabkey => $tabitem) {
         $tabitem['title'] = html_specialchars($tabitem['title']);
         $g['wrap'][] = sprintf($template_default['attributes']['cpgroup_custom'][$content['cptab_types'][$CNT_TAB]]['prefix'], $tabitem['title'], $CNT_TAB);
         $g['wrap'][] = $tabitem['content'];
         $g['wrap'][] = sprintf($template_default['attributes']['cpgroup_custom'][$content['cptab_types'][$CNT_TAB]]['suffix'], $tabitem['title'], $CNT_TAB);
     }
     // Default behavior: Tabs
 } else {
     $g['cnt'] = array();
     $g['wrap'][] = '<div id="' . $CNT_TAB . '"' . ($template_default['classes']['tab-container'] ? ' class="' . $template_default['classes']['tab-container'] . '"' : '') . '>';
     $g['wrap'][] = '	<ul' . ($template_default['classes']['tab-navigation'] ? ' class="' . $template_default['classes']['tab-navigation'] . '"' : '') . '>';
     foreach ($trow as $tabkey => $tabitem) {
         $tabitem['id'] = 'tab-' . uri_sanitize(strtolower($tabitem['title'])) . '-' . $g['counter'];
         $tabitem['class'] = $template_default['classes']['tab-item'] ? $template_default['classes']['tab-item'] . '-' . $g['counter'] : '';
         $tabitem['content-class'] = $template_default['classes']['tab-content'];
         if ($template_default['classes']['tab-content-item']) {
             $tabitem['content-class'] = trim($tabitem['content-class'] . ' ' . $template_default['classes']['tab-content-item']) . '-' . $g['counter'];
         }
         if ($tabitem['content-class']) {
             $tabitem['content-class'] = ' class="' . $tabitem['content-class'] . '"';
         }
         if ($template_default['classes']['tab-first'] && $g['counter'] === 1) {
             $tabitem['class'] .= ' ' . $template_default['classes']['tab-first'];
         }
         if ($template_default['classes']['tab-last'] && $g['counter'] === $g['max']) {
             $tabitem['class'] .= ' ' . $template_default['classes']['tab-last'];
         }
         $tabitem['class'] = trim($tabitem['class']);
function get_struct_alias($start_id = 0, $parent_alias = false)
{
    if ($start_id == 0) {
        global $indexpage;
        if ($parent_alias && !empty($indexpage['acat_alias'])) {
            return $indexpage['acat_alias'];
        } elseif (!empty($indexpage['acat_pagetitle']) && strlen($indexpage['acat_name']) > strlen($indexpage['acat_pagetitle'])) {
            return strtolower(uri_sanitize($indexpage['acat_pagetitle']));
        } elseif (!empty($struct_array[$start_id]['acat_name'])) {
            return strtolower(uri_sanitize($indexpage['acat_name']));
        }
        return '';
    }
    $start_id = intval($start_id);
    $sql = 'SELECT acat_id, acat_struct, acat_name, acat_pagetitle, acat_alias ';
    $sql .= 'FROM ' . DB_PREPEND . 'phpwcms_articlecat WHERE acat_trash=0 ';
    if ($parent_alias) {
        $sql .= 'AND acat_id=' . $start_id;
    } else {
        $sql .= 'ORDER BY acat_struct, acat_sort';
    }
    $result = _dbQuery($sql);
    $struct_array = array();
    if (isset($result[0]['acat_id'])) {
        if ($parent_alias && !empty($result[0]['acat_alias'])) {
            return $result[0]['acat_alias'];
        }
        foreach ($result as $value) {
            $value['acat_id'] = intval($value['acat_id']);
            $value['acat_struct'] = intval($value['acat_struct']);
            $struct_array[$value['acat_id']] = $value;
        }
    } else {
        return '';
    }
    $data = array();
    while ($start_id && isset($struct_array[$start_id])) {
        if (!empty($struct_array[$start_id]['acat_pagetitle']) && strlen($struct_array[$start_id]['acat_name']) > strlen($struct_array[$start_id]['acat_pagetitle'])) {
            $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_pagetitle']));
        } else {
            $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_name']));
        }
        $start_id = $struct_array[$start_id]["acat_struct"];
    }
    if (!empty($struct_array[$start_id]['acat_pagetitle']) && strlen($struct_array[$start_id]['acat_name']) > strlen($struct_array[$start_id]['acat_pagetitle'])) {
        $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_pagetitle']));
    } elseif (!empty($struct_array[$start_id]['acat_name'])) {
        $data[$start_id] = strtolower(uri_sanitize($struct_array[$start_id]['acat_name']));
    }
    return implode($GLOBALS['phpwcms']['alias_allow_slash'] ? '/' : '-', array_reverse($data));
}