Elgg  Version 1.11
Namespaces | Functions | Variables
metastrings.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Activate a plugin or plugins.
 

Functions

 elgg_get_metastring_id ($string, $case_sensitive=true)
 Gets the metastring identifier for a value. More...
 
 _elgg_add_metastring ($string)
 Add a metastring. More...
 
 _elgg_get_metastring_based_objects ($options)
 Returns an array of either or objects. More...
 
 _elgg_get_metastring_sql ($table, $names=null, $values=null, $pairs=null, $ids=null, $case_sensitive=false)
 Returns an array of joins and wheres for use in metastrings. More...
 
 _elgg_normalize_metastrings_options (array $options=array())
 Normalizes metadata / annotation option names to their corresponding metastrings name. More...
 
 _elgg_set_metastring_based_object_enabled_by_id ($id, $enabled, $type)
 Enables or disables a metastrings-based object by its id. More...
 
 _elgg_batch_metastring_based_objects (array $options, $callback, $inc_offset=true)
 Runs metastrings-based objects found using $options through $callback. More...
 
 _elgg_get_metastring_based_object_from_id ($id, $type)
 Returns a singular metastring-based object by its ID. More...
 
 _elgg_delete_metastring_based_object_by_id ($id, $type)
 Deletes a metastring-based object by its id. More...
 
 _elgg_entities_get_metastrings_options ($type, $options)
 Returns options to pass to elgg_get_entities() for metastrings operations. More...
 
 _elgg_metastrings_test ($hook, $type, $value)
 Metastring unit tests. More...
 

Variables

return function (\Elgg\EventsService $events,\Elgg\HooksRegistrationService $hooks)
 

Function Documentation

_elgg_add_metastring (   $string)

Add a metastring.

Warning
You should not call this directly. Use elgg_get_metastring_id().
Parameters
string$stringThe value to be normalized
Returns
int The identifier for this string

Definition at line 37 of file metastrings.php.

_elgg_batch_metastring_based_objects ( array  $options,
  $callback,
  $inc_offset = true 
)

Runs metastrings-based objects found using $options through $callback.

Warning
Unlike _elgg_get_metastring_based_objects() this will not accept an empty options array!
This returns null on no ops.
Parameters
array$optionsAn options array. _elgg_get_metastring_based_objects()
string$callbackThe callback to pass each result through
bool$inc_offsetIncrement the offset? Pass false for callbacks that delete / disable
Returns
bool|null true on success, false on failure, null if no objects are found. private

Definition at line 567 of file metastrings.php.

_elgg_delete_metastring_based_object_by_id (   $id,
  $type 
)

Deletes a metastring-based object by its id.

Parameters
int$idThe object's ID
string$typeThe object's metastring type: annotation or metadata
Returns
bool private

Definition at line 612 of file metastrings.php.

_elgg_entities_get_metastrings_options (   $type,
  $options 
)

Returns options to pass to elgg_get_entities() for metastrings operations.

Parameters
string$typeMetastring type: annotation or metadata
array$optionsOptions
Returns
array private

Definition at line 677 of file metastrings.php.

_elgg_get_metastring_based_object_from_id (   $id,
  $type 
)

Returns a singular metastring-based object by its ID.

Parameters
int$idThe metastring-based object's ID
string$typeThe type: annotation or metadata
Returns
private

Definition at line 584 of file metastrings.php.

_elgg_get_metastring_based_objects (   $options)

Returns an array of either or objects.

Accepts all elgg_get_entities() options for entity restraints.

See also
elgg_get_entities
Parameters
array$optionsArray in format:
metastring_names              => null|ARR metastring names

metastring_values             => null|ARR metastring values

metastring_ids                => null|ARR metastring ids

metastring_case_sensitive     => BOOL     Overall Case sensitive

metastring_owner_guids => null|ARR Guids for metadata owners

metastring_created_time_lower => INT Lower limit for created time.

metastring_created_time_upper => INT Upper limit for created time.

metastring_calculation => STR Perform the MySQL function on the metastring values returned. This differs from egef_annotation_calculation in that it returns only the calculation of all annotation values. You can sum, avg, count, etc. egef_annotation_calculation() returns ordered by a calculation on their annotation values.

metastring_type => STR metadata or annotation(s)

Returns
[]|int An array or count of metastring based objects private

Definition at line 76 of file metastrings.php.

_elgg_get_metastring_sql (   $table,
  $names = null,
  $values = null,
  $pairs = null,
  $ids = null,
  $case_sensitive = false 
)

Returns an array of joins and wheres for use in metastrings.

Note
The $pairs is reserved for name/value pairs if we want to implement those.
Parameters
string$tableThe annotation or metadata table name or alias
array$namesAn array of names
array$valuesAn array of values
array$pairsName / value pairs. Not currently used.
array$idsMetastring IDs
bool$case_sensitiveShould name and values be case sensitive?
Returns
array private

Definition at line 352 of file metastrings.php.

_elgg_metastrings_test (   $hook,
  $type,
  $value 
)

Metastring unit tests.

Parameters
string$hookunit_test
string$typesystem
array$valueArray of other tests
Returns
array private

Definition at line 738 of file metastrings.php.

_elgg_normalize_metastrings_options ( array  $options = array())

Normalizes metadata / annotation option names to their corresponding metastrings name.

Parameters
array$optionsAn options array
Returns
array private

Definition at line 457 of file metastrings.php.

_elgg_set_metastring_based_object_enabled_by_id (   $id,
  $enabled,
  $type 
)

Enables or disables a metastrings-based object by its id.

Warning
To enable disabled metastrings you must first use access_show_hidden_entities().
Parameters
int$idThe object's ID
string$enabledValue to set to: yes or no
string$typeMetastring type: metadata or annotation
Returns
bool
Exceptions
InvalidParameterExceptionprivate

Definition at line 510 of file metastrings.php.

elgg_get_metastring_id (   $string,
  $case_sensitive = true 
)

Gets the metastring identifier for a value.

Elgg normalizes the names and values of annotations and metadata. This function provides the identifier used as the index in the metastrings table. Plugin developers should only use this if denormalizing names/values for performance reasons (to avoid multiple joins on the metastrings table).

Parameters
string$stringThe value
bool$case_sensitiveShould the retrieval be case sensitive? If not, there may be more than one result
Returns
int|array metastring id or array of ids
Since
1.9.0

Definition at line 25 of file metastrings.php.

Variable Documentation

Definition at line 744 of file metastrings.php.