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


PHP getinstance函数代码示例

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


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

示例1: doaction

 private function doaction($name, $args)
 {
     if (!is_array($args)) {
         $args = array(0 => $args);
     }
     $class = $this->items[$name]['class'];
     $func = $this->items[$name]['func'];
     if (empty($class)) {
         if (!function_exists($func)) {
             unset($this->items[$name]);
             $this->Save();
             return new IXR_Error(404, 'The requested function not found');
         }
         //return $func($arg);
         try {
             return call_user_func_array($func, $args);
         } catch (Exception $e) {
             return new IXR_Error($e->getCode(), $e->getMessage());
         }
     } else {
         if (!class_exists($class)) {
             unset($this->items[$name]);
             $this->save();
             return new IXR_Error(404, 'The requested class not found');
         }
         $obj = getinstance($class);
         //return $obj->$func($arg);
         try {
             return call_user_func_array(array($obj, $func), $args);
         } catch (Exception $e) {
             return new IXR_Error($e->getCode(), $e->getMessage());
         }
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:34,代码来源:xmlrpc.action.class.php

示例2: i

 public static function i($pid = 0)
 {
     $result = getinstance(__CLASS__);
     if ($pid > 0) {
         $result->pid = $pid;
     }
     return $result;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:8,代码来源:comments.class.db.php

示例3: i

 public static function i($section = '')
 {
     if (!isset(self::$self)) {
         self::$self = getinstance(__CLASS__);
         self::$self->loadfile('default');
     }
     if ($section != '') {
         self::$self->section = $section;
     }
     return self::$self;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:11,代码来源:local.class.php

示例4: __get

 public function __get($name)
 {
     if (isset($this->mapoptions[$name])) {
         $prop = $this->mapoptions[$name];
         if (is_array($prop)) {
             list($classname, $method) = $prop;
             return call_user_func_array(array(getinstance($classname), $method), array($name));
         }
         return litepublisher::$options->data[$prop];
     }
     return parent::__get($name);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:12,代码来源:site.class.php

示例5: processform

 public function processform()
 {
     $plugin = tregservices::i();
     $plugin->lock();
     foreach ($plugin->items as $name => $classname) {
         $service = getinstance($classname);
         $service->processform();
     }
     $plugin->update_widget();
     $plugin->unlock();
     return '';
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:12,代码来源:admin.regservices.class.php

示例6: getinstance

 public static function getinstance($name)
 {
     if (isset(self::$instances[$name])) {
         return self::$instances[$name];
     }
     $result = getinstance(__CLASS__);
     if ($result->name != '') {
         $result = litepublisher::$classes->newinstance(__CLASS__);
     }
     $result->name = $name;
     $result->load();
     return $result;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:13,代码来源:theme.class.php

示例7: processform

 public function processform()
 {
     $plugin = tmlstorage::i();
     foreach ($plugin->items as $classname => $items) {
         $obj = getinstance($classname);
         if (is_array($obj->data['tml'])) {
             foreach ($obj->data['tml'] as $key => $value) {
                 $obj->data['tml'][$key] = $_POST[$classname . '_text_' . $key];
             }
         } else {
             $obj->data['tml'] = $_POST[$classname . '_text'];
         }
         $obj->save();
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:15,代码来源:admin.tmlstorage.class.php

示例8: init

 public static function init($usecookie = false)
 {
     if (!self::$initialized) {
         self::$initialized = true;
         ini_set('session.use_cookies', $usecookie);
         ini_set('session.use_only_cookies', $usecookie);
         ini_set('session.use_trans_sid', 0);
         session_cache_limiter(false);
         if (function_exists('igbinary_serialize')) {
             ini_set('igbinary.compact_strings', 0);
             ini_set('session.serialize_handler', 'igbinary');
         }
     }
     if (tfilestorage::$memcache) {
         return getinstance(__CLASS__);
     } else {
         //ini_set('session.gc_probability', 1);
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:19,代码来源:session.class.php

示例9: __get

 public function __get($name)
 {
     if (!isset($this->items[$name])) {
         return '';
     }
     $func = $this->items[$name]['func'];
     $class = $this->tags[$name]['class'];
     if (empty($class)) {
         if (function_exists($func)) {
             return $func($name);
         } else {
             $this->delete($name);
         }
     } elseif (class_exists($class)) {
         $obj = getinstance($class);
         return $obj->{$func}($name);
     } else {
         $this->delete($name);
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:20,代码来源:template.tags.class.php

示例10: methodSignature

 public function methodSignature($name)
 {
     $caller = TXMLRPC::i();
     if (!$caller->itemexists($name)) {
         return new IXR_Error(-32601, "server error. requested method {$name} does not exist.");
     }
     $item = $caller->getitem($name);
     if ($item['class'] != __CLASS__) {
         $obj = getinstance($item['class']);
         if (method_exists($obj, 'getsignature')) {
             return $obj->getsignature($name);
         } else {
             return new IXR_Error(-32601, "server error. requested signature of {$name} method does not exist.");
         }
     }
     switch ($name) {
         case 'system.listMethods':
         case 'mt.listMethods':
             return array('array');
         case 'system.methodSignature':
             return array('array', 'string');
         case 'system.methodHelp':
             return array('string', 'string');
         case 'system.multicall':
             return array('array', 'array');
         case 'methodExist':
             return array('boolean', 'string');
         case 'demo.addTwoNumbers':
         case 'sample.add':
             return array('int', 'int', 'int');
         case 'demo.sayHello':
             return array('string');
         default:
             return new IXR_Error(-32601, "server error. requested signature of {$name} method does not exist.");
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:36,代码来源:xmlrpc.system.class.php

示例11: parsehtml

 public function parsehtml()
 {
     $html = getinstance('tadminhtml');
     $html->ini = array();
     foreach ($this->html as $filename) {
         $realfilename = $this->getrealfilename($filename);
         if (!file_exists($realfilename)) {
             $this->error(sprintf('The file "%s" not found', $realfilename));
         }
         if (!($parsed = parse_ini_file($realfilename, true))) {
             $this->error(sprintf('Error parse "%s" ini file', $realfilename));
         }
         if (count($html->ini) == 0) {
             $html->ini = $parsed;
         } else {
             foreach ($parsed as $section => $itemsini) {
                 $html->ini[$section] = isset($html->ini[$section]) ? $itemsini + $html->ini[$section] : $itemsini;
             }
         }
     }
     tfilestorage::savevar(tlocal::getcachedir() . 'adminhtml', $html->ini);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:22,代码来源:localmerger.class.php

示例12: i

 public static function i(tpost $post)
 {
     $self = getinstance(__CLASS__);
     $self->post = $post;
     return $self;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:6,代码来源:post.transform.class.php

示例13: execute

 public function execute()
 {
     while ($item = $this->db->getassoc(sprintf("date <= '%s' order by date asc limit 1", sqldate()))) {
         extract($item);
         $this->log("task started:\n{$class}->{$func}({$arg})");
         $arg = unserialize($arg);
         if ($class == '') {
             if (function_exists($func)) {
                 try {
                     $func($arg);
                 } catch (Exception $e) {
                     litepublisher::$options->handexception($e);
                 }
             } else {
                 $this->db->iddelete($id);
                 continue;
             }
         } elseif (class_exists($class)) {
             try {
                 $obj = getinstance($class);
                 $obj->{$func}($arg);
             } catch (Exception $e) {
                 litepublisher::$options->handexception($e);
             }
         } else {
             $this->db->iddelete($id);
             continue;
         }
         if ($type == 'single') {
             $this->db->iddelete($id);
         } else {
             $this->db->setvalue($id, 'date', sqldate(strtotime("+1 {$type}")));
         }
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:35,代码来源:cron.class.php

示例14: getadminplugin

 private function getadminplugin($name)
 {
     $about = tplugins::getabout($name);
     if (empty($about['adminclassname'])) {
         return false;
     }
     $class = $about['adminclassname'];
     if (!class_exists($class)) {
         litepublisher::$classes->include_file(litepublisher::$paths->plugins . $name . DIRECTORY_SEPARATOR . $about['adminfilename']);
     }
     return getinstance($class);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:12,代码来源:admin.plugins.class.php

示例15: createfiles

 public function createfiles()
 {
     $this->countfiles = 0;
     $this->count = 0;
     $this->date = time();
     $this->lastmod = date('Y-m-d', $this->date);
     $this->openfile();
     $home = thomepage::i();
     $this->prio = 9;
     $this->write('/', $home->showposts && $home->showpagenator ? ceil($home->archcount / litepublisher::$options->perpage) : 1);
     $perpage = 1000;
     foreach ($this->classes as $prio => $class) {
         $this->prio = max(9 - $prio, 1);
         $instance = getinstance($class);
         $from = 0;
         do {
             $links = $instance->getsitemap($from, $perpage);
             $from += count($links);
             foreach ($links as $item) {
                 $this->write($item['url'], $item['pages']);
             }
         } while (count($links) == $perpage);
     }
     //url's from items prop
     foreach ($this->items as $url => $prio) {
         $this->writeitem($url, $prio);
     }
     $this->closefile();
     $this->Save();
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:30,代码来源:sitemap.class.php


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