PitbullMean
11-25-2010, 12:03 AM
I'm guessing I posted my problem in the wrong section thats why im not getting any replies. I apologize for double posting this problem but i really dont have anywhere else to turn.
I'm using a Game battles Roster plugin for wordpress im working why its not picking up my clans roster it just says "Unable to open the GameBattles team list at the moment"
But i Filled out the script properly.
<?php
/*
Plugin Name: GameBattles Stats
Plugin URI: http://www.robmcghee.com/gamebattles/
Description: Display the statistics for your GameBattles team.
Author: Rob McGhee
Version: 1.1
Author URI: http://www.llygoden.com/
*/
function gamebattles($content) {
$opentag = "[gamebattles:"; // open gamebattles plugin
$closetag = "]"; // close gamebattles plugin
$onlineurl = "http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag="; // website to check online
$stat = "";
$gb = explode($opentag, $content); // find the open tag in the content
$gb = explode($closetag, $gb[1]); // find the close tag in the content
$gb = $gb[0];
$replaced = $opentag . $gb . $closetag; // the string that will be replaced
if ($gb == "http://gamebattles.com/pc/call-of-duty-black-ops/team/os-punho/stats.xml" ){ // check that info was added
$stat = "You must enter a valid GameBattles URL"; // error message for not having details
}else{
if(!$feed = @file_get_contents($gb)){ // get gamebattles XML
$stat = "Unable to open the GameBattles team list at the moment"; // if we can't get the file display an error message
}else{
$feed = uncdata($feed);
$feed = iconv("UTF-8","UTF-8//IGNORE",$feed); // get rid of tm or copyright characters
$gbxml = simplexml_load_string($feed); // load into simplexml
$stat = "<table width='100%' id='roster'><thead><tr><th align='left'>Member</th><th align='left'>Role</th><th>GB Rank™</th><th>XBox Live</th><th>Playing</th></tr></thead><tbody>"; // table header
foreach ($gbxml->roster->player as $player){ //loop through each player
$name = $player->name;
$url = $player->url;
$role = $player->role;
$rank = number_format($player->gbRank);
$onlinefeed = file_get_contents($onlineurl . str_replace(" ","+",trim($name))); // get file
$onlinexml = simplexml_load_string($onlinefeed); // load into simplexml
$online = $onlinexml->PresenceInfo->StatusText;
$game = $onlinexml->PresenceInfo->Title;
$map = $onlinexml->PresenceInfo->Info2;
$map = str_replace("Playing ","", $map);
$stat .= "<tr><td><a href=" . $url . " >". $name . "</td>";
$stat .= "<td>" . $role . "</td>";
$stat .= "<td align='center'>" . $rank . "</td>";
$stat .= "<td align='center'>" . $online . "</td>";
$stat .= "<td align='center'>" . $map . "</td></tr>";
}
$stat .= "</tbody></table><br />";
}
}
$content = str_replace($replaced, $stat,$content); // replace the string in the original text
return $content; // return the text
}
function uncdata($xml)
{
$state = 'out';
$a = str_split($xml);
$new_xml = '';
foreach ($a AS $k => $v) {
// Deal with "state".
switch ( $state ) {
case 'out':
if ( '<' == $v ) {
$state = $v;
} else {
$new_xml .= $v;
}
break;
case '<':
if ( '!' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<!':
if ( '[' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![':
if ( 'C' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![C':
if ( 'D' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CD':
if ( 'A' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CDA':
if ( 'T' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CDAT':
if ( 'A' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CDATA':
if ( '[' == $v ) {
$cdata = '';
$state = 'in';
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case 'in':
if ( ']' == $v ) {
$state = $v;
} else {
$cdata .= $v;
}
break;
case ']':
if ( ']' == $v ) {
$state = $state . $v;
} else {
$cdata .= $state . $v;
$state = 'in';
}
break;
case ']]':
if ( '>' == $v ) {
$new_xml .= str_replace('>','>',
str_replace('>','<',
str_replace('"','"',
str_replace('&','&',
$cdata))));
$state = 'out';
} else {
$cdata .= $state . $v;
$state = 'in';
}
break;
} // switch
}
return $new_xml;
}
add_filter('the_content','gamebattles');
?>
Any help will be appreciated.
I'm using a Game battles Roster plugin for wordpress im working why its not picking up my clans roster it just says "Unable to open the GameBattles team list at the moment"
But i Filled out the script properly.
<?php
/*
Plugin Name: GameBattles Stats
Plugin URI: http://www.robmcghee.com/gamebattles/
Description: Display the statistics for your GameBattles team.
Author: Rob McGhee
Version: 1.1
Author URI: http://www.llygoden.com/
*/
function gamebattles($content) {
$opentag = "[gamebattles:"; // open gamebattles plugin
$closetag = "]"; // close gamebattles plugin
$onlineurl = "http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag="; // website to check online
$stat = "";
$gb = explode($opentag, $content); // find the open tag in the content
$gb = explode($closetag, $gb[1]); // find the close tag in the content
$gb = $gb[0];
$replaced = $opentag . $gb . $closetag; // the string that will be replaced
if ($gb == "http://gamebattles.com/pc/call-of-duty-black-ops/team/os-punho/stats.xml" ){ // check that info was added
$stat = "You must enter a valid GameBattles URL"; // error message for not having details
}else{
if(!$feed = @file_get_contents($gb)){ // get gamebattles XML
$stat = "Unable to open the GameBattles team list at the moment"; // if we can't get the file display an error message
}else{
$feed = uncdata($feed);
$feed = iconv("UTF-8","UTF-8//IGNORE",$feed); // get rid of tm or copyright characters
$gbxml = simplexml_load_string($feed); // load into simplexml
$stat = "<table width='100%' id='roster'><thead><tr><th align='left'>Member</th><th align='left'>Role</th><th>GB Rank™</th><th>XBox Live</th><th>Playing</th></tr></thead><tbody>"; // table header
foreach ($gbxml->roster->player as $player){ //loop through each player
$name = $player->name;
$url = $player->url;
$role = $player->role;
$rank = number_format($player->gbRank);
$onlinefeed = file_get_contents($onlineurl . str_replace(" ","+",trim($name))); // get file
$onlinexml = simplexml_load_string($onlinefeed); // load into simplexml
$online = $onlinexml->PresenceInfo->StatusText;
$game = $onlinexml->PresenceInfo->Title;
$map = $onlinexml->PresenceInfo->Info2;
$map = str_replace("Playing ","", $map);
$stat .= "<tr><td><a href=" . $url . " >". $name . "</td>";
$stat .= "<td>" . $role . "</td>";
$stat .= "<td align='center'>" . $rank . "</td>";
$stat .= "<td align='center'>" . $online . "</td>";
$stat .= "<td align='center'>" . $map . "</td></tr>";
}
$stat .= "</tbody></table><br />";
}
}
$content = str_replace($replaced, $stat,$content); // replace the string in the original text
return $content; // return the text
}
function uncdata($xml)
{
$state = 'out';
$a = str_split($xml);
$new_xml = '';
foreach ($a AS $k => $v) {
// Deal with "state".
switch ( $state ) {
case 'out':
if ( '<' == $v ) {
$state = $v;
} else {
$new_xml .= $v;
}
break;
case '<':
if ( '!' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<!':
if ( '[' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![':
if ( 'C' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![C':
if ( 'D' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CD':
if ( 'A' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CDA':
if ( 'T' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CDAT':
if ( 'A' == $v ) {
$state = $state . $v;
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case '<![CDATA':
if ( '[' == $v ) {
$cdata = '';
$state = 'in';
} else {
$new_xml .= $state . $v;
$state = 'out';
}
break;
case 'in':
if ( ']' == $v ) {
$state = $v;
} else {
$cdata .= $v;
}
break;
case ']':
if ( ']' == $v ) {
$state = $state . $v;
} else {
$cdata .= $state . $v;
$state = 'in';
}
break;
case ']]':
if ( '>' == $v ) {
$new_xml .= str_replace('>','>',
str_replace('>','<',
str_replace('"','"',
str_replace('&','&',
$cdata))));
$state = 'out';
} else {
$cdata .= $state . $v;
$state = 'in';
}
break;
} // switch
}
return $new_xml;
}
add_filter('the_content','gamebattles');
?>
Any help will be appreciated.