示例#1
0
/**
 * alphaBits()
 * 
 * @param bool $all
 * @param array $vars
 * @param array $class
 * @return
 */
function alphaBits($all = false, $vars, $class)
{
    if (!empty($_SERVER['QUERY_STRING'])) {
        $parts = explode("&", $_SERVER['QUERY_STRING']);
        $vars = str_replace(" ", "", $vars);
        $c_vars = explode(",", $vars);
        $newParts = array();
        foreach ($parts as $val) {
            $val_parts = explode("=", $val);
            if (!in_array($val_parts[0], $c_vars)) {
                array_push($newParts, $val);
            }
        }
        if (count($newParts) != 0) {
            $qs = "&" . implode("&", $newParts);
        } else {
            return false;
        }
        $html = '';
        $charset = explode(",", Core::$word->CHARSET);
        $html .= "<div class=\"{$class}\">\n";
        foreach ($charset as $key) {
            $active = $key == get('letter') ? ' active' : null;
            $html .= "<a class=\"item{$active}\" href=\"" . phpself() . "?letter=" . $key . $qs . "\">" . $key . "</a>\n";
        }
        $viewAll = $all === false ? phpself() : $all;
        $html .= "<a class=\"item\" href=\"" . $viewAll . "\">" . Core::$word->ALL . "</a>\n";
        $html .= "</div>\n";
        unset($key);
        return $html;
    } else {
        return false;
    }
}
示例#2
0
function is_phpself($name)
{
    return phpself() == $name;
}
示例#3
0
 /**
  * Paginator::jump_menu()
  * 
  * @return
  */
 public function jump_menu()
 {
     $option = '';
     $option .= "<option  value=\"\">" . Core::$word->PAG_GOTO . "</option>";
     for ($i = 1; $i <= $this->num_pages; $i++) {
         $option .= $i == $this->current_page ? "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n" : "<option value=\"{$i}\">{$i}</option>\n";
     }
     return $this->num_pages >= 1 ? "<select data-cover=\"true\" onchange=\"window.location='" . phpself() . "?pg='+this[this.selectedIndex].value+'&amp;ipp={$this->items_per_page}{$this->querystring}';return false\">{$option}</select>\n" : '';
 }