No current need for an alias to getPath()
[lhc/web/wiklou.git] / includes / Fallback.php
index 06dc9e7..81ca6ad 100644 (file)
@@ -76,7 +76,7 @@ class Fallback {
                                // This will cut out most of our slow time on Latin-based text,
                                // and 1/2 to 1/3 on East European and Asian scripts.
                                $bytePos = $splitPos;
-                               while ( $bytePos < $byteLen && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
+                               while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
                                        ++$bytePos;
                                }
                                $charPos = mb_strlen( substr( $str, 0, $bytePos ) );
@@ -88,7 +88,7 @@ class Fallback {
                        while( $charPos++ < $splitPos ) {
                                ++$bytePos;
                                // Move past any tail bytes
-                               while ( $bytePos < $byteLen && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
+                               while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
                                        ++$bytePos;
                                }
                        }
@@ -99,7 +99,7 @@ class Fallback {
                        while( $bytePos > 0 && $charPos-- >= $splitPosX ) {
                                --$bytePos;
                                // Move past any tail bytes
-                               while ( $bytePos > 0 && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
+                               while ( $bytePos > 0 && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
                                        --$bytePos;
                                }
                        }
@@ -173,5 +173,22 @@ class Fallback {
                        return false;
                }
        }
+
+       /**
+        * Fallback implementation of stream_resolve_include_path()
+        * Native stream_resolve_include_path is available for PHP 5 >= 5.3.2
+        * @param $filename String
+        * @return String
+        */
+       public static function stream_resolve_include_path( $filename ) {
+               $pathArray = explode( PATH_SEPARATOR, get_include_path() );
+               foreach ( $pathArray as $path ) {
+                       $fullFilename = $path . DIRECTORY_SEPARATOR . $filename;
+                       if ( file_exists( $fullFilename ) ) {
+                               return $fullFilename;
+                       }
+               }
+               return false;
+       }
                
-}
\ No newline at end of file
+}