function rss_permissions_preprocess_page in RSS Permissions 6
Implementation of theme_preprocess_page(). Use regex to remove RSS link from HEAD, if the user has no permission for that feed.
File
- ./
rss_permissions.module, line 274
Code
function rss_permissions_preprocess_page(&$vars) {
if (preg_match('/<link rel="alternate" type="application\\/rss\\+xml" title=".*?" href="(.*?)" \\/>/', $vars['head'], $matches)) {
// $matches[1] is the URL to the feed.
if (!empty($matches[1]) && !rss_permissions_feed_url_access($matches[1])) {
$vars['head'] = preg_replace('/<link rel="alternate" type="application\\/rss\\+xml" title=".*?" href="' . addcslashes($matches[1], '/') . '" \\/>\\n/', '', $vars['head']);
}
}
}