当前位置: 首页>>代码示例>>PHP>>正文


PHP category::getInstance方法代码示例

本文整理汇总了PHP中category::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP category::getInstance方法的具体用法?PHP category::getInstance怎么用?PHP category::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在category的用法示例。


在下文中一共展示了category::getInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: select

 static function select($name,$value,$data,$option=null) {
     $select="<select id=\"$name\" name=\"$name\" $option>";
     if (!isset($data[0]) &&@$data[0] != null) {
         $select.="<option value=\"0\">请选择...</option>";
     }
     if (@$data[0] == null ||(isset($data[0]) &&!$data[0]))
         unset($data[0]);
     if($_GET['table'] == 'category'){
         $category = category::getInstance();
         $subids = $category->sons($_GET['id']);
     }
     if($_GET['table'] == 'type'){
         $category = type::getInstance();
         $subids = $category->sons($_GET['id']);
     }
     foreach ($data as $k=>$d) {
         $select .= "<option value=\"$k\"";
         if($k == $value){
             $select .= ' selected ';
         }else if(isset($_GET['id']) && ($_GET['table'] == 'category' || $_GET['table'] == 'type') && !preg_match('/htmlrule/is', $name)){
             if($_GET['id'] == $k || in_array($k,$subids)){
                 $select .= ' disabled ';
             }
         }
         $select .= ">$d</option>";
         //$select.="<option value=\"$k\" ".($k == $value ?'selected': '').">$d</option>";
     }
     $select.="</select>";
     return $select;
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:30,代码来源:form.php

示例2: ctsitemap_action

 function ctsitemap_action(){
 	$category = category::getInstance();
 	$category->sitemap();
 	front::flash('生成网站地图成功');
 	front::redirect(front::$from);
     /*echo "<script>alert('生成网站地图成功!');window.close();</script>";
     exit;*/
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:8,代码来源:cache_act.php

示例3: categoryinfo

	static function categoryinfo($id) {
		if ($id == 0) {
			$category = category::getInstance ();
			if (is_array ( $id ))
				$id = $id ['catid'];
			$categories = $category->son ( $id );
			$cats = array ();
			foreach ( $categories as $catid ) {
				$_category = $category->category [$catid];
				if ($stype && ! preg_match ( '/-/', $stype ) && $_category ['stype'] != $stype)
					continue;
				if ($stype && preg_match ( '/-/', $stype ) && '-' . $_category ['stype'] == $stype)
					continue;
				$_category ['url'] = category::url ( $_category ['catid'] );
				$cats [] = $_category;
			}
			return $cats;
		}
		$category = category::getInstance ();
		$catinfo [] = $category->category [$id];
		$catinfo [0] ['url'] = category::url ( $id );
		return $catinfo;
	}
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:23,代码来源:plugins.php

示例4: archive

function archive($catid='0',$typeid='0',$spid=0,$area='0,0,0',$length=20,$ordertype='aid',$limit=10,$image=false,$attr1=null,$son=true,$wheretype='',$tpl=null,$intro_len='0',$istop=0) {
    $_ordertype=$ordertype;
    $cache_id=md5($catid.$typeid.$spid.$area.$length.$ordertype.$limit.$son.$wheretype.$tpl.$intro_len.$istop);
    if ($ordertype == 'rand()')
        $cache_id=$cache_id.time();
    if (cache::get($cache_id))
        $archives=cache::get($cache_id);
    else {
        $ordertype=str_replace('-',' ',$ordertype);
        $wheretype=str_replace('-',' ',$wheretype);
        $order = 'listorder=0,listorder ASC ';
        if (preg_match('/^\w+$/',$ordertype))
            $order .= ','.$ordertype.' desc';
        elseif ($ordertype)
            $order .= ','.$ordertype;
        $where=array();
        if ($wheretype)
            foreach (explode(',',$wheretype) as $_wheretype)
                switch ($_wheretype) {
                    case 'day': $where[]='adddate>'.date('Y-m-d H:i:s',time() -3600 * 24);
                        break;
                    case 'week': $where[]='adddate>'.date('Y-m-d H:i:s',time() -3600 * 24 * 7);
                        break;
                    case 'month': $where[]='adddate>'.date('Y-m-d H:i:s',time() -3600 * 24 * 30);
                        break;
                    default:
                        if (preg_match('/commend=(\d+)/i',$_wheretype,$match))
                            $where[]=" attr1 REGEXP  '(^|,)$match[1](,|$)'  ";
                        else
                        if (preg_match('/^\w+$/',$_wheretype))
                            $where[]=$_wheretype."<>''";
                        else
                            $where[]=$_wheretype;
                        break;
                }
        if (!empty($where))
            $where=' and '.implode(' and ',$where);
        else
            $where='';
        $archive=archive::getInstance();
        $category=category::getInstance();
        $categories=array();
        if (isset($catid) &&$catid != '0') {
            $catid=explode('-',$catid);
            //var_dump($catid);
            $categories=$catid;
            $_categories1=array();
            if ($son) {
                
                foreach ($categories as $key=>$val) {
                    $_categories[$key]=$category->sons($val);
                    $_categories1=array_merge($_categories[$key],$_categories1);
                }
                //var_dump($_categories);
            }
            //var_dump($categories);
            $categories=array_merge($categories,$_categories1);
            //var_dump($categories);
        }
        //var_dump($categories);
        $type=type::getInstance();
        $types=array();
        if (isset($typeid) &&$typeid != '0') {
            $types[]=$typeid;
            if ($son) {
                $_types=$type->sons($typeid);
            }
            $types=array_merge($types,$_types);
        }
        $where='1';
        if (!empty($types))
            $where.=' and typeid in ('.implode(',',$types).')';
        if (!empty($categories))
            $where.=' and catid in ('.implode(',',$categories).')';
        if ($spid)
            $where.=' and spid='.$spid;
        list($province_id,$city_id,$section_id)=explode(',',$area);
        if ($province_id)
            $where.=' and province_id='.$province_id;
        if ($city_id)
            $where.=' and city_id='.$city_id;
        if ($section_id)
            $where.=' and section_id='.$section_id;
        if ($image)
            $where.=' and thumb <> "" ';
        if ($attr1)
            $where.=" and FIND_IN_SET('$attr1',attr1) ";
        if ($_ordertype == 'aid-asc') {
            $order .=',aid asc';
        }
        if ($_ordertype == 'new') {
        	$order .= ',adddate desc';
        }
        if($istop){
        	$tops = $archive->getrows($where." AND checked=1 AND state=1 AND toppost!=0",0,'toppost DESC,listorder=0,listorder ASC,aid DESC');
        }
        $archives = $archive->getrows($where.' AND state=1 AND checked=1',$limit-count($tops),$order,$archive->getcols('list'));
        
        if(is_array($tops) && !empty($tops)){
        	foreach($tops as $order => $arc){
//.........这里部分代码省略.........
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:101,代码来源:front_class.php

示例5: getshowform

 function getshowform($cid) {
     $category = category::getInstance();
     $row = $category->getrow(array('catid'=>$cid),'1 desc','catid,showform,parentid');
     if($row['showform'] && $row['showform'] != 1) {
         $this->showform = $row['showform'];
     }else if($row['showform'] && $row['showform'] == 1) {
         $this->showform  = 1;
     }else if(!$row['showform']) {
         if($row['parentid'] != 0) {
             $this->getshowform($row['parentid']);
         }else {
             $this->showform = '1';
         }
     }
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:15,代码来源:archive_act.php

示例6: foreach

<table width="100%" border="0" cellspacing="0" cellpadding="0" id="table6">
    <tr>
        <td width="19%" align="right">自定义字段</td>
        <td width="1%">&nbsp;</td>
        <td width="70%">
            <table>
            
<?php 
if (is_array($field) && !empty($field)) {
    foreach ($field as $f) {
        $name = $f['name'];
        if (!preg_match('/^my_/', $name)) {
            unset($field[$name]);
            continue;
        }
        $category = category::getInstance();
        $sonids = $category->sons(setting::$var['archive'][$name]['catid']);
        if (setting::$var['archive'][$name]['catid'] != $data['catid'] && !in_array($data['catid'], $sonids) && setting::$var['archive'][$name]['catid']) {
            unset($field[$name]);
            continue;
        }
        if (!isset($data[$name])) {
            $data[$name] = '';
        }
        ?>
<tr>
    <td class="left" width="20%"><?php 
        echo setting::$var['archive'][$name]['cname'];
        ?>
</td>
    <td width="70%"><?php 
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:31,代码来源:#edit.php

示例7: list_action

 function list_action() {
     $set1=settings::getInstance();
     $sets1=$set1->getrow(array('tag'=>'table-'.$this->table));
     $setsdata1=unserialize($sets1['value']);
     $this->view->settings=$setsdata1;
     $where=null;
     $ordre='`id` DESC';
     if (preg_match('/^special$/',$this->table)) {
         $ordre="listorder='0',`listorder` asc,`adddate` DESC";
     }
     if(preg_match('/^archive$/',$this->table)){
     	$ordre="toppost DESC,listorder=0,listorder ASC,adddate DESC";
     }
     if (preg_match('/^type|category$/',$this->table)) {
         $ordre="listorder=0,listorder asc";
     }
     if (preg_match('/^user$/',$this->table)) {
         $ordre='`userid` DESC';
     }
     if (preg_match('/^usergroup$/',$this->table)) {
     	$ordre='`groupid` DESC';
     }
     if (preg_match('/^my_/',$this->table)) {
         $ordre='`fid` DESC';
     }
     
     if ($this->table == 'archive') {
         $where=$this->_table->get_where('manage');
         if (!front::post('search_catid')  && front::get('type') != 'search')
             session::del('search_catid');
         if (get('search_catid')) {
             $catid=get('search_catid');
             session::set('search_catid',$catid);
             $this->category=category::getInstance();
             $categories=$this->category->sons($catid);
             $categories[]=$catid;
             $where .=' and catid in('.trim(implode(',',$categories),',').')';
         }
         if (get('catid')) {
             $catid=get('catid');
             $where .=' and catid='.$catid;
         }
         if (!front::post('search_typeid')  && front::get('type') != 'search')
             session::del('search_typeid');
         if (get('search_typeid')) {
             $typeid=get('search_typeid');
             session::set('search_typeid',$typeid);
             $this->type=type::getInstance();
             $types=$this->type->sons($typeid);
             $types[]=$typeid;
             $where .=' and typeid in('.trim(implode(',',$types),',').')';
         }
         if (get('typeid')) {
             $typeid=get('typeid');
             $where .=' and typeid='.$typeid;
         }
         if (!front::post('search_title')  && front::get('type') != 'search')
             session::del('search_title');
         if (get('search_title')) {
             $title=get('search_title');
             session::set('search_title',$title);
             $where .=" and title like '%$title%' ";
         }
         if (!front::post('search_province_id')  && front::get('type') != 'search')
             session::del('search_province_id');
         if (get('search_province_id')) {
             $proid=get('search_province_id');
             session::set('search_province_id',$proid);
             $where .=' and province_id='.$proid;
         }
         if (!front::post('search_city_id')  && front::get('type') != 'search')
             session::del('search_city_id');
         if (get('search_city_id')) {
             $cityid=get('search_city_id');
             session::set('search_city_id',$cityid);
             $where .=' and city_id='.$cityid;
         }
         if (!front::post('search_section_id')  && front::get('type') != 'search')
             session::del('search_section_id');
         if (get('search_section_id')) {
             $sectionid=get('search_section_id');
             session::set('search_section_id',$sectionid);
             $where .=' and section_id='.$sectionid;
         }
         if (!front::post('search_spid')  && front::get('type') != 'search')
             session::del('search_spid');
         if (get('search_spid')) {
             $sectionid=get('search_spid');
             session::set('search_spid',$sectionid);
             $where .=' and spid='.$sectionid;
         }
     }
     if ($this->table == 'templatetag') {
         if (front::get('tagfrom')) {
             $where="tagfrom='".front::get('tagfrom')."'";
         }
         else
             $where="tagfrom='define'";
         $where .=" and (`tagvar` IS NULL OR `tagvar` = '') ";
     }
//.........这里部分代码省略.........
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:101,代码来源:table_admin.php

示例8: make_show_action

 function make_show_action() {
     header('Cache-control: private, must-revalidate');
     @set_time_limit(0);
     $submit = front::post('submit') ? front::post('submit') : front::get('submit');
     if (!$submit)
         return;
     chkpw('cache_content');
     //time::start();
     $post = front::$post + front::$get;
     unset($post['submit']);
     $c_url = preg_replace('#&make_page=(\d+)#', '', $_SERVER['QUERY_STRING']);
     $c_url = preg_replace('#&aid_start=(\d+)#', '', $c_url);
     $c_url = preg_replace('#&aid_end=(\d+)#', '', $c_url);
     $c_url = preg_replace('#&catid=(\d+)#', '', $c_url);
     $c_url = preg_replace('#&submit=(\d+)#', '', $c_url);
     $c_url = 'index.php?' . $c_url;
     $c_url.='&submit=1';
     
     $category = category::getInstance(); //实例化栏目类
     
     if ($post['aid_start']) {
         $aid_start = $post['aid_start'];
         $aid_end = $post['aid_end'];
         $where = "aid>=$aid_start and aid<=$aid_end AND checked=1 AND (ishtml IS NULL OR ishtml!=2)";
         $c_url.='&aid_start=' . $aid_start . '&aid_end=' . $aid_end;
     } elseif (isset($post['catid'])) {
         $catid = $post['catid'];
         $categories = $category->sons($catid);
         $categories[] = $catid;
         $categories = implode(',', $categories);
         $where = "catid in(" . $categories . ') and checked=1 AND (ishtml IS NULL OR ishtml!=2)';
         $c_url.='&catid=' . $catid;
     }else
         return;
     $case = 'archive';
     $act = 'show';
     $_GET = array('case' => $case, 'act' => $act);
     $front = new front();
     front::$admin = false;
     front::$html = true;
     front::$rewrite = false;
     $case = $case . '_act';
     $case = new $case();
     $case->init();
     $method = $act . '_action';
     //$time_start = time::getTime();
     
     $archive = new archive(); //实例化文章类
     
     if (config::get('group_on')) { //启用分组生成
         $make_page = $post['make_page'] == '' ? 1 : $post['make_page'];
         $archive->getrows($where);
         $archive_num = $archive->record_count;
         $group_count = config::get('group_count');
         $make_page_num = ceil($archive_num / $group_count);
         $totalpage = (($make_page - 1) * $group_count) . ',' . $group_count;
         $c_url.='&make_page=' . ($make_page + 1);
     } else {
         $totalpage = "";
     }
     
     $archives = $archive->getrows($where, $totalpage, '1'); //取到要生成的所有文章
     
     $cpage = 0;
     foreach ($archives as $arc) {
         if (!category::getarcishtml($arc))  //如果文章设置不生成则跳过
             continue;
         if($arc['linkto']){ //如果有跳转连接则跳过生成
         	continue;
         }
         $case->view->archive = $arc;
         front::$get['aid'] = $case->view->aid = $case->view->archive['aid'];
         $case->view->catid = $case->view->archive['catid'];
         
         $case->view->topid = category::gettopparent($case->view->catid);
         $case->view->parentid = $category->getparent($case->view->catid);
         
         $template = $case->view->archive['template'];
         $content = $case->view->archive['content'];
         
         $case->view->categories = category::getpositionlink2($case->view->catid);
         
         //关键字连接
         $linkword = new linkword();
         $linkwords = $linkword->getrows(null, 1000, 'linkorder desc');
         foreach ($linkwords as $linkword) {
             if (trim($linkword['linkurl']) && !preg_match('%^http://$%', trim($linkword['linkurl']))) {
                 $linkword['linktimes'] = (int) $linkword['linktimes'];
                 $link = "<a href='$linkword[linkurl]' target='_blank'>$linkword[linkword]</a>";
             } else {
                 $link = "<a href='" . url('archive/search/keyword/' . urlencode($linkword['linkword'])) . "' target='_blank'>$linkword[linkword]</a>";
             }
             if (isset($link)) {
                 $content = preg_replace("%(?!\"]*>)$linkword[linkword](?!\s*\")%i", "\\1$link\\2", $content, $linkword['linktimes']);
             }
             unset($link);
         }
         
         //相关文章
         $case->view->likenews = $case->getLike($case->view->archive['tag'], $case->view->archive['keyword']);
//.........这里部分代码省略.........
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:101,代码来源:cache_admin.php

示例9: url

    static function url($info,$page=null,$relative=false) {
        if ($info['linkto']) return $info['linkto'];
        
        if(front::$get['t'] == 'wap'){
        	if (config::get('wap_html_prefix')){
        		$html_prefix='/'.trim(config::get('wap_html_prefix'),'/');
        	}
        	if(front::$rewrite){
        		if (!$page){
        			return config::get('site_url').'show_wap_'.$info['aid'].'.htm';
        		}else{
        			return config::get('site_url').'show_wap_'.$info['aid'].'_'.$page.'.htm';
        		}
        	}
        	$type=category::getInstance();
        	if($info['iswaphtml'] == 2){
        		return url::create('archive/show/t/wap/aid/'.$info['aid']);
        	}
        	
        	if (!category::getarciswaphtml($info)){
        		if ($page){
        			return url::create('archive/show/t/wap/aid/'.$info['aid'].'/page/'.$page);
	        	}else{
	        		return url::create('archive/show/t/wap/aid/'.$info['aid']);
	        	}
        	}else {
        		if ($info['htmlrule']){
        			$rule=$info['htmlrule'];
        		}else{
        			$rule=category::gethtmlrule($info['catid'],'showhtmlrule');
        		}
        		$rule=str_replace('{$caturl}',$type->htmlpath($info['catid']),$rule);
        		$rule=str_replace('{$dir}',$type->category[$info['catid']]['htmldir'],$rule);
        		$rule=str_replace('{$catid}',$info['catid'],$rule);
        		$rule=str_replace('{$aid}',$info['aid'],$rule);
        		if ($page){
        			$rule=str_replace('{$page}',$page,$rule);
        		}else{
        			$rule=preg_replace('/\(.*?\)/','',$rule);
        			$rule=str_replace('_{$page}','',$rule);
        		}
        		$rule=preg_replace('/[\(\)]/','',$rule);
        		$rule=preg_replace('%[\\/]index\.htm1%','',$rule);
        		$rule=rtrim($rule,'/');
        		$rule=trim($rule,'\\');
        		if ($relative) return $html_prefix.'/'.$rule;
        		return config::get('base_url').$html_prefix.'/'.$rule;
        	}
        }
        
        if (config::get('html_prefix')) $html_prefix='/'.trim(config::get('html_prefix'),'/');
        $type=category::getInstance();
        if($info['ishtml'] == 2){
        	return url::create('archive/show/aid/'.$info['aid']);
        }
        if (!category::getarcishtml($info) ||front::$rewrite) if ($page) return url::create('archive/show/aid/'.$info['aid'].'/page/'.$page);
            else return url::create('archive/show/aid/'.$info['aid']);
        else {
            if ($info['htmlrule']) $rule=$info['htmlrule'];
            else $rule=category::gethtmlrule($info['catid'],'showhtmlrule');
            $rule=str_replace('{$caturl}',$type->htmlpath($info['catid']),$rule);
            $rule=str_replace('{$dir}',$type->category[$info['catid']]['htmldir'],$rule);
            $rule=str_replace('{$catid}',$info['catid'],$rule);
            $rule=str_replace('{$aid}',$info['aid'],$rule);
            if ($page){
                $rule=str_replace('{$page}',$page,$rule);
            }else{
                $rule=preg_replace('/\(.*?\)/','',$rule);
                $rule=str_replace('_{$page}','',$rule);
            }
            $rule=preg_replace('/[\(\)]/','',$rule);
            $rule=preg_replace('%[\\/]index\.htm1%','',$rule);
            $rule=rtrim($rule,'/');
            $rule=trim($rule,'\\');
            if ($relative) return $html_prefix.'/'.$rule;
            return config::get('base_url').$html_prefix.'/'.$rule;
        }
    }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:78,代码来源:archive.php

示例10: index_archive

function index_archive($catid) {
    $index_archive = new archive();
    $index_category = category::getInstance();
    $index_view_category = $index_category->category;
    if (front::get('page'))
        $page = front::get('page');
    else
        $page = 1;
    $index_view_page = $page;
    front::check_type($page);
    $_catpage = category::categorypages($catid);
    if ($_catpage) {
        $index_pagesize = $_catpage;
    } else {
        $index_pagesize = config::get('list_pagesize');
    }
    front::check_type($index_pagesize);
    $index_view_categorys = category::getpositionlink2($catid);
    $topid = category::gettopparent($catid);
    if (!isset($index_category->category[$catid]) ||
            !isset($index_category->category[$topid])) {
        $this->out('message/error.html');
    }
    $limit = (($index_view_page - 1) * $index_pagesize) . ',' . $index_pagesize;
    $categories = array();
    if (@$index_category->category[$catid]['ispages'])
        $categories = $index_category->sons($catid);
    $categories[] = $catid;
    $index_view_pages = @$index_category->category[$catid]['ispages'];
    if (!rank::catget($catid, $index_view_usergroupid))
        $this->out('message/error.html');
    $order = "`listorder` asc,`adddate` DESC";
    if (@$index_category->category[$catid]['includecatarchives'])
        $articles = $index_archive->getrows('catid in (' . implode(',', $categories) . ') and checked=1', $limit, $order);
    else
        $articles = $index_archive->getrows('catid=' . $catid . ' and checked=1', $limit, $order);
    if (!is_array($articles)) {
        $this->out('message/error.html');
    }
    foreach ($articles as $order => $arc) {
        $articles[$order]['url'] = archive::url($arc);
        $articles[$order]['catname'] = category::name($arc['catid']);
        $articles[$order]['caturl'] = category::url($arc['catid']);
        $articles[$order]['adddate'] = sdate($arc['adddate']);
        $articles[$order]['stitle'] = strip_tags($arc['title']);
        $articles[$order]['strgrade'] = archive::getgrade($arc['grade']);
    }
    $index_view_archives = $articles;
    if (@$index_category->category[$catid]['includecatarchives'])
        $index_view_record_count = $index_archive->rec_count('catid in(' . implode(',', $categories) . ')');
    else
        $index_view_record_count = $index_archive->rec_count('catid=' . $catid);
    front::$record_count = $index_view_record_count;
    return $index_view_archives;
}
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:55,代码来源:userfunction.php


注:本文中的category::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。