Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.

Commit

Permalink
more 3.6 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
highstrike committed Apr 26, 2018
1 parent eefe660 commit 74f3f39
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 21 deletions.
5 changes: 2 additions & 3 deletions src/Controller/Component/CaptchaComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* $this->loadComponent('Unimatrix/Frontend.Captcha');
*
* // then in your controller action
* if($this->request->is('post')) {
* if($this->getRequest()->is('post')) {
* if($this->Captcha->verify()) {
* ...
* } else $this->Flash->error('Captcha invalid')
Expand Down Expand Up @@ -73,8 +73,7 @@ public function verify() {
}

/**
* Request recaptcha value
* Also removes it from the request
* Consumes request recaptcha value
* @return boolean|string
*/
private function requestRecaptcha() {
Expand Down
18 changes: 9 additions & 9 deletions src/Controller/Component/FrontendComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
* This component loads all other necesary stuff for the frontend,
* it also handles some custom frontend logic and request filtering
*
* To use switch between languages use the following in your controller:
* To use switch between languages use the following in your controller: (asuming 'ro' is default)
* ---------------------------------------------------------------------
* public function ro() {
* $this->request->getSession()->delete('App.locale');
* $this->redirect($this->request->referer());
* }
* public function en() {
* $this->request->getSession()->write('App.locale', 'en_US');
* $this->redirect($this->request->referer());
* }
* public function ro() {
* $this->getRequest()->getSession()->delete('App.locale');
* $this->redirect($this->getRequest()->referer());
* }
* public function en() {
* $this->getRequest()->getSession()->write('App.locale', 'en_US');
* $this->redirect($this->getRequest()->referer());
* }
* ---------------------------------------------------------------------
*
* @author Flavius
Expand Down
12 changes: 12 additions & 0 deletions src/Controller/Component/SitemapComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
* Sitemap component
* Basic to Advanced Sitemap implementation
*
* Installation
* --------------------------------------------------
* Router::scope('/', function (RouteBuilder $routes) {
* ....
* $routes->connect('/sitemap.xml', ['controller' => 'Index', 'action' => 'sitemap']);
* });
*
* and in your Index controller:
* public function sitemap() {
* return $this->getResponse()->withType('application/xml')->withStringBody($this->Sitemap->render());
* }
*
* Example of routes configured for sitemap
* --------------------------------------------------
* $routes->connect('/', ['controller' => 'Index', 'action' => 'index'], ['sitemap' => ['modified' => time(), 'frequency' => 'daily', 'priority' => '1.0']]);
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/CsrfProtectionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* 'skip' => [
* ['controller' => 'API', 'action' => 'batch'], // skip the batch action from the API controller
* ['controller' => 'Amazon'], // skip the whole amazon controller
* ['plugin => 'Backend'] // skip the whole backend plugin
* ['plugin => 'Rest'] // skip the whole REST plugin
* ]
* ---------------------------------------------------------------------------------
*
Expand Down
6 changes: 6 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
*/
class Plugin extends BasePlugin
{
/**
* Plugin name
* @var string
*/
protected $name = 'Unimatrix/Frontend';

/**
* Should this plugin be activated
* @return bool
Expand Down
10 changes: 2 additions & 8 deletions src/Template/Element/seo.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ $seo = Configure::read('Frontend.seo');
foreach($seo as $idx => $one) {
if(is_array($one)) {
foreach($one as $jdx => $two)
designate($this, $jdx, $two, $idx);

} else designate($this, $idx, $one);
}

// designate
function designate($self, $key, $value, $prefix = 'seo') {
$self->assign($prefix . '_' . $key, $value);
$this->assign($idx . '_' . $jdx, $two);
} else $this->assign('seo_' . $idx, $one);
}

// don't use cake default template path as title
Expand Down

0 comments on commit 74f3f39

Please sign in to comment.