Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2007
    Location
    Glencoe, Ontario, Canada
    Posts
    340
    Thanks
    19
    Thanked 27 Times in 27 Posts

    Plugin not working

    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 Code:
    <?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&trade;</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('>','&gt;'
                                        
    str_replace('>','&lt;'
                                        
    str_replace('"','&quot;'
                                        
    str_replace('&','&amp;'
                                        
    $cdata)))); 
                            
    $state 'out'
                        } else { 
                            
    $cdata .= $state $v
                            
    $state 'in'
                        } 
                    break; 
                } 
    // switch 
            

            return 
    $new_xml
        } 

    add_filter('the_content','gamebattles'); 

    ?>
    Any help will be appreciated.
    Eric "PitbullMean" Melo
    Always Start your layout with*{border:0; margin:0; padding:0;}
    Be sure to Thank ALL Users who give assistance.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    The value you are giving to the function .... $content

    What is the value of $content when you call the function.

  • #3
    Regular Coder
    Join Date
    Oct 2007
    Location
    Glencoe, Ontario, Canada
    Posts
    340
    Thanks
    19
    Thanked 27 Times in 27 Posts
    Well this is the script i downloaded from wordpress. Its pretty much suppose to display my clans roster on Gamebattles.com via the XML file. So I dunno what the developer did so I cant really answer that question.
    Eric "PitbullMean" Melo
    Always Start your layout with*{border:0; margin:0; padding:0;}
    Be sure to Thank ALL Users who give assistance.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    No way for me to test anything, so you'll have to find a programmer who
    can actually get into your files and test things out in real time. There is a
    section on this forum where you could hire someone ... unless there's a
    person that is willing to do it for free.

  • #5
    Regular Coder
    Join Date
    Oct 2007
    Location
    Glencoe, Ontario, Canada
    Posts
    340
    Thanks
    19
    Thanked 27 Times in 27 Posts
    Ya I dont think a programmer will do that for free.
    Eric "PitbullMean" Melo
    Always Start your layout with*{border:0; margin:0; padding:0;}
    Be sure to Thank ALL Users who give assistance.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •