PHP Class MOBI, phpMobi

Usage: include("MOBIClass/MOBI.php"); $mobi = new MOBI(); Then use one of the following ways to prepare information (it should be in the form of valid html) $mobi->setInternetSource($url); //Load URL, the result will be cleaned using a Readability port $mobi->setFileSource($file); //Load a local file without any extra changes $mobi->setData($data); //Load data If you want, you can set some optional settings (see Settings.php for all recognized settings) $options = array( "title"=>"Insert title here", "author"=>"Author" ); $mobi->setOptions($options); Then there are two ways to output it: $mobi->save($file); //Save the file locally $mobi->download($name); //Let the client download the file, make sure the page that calls it doesn't output anything, otherwise it might conflict with the download. $name contains the file name, usually something like "title.mobi" (where the title should be cleaned so as not to contain illegal characters).
Author: Sander Kromwijk
Afficher le fichier Open project: raiju/phpMobi Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( )
download ( string $name ) Let the client download the file. Warning! No data should be outputted before or after.
getTitle ( )
save ( string $filename ) Save the file locally
setContentProvider ( ContentProvider $content ) Set a content provider as source
setData ( string $data ) Set the data to use
setFileSource ( string $file ) Set a local file as source
setImages ( array $data ) Set the images to use
setOptions ( array $options ) Set options, usually for things like titles, authors, etc.

Private Methods

Méthode Description
preparePRC ( ) : Prc Prepare the prc file

Method Details

__construct() public méthode

public __construct ( )

download() public méthode

Let the client download the file. Warning! No data should be outputted before or after.
public download ( string $name )
$name string Name used for download, usually "title.mobi"

getTitle() public méthode

public getTitle ( )

save() public méthode

Save the file locally
public save ( string $filename )
$filename string Path to save the file

setContentProvider() public méthode

Set a content provider as source
public setContentProvider ( ContentProvider $content )
$content ContentProvider Content Provider to use

setData() public méthode

Set the data to use
public setData ( string $data )
$data string Data to put in the file

setFileSource() public méthode

Set a local file as source
public setFileSource ( string $file )
$file string Path to the file

setImages() public méthode

Set the images to use
public setImages ( array $data )
$data array Data to put in the file

setOptions() public méthode

..
public setOptions ( array $options )
$options array Options to set