|
[pLog-CVS] plog_devel stringutils.class.php,NONE,1.1 adminaddpostaction.class.php,1.15,1.16
From: <phunkphorce@us...> - 2003-09-24 23:27
|
Update of /cvsroot/plog/plog_devel
In directory sc8-pr-cvs1:/tmp/cvs-serv25089
Modified Files:
adminaddpostaction.class.php
Added Files:
stringutils.class.php
Log Message:
Replaced the dependecy of TemplateUtils in AdminAddPostAction with StringUtils, a smaller class that implements some stupid methods.
--- NEW FILE: stringutils.class.php ---
<?php
include_once( "object.class.php" );
class StringUtils extends Object {
function htmlTranslate( $string )
{
return htmlspecialchars( $string );
}
function cutString( $string, $n )
{
return substr( $string, 0, $n );
}
/**
* Returns an array with all the links in a string.
*
* @param string The string
* @return An array with the links in the string.
*/
function getLinks( $string )
{
$regexp = "|<a href=\"(.+)\">(.+)</a>|U";
$result = Array();
if( preg_match_all( $regexp, $string, $out, PREG_PATTERN_ORDER )) {
foreach( $out[1] as $link ) {
array_push( $result, $link );
}
}
return $result;
}
}
?>
Index: adminaddpostaction.class.php
===================================================================
RCS file: /cvsroot/plog/plog_devel/adminaddpostaction.class.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** adminaddpostaction.class.php 22 Sep 2003 22:14:06 -0000 1.15
--- adminaddpostaction.class.php 24 Sep 2003 23:26:58 -0000 1.16
***************
*** 8,11 ****
--- 8,12 ----
include_once( "locale.class.php" );
include_once( "stringvalidator.class.php" );
+ include_once( "stringutils.class.php" );
/**
***************
*** 123,128 ****
if( $this->_sendTrackbacks ) {
// get the links from the text of the post
! $utils = new TemplateUtils();
! $links = $utils->getLinks( stripslashes($article->getText()));
// if no links, there is nothing to do
--- 124,128 ----
if( $this->_sendTrackbacks ) {
// get the links from the text of the post
! $links = StringUtils::getLinks( stripslashes($article->getText()));
// if no links, there is nothing to do
|
| Thread | Author | Date |
|---|---|---|
| [pLog-CVS] plog_devel stringutils.class.php,NONE,1.1 adminaddpostaction.class.php,1.15,1.16 | <phunkphorce@us...> |