Last active
August 29, 2015 13:58
-
-
Save tai-sho/9987732 to your computer and use it in GitHub Desktop.
CakePHPが出力するHTMLからスペースやタブを削除する。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('Helper', 'View'); | |
class AppHelper extends Helper { | |
/** | |
* CakeがHTMLを出力する際に生成される無駄なタブを削除する。 | |
* @see Helper::afterLayout() | |
*/ | |
public function afterLayout($layoutFile) { | |
parent::afterLayout($layoutFile); | |
mb_internal_encoding('UTF-8'); | |
mb_regex_encoding('UTF-8'); | |
//出力するソースのタブを削除する | |
if ($this->_View){ | |
$this->_View->output = mb_ereg_replace(' *\t *', '', $this->_View->output); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment