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


PHP CI_Controller::get_instance方法代码示例

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


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

示例1: on_before_validate

 function on_before_validate($values)
 {
     if ($values['username'] == "" || $values['username'] == NULL) {
         $this->password_in_clear = $password = $this->random_password();
         $ci = CI_Controller::get_instance();
         $ci->load->helper('url');
         $ci->load->library('session');
         $ci->load->library('extemplate');
         $ci->load->library("email");
         $ci->load->config('tank_auth', TRUE);
         $hasher = new PasswordHash($ci->config->item('phpass_hash_strength', 'tank_auth'), $ci->config->item('phpass_hash_portable', 'tank_auth'));
         $hashed_password = $hasher->HashPassword($password);
         $values["password"] = $hashed_password;
         $values["created"] = datetime_now();
         $values['username'] = trim($values['email']);
         $values["last_ip"] = $_SERVER['REMOTE_ADDR'];
         $data = $values;
         $data['site_name'] = 'http://www.ressphere.com';
         $data['password'] = $this->password_in_clear;
         if ($ci->config->item('email_account_details')) {
             base::_begin_send_email('Welcome to', $data['email'], $data, $ci);
         }
     }
     return parent::on_before_validate($values);
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:25,代码来源:users_model.php

示例2: get_admin_field

function get_admin_field($field = 'id', $id = FALSE)
{
    $uid = $id && is_numeric($id) ? $id : $_SESSION['auth_admin'];
    $CI = CI_Controller::get_instance();
    $CI->load->model('admin_model');
    return $CI->admin_model->get_field($field, $uid);
}
开发者ID:skyling,项目名称:ci_study,代码行数:7,代码来源:admin_helper.php

示例3: render

 /**
  * Render banner into template
  * @access public
  * @param int $id is id entity (brand, category, product, page) .... for main id = 0
  * @param string $group
  * @return boolean
  * @author L.Andriy <l.andriy@siteimage.com.ua>
  * @copyright (c) 2013, ImageCMS
  */
 public function render($id = 0, $group = 0)
 {
     if ($this->no_install === false) {
         return false;
     }
     $type = $this->core->core_data['data_type'];
     $lang = $this->get_main_lang('identif');
     $painting = $type . '_' . (int) $id;
     $hash = 'baners' . $type . $id . \CI_Controller::get_instance()->config->item('template');
     if ($cache = Cache_html::get_html($hash)) {
         \CMSFactory\assetManager::create()->registerScript('jquery.cycle.all.min');
         echo $cache;
     } else {
         $banners = $this->banner_model->get_all_banner($lang, $group);
         foreach ($banners as $banner) {
             $data = unserialize($banner['where_show']);
             if ((in_array($painting, $data) || in_array($type . '_0', $data)) && $banner['active'] && (time() < $banner['active_to'] or $banner['active_to'] == '-1')) {
                 $ban[] = $banner;
             }
         }
         if (count($ban) > 0) {
             $tpl = $this->banner_model->get_settings_tpl() ? $type . '_slider' : 'slider';
             ob_start();
             \CMSFactory\assetManager::create()->registerStyle('style')->registerScript('jquery.cycle.all.min')->setData(array('banners' => $ban))->render($tpl, TRUE);
             $baners_view = ob_get_clean();
             Cache_html::set_html($baners_view, $hash);
             echo $baners_view;
         } else {
             return FALSE;
         }
     }
 }
开发者ID:RandomUsernameHere,项目名称:megainfo-corporate-cms,代码行数:41,代码来源:banners.php

示例4: __construct

 public function __construct()
 {
     if (defined('FCPATH')) {
         //Get CI instance
         $this->ci = CI_Controller::get_instance();
         //Load database configuration from CodeIgniter
         $this->db = $this->ci->db;
         //Database connection information
         $connectionOptions = array('user' => $this->db->username, 'password' => $this->db->password, 'host' => $this->db->hostname, 'dbname' => $this->db->database);
     } elseif (ENVIRONMENT === 'development') {
         include_once str_replace("/", DIRECTORY_SEPARATOR, APPPATH) . 'config' . DIRECTORY_SEPARATOR . 'development' . DIRECTORY_SEPARATOR . 'database.php';
         $connectionOptions = array('user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']);
     }
     $connectionOptions['driver'] = 'pdo_mysql';
     $connectionOptions['charset'] = 'utf8';
     $connectionOptions['driverOptions'] = array(1002 => 'SET NAMES utf8');
     $config = new Configuration();
     //Set up caches
     $cache = new ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     //Set up Annotation
     $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
     $config->setMetadataDriverImpl($driverImpl);
     //Proxy configuration
     $config->setProxyDir(APPPATH . '/models/proxies');
     $config->setProxyNamespace('Proxies');
     $config->setAutoGenerateProxyClasses(TRUE);
     // Create EntityManager
     $this->em = EntityManager::create($connectionOptions, $config);
     //Fix the problem: "unknown database type enum requested"
     $platform = $this->em->getConnection()->getDatabasePlatform();
     $platform->registerDoctrineTypeMapping('enum', 'string');
 }
开发者ID:ricardoandrietta,项目名称:skeleton-ci,代码行数:34,代码来源:Doctrine.php

示例5: __construct

 /**
  *
  */
 function __construct()
 {
     date_default_timezone_set('Asia/Calcutta');
     $ci = CI_Controller::get_instance();
     $ci->load->Model('Email_settings/Mdl_email_settings');
     //load email settings model
     $smtp = $ci->Mdl_email_settings->toArray();
     //get object valeus in array
     $config = array();
     $config['protocol'] = 'smtp';
     $config['mailpath'] = '/usr/sbin/sendmail';
     $config['smtp_host'] = $smtp['smtp_host'];
     $config['smtp_pass'] = $smtp['smtp_pass'];
     // email's password    - set smtp values
     $config['smtp_user'] = $smtp['smtp_user'];
     $config['smtp_port'] = $smtp['smtp_port'];
     //gmail port 465 (ssl) and 587 (TSL) required
     $config['smtp_timeout'] = 300;
     //smtp timeout in seconds
     $config['wordwrap'] = TRUE;
     $config['wrapchars'] = 76;
     $config['mailtype'] = 'html';
     $config['charset'] = 'utf-8';
     $config['validate'] = TRUE;
     $config['priority'] = 3;
     $config['crif'] = "\r\n";
     $config['newline'] = "\r\n";
     $config['bcc_batch_mode'] = TRUE;
     $config['bcc_batch_size'] = 200;
     parent::__construct($config);
 }
开发者ID:Scaledesk,项目名称:eduworkers.co.uk,代码行数:34,代码来源:MY_Email.php

示例6: load

 static function load($model)
 {
     if (!isset(self::$models[$model])) {
         CI_Controller::get_instance()->load->model($model);
         self::$models[$model] = CI_Controller::get_instance()->{$model};
     }
     return self::$models[$model];
 }
开发者ID:TF-Joynic,项目名称:tiandi,代码行数:8,代码来源:ModelFactory.php

示例7: display

 /**
  * 
  * @param string $filePath file name or path to file
  * @param array $data data for template
  * @return html
  */
 public function display($filePath, array $data = array())
 {
     $filePath = strpos($filePath, '.tpl') === FALSE ? $filePath .= '.tpl' : $filePath;
     $fullPath = $this->tComponentPath . '/assets/' . $filePath;
     $fullPath = str_replace(array('/', '//', '\\', '\\\\'), DIRECTORY_SEPARATOR, $fullPath);
     if (count($data) > 0) {
         \CI_Controller::get_instance()->template->add_array($data);
     }
     \CI_Controller::get_instance()->template->display('file:' . $fullPath);
 }
开发者ID:RandomUsernameHere,项目名称:megainfo-corporate-cms,代码行数:16,代码来源:TComponentAssetManager.php

示例8: get_CI

 public static function get_CI()
 {
     if (Yupii::$CI == NULL) {
         $f = CI_Controller::get_instance();
         if ($f == NULL) {
             $f = new CI_Controller();
         }
         Yupii::$CI = $f->get_instance();
     }
     return Yupii::$CI;
 }
开发者ID:cgarciagl,项目名称:Yupii,代码行数:11,代码来源:Yupii.php

示例9: edit_record

 public function edit_record($table, $rules = '')
 {
     $ci = CI_Controller::get_instance();
     $rules = str_replace('%7C', '|', $rules);
     $this->form_validation->set_rules('value', 'given', $rules);
     if ($_SESSION['role'] == 1) {
         if ($this->form_validation->run() == FALSE) {
             $this->output->set_content_type('application/json');
             echo strip_tags(validation_errors());
         } else {
             $pk = $this->input->post('pk');
             $name = $this->input->post('name');
             $value = $this->input->post('value');
             $this->helper_model->edit_global_record($table, $pk, $name, $value);
         }
     } else {
         /*---------------------------------------*
          *In this section we will see if
          * we have to give some permissions to
          * un authorized members or not...
          *-----------------------------------------
          */
         switch ($table) {
             case "cities":
                 if ($this->form_validation->run() == FALSE) {
                     $this->output->set_content_type('application/json');
                     echo strip_tags(validation_errors());
                 } else {
                     $pk = $this->input->post('pk');
                     $name = $this->input->post('name');
                     $value = $this->input->post('value');
                     $this->helper_model->edit_global_record($table, $pk, $name, $value);
                 }
                 break;
             case "products":
                 if ($this->form_validation->run() == FALSE) {
                     $this->output->set_content_type('application/json');
                     echo strip_tags(validation_errors());
                 } else {
                     $pk = $this->input->post('pk');
                     $name = $this->input->post('name');
                     $value = $this->input->post('value');
                     $this->helper_model->edit_global_record($table, $pk, $name, $value);
                 }
                 break;
             default:
                 $this->output->set_content_type('application/json');
                 echo "No Accessibility! Please contact your system administrator";
                 break;
         }
     }
 }
