Convert a few call_user_func*() calls to native PHP syntax
[lhc/web/wiklou.git] / includes / filerepo / file / File.php
index 6d01c29..c3b5199 100644 (file)
@@ -207,7 +207,7 @@ abstract class File implements IDBAccessObject {
                if ( !is_callable( $function ) ) {
                        return null;
                } else {
-                       $this->$name = call_user_func( $function );
+                       $this->$name = $function();
 
                        return $this->$name;
                }
@@ -1543,7 +1543,7 @@ abstract class File implements IDBAccessObject {
        function getArchiveRel( $suffix = false ) {
                $path = 'archive/' . $this->getHashPath();
                if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
+                       $path = rtrim( $path, '/' );
                } else {
                        $path .= $suffix;
                }
@@ -1586,11 +1586,9 @@ abstract class File implements IDBAccessObject {
         * @return string
         */
        function getArchiveThumbRel( $archiveName, $suffix = false ) {
-               $path = 'archive/' . $this->getHashPath() . $archiveName . "/";
-               if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
-               } else {
-                       $path .= $suffix;
+               $path = $this->getArchiveRel( $archiveName );
+               if ( $suffix !== false ) {
+                       $path .= '/' . $suffix;
                }
 
                return $path;
@@ -1657,7 +1655,7 @@ abstract class File implements IDBAccessObject {
                $ext = $this->getExtension();
                $path = $this->repo->getZoneUrl( 'public', $ext ) . '/archive/' . $this->getHashPath();
                if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
+                       $path = rtrim( $path, '/' );
                } else {
                        $path .= rawurlencode( $suffix );
                }
@@ -1676,11 +1674,9 @@ abstract class File implements IDBAccessObject {
                $this->assertRepoDefined();
                $ext = $this->getExtension();
                $path = $this->repo->getZoneUrl( 'thumb', $ext ) . '/archive/' .
-                       $this->getHashPath() . rawurlencode( $archiveName ) . "/";
-               if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
-               } else {
-                       $path .= rawurlencode( $suffix );
+                       $this->getHashPath() . rawurlencode( $archiveName );
+               if ( $suffix !== false ) {
+                       $path .= '/' . rawurlencode( $suffix );
                }
 
                return $path;
@@ -1750,7 +1746,7 @@ abstract class File implements IDBAccessObject {
                $this->assertRepoDefined();
                $path = $this->repo->getVirtualUrl() . '/public/archive/' . $this->getHashPath();
                if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
+                       $path = rtrim( $path, '/' );
                } else {
                        $path .= rawurlencode( $suffix );
                }
@@ -2023,7 +2019,7 @@ abstract class File implements IDBAccessObject {
         * @note Use getWidth()/getHeight() instead of this method unless you have a
         *  a good reason. This method skips all caches.
         *
-        * @param string $filePath The path to the file (e.g. From getLocalPathRef() )
+        * @param string $filePath The path to the file (e.g. From getLocalRefPath() )
         * @return array|false The width, followed by height, with optionally more things after
         */
        function getImageSize( $filePath ) {