Skip to content

Instantly share code, notes, and snippets.

@konnoyosuke
Created January 17, 2012 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konnoyosuke/1625037 to your computer and use it in GitHub Desktop.
Save konnoyosuke/1625037 to your computer and use it in GitHub Desktop.
function beforeFilter() {
       if(isset($this->Ktai) && $this->Ktai->is_ktai()){
$this->layout = 'ktai_default';
$this->viewPath = 'ktai' . DS . $this->viewPath;
$this->Ktai->_options = array_merge($this->Ktai->_options, array(
'input_encoding' => 'UTF-8',
'output_encoding' => 'SJIS-win',
'output_auto_encoding' => true,
'output_auto_convert_emoji' => false,
));
//1.x
$this->header('Content-Type: text/html; charset=Shift-JIS');
//2.0
$this->response->header('Content-Type: text/html; charset=Shift-JIS');
}
}
//class KtaiComponent extends Object { L35
//2.0
class KtaiComponent extends Component {
function shutdown(&$controller){
//自動変換処理
//requestAction()からのコールの場合は以下処理をスキップする
//
if (!isset($controller->params['requested']) || $controller->params['requested'] !== 1) {
//1.x
//$out = $controller->output; //L144
//2.0
$out = $controller->response->body();
//1.x
//$controller->output = $out; //L170
//2.0
$controller->response->body($out);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment