本文整理匯總了PHP中type::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::getInstance方法的具體用法?PHP type::getInstance怎麽用?PHP type::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::getInstance方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeRequest
/**
*
* @param type $element
* @param type $createThread
* @param type $bean
* @param type $externalAction
* @param type $args
* @return type
*/
public function executeRequest($args = array(), $createThread = false, $bean = null, $externalAction = '')
{
$this->logger->info('Processing a direct request.');
$this->logger->debug('Direct request params: ' . print_r($args));
$this->request->setCreateThread($createThread);
$this->request->setExternalAction($externalAction);
$this->request->setBean($bean);
$this->request->setArguments($args);
$preProcessor = $this->preProcessor->getInstance();
$response = $preProcessor->processRequest($this->request);
return $response;
}
示例2: typeinfo
static function typeinfo($id) {
$type = type::getInstance ();
if (is_array ( $id ))
$id = $id ['typeid'];
$typeinfo [] = $type->type [$id];
$typeinfo [0] ['url'] = type::url ( $id );
if(!$typeinfo){
return;
}
$types = $type->son ( $id );
$tys = array ();
foreach ( $types as $typeid ) {
$_type = $type->type [$typeid];
if ($stype && ! preg_match ( '/-/', $stype ) && $_type ['stype'] != $stype)
continue;
if ($stype && preg_match ( '/-/', $stype ) && '-' . $_type ['stype'] == $stype)
continue;
$_type ['url'] = type::url ( $_type ['typeid'] );
$tys [] = $_type;
}
if(!empty($tys)){
$typeinfo = array_merge($typeinfo,$tys);
}
//var_dump($typeinfo);
return $typeinfo;
}
示例3: 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;
}
示例4: list_action
function list_action() {
$this->view->page=front::get('page') ?front::get('page') : 1;
$this->pagesize=config::get('list_pagesize');
$limit=(($this->view->page -1) * $this->pagesize).','.$this->pagesize;
$type=new type();
$types=array();
$types=$type->sons(front::get('typeid'));
$types[]=front::get('typeid');
$where='typeid in ('.implode(',',$types).') AND checked=1 AND state=1';
$this->view->type=$type->getrow('typeid='.front::get('typeid'));
$this->view->pages=@$this->view->type['ispages'];
$this->view->typeid=front::get('typeid');
$archive=new archive();
$archives=$archive->getrows($where,$limit,'listorder desc,aid desc');
foreach ($archives as $order=>$arc) {
$archives[$order]['url']=archive::url($arc);
$archives[$order]['typename']=type::name($arc['typeid']);
$archives[$order]['typeurl']=type::url($arc['typeid']);
$archives[$order]['adddate']=sdate($arc['adddate']);
$archives[$order]['stitle']=strip_tags($arc['title']);
$archives[$order]['sthumb'] = @strstr($arc['thumb'], "http://") ? $arc['thumb'] : config::get('base_url') . '/' . $arc['thumb'];
}
$this->view->archives=$archives;
$this->view->record_count=$archive->rec_count($where);
front::$record_count=$this->view->record_count;
$this->type=type::getInstance();
if (front::get('t') == 'wap') {
$this->out('wap/type_list.html');
return;
}
$template=$this->type->type[front::get('typeid')]['template'];
if ($template&&file_exists(TEMPLATE.'/'.$this->view->_style.'/'.$template)) $this->out($template);
else {
$tpl=type::gettemplate($this->view->typeid);
if (type::getishtml($this->view->typeid)) {
$path=ROOT.type::url($this->view->typeid,@front::$get['page']>1 ?front::$get['page'] : null);
if (!preg_match('/\.[a-zA-Z]+$/',$path)) $path=rtrim(rtrim($path,'/'),'\\').'/index.html';
$this->cache_path=$path;
}
$this->out($tpl);
}
}
示例5: factory
/**
* Obtains a new instance of $modelClassName, using a dependency injection
* container if possible.
*
* @param string $modelClassName name of the model
*/
public static function factory($modelClassName)
{
if (self::$dependencyInjector) {
return self::$dependencyInjector->getInstance($modelClassName);
}
return new $modelClassName();
}
示例6: 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){
//.........這裏部分代碼省略.........
示例7: mail_action
function mail_action() {
chkpw('seo_mail_usersend');
$where=null;
$ordre='1 desc';
if ($this->table == 'archive') {
$ordre="`order`,1 DESC";
$where=$this->_table->get_where('manage');
if (!front::post('_typeid'))
session::del('_typeid');
if (get('_typeid')) {
$typeid=get('_typeid');
session::set('_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('_title'))
session::del('_title');
if (get('_title')) {
$title=get('_title');
session::set('_title',$title);
$where .=" and title like '%$title%' ";
}
}
if ($this->table == 'templatetag') {
if (front::get('tagfrom')) {
$where="tagfrom='".front::get('tagfrom')."'";
}
else
$where="tagfrom='define'";
$where .=" and (`tagvar` IS NULL OR `tagvar` = '') ";
}
if ($this->table == 'option') {
$ballot=new ballot();
$where=array('bid'=>front::$get['bid']);
session::set('bid',front::$get['bid']);
$row=$ballot->getrow(array('id'=>front::$get['bid']));
$this->view->ballot=$row;
}
$limit=((front::get('page') -1) * $this->_pagesize).','.$this->_pagesize;
$this->_view_table=$this->_table->getrows($where,$limit,$ordre,$this->_table->getcols('manage'));
$this->view->record_count=$this->_table->record_count;
}
示例8: make_type_action
function make_type_action() {
chkpw('cache_type');
header('Cache-control: private, must-revalidate');
@set_time_limit(0);
if (!front::post('submit'))
return;
$case = 'type';
$act = 'list';
$_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';
$totalpage = 100;
$time_start = time::getTime();
$type = type::getInstance();
$typeid = front::post('typeid');
if ($typeid && !$type->getishtml($typeid)) {
front::flash("該分類不需要生成html!");
return;
}
if($typeid){
$arrtype = $type->getrows($typeid);
}else{
$arrtype = $type->getrows('',0);
}
$cpage = 0;
if(is_array($arrtype) && !empty($arrtype)){
foreach($arrtype as $v){
if (!$type->getishtml($v['typeid'])) {
continue;
}
$types=array();
$types=$type->sons($v['typeid']);
$types[]=$v['typeid'];
$where='typeid in ('.implode(',',$types).') AND checked=1 AND state=1';
$archive_all = new archive();
$archive_num = $archive_all->rec_count($where);
for (front::$get['page'] = 1;; front::$get['page']++) {
$view = $case->view;
$pagesize = config::get('list_pagesize');
$limit = ((front::$get['page'] - 1) * $pagesize) . ',' . $pagesize;
$archive = new archive();
$case->view->archives = $archive->getrows($where, $limit, '`listorder` desc,aid desc');
$case->view->page = front::$get['page'];
$case->view->type = $v;
$case->view->typeid = $v['typeid'];
$case->view->pages = $v['ispages'];
foreach ($case->view->archives as $order => $arc) {
$articles = $arc;
if (!$arc['introduce'])
$arc['introduce'] = cut($arc['content'], 200);
$articles['url'] = archive::url($arc);
$articles['catname'] = category::name($arc['catid']);
$articles['caturl'] = category::url($arc['catid']);
$articles['sthumb'] = @strstr($arc['thumb'], "http://") ? $arc['thumb'] : config::get('base_url') . '/' . $arc['thumb'];
$articles['strgrade'] = archive::getgrade($arc['grade']);
$articles['adddate'] = sdate($arc['adddate']);
$articles['buyurl'] = url('archive/orders/aid/' . $arc['aid']);
$articles['stitle'] = strip_tags($arc['title']);
$case->view->archives[$order] = $articles;
}
if (!isset($page_count)) {
front::$record_count = $case->view->record_count = $archive_num;
$case->view->page_count = ceil($case->view->record_count / $pagesize);
$page_count = $case->view->page_count;
}
if (front::get('page') > 1 && front::get('page') > $case->view->page_count) {
$page_count = null;
break;
}
$tpl = type::gettemplate($v['typeid']);
$content = $case->fetch($tpl);
$path = type::url($v['typeid'], front::$get['page'], true);
if (!preg_match('/\.[a-zA-Z]+$/', $path))
$path = rtrim(rtrim($path, '/'), '\\') . '/index.html';
$path = rtrim($path, '/');
$path = rtrim($path, '\\');
$path = str_replace('//', '/', $path);
if(config::get('base_url') == '/'){
$path = ROOT.substr($path,1);
}else{
$path = ROOT.str_replace(config::get('base_url'), '', $path);
}
tool::mkdir(dirname($path));
if (!file_put_contents($path, $content)) {
front::flash("寫入HTML失敗!");
}
$indexpath = dirname($path) . '/index.html';
if (front::$get['page'] == 1 && $indexpath != ROOT . '/index.html') {
file_put_contents($indexpath, $content);
$cpage++;
//.........這裏部分代碼省略.........
示例9: getInstance
/**
* Get instance of Thrift Model classes
* @param string $classe
* @param mixed $param
* @return mixed
*/
public function getInstance($classe, $param = null)
{
return $this->factory->getInstance($classe, $param);
}