Forráskód Böngészése

Merge pull request #152 from Alkarex/AvoidPregReplace

Avoid preg_replace() for simple cases
Marien Fressinaud 12 éve
szülő
commit
980b1ef26c
3 módosított fájl, 3 hozzáadás és 3 törlés
  1. 1 1
      app/models/Feed.php
  2. 1 1
      app/views/entry/bookmark.phtml
  3. 1 1
      app/views/entry/read.phtml

+ 1 - 1
app/models/Feed.php

@@ -172,7 +172,7 @@ class Feed extends Model {
 				);
 			} else {
 				$feed = new SimplePie ();
-				$url = preg_replace ('/&/', '&', $this->url);
+				$url = str_replace ('&', '&', $this->url);
 				if ($this->httpAuth != '') {
 					$url = preg_replace ('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url);
 				}

+ 1 - 1
app/views/entry/bookmark.phtml

@@ -12,4 +12,4 @@ $url = Url::display (array (
 	'params' => Request::params (),
 ));
 
-echo json_encode (array ('url' => preg_replace ('#&#i', '&', $url)));
+echo json_encode (array ('url' => str_ireplace ('&', '&', $url)));

+ 1 - 1
app/views/entry/read.phtml

@@ -12,4 +12,4 @@ $url = Url::display (array (
 	'params' => Request::params (),
 ));
 
-echo json_encode (array ('url' => preg_replace ('#&#i', '&', $url)));
+echo json_encode (array ('url' => str_ireplace ('&', '&', $url)));