Otro bug MOD follower


no_avatar
vinotinto22
 
Posts: 12
Joined: Fri Jan 04, 2013 6:35 pm
 Fri May 30, 2014 3:41 pm • via Web
Saludos, le describo el siguiente error:

Aparece cuando en algun post o respuestas, nombras 2 veces el mismo hashtag

Ejemplo: si se escribe, " saludos al #administrador, excelente foro. Nuevamente Gracias al #administrador "

Al publicar eso, automaticamente los 2 nombramientos del administracion desaparecen, aperiendo publicado nada mas " saludos al , excelente foro. Nuevamente Gracias al "
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Sat Jun 07, 2014 2:29 pm • via Web
Hola

Realiza esta edición para solucionar el problema.
1. Abre el archivo "follower/includes/follower.php"
2. Busca:
Code: Select all
         foreach($matches[1] as $tag)
         {
            $this->hashtags[] = str_replace('#', '', utf8_strtolower($tag));
            $text = str_replace($tag, '<!--' . $tag . '-->', $text);
         }

3. Reemplázalo por:
Code: Select all
         foreach($matches[1] as $tag)
         {
            $tag_clean = str_replace('#', '', utf8_strtolower($tag));

            if(!in_array($tag_clean, $this->hashtags))
            {
               $this->hashtags[] = $tag_clean;
               $text = str_replace($tag, '<!--' . $tag . '-->', $text);
            }
         }
no_avatar
vinotinto22
 
Posts: 12
Joined: Fri Jan 04, 2013 6:35 pm
 Sun Jun 08, 2014 6:15 pm • via Web
Saludos, hicimos lo indicado e hicimos varias pruebas, el detalle se arreglo, pero al colocar el siguiente ejemplo: hay unos que no se marca, especificamente lo que escribimos con la primera letra en mayuscula.

Ejemplo:

"como estan #prueba excelente #Prueba 25 #Beisbol, #Prueba, #Vinotinto, #vinotinto, #Prueba, #prueba."

Sabemos que es algo nulo, pero como desemos colaborar para que tengan el MOD perfecto, anunciamos eso. Exitos.
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Tue Jun 10, 2014 9:45 am • via Web
Gracias por el reporte.

Para solucionarlo prueba lo siguiente
1 Abre el archivo follower/includes/follower.php
2. Tienes que buscar la función entera llamada "_parse_hashtags", en tu caso debería ser esto lo que tienes:
Code: Select all
   function _parse_hashtags(&$text)
   {      
      $this->hashtags = array();
      
      if(!$this->active)
      {
         return false;
      }

      preg_match_all('/(?:^|\s)+(#[^<>\s\[]+)/', $text, $matches);

      if(!empty($matches[1]))
      {
         foreach($matches[1] as $tag)
         {
            $tag_clean = str_replace('#', '', utf8_strtolower($tag));

            if(!in_array($tag_clean, $this->hashtags))
            {
               $this->hashtags[] = $tag_clean;
               $text = str_replace($tag, '<!--' . $tag . '-->', $text);
            }
         }
         
         $this->hashtags = array_unique($this->hashtags);
      }
   }

3. Reemplaza toda la función por esta otra:
Code: Select all
   function _parse_hashtags(&$text)
   {      
      $this->hashtags = array();
      
      if(!$this->active)
      {
         return false;
      }

      preg_match_all('/(?:^|\s)+(#[^<>\s\[\,\.]+)/', $text, $matches);

      if(!empty($matches[1]))
      {
         foreach($matches[1] as $tag)
         {
            $tag_clean = str_replace('#', '', utf8_strtolower($tag));

            $this->hashtags[] = $tag_clean;
            
            if(strpos($text, '<!--' . $tag . '-->') === false)
            {
               $text = str_replace($tag, '<!--' . $tag . '-->', $text);
            }
         }
         
         $this->hashtags = array_unique($this->hashtags);
      }
   }


Esto debería solucionar el problema.
Saludos

Who is online

Users browsing this forum: No registered users and 0 guests