Changeset 25473


Ignore:
Timestamp:
11/13/13 12:20:17 (6 years ago)
Author:
mistic100
Message:

factorize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/SocialButtons/main.inc.php

    r25178 r25473  
    9696  global $conf, $template, $picture; 
    9797   
     98  set_make_full_url(); 
    9899  $basename = script_basename(); 
    99   set_make_full_url(); 
    100100  $root_url = get_absolute_root_url(); 
    101101   
     
    141141   
    142142  $buttons = array(); 
    143    
    144   if ($conf['SocialButtons']['google']['enabled']) 
    145   { 
    146     include_once(SOCIALBUTT_PATH . 'include/google.inc.php'); 
    147     socialbutt_google($basename, $root_url, $tpl_vars, $buttons); 
    148   } 
    149   if ($conf['SocialButtons']['twitter']['enabled']) 
    150   { 
    151     include_once(SOCIALBUTT_PATH . 'include/twitter.inc.php'); 
    152     socialbutt_twitter($basename, $root_url, $tpl_vars, $buttons); 
    153   } 
    154   if ($conf['SocialButtons']['facebook']['enabled']) 
    155   { 
    156     include_once(SOCIALBUTT_PATH . 'include/facebook.inc.php'); 
    157     socialbutt_facebook($basename, $root_url, $tpl_vars, $buttons); 
    158   } 
    159   if ($conf['SocialButtons']['tumblr']['enabled']) 
    160   { 
    161     include_once(SOCIALBUTT_PATH . 'include/tumblr.inc.php'); 
    162     socialbutt_tumblr($basename, $root_url, $tpl_vars, $buttons); 
    163   } 
    164   if ($conf['SocialButtons']['pinterest']['enabled'] and $basename=='picture') 
    165   { 
    166     include_once(SOCIALBUTT_PATH . 'include/pinterest.inc.php'); 
    167     socialbutt_pinterest($basename, $root_url, $tpl_vars, $buttons); 
    168   } 
    169   if ($conf['SocialButtons']['reddit']['enabled']) 
    170   { 
    171     include_once(SOCIALBUTT_PATH . 'include/reddit.inc.php'); 
    172     socialbutt_reddit($basename, $root_url, $tpl_vars, $buttons); 
    173   } 
    174   if ($conf['SocialButtons']['linkedin']['enabled']) 
    175   { 
    176     include_once(SOCIALBUTT_PATH . 'include/linkedin.inc.php'); 
    177     socialbutt_linkedin($basename, $root_url, $tpl_vars, $buttons); 
     143  $services = array('google', 'twitter', 'facebook', 'tumblr', 'pinterest', 'reddit', 'linkedin'); 
     144   
     145  foreach ($services as $service) 
     146  { 
     147    if ($conf['SocialButtons'][$service]['enabled']) 
     148    { 
     149      include_once(SOCIALBUTT_PATH . 'include/'. $service .'.inc.php'); 
     150      call_user_func_array('socialbutt_'.$service, array($basename, $root_url, &$tpl_vars, &$buttons)); 
     151    } 
    178152  } 
    179153   
Note: See TracChangeset for help on using the changeset viewer.