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


PHP Connect::get_instance方法代码示例

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


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

示例1: delete_common

 public function delete_common($table, $filters, $query_extra)
 {
     //criando o objeto pdo...
     $pdo = parent::get_instance();
     //filtros
     foreach ($filters as $key => $value) {
         $filters_delete = "{$key}=:{$key} AND ";
     }
     //removendo ultimo "AND";
     $filters_delete = substr($filters_delete, 0, -4);
     //preparando query apartir dos campos($fields) e os parametros de valores nomeados($values)
     $query = "DELETE FROM {$table} WHERE {$filters_delete};";
     //se a consulta precisar de algo mais..
     if ($query_extra != "") {
         $query .= $query_extra;
     }
     //echo $query,'<br>';
     //continuação da preparação da query...
     $statement = $pdo->prepare($query);
     if (!$statement) {
         echo "\\PDO::errorInfo():\n";
         print_r($dbh->errorInfo());
     }
     //substituindo os parametros dos filtros nomeados pelos verdadeiros valores, ex: ":name" por "Alessandro"
     foreach ($filters as $key => $value) {
         //$parameters[":$key"] = $value;
         $statement->bindValue(":{$key}", $value, PDO::PARAM_STR);
     }
     //$statement->debugDumpParams();
     //executando a query já com seus valores
     if ($statement->execute()) {
         //se der certo retorna true...
         return true;
     } else {
         //se não der certo, retornará false...
         return false;
     }
 }
开发者ID:PHPcomRapadura,项目名称:PDO,代码行数:38,代码来源:Manager.class.php

示例2: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->helper('module_helper');
     // Redirect the not authorized user to the login panel. See /application/config/connect.php
     Connect()->restrict_type_redirect = array('uri' => config_item('admin_url') . '/user/login', 'flash_msg' => 'You have been denied access to %s', 'flash_use_lang' => false, 'flash_var' => 'error');
     //	$this->output->enable_profiler(true);
     // PHP standard session is mandatory for FileManager authentication
     // and other external lib
     //		session_start();
     // Librairies
     $this->connect = Connect::get_instance();
     // Current user
     $this->template['current_user'] = $this->connect->get_current_user();
     // Set the admin theme as current theme
     Theme::set_theme('admin');
     /*
      * Admin languages : Depending on installed translations in /application/languages/
      * The Admin translations are only stored in the translation file /application/languages/xx/admin_lang.php
      *
      */
     // Set admin lang codes array
     Settings::set('admin_languages', $this->settings_model->get_admin_langs());
     Settings::set('displayed_admin_languages', explode(',', Settings::get('displayed_admin_languages')));
     // Set Router's found language code as current language
     Settings::set('current_lang', config_item('language_abbr'));
     // Load the current language translations file
     $this->lang->load('admin', Settings::get_lang());
     /*
      * Modules config
      *
      */
     $this->get_modules_config();
     // Including all modules languages files
     require APPPATH . 'config/modules.php';
     $this->modules = $modules;
     foreach ($this->modules as $module) {
         $lang_file = MODPATH . $module . '/language/' . Settings::get_lang() . '/' . strtolower($module) . '_lang.php';
         if (is_file($lang_file)) {
             include $lang_file;
             $this->lang->language = array_merge($this->lang->language, $lang);
             unset($lang);
         }
     }
     /*
      * Loads all Module's addons
      *
      */
     $this->_get_modules_addons();
     // Load all modules lang files
     /*
     Look how to make Modules translations available in javascript 
     Notice : $yhis->lang object is transmitted to JS through load->view('javascript_lang')
      
     		if ( ! empty($lang_files))
     		{
     			foreach($lang_files as $l)
     			{
     				if (is_file($l))
     				{
     //					$logical_name = substr($l, strripos($l, '/') +1);
     //					$logical_name = str_replace('_lang.php', '', $logical_name);
     //					$this->lang->load($logical_name, Settings::get_lang());
     
     					include $l;
     					$this->lang->language = array_merge($this->lang->language, $lang);
     					unset($lang);
     
     				}
     			}
     		}
     */
     /*
      * Settings
      *
      */
     // @TODO : Remove this thing from the global CMS. Not more mandatory, but necessary for compatibility with historical version
     // Available menus
     // Each menu was a root node in which you can put several pages, wich are composing a menu.
     // Was never really implemented in ionize historical version, but already used as : menus[0]...
     Settings::set('menus', config_item('menus'));
     // Don't want to cache this content
     $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
     $this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
     $this->output->set_header("Pragma: no-cache");
 }
开发者ID:BGCX261,项目名称:zillatek-project-svn-to-git,代码行数:90,代码来源:MY_Controller.php

示例3: init_connect

/**
 * Initialize Connect and run the folder protection.
 *
 * @return void
 */
function init_connect()
{
    // get the connect object and the router object
    $connect = Connect::get_instance();
    $router =& load_class('Router');
    $dir = trim($router->directory, ' /\\');
    if (isset($dir)) {
        // We have a subdir
        if (isset($connect->folder_protection[$dir])) {
            // send restriction settings to Connect::restrict()
            $connect->restrict($connect->folder_protection[$dir]);
        }
    }
}
开发者ID:BGCX261,项目名称:zillatek-project-svn-to-git,代码行数:19,代码来源:Connect.php


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