• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_instance函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: view

 /**
  * Replace the default $this->load->view() method
  * with our own, so we can use Smarty!
  *
  * This method works identically to CI's default method,
  * in that you should pass parameters to it in the same way.
  *
  * @access	public
  * @param	string	The template path name.
  * @param	array	An array of data to convert to variables.
  * @param	bool	Set to TRUE to return the loaded template as a string.
  * @return	mixed	If $return is TRUE, returns string. If not, returns void.
  */
 public function view($template, $data = array(), $return = false)
 {
     // Get the CI super object, load related library.
     $CI =& get_instance();
     $CI->load->library('smartytpl');
     // Add extension to the filename if it's not there.
     $ext = '.' . $CI->config->item('smarty_template_ext');
     if (substr($template, -strlen($ext)) !== $ext) {
         $template .= $ext;
     }
     // Make sure the file exists first.
     if (!$CI->smartytpl->templateExists($template)) {
         show_error('Unable to load the template file: ' . $template);
     }
     // Assign any variables from the $data array.
     $CI->smartytpl->assign_variables($data);
     // Assign CI instance to be available in templates as $ci
     $CI->smartytpl->assignByRef('ci', $CI);
     /*
     	Smarty has two built-in functions to rendering templates: display() 
     	and fetch(). We're going to	use only fetch(), since we want to take
     	the template contents and either return them or add them to
     	CodeIgniter's output class. This lets us optionally take advantage
     	of some of CI's built-in output features.
     */
     $output = $CI->smartytpl->fetch($template);
     // Return the output if the return value is TRUE.
     if ($return === true) {
         return $output;
     }
     // Otherwise append to output just like a view.
     $CI->output->append_output($output);
 }
开发者ID:neovoxel,项目名称:cuisine-resort,代码行数:46,代码来源:MY_Loader.php


示例2: __construct

 function __construct()
 {
     parent::__construct();
     $this->_table = 'reff_jamkesmas';
     //get instance
     $this->CI = get_instance();
 }
开发者ID:lahirwisada,项目名称:sideka,代码行数:7,代码来源:m_jamkesmas.php


示例3: not_loggedin

 public function not_loggedin()
 {
     $CI =& get_instance();
     if (!$CI->session->is_loggedin) {
         redirect('/index');
     }
 }
开发者ID:jhernani,项目名称:chu,代码行数:7,代码来源:E_security.php


示例4: __construct

 public function __construct()
 {
     //error_reporting(E_ALL);
     log_message('debug', "Weixinapi Class Initialized.");
     $this->CI =& get_instance();
     $this->valid();
 }
开发者ID:haohailuo,项目名称:Codeigniter-Wechat,代码行数:7,代码来源:Weixinapi.php


示例5: __construct

	function __construct()
    {
        
		$this->CI =& get_instance();

		$this->CI->load->model('orders/morders');
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:7,代码来源:Neworders_widget.php


示例6: set_sections

	function set_sections()
	{
		$EE =& get_instance();
		
		// cheers to @leevigraham for this one.
		$this->sections[] = '<script type="text/javascript" charset="utf-8">$("#accessoryTabs a.catshit").parent().remove();</script>';
		
		// RAGE.
		$EE->cp->add_to_head('
		<script type="text/javascript">
		
			$(document).ready(function(){
				$(".ui-widget input#cat_image").live("click", function() {
					$.ee_filebrowser.add_trigger("input#cat_image", function (a) {
							
	
							var full_url = EE.upload_directories[a.directory].url + a.name;
							relative_url = full_url.replace(/http:\/\/[^\/]+/i,""); 
							
							$("input#cat_image" + window.file_manager_context).val(relative_url)
					});
				});
			});
		
		</script>
		
		');

	}
开发者ID:rmdort,项目名称:adiee,代码行数:29,代码来源:acc.catshit.php


示例7: Simple_commerce_mcp

 /**
  * Constructor
  *
  * @access	public
  */
 function Simple_commerce_mcp($switch = TRUE)
 {
     // Make a local reference to the ExpressionEngine super object
     $this->EE =& get_instance();
     $this->base_url = BASE . AMP . 'C=addons_modules' . AMP . 'M=show_module_cp' . AMP . 'module=simple_commerce';
     ee()->cp->set_right_nav(array('items' => $this->base_url . AMP . 'method=edit_items', 'purchases' => $this->base_url . AMP . 'method=edit_purchases', 'email_templates' => $this->base_url . AMP . 'method=edit_emails', 'simple_commerce_module_name' => $this->base_url));
 }
开发者ID:nigelpeters,项目名称:css-recruitment-ee,代码行数:12,代码来源:mcp.simple_commerce.php


示例8: output

 /**
  * Responsible for sending final output to browser
  */
 function output()
 {
     $CI =& get_instance();
     $buffer = $CI->output->get_output();
     $re = '%            # Collapse ws everywhere but in blacklisted elements.
         (?>             # Match all whitespans other than single space.
           [^\\S ]\\s*     # Either one [\\t\\r\\n\\f\\v] and zero or more ws,
         | \\s{2,}        # or two or more consecutive-any-whitespace.
         ) # Note: The remaining regex consumes no text at all...
         (?=             # Ensure we are not in a blacklist tag.
           (?:           # Begin (unnecessary) group.
             (?:         # Zero or more of...
               [^<]++    # Either one or more non-"<"
             | <         # or a < starting a non-blacklist tag.
               (?!/?(?:textarea|pre)\\b)
             )*+         # (This could be "unroll-the-loop"ified.)
           )             # End (unnecessary) group.
           (?:           # Begin alternation group.
             <           # Either a blacklist start tag.
             (?>textarea|pre)\\b
           | \\z          # or end of file.
           )             # End alternation group.
         )  # If we made it here, we are not in a blacklist tag.
         %ix';
     $buffer = preg_replace($re, " ", $buffer);
     $CI->output->set_output($buffer);
     $CI->output->_display();
 }
开发者ID:ppwalks33,项目名称:cleansure,代码行数:31,代码来源:Minifyhtml.php


示例9: lang

/**
* lang()
* Translates an index located on array $lang inside of file application/language/LANGUAGE/app_lang.php
* If the key does not have a translation then this function returns the key.
* @param string key
* @param string $lang['key']
*/
function lang($key = '')
{
    $CI =& get_instance();
    $line = $CI->lang->line($key);
    $line = $line == '' ? $key : $line;
    return $line;
}
开发者ID:creativify,项目名称:acmeframework,代码行数:14,代码来源:language_helper.php


示例10: __construct

 public function __construct()
 {
     $this->CI =& get_instance();
     $this->use = new class_loader();
     $this->use->use_model('data_base');
     $this->use->use_lib('system/date_time/date_time');
 }
开发者ID:medosalahat,项目名称:field_training_management,代码行数:7,代码来源:specialty_lib_ad.php


示例11: __construct

 /**
  * Message Stack Constructor
  *
  * @access public
  * @return void
  */
 public function __construct()
 {
     // Set the super object to a local variable for use later
     $this->ci =& get_instance();
     // Load message from session
     $this->load_from_session();
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:13,代码来源:message_stack.php


示例12: __construct

 function __construct()
 {
     $CI =& get_instance();
     $CI->load->helper('maths');
     $CI->load->helper('language');
     return;
 }
开发者ID:zsebtanar,项目名称:zsebtanar_v4,代码行数:7,代码来源:Reszhalmazok.php


示例13: form_open

 function form_open($action = '', $attributes = array(), $hidden = array())
 {
     $CI =& get_instance();
     // If no action is provided then set to the current url
     if (!$action) {
         $action = current_url($action);
     } elseif (strpos($action, '://') === FALSE) {
         $action = if_secure_site_url($action);
     }
     $attributes = _attributes_to_string($attributes);
     if (stripos($attributes, 'method=') === FALSE) {
         $attributes .= ' method="post"';
     }
     if (stripos($attributes, 'accept-charset=') === FALSE) {
         $attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"';
     }
     $form = '<form action="' . $action . '"' . $attributes . ">\n";
     // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
     if ($CI->config->item('csrf_protection') === TRUE && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
     }
     // Add MY CSRF token if MY CSRF library is loaded
     if ($CI->load->is_loaded('tokens') && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->tokens->name] = $CI->tokens->token();
     }
     if (is_array($hidden)) {
         foreach ($hidden as $name => $value) {
             $form .= '<input type="hidden" name="' . $name . '" value="' . html_escape($value) . '" style="display:none;" />' . "\n";
         }
     }
     return $form;
 }
开发者ID:railsgem,项目名称:htdocs,代码行数:32,代码来源:MY_form_helper.php


示例14: _report_error

 function _report_error($subject)
 {
     $CI =& get_instance();
     $CI->load->library('Rabbitmq');
     $CI->load->helper('email_sender');
     $body = '';
     $body .= 'Request: <br/><br/><code>';
     foreach ($_REQUEST as $k => $v) {
         $body .= $k . ' => ' . $v . '<br/>';
     }
     $body .= '</code>';
     $body .= '<br/><br/>Server: <br/><br/><code>';
     foreach ($_SERVER as $k => $v) {
         $body .= $k . ' => ' . $v . '<br/>';
     }
     $body .= '</code>';
     $body .= '<br/><br/>Stacktrace: <br/><br/>';
     $body .= serialize($subject);
     $data = array();
     $data['to'] = "[email protected]";
     $data['to_name'] = "shakaib";
     $data['from'] = ADMIN_EMAIL;
     $data['from_name'] = ADMIN_NAME;
     $data['from_pass'] = ADMIN_EMAIL_PASSWORD;
     $data['subject'] = "Exception";
     $data['body'] = $body;
     mail_me($data);
 }
开发者ID:khadim-raath,项目名称:insatiablehair,代码行数:28,代码来源:MY_Exceptions.php


示例15: __construct

 /**
  * class constructor
  *
  * @access	public
  */
 public function __construct()
 {
     // load up instance
     $this->instance = get_instance();
     // load up session library
     $this->instance->load->library('session');
 }
开发者ID:hymns,项目名称:phphyppo,代码行数:12,代码来源:authentication.php


示例16: __construct

 /**
  * Constructor
  *
  * Accepts an associative array as input, containing preferences
  *
  * @access	public
  * @param	array	config preferences
  * @return	void
  */
 public function __construct()
 {
     $this->CI =& get_instance();
     if (isset($this->CI->dpi)) {
         $this->dpi =& $this->CI->dpi;
     }
 }
开发者ID:kebattai,项目名称:vDownload,代码行数:16,代码来源:Dpi_base_library.php


示例17: __construct

 /**
  * Initialize file-based cache
  *
  * @return    void
  */
 public function __construct()
 {
     $CI =& get_instance();
     $CI->load->helper('file');
     $path = $CI->config->item('cache_path');
     $this->_cache_path = $path === '' ? APPPATH . 'cache/' : $path;
 }
开发者ID:at15,项目名称:codeignitordb,代码行数:12,代码来源:Cache_file.php


示例18: __construct

 /**
  * Class constructor
  *
  * Setup Redis
  *
  * Loads Redis config file if present. Will halt execution
  * if a Redis connection can't be established.
  *
  * @return	void
  * @see		Redis::connect()
  */
 public function __construct()
 {
     $config = array();
     $CI =& get_instance();
     if ($CI->config->load('redis', TRUE, TRUE)) {
         $config = $CI->config->item('redis');
     }
     $config = array_merge(self::$_default_config, $config);
     $this->_redis = new Redis();
     try {
         if ($config['socket_type'] === 'unix') {
             $success = $this->_redis->connect($config['socket']);
         } else {
             $success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']);
         }
         if (!$success) {
             log_message('error', 'Cache: Redis connection failed. Check your configuration.');
         }
         if (isset($config['password']) && !$this->_redis->auth($config['password'])) {
             log_message('error', 'Cache: Redis authentication failed.');
         }
     } catch (RedisException $e) {
         log_message('error', 'Cache: Redis connection refused (' . $e->getMessage() . ')');
     }
     // Initialize the index of serialized values.
     $serialized = $this->_redis->sMembers('_ci_redis_serialized');
     empty($serialized) or $this->_serialized = array_flip($serialized);
 }
开发者ID:dhamodhar,项目名称:mysmartportal,代码行数:39,代码来源:Cache_redis.php


示例19: Auth

 function Auth()
 {
     $this->table = 'your_table';
     //The fields below should be columns in the table above, which are used to
     //authenticate the user's credentials.
     $this->userNameField = 'username';
     $this->passField = 'password';
     //The numeric column which stores the permissions/level of each user:
     $this->lvlField = 'lvl';
     //The following are general columns in the database which are
     //stored in the Session, for easily displaying some information
     //about the user:
     $this->miscFields = 'id,first,email,lvl,verified,credits';
     /* If there is a no lastLoggedIn field in the table which is updated
         to the current DATETIME whenever the user logs in, set the next
        variable to blank to disable this feature. */
     $this->lastLoggedInField = 'last_login';
     $this->homePageUrl = site_url();
     $this->loginPageUrl = site_url('accounts/login');
     $this->membersAreaUrl = site_url();
     //This is a CodeIgniter specific variable used to refer to the base
     //CodeIgniter Object:
     $this->obj =& get_instance();
     //This is my custom database library:
     $this->db = $this->obj->db;
     //All data passed on from a form to this class must be
     // already escaped to prevent SQL injection.
     //However, all data stored in sessions is escaped by the class.
     if ($this->isLoggedIn()) {
         $this->refreshInfo();
     }
 }
开发者ID:ngukho,项目名称:mvc-cms,代码行数:32,代码来源:Auth.class.php


示例20: __construct

 function __construct()
 {
     //When the class is constructed get an instance of codeigniter so we can access it locally
     $this->_ci =& get_instance();
     //Include the piso_model so we can use it
     $this->_ci->load->model("Piso_Model");
 }
开发者ID:Hendrixcosta,项目名称:Livrando,代码行数:7,代码来源:PisoFactory_old.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_instance_of函数代码示例发布时间:2022-05-15
下一篇:
PHP get_installed_translations函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap