default
[ class tree: default ] [ index: default ] [ all elements ]

Class: RSFile

Source Location: /RSFile.php

Class Overview


Simple rapidshare file checker class.


Author(s):

  • Alex

Version:

  • v1.0

Implements interfaces:

  • Iterator (internal interface)

Variables

Constants

Methods



Class Details

[line 19]
Simple rapidshare file checker class.

Simple rapidshare file checker class. Usage: $files = RSFile::getInstance($id1, $name1); $files = RSFile::getInstance($id2, $name2); $files->processFiles(); if ($files->getStatus() === RSFile::STATUS_FILE_OK) { echo $files->getSize(RSFile::SIZE_MB); echo $files->getDownloadMirror(); }




Tags:

author:  Alex
version:  v1.0


[ Top ]


Class Variables

static $calls =  0

[line 135]

We use this simple variable to know if more than MAX_SERVER_CALLS calls are made to the rapidshare server, you should never make more than one call to processFiles() function that connects to the rapidshare servers.

We use this simple variable to know if more than MAX_SERVER_CALLS calls are made to the rapidshare server, you should never make more than one call to processFiles() function that connects to the rapidshare servers.




Tags:

access:  private

Type:   integer


[ Top ]

static $instances = array()

[line 141]

The list of instances of this class

The list of instances of this class




Tags:

access:  private

Type:   object


[ Top ]

$_errno =  null

[line 85]

Stores the latest error number (if any)

Stores the latest error number (if any)




Tags:

access:  private

Type:   string


[ Top ]

$_error =  null

[line 79]

Stores the latest error (if any)

Stores the latest error (if any)




Tags:

access:  private

Type:   string


[ Top ]

$_id =

[line 91]

Stores the current file id

Stores the current file id




Tags:

access:  private

Type:   string


[ Top ]

$_md5sum =

[line 127]

Stores the md5sum of the current file

Stores the md5sum of the current file




Tags:

access:  private

Type:   string


[ Top ]

$_name =

[line 97]

Stores the current file name

Stores the current file name




Tags:

access:  private

Type:   string


[ Top ]

$_serverId =

[line 109]

Stores the server id for the current file

Stores the server id for the current file




Tags:

access:  private

Type:   integer


[ Top ]

$_shortHost =

[line 121]

Stores the short host for the current file

Stores the short host for the current file




Tags:

access:  private

Type:   string


[ Top ]

$_size =

[line 103]

Stores the current file size in bytes

Stores the current file size in bytes




Tags:

access:  private

Type:   integer


[ Top ]

$_status =

[line 115]

Stores the status for the current file

Stores the status for the current file




Tags:

access:  private

Type:   integer


[ Top ]



Class Methods


static method getInstance [line 159]

static object getInstance( string $id, string $name)

Returns only one instance of this class per id/name

Returns only one instance of this class per id/name




Tags:

access:  public


Parameters:

string   $id   File id on rapidshare servers
string   $name   File name on rapidshare servers

[ Top ]

constructor __construct [line 146]

RSFile __construct( $id, $name)

Private constructor

Private constructor




Tags:

access:  private


Parameters:

   $id  
   $name  

[ Top ]

method current [line 421]

void current( )

Implementing Iterator

Implementing Iterator




Tags:

access:  public



Implementation of:
Iterator::current
[ Top ]

method errno [line 400]

string errno( )

Returns the last error number.

Returns the last error number.




Tags:

access:  public


[ Top ]

method error [line 392]

string error( )

Returns the last error description.

Returns the last error description.




Tags:

access:  public


[ Top ]

method getDownloadMirror [line 259]

mixed getDownloadMirror( )

Returns the best download mirror for the current file or null if the

Returns the best download mirror for the current file or null if the file status is not equal to 1




Tags:

access:  public


[ Top ]

method getFileId [line 188]

string getFileId( )

Returns the id for the current file

Returns the id for the current file




Tags:

access:  public


[ Top ]

method getFileName [line 196]

string getFileName( )

Returns the name of the current file

Returns the name of the current file




Tags:

access:  public


