/[drupal]/contributions/modules/addtofavorites/addtofavorites.module
ViewVC logotype

Diff of /contributions/modules/addtofavorites/addtofavorites.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4, Sat Apr 7 10:41:20 2007 UTC revision 1.5, Mon Dec 8 01:46:44 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: addtofavorites.module,v 1.4 2006/11/13 16:25:04 thierrygd Exp $  // $Id: addtofavorites.module,v 1.4 2007/05/06 16:25:04 thierrygd Exp $
3    
4  // Copyright 2006 Thierry GUEGAN http://www.arvoriad.com  // Copyright 2007 Thierry GUEGAN http://www.arvoriad.com
5    
6  /**  /**
7   * @file   * @file
# Line 9  Line 9 
9   * browser's bookmarks.   * browser's bookmarks.
10   */   */
11    
12  function addtofavorites_menu($may_cache) {  function addtofavorites_menu() {
13    $items = array();    $items = array();
14    
15    if ($may_cache) {    $items['admin/settings/addtofavorites'] = array(
16      $items[] = array(        'title' => 'Add to favorites module',
17        'path' => 'admin/settings/addtofavorites',        'description' => 'Add to favorites module configuration.',
18        'title' => t('Add to favorites module'),        'page callback' => 'drupal_get_form',
19        'description' => t('Add to favorites module configuration.'),        'page arguments' => array('addtofavorites_admin_settings'),
20        'callback' => 'drupal_get_form',        'access arguments' => array('administer site configuration'),
       'callback arguments' => array('addtofavorites_admin_settings'),  
       'access' => user_access('administer site configuration'),  
21        'type' => MENU_NORMAL_ITEM,);        'type' => MENU_NORMAL_ITEM,);
22    }  
23    return $items;    return $items;
24  }  }
25    
# Line 123  function addtofavorites_block($op = 'lis Line 121  function addtofavorites_block($op = 'lis
121      $sitename = variable_get('site_name', 'drupal');      $sitename = variable_get('site_name', 'drupal');
122      $pagetitle = strip_tags(drupal_get_title());      $pagetitle = strip_tags(drupal_get_title());
123      $pagetitle = $pagetitle ? $pagetitle . ' | ' . $sitename : $sitename;      $pagetitle = $pagetitle ? $pagetitle . ' | ' . $sitename : $sitename;
124      $siteurl = url('', null, null, true);      $siteurl = url('', array('query' => NULL, 'fragment' => NULL, 'absolute' => TRUE));
125      $display_links = variable_get('addtofavorites_links',1); //add the links or not      $display_links = variable_get('addtofavorites_links',1); //add the links or not
126      $display_site_OK = variable_get('addtofavorites_site_OK', 1); //bookmark the site or not      $display_site_OK = variable_get('addtofavorites_site_OK', 1); //bookmark the site or not
127      $display_text_site = variable_get('addtofavorites_site', t("Bookmark this site"));      $display_text_site = variable_get('addtofavorites_site', t("Bookmark this site"));
# Line 143  function addtofavorites_block($op = 'lis Line 141  function addtofavorites_block($op = 'lis
141      $links = "";      $links = "";
142    
143      if ($display_site_OK) {      if ($display_site_OK) {
             $links .= "<a href=\"javascript:addtofavorites";  
             $links .= "('" . $siteurl . "','" . $sitename . "')\">";  
144              if ($display_icons) {              if ($display_icons) {
145                  $links .= "<img src=\"" . $display_icon_site . "\"";                  $links .= "<img src=\"" . $display_icon_site . "\"";
146                  $links .= " alt=\"" . $display_text_site . "\" align=\"absmiddle\">";                  $links .= " alt=\"" . $display_text_site . "\" style=\"vertical-align:middle;\" />";
147              }              }
148                $links .= "<a href=\"#\" onclick=\"javascript:addtofavorites";
149                $links .= "('" . $siteurl . "','" . $sitename . "')\">";
150              if ($display_links) {              if ($display_links) {
151                  $links .= $display_text_site;                  $links .= $display_text_site;
152                  $links .= "<br>\n";  //if we don't display links then align horizontally the icons                  $links .= "<br />\n";  //if we don't display links then align horizontally the icons
153              }              }
154              $links .= "</a>";              $links .= "</a>";
155      }      }
156      if ($display_page_OK) {      if ($display_page_OK) {
             $links .= "<a href=\"javascript:addtofavorites";  
             $links .= "(top.location.href, '" . $pagetitle . "')\">";  
157              if ($display_icons) {              if ($display_icons) {
158                  $links .= "<img src=\"" . $display_icon_page . "\"";                  $links .= "<img src=\"" . $display_icon_page . "\"";
159                  $links .= " alt=\"" . $display_text_page . "\" align=\"absmiddle\">";                  $links .= " alt=\"" . $display_text_page . "\" style=\"vertical-align:middle;\" />";
160              }              }
161                $links .= "<a href=\"#\" onclick=\"javascript:addtofavorites";
162                $links .= "(top.location.href, '" . $pagetitle . "')\">";
163              if ($display_links) {              if ($display_links) {
164                  $links .= $display_text_page;                  $links .= $display_text_page;
165                  $links .= "<br>\n";  //if we don't display links then align horizontally the icons                  $links .= "<br />\n";  //if we don't display links then align horizontally the icons
166              }              }
167              $links .= "</a>";              $links .= "</a>";
168      }      }
169      if ($display_homepage_OK) {      if ($display_homepage_OK) {
170              $links .= "<a href=\"#\" ";              if ($display_icons) {
             $links .= "onClick=\"this.style.behavior='url(#default#homepage)';this.setHomePage('" . $siteurl . "')\">";  
                 if ($display_icons) {  
171                  $links .= "<img src=\"" . $display_icon_homepage . "\"";                  $links .= "<img src=\"" . $display_icon_homepage . "\"";
172                  $links .= " alt=\"" . $display_text_homepage . "\" align=\"absmiddle\">";                  $links .= " alt=\"" . $display_text_homepage . "\" style=\"vertical-align:middle;\" />";
173              }              }
174                $links .= "<a href=\"#\" ";
175                $links .= "onClick=\"this.style.behavior='url(#default#homepage)';this.setHomePage('" . $siteurl . "')\">";
176              if ($display_links) {              if ($display_links) {
177                  $links .= $display_text_homepage;                  $links .= $display_text_homepage;
178              }              }
179              $links .= "</a>";              $links .= "</a>";
180      }      }
181      $block['content'] = $links;      $block['content'] = $links;
182      }      }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.2