ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFilePreviewRenderer Class Reference

Abstract parent class for all file preview renderer classes. More...

+ Inheritance diagram for ilFilePreviewRenderer:
+ Collaboration diagram for ilFilePreviewRenderer:

Public Member Functions

 getSupportedRepositoryTypes ()
 Gets an array containing the repository types (e.g.
 supports ($preview)
 Determines whether the specified preview object is supported by the renderer.
 prepareFileForExec ($filepath)
 Checks whether the specified file path can be used with exec() commands.
 getSupportedFileFormats ()
 Gets an array containing the file formats that are supported by the renderer.
- Public Member Functions inherited from ilPreviewRenderer
 getName ()
 Gets the name of the renderer.
 isPlugin ()
 Determines whether the renderer is a plugin or a built in one.
 render ($preview, $obj, $async)
 Creates the preview of the specified preview object.

Additional Inherited Members

- Protected Member Functions inherited from ilPreviewRenderer
 renderImages ($obj)
 Renders the specified object into images.
 getImageSize ()
 Gets the size of the preview images in pixels.
 getImageQuality ()
 Gets the quality (compression) of the preview images (1-100).
 getMaximumNumberOfPreviews ()
 Gets the maximum number of preview pictures per object.

Detailed Description

Abstract parent class for all file preview renderer classes.

Author
Stefan Born stefa.nosp@m.n.bo.nosp@m.rn@ph.nosp@m.zh.c.nosp@m.h
Version
$Id$

Definition at line 14 of file class.ilFilePreviewRenderer.php.

Member Function Documentation

ilFilePreviewRenderer::getSupportedFileFormats ( )
abstract

Gets an array containing the file formats that are supported by the renderer.

Returns
array An array containing the supported file formats.

Reimplemented in ilGhostscriptRenderer, and ilImageMagickRenderer.

Referenced by supports().

+ Here is the caller graph for this function:

ilFilePreviewRenderer::getSupportedRepositoryTypes ( )
final

Gets an array containing the repository types (e.g.

'file' or 'crs') that are supported by the renderer.

Returns
array An array containing the supported repository types.

Reimplemented from ilPreviewRenderer.

Definition at line 21 of file class.ilFilePreviewRenderer.php.

{
return array("file");
}
ilFilePreviewRenderer::prepareFileForExec (   $filepath)

Checks whether the specified file path can be used with exec() commands.

If the file name is not conform with exec() commands, a temporary file is created and the path to that file is returned.

Parameters
string$filepathThe path of the file to check.
Returns
string The specified file path if conform with exec(); otherwise, the path to a temporary copy of the file.

Definition at line 56 of file class.ilFilePreviewRenderer.php.

References ilUtil\ilTempnam().

Referenced by ilGhostscriptRenderer\renderImages(), and ilImageMagickRenderer\renderImages().

{
$pos = strrpos($filepath, "/");
$name = $pos !== false ? substr($filepath, $pos + 1) : $filepath;
// if the file path contains any characters that could cause problems
// we copy the file to a temporary file
$normName = preg_replace("/[^A-Za-z0-9.\- +_&]/", "", $name);
if ($normName != $name)
{
$tempPath = ilUtil::ilTempnam();
if (copy($filepath, $tempPath))
return $tempPath;
}
return $filepath;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFilePreviewRenderer::supports (   $preview)

Determines whether the specified preview object is supported by the renderer.

Parameters
ilPreview$previewThe preview object to check.
Returns
bool true, if the renderer supports the specified preview object; otherwise, false.

Reimplemented from ilPreviewRenderer.

Definition at line 32 of file class.ilFilePreviewRenderer.php.

References $filename, $preview, ilObjFileAccess\_getFileExtension(), ilObjFile\_lookupFileName(), and getSupportedFileFormats().

{
// let parent check first
if (!parent::supports($preview))
return false;
// get file extension
require_once("./Modules/File/classes/class.ilObjFile.php");
include_once './Modules/File/classes/class.ilObjFileAccess.php';
// contains that extension?
return in_array($ext, $this->getSupportedFileFormats());
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: