[xoops-cvslog 3765] CVS update: xoops2jp/html/class

Back to archive index

Minahito minah****@users*****
2006年 7月 31日 (月) 18:52:26 JST


Index: xoops2jp/html/class/module.textsanitizer.php
diff -u xoops2jp/html/class/module.textsanitizer.php:1.2.8.5 xoops2jp/html/class/module.textsanitizer.php:1.2.8.6
--- xoops2jp/html/class/module.textsanitizer.php:1.2.8.5	Sat Feb 18 23:51:46 2006
+++ xoops2jp/html/class/module.textsanitizer.php	Mon Jul 31 18:52:26 2006
@@ -1,5 +1,5 @@
 <?php
-// $Id: module.textsanitizer.php,v 1.2.8.5 2006/02/18 14:51:46 nobunobu Exp $
+// $Id: module.textsanitizer.php,v 1.2.8.6 2006/07/31 09:52:26 minahito Exp $
 //  ------------------------------------------------------------------------ //
 //                XOOPS - PHP Content Management System                      //
 //                    Copyright (c) 2000 XOOPS.org                           //
@@ -53,6 +53,26 @@
      */
     var $censorConf;
 
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mMakeClickablePre = null;
+	
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mMakeClickablePostFilter = null;
+	
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mXoopsCodePre = null;
+	
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mXoopsCodePostFilter = null;
+	
     /*
     * Constructor of this class
     *
@@ -66,7 +86,17 @@
     */
     function MyTextSanitizer()
     {
-
+		$this->mMakeClickablePre =& new XCube_NewDelegate();
+		$this->mMakeClickablePre->register('MyTextSanitizer.MakeClickablePre');
+		
+		$this->mMakeClickablePostFilter =& new XCube_NewDelegate();
+		$this->mMakeClickablePostFilter->register('MyTextSanitizer.MakeClickablePostFilter');
+		
+		$this->mXoopsCodePre =& new XCube_NewDelegate();
+		$this->mXoopsCodePre->register('MyTextSanitizer.XoopsCodePre');
+		
+		$this->mXoopsCodePostFilter =& new XCube_NewDelegate();
+		$this->mXoopsCodePostFilter->register('MyTextSanitizer.XoopsCodePostFilter');
     }
 
     /**
@@ -133,27 +163,22 @@
         $patterns = array("/(^|[^]_a-z0-9-=\"'\/])([a-z]+?):\/\/([^, \r\n\"\(\)'<>]+)/i", "/(^|[^]_a-z0-9-=\"'\/])www\.([a-z0-9\-]+)\.([^, \r\n\"\(\)'<>]+)/i", "/(^|[^]_a-z0-9-=\"'\/])ftp\.([a-z0-9\-]+)\.([^, \r\n\"\(\)'<>]+)/i", "/(^|[^]_a-z0-9-=\"'\/:\.])([a-z0-9\-_\.]+?)@([^, \r\n\"\(\)'<>\[\]]+)/i");
         $replacements = array("\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", "\\1<a href=\"http://www.\\2.\\3\" target=\"_blank\">www.\\2.\\3</a>", "\\1<a href=\"ftp://ftp.\\2.\\3\" target=\"_blank\">ftp.\\2.\\3</a>", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>");
 
-        // RaiseEvent 'Legacy.TextSanitizer.MakeClicablePre'
+        // RaiseEvent 'MyTextSanitizer.MakeClickablePre' ('Legacy.TextSanitizer.MakeClicablePre')
         //  Delegate may replace makeClickable conversion table
         //  varArgs : 
         //      'patterns'     [I/O] : &Array of pattern RegExp
         //      'replacements' [I/O] : &Array of replacing string
         //
-        if ($result =& XCube_EventUtils::quickRaiseEvent('Legacy.TextSanitizer.MakeClickablePre', 
-        												 array('patterns'=> &$patterns,
-        												       'replacements' => &$replacements))) {
-        	$patterns =& $result['patterns'];
-        	$replacements =& $result['replacements'];
-        }
+        $this->mMakeClickablePre->call(new XCube_Ref($patterns), new XCube_Ref($replacements));
 
         $text = preg_replace($patterns, $replacements, $text);
 
-        // RaiseEvent : 'Legacy.TextSanitizer.MakeClicablePostFilter' 
+        // RaiseEvent : 'MyTextSanitizer.MakeClickablePostFilter' ('Legacy.TextSanitizer.MakeClicablePostFilter')
         //  Delegate may convert output text with quickApplyFilter rule
         //  varArgs : 
         //      'string'       [I/O] : Text to convert;
         //
-        $text = XCube_EventUtils::quickApplyFilter('Legacy.TextSanitizer.MakeClickablePostFilter', $text);
+        $this->mMakeClickablePostFilter->call(new XCube_Ref($text));
 
         return $text;
     }
@@ -226,31 +251,24 @@
         $patterns[] = "/about:/si";
         $replacements[] = "about :";
 
-        // RaiseEvent 'Legacy.TextSanitizer.XoopsCodePre' 
+        // RaiseEvent 'MyTextSanitizer.XoopsCodePre' ('Legacy.TextSanitizer.XoopsCodePre')
         //  Delegate may replace conversion table
         //  varArgs : 
         //      'patterns'     [I/O] : &Array of pattern RegExp
         //      'replacements' [I/O] : &Array of replacing string
         //      'allowimage'   [I]   : xoopsCodeDecode $allowimage parameter
         //
-        if ($result =& XCube_EventUtils::quickRaiseEvent('Legacy.TextSanitizer.XoopsCodePre', 
-        												 array('patterns'=> &$patterns,
-        												       'replacements' => &$replacements,
-        												       'allowimage'=>$allowimage))) {
-        	$patterns =& $result['patterns'];
-        	$replacements =& $result['replacements'];
-        }
+        $this->mXoopsCodePre->call(new XCube_Ref($patterns), new XCube_Ref($replacements), $allowimage);
 
         $text = preg_replace($patterns, $replacements, $text);
         
-        // RaiseEvent : 'Legacy.TextSanitizer.XoopsCodePostFilter' 
+        // RaiseEvent : 'MyTextSanitizer.XoopsCodePostFilter' ('Legacy.TextSanitizer.XoopsCodePostFilter')
         //  Delegate may convert output text with quickApplyFilter rule
         //  varArgs : 
         //      'string'       [I/O] : Text to convert;
         //      'allowimage'   [I]   : xoopsCodeDecode $allowimage parameter
         //
-        $text = XCube_EventUtils::quickApplyFilter('Legacy.TextSanitizer.XoopsCodePostFilter', $text,
-        											array('allowimage'=>$allowimage));
+        $this->mXoopsCodePostFilter->call(new XCube_Ref($text), $allowimage);
 
         return $text;
     }


xoops-cvslog メーリングリストの案内
Back to archive index