[ Top ]

method getFileSize [line 207]

float getFileSize( [string $format = self::SIZE_B], [int $precision = 2])

Returns the size of the current file

Returns the size of the current file




Tags:

return:  The file size changed in the desired format.
access:  public


Parameters:

string   $format   Use one of the defined SIZE_* constants
int   $precision   Precision for round function

[ Top ]

method getFileStatus [line 240]

integer. getFileStatus( )

Returns the status of the current file

Returns the status of the current file




Tags:

access:  public


[ Top ]

method getMd5sum [line 279]

string getMd5sum( )

Returns the md5sum of the current file

Returns the md5sum of the current file




Tags:

access:  public


[ Top ]

method getServerId [line 232]

integer getServerId( )

Returns the server id where the file is hosted.

Returns the server id where the file is hosted.




Tags:

access:  public


[ Top ]

method getShortHost [line 249]

string. getShortHost( )

Returns the short host for the current file, is used to get the best download mirror.

Returns the short host for the current file, is used to get the best download mirror.




Tags:

access:  public


[ Top ]

method implodeObjs [line 291]

void implodeObjs( string $glue, object $objs, string $callback)

Simple implode function but works with multiton objects.

Simple implode function but works with multiton objects.




Tags:

access:  public


Parameters:

string   $glue   String separator
object   $objs   Instance of class implementing Iterator interface
string   $callback   Object method used to get the string for concatenation

[ Top ]

method key [line 425]

void key( )



Tags:

access:  public



Implementation of:
Iterator::key
[ Top ]

method next [line 429]

void next( )



Tags:

access:  public



Implementation of:
Iterator::next
[ Top ]

method processFiles [line 318]

boolean processFiles( )

This function must be called only after every file is already created.

This function must be called only after every file is already created. e.g. $files = RSFile::getInstance(id1, name1)->getInstance(id2, name2)... $files->processFiles(); foreach($files as $file) $file->getFileSize() ...




Tags:

return:  true on success and false otherwise.
access:  public


[ Top ]

method rewind [line 433]

void rewind( )



Tags:

access:  public



Implementation of:
Iterator::rewind
[ Top ]

method unsetInstance [line 174]

void unsetInstance( string $id, $name)

Removes the instance.

Removes the instance.




Tags:

access:  public


Parameters:

string   $id  
   $name  

[ Top ]

method valid [line 437]

void valid( )



Tags:

access:  public



Implementation of:
Iterator::valid
[ Top ]

method __clone [line 414]

void __clone( )

No cloning allowed

No cloning allowed




Tags:

access:  public


[ Top ]

method __sleep [line 407]

void __sleep( )

No serialization allowed

No serialization allowed




Tags:

access:  public


[ Top ]


Class Constants

MAX_SERVER_CALLS =  3

[line 73]

The maximum number of calls to the rapidshare servers.

The maximum number of calls to the rapidshare servers.



[ Top ]

SIZE_B =  'b'

[line 49]

Format file size to bytes (by default).

Format file size to bytes (by default).



[ Top ]

SIZE_GB =  'gb'

[line 67]

Format file size to gigabytes

Format file size to gigabytes



[ Top ]

SIZE_KB =  'kb'

[line 55]

Format file size to kilobytes

Format file size to kilobytes



[ Top ]

SIZE_MB =  'mb'

[line 61]

Format file size to megabytes

Format file size to megabytes



[ Top ]

STATUS_FILE_NOT_FOUND =  0

[line 25]

The file was not found on the rapidshare servers.

The file was not found on the rapidshare servers.



[ Top ]

STATUS_FILE_OK =  1

[line 31]

File was found and everything is OK.

File was found and everything is OK.



[ Top ]

STATUS_ILLEGAL_FILE =  4

[line 43]

The file was marked as illegal.

The file was marked as illegal.



[ Top ]

STATUS_SERVER_DOWN =  3

[line 37]

The rapidshare server is down.

The rapidshare server is down.



[ Top ]



Documentation generated on Wed, 22 Feb 2012 12:18:08 +0100 by phpDocumentor 1.4.3