[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/ -> TAssetManager.php (sommaire)

TAssetManager class

Author: Qiang Xue <qiang.xue@gmail.com>
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TAssetManager.php 1546 2006-12-03 22:44:38Z wei $
Poids: 331 lignes (11 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

TAssetManager:: (13 méthodes):
  init()
  getBasePath()
  setBasePath()
  getBaseUrl()
  setBaseUrl()
  publishFilePath()
  getPublishedPath()
  getPublishedUrl()
  hash()
  copyFile()
  copyDirectory()
  publishTarFile()
  deployTarFile()


Classe: TAssetManager  - X-Ref

TAssetManager class

TAssetManager provides a scheme to allow web clients visiting
private files that are normally web-inaccessible.

TAssetManager will copy the file to be published into a web-accessible
directory. The default base directory for storing the file is "assets", which
should be under the application directory. This can be changed by setting
the {@link setBasePath BasePath} property together with the
{@link setBaseUrl BaseUrl} property that refers to the URL for accessing the base path.

By default, TAssetManager will not publish a file or directory if it already
exists in the publishing directory and has an older modification time.
If the application mode is set as 'Performance', the modification time check
will be skipped. You can explicitly require a modification time check
with the function {@link publishFilePath}. This is usually
very useful during development.

TAssetManager may be configured in application configuration file as follows,
<code>
<module id="asset" BasePath="Application.assets" BaseUrl="/assets" />
</code>
where {@link getBasePath BasePath} and {@link getBaseUrl BaseUrl} are
configurable properties of TAssetManager. Make sure that BasePath is a namespace
pointing to a valid directory writable by the Web server process.

init($config)   X-Ref
Initializes the module.
This method is required by IModule and is invoked by application.

param: TXmlElement module configuration

getBasePath()   X-Ref

return: string the root directory storing published asset files

setBasePath($value)   X-Ref
Sets the root directory storing published asset files.
The directory must be in namespace format.

param: string the root directory storing published asset files

getBaseUrl()   X-Ref

return: string the base url that the published asset files can be accessed

setBaseUrl($value)   X-Ref

param: string the base url that the published asset files can be accessed

publishFilePath($path,$checkTimestamp=false)   X-Ref
Publishes a file or a directory (recursively).
This method will copy the content in a directory (recursively) to
a web accessible directory and returns the URL for the directory.
If the application is not in performance mode, the file modification
time will be used to make sure the published file is latest or not.
If not, a file copy will be performed.

param: string the path to be published
param: boolean If true, file modification time will be checked even if the application
return: string an absolute URL to the published directory

getPublishedPath($path)   X-Ref
Returns the published path of a file path.
This method does not perform any publishing. It merely tells you
if the file path is published, where it will go.

param: string directory or file path being published
return: string the published file path

getPublishedUrl($path)   X-Ref
Returns the URL of a published file path.
This method does not perform any publishing. It merely tells you
if the file path is published, what the URL will be to access it.

param: string directory or file path being published
return: string the published URL for the file path

hash($dir)   X-Ref
Generate a CRC32 hash for the directory path. Collisions are higher
than MD5 but generates a much smaller hash string.

param: string string to be hashed.
return: string hashed string.

copyFile($src,$dst)   X-Ref
Copies a file to a directory.
Copying is done only when the destination file does not exist
or has an older file modification time.

param: string source file path
param: string destination directory (if not exists, it will be created)

copyDirectory($src,$dst)   X-Ref
Copies a directory recursively as another.
If the destination directory does not exist, it will be created.
File modification time is used to ensure the copied files are latest.

param: string the source directory
param: string the destination directory

publishTarFile($tarfile, $md5sum, $checkTimestamp=false)   X-Ref
Publish a tar file by extracting its contents to the assets directory.
Each tar file must be accomplished with its own MD5 check sum file.
The MD5 file is published when the tar contents are successfully
extracted to the assets directory. The presence of the MD5 file
as published asset assumes that the tar file has already been extracted.

param: string tar filename
param: string MD5 checksum for the corresponding tar file.
return: string URL path to the directory where the tar file was extracted.

deployTarFile($path,$destination)   X-Ref
Extracts the tar file to the destination directory.
N.B Tar file must not be compressed.

param: string tar file
param: string path where the contents of tar file are to be extracted
return: boolean true if extract successful, false otherwise.



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7