]> git.andy128k.dev Git - ipf.git/commitdiff
IPF_Utils::TrimP()
authoravl <alex.litovchenko@gmail.com>
Thu, 12 Feb 2009 19:54:50 +0000 (21:54 +0200)
committeravl <alex.litovchenko@gmail.com>
Thu, 12 Feb 2009 19:54:50 +0000 (21:54 +0200)
ipf/utils.php

index 2ed6b64e10df8d2466ab79d3a396f9603e1882db..fb71f24b62327632af8347283e8fd5806a249652 100644 (file)
@@ -223,5 +223,17 @@ class IPF_Utils {
                list($f,$i) = split(' ',microtime());
                return $i.substr((string)$f,2,6);
     }
+
+    static function TrimP($html)
+    {
+        $strL = "<p>";  $lenL = 3;
+        $strR = "</p>"; $lenR = 4;
+        if (0 == strcasecmp(substr($html, 0, $lenL), $strL)
+        &&  0 == strcasecmp(substr($html, -$lenR), $strR)){
+            return substr($html, $lenL, strlen($html) - ($lenL + $lenR));
+        }
+        return $html;
+    }
+
 }