function securepages_link_alter in Secure Pages 6
Same name and namespace in other branches
- 5 securepages.module \securepages_link_alter()
Implementation of hook_link_alter().
File
- ./
securepages.module, line 124 - Provide method of creating allowing certain pages to only viewable from https pages
Code
function securepages_link_alter(&$links, $node, $comment = NULL) {
if (!variable_get('securepages_enable', 0)) {
return;
}
foreach ($links as $module => $link) {
if (isset($link['href']) && $link['href'] && securepages_can_alter_url($link['href'])) {
$page_match = securepages_match($link['href']);
if ($page_match && !securepages_is_secure()) {
$links[$module]['href'] = securepages_url($link['href'], array(
'secure' => TRUE,
));
}
elseif ($page_match === 0 && securepages_is_secure() && variable_get('securepages_switch', FALSE)) {
$links[$module]['href'] = securepages_url($link['href'], array(
'secure' => FALSE,
));
}
}
}
}