Back to HTMLHelper class

Method extract

protected static array
extract
(mixed $key)
Method to extract a key
Parameters
  • string $key The name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers.
Returns
  • array Contains lowercase key, prefix, file, function.
Since
  • 1.6
Deprecated
  • 5.0
Class: HTMLHelper
Project: Joomla

Method extract - Source code

/**
 * Method to extract a key
 *
 * @param   string  $key  The name of helper method to load, (prefix).(class).function
 *                        prefix and class are optional and can be used to load custom html helpers.
 *
 * @return  array  Contains lowercase key, prefix, file, function.
 *
 * @since       1.6
 * @deprecated  5.0 Use the service registry instead
 */
protected static function extract($key)
{
    $key = preg_replace('#[^A-Z0-9_\\.]#i', '', $key);
    // Check to see whether we need to load a helper file
    $parts = explode('.', $key);
    if (\count($parts) === 3) {
        @trigger_error('Support for a three segment service key is deprecated and will be removed in Joomla 5.0, use the service registry instead', E_USER_DEPRECATED);
    }
    $prefix = \count($parts) === 3 ? array_shift($parts) : 'JHtml';
    $file = \count($parts) === 2 ? array_shift($parts) : '';
    $func = array_shift($parts);
    return array(strtolower($prefix . '.' . $file . '.' . $func), $prefix, $file, $func);
}