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


PHP Solar::dependency方法代码示例

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


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

示例1: open

 /**
  * 
  * Open session handler.
  * 
  * @return bool
  * 
  */
 public function open()
 {
     if (!$this->_sql) {
         $this->_sql = Solar::dependency('Solar_Sql', $this->_config['sql']);
     }
     return true;
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:14,代码来源:Sql.php

示例2: _postConstruct

 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // inflection dependency
     $this->_inflect = Solar::dependency('Solar_Inflect', 'inflect');
     // model stack
     $this->_setStack($this->_config['classes']);
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:15,代码来源:Catalog.php

示例3: _postConstruct

 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // only set up the handler if it doesn't exist yet.
     if (!self::$_handler) {
         self::$_handler = Solar::dependency('Solar_Session_Handler', $this->_config['handler']);
     }
     $this->_request = Solar_Registry::get('request');
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:16,代码来源:Native.php

示例4: _postConstruct

 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_response = Solar::dependency('Solar_Http_Response', $this->_config['response']);
     $this->_json = Solar::factory('Solar_Json');
     // Setup headers based on the wildfire standard
     $this->_response->setHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
     $this->_response->setHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3');
     $this->_response->setHeader('X-Wf-1-Structure-1', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:17,代码来源:Firephp.php

示例5: _postConstruct

 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_response = Solar::dependency('Solar_Http_Response', $this->_config['response']);
     $this->_json = Solar::factory('Solar_Json');
     $this->_response->setHeader('X-FirePHP-Data-100000000001', '{');
     $this->_response->setHeader('X-FirePHP-Data-300000000001', '"FirePHP.Firebug.Console":[');
     $this->_response->setHeader('X-FirePHP-Data-399999999999', '["__SKIP__"]],');
     $this->_response->setHeader('X-FirePHP-Data-200000000001', '"FirePHP.Dump":{');
     $this->_response->setHeader('X-FirePHP-Data-299999999999', '"__SKIP__":"__SKIP__"},');
     $this->_response->setHeader('X-FirePHP-Data-999999999999', '"__SKIP__":"__SKIP__"}');
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:19,代码来源:Firephp.php

示例6: fetch

 /**
  * 
  * Fetches the roles for a user.
  * 
  * @param string $handle User handle to get roles for.
  * 
  * @return array An array of roles discovered in the table.
  * 
  */
 public function fetch($handle)
 {
     // get the dependency object of class Solar_Sql
     $sql = Solar::dependency('Solar_Sql', $this->_config['sql']);
     // get a selection tool using the dependency object
     $select = Solar::factory('Solar_Sql_Select', array('sql' => $sql));
     // build the select
     $select->from($this->_config['table'], $this->_config['role_col'])->where("{$this->_config['handle_col']} = ?", $handle)->multiWhere($this->_config['where']);
     // get the results (a column of rows)
     $result = $select->fetch('col');
     // done!
     return $result;
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:22,代码来源:Sql.php

示例7: _processLogin

 /**
  * 
  * Verifies a username handle and password.
  * 
  * @return mixed An array of verified user information, or boolean false
  * if verification failed.
  * 
  * 
  */
 protected function _processLogin()
 {
     // get the dependency object of class Solar_Sql
     $obj = Solar::dependency('Solar_Sql', $this->_config['sql']);
     // get a selection tool using the dependency object
     $select = Solar::factory('Solar_Sql_Select', array('sql' => $obj));
     // list of optional columns as (property => field)
     $optional = array('email' => 'email_col', 'moniker' => 'moniker_col', 'uri' => 'uri_col', 'uid' => 'uid_col');
     // always get the user handle
     $cols = array($this->_config['handle_col']);
     // get optional columns
     foreach ($optional as $key => $val) {
         if ($this->_config[$val]) {
             $cols[] = $this->_config[$val];
         }
     }
     // salt and hash the password
     $hash = hash($this->_config['hash_algo'], $this->_config['salt'] . $this->_passwd);
     // make sure the handle col is dotted so it gets quoted properly
     $handle_col = $this->_config['handle_col'];
     if (strpos($handle_col, '.') === false) {
         $handle_col = "{$this->_config['table']}.{$handle_col}";
     }
     // make sure the passwd col is dotted so it gets quoted properly
     $passwd_col = $this->_config['passwd_col'];
     if (strpos($passwd_col, '.') === false) {
         $passwd_col = "{$this->_config['table']}.{$passwd_col}";
     }
     // build the select, fetch up to 2 rows (just in case there's actually
     // more than one, we don't want to select *all* of them).
     $select->from($this->_config['table'], $cols)->where("{$handle_col} = ?", $this->_handle)->where("{$passwd_col} = ?", $hash)->multiWhere($this->_config['where'])->limit(2);
     // get the results
     $rows = $select->fetchAll();
     // if we get back exactly 1 row, the user is authenticated;
     // otherwise, it's more or less than exactly 1 row.
     if (count($rows) == 1) {
         // set base info
         $info = array('handle' => $this->_handle);
         // set optional info from optional cols
         $row = current($rows);
         foreach ($optional as $key => $val) {
             if ($this->_config[$val]) {
                 $info[$key] = $row[$this->_config[$val]];
             }
         }
         // done
         return $info;
     } else {
         return false;
     }
 }
开发者ID:agentile,项目名称:foresmo,代码行数:60,代码来源:Sql.php

示例8: setup

 public function setup()
 {
     $this->_model = Solar::dependency('Solar_Sql_Model_Catalog', 'model_catalog');
     $sql = Solar::dependency('Solar_Sql', 'sql');
     $sql->begin();
     $this->_setupUsers();
     $this->_setupPrefs();
     $this->_setupAreas();
     $this->_setupNodes();
     $this->_setupMetas();
     $this->_setupTags();
     $this->_setupTaggings();
     $this->_setupComments();
     $sql->commit();
 }
开发者ID:agentile,项目名称:foresmo,代码行数:15,代码来源:Model.php

示例9: _send

 /**
  * 
  * Sends the Solar_Mail_Message through an SMTP server connection; 
  * lazy-loads the SMTP dependency if needed.
  * 
  * @return bool True on success, false on failure.
  * 
  */
 protected function _send()
 {
     // lazy-load the SMTP dependency if it's not already present
     if (!$this->_smtp) {
         $this->_smtp = Solar::dependency('Solar_Smtp', $this->_config['smtp']);
     }
     // get the headers for the message
     $headers = $this->_mail->fetchHeaders();
     // who are we sending from?
     $from = null;
     foreach ($headers as $header) {
         if ($header[0] == 'Return-Path') {
             $from = trim($header[1], '<>');
             break;
         }
     }
     if (!$from) {
         throw $this->_exception('ERR_NO_RETURN_PATH');
     }
     // who are we sending to?
     $rcpt = $this->_mail->getRcpt();
     // get the content
     $content = $this->_mail->fetchContent();
     // change headers from array to string
     $headers = $this->_headersToString($headers);
     // prepare the message data
     $crlf = $this->_mail->getCrlf();
     $data = $headers . $crlf . $content;
     // make sure we're connected to the server
     if (!$this->_smtp->isConnected()) {
         $this->_smtp->connect();
         $this->_smtp->helo();
     }
     // reset previous connections
     $this->_smtp->rset();
     // tell who this is MAIL FROM
     $this->_smtp->mail($from);
     // tell who this is RCPT TO (each to, cc, and bcc)
     foreach ($rcpt as $addr) {
         $this->_smtp->rcpt($addr);
     }
     // send the message
     $this->_smtp->data($data, $crlf);
     // done!
     return true;
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:54,代码来源:Smtp.php

示例10: fetch

 /**
  * 
  * Fetches the roles for a user.
  * 
  * @param string $handle User handle to get roles for.
  * 
  * @return array An array of roles discovered in the table.
  * 
  */
 public function fetch($handle)
 {
     // get the dependency object of class Solar_Sql
     $sql = Solar::dependency('Solar_Sql', $this->_config['sql']);
     // get a selection tool using the dependency object
     $select = Solar::factory('Solar_Sql_Select', array('sql' => $sql));
     // make sure the handle col is dotted so it gets quoted properly
     $handle_col = $this->_config['handle_col'];
     if (strpos($handle_col, '.') === false) {
         $handle_col = "{$this->_config['table']}.{$handle_col}";
     }
     // build the select
     $select->from($this->_config['table'], $this->_config['role_col'])->where("{$handle_col} = ?", $handle)->multiWhere($this->_config['where']);
     // get the results (a column of rows)
     $result = $select->fetch('col');
     // done!
     return $result;
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:27,代码来源:Sql.php

示例11: _postConstruct

    /**
     * 
     * Generates the script block required by Facebook.
     * 
     * @return void
     * 
     */
    protected function _postConstruct()
    {
        parent::_postConstruct();
        // retain the facebook dependency
        $this->_facebook = Solar::dependency('Facebook', $this->_config['facebook']);
        // add the FB script to the foot helper
        $href = "http://connect.facebook.net/en_US/all.js";
        $this->_view->foot()->addScript($href);
        // initialize the application and set up login event subscription,
        // also done via the foot helper
        $appid = $this->_facebook->getAppId();
        $inline = <<<INLINE
FB.init({appId: '{$appid}', xfbml: true, cookie: true});
FB.Event.subscribe('auth.login', function(response) {
  window.location.reload();
});
INLINE;
        $this->_view->foot()->addScriptInline($inline);
    }
开发者ID:kalkin,项目名称:solarphp,代码行数:26,代码来源:FacebookScript.php

示例12: _preSetup

 /**
  * 
  * Establish state of this object prior to _setup().
  * 
  * @return void
  * 
  */
 protected function _preSetup()
 {
     // inflection reference
     $this->_inflect = Solar_Registry::get('inflect');
     // our class name so that we don't call get_class() all the time
     $this->_class = get_class($this);
     // get the catalog injection
     $this->_catalog = Solar::dependency('Solar_Sql_Model_Catalog', $this->_config['catalog']);
     // connect to the database
     $this->_sql = Solar::dependency('Solar_Sql', $this->_config['sql']);
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:18,代码来源:Model.php

示例13: _postConstruct

 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // custom boundary string
     if ($this->_config['boundary']) {
         $this->_boundary = $this->_config['boundary'];
     } else {
         $this->_boundary = '__' . hash('md5', uniqid());
     }
     // custom encoding
     if ($this->_config['encoding']) {
         $this->_encoding = $this->_config['encoding'];
     }
     // custom charset
     if ($this->_config['charset']) {
         $this->_charset = $this->_config['charset'];
     }
     // custom CRLF
     if ($this->_config['crlf']) {
         $this->_crlf = $this->_config['crlf'];
     }
     // custom headers
     if ($this->_config['headers']) {
         foreach ((array) $this->_config['headers'] as $label => $value) {
             $this->addHeader($label, $value);
         }
     }
     // do we have an injected transport?
     if ($this->_config['transport']) {
         $this->_transport = Solar::dependency('Solar_Mail_Transport', $this->_config['transport']);
     }
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:39,代码来源:Message.php

示例14: _postConstruct

 /**
  * 
  * Set up the dependency to the Facebook object.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_facebook = Solar::dependency('Facebook', $this->_config['facebook']);
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:12,代码来源:Facebook.php

示例15: _postConstruct

 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // verbosity
     if ($this->_config['verbose'] !== null) {
         $this->setVerbose($this->_config['verbose']);
     }
     // keep a Solar_Debug_Var object around for later
     $this->_var = Solar::factory('Solar_Debug_Var');
     // set the include directory
     $this->_dir = Solar::$system . "/include";
     // logging
     $this->_log = Solar::dependency('Solar_Log', $this->_config['log']);
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:21,代码来源:Suite.php


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