[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.301.2.1,1.301.2.2

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Mon May 31 14:19:07 EDT 2004


Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv1353/public_html

Modified Files:
      Tag: geeklog_1_3_9_1
	lib-common.php 
Log Message:
COM_extractLinks will now ignore anchor tags that do not contain "href" (bug #183).


Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.301.2.1
retrieving revision 1.301.2.2
diff -C2 -d -r1.301.2.1 -r1.301.2.2
*** lib-common.php	31 May 2004 10:50:38 -0000	1.301.2.1
--- lib-common.php	31 May 2004 18:19:04 -0000	1.301.2.2
***************
*** 15,18 ****
--- 15,19 ----
  // |          Jason Whittenburg - jwhitten at securitygeeks.com                   |
  // |          Dirk Haun         - dirk at haun-online.de                          |
+ // |          Vincent Furia     - vinny01 at users.sourceforge.net                |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
***************
*** 5122,5140 ****
      $rel = array();
  
!     preg_match_all( "/(<a.*?href=\"(.*?)\".*?>)(.*?)(<\/a>)/i", $fulltext, $matches );
      for ( $i=0; $i< count( $matches[0] ); $i++ )
      {
!         $matches[3][$i] = strip_tags( $matches[3][$i] );
!         if ( !strlen( trim( $matches[3][$i] ) ) ) {
!             $matches[3][$i] = strip_tags( $matches[2][$i] );
          }
  
          // if link is too long, shorten it and add ... at the end
!         if ( ( $maxlength > 0 ) && ( strlen( $matches[3][$i] ) > $maxlength ) )
          {
!             $matches[3][$i] = substr( $matches[3][$i], 0, $maxlength - 3 ) . '...';
          }
  
!         $rel[] = $matches[1][$i] . $matches[3][$i] . $matches[4][$i];
      }
  
--- 5123,5143 ----
      $rel = array();
  
!     /* Only match anchor tags that contain 'href="<something>"'
!      */
!     preg_match_all( "/<a[^>]*href=\"([^\"]*)\"[^>]*>([^<]*)<\/a>/i", $fulltext, $matches );
      for ( $i=0; $i< count( $matches[0] ); $i++ )
      {
!         $matches[2][$i] = strip_tags( $matches[2][$i] );
!         if ( !strlen( trim( $matches[2][$i] ) ) ) {
!             $matches[2][$i] = strip_tags( $matches[1][$i] );
          }
  
          // if link is too long, shorten it and add ... at the end
!         if ( ( $maxlength > 0 ) && ( strlen( $matches[2][$i] ) > $maxlength ) )
          {
!             $matches[2][$i] = substr( $matches[2][$i], 0, $maxlength - 3 ) . '...';
          }
  
!         $rel[] = '<a href="' . $matches[1][$i] . '">' . $matches[2][$i] . '</a>';
      }
  




More information about the geeklog-cvs mailing list