ZenphotoCMS 1.6.2

downloadList.php

A plugin to generate a file download list.

This download folder can be relative to your Zenphoto root (foldername) or external to it (../foldername). By default the %UPLOAD_FOLDER% folder is chosen so you can use the file manager to manage these files.

You can also override that folder by using the printdownloadList() function parameters directly. Additionally you can set a downloadlink to a specific file directly by using printDownloadURL(path-to-file);.

The file names and the download path of the items are stored with the number of downloads in the database's plugin_storage table.

The download link is something like: www.yourdomain.com/download.php?file=id number of the download.

So the actual download source is not public. The list itself is generated directly from the file system. However, files which no longer exist are kept in the database for statistical reasons until you clear them manually via the statistics utility.

You will need to modify your theme to use this plugin. You can use the codeblock fields if your theme supports them or insert the function calls directly where you want the list to appear.

To protect the download directory from direct linking you need to set up a proper .htaccess for this folder.

The printDownloadAlbumZipURL() function will create a zipfile of the album on the fly. The source of the images may be the original images from the album and its subalbums or they may be the sized images from the cache. Use the latter if you want the images to be watermarked.

The list has a CSS class downloadList attached.

Tags
author

Malte Müller (acrylian), Stephen Billard (sbillard), , Antonio Ranesi (bic)

tags

"file download", "download manager", download

Table of Contents

Classes

DownloadList
Plugin option handling class
AlbumZip

Functions

printdownloadList()  : mixed
Prints the actual download list included all subfolders and files
getdownloadList()  : array<string|int, mixed>
Gets the actual download list included all subfolders and files
getDownloadURL()  : mixed
Gets the download url for a file
printDownloadURL()  : mixed
Prints a download link for a file, depending on the plugin options including the downloadcount and filesize
printFullImageDownloadURL()  : mixed
Prints the dwnload url link for a full image
printDownloadAlbumZipURL()  : mixed
Prints a download link for an album zip of the current album (therefore to be used only on album.php/image.php).

Functions

printdownloadList()

Prints the actual download list included all subfolders and files

printdownloadList([string $dir = '' ][, string $listtype = 'ol' ][, array<string|int, mixed> $filters = array() ][, array<string|int, mixed> $excludesuffixes = '' ][, string $sort = 'desc' ]) : mixed
Parameters
$dir : string = ''

An optional different folder to generate the list that overrides the folder set on the option.

$listtype : string = 'ol'

"ol" or "ul" for the type of HTML list you want to use

$filters : array<string|int, mixed> = array()

an array of files to exclude from the list. Standard items are Array( '.', '..','.DS_Store','Thumbs.db','.htaccess','.svn')

$excludesuffixes : array<string|int, mixed> = ''

an array of file suffixes (without trailing dot to exclude from the list (e.g. "jpg")

$sort : string = 'desc'

'asc" or "desc" (default) for alphabetical ascending or descending list

getdownloadList()

Gets the actual download list included all subfolders and files

getdownloadList(string $dir8, array<string|int, mixed> $filters8, array<string|int, mixed> $excludesuffixes, string $sort) : array<string|int, mixed>
Parameters
$dir8 : string

An optional different folder to generate the list that overrides the folder set on the option. This could be a subfolder of the main download folder set on the plugin's options. You have to include the base directory as like this: "folder" or "folder/subfolder" or "../folder" You can also set any folder within or without the root of your Zenphoto installation as a download folder with this directly

$filters8 : array<string|int, mixed>

an array of files to exclude from the list. Standard items are '.', '..','.DS_Store','Thumbs.db','.htaccess','.svn'

$excludesuffixes : array<string|int, mixed>

an array of file suffixes (without trailing dot to exclude from the list (e.g. "jpg")

$sort : string

'asc" or "desc" (default) for alphabetical ascending or descending list

Return values
array<string|int, mixed>

getDownloadURL()

Gets the download url for a file

getDownloadURL(string $file) : mixed
Parameters
$file : string

the path to a file to get a download link.

printDownloadURL()

Prints a download link for a file, depending on the plugin options including the downloadcount and filesize

printDownloadURL(string $file[, string $linktext = NULL ]) : mixed
Parameters
$file : string

the path to a file to print a download link.

$linktext : string = NULL

Optionally how you wish to call the link. Set/leave to NULL to use the filename.

printFullImageDownloadURL()

Prints the dwnload url link for a full image

printFullImageDownloadURL([string $linktext = null ][, obj $imageobj = null ]) : mixed
Parameters
$linktext : string = null

Linktext for the download

$imageobj : obj = null

Optional image object to use, otherwise the current image if available

Tags
since
1.5.7
global

type $_zp_current_image

printDownloadAlbumZipURL()

Prints a download link for an album zip of the current album (therefore to be used only on album.php/image.php).

printDownloadAlbumZipURL([string $linktext = NULL ][, object $albumobj = NULL ][, bool $fromcache = NULL ]) : mixed

This function only creates a download count and then redirects to the original Zenphoto album zip download.

Parameters
$linktext : string = NULL
$albumobj : object = NULL
$fromcache : bool = NULL

if true get the images from the cache


        
On this page

Search results