Strona 1 z 1

[FIX] Advanced phpBB3 SEO mod Rewrite 0.4.4

: 13 sierpnia 2008, 18:20
autor: jaroslw
Na potrzeby swojego forum napisałem prostą poprawkę, która przystosowuje tą modyfikację do polskich realiów. Co właściwie robi? Poprawia (a właściwie dodaje, bo jej brak) obsługę polskich znaków diaktrycznych w nadpisywanych adresach, np.

ą => a
ę => e
ś => s
ć => c

itd.

Otwórz plik phpbb_seo/phpbb_seo_class.php i znajdź:

Kod: Zaznacz cały

function format_url( $url, $type = 'topic' ) {
		$url = preg_replace('`\[.*\]`U','',$url);
		$url = htmlentities($url, ENT_COMPAT, $this->encoding);
Dodaj po:

Kod: Zaznacz cały

$this->seo_opt['url_find'] = array (
			utf8_chr(260), utf8_chr(261),
			utf8_chr(262), utf8_chr(263),
			utf8_chr(280), utf8_chr(281),
			utf8_chr(321), utf8_chr(322),
			utf8_chr(323), utf8_chr(324),
			utf8_chr(346), utf8_chr(347),
			utf8_chr(377), utf8_chr(378),
			utf8_chr(379), utf8_chr(380)
		);
		$this->seo_opt['url_replace'] = array('a', 'a', 'c', 'c', 'e', 'e', 'l', 'l', 'n', 'n', 's', 's', 'z', 'z', 'z', 'z');
		
		$url = str_replace($this->seo_opt['url_find'],$this->seo_opt['url_replace'], $url);

Re: [FIX] Advanced phpBB3 SEO mod Rewrite 0.4.4

: 11 lutego 2009, 19:22
autor: Smuger
Witam,

Zainstalowałem Advanced phpBB3 SEO mod Rewrite 0.4.4 Wszystko działa bez problemu.
Jednak gdy chcę zmienić znaki tzn np 'ą' na 'a' to mam pewien problem

otóż w pliku phpbb_seo/phpbb_seo_class.php
mam linie która wyglada tak:

Kod: Zaznacz cały

	function format_url( $url, $type = 'topic' ) {
		$url = preg_replace('`\[.*\]`U','',$url);
		$url = htmlentities($url, ENT_COMPAT, 'utf-8');
		$url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
		$url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
		$url = strtolower(trim($url, '-'));
		return empty($url) ? $type : $url;
	}
i według Twojej instrukcji zmieniam ją tak:

Kod: Zaznacz cały

		function format_url( $url, $type = 'topic' ) {
		$url = preg_replace('`\[.*\]`U','',$url);
		$url = htmlentities($url, ENT_COMPAT, $this->encoding);
		$this->seo_opt['url_find'] = array (
		 utf8_chr(260), utf8_chr(261),
		 utf8_chr(262), utf8_chr(263),
		 utf8_chr(280), utf8_chr(281),
		 utf8_chr(321), utf8_chr(322),
		 utf8_chr(323), utf8_chr(324),
		 utf8_chr(346), utf8_chr(347),
		 utf8_chr(377), utf8_chr(378),
		 utf8_chr(379), utf8_chr(380)
	     );
	    $this->seo_opt['url_replace'] = array('a', 'a', 'c', 'c', 'e', 'e', 'l', 'l', 'n', 'n', 's', 's', 'z', 'z', 'z', 'z');
	    $url = str_replace($this->seo_opt['url_find'],$this->seo_opt['url_replace'], $url);
		$url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
		$url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
		$url = strtolower(trim($url, '-'));
		return empty($url) ? $type : $url;
	}
Lecz to nic nie daje, wciąż literki się nie zmieniają
Pozdrawiam. ;)

Re: [FIX] Advanced phpBB3 SEO mod Rewrite 0.4.4

: 11 lutego 2009, 19:53
autor: jaroslw
Spróbuj tak:

