File/application/libraries/globals.php

Description

Helper functions that are always available in Omeka. these should be used as little as possible in the application code to reduce coupling.

Helper functions that are always available in Omeka. As global functions, these should be used as little as possible in the application code to reduce coupling.

Functions
add_filter (line 319)

Declare a filter implementation.

Declare a filter implementation.

  • since: 0.10
void add_filter (string|array $filterName, callback $callback, [integer $priority = 10])
  • string|array $filterName
  • callback $callback
  • integer $priority: Optional Defaults to 10.
add_mime_display_type (line 281)

Declare a function that will be used to display files with a given MIME type.

Declare a function that will be used to display files with a given MIME type.

void add_mime_display_type ( $mimeTypes,  $callback, [ $options = array()])
  • $mimeTypes
  • $callback
  • array $options
add_plugin_hook (line 166)

Declare a plugin hook implementation within a plugin.

Declare a plugin hook implementation within a plugin.

void add_plugin_hook (string $hook, mixed $callback)
  • mixed $callback: Any valid PHP callback.
  • string $hook
apply_filters (line 299)

Apply a set of plugin filters to a given value.

Apply a set of plugin filters to a given value. The first two arguments represent the name of the filter and the value to filter, and all subsequent arguments are passed to the individual filter implementations.

mixed apply_filters (string|array $filterName, mixed $valueToFilter)
  • string|array $filterName
  • mixed $valueToFilter
current_user (line 110)

Retrieve the User record associated with the currently logged in user.

Retrieve the User record associated with the currently logged in user.

  • return: Null if no user is logged in.
User|null current_user ()
debug (line 134)

Log a message with 'DEBUG' priority.

Log a message with 'DEBUG' priority. This will do nothing if logging is not enabled via config.ini's log.errors setting.

void debug (string $msg)
  • string $msg
delete_option (line 53)

Delete an option from the database.

Delete an option from the database.

void delete_option (string $name)
  • string $name
generate_slug (line 78)

Generate a URL slug from a piece of text.

Generate a URL slug from a piece of text. Trims whitespace, replaces some prohibited characters with hyphens, and converts the resulting string to lowercase.

string generate_slug (string $text)
  • string $text
get_acl (line 331)

Retrieve the ACL object.

Retrieve the ACL object.

Omeka_Acl get_acl ()
get_db (line 120)

Retrieve the database object.

Retrieve the database object.

Omeka_Db get_db ()
get_option (line 20)

Retrieve an option from the Omeka database.

Retrieve an option from the Omeka database. If the returned value represents an object or array, it must be unserialized by the caller before use. For example,

  1. $object unserialize(get_option('plugin_object'))
.

string get_option (string $name)
  • string $name
get_plugin_hook_output (line 203)

Retrieve the output of fire_plugin_hook() as a string.

Retrieve the output of fire_plugin_hook() as a string. This is invoked in the same way as fire_plugin_hook().

  • uses: fire_plugin_hook()
string get_plugin_hook_output ()
get_plugin_ini (line 268)

Retrieves specified descriptive info for a plugin from its ini file.

Retrieves specified descriptive info for a plugin from its ini file.

  • return: | string The value of the specified plugin key. If the key does not exist, it returns null
null get_plugin_ini (string $pluginDirName, string $iniKeyName)
  • string $pluginDirName: The directory name of the plugin
  • string $iniKeyName: The name of the key in the ini file
get_specific_plugin_hook_output (line 224)

Retrieve the output of a specific plugin's hook as a string.

Retrieve the output of a specific plugin's hook as a string. This is like get_plugin_hook_output() but only calls the hook within the provided plugin.

string get_specific_plugin_hook_output (string $pluginName, string $hookName, [any 2)
  • string $pluginName
  • string $hookName
  • [any 2: number of further arguments]
insert_collection (line 547)

Inserts a collection

Inserts a collection

void insert_collection ([array $metadata = array()])
  • array $metadata: Follows the format:
    1.  array(
    2.      'name'       => [string],
    3.      'description'=> [string],
    4.      'public'     => [true|false],
    5.      'featured'   => [true|false]
    6.      'collectors' => [array of entitiesentity idsor entity property arrays]
    7.  )
    You can specify collectors in several ways. You can provide an array of entity properties:
    1.  insert_collection(array('collectors'=>array(
    2.    array('first_name' => $entityFirstName1,
    3.          'middle_name' => $entityMiddleName1,
    4.          'last_name' => $entityLastName1,
    5.           ...
    6.          ),
    7.    array('first_name' => $entityFirstName2,
    8.          'middle_name' => $entityMiddleName2,
    9.          'last_name' => $entityLastName2,
    10.          ...
    11.          ),
    12.    array(...),
    13.    ...
    14.  ));
    Alternatively, you can use an array of entity objects or entity ids. insert_collection(array('collectors'=>array($entity1, $entity2, ...)); insert_collection(array('collectors'=>array($entityId1, $entityId2, ...)); Also you can mix the parameters:
    1.  insert_collection(array('collectors'=>array(
    2.     array('first_name' => $entityFirstName1,
    3.          'middle_name' => $entityMiddleName1,
    4.          'last_name' => $entityLastName1,
    5.           ...
    6.          ),
    7.    $entity2,
    8.    $entityId3,
    9.    ...
    10.  ));
insert_element_set (line 586)

Insert an element set and its elements into the database.

Insert an element set and its elements into the database.

ElementSet insert_element_set ([string|array $elementSetMetadata = array()], [ $elements = array()])
  • string|array $elementSetMetadata: Element set information.
    1.      [(string) element set name]
    2.      -OR-
    3.      array(
    4.          'name'        => [(string) element set namerequiredunique],
    5.          'description' => [(string) element set descriptionoptional]
    6.      );
  • array $elements: An array containing element data. Follows one of more of the following formats:
    1. An array containing element metadata
    2. A string of the element name
    1.     array(
    2.          array(
    3.              'name'        => [(string) namerequired],
    4.              'description' => [(string) descriptionoptional],
    5.              'record_type' => [(string) record type nameoptional],
    6.              'data_type'   => [(string) data type nameoptional],
    7.              'record_type_id' => [(int) record type idoptional],
    8.              'data_type_id'   => [(int) data type idoptional]
    9.          ),
    10.          [(string) element name]
    11.      );
insert_files_for_item (line 433)

Add files to an item.

Add files to an item.

array insert_files_for_item (Item|integer $item, string|Omeka_File_Ingest_Abstract $transferStrategy, array $files, [array $options = array()])
insert_item (line 415)

Insert a new item into the Omeka database.

Insert a new item into the Omeka database. * @param array $itemMetadata Optional Set of metadata options for configuring the item. Array which can include the following properties:

  • 'public' (boolean)
  • 'featured' (boolean)
  • 'collection_id' (integer)
  • 'item_type_id' (integer)
  • 'item_type_name' (string)
  • 'tags' (string, comma-delimited)
  • 'tag_entity' (Entity, optional and only checked if 'tags' is given)
  • 'overwriteElementTexts' (boolean) -- determines whether or not to overwrite existing element texts. If true, this will loop through the element texts provided in $elementTexts, and it will update existing records where possible. All texts that are not yet in the DB will be added in the usual manner. False by default.

Item insert_item ([ $metadata = array()], [array $elementTexts = array()], [array $fileMetadata = array()])
  • array $elementTexts: Optional Array of element texts to assign to the item. This follows the format:
    1.  array(
    2.      [element set name=> array(
    3.          [element name=> array(
    4.              array('text' => [string]'html' => [false|true]),
    5.              array('text' => [string]'html' => [false|true])
    6.          ),
    7.          [element name=> array(
    8.              array('text' => [string]'html' => [false|true]),
    9.              array('text' => [string]'html' => [false|true])
    10.          )
    11.      ),
    12.      [element set name=> array(
    13.          [element name=> array(
    14.              array('text' => [string]'html' => [false|true]),
    15.              array('text' => [string]'html' => [false|true])
    16.          ),
    17.          [element name=> array(
    18.              array('text' => [string]'html' => [false|true]),
    19.              array('text' => [string]'html' => [false|true])
    20.          )
    21.      )
    22.  );
    See ActsAsElementText::addElementTextsByArray() for more info.
  • array $fileMetadata: Optional Set of metadata options that allow one or more files to be associated with the item. Includes the following options:
    • 'file_transfer_type' (string = 'Url|Filesystem|Upload' or Omeka_File_Transfer_Adapter_Interface). Corresponds to the $transferStrategy argument for addFiles().
    • 'file_ingest_options' OPTIONAL (array of possible options to pass modify the behavior of the ingest script). Corresponds to the $options argument for addFiles().
    • 'files' (array or string) Represents information indicating the file to ingest. Corresponds to the $files argument for addFiles().
  • $metadata
insert_item_type (line 488)

Insert a new item type.

Insert a new item type.

  • throws: Exception
ItemType insert_item_type ([array $metadata = array()], [array $elementInfos = array()])
  • array $metadata: Follows the format:
    1.  array(
    2.      'name'       => [string],
    3.      'description'=> [string]
    4.  )
  • array $elementInfos: An array containing element data. Each entry follows one or more of the following formats:
    1. An array containing element metadata
    2. A string containing the element name
    1.     array(
    2.          array(
    3.              'name'        => [(string) namerequired],
    4.              'description' => [(string) descriptionoptional],
    5.              'record_type' => [(string) record type nameoptional],
    6.              'data_type'   => [(string) data type nameoptional],
    7.              'order'       => [(int) orderoptional],
    8.              'record_type_id' => [(int) record type idoptional],
    9.              'data_type_id'   => [(int) data type idoptional]
    10.          ),
    11.          [(string) element name],
    12.      );
is_admin_theme (line 346)

Determine whether or not the script is being executed through the administrative interface.

Determine whether or not the script is being executed through the administrative interface. Can be used to branch behavior based on whether or not the admin theme is being accessed, but should not be relied upon in place of using the ACL for controlling access to scripts.

boolean is_admin_theme ()
is_true (line 633)

Returns whether a value is true or not.

Returns whether a value is true or not. If the value is a string and its lowercased value is 'true' or '1', it returns true. If the value is an integer and equal to 1, then it returns true. Otherwise it returns false.

boolean is_true (string $value)
  • string $value
not_empty_or (line 618)

Return either the value or, if it's empty, output the default.

Return either the value or, if it's empty, output the default.

mixed not_empty_or (mixed $value, mixed $default)
  • mixed $value
  • mixed $default
pluck (line 96)

Retrieve one column of a multidimensional array as an array.

Retrieve one column of a multidimensional array as an array.

array pluck (string|integer $col, array $array)
  • string|integer $col
  • array $array
release_object (line 601)

Releases an object from memory.

Releases an object from memory. Use this fuction after you are done using an Omeka model object to prevent memory leaks. Required because PHP 5.2 does not do garbage collection on circular references.

void release_object (mixed &$var)
  • mixed &$var
set_option (line 35)

Set an option in the Omeka database.

Set an option in the Omeka database. Note that objects and arrays must be serialized before being saved.

void set_option (string $name, string $value)
  • string $name
  • string $value
update_item (line 449)
Item update_item (Item|int $item, [array $metadata = array()], [array $elementTexts = array()], [array $fileMetadata = array()])
  • Item|int $item: Either an Item object or the ID for the item.
  • array $metadata: Set of options that can be passed to the item.
  • array $elementTexts
  • array $fileMetadata

Documentation generated on Thu, 15 Oct 2009 15:37:50 -0400 by phpDocumentor 1.4.2