Public Member Functions | Public Attributes | Protected Attributes

HabariSilo Class Reference

Inheritance diagram for HabariSilo:
Collaboration diagram for HabariSilo:

List of all members.

Public Member Functions

 action_init ()
 filter_activate_plugin ($ok, $file)
 action_plugin_activation ($file)
 filter_plugin_config ($actions)
 action_plugin_ui_configure ()
 filter_token_description_display ($token)
 action_plugin_deactivation ($file)
 silo_info ()
 silo_dir ($path)
 silo_get ($path, $qualities=null)
 silo_new ($path)
 silo_put ($path, $filedata)
 silo_delete ($path)
 silo_highlights ()
 silo_permissions ($path)
 link_path ($path, $title= '')
 link_panel ($path, $panel, $title)
 filter_media_controls ($controls, $silo, $path, $panelname)
 filter_media_panels ($panel, $silo, $path, $panelname)
 mkdir_validator ($dir, $control, $form)
 dir_success ($form)
 do_delete ($form)

Public Attributes

const SILO_NAME = 'Habari'
const DERIV_DIR = '.deriv'

Protected Attributes

 $root = null
 $url = null

Detailed Description

Simple file access silo

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.

Definition at line 13 of file habarisilo.plugin.php.


Member Function Documentation

HabariSilo::action_init (  ) 

Initialize some internal values when plugin initializes

Definition at line 25 of file habarisilo.plugin.php.

HabariSilo::action_plugin_deactivation ( file  ) 
Parameters:
string $file. The name of the plugin file

Delete the special silo permissions if they're no longer being used.

Definition at line 105 of file habarisilo.plugin.php.

HabariSilo::dir_success ( form  ) 

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

Parameters:
FormUI $form

Definition at line 673 of file habarisilo.plugin.php.

HabariSilo::do_delete ( form  ) 

This function takes the path passed from the form and passes it to silo_delete to delete the file and it's thumbnail if it's an image.

Parameters:
FormUI $form

Definition at line 700 of file habarisilo.plugin.php.

HabariSilo::filter_media_controls ( controls,
silo,
path,
panelname 
)

Provide controls for the media control bar

Parameters:
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
Returns:
array 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

Definition at line 470 of file habarisilo.plugin.php.

HabariSilo::filter_media_panels ( panel,
silo,
path,
panelname 
)

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.

Parameters:
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
Returns:
string 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.

Definition at line 508 of file habarisilo.plugin.php.

HabariSilo::filter_plugin_config ( actions  ) 

function filter_plugin_config Add configuration options

Definition at line 63 of file habarisilo.plugin.php.

HabariSilo::filter_token_description_display ( token  ) 

function filter_token_description_display Plugin filter to localize token descriptions

Parameters:
string Token to get the description of
Returns:
string The localized token description

Definition at line 87 of file habarisilo.plugin.php.

HabariSilo::link_panel ( path,
panel,
title 
)

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

Parameters:
string $path The path to pass
string $path The panel to display
string $title The text to use for the link in the control bar
Returns:
string The link to create

Definition at line 454 of file habarisilo.plugin.php.

HabariSilo::link_path ( path,
title = '' 
)

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

Parameters:
string $path The path to display
string $title The text to use for the link in the control bar
Returns:
string The link to create

Definition at line 438 of file habarisilo.plugin.php.

HabariSilo::mkdir_validator ( dir,
control,
form 
)

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.

Parameters:
$dir The input from the form
$control The FormControl object
$form The FormUI object

Definition at line 650 of file habarisilo.plugin.php.

HabariSilo::silo_delete ( path  ) 

Delete the file at the specified path

Parameters:
string $path The path of the file to retrieve

Implements MediaSilo.

Definition at line 392 of file habarisilo.plugin.php.

HabariSilo::silo_dir ( path  ) 

Return directory contents for the silo path

Parameters:
string $path The path to retrieve the contents of
Returns:
array An array of MediaAssets describing the contents of the directory

Implements MediaSilo.

Definition at line 153 of file habarisilo.plugin.php.

HabariSilo::silo_get ( path,
qualities = null 
)

Get the file from the specified path

Parameters:
string $path The path of the file to retrieve
array $qualities Qualities that specify the version of the file to retrieve.
Returns:
MediaAsset The requested asset

Implements MediaSilo.

Definition at line 198 of file habarisilo.plugin.php.

Referenced by silo_dir().

HabariSilo::silo_highlights (  ) 

Retrieve a set of highlights from this silo This would include things like recently uploaded assets, or top downloads

Returns:
array An array of MediaAssets to highlihgt from this silo

Implements MediaSilo.

Definition at line 418 of file habarisilo.plugin.php.

HabariSilo::silo_info (  ) 

Return basic information about this silo name- The name of the silo, used as the root directory for media in this silo

Implements MediaSilo.

Definition at line 140 of file habarisilo.plugin.php.

HabariSilo::silo_new ( path  ) 

Create a new asset instance for the specified path

Parameters:
string $path The path of the new file to create
Returns:
MediaAsset The requested asset

Definition at line 363 of file habarisilo.plugin.php.

HabariSilo::silo_permissions ( path  ) 

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

Parameters:
string $path The path to retrieve permissions for
Returns:
array An array of permissions constants (MediaSilo::PERM_READ, MediaSilo::PERM_WRITE)

Implements MediaSilo.

Definition at line 427 of file habarisilo.plugin.php.

HabariSilo::silo_put ( path,
filedata 
)

Store the specified media at the specified path

Parameters:
string $path The path of the file to retrieve
MediaAsset $filedata The MediaAsset to store
Returns:
boolean True on success

Implements MediaSilo.

Definition at line 373 of file habarisilo.plugin.php.


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