tutida / altair
Auto converting special characters of variables to HTML entities
Installs: 59 275
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 3
Forks: 5
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.4.16
- cakephp/cakephp: ~3.5
Requires (Dev)
README
Auto converting special characters of variables to HTML entities
Requirements
- PHP >=5.4.16
- CakePHP >= ~3.0
Usage
<?php class AppController extends Controller { public function initialize() { $this->loadComponent('Altair.Altair'); } ... }
By doing above, You do not have to write the following(h()) every time.
<?= h($variable); ?>
If you do not want to escape $object
, use $object->escape
property.
<?php class UsersController extends AppController { public function add() { $user = $this->Users->newEntity(); ... $user->escape = false; $this->set('user', $user); } ... }
If you do not want to escape in the action, use $this->Altair->escape()
method.
<?php class UsersController extends AppController { public function add() { $user = $this->Users->newEntity(); ... // Not escape $viewVars in this action. $this->Altair->escape(false); $this->set('user', $user); } ... }