Kod: Zaznacz cały

function format_url( $url, $type = 'topic' ) {
      $url = preg_replace('`\[.*\]`U','',$url);
      $url = htmlentities($url, ENT_COMPAT, 'utf-8');
		$this->seo_opt['url_find'] = array(
         utf8_chr(260), utf8_chr(261),
         utf8_chr(262), utf8_chr(263),
         utf8_chr(280), utf8_chr(281),
         utf8_chr(321), utf8_chr(322),
         utf8_chr(323), utf8_chr(324),
         utf8_chr(346), utf8_chr(347),
         utf8_chr(377), utf8_chr(378),
         utf8_chr(379), utf8_chr(380)
      );
      $this->seo_opt['url_replace'] = array('a', 'a', 'c', 'c', 'e', 'e', 'l', 'l', 'n', 'n', 's', 's', 'z', 'z', 'z', 'z');
      $url = str_replace($this->seo_opt['url_find'],$this->seo_opt['url_replace'], $url);
      $url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
      $url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
      $url = strtolower(trim($url, '-'));
      return empty($url) ? $type : $url;
   }
Sprawdź, czy działa to dla nowych tematów.

Re: [FIX] Advanced phpBB3 SEO mod Rewrite 0.4.4

: 11 lutego 2009, 20:01
autor: Smuger
Działa jak należy ;)
Wielkie dzięki :)

Re: [FIX] Advanced phpBB3 SEO mod Rewrite 0.4.4

: 02 maja 2009, 18:12
autor: Grin
Działa świetnie :P

Re: [FIX] Advanced phpBB3 SEO mod Rewrite 0.4.4

: 05 czerwca 2009, 14:42
autor: pito
Wstawiłem, to jak należy, ale przy wejsci w obojętnie jaki dział wywala error.

"Fatal error: Cannot redeclare format_url() (previously declared in /home/garcius/public_html/phpbb_seo/phpbb_seo_class.php:227) in /home/garcius/public_html/phpbb_seo/phpbb_seo_class.php on line 227"

oto kod

Kod: Zaznacz cały

/**
	* Prepare Titles for URL injection
	*/
	function format_url( $url, $type = 'topic' ) {
		$url = preg_replace('`\[.*\]`U','',$url);
		$url = htmlentities($url, ENT_COMPAT, 'utf-8');
		function format_url( $url, $type = 'topic' ) {
      $url = preg_replace('`\[.*\]`U','',$url);
      $url = htmlentities($url, ENT_COMPAT, 'utf-8');
      $this->seo_opt['url_find'] = array(    [b]To jest ta 227 linia[/b]
         utf8_chr(260), utf8_chr(261),
         utf8_chr(262), utf8_chr(263),
         utf8_chr(280), utf8_chr(281),
         utf8_chr(321), utf8_chr(322),
         utf8_chr(323), utf8_chr(324),
         utf8_chr(346), utf8_chr(347),
         utf8_chr(377), utf8_chr(378),
         utf8_chr(379), utf8_chr(380)
      );
      $this->seo_opt['url_replace'] = array('a', 'a', 'c', 'c', 'e', 'e', 'l', 'l', 'n', 'n', 's', 's', 'z', 'z', 'z', 'z');
      $url = str_replace($this->seo_opt['url_find'],$this->seo_opt['url_replace'], $url);
      $url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
      $url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
      $url = strtolower(trim($url, '-'));
      return empty($url) ? $type : $url;
   }
		$url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
		$url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
		$url = strtolower(trim($url, '-'));
		return empty($url) ? $type : $url;
	}
	/**

Re: [FIX] Advanced phpBB3 SEO mod Rewrite 0.4.4

: 05 czerwca 2009, 17:34
autor: daroPL
Zobacz czy w pliku /phpbb_seo/phpbb_seo_class.php nie występuje u Ciebie dwa razy fraza "function format_url(".