publicHeadContent pour le greffon shortURL
Par Osku le vendredi 23 juillet 2010, 11:47 - Lien permanent
public static function publicHeadContent($core, $_ctx) {
if ($core->blog->settings->shortURL->shortURLEnabled) {
$types = $core->getPostTypes();
foreach ($types as $k => $v) {
$urltype[$k] = preg_replace('/\/%s/','',$types[$k]['public_url']);
}
//print_r($urltype);
if (array_key_exists($core->url->type, $urltype)) {
if ($GLOBALS['core']->blog->settings->shortURL->shortURLEvenShorter) {
$id = dcShortURL::idConversion($_ctx->posts->post_id);
} else {
$id = $_ctx->posts->post_id;
}
$url = $core->blog->url.$core->url->getBase("shortURL").'/'.rawurlencode($id);
echo '<link rel="shortlink" type="text/html" href="'.$url.'" />';
}
}
}