You are here

function securepages_link_alter in Secure Pages 5

Same name and namespace in other branches
  1. 6 securepages.module \securepages_link_alter()

Implementation of hook_link_alter()

File

./securepages.module, line 151

Code

function securepages_link_alter(&$node, &$links) {
  if (!variable_get('securepages_enable', 0)) {
    return;
  }
  foreach ($links as $module => $link) {
    if ($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'], NULL, NULL, TRUE);
      }
      elseif ($page_match === 0 && securepages_is_secure() && variable_get('securepages_switch', FALSE)) {
        $links[$module]['href'] = securepages_url($link['href'], NULL, NULL, FALSE);
      }
    }
  }
}