Index: service_links.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/service_links/Attic/service_links.admin.inc,v retrieving revision 1.1.2.6 diff -u -p -r1.1.2.6 service_links.admin.inc --- service_links.admin.inc 18 Aug 2009 17:54:03 -0000 1.1.2.6 +++ service_links.admin.inc 4 Feb 2010 03:18:56 -0000 @@ -7,68 +7,88 @@ */ /** - * Theming function for build a draggable service links table + * Theming function for build a draggable service links table. */ -function theme_service_links_drag_table(&$form) { - $table = array(); +function theme_service_links_drag_table($variables) { + $form = $variables['form']; + $table['rows'] = array(); foreach (element_children($form['service_links_show']) as $service_id) { - $service = &$form['service_links_show'][$service_id]; - $col = array(); + $service = $form['service_links_show'][$service_id]; + $columns = array(); - $service['name'] = array('#value' => $service['#title']); - $col[] = drupal_render($service['name']); + $service['name'] = array('#markup' => $service['#title']); + $columns[] = drupal_render($service['name']); - $service['service'] = array('#value' => $service['#service']); - $col[] = drupal_render($service['service']); + $service['service'] = array('#markup' => $service['#service']); + $columns[] = drupal_render($service['service']); - $service['show'] = array('#type' => 'checkbox', + $service['show'] = array( + '#type' => 'checkbox', '#value' => $service['#default_value'], '#id' => $service['#id'], - '#name' => $service['#name']); - $col[] = drupal_render($service['show']); - - $service['weight'] = &$form['service_links_weight'][$service_id]; - $service['weight']['#attributes']['class'] = 'service-weight'; - $col[] = drupal_render($service['weight']); + '#name' => $service['#name'], + '#required' => FALSE, + '#parents' => array(''), + ); + $columns[] = drupal_render($service['show']); + + $service['weight'] = $form['service_links_weight'][$service_id]; + $service['weight']['#attributes']['class'] = array('service-weight'); + $columns[] = drupal_render($service['weight']); $table['weights'][] = $service['#weight']; - $table['rows'][] = array('data' => $col, 'class' => 'draggable'); + $table['rows'][] = array( + 'data' => $columns, + 'class' => array('draggable'), + ); } - - if (empty($table['rows'])) { - $table['rows'][] = array(array('data' => t('No service available.'), 'colspan' => '5')); + + if (!empty($table['rows'])) { + array_multisort($table['weights'], $table['rows']); } - else array_multisort($table['weights'], $table['rows']); - $table['header'] = array(t('Service Name'), t('Service Group'), t('Show'), t('Weight')); - drupal_add_tabledrag('service_links', 'order', 'sibling', 'service-weight'); - return theme('table', $table['header'], $table['rows'], array('id' => 'service_links')); + $table['header'] = array( + t('Service Name'), + t('Service Group'), + t('Show'), + t('Weight'), + ); + drupal_add_tabledrag('service-links', 'order', 'sibling', 'service-weight'); + + $build['service_links_table'] = array( + '#theme' => 'table', + '#header' => $table['header'], + '#rows' => $table['rows'], + '#attributes' => array('id' => 'service-links'), + '#empty' => t('No service available.'), + ); + + return drupal_render($build); } /** * Menu callback administration settings for general options. */ function service_links_admin_settings() { - $form['where_to_show_the_links'] = array( '#type' => 'fieldset', '#title' => t('Where to show the service links'), - '#description' => t('Set the node types and categories you want to display links for.'), + '#description' => t('Set the content types and categories you want to display links for.'), ); $form['where_to_show_the_links']['service_links_node_types'] = array( '#type' => 'checkboxes', - '#title' => t('Node types'), + '#title' => t('Content types'), '#default_value' => variable_get('service_links_node_types', array()), - '#options' => node_get_types('names'), + '#options' => node_type_get_names(), ); - if (module_exists('taxonomy')) { + if (module_exists('taxonomy') && $categories = _service_links_get_terms()) { $form['where_to_show_the_links']['service_links_category_types'] = array( '#type' => 'select', '#multiple' => TRUE, '#title' => t('Categories'), '#default_value' => variable_get('service_links_category_types', array()), - '#options' => _service_links_get_terms(), + '#options' => $categories, ); } @@ -79,14 +99,19 @@ function service_links_admin_settings() $form['how_to_show_the_links']['service_links_in_links'] = array( '#type' => 'select', '#title' => t('Service links in links'), - '#default_value' => variable_get('service_links_in_links', 0), - '#options' => array(0 => t('Disabled'), 1 => t('Teaser view'), 2 => t('Full-page view'), 3 => t('Teasers and full-page view')), + '#default_value' => variable_get('service_links_in_links', SERVICE_LINKS_DISABLED), + '#options' => array( + SERVICE_LINKS_DISABLED => t('Disabled'), + SERVICE_LINKS_IN_TEASER => t('Teaser view'), + SERVICE_LINKS_IN_FULL => t('Full-page view'), + SERVICE_LINKS_IN_BOTH => t('Teasers and full-page view'), + ), '#description' => t('When to display the services in the links section.'), ); $form['how_to_show_the_links']['service_links_in_node'] = array( '#type' => 'select', '#title' => t('Service links in nodes'), - '#default_value' => variable_get('service_links_in_node', 2), + '#default_value' => variable_get('service_links_in_node', SERVICE_LINKS_IN_FULL), '#options' => array( SERVICE_LINKS_DISABLED => t('Disabled'), SERVICE_LINKS_IN_TEASER => t('Teaser view'), @@ -97,7 +122,7 @@ function service_links_admin_settings() $form['how_to_show_the_links']['service_links_style'] = array( '#type' => 'select', '#title' => t('Service links style'), - '#default_value' => variable_get('service_links_style', 1), + '#default_value' => variable_get('service_links_style', SERVICE_LINKS_STYLE_TEXT), '#options' => array( SERVICE_LINKS_STYLE_TEXT => t('Only Text'), SERVICE_LINKS_STYLE_IMAGE => t('Only Image'), @@ -108,7 +133,10 @@ function service_links_admin_settings() '#type' => 'select', '#title' => t('Open link in...'), '#default_value' => variable_get('service_links_new_window', 0), - '#options' => array(0 => t('Same window'), 1 => t('New window')), + '#options' => array( + 0 => t('Same window'), + 1 => t('New window'), + ), ); $form['short_links'] = array( @@ -119,14 +147,23 @@ function service_links_admin_settings() '#type' => 'select', '#title' => t('Use short links'), '#default_value' => variable_get('service_links_short_links_use', 0), - '#options' => array(0 => t('Never'), 1 => t('Only when requested'), 2 => t('Always')), + '#options' => array( + 0 => t('Never'), + 1 => t('Only when requested'), + 2 => t('Always'), + ), ); if (variable_get('service_links_short_links_use', 0) > 0) { $form['short_links']['service_links_short_links_type'] = array( '#type' => 'select', '#title' => t('How generate short links'), '#default_value' => variable_get('service_links_short_links_type', 1), - '#options' => array(1 => t('Use node/xxx alias'), 2 => t('Use TinyURL.com service'), 3 => t('Redirect only the Domain name'), 4 => t('Combo: domain redirect and node/xxx alias')), + '#options' => array( + 1 => t('Use node/xxx alias'), + 2 => t('Use TinyURL.com service'), + 3 => t('Redirect only the Domain name'), + 4 => t('Combo: domain redirect and node/xxx alias'), + ), ); $form['short_links']['service_links_domain_redirect'] = array( '#type' => 'textfield', @@ -155,9 +192,9 @@ function service_links_admin_settings() } /** - * Check if domain address textbox is empty + * Check if domain address textbox is empty. */ -function service_links_admin_services_validate($form, &$form_state) { +function service_links_admin_settings_validate($form, &$form_state) { if (isset($form_state['values']['service_links_short_links_type']) && (int) $form_state['values']['service_links_short_links_type'] > 2) { if (!$form_state['values']['service_links_domain_redirect']) { form_set_error('service_links_domain_redirect', t('Domain redirect address is not set.')); @@ -165,32 +202,34 @@ function service_links_admin_services_va if (preg_match("/\/$/", $form_state['values']['service_links_domain_redirect'])) { form_set_error('service_links_domain_redirect', t('No trailing slash!')); } - } + } } /** * Menu callback administration settings for services links list. */ function service_links_admin_services() { - $settings = array(); - $services = service_links_get_links(NULL, TRUE); $settings['show'] = variable_get('service_links_show', NULL); $settings['weight'] = variable_get('service_links_weight', NULL); - $form['service_links'] = array('#theme' => 'service_links_drag_table'); + $form['service_links'] = array( + '#theme' => 'service_links_drag_table', + ); $form['service_links']['service_links_show'] = array('#tree' => TRUE); $form['service_links']['service_links_weight'] = array('#tree' => TRUE); foreach ($services as $service_id => $service) { - $icon = isset($service['icon']) ? $service['icon'] : drupal_get_path('module', 'service_links') ."/images/$service_id.png"; + $icon = array( + 'path' => isset($service['icon']) ? $service['icon'] : drupal_get_path('module', 'service_links') . "/images/$service_id.png" + ); $weight = isset($settings['weight'][$service_id]) ? $settings['weight'][$service_id] : 0; - $form['service_links']['service_links_show'][$service_id] = array ( + $form['service_links']['service_links_show'][$service_id] = array( '#service' => ucwords(str_replace('_', ' ', $service['module'])), '#weight' => $weight, '#type' => 'checkbox', - '#title' => theme('image', $icon). " " . t('Show %name link', array('%name' => $service['name'])), + '#title' => theme('image', $icon) . " " . t('Show %name link', array('%name' => $service['name'])), '#return_value' => 1, '#default_value' => isset($settings['show'][$service_id]) ? $settings['show'][$service_id] : 0, ); @@ -200,5 +239,6 @@ function service_links_admin_services() '#default_value' => $weight, ); } + return system_settings_form($form); } Index: service_links.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/service_links/service_links.info,v retrieving revision 1.4.4.2 diff -u -p -r1.4.4.2 service_links.info --- service_links.info 3 Apr 2009 11:21:03 -0000 1.4.4.2 +++ service_links.info 3 Feb 2010 03:11:34 -0000 @@ -1,5 +1,11 @@ ; $Id: service_links.info,v 1.4.4.2 2009/04/03 11:21:03 thecrow Exp $ -name = "Service links" -description = "Module engine for add various service links about sharing networks to nodes." -core = 6.x +name = Service links +description = Module engine for add various service links about sharing networks to nodes. +core = 7.x package = Service Links + +files[] = service_links.module +files[] = service_links.install +files[] = service_links.admin.inc +files[] = service_links.api.php +configure = admin/config/services/service_links Index: service_links.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/service_links/service_links.install,v retrieving revision 1.4.4.2 diff -u -p -r1.4.4.2 service_links.install --- service_links.install 3 Apr 2009 11:21:03 -0000 1.4.4.2 +++ service_links.install 4 Feb 2010 03:22:27 -0000 @@ -7,11 +7,18 @@ */ /** - * Implementation of hook_uninstall(). + * Implements hook_uninstall(). */ function service_links_uninstall() { - $result = db_query('SELECT name FROM {variable} v WHERE LOCATE("service_links_",v.name) > 0'); - while ($row = db_fetch_object($result)){ - variable_del($row->name); - } + db_delete('variable') + ->condition('name', 'service_links_%', 'LIKE') + ->execute(); +} + +/** + * Update to Drupal 7. Set the version number for new installs. + */ +function service_links_update_7000() { + $ret = array(); + return $ret; } Index: service_links.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/service_links/service_links.module,v retrieving revision 1.26.4.10 diff -u -p -r1.26.4.10 service_links.module --- service_links.module 19 Jan 2010 20:12:03 -0000 1.26.4.10 +++ service_links.module 4 Feb 2010 03:22:58 -0000 @@ -9,10 +9,10 @@ * A module that adds Digg, del.icio.us, reddit, Technorati etc. links to nodes. */ -define('SERVICE_LINKS_STYLE_TEXT',1); -define('SERVICE_LINKS_STYLE_IMAGE',2); -define('SERVICE_LINKS_STYLE_IMAGE_AND_TEXT',3); -define('SERVICE_LINKS_STYLE_FISHEYE',4); +define('SERVICE_LINKS_STYLE_TEXT', 1); +define('SERVICE_LINKS_STYLE_IMAGE', 2); +define('SERVICE_LINKS_STYLE_IMAGE_AND_TEXT', 3); +define('SERVICE_LINKS_STYLE_FISHEYE', 4); define('SERVICE_LINKS_DISABLED', 0); define('SERVICE_LINKS_IN_TEASER', 1); @@ -20,32 +20,34 @@ define('SERVICE_LINKS_IN_FULL', 2); define('SERVICE_LINKS_IN_BOTH', 3); /** - * Implementation of hook_help(). + * Implements hook_help(). */ function service_links_help($path, $arg) { switch ($path) { case 'admin/help#service_links': - return '
'. t('Display links to social sharing websites like Digg, del.icio.us, reddit, Technorati etc.') .'
'; - break; - case "admin/modules#description": - return ''. t('Control which and where service links should be active.') .'
'; + return '' . t('Display links to social sharing websites like Digg, del.icio.us, reddit, Technorati etc.') . '
'; } } /** - * Implementation of hook_perm(). + * Implements hook_perm(). */ function service_links_perm() { - return array('access service links', 'administer service links'); + return array( + 'access service links' => array( + 'title' => t('Access service links'), + ), + 'administer service links' => array( + 'title' => t('Administer service links'), + ), + ); } /** - * Implementation of hook_menu(). + * Implements hook_menu(). */ function service_links_menu() { - $items = array(); - - $items['admin/settings/service_links'] = array( + $items['admin/config/services/service_links'] = array( 'title' => 'Service links', 'description' => 'Control which and where service links should be active.', 'page callback' => 'drupal_get_form', @@ -55,13 +57,13 @@ function service_links_menu() { 'file' => 'service_links.admin.inc', ); - $items['admin/settings/service_links/general'] = array( + $items['admin/config/services/service_links/general'] = array( 'title' => 'General Settings', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); - $items['admin/settings/service_links/services'] = array( + $items['admin/config/services/service_links/services'] = array( 'title' => 'Services', 'page callback' => 'drupal_get_form', 'page arguments' => array('service_links_admin_services'), @@ -75,77 +77,89 @@ function service_links_menu() { } /** - * Implementation of hook_nodeapi(). + * Implements hook_node_load(). */ -function service_links_nodeapi(&$node, $op, $teaser, $page) { - switch ($op) { - case 'load': - if (arg(2) != 'edit') { - $links_show = _service_links_show($node); - if ($links_show) { - $node->service_links = service_links_render($node, TRUE); - $node->service_links_rendered = theme('service_links_node_format', $node->service_links); - } +function service_links_node_load($nodes, $types) { + if (arg(2) != 'edit') { + foreach ($nodes as $node) { + $links_show = _service_links_show($node); + if ($links_show) { + $nodes[$node->nid]->service_links = service_links_render($node, TRUE); + $nodes[$node->nid]->service_links_rendered = theme('service_links_node_format', + array( + 'links' => $node->service_links, + ) + ); } - break; - case 'view': - if (isset($node->service_links) && user_access('access service links')) { - switch (variable_get('service_links_in_node', 0)) { - case 1: - if ($teaser) { - $node->content['service_links'] = array( - '#value' => $node->service_links_rendered, - '#weight' => 10, - ); - } - break; - case 2: - if ($page) { - $node->content['service_links'] = array( - '#value' => $node->service_links_rendered, - '#weight' => 10, - ); - } - break; - case 3: - if ($teaser) { - $node->content['service_links'] = array( - '#value' => $node->service_links_rendered, - '#weight' => 10, - ); - } - else if ($page) { - $node->content['service_links'] = array( - '#value' => $node->service_links_rendered, - '#weight' => 10, - ); - } - break; + } + } +} + +/** + * Implements hook_node_view(). + */ +function service_links_node_view($node, $view_mode) { + if (isset($node->service_links) && user_access('access service links')) { + switch (variable_get('service_links_in_node', SERVICE_LINKS_DISABLED)) { + case SERVICE_LINKS_IN_TEASER: + if ($view_mode == 'teaser') { + $node->content['service_links'] = array( + '#markup' => $node->service_links_rendered, + '#weight' => 10, + ); } - } - break; + break; + + case SERVICE_LINKS_IN_FULL: + if ($view_mode == 'full') { + $node->content['service_links'] = array( + '#markup' => $node->service_links_rendered, + '#weight' => 10, + ); + } + break; + + case SERVICE_LINKS_IN_BOTH: + if ($view_mode == 'teaser') { + $node->content['service_links'] = array( + '#markup' => $node->service_links_rendered, + '#weight' => 10, + ); + } + elseif ($view_mode == 'full') { + $node->content['service_links'] = array( + '#markup' => $node->service_links_rendered, + '#weight' => 10, + ); + } + break; + } } } /** - * Implementation of hook_link(). + * Implements hook_link(). */ function service_links_link($type, $node = NULL, $teaser = FALSE) { $links = array(); - switch (variable_get('service_links_in_links', 0)) { + switch (variable_get('service_links_in_links', SERVICE_LINKS_DISABLED)) { case SERVICE_LINKS_DISABLED: $show_links = FALSE; break; + case SERVICE_LINKS_IN_TEASER: $show_links = $teaser ? TRUE : FALSE; break; + case SERVICE_LINKS_IN_FULL: $show_links = $teaser ? FALSE : TRUE; break; + case SERVICE_LINKS_IN_BOTH: $show_links = TRUE; break; + default: $show_links = FALSE; } @@ -160,108 +174,127 @@ function service_links_link($type, $node } /** - * Implementation of hook_block(). + * Implements hook_block_info(). */ -function service_links_block($op = 'list', $delta = 0, $edit = array()) { - if ($op == 'list') { - $blocks['service_links'] = array( - 'info' => t('Service links'), - 'cache' => BLOCK_NO_CACHE, - ); - $blocks['service_links_fisheye'] = array( - 'info' => t('Service links with FishEye effect'), - 'cache' => BLOCK_NO_CACHE, - ); - return $blocks; - } - elseif ($op == 'view') { - if (user_access('access service links') && $node = menu_get_object('node')) { - $links_show = _service_links_show($node); - if ($links_show) { - switch ($delta) { - case 'service_links': - $block['subject'] = t('Bookmark/Search this post'); - $style = variable_get('service_links_block_style', SERVICE_LINKS_STYLE_IMAGE_AND_TEXT); - $block['content'] = theme('service_links_block_format', service_links_render($node, FALSE, $style), $style); - break; - - case 'service_links_fisheye': - $block['subject'] = t('Bookmark/Search this post'); - $block['content'] = theme('service_links_fisheye_format', service_links_render($node, FALSE, SERVICE_LINKS_STYLE_FISHEYE)); - break; - } +function service_links_block_info() { + $blocks['service_links'] = array( + 'info' => t('Service links'), + 'cache' => DRUPAL_NO_CACHE, + ); + $blocks['service_links_fisheye'] = array( + 'info' => t('Service links with FishEye effect'), + 'cache' => DRUPAL_NO_CACHE, + ); + return $blocks; +} + +/** + * Implements hook_block_view(). + */ +function service_links_block_view($delta = '') { + if (user_access('access service links') && $node = menu_get_object('node')) { + $links_show = _service_links_show($node); + if ($links_show) { + switch ($delta) { + case 'service_links': + $block['subject'] = t('Bookmark/Search this post'); + $style = variable_get('service_links_block_style', SERVICE_LINKS_STYLE_IMAGE_AND_TEXT); + $block['content'] = theme('service_links_block_format', + array( + 'items' => service_links_render($node, FALSE, $style), + 'style' => $style, + ) + ); + break; + + case 'service_links_fisheye': + $block['subject'] = t('Bookmark/Search this post'); + $block['content'] = theme('service_links_fisheye_format', + array( + 'items' => service_links_render($node, FALSE, SERVICE_LINKS_STYLE_FISHEYE), + ) + ); + break; } - return $block; } + return $block; } - elseif ($op == 'configure') { - $form = array(); - switch ($delta) { - case 'service_links': - $form['service_links_block_style'] = array( - '#type' => 'select', - '#title' => t('Style'), - '#description' => t('How the service links will appear in the block.'), - '#default_value' => variable_get('service_links_block_style', SERVICE_LINKS_STYLE_IMAGE_AND_TEXT), - '#options' => array( - SERVICE_LINKS_STYLE_TEXT => t('Text'), - SERVICE_LINKS_STYLE_IMAGE => t('Image'), - SERVICE_LINKS_STYLE_IMAGE_AND_TEXT => t('Image and Text'), - ), - ); - break; - case 'service_links_fisheye': - $form['service_links_fisheye_folder'] = array( - '#type' => 'textfield', - '#title' => t('Alternative icon folder'), - '#size' => 60, - '#description' => t('Subfolder under images/ containing icons for fisheye effect (b.e. big_icons/)'), - '#default_value' => variable_get('service_links_fisheye_folder', ''), - ); - break; - } - return $form; +} + +/** + * Implements hook_block_configure(). + */ +function service_links_block_configure($delta = '') { + $form = array(); + switch ($delta) { + case 'service_links': + $form['service_links_block_style'] = array( + '#type' => 'select', + '#title' => t('Style'), + '#description' => t('How the service links will appear in the block.'), + '#default_value' => variable_get('service_links_block_style', SERVICE_LINKS_STYLE_IMAGE_AND_TEXT), + '#options' => array( + SERVICE_LINKS_STYLE_TEXT => t('Text'), + SERVICE_LINKS_STYLE_IMAGE => t('Image'), + SERVICE_LINKS_STYLE_IMAGE_AND_TEXT => t('Image and Text'), + ), + ); + break; + + case 'service_links_fisheye': + $form['service_links_fisheye_folder'] = array( + '#type' => 'textfield', + '#title' => t('Alternative icon folder'), + '#size' => 60, + '#description' => t('Subfolder under images/ containing icons for fisheye effect (b.e. big_icons/)'), + '#default_value' => variable_get('service_links_fisheye_folder', ''), + ); + break; } - elseif ($op == 'save') { - switch ($delta) { - case 'service_links': - variable_set('service_links_block_style', $edit['service_links_block_style']); - break; - case 'service_links_fisheye': - variable_set('service_links_fisheye_folder', $edit['service_links_fisheye_folder']); - break; - } + return $form; +} + +/** + * Implements hook_block_save(). + */ +function service_links_block_save($delta = '', $edit = array()) { + switch ($delta) { + case 'service_links': + variable_set('service_links_block_style', $edit['service_links_block_style']); + break; + + case 'service_links_fisheye': + variable_set('service_links_fisheye_folder', $edit['service_links_fisheye_folder']); + break; } } /** - * Implementation of hook_theme(). + * Implements hook_theme(). */ function service_links_theme() { return array( 'service_links_build_link' => array( - 'arguments' => array( + 'variables' => array( 'text' => NULL, - 'url' => NULL, - 'title' => NULL, + 'url' => array(), 'image' => NULL, 'nodelink' => NULL, - 'style' => NULL, - 'attributes' => NULL, + 'style' => SERVICE_LINKS_STYLE_IMAGE_AND_TEXT, + 'attributes' => array(), ), ), 'service_links_node_format' => array( - 'arguments' => array('links' => NULL), + 'variables' => array('links' => array()), ), 'service_links_block_format' => array( - 'arguments' => array('items' => NULL), + 'variables' => array('items' => array(), 'style' => SERVICE_LINKS_STYLE_IMAGE_AND_TEXT), ), 'service_links_fisheye_format' => array( - 'arguments' => array('items' => NULL), + 'variables' => array('items' => array()), ), 'service_links_drag_table' => array( - 'arguments' => array('form' => NULL), - 'file' => 'service_links.admin.inc', + 'render element' => 'form', ), ); } @@ -279,7 +312,8 @@ function service_links_theme() { * An array containing information for all the requested services. */ function service_links_get_links($services = NULL, $reset = FALSE) { - static $links = NULL; + $links = &drupal_static(__FUNCTION__, NULL); + if (!isset($links) || $reset) { // Retrieve the links from the cache. if (!$reset && ($cache = cache_get('service_links_get_links')) && !empty($cache->data)) { @@ -307,20 +341,23 @@ function service_links_get_links($servic } /** - * Create short links using predefined settings + * Create short links using predefined settings. */ function service_links_short_url($url, $nid) { switch (variable_get('service_links_short_links_type', 1)) { case 1: //with alias = true dont transform with path return url("node/$nid", array('absolute' => TRUE, 'alias' => TRUE)); + case 2: - $turl = drupal_http_request('http://tinyurl.com/api-create.php?url='. $url); + $turl = drupal_http_request('http://tinyurl.com/api-create.php?url=' . $url); $turl = (isset($turl->data) && ($turl->code == 200)) ? $turl->data : $url; return $turl; + case 3: $burl = variable_get('service_links_domain_redirect', NULL); return url($url, array('absolute' => TRUE, 'base_url' => $burl)); + case 4: $burl = variable_get('service_links_domain_redirect', NULL); return url("node/$nid", array('absolute' => TRUE, 'alias' => TRUE, 'base_url' => $burl)); @@ -340,7 +377,7 @@ function service_links_render($node, $no $url = ($node->source_link ? $node->source_link : $node->link); $settings['short_links_use'] = 0; } - else if (!empty($node)) { + elseif (!empty($node)) { $url = url("node/$node->nid", array('absolute' => TRUE)); } else { @@ -374,11 +411,18 @@ function service_links_render($node, $no 'url' => '