| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: gamertags.module,v 1.2 2009/02/24 22:12:46 pobster Exp $ |
| 3 |
|
|
| 4 |
function gamertags_user_register(&$edit, &$user, $category = NULL) { |
/** |
| 5 |
return gamertags_return_form($edit, $user, $category); |
* Implementation of hook_filter(). |
| 6 |
} // gamertags_user_register |
*/ |
| 7 |
|
function gamertags_filter($op, $delta = 0, $format = -1, $text = '') { |
| 8 |
function gamertags_user_form(&$edit, &$user, $category = NULL) { |
switch ($op) { |
| 9 |
return gamertags_return_form($edit, $user, $category); |
case 'list': |
| 10 |
} // gamertags_user_form |
return (array(0 => t('Gamertags filter'))); |
| 11 |
|
break; |
| 12 |
|
case 'name': |
| 13 |
|
return t('gamertags filter'); |
| 14 |
|
break; |
| 15 |
|
case 'description': |
| 16 |
|
return t('Substitutes either [xbox:id] [playstation:id:region] [wii:id] [steam:id] with the corresponding Gamertag'); |
| 17 |
|
break; |
| 18 |
|
case 'no cache': |
| 19 |
|
return TRUE; |
| 20 |
|
break; |
| 21 |
|
case 'prepare': |
| 22 |
|
return $text; |
| 23 |
|
break; |
| 24 |
|
case 'process': |
| 25 |
|
return _gamertags_process_text($text); |
| 26 |
|
break; |
| 27 |
|
} // end switch |
| 28 |
|
} // gamertags_filter |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
/** |
| 32 |
|
* Implementation of hook_filter_tips(). |
| 33 |
|
*/ |
| 34 |
|
function gamertags_filter_tips($delta, $format, $long = FALSE) { |
| 35 |
|
if ($long) { |
| 36 |
|
return t('You can display your Xbox Live Gamertag by typing [xbox:id] your Playstation Network Gamertag by typing [playstation:id:region] and/ or [steam:id] to display your Steam Gamercard'); |
| 37 |
|
} |
| 38 |
|
else { |
| 39 |
|
return t('You can display gamertags using the following formats [xbox:id] [playstation:id:region] [steam:id]]'); |
| 40 |
|
} |
| 41 |
|
} // gamertags_filter_tips |
| 42 |
|
|
| 43 |
function gamertags_user_view(&$edit, &$account, $category = NULL) { |
/** |
| 44 |
if ($account->xbox_gamertag) { |
* Implementation of hook_menu(). |
| 45 |
|
*/ |
| 46 |
|
function gamertags_menu() { |
| 47 |
|
$items['admin/config/gamertags'] = array( |
| 48 |
|
'title' => 'Gamertag Settings', |
| 49 |
|
'description' => 'Settings for the Gamertags module.', |
| 50 |
|
'page callback' => 'drupal_get_form', |
| 51 |
|
'page arguments' => array('gamertags_settings'), |
| 52 |
|
'access arguments' => array('administer site configuration'), |
| 53 |
|
'type' => MENU_NORMAL_ITEM, |
| 54 |
|
); |
| 55 |
|
|
| 56 |
|
return $items; |
| 57 |
|
} // gamertags_menu |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
/** |
| 61 |
|
* Implementation of hook_theme(). |
| 62 |
|
*/ |
| 63 |
|
function gamertags_theme() { |
| 64 |
|
return array( |
| 65 |
|
'gamertags' => array( |
| 66 |
|
'variables' => array('url' => NULL, 'account' => NULL, 'console' => NULL, 'region' => NULL), |
| 67 |
|
), |
| 68 |
|
'gamertags_render' => array( |
| 69 |
|
'variables' => array('account' => NULL), |
| 70 |
|
), |
| 71 |
|
); |
| 72 |
|
} // gamertags_theme |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
/** |
| 76 |
|
* Implementation of hook_user_view(). |
| 77 |
|
*/ |
| 78 |
|
function gamertags_user_view($account, $build_mode) { |
| 79 |
|
if (variable_get('gamertags_collect_xbox', TRUE) && !empty($account->xbox_gamertag)) { |
| 80 |
$account->content['summary']['xbox_gamertag_view'] = array( |
$account->content['summary']['xbox_gamertag_view'] = array( |
| 81 |
'#type' => 'user_profile_item', |
'#type' => 'user_profile_item', |
| 82 |
'#title' => t('Xbox Live Gamertag'), |
'#title' => t('Xbox Live Gamertag'), |
| 83 |
'#markup' => gamertags('fetch', 'xbox', $account->xbox_gamertag), |
'#markup' => gamertags('fetch', 'xbox', $account->xbox_gamertag), |
| 84 |
); |
); |
| 85 |
} |
} |
| 86 |
if ($account->psn_gamertag && $account->psn_region != "na") { |
if (variable_get('gamertags_collect_psn', TRUE) && !empty($account->psn_gamertag) && !empty($account->psn_region)) { |
| 87 |
$account->content['summary']['psn_gamertag_view'] = array( |
$account->content['summary']['psn_gamertag_view'] = array( |
| 88 |
'#type' => 'user_profile_item', |
'#type' => 'user_profile_item', |
| 89 |
'#title' => t('Playstation Network Gamertag'), |
'#title' => t('Playstation Network Gamertag'), |
| 90 |
'#markup' => gamertags('fetch', 'playstation', $account->psn_gamertag, $account->psn_region), |
'#markup' => gamertags('fetch', 'playstation', $account->psn_gamertag, $account->psn_region), |
| 91 |
); |
); |
| 92 |
} |
} |
| 93 |
if ($account->steam_gamertag) { |
if (variable_get('gamertags_collect_wii', TRUE) && !empty($account->wii_gamertag)) { |
| 94 |
|
$account->content['summary']['wii_gamertag_view'] = array( |
| 95 |
|
'#type' => 'user_profile_item', |
| 96 |
|
'#title' => t('Wii Friend Code'), |
| 97 |
|
'#markup' => gamertags('fetch', 'wii', $account->wii_gamertag), |
| 98 |
|
); |
| 99 |
|
} |
| 100 |
|
if (variable_get('gamertags_collect_steam', TRUE) && !empty($account->steam_gamertag)) { |
| 101 |
$account->content['summary']['steam_gamertag_view'] = array( |
$account->content['summary']['steam_gamertag_view'] = array( |
| 102 |
'#type' => 'user_profile_item', |
'#type' => 'user_profile_item', |
| 103 |
'#title' => t('Steam Network Gamertag'), |
'#title' => t('Steam Network Gamertag'), |
| 106 |
} |
} |
| 107 |
} // gamertags_user_view |
} // gamertags_user_view |
| 108 |
|
|
| 109 |
function gamertags_return_form($edit, $user, $category) { |
/** |
| 110 |
$form['gamertags'] = array( |
* Administrative setting callback. |
| 111 |
|
*/ |
| 112 |
|
function gamertags_settings() { |
| 113 |
|
$form['collect'] = array( |
| 114 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 115 |
'#title' => t('Gamertags'), |
'#title' => t('Gamertag Usage'), |
| 116 |
'#collapsible' => FALSE, |
'#description' => t('Collect and Display:'), |
| 117 |
|
'#collapsible' => TRUE, |
| 118 |
'#collapsed' => FALSE, |
'#collapsed' => FALSE, |
|
'#weight' => 1, |
|
| 119 |
); |
); |
| 120 |
$form['gamertags']['psn']['psn_gamertag'] = array( |
$form['collect']['gamertags_collect_xbox'] = array( |
| 121 |
'#type' => 'textfield', |
'#type' => 'checkbox', |
| 122 |
'#title' => t('Playstation Network'), |
'#title' => t("Xbox Gamertags"), |
| 123 |
'#default_value' => $user->psn_gamertag, |
'#default_value' => variable_get('gamertags_collect_xbox', TRUE), |
|
'#description' => t('If you have one, please enter your Playstation Network GamerTag'), |
|
|
); |
|
|
$form['gamertags']['psn']['psn_region'] = array( |
|
|
'#type' => 'select', |
|
|
'#title' => t('Playstation Region'), |
|
|
'#options' => array('na' => t('N/A'), 'eu' => t('Europe'), 'us' => t('America')), |
|
|
'#default_value' => $user->psn_region, |
|
|
'#description' => t('Please enter your region for your PSN gamertag as European ones are rendered differently to US ones.'), |
|
|
); |
|
|
$form['gamertags']['xbox_gamertag'] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('Xbox Live'), |
|
|
'#default_value' => $user->xbox_gamertag, |
|
|
'#description' => t('If you have one, please enter your Xbox Live GamerTag'), |
|
|
); |
|
|
$form['gamertags']['steam_gamertag'] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('Steam'), |
|
|
'#default_value' => $user->steam_gamertag, |
|
|
'#description' => t('If you have one, please enter your Steam GamerTag'), |
|
| 124 |
); |
); |
| 125 |
return $form; |
$form['collect']['gamertags_collect_psn'] = array( |
| 126 |
} // gamertags_return_form |
'#type' => 'checkbox', |
| 127 |
|
'#title' => t("Playstation Gamertags"), |
| 128 |
|
'#default_value' => variable_get('gamertags_collect_psn', TRUE), |
| 129 |
|
); |
| 130 |
|
$form['collect']['gamertags_collect_wii'] = array( |
| 131 |
|
'#type' => 'checkbox', |
| 132 |
|
'#title' => t("Wii Friend Codes"), |
| 133 |
|
'#default_value' => variable_get('gamertags_collect_wii', TRUE), |
| 134 |
|
); |
| 135 |
|
$form['collect']['gamertags_collect_steam'] = array( |
| 136 |
|
'#type' => 'checkbox', |
| 137 |
|
'#title' => t("Steam Gamertags"), |
| 138 |
|
'#default_value' => variable_get('gamertags_collect_steam', TRUE), |
| 139 |
|
); |
| 140 |
|
$form['settings'] = array( |
| 141 |
|
'#type' => 'fieldset', |
| 142 |
|
'#title' => t('Gamertag Settings'), |
| 143 |
|
'#collapsible' => TRUE, |
| 144 |
|
'#collapsed' => FALSE, |
| 145 |
|
); |
| 146 |
|
$form['settings']['gamertags_on_registration'] = array( |
| 147 |
|
'#type' => 'checkbox', |
| 148 |
|
'#title' => t("Ask for Gamertags on registration screen"), |
| 149 |
|
'#description' => t("Check this if you want users to be able to input their Gamertags on the user registration page as well as from their user account pages after they've registered."), |
| 150 |
|
'#default_value' => variable_get('gamertags_on_registration', TRUE), |
| 151 |
|
); |
| 152 |
|
$form['settings']['gamertags_debunk_ms'] = array( |
| 153 |
|
'#type' => 'checkbox', |
| 154 |
|
'#title' => t("Don't use Xbox.com for Xbox gamercard"), |
| 155 |
|
'#description' => t("If you use Xbox.com then you have to be happy with Microsofts 'solution' of having your Gamertags inside iframes. Checking this box will use Gamertags from MyGamercard.net instead of official (but iframed) ones."), |
| 156 |
|
'#default_value' => variable_get('gamertags_debunk_ms', FALSE), |
| 157 |
|
); |
| 158 |
|
$form['settings']['gamertags_use_mapwii'] = array( |
| 159 |
|
'#type' => 'checkbox', |
| 160 |
|
'#title' => t("Use mapwii.com for Wii Friend Codes"), |
| 161 |
|
'#description' => t("Check this box to allow users wii friend codes to link through to the mapwii.com friend code repository."), |
| 162 |
|
'#default_value' => variable_get('gamertags_use_mapwii', FALSE), |
| 163 |
|
); |
| 164 |
|
return system_settings_form($form); |
| 165 |
|
} // gamertags_settings |
| 166 |
|
|
| 167 |
|
/** |
| 168 |
|
* Implement hook_form_FORM_ID_alter(). |
| 169 |
|
*/ |
| 170 |
|
function gamertags_form_user_profile_form_alter(&$form, &$form_state) { |
| 171 |
|
if ($form['#user_category'] == 'account') { |
| 172 |
|
$account = $form['#user']; |
| 173 |
|
if (!_gamertags_test_any()) { |
| 174 |
|
return; |
| 175 |
|
} |
| 176 |
|
$form['gamertags'] = array( |
| 177 |
|
'#type' => 'fieldset', |
| 178 |
|
'#title' => t('Gamertags'), |
| 179 |
|
'#collapsible' => FALSE, |
| 180 |
|
'#collapsed' => FALSE, |
| 181 |
|
'#weight' => 1, |
| 182 |
|
); |
| 183 |
|
if (variable_get('gamertags_collect_psn', TRUE)) { |
| 184 |
|
$form['gamertags']['psn']['psn_gamertag'] = array( |
| 185 |
|
'#type' => 'textfield', |
| 186 |
|
'#title' => t('Playstation Network'), |
| 187 |
|
'#default_value' => !empty($account->psn_gamertag) ? $account->psn_gamertag : FALSE, |
| 188 |
|
'#description' => t('If you have one, please enter your Playstation Network GamerTag.'), |
| 189 |
|
); |
| 190 |
|
$form['gamertags']['psn']['psn_region'] = array( |
| 191 |
|
'#type' => 'select', |
| 192 |
|
'#title' => t('Playstation Region'), |
| 193 |
|
'#options' => array('na' => t('N/A'), 'eu' => t('Europe'), 'us' => t('America')), |
| 194 |
|
'#default_value' => !empty($account->psn_region) ? $account->psn_region : FALSE, |
| 195 |
|
'#description' => t("As Sony don't seem to have thought this through properly, please enter the region for your PSN gamertag."), |
| 196 |
|
); |
| 197 |
|
} |
| 198 |
|
if (variable_get('gamertags_collect_xbox', TRUE)) { |
| 199 |
|
$form['gamertags']['xbox_gamertag'] = array( |
| 200 |
|
'#type' => 'textfield', |
| 201 |
|
'#title' => t('Xbox Live'), |
| 202 |
|
'#default_value' => !empty($account->xbox_gamertag) ? $account->xbox_gamertag : FALSE, |
| 203 |
|
'#description' => t('If you have one, please enter your Xbox Live GamerTag.'), |
| 204 |
|
); |
| 205 |
|
} |
| 206 |
|
if (variable_get('gamertags_collect_wii', TRUE)) { |
| 207 |
|
$form['gamertags']['wii_gamertag'] = array( |
| 208 |
|
'#type' => 'textfield', |
| 209 |
|
'#title' => t('Nintendo Wii'), |
| 210 |
|
'#default_value' => !empty($account->wii_gamertag) ? $account->wii_gamertag : FALSE, |
| 211 |
|
'#description' => t('If you have one, please enter your Wii Friend Code.'), |
| 212 |
|
); |
| 213 |
|
} |
| 214 |
|
if (variable_get('gamertags_collect_steam', TRUE)) { |
| 215 |
|
$form['gamertags']['steam_gamertag'] = array( |
| 216 |
|
'#type' => 'textfield', |
| 217 |
|
'#title' => t('Steam'), |
| 218 |
|
'#default_value' => !empty($account->steam_gamertag) ? $account->steam_gamertag : FALSE, |
| 219 |
|
'#description' => t('If you have one, please enter your Steam GamerTag.'), |
| 220 |
|
); |
| 221 |
|
} |
| 222 |
|
} |
| 223 |
|
} // gamertags_form_user_profile_form_alter |
| 224 |
|
|
| 225 |
|
/** |
| 226 |
|
* Helper function to return TRUE if any gamertags are set to be collectable/ displayable. |
| 227 |
|
*/ |
| 228 |
|
function _gamertags_test_any() { |
| 229 |
|
if (variable_get('gamertags_collect_xbox', TRUE) || variable_get('gamertags_collect_psn', TRUE) || variable_get('gamertags_collect_wii', TRUE) || variable_get('gamertags_collect_steam', TRUE)) { |
| 230 |
|
return TRUE; |
| 231 |
|
} |
| 232 |
|
return FALSE; |
| 233 |
|
} // _gamertags_test_any |
| 234 |
|
|
| 235 |
function gamertags($op, $console, $user, $region = NULL) { |
function gamertags($op, $console, $account, $region = NULL) { |
| 236 |
switch ($op) { |
switch ($op) { |
| 237 |
case 'fetch': |
case 'fetch': |
| 238 |
return theme('gamertags', gamertags('url', $console, $user, $region), $user, $console, $region); |
return theme('gamertags', array('url' => gamertags('url', $console, check_plain($account), $region), 'account' => check_plain($account), 'console' => $console, 'region' => $region)); |
| 239 |
case 'url': |
case 'url': |
| 240 |
return gamertags_return_url($console, $user, $region); |
return gamertags_return_url($console, check_plain($account), $region); |
| 241 |
} // end switch $op |
} // end switch $op |
| 242 |
} // gamertags |
} // gamertags |
| 243 |
|
|
| 244 |
function gamertags_return_url($console, $user, $region) { |
/** |
| 245 |
|
* Returns a formatted URL for linking from gamertags. |
| 246 |
|
*/ |
| 247 |
|
function gamertags_return_url($console, $account, $region) { |
| 248 |
switch ($console) { |
switch ($console) { |
| 249 |
case 'xbox': |
case 'xbox': |
| 250 |
return sprintf("http://gamercard.xbox.com/%s.card", $user); |
return variable_get('gamertags_debunk_ms', FALSE) ? sprintf("http://card.mygamercard.net/%s.png", $account) : sprintf("http://gamercard.xbox.com/%s.card", $account); |
| 251 |
case 'playstation': |
case 'playstation': |
| 252 |
switch ($region) { |
switch ($region) { |
| 253 |
default: |
default: |
| 254 |
return sprintf("http://mypsn.eu.playstation.com/psn/profile/%s.jpg", $user); |
return sprintf("http://mypsn.eu.playstation.com/psn/profile/%s.jpg", $account); |
| 255 |
case 'us': |
case 'us': |
| 256 |
return sprintf("http://pid.us.playstation.com/user/%s.jpg", $user); |
return sprintf("http://pid.us.playstation.com/user/%s.jpg", $account); |
| 257 |
} |
} |
| 258 |
|
case 'wii': |
| 259 |
|
return sprintf("http://mapwii.com/wii-number/member.cfm?wii_number=%s", str_replace(' ', '', $account)); |
| 260 |
case 'steam': |
case 'steam': |
| 261 |
return sprintf("http://steamcard.com/do/modern/%s.png", $user); |
return sprintf("http://steamcard.com/do/modern/%s.png", $account); |
| 262 |
} |
} |
| 263 |
} // gamertags_return_url |
} // gamertags_return_url |
| 264 |
|
|
| 265 |
function theme_gamertags($url, $user, $console, $region = NULL) { |
/** |
| 266 |
switch ($console) { |
* Helper function which processes token matching and returns the appropriate Gamertag. |
| 267 |
case 'xbox': |
*/ |
|
return sprintf("<iframe name=\"xbox_gamertag\" src=\"%s\" scrolling=\"no\" width=\"204\" height=\"140\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\">If you can see this, your browser does not support iframes!</iframe>", $url); |
|
|
case 'playstation': |
|
|
switch ($region) { |
|
|
default: |
|
|
return l(sprintf("<img src=\"%s\" alt=\"Playstation Network Gamertag\" name=\"psn_gamertag\" />", $url), 'http://uk.playstation.com/psn/profile/'. $user, array('html' => TRUE)); |
|
|
case 'us': |
|
|
return l(sprintf("<img src=\"%s\" alt=\"Playstation Network Gamertag\" name=\"psn_gamertag\" />", $url), 'http://us.playstation.com/psn/profile/'. $user, array('html' => TRUE)); |
|
|
} |
|
|
case 'steam': |
|
|
return sprintf("<img src=\"%s\" alt=\"Steam Gamertag\" name=\"steam_gamertag\" />", $url); |
|
|
} |
|
|
} // theme_gamertags |
|
|
|
|
|
function gamertags_filter($op, $delta = 0, $format = -1, $text = '') { |
|
|
switch ($op) { |
|
|
case 'list': |
|
|
return (array(0 => t('Gamertags filter'))); |
|
|
break; |
|
|
case 'name': |
|
|
return t('gamertags filter'); |
|
|
break; |
|
|
case 'description': |
|
|
return t('Substitutes either [xbox:id] [playstation:id:region] [steam:id] with the corresponding Gamertag'); |
|
|
break; |
|
|
case 'no cache': |
|
|
return TRUE; |
|
|
break; |
|
|
case 'prepare': |
|
|
return $text; |
|
|
break; |
|
|
case 'process': |
|
|
return _gamertags_process_text($text); |
|
|
break; |
|
|
} // end switch |
|
|
} // gamertags_filter |
|
|
|
|
| 268 |
function _gamertags_process_text($text) { |
function _gamertags_process_text($text) { |
| 269 |
$pattern = "/\[(xbox|playstation|steam):(.*)\]/i"; |
$pattern = "/\[(xbox|playstation|wii|steam):(.*)\]/i"; |
| 270 |
if (preg_match_all($pattern, $text, $matches)) { |
if (preg_match_all($pattern, $text, $matches)) { |
| 271 |
foreach ($matches[1] as $no => $match) { |
foreach ($matches[1] as $no => $match) { |
| 272 |
if (drupal_strtolower($match) == 'playstation') { |
if (drupal_strtolower($match) == 'playstation') { |
| 281 |
return $text; |
return $text; |
| 282 |
} // _gamertags_process_text |
} // _gamertags_process_text |
| 283 |
|
|
| 284 |
function gamertags_filter_tips($delta, $format, $long = FALSE) { |
/** |
| 285 |
if ($long) { |
* Returns a themed Gamertag. |
| 286 |
return t('You can display your Xbox Live Gamertag by typing [xbox:id] your Playstation Network Gamertag by typing [playstation:id:region] and/ or [steam:id] to display your Steam Gamercard'); |
*/ |
| 287 |
} |
function theme_gamertags($variables) { |
| 288 |
else { |
switch ($variables['console']) { |
| 289 |
return t('You can display gamertags using the following formats [xbox:id] [playstation:id:region] [steam:id]]'); |
case 'xbox': |
| 290 |
|
return variable_get('gamertags_debunk_ms', FALSE) ? sprintf("<img src=\"%s\" alt=\"Xbox Gamertag\" name=\"xbox_gamertag\" />", $variables['url']) : sprintf("<iframe name=\"xbox_gamertag\" src=\"%s\" scrolling=\"no\" width=\"204\" height=\"140\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\">If you can see this, your browser does not support iframes!</iframe>", $variables['url']); |
| 291 |
|
case 'playstation': |
| 292 |
|
switch ($variables['region']) { |
| 293 |
|
default: |
| 294 |
|
return l(sprintf("<img src=\"%s\" alt=\"Playstation Network Gamertag\" name=\"psn_gamertag\" />", $variables['url']), 'http://uk.playstation.com/psn/profile/'. $variables['account'], array('html' => TRUE)); |
| 295 |
|
case 'us': |
| 296 |
|
return l(sprintf("<img src=\"%s\" alt=\"Playstation Network Gamertag\" name=\"psn_gamertag\" />", $variables['url']), 'http://us.playstation.com/psn/profile/'. $variables['account'], array('html' => TRUE)); |
| 297 |
|
} |
| 298 |
|
case 'wii': |
| 299 |
|
drupal_add_css(drupal_get_path('module', 'gamertags') .'/gamertags.css'); |
| 300 |
|
return variable_get('gamertags_use_mapwii', FALSE) ? sprintf("<div id=\"wii_bg\"><div id=\"wii_text\"><a href=\"%s\">%s</a></div></div>", $variables['url'], $variables['account']) : sprintf("<div id=\"wii_bg\"><div id=\"wii_text\">%s</div></div>", $variables['account']); |
| 301 |
|
case 'steam': |
| 302 |
|
return sprintf("<img src=\"%s\" alt=\"Steam Gamertag\" name=\"steam_gamertag\" />", $variables['url']); |
| 303 |
} |
} |
| 304 |
} // gamertags_filter_tips |
} // theme_gamertags |
| 305 |
|
|
| 306 |
function gamertags_theme() { |
/** |
| 307 |
return array( |
* Returns all Gamertags for a specified user account. |
| 308 |
'gamertags' => array( |
*/ |
| 309 |
'arguments' => array('url' => NULL, 'user' => NULL, 'console' => NULL, 'region' => NULL), |
function theme_gamertags_render($variables) { |
| 310 |
), |
drupal_add_css(drupal_get_path('module', 'gamertags') .'/gamertags.css'); |
| 311 |
); |
$output = array(); |
| 312 |
} // gamertags_theme |
if (variable_get('gamertags_collect_xbox', TRUE) && $variables['account']->xbox_gamertag) { |
| 313 |
|
$output[] = gamertags('fetch', 'xbox', $variables['account']->xbox_gamertag); |
| 314 |
|
} |
| 315 |
|
if (variable_get('gamertags_collect_psn', TRUE) && $variables['account']->psn_gamertag) { |
| 316 |
|
$output[] = gamertags('fetch', 'playstation', $variables['account']->psn_gamertag, $variables['account']->psn_region); |
| 317 |
|
} |
| 318 |
|
if (variable_get('gamertags_collect_wii', TRUE) && $variables['account']->wii_gamertag) { |
| 319 |
|
$output[] = gamertags('fetch', 'wii', $variables['account']->wii_gamertag); |
| 320 |
|
} |
| 321 |
|
if (variable_get('gamertags_collect_steam', TRUE) && $variables['account']->steam_gamertag) { |
| 322 |
|
$output[] = gamertags('fetch', 'steam', $variables['account']->steam_gamertag); |
| 323 |
|
} |
| 324 |
|
if (count($output) == 1) { |
| 325 |
|
return $output[0]; |
| 326 |
|
} |
| 327 |
|
return theme('item_list', array('items' => $output, 'title' => NULL, 'type' => 'ul', 'attributes' => array('id' => 'gamertags-all'))); |
| 328 |
|
} // theme_gamertags_render |