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


PHP get_instance_of函数代码示例

本文整理汇总了PHP中get_instance_of函数的典型用法代码示例。如果您正苦于以下问题:PHP get_instance_of函数的具体用法?PHP get_instance_of怎么用?PHP get_instance_of使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _initialize

 protected function _initialize()
 {
     parent::_initialize();
     import('Url');
     $this->Url = get_instance_of('Url');
     load("@.iconvfunc");
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:7,代码来源:CategoryAction.class.php

示例2: __construct

 /**
  * 架构函数
  * @param array $options 配置参数
  * @access public
  */
 function __construct($options = array())
 {
     //网站配置
     $this->config = F("Config");
     $options = array_merge(array('userid' => AppframeAction::$Cache['uid'] ? AppframeAction::$Cache['uid'] : 0, 'groupid' => 8, 'isadmin' => 0, 'catid' => 0, 'module' => 'contents ', 'watermarkenable' => $this->config['watermarkenable'], 'thumb' => false, 'time' => time(), 'dateFormat' => 'Y/m'), $options);
     $this->options = $options;
     //附件访问地址
     $this->options['sitefileurl'] = $this->config['sitefileurl'];
     //附件存放路径
     $this->options['uploadfilepath'] = C('UPLOADFILEPATH');
     //允许上传的附件大小
     if (empty($this->options['uploadmaxsize'])) {
         $this->options['uploadmaxsize'] = $this->options['isadmin'] ? (int) $this->config['uploadmaxsize'] * 1024 : (int) $this->config['qtuploadmaxsize'] * 1024;
     }
     //允许上传的附件类型
     if (empty($this->options['uploadallowext'])) {
         $this->options['uploadallowext'] = $this->options['isadmin'] ? explode("|", $this->config['uploadallowext']) : explode("|", $this->config['qtuploadallowext']);
     }
     //上传目录
     $this->options['savePath'] = D('Attachment')->getFilePath($this->options['module'], $this->options['dateFormat'], $this->options['time']);
     //如果生成缩略图是否移除原图
     $this->options['thumbRemoveOrigin'] = false;
     import('UploadFile');
     $this->handler = get_instance_of('UploadFile');
     //设置上传类型
     $this->handler->allowExts = $this->options['uploadallowext'];
     //设置上传大小
     $this->handler->maxSize = $this->options['uploadmaxsize'];
     //设置本次上传目录,不存在时生成
     $this->handler->savePath = $this->options['savePath'];
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:36,代码来源:AttachmentLocal.class.php

示例3: _initialize

 protected function _initialize()
 {
     parent::_initialize();
     import('Url');
     $this->url = get_instance_of('Url');
     /**
      * 查询城市
      * */
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:9,代码来源:IndexAction.class.php

示例4: _initialize

 public function _initialize()
 {
     //关闭由于启用域名绑定造成的前台域名出错
     define("APP_SUB_DOMAIN_NO", 1);
     parent::_initialize();
     import('Url');
     $this->url = get_instance_of('Url');
     define('HTML', true);
     C('HTML_FILE_SUFFIX', "");
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:10,代码来源:Html.class.php

示例5: load

 /**
 +----------------------------------------------------------
 * 加载过滤器
 * 
 +----------------------------------------------------------
 * @static
 * @access public 
 +----------------------------------------------------------
 * @param string $filterNames  过滤器名称
 * @param string $method  执行的方法名称
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 * @throws ThinkExecption
 +----------------------------------------------------------
 */
 static function load($filterNames, $method = 'execute')
 {
     $filterPath = dirname(__FILE__) . '/Filter/';
     $filters = explode(',', $filterNames);
     $load = false;
     foreach ($filters as $key => $val) {
         if (strpos($val, '.')) {
             $filterClass = strtolower(substr(strrchr($val, '.'), 1));
             import($val);
         } else {
             $filterClass = 'Filter' . $val;
             require_cache($filterPath . $filterClass . '.class.php');
         }
         if (class_exists($filterClass)) {
             $filter = get_instance_of($filterClass);
             $filter->{$method}();
         }
     }
     return;
 }
开发者ID:skiman100,项目名称:thinksns,代码行数:36,代码来源:Filter.class.php

示例6: connect

 /**
  * 连接
  * @access public
  * @param array $options  配置数组
  * @return object
  */
 public static function connect($options = array())
 {
     //判断模块是否安装
     if (false == isModuleInstall('Member')) {
         return get_instance_of('PassportService');
     }
     //网站配置
     $config = F("Member_Config");
     if ($config['interface']) {
         $type = $config['interface'];
     } else {
         $type = 'Local';
     }
     //附件存储方案
     $type = trim($type);
     $class = 'Passport' . ucwords($type);
     import("Driver.Passport.{$class}", LIB_PATH);
     if (class_exists($class)) {
         $Atta = new $class($options);
     } else {
         throw_exception('无法加载通行证:' . $type);
     }
     return $Atta;
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:30,代码来源:PassportService.class.php

示例7: getInstance

 public static function getInstance()
 {
     $args = func_get_args();
     return get_instance_of(__CLASS__, 'factory', $args);
 }
开发者ID:BGCX067,项目名称:fakebook-svn-to-git,代码行数:5,代码来源:Db.class.php

示例8: parseXmlTag

 /**
 +----------------------------------------------------------
 * 解析标签库的标签
 * 需要调用对应的标签库文件解析类
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @param string $tagLib  标签库名称
 * @param string $tag  标签名
 * @param string $attr  标签属性
 * @param string $content  标签内容
 +----------------------------------------------------------
 * @return string|false
 +----------------------------------------------------------
 */
 public function parseXmlTag($tagLib, $tag, $attr, $content)
 {
     //if (MAGIC_QUOTES_GPC) {
     $attr = stripslashes($attr);
     $content = stripslashes($content);
     //}
     if (ini_get('magic_quotes_sybase')) {
         $attr = str_replace('\\"', '\'', $attr);
     }
     $tLib = get_instance_of('TagLib' . ucwords(strtolower($tagLib)));
     if ($tLib->valid()) {
         $parse = '_' . $tag;
         $content = trim($content);
         return $tLib->{$parse}($attr, $content);
     }
 }
开发者ID:macall,项目名称:jsd,代码行数:31,代码来源:ThinkTemplate.class.php

示例9: getInstance

 public static function getInstance()
 {
     return get_instance_of(__CLASS__);
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:4,代码来源:Input.class.php

示例10: getInstance

 /**
  * 取得缓存类实例
  * @static
  * @access public
  * @return mixed
  */
 static function getInstance()
 {
     $param = func_get_args();
     return get_instance_of(__CLASS__, 'connect', $param);
 }
开发者ID:ljhchshm,项目名称:weixin,代码行数:11,代码来源:Cache.class.php

示例11: parseXmlTag

 /**
    +----------------------------------------------------------
    * 解析标签库的标签
    * 需要调用对应的标签库文件解析类
    +----------------------------------------------------------
    * @access public
    +----------------------------------------------------------
    * @param string $tagLib  标签库名称
    * @param string $tag  标签名
    * @param string $attr  标签属性
    * @param string $content  标签内容
    +----------------------------------------------------------
    * @return string|false
    +----------------------------------------------------------
 */
 public function parseXmlTag($tagLib, $tag, $attr, $content)
 {
     $attr = stripslashes($attr);
     $content = stripslashes($content);
     if (ini_get('magic_quotes_sybase')) {
         $attr = str_replace('\\"', '\'', $attr);
     }
     if (!empty(self::$nowTags['alias'])) {
         $tLib = get_instance_of('Tag' . ucwords(strtolower(self::$nowTags['alias'])));
         $tLib->setOther($tag);
     } else {
         $tLib = get_instance_of('Tag' . ucwords(strtolower($tag)));
     }
     return $tLib->parse($attr, $content);
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:30,代码来源:TemplateService.class.php

示例12: remove

 public function remove()
 {
     if (IS_POST && isset($_POST['fromtype'])) {
         $catid = I('get.catid', '', 'intval');
         if (!$catid) {
             $this->error("请指定栏目!");
         }
         //移动类型
         $fromtype = I('post.fromtype', '', 'intval');
         //需要移动的信息ID集合
         $ids = $_POST['ids'];
         //需要移动的栏目ID集合
         $fromid = $_POST['fromid'];
         //目标栏目
         $tocatid = I('post.tocatid', '', 'intval');
         if (!$tocatid) {
             $this->error("目标栏目不正确!");
         }
         import('Content');
         $Content = get_instance_of('Content');
         switch ($fromtype) {
             //信息移动
             case 0:
                 if ($ids) {
                     if ($tocatid == $catid) {
                         $this->error("目标栏目和当前栏目是同一个栏目!");
                     }
                     $modelid = getCategory($tocatid, 'modelid');
                     if (!$modelid) {
                         $this->error("该模型不存在!");
                     }
                     $this->contentModel = ContentModel::getInstance($modelid);
                     import('Url');
                     $this->url = get_instance_of('Url');
                     //表名
                     $tablename = ucwords($this->model[$modelid]['tablename']);
                     if (!$ids) {
                         $this->error("请选择需要移动信息!");
                     }
                     $ids = array_filter(explode('|', $_POST['ids']), "intval");
                     //删除静态文件
                     foreach ($ids as $sid) {
                         $data = $this->contentModel->where(array('catid' => $catid, 'id' => $sid))->find();
                         $Content->deleteHtml($catid, $sid, $data['inputtime'], $data['prefix'], $data);
                         $data['catid'] = $tocatid;
                         $urls = $this->url->show($data);
                         $this->contentModel->where(array('catid' => $catid, 'id' => $sid))->save(array("catid" => $tocatid, 'url' => $urls['url']));
                     }
                     $this->success("移动成功!", U("Createhtml/update_urls"));
                 } else {
                     $this->error("请选择需要移动的信息!");
                 }
                 break;
                 //栏目移动
             //栏目移动
             case 1:
                 if (!$fromid) {
                     $this->error("请选择需要移动的栏目!");
                 }
                 $where = array();
                 $where['catid'] = array("IN", $fromid);
                 $modelid = getCategory($catid, 'modelid');
                 if (!$modelid) {
                     $this->error("该模型不存在!");
                 }
                 $tablename = ucwords($this->model[$modelid]['tablename']);
                 //进行栏目id更改
                 if (M($tablename)->where($where)->save(array("catid" => $tocatid, 'url' => ''))) {
                     $this->success("移动成功,请使用《批量更新URL》更新新的地址!!", U("Createhtml/update_urls"));
                 } else {
                     $this->error("移动失败");
                 }
                 break;
             default:
                 $this->error("请选择移动类型!");
                 break;
         }
     } else {
         $ids = I('request.ids', '', '');
         $ids = is_array($ids) ? implode("|", $ids) : $ids;
         $catid = I('get.catid', '', 'intval');
         if (!$catid) {
             $this->error("请指定栏目!");
         }
         $modelid = getCategory($catid, 'modelid');
         import("Tree");
         $tree = new Tree();
         $tree->icon = array('  │ ', '  ├─ ', '  └─ ');
         $tree->nbsp = '  ';
         $categorys = array();
         $categorysList = F("Category");
         foreach ($categorysList as $cid => $r) {
             if ($r['type']) {
                 continue;
             }
             if ($modelid && $modelid != $r['modelid']) {
                 continue;
             }
             $r['disabled'] = $r['child'] ? 'disabled' : '';
             $r['selected'] = $cid == $catid ? 'selected' : '';
//.........这里部分代码省略.........
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:101,代码来源:ContentAction.class.php

示例13: TagLib

function TagLib($name, $params = array())
{
    $class = $name . 'TagLib';
    import("TagLib.{$class}", LIB_PATH);
    return get_instance_of($class, '', $params);
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:6,代码来源:~runtime.php

示例14: related_content

 /**
  * 上下篇生成
  * @param type $catid
  * @param type $id 
  */
 public function related_content($catid, $id, $action = "edit")
 {
     if (!$catid || !$id) {
         return;
     }
     $modelid = getCategory($catid, 'modelid');
     $db = ContentModel::getInstance($modelid);
     $where = array();
     $where['catid'] = $catid;
     $where['status'] = array("EQ", "99");
     $where['id'] = array("LT", $id);
     $data[] = $db->relation(true)->where($where)->order(array("id" => "DESC"))->find();
     if ($action == "edit") {
         $where['id'] = array("GT", $id);
         $data[] = $db->relation(true)->where($where)->find();
     }
     import('Html');
     $html = get_instance_of('Html');
     foreach ($data as $r) {
         if ($r['islink'] || empty($r['id'])) {
             continue;
         }
         $db->dataMerger($r);
         $setting = getCategory($r['catid'], 'setting');
         $content_ishtml = $setting['content_ishtml'];
         if (!$content_ishtml) {
             continue;
         }
         $html->show($r, 1, 'edit');
     }
     return true;
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:37,代码来源:Content.class.php

示例15: clean_file

 /**
  * 移除文件
  * @param type $tmpdir 目录
  * @param type $list 需要删除的文件列表
  * @return type
  */
 public function clean_file($tmpdir, $list)
 {
     $Dir = get_instance_of('Dir');
     //过滤空白数组
     $list = array_filter($list);
     //批量转换编码
     foreach ($list as $file) {
         $object = $tmpdir . $file;
         //忽略不存在的文件
         if (file_exists($object) === FALSE) {
             continue;
         }
         //删除目录
         if (is_dir($object)) {
             $Dir->delDir($object);
         }
         //删除文件出错
         if (is_file($object) && unlink($object) === FALSE) {
             //记录在案
             $this->lastfile = $object;
             //错误信息
             $this->error = "无法删除{$object}文件!";
             return -10006;
         }
     }
     return true;
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:33,代码来源:Cloud.class.php


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