开发者ID:nomantufail,项目名称:virik_updating,代码行数:52,代码来源:helper_controller.php

示例10: __construct

 public function __construct()
 {
     /* assign the application instance */
     self::$APP = CI_Controller::get_instance();
     global $LANG, $CFG;
     /* re-assign language and config for modules */
     if (!is_a($LANG, 'MX_Lang')) {
         $LANG = new MX_Lang();
     }
     if (!is_a($CFG, 'MX_Config')) {
         $CFG = new MX_Config();
     }
 }
开发者ID:darkwebside,项目名称:Sprint,代码行数:13,代码来源:Ci.php

示例11: __construct

 public function __construct()
 {
     /* assign the application instance */
     self::$APP = CI_Controller::get_instance();
     global $LANG, $CFG;
     /* re-assign language and config for modules */
     if (!$LANG instanceof HMVC_Lang) {
         $LANG = new HMVC_Lang();
     }
     if (!$CFG instanceof HMVC_Config) {
         $CFG = new HMVC_Config();
     }
 }
开发者ID:adamos42,项目名称:ionize,代码行数:13,代码来源:Ci.php

示例12: getCodeIgniter

 /**
  * Returns an instance of CodeIgniter.
  *
  * @return \CI_Controller
  */
 public function getCodeIgniter()
 {
     $this->setPathConstants();
     $this->prepareEnvironment();
     $this->defineConstants();
     $this->loadCommonClasses();
     $this->setCharacterSets();
     $this->setConfigurations();
     $this->loadCoreClasses();
     // Loads the get_instance.php for loading libraries
     require 'get_instance.php';
     $ci = \CI_Controller::get_instance();
     return empty($ci) ? new \CI_Controller() : $ci;
 }
开发者ID:rougin,项目名称:spark-plug,代码行数:19,代码来源:SparkPlug.php

示例13: __construct

	public function __construct() {
		
		self::$APP = CI_Controller::get_instance();

		/* assign the core loader */
		self::$APP->load = new MX_Loader;

		/* re-assign language and config for modules */
		if ( ! is_a(self::$APP->lang, 'MX_Lang')) self::$APP->lang = new MX_Lang;
		if ( ! is_a(self::$APP->config, 'MX_Config')) self::$APP->config = new MX_Config;

		/* autoload module items */
		self::$APP->load->_autoloader(array());
	}
开发者ID:reith2004,项目名称:pyrocms,代码行数:14,代码来源:Ci.php

示例14: __construct

 public function __construct()
 {
     /* assign the application instance */
     self::$APP = CI_Controller::get_instance();
     global $LANG, $CFG;
     /* re-assign language and config for modules */
     // Modified by Ivan Tcholakov, 28-SEP-2012.
     //if ( ! is_a($LANG, 'MX_Lang')) $LANG = new MX_Lang;
     //if ( ! is_a($CFG, 'MX_Config')) $CFG = new MX_Config;
     if (@(!is_a($LANG, 'MX_Lang'))) {
         $LANG = new MX_Lang();
     }
     if (@(!is_a($CFG, 'MX_Config'))) {
         $CFG = new MX_Config();
     }
     //
 }
开发者ID:Balamir,项目名称:starter-public-edition-3,代码行数:17,代码来源:Ci.php

示例15: __construct

 public function __construct()
 {
     /* assign the application instance */
     self::$APP = CI_Controller::get_instance();
     global $LANG, $CFG;
     /* re-assign language and config for modules */
     if (!is_a($LANG, 'MX_Lang')) {
         $LANG = new MX_Lang();
     }
     if (!is_a($CFG, 'MX_Config')) {
         $CFG = new MX_Config();
     }
     /* assign the core loader */
     self::$APP->load = new MX_Loader();
     /* autoload module items */
     self::$APP->load->_autoloader(array());
 }
开发者ID:thomasgroch,项目名称:quiz,代码行数:17,代码来源:Ci.php


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