|
14 | 14 | * @package symfony |
15 | 15 | * @subpackage debug |
16 | 16 | * @author Fabien Potencier <fabien.potencier@symfony-project.com> |
17 | | - * @version SVN: $Id: sfWebDebug.class.php 30961 2010-09-22 09:36:43Z Kris.Wallsmith $ |
| 17 | + * @version SVN: $Id: sfWebDebug.class.php 31254 2010-10-26 15:26:03Z fabien $ |
18 | 18 | */ |
19 | 19 | class sfWebDebug |
20 | 20 | { |
@@ -154,20 +154,33 @@ public function getOption($name, $default = null) |
154 | 154 | */ |
155 | 155 | public function injectToolbar($content) |
156 | 156 | { |
157 | | - if (false !== $pos = stripos($content, '</head>')) |
| 157 | + if (function_exists('mb_stripos')) |
| 158 | + { |
| 159 | + $posFunction = 'mb_stripos'; |
| 160 | + $posrFunction = 'mb_strripos'; |
| 161 | + $substrFunction = 'mb_substr'; |
| 162 | + } |
| 163 | + else |
| 164 | + { |
| 165 | + $posFunction = 'stripos'; |
| 166 | + $posrFunction = 'strripos'; |
| 167 | + $substrFunction = 'substr'; |
| 168 | + } |
| 169 | + |
| 170 | + if (false !== $pos = $posFunction($content, '</head>')) |
158 | 171 | { |
159 | 172 | $styles = '<style type="text/css">'.str_replace(array("\r", "\n"), ' ', $this->getStylesheet()).'</style>'; |
160 | | - $content = substr($content, 0, $pos).$styles.substr($content, $pos); |
| 173 | + $content = $substrFunction($content, 0, $pos).$styles.$substrFunction($content, $pos); |
161 | 174 | } |
162 | 175 |
|
163 | 176 | $debug = $this->asHtml(); |
164 | | - if (false === $pos = strripos($content, '</body>')) |
| 177 | + if (false === $pos = $posrFunction($content, '</body>')) |
165 | 178 | { |
166 | 179 | $content .= $debug; |
167 | 180 | } |
168 | 181 | else |
169 | 182 | { |
170 | | - $content = substr($content, 0, $pos).'<script type="text/javascript">'.$this->getJavascript().'</script>'.$debug.substr($content, $pos); |
| 183 | + $content = $substrFunction($content, 0, $pos).'<script type="text/javascript">'.$this->getJavascript().'</script>'.$debug.$substrFunction($content, $pos); |
171 | 184 | } |
172 | 185 |
|
173 | 186 | return $content; |
|
0 commit comments