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


PHP Solar_Registry类代码示例

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


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

示例1: setup

 /**
  * 
  * Setup; runs before each test method.
  * 
  */
 public function setup()
 {
     $this->_sql = Solar::factory('Solar_Sql', array('adapter' => 'Solar_Sql_Adapter_Sqlite', 'name' => ':memory:'));
     // forcibly add sql to registry
     Solar_Registry::set('sql', $this->_sql);
     $cmd = "CREATE TABLE acl (" . "    flag VARCHAR(10)," . "    type CHAR(100)," . "    name VARCHAR(255)," . "    class_name VARCHAR(255)," . "    action_name VARCHAR(255)," . "    position VARCHAR(255)" . ")";
     $this->_sql->query($cmd);
     $dir = Solar_Class::dir('Test_Solar_Access_Adapter', '_support');
     $lines = file_get_contents($dir . 'access.txt');
     $rows = explode("\n", $lines);
     $pos = 0;
     foreach ($rows as $row) {
         $row = trim($row);
         // skip empty lines and comments
         if (empty($row) || substr($row, 0, 1) == '#') {
             continue;
         }
         $row = preg_replace('/[ \\t]{2,}/', ' ', $row);
         $row = explode(' ', $row);
         $data['flag'] = trim($row[0]);
         $data['type'] = trim($row[1]);
         $data['name'] = trim($row[2]);
         $data['class_name'] = trim($row[3]);
         $data['action_name'] = trim($row[4]);
         $data['position'] = $pos;
         $this->_sql->insert('acl', $data);
         $pos++;
     }
     parent::setup();
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:35,代码来源:Sql.php

示例2: _exec

 /**
  * 
  * Write out a series of dirs and symlinks for a new Vendor source.
  * 
  * @param string $vendor The Vendor name.
  * 
  * @return void
  * 
  */
 protected function _exec($vendor = null)
 {
     // we need a vendor name, at least
     if (!$vendor) {
         throw $this->_exception('ERR_NO_VENDOR_NAME');
     }
     $this->_outln("Removing links for vendor '{$vendor}' ...");
     // build "foo-bar" and "FooBar" versions of the vendor name.
     $this->_inflect = Solar_Registry::get('inflect');
     $this->_dashes = $this->_inflect->camelToDashes($vendor);
     $this->_studly = $this->_inflect->dashesToStudly($this->_dashes);
     // the base system dir
     $system = Solar::$system;
     // the links to remove (reverse order from make-vendor)
     $links = array("script/{$this->_dashes}", "include/Mock/{$this->_studly}", "include/Test/{$this->_studly}", "include/{$this->_studly}");
     // remove the links
     foreach ($links as $link) {
         $this->_out("    Removing '{$link}' ... ");
         $path = "{$system}/{$link}";
         if (Solar_File::exists($path)) {
             unlink($path);
             $this->_outln("done.");
         } else {
             $this->_outln("missing.");
         }
     }
     // done!
     $this->_outln("... done.");
     // reminders
     $this->_outln("Remember to remove '{$this->_studly}_App' from the " . "['Solar_Controller_Front']['classes'] element " . "in your config file.");
     $this->_outln("Remember to remove '{$this->_studly}_Model' from the " . "['Solar_Sql_Model_Catalog']['classes'] element " . "in your config file.");
     // need to write a recursive-remove method for Solar_Dir that will
     // delete only the symlinked files (not the real files)
     $this->_outln("You will need to remove the " . "'docroot/public/{$this->_studly}' directory yourself, as it " . "may contain copies of public assets (not links).");
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:44,代码来源:UnlinkVendor.php

示例3: _exec

 /**
  * 
  * Write out a series of dirs and symlinks for a new Vendor source.
  * 
  * @param string $vendor The Vendor name.
  * 
  * @return void
  * 
  */
 protected function _exec($vendor = null)
 {
     // we need a vendor name, at least
     if (!$vendor) {
         throw $this->_exception('ERR_NO_VENDOR');
     }
     $this->_outln("Making links for vendor '{$vendor}' ...");
     // build "foo-bar" and "FooBar" versions of the vendor name.
     $this->_inflect = Solar_Registry::get('inflect');
     $this->_dashes = $this->_inflect->camelToDashes($vendor);
     $this->_studly = $this->_inflect->dashesToStudly($this->_dashes);
     $links = array(array('dir' => "include", 'tgt' => $this->_studly, 'src' => "../source/{$this->_dashes}/{$this->_studly}"), array('dir' => "include/Test", 'tgt' => $this->_studly, 'src' => "../../source/{$this->_dashes}/tests/Test/{$this->_studly}"), array('dir' => "include/Mock", 'tgt' => $this->_studly, 'src' => "../../source/{$this->_dashes}/tests/Mock/{$this->_studly}"), array('dir' => "include/Fixture", 'tgt' => $this->_studly, 'src' => "../../source/{$this->_dashes}/tests/Fixture/{$this->_studly}"), array('dir' => "script", 'tgt' => $this->_dashes, 'src' => "../source/solar/script/solar"));
     $system = Solar::$system;
     foreach ($links as $link) {
         // $dir, $src, $tgt
         extract($link);
         // make it
         $this->_out("    Making link '{$dir}/{$tgt}' ... ");
         try {
             Solar_Symlink::make($src, $tgt, "{$system}/{$dir}");
             $this->_outln("done.");
         } catch (Exception $e) {
             $this->_out($e->getMessage());
             $this->_outln(" ... failed.");
         }
     }
     // done with this part
     $this->_outln("... done.");
     // make public links
     $link_public = Solar::factory('Solar_Cli_LinkPublic');
     $link_public->exec($vendor);
     // done for real
     $this->_outln("Remember to add '{$this->_studly}_App' to the " . "['Solar_Controller_Front']['classes'] element " . "in your config file so that it finds your apps.");
     $this->_outln("Remember to add '{$this->_studly}_Model' to the " . "['Solar_Sql_Model_Catalog']['classes'] element " . "in your config file so that it finds your models.");
 }
开发者ID:abtris,项目名称:solarphp-quickstart,代码行数:44,代码来源:LinkVendor.php

示例4: actionOverview

 public function actionOverview($page = 1)
 {
     $model_news = new JForg_Model_News();
     $locale = Solar_Registry::get('locale');
     if ($this->_format != null) {
         //requesting an newsfeed (rss,rss2 or atom)
         //disable all pageing stuff
         $this->title = $this->locale('TEXT_NEWS');
         $items_per_page = 15;
         $page = 1;
     } else {
         //requesting an usual (xhtml) webpage.
         //do this pageing stuff
         $page = (int) $page;
         $items_per_page = 5;
         $pagecount = $model_news->countPages(array('where' => 'language = \'' . $locale->getCode() . '\'', 'paging' => $items_per_page, 'page' => $page));
         if ($page > $pagecount['pages']) {
             $page = $pagecount['pages'];
         }
         if ($page == 0) {
             $page = 1;
         }
         $this->title = $this->locale('TEXT_NEWS') . ' - ' . $this->locale('TEXT_PAGE') . ': ' . $page;
         $this->page = $page;
         $this->max_page = $pagecount['pages'];
     }
     $collection = $model_news->fetchAllByLanguage($locale->getCode(), array('page' => $page, 'paging' => $items_per_page));
     $this->news = $collection;
 }
开发者ID:BackupTheBerlios,项目名称:jabberfriends-svn,代码行数:29,代码来源:News.php

示例5: getTextRaw

 /**
  * 
  * Returns a localized string WITH NO ESCAPING.
  * 
  * @param string $key The locale key to look up from the class.
  * 
  * @param int|float $num A number to help determine if the
  * translation should return singluar or plural.
  * 
  * @param array $replace If an array, will call vsprintf() on the
  * localized string using the replacements in the array.
  * 
  * @return string The translated locale string.
  * 
  */
 public function getTextRaw($key, $num = 1, $replace = null)
 {
     static $locale;
     if (!$locale) {
         $locale = Solar_Registry::get('locale');
     }
     return $locale->fetch($this->_class, $key, $num, $replace);
 }
开发者ID:agentile,项目名称:foresmo,代码行数:23,代码来源:GetTextRaw.php

示例6: postLoginFailure

 /**
  * 
  * The login was a failure, complete the protocol
  * 
  * @return void
  * 
  */
 public function postLoginFailure()
 {
     $response = Solar_Registry::get('response');
     $response->setHeader('WWW-Authenticate', 'Basic realm="' . $this->_config['realm'] . '"');
     $response->setStatusCode(401);
     $response->display();
     exit(0);
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:15,代码来源:HttpBasic.php

示例7: _postConstruct

 protected function _postConstruct()
 {
     parent::_postConstruct();
     // "Test_Solar_View_Helper_" = 23
     $this->_helper_name = substr(get_class($this), 23);
     $this->_helper_class = substr(get_class($this), 5);
     $this->_request = Solar_Registry::get('request');
     $this->_view = Solar::factory('Solar_View');
 }
开发者ID:agentile,项目名称:foresmo,代码行数:9,代码来源:Helper.php

示例8: _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

示例9: setup

 public function setup()
 {
     parent::setup();
     $this->_view = Solar::factory('Solar_View');
     $this->_name = substr(get_class($this), 18, -4);
     $this->_name[0] = strtolower($this->_name[0]);
     // retain and reset the request environment
     $this->_request = Solar_Registry::get('request');
     $this->_request->reset();
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:10,代码来源:HelperTestCase.php

示例10: setup

 /**
  * 
  * Setup; runs before each test method.
  * 
  */
 public function setup()
 {
     parent::setup();
     // remove "Test_" prefix
     $this->_class = substr(get_class($this), 5);
     // get the request environment
     $this->_request = Solar_Registry::get('request');
     // get a new adapter
     $this->_auth = Solar::factory($this->_class, $this->_config);
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:15,代码来源:Adapter.php

示例11: setup

 /**
  * 
  * Setup; runs before each test method.
  * 
  */
 public function setup()
 {
     parent::setup();
     // set up an SQL connection
     $this->_sql = Solar::factory('Solar_Sql', $this->_sql_config);
     // set up a model catalog
     $this->_catalog = Solar::factory('Solar_Sql_Model_Catalog', $this->_catalog_config);
     // register the connection and catalog
     Solar_Registry::set('sql', $this->_sql);
     Solar_Registry::set('model_catalog', $this->_catalog);
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:16,代码来源:Model.php

示例12: preTest

 /**
  * 
  * Setup; runs before each test method.
  * 
  */
 public function preTest()
 {
     parent::preTest();
     // set up an SQL connection
     $this->_sql = Solar::factory('Solar_Sql', $this->_sql_config);
     $this->_sql->setProfiling(true);
     // set up a model catalog
     $this->_catalog = Solar::factory('Solar_Sql_Model_Catalog', $this->_catalog_config);
     // register the connection and catalog
     Solar_Registry::set('sql', $this->_sql);
     Solar_Registry::set('model_catalog', $this->_catalog);
     // fixture to populate tables
     $this->_fixture = Solar::factory('Fixture_Solar_Sql_Model');
 }
开发者ID:agentile,项目名称:foresmo,代码行数:19,代码来源:Collection.php

示例13: setup

 /**
  * 
  * Setup; runs before each test method.
  * 
  */
 public function setup()
 {
     parent::setup();
     // set up an SQL connection
     $this->_sql = Solar::factory('Solar_Sql', $this->_sql_config);
     $this->_sql->setProfiling(true);
     // set up a model catalog
     $this->_catalog = Solar::factory('Solar_Sql_Model_Catalog', $this->_catalog_config);
     // register the connection and catalog
     Solar_Registry::set('sql', $this->_sql);
     Solar_Registry::set('model_catalog', $this->_catalog);
     // populate everything
     $this->_populateAll();
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:19,代码来源:Record.php

示例14: _postConstruct

 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // get the current request environment
     $this->_request = Solar_Registry::get('request');
     // set convenience vars from config
     $this->_routing = $this->_config['routing'];
     $this->_default = $this->_config['default'];
     $this->_disable = (array) $this->_config['disable'];
     // set up a class stack for finding commands
     $this->_stack = Solar::factory('Solar_Class_Stack');
     $this->_stack->add($this->_config['classes']);
     // extended setup
     $this->_setup();
 }
开发者ID:agentile,项目名称:foresmo,代码行数:22,代码来源:Console.php

示例15: _exec

 /**
  * 
  * Write out a series of dirs and symlinks for a new Vendor source.
  * 
  * @param string $vendor The Vendor name.
  * 
  * @return void
  * 
  */
 protected function _exec($vendor = null)
 {
     // we need a vendor name, at least
     if (!$vendor) {
         throw $this->_exception('ERR_NO_VENDOR_NAME');
     }
     // build "foo-bar" and "FooBar" versions of the vendor name.
     $this->_inflect = Solar_Registry::get('inflect');
     $this->_dashes = $this->_inflect->camelToDashes($vendor);
     $this->_studly = $this->_inflect->dashesToStudly($this->_dashes);
     // create dirs, files, and symlinks
     $this->_createDirs();
     $this->_createFiles();
     $this->_createLinks();
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:24,代码来源:MakeVendor.php


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