本文整理汇总了PHP中Solar_Registry::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Solar_Registry::get方法的具体用法?PHP Solar_Registry::get怎么用?PHP Solar_Registry::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solar_Registry
的用法示例。
在下文中一共展示了Solar_Registry::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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.");
}
示例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).");
}
示例3: 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;
}
示例4: 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);
}
示例5: 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);
}
示例6: _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');
}
示例7: _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');
}
示例8: 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);
}
示例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();
}
示例10: _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();
}
示例11: _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();
}
示例12: _postConstruct
/**
*
* Post-construction tasks to complete object construction.
*
* @return void
*
*/
protected function _postConstruct()
{
if (!self::$_session) {
self::$_session = Solar::factory('Solar_Session', array('class' => 'Solar_Csrf'));
}
if (!self::$_request) {
self::$_request = Solar_Registry::get('request');
}
// ignore construct-time configuration for the key, but honor
// it from the config file. we want the key name to be the
// same everywhere all the time.
$key = Solar_Config::get('Solar_Csrf', 'key');
if ($key) {
self::$_key = $key;
}
}
示例13: _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();
// done!
$this->_outln("Done!");
$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.");
}
示例14: redirect
/**
*
* Issues an immediate "Location" redirect. Use instead of display()
* to perform a redirect. You should die() or exit() after calling this.
*
* @param Solar_Uri_Action|string $spec The URI to redirect to.
*
* @param int|string $code The HTTP status code to redirect with; default
* is '302 Found'.
*
* @return void
*
*/
public function redirect($spec, $code = '302')
{
if ($spec instanceof Solar_Uri_Action) {
$href = $spec->get(true);
} elseif (strpos($spec, '://') !== false) {
// external link, protect against header injections
$href = str_replace(array("\r", "\n"), '', $spec);
} else {
$uri = Solar::factory('Solar_Uri_Action');
$href = $uri->quick($spec, true);
}
// kill off all output buffers
while (@ob_end_clean()) {
}
// make sure there's actually an href
$href = trim($href);
if (!$href) {
throw $this->_exception('ERR_REDIRECT_FAILED', array('href' => $href));
}
// set the status code
$this->setStatusCode($code);
// set the redirect location
$this->setHeader('Location', $href);
// clear the response body
$this->content = null;
// is this a GET-after-(POST|PUT) redirect?
$request = Solar_Registry::get('request');
if ($request->isPost() || $request->isPut()) {
// tell the next request object that it's a get-after-post
$session = Solar::factory('Solar_Session', array('class' => get_class($request)));
$session->setFlash('is_gap', true);
}
// save the session
session_write_close();
// send the response directly -- done.
$this->display();
}
示例15: _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');
}