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


PHP Registry::getInstance方法代码示例

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


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

示例1: renderTemplate

 /**
  * renderTemplate
  *
  * @since 3.0.0
  *
  * @return mixed
  */
 public static function renderTemplate()
 {
     $registry = Registry::getInstance();
     $request = Request::getInstance();
     $language = Language::getInstance();
     /* handle notification */
     if (!is_dir(self::$_configArray['directory']) && !mkdir(self::$_configArray['directory'])) {
         self::setNotification('error', $language->get('directory_not_found') . $language->get('colon') . ' ' . self::$_configArray['directory'] . $language->get('point'));
     }
     /* prevent as needed */
     if ($request->getPost() || $registry->get('noCache')) {
         return false;
     }
     /* cache as needed */
     $cache = new Cache();
     $cache->init(self::$_configArray['directory'], self::$_configArray['extension']);
     $fullRoute = $registry->get('fullRoute');
     /* load from cache */
     if ($cache->validate($fullRoute, self::$_configArray['lifetime'])) {
         $raw = $cache->retrieve($fullRoute);
         $content = preg_replace('/' . self::$_configArray['tokenPlaceholder'] . '/', $registry->get('token'), self::_uncompress($raw));
         return ['header' => function_exists('gzdeflate') ? 'content-encoding: deflate' : null, 'content' => self::_compress($content)];
     } else {
         $raw = Template\Tag::partial('templates/' . $registry->get('template') . '/index.phtml');
         $content = preg_replace('/' . $registry->get('token') . '/', self::$_configArray['tokenPlaceholder'], $raw);
         $cache->store($fullRoute, self::_compress($content));
         return ['content' => $raw];
     }
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:36,代码来源:PageCache.php

示例2: setUp

 /**
  * setUp
  *
  * @since 3.0.0
  */
 public function setUp()
 {
     $this->_registry = Registry::getInstance();
     $this->_request = Request::getInstance();
     $this->_config = Config::getInstance();
     $this->_configArray = $this->_config->get();
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:12,代码来源:ConfigTest.php

示例3: setUp

 /**
  * setUp
  *
  * @since 3.0.0
  */
 public function setUp()
 {
     $this->_registry = Registry::getInstance();
     $this->_language = Language::getInstance();
     $this->_request = Request::getInstance();
     $this->_config = Config::getInstance();
     $this->_configArray = $this->_config->get();
     $this->_config->set('dbPrefix', 'controller_');
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:14,代码来源:InstallTest.php

示例4: render

 /**
  * render
  *
  * @since 2.6.0
  */
 public static function render()
 {
     $formElement = new Html\Form(Registry::getInstance(), Language::getInstance());
     $formElement->init(array('form' => array('class' => 'js_validate_form form_default'), 'label' => array('class' => 'label'), 'textarea' => array('class' => 'js_auto_resize js_editor_textarea field_textarea'), 'input' => array('email' => array('class' => 'field_text'), 'number' => array('class' => 'field_text'), 'text' => array('class' => 'field_text'), 'url' => array('class' => 'field_text')), 'button' => array('submit' => array('class' => 'js_submit button_default', 'name' => get_class()), 'reset' => array('class' => 'js_reset button_default', 'name' => get_class()))), array('captcha' => Db::getSettings('captcha') > 0));
     /* create the form */
     $formElement->append('<fieldset>')->legend()->append('<ul><li>')->label('* ' . Language::get('author'), array('for' => 'author'))->text(array('id' => 'author', 'name' => 'author', 'readonly' => Registry::get('myName') ? 'readonly' : null, 'required' => 'required', 'value' => Registry::get('myName') ? Registry::get('myName') : Request::getPost('author')))->append('</li><li>')->label('* ' . Language::get('email'), array('for' => 'email'))->email(array('id' => 'email', 'name' => 'email', 'readonly' => Registry::get('myEmail') ? 'readonly' : null, 'required' => 'required', 'value' => Registry::get('myEmail') ? Registry::get('myEmail') : Request::getPost('email')))->append('</li><li>')->label(Language::get('url'), array('for' => 'url'))->url(array('id' => 'url', 'name' => 'url', 'value' => Request::getPost('url')))->append('</li><li>')->label('* ' . Language::get('message'), array('for' => 'text'))->textarea(array('id' => 'text', 'name' => 'text', 'required' => 'required', 'value' => Request::getPost('text')))->append('</li>');
     if (Db::getSettings('captcha') > 0) {
         $formElement->append('<li>')->captcha('task')->append('</li>');
     }
     $formElement->append('</ul></fieldset>');
     if (Db::getSettings('captcha') > 0) {
         $formElement->captcha('solution');
     }
     $formElement->token()->submit()->reset();
     return $formElement;
 }
开发者ID:joergsteinhauer,项目名称:redaxscript,代码行数:21,代码来源:Contact.php

示例5: setUp

 /**
  * setUp
  *
  * @since 2.1.0
  */
 protected function setUp()
 {
     $this->_registry = Registry::getInstance();
     $this->_request = Request::getInstance();
 }
开发者ID:EtienneBruines,项目名称:redaxscript,代码行数:10,代码来源:DetectorTest.php

示例6: setUp

 /**
  * setUp
  *
  * @since 2.4.0
  */
 public function setUp()
 {
     $this->_registry = Registry::getInstance();
 }
开发者ID:amanpreetsinghmalhotra,项目名称:redaxscript,代码行数:9,代码来源:HookTest.php

示例7: setUp

 /**
  * setUp
  *
  * @since 2.6.0
  */
 public function setUp()
 {
     $this->_registry = Registry::getInstance();
     $this->_language = Language::getInstance();
     $this->_request = Request::getInstance();
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:11,代码来源:TagTest.php

示例8: setUp

 /**
  * setUp
  *
  * @since 2.1.0
  */
 protected function setUp()
 {
     $this->_registry = Registry::getInstance();
     $this->_registry->init();
 }
开发者ID:ITw3,项目名称:redaxscript,代码行数:10,代码来源:RegistryTest.php

示例9: registry

 /**
  * registry
  *
  * @since 2.6.0
  *
  * @param string $key
  *
  * @return string
  */
 public static function registry($key = null)
 {
     $registry = Registry::getInstance();
     return $registry->get($key);
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:14,代码来源:Tag.php

示例10: setUp

 /**
  * setUp
  *
  * @since 2.6.0
  */
 protected function setUp()
 {
     $this->_registry = Registry::getInstance();
     $this->_language = Language::getInstance();
 }
开发者ID:amanpreetsinghmalhotra,项目名称:redaxscript,代码行数:10,代码来源:TemplateTest.php

示例11: testRewrite

 /**
  * testRewrite
  *
  * @since 3.0.0
  *
  * @param array $collectionArray
  * @param array $rewriteArray
  * @param string $expect
  *
  * @dataProvider providerRewrite
  */
 public function testRewrite($collectionArray = [], $rewriteArray = [], $expect = null)
 {
     /* setup */
     $optionArray = ['directory' => Stream::url('root/cache/styles'), 'extension' => 'css', 'attribute' => 'href', 'lifetime' => 86400];
     $loader = new Assetic\Loader(Registry::getInstance());
     $loader->init($collectionArray, 'css')->concat($optionArray, $rewriteArray)->concat($optionArray, $rewriteArray);
     /* actual */
     $file = $loader->getCollectionArray()['bundle']['href'];
     $actual = file_get_contents($file);
     /* compare */
     $this->assertEquals($expect, $actual);
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:23,代码来源:LoaderTest.php

示例12: _error

 /**
  * error
  *
  * @since 3.0.0
  *
  * @return string
  */
 protected static function _error()
 {
     $messenger = new Messenger(Registry::getInstance());
     return $messenger->setRoute(Language::get('back'), 'login')->doRedirect()->error(Language::get('something_wrong'), Language::get('error_occurred'));
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:12,代码来源:Demo.php

示例13: _error

 /**
  * error
  *
  * @since 3.0.0
  *
  * @param array $errorArray array of the error
  *
  * @return string
  */
 protected static function _error($errorArray = [])
 {
     $messenger = new Messenger(Registry::getInstance());
     return $messenger->setRoute(Language::get('home'), Registry::get('root'))->error($errorArray['message'], Language::get('error_occurred'));
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:14,代码来源:Contact.php

示例14: getTransport

 /**
  * get the transport
  *
  * @since 3.0.0
  *
  * @return string
  */
 public static function getTransport()
 {
     $transport = new Assetic\Transport(Registry::getInstance(), Language::getInstance());
     return $transport->getArray();
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:12,代码来源:Helper.php

示例15: concat

 /**
  * concat the script
  *
  * @since 3.0.0
  *
  * @param array $optionArray
  *
  * @return Script
  */
 public function concat($optionArray = [])
 {
     $optionArray = array_merge(self::$_optionArray, $optionArray);
     $loader = new Assetic\Loader(Registry::getInstance());
     $loader->init(self::$_collectionArray[self::$_namespace])->concat($optionArray);
     /* update collection */
     self::$_collectionArray[self::$_namespace] = $loader->getCollectionArray();
     return $this;
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:18,代码来源:Script.php


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