cvs: pear /Pager Common.php package.xml

[email protected] ("Lorenzo Alberton")
Newsgroups php.pear.cvs
Message-ID <cvsquipo1208700447@cvsserver>
quipo		Sun Apr 20 14:07:27 2008 UTC

  Modified files:              
    /pear/Pager	Common.php package.xml 
  Log:
  request #13567: support for regexp in 'excludeVars' [thanks to Stefano Coletta]
  
http://cvs.php.net/viewvc.cgi/pear/Pager/Common.php?r1=1.79&r2=1.80&diff_format=u
Index: pear/Pager/Common.php
diff -u pear/Pager/Common.php:1.79 pear/Pager/Common.php:1.80
--- pear/Pager/Common.php:1.79	Sat Apr 19 16:52:56 2008
+++ pear/Pager/Common.php	Sun Apr 20 14:07:27 2008
@@ -33,7 +33,7 @@
  * @author    Richard Heyes <[email protected]>
  * @copyright 2003-2007 Lorenzo Alberton, Richard Heyes
  * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
- * @version   CVS: $Id: Common.php,v 1.79 2008/04/19 16:52:56 quipo Exp $
+ * @version   CVS: $Id: Common.php,v 1.80 2008/04/20 14:07:27 quipo Exp $
  * @link      http://pear.php.net/package/Pager
  */
 
@@ -969,6 +969,21 @@
     }
 
     // }}}
+    // {{{ _isRegexp()
+
+    /**
+     * Returns true if the string is a regexp pattern
+     *
+     * @param string $string the pattern to check
+     *
+     * @return boolean
+     * @access private
+     */
+    function _isRegexp($string) {
+        return preg_match('/^\/.*\/([Uims]+)?$/', $string);
+    }
+
+    // }}}
     // {{{ _getLinksData()
 
     /**
@@ -988,8 +1003,18 @@
             }
         }
         foreach ($this->_excludeVars as $exclude) {
-            if (array_key_exists($exclude, $qs)) {
-                unset($qs[$exclude]);
+            $use_preg = $this->_isRegexp($exclude);
+            foreach (array_keys($qs) as $qs_item) {
+                if ($use_preg) {
+                    if (preg_match($exclude, $qs_item, $matches)) {
+                        foreach ($matches as $m) {
+                            unset($qs[$m]);
+                        }
+                    }
+                } elseif ($qs_item == $exclude) {
+                    unset($qs[$qs_item]);
+                    break;
+                }
             }
         }
         if (count($this->_extraVars)) {
http://cvs.php.net/viewvc.cgi/pear/Pager/package.xml?r1=1.109&r2=1.110&diff_format=u
Index: pear/Pager/package.xml
diff -u pear/Pager/package.xml:1.109 pear/Pager/package.xml:1.110
--- pear/Pager/package.xml:1.109	Sat Apr 19 16:52:56 2008
+++ pear/Pager/package.xml	Sun Apr 20 14:07:27 2008
@@ -22,8 +22,8 @@
   <email>[email protected]</email>
   <active>no</active>
  </lead>
- <date>2008-04-19</date>
- <time>18:51:27</time>
+ <date>2008-04-20</date>
+ <time>16:05:27</time>
  <version>
   <release>2.4.7</release>
   <api>2.4.7</api>
@@ -34,6 +34,7 @@
  </stability>
  <license uri="http://www.debian.org/misc/bsd.license">BSD</license>
  <notes>- fixed bug #13604: WARNINGS with PHP 5.3-dev [thanks to Chris Troup]
+- request #13567: support for regexp in 'excludeVars' [thanks to Stefano Coletta]
  </notes>
  <contents>
   <dir name="/">
@@ -97,9 +98,10 @@
     <release>stable</release>
     <api>stable</api>
    </stability>
-   <date>2008-04-19</date>
+   <date>2008-04-20</date>
    <license uri="http://www.debian.org/misc/bsd.license">BSD</license>
    <notes>- fixed bug #13604: WARNINGS with PHP 5.3-dev [thanks to Chris Troup]
+- request #13567: support for regexp in 'excludeVars' [thanks to Stefano Coletta]
    </notes>
   </release>
   <release>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.