Class HabariSilo

Description

Implements interfaces:

Simple file access silo

  • version: $Id$
  • copyright: 2008
  • todo: Create some helper functions in a superclass to display panel controls more easily, so that you don't need to include 80 lines of code to build a simple upload form every time.

Located in /system/plugins/habarisilo/habarisilo.plugin.php (line 9)

Pluggable
   |
   --Plugin
      |
      --HabariSilo
Class Constant Summary
 DERIV_DIR = '.deriv'
 SILO_NAME = 'Habari'
Variable Summary
mixed $root
mixed $url
Method Summary
void action_init ()
array filter_media_controls (array $controls, MediaSilo $silo, string $path, string $panelname)
string filter_media_panels (string $panel, MediaSilo $silo, string $path, string $panelname)
void info ()
string link_panel (string $path,  $panel, string $title)
string link_path (string $path, [string $title = ''])
void mkdir ( $form,  $panel,  $silo,  $path)
void mkdir_success (FormUI $form)
void mkdir_validator ($dir $dir, $control $control, $form $form)
void silo_delete (string $path)
array silo_dir (string $path)
MediaAsset silo_get (string $path, [array $qualities = null])
array silo_highlights ()
void silo_info ()
MediaAsset silo_new (string $path)
array silo_permissions (string $path)
boolean silo_put (string $path, MediaAsset $filedata)
Variables
mixed $root = null (line 11)
  • access: protected
mixed $url = null (line 12)
  • access: protected

Inherited Variables

Inherited from Pluggable

Pluggable::$info
Pluggable::$plugin_id
Methods
action_init (line 38)

Initialize some internal values when plugin initializes

  • access: public
void action_init ()
filter_media_controls (line 336)

Provide controls for the media control bar

  • return: The altered $controls array with new (or removed) controls
  • todo: This should really use FormUI, but FormUI needs a way to submit forms via ajax
  • access: public
array filter_media_controls (array $controls, MediaSilo $silo, string $path, string $panelname)
  • array $controls: Incoming controls from other plugins
  • MediaSilo $silo: An instance of a MediaSilo
  • string $path: The path to get controls for
  • string $panelname: The name of the requested panel, if none then emptystring
filter_media_panels (line 371)

Provide requested media panels for this plugin

Regarding Uploading: A panel is returned to the media bar that contains a form, an iframe, and a javascript function. The form allows the user to select a file, and is submitted back to the same URL that produced this panel in the first place. This has the result of submitting the uploaded file to here when the form is submitted. To prevent the panel form from reloading the whole publishing page, the form is submitted into the iframe. An onload event attached to the iframe calls the function. The function accesses the content of the iframe when it loads, which should contain the results of the request to obtain this panel, which are in JSON format. The JSON data is passed to the habari.media.jsonpanel() function in media.js to process the data and display the results, just like when displaying a panel normally.

  • return: The modified $panel to contain the HTML output for the requested panel
  • todo: Move the uploaded file from the temporary location to the location indicated by the path field.
  • access: public
string filter_media_panels (string $panel, MediaSilo $silo, string $path, string $panelname)
  • string $panel: The HTML content of the panel to be output in the media bar
  • MediaSilo $silo: The silo for which the panel was requested
  • string $path: The path within the silo (silo root omitted) for which the panel was requested
  • string $panelname: The name of the requested panel
info (line 21)

Provide plugin info to the system

  • access: public
void info ()

Redefinition of:
Plugin::info()
Returns information about this plugin
link_panel (line 320)

Produce a link for the media control bar that causes a specific panel to be displayed

  • return: The link to create
  • access: public
string link_panel (string $path,  $panel, string $title)
  • string $path: The panel to display
  • string $title: The text to use for the link in the control bar
  • $panel
link_path (line 304)

Produce a link for the media control bar that causes a specific path to be displayed

  • return: The link to create
  • access: public
string link_path (string $path, [string $title = ''])
  • string $path: The path to display
  • string $title: The text to use for the link in the control bar
mkdir (line 449)
  • access: public
void mkdir ( $form,  $panel,  $silo,  $path)
  • $form
  • $panel
  • $silo
  • $path
mkdir_success (line 485)

This function performs the mkdir action on submission of the form. It is called by FormUI's success() method.

  • access: public
void mkdir_success (FormUI $form)
mkdir_validator (line 465)

A validator for the mkdir form created with FormUI. Checks to see if the webserver can write to the parent directory and that the directory does not already exist.

  • access: public
void mkdir_validator ($dir $dir, $control $control, $form $form)
  • $dir $dir: The input from the form
  • $control $control: The FormControl object
  • $form $form: The FormUI object
silo_delete (line 275)

Delete the file at the specified path

  • access: public
void silo_delete (string $path)
  • string $path: The path of the file to retrieve

Implementation of:
MediaSilo::silo_delete()
Delete the file at the specified path
silo_dir (line 88)

Return directory contents for the silo path

  • return: An array of MediaAssets describing the contents of the directory
  • access: public
array silo_dir (string $path)
  • string $path: The path to retrieve the contents of

Implementation of:
MediaSilo::silo_dir()
Return directory contents for the silo path
silo_get (line 148)

Get the file from the specified path

  • return: The requested asset
  • access: public
MediaAsset silo_get (string $path, [array $qualities = null])
  • string $path: The path of the file to retrieve
  • array $qualities: Qualities that specify the version of the file to retrieve.

Implementation of:
MediaSilo::silo_get()
Get the file from the specified path
silo_highlights (line 284)

Retrieve a set of highlights from this silo

This would include things like recently uploaded assets, or top downloads

  • return: An array of MediaAssets to highlihgt from this silo
  • access: public
array silo_highlights ()

Implementation of:
MediaSilo::silo_highlights()
Retrieve a set of highlights from this silo
silo_info (line 75)

Return basic information about this silo

name- The name of the silo, used as the root directory for media in this silo

  • access: public
void silo_info ()

Implementation of:
MediaSilo::silo_info()
Return basic information about this silo
silo_new (line 253)

Create a new asset instance for the specified path

  • return: The requested asset
  • access: public
MediaAsset silo_new (string $path)
  • string $path: The path of the new file to create
silo_permissions (line 293)

Retrieve the permissions for the current user to access the specified path

  • return: An array of permissions constants (MediaSilo::PERM_READ, MediaSilo::PERM_WRITE)
  • access: public
array silo_permissions (string $path)
  • string $path: The path to retrieve permissions for

Implementation of:
MediaSilo::silo_permissions()
Retrieve the permissions for the current user to access the specified path
silo_put (line 263)

Store the specified media at the specified path

  • return: True on success
  • access: public
boolean silo_put (string $path, MediaAsset $filedata)
  • string $path: The path of the file to retrieve
  • MediaAsset $filedata: The MediaAsset to store

Implementation of:
MediaSilo::silo_put()
Store the specified media at the specified path

Inherited Methods

Inherited From Plugin

Plugin::__construct()
Plugin::add_template()
Plugin::info()
Plugin::_plugin_available_templates()
Plugin::_plugin_include_template_file()

Inherited From Pluggable

Pluggable::__construct()
Pluggable::get_db_schema()
Pluggable::get_file()
Pluggable::get_url()
Pluggable::load()
Pluggable::load_text_domain()
Pluggable::plugin_id()
Class Constants
DERIV_DIR = '.deriv' (line 16)
SILO_NAME = 'Habari' (line 14)

Documentation generated on Thu, 30 Oct 2008 20:31:17 +0100 by phpDocumentor 1.3.2