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


PHP Registry::factory方法代码示例

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


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

示例1: __construct

 /**
  * Loads URI and Input objects into the controller.
  * Check if the requested environment the system does supports.
  */
 function __construct($instance)
 {
     $this->db = Registry::factory('Database_Query_Builder');
     $this->_data_types = $this->_getDataTypes();
     $this->eav_instance = $this->_checkInstance($instance);
     $this->_aData = Model_Registry::instance(true);
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:11,代码来源:abstract.php

示例2: load

 /**
  * Loader.
  * @param string $model
  * @param null $params
  * @return bool|object
  */
 public function load($model, $params = null)
 {
     // Does the model exist? If so, we're done...
     if (isset($this->_models[$model])) {
         return $this->_models[$model];
     }
     // Load model class
     $this->_models[$model] = Registry::factory($model, $params);
     // Get object
     return $this->get($model);
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:17,代码来源:model.php

示例3: exec

 /**
  * Executes a query.
  * @param bool $print_last
  * @return mixed
  */
 public function exec($print_last = false)
 {
     if ($print_last) {
         $this->_printSql();
     }
     // Execute an SQL
     $result = $this->db->exec($this->_query());
     if (!$result) {
         return Registry::factory('Database_Mapper_Result_Dummy');
     }
     // Clear last SQL
     //$this->_clear();
     return $result;
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:19,代码来源:abstract.php

示例4: email

 /**
  * Dashboard page
  * @return void
  */
 public function email()
 {
     $this->disableViews();
     $mail = Registry::factory('Mail_Php');
     $mail->to('sharapov.web@gmail.com', 'Александр');
     $mail->from('noreply@exidoengine.com', 'Exidoengine');
     $mail->reply('admin@exidoengine.com', 'Admin');
     $mail->subject('Тема');
     $mail->body('Текст письма');
     if ($mail->send()) {
         print '1';
     } else {
         print '0';
     }
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:19,代码来源:dashboard.php

示例5: __construct

 /**
  * Loads URI and Input objects into the controller.
  * Check if the requested environment supports by the system.
  * @throws Exception_Exido
  */
 public function __construct()
 {
     // Check environment
     if (!in_array(EXIDO_ENVIRONMENT_NAME, $this->_envs)) {
         throw new Exception_Exido('The requested environment %s does not supported by the system', array(EXIDO_ENVIRONMENT_NAME));
     }
     // URI should always be available
     $this->uri = Uri::instance();
     // Input should always be available
     $this->input = Input::instance();
     // Init a model loader object
     $this->_model = Registry::factory('Model');
     // Input should always be available
     $this->view = View::instance();
     // Session object
     $this->session = Registry::factory('Session');
     // Init layout view object
     $this->_viewLayout = Registry::factory('View_Layout');
     // Init action view object
     $this->_viewAction = Registry::factory('View_Action');
     // Get active components
     $this->_components = $this->model('Model_Component')->getActiveComponents();
     // Get session data
     $_user_key = $this->_getCurrentUser();
     // If current user is unknown so we should start guest session
     if (empty($_user_key)) {
         // Guest session id
         $_user_key = '5627a272bf2563cee5877539bd906e7cc3eb33afcefe2b570a08906f9a34ae48';
     }
     if ($r = $this->model('Model_User')->getUserByUniqueKey($_user_key)) {
         $this->_system_user = array('user_id' => $r->getUser_id(), 'user_name' => $r->getUser_name(), 'password' => $r->getPassword(), 'user_email' => $r->getUser_email(), 'owner_id' => $r->getOwner_id(), 'owner_name' => $r->getOwner_name(), 'group_id' => $r->getGroup_id(), 'group_name' => $r->getGroup_name(), 'role_name' => $r->getRole_key(), 'permissions' => array('owner' => $r->getPermissions_owner(), 'group' => $r->getPermissions_group(), 'other' => $r->getPermissions_other()), 'is_enabled' => $r->getIs_enabled(), 'is_dropped' => $r->getIs_dropped(), 'is_system' => $r->getIs_system());
         // User constants
         define('@SU.GROUP_ID', $r->getGroup_id());
         define('@SU.GROUP_NAME', $r->getGroup_name());
         define('@SU.USER_ID', $r->getUser_id());
         define('@SU.USER_NAME', $r->getUser_name());
         $this->_system_user_access = $this->model('Model_User')->getUserAccess($r->getUser_id(), EXIDO_ENVIRONMENT_NAME);
         $this->session->set('system_user', $_user_key);
     }
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:45,代码来源:abstract.php

示例6: __construct

 /**
  * Prevents inheritance of the method.
  */
 public final function __construct()
 {
     $this->input = Input::instance();
     $this->_model = Registry::factory('Model');
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:8,代码来源:cron.php

示例7: get

 /**
  * Generates a pagination selector.
  * @return string
  */
 public function get()
 {
     if (empty($this->total_rows) or empty($this->per_page)) {
         return '';
     }
     // Count pages
     $num_pages = $this->_countPages();
     // Return empty if we have one page.
     if ($num_pages == 1) {
         return '';
     }
     // Get the current page number
     if (!is_numeric($this->cur_page) or $this->cur_page < 1) {
         $this->cur_page = 1;
     }
     if (!is_numeric($this->num_links)) {
         $this->num_links = 2;
     }
     if ($this->num_links < 1) {
         return '';
     }
     // If the current page number is bigger than total count of a pages
     // so we will need to show the last page
     if ($this->cur_page > $num_pages) {
         $this->cur_page = $num_pages;
     }
     $view = View::instance();
     // Get start and end page numbers
     $view->start = $this->cur_page - $this->num_links > 0 ? $this->cur_page - ($this->num_links - 1) : 1;
     $view->end = $this->cur_page + $this->num_links < $num_pages ? $this->cur_page + $this->num_links : $num_pages;
     $view->cur_page = $this->cur_page;
     $view->base_url = $this->base_url;
     $view->url_attach = $this->base_url_attach;
     // Define variables...
     $view->first_page = $view->prev_page = $view->next_page = $view->last_page = '';
     // Generate link to a first page
     if ($this->cur_page > $this->num_links + 1) {
         $view->first_page = $this->base_url . '1' . $this->base_url_attach;
     }
     // Generate link to a previous page
     if ($this->cur_page != 1) {
         $i = $this->cur_page - 1;
         if ($i <= 0) {
             $i = '1';
         }
         $view->prev_page = $this->base_url . $i . $this->base_url_attach;
     }
     // Generate link to a next page
     if ($this->cur_page < $num_pages) {
         $view->next_page = $this->base_url . ($this->cur_page + 1) . $this->base_url_attach;
     }
     // Generate link to a last page
     if ($this->cur_page + $this->num_links < $num_pages) {
         $view->last_page = $this->base_url . $num_pages . $this->base_url_attach;
     }
     // Load a pagination view
     return Registry::factory('View_Custom')->load('pagination')->parse('pagination', $view, new View_Helper());
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:62,代码来源:pagination.php

示例8: __construct

 /**
  * Constructor.
  * @throws Exception_Exido
  */
 public function __construct()
 {
     $this->input = Input::instance();
     // Set the "now" time. can either be gmt or server time, based on the
     // config prefs.  we use this to set the "last activity" time
     $this->now = $this->_getTime();
     $config = Exido::config('session');
     // Set all the session preferences via the config file
     foreach (array('cookie_name', 'life_time', 'use_database', 'use_phpsession', 'db_table_name', 'db_files_path', 'cookie_path', 'cookie_domain', 'time_reference') as $key) {
         $this->{$key} = $config[$key];
     }
     // We dont make anything else if we use the PHP sessions
     if ($this->use_phpsession) {
         @session_start();
         return;
     }
     if (empty($this->cookie_domain)) {
         $this->cookie_domain = HOST;
     }
     if (empty($this->db_table_name)) {
         $this->db_table_name = 'session';
     }
     if (empty($this->db_files_path)) {
         $this->db_files_path = APPPATH . 'data/cache';
     }
     $this->db_files_path = rtrim($this->db_files_path, '/') . '/' . $this->sess_dir_name . '/';
     // Try to create session directory
     if (!is_dir($this->db_files_path)) {
         if (!@mkdir($this->db_files_path, DIR_WRITE_MODE, true)) {
             throw new Exception_Exido("Couldn't create session directory");
         }
     }
     // Load a database instance
     if ($this->use_database) {
         $this->use_database = Registry::factory('Session_Db');
         $this->use_database->setDbTableName($this->db_table_name);
     }
     // Run the session routine. If a session doesn't exist we'll
     // create a new one. If it does, we'll update it.
     if (!$this->_read()) {
         $this->_create();
     } else {
         $this->_update();
     }
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:49,代码来源:base.php

示例9: __get

 /**
  * Handles view variables that do not exist.
  * @param string $var
  * @return bool|object|void
  */
 public function __get($var)
 {
     print sprintf(__('[Undefined property $view->%s]'), $var);
     return Registry::factory('View_Dummy');
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:10,代码来源:view.php

示例10: captcha

 /**
  * Checks if the entered captcha string consists with the session captcha string.
  * @param string $str
  * @return bool
  */
 public function captcha($str)
 {
     // Get secret word from session
     $s = Registry::factory('Session');
     $str2 = $s->get('captcha');
     if (empty($str) or empty($str2)) {
         return false;
     }
     return $str == $str2 ? true : false;
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:15,代码来源:form.php

示例11: handlerException

 /**
  * Inline exception handler, displays the error message, source of the
  * exception, and the stack trace of the error.
  * @param object $e
  * return void
  */
 public static function handlerException($e)
 {
     try {
         // Get the exception information
         $type = get_class($e);
         $code = $e->getCode();
         $message = $e->getMessage();
         $file = $e->getFile();
         $line = $e->getLine();
         if (!in_array($code, self::$codes)) {
             $code = 500;
         }
         // Get the exception backtrace
         $trace = $e->getTrace();
         // Run logger
         self::log($e);
         // If Exido running in a command line environment
         // or using an XML request.
         // We just print a json encoded string.
         if (Exido::$is_cli or Exido::$is_xml) {
             // Just display the text of the exception
             exit(json_encode(array('status' => false, 'code' => $code, 'text' => $message)));
         }
         if (!headers_sent()) {
             // Make sure the proper http header is sent
             header('Content-Type: text/html; charset=' . __('__charset'), true, $code);
         }
         // If we're in production so we should return the correct error page.
         if (IN_PRODUCTION == true) {
             if ($e instanceof Exception_Database) {
                 exit($message);
             } else {
                 $view = View::instance();
                 $view->code = $code;
                 $view->message = $message;
                 $view->file = Debug::path($file);
                 $view->line = $line;
                 $html = Registry::factory('View_Exception')->setLayout('exception/template', 'error' . $code)->load()->parse($view, new View_Helper());
                 // Display the contents and exit
                 exit($html);
             }
         } else {
             if ($e instanceof Exception_Database) {
                 $message = $e->errstr . ' [ ' . $e->errquery . ' ]';
             }
             // Return the page with more information about error in the development mode.
             include_once Exido::findFile('exception/template', 'development');
             exit(1);
         }
     } catch (Exception $e) {
         // Clean the output buffer if one exists
         ob_get_level() and ob_clean();
         // Display the exception text
         echo self::text($e), EXIDO_EOL;
         // Run logger
         Exido::$log->write();
         // Exit with an error status
         exit(1);
     }
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:66,代码来源:exido.php

示例12: getUserByUniqueKey

 /**
  * Get user. Return FALSE if the user is not found.
  * @param string $key
  * @return mixed
  */
 public function getUserByUniqueKey($key)
 {
     if ($r = $this->db->select('user', '*')->where(array('unique_session_id' => $key))->limit(1)->exec()->row()) {
         return $this->_user = Registry::factory('Model_Auth_User', $r);
     }
     return false;
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:12,代码来源:user.php

示例13: __construct

 /**
  * Loads URI and Input objects into the controller.
  * Check if the requested environment supports by the system.
  */
 function __construct()
 {
     $this->_aData = Model_Registry::instance(true);
     $this->db = Registry::factory('Database_Query_Builder', null, true, true);
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:9,代码来源:abstract.php

示例14: _emailPassword

 /**
  * Send password to email
  * @param string $to
  * @param string $username
  * @param string $password
  * @return void
  * @throws Exception_Exido
  */
 private function _emailPassword($to, $username, $password)
 {
     $this->view->password = $password;
     $this->view->username = $username;
     $email = Registry::factory('Mail_Php');
     $email->to($to);
     $email->from(Exido::config('global.mail.name'), Exido::config('global.mail.from'));
     $email->subject(__('Your credentials'));
     $email->body($this->view->getView('mail/notification/password', true));
     return $email->send();
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:19,代码来源:action.php

示例15: cookie

 /**
  * Gets the value of given key.
  * @param string $key
  * @param bool $xss_clean_enabled
  * @return array|string
  */
 public function cookie($key = '', $xss_clean_enabled = true)
 {
     if (!isset($_COOKIE) or empty($_COOKIE)) {
         return false;
     }
     if (empty($key)) {
         return $xss_clean_enabled ? Registry::factory('security')->cleanXSS($_COOKIE) : $_COOKIE;
     }
     if (!isset($_COOKIE[$key])) {
         return false;
     }
     // Sanitize variable
     return $xss_clean_enabled ? Registry::factory('security')->cleanXSS($_COOKIE[$key]) : $_COOKIE[$key];
 }
开发者ID:esironal,项目名称:exidoengine,代码行数:20,代码来源:input.php


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