Beispiel #1
0
/**
 * When given a title, returns a version suitable for inclusion in a URL
 *
 * @param string $title The title
 *
 * @return string The optimised title
 * @since 1.7.2
 */
function elgg_get_friendly_title($title)
{
    // return a URL friendly title to short circuit normal title formatting
    $params = array('title' => $title);
    $result = elgg_trigger_plugin_hook('format', 'friendly:title', $params, NULL);
    if ($result) {
        return $result;
    }
    // titles are often stored HTML encoded
    $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
    $title = ElggTranslit::urlize($title);
    return $title;
}
Beispiel #2
0
/**
 * When given a title, returns a version suitable for inclusion in a URL
 *
 * @param string $title The title
 *
 * @return string The optimised title
 * @since 1.7.2
 */
function elgg_get_friendly_title($title)
{
    // return a URL friendly title to short circuit normal title formatting
    $params = array('title' => $title);
    $result = elgg_trigger_plugin_hook('format', 'friendly:title', $params, NULL);
    if ($result) {
        return $result;
    }
    // handle some special cases
    $title = str_replace('&', 'and', $title);
    $title = ElggTranslit::urlize($title);
    return $title;
}