PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 19th, 2012, 03:05 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Php project, joomla component

Hello to all.
Excuse my bad Englishe, i will tray to short describe what this project is.
In Joomla is one component which conect Joomla website with MochiMedia game feed. In last few month MM change have share game, and therefore this component stop working. :S
I read php dokument within component, and change some thing, and games start showing.
Changes:
1.In folder \com_yoflash\admin\views\mochigames in view.html.php dokument i change this code.
PHP Code:
//$ffp=fopen("http://www.mochimedia.com/feeds/games/".$publisherID."/?limit=25&offset=10"); 
to
PHP Code:
//$ffp=fopen("http://feedmonger.mochimedia.com/feeds/query/partner_id=".$publisherID."/?limit=25&offset=10"); 
because old MM games feed use this structure of html :
Code:
http://www.mochimedia.com/feeds/games/XXXX 
and new one use this
Code:
http://feedmonger.mochimedia.com/feeds/query/partner_id=XXXX 
.
2.In folder \com_yoflash\admin\models in dokument yfl_mochifeed.php i change same thing, which for result have to show games.
But when i tray to add games, or to filter games trough category their is problems, because MM use new html structure for that. For that i need help to change so this component start working ok.
Attached Files
File Type: zip com_yoflash.zip (195.4 KB, 15 views)

Last edited by Robotower : November 19th, 2012 at 03:36 AM.

Reply With Quote
  #2  
Old November 19th, 2012, 04:04 AM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,679 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 46 m 33 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Quote:
Originally Posted by Robotower
But when i tray to add games, or to filter games trough category their is problems

What problems?

Reply With Quote
  #3  
Old November 19th, 2012, 04:40 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Quote:
Originally Posted by requinix
What problems?

Old html structure for category look like this.
Code:
http://www.mochimedia.com/feeds/games/XXXX/action/ 

And new onr look like this.
Code:
http://feedmonger.mochimedia.com/feeds/query/?q=(recommendation%3A%3E%3D0)%20and%20category%3Aaction&partner_id=XXXX
So somewhere in some php document need to change this code. But problem is because it use so many code to make link. And i can get mowing with this. :S

Reply With Quote
  #4  
Old November 19th, 2012, 04:46 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
This is php script for getting MM feeed for games.
PHP Code:
<?php
class YoflashModelFeed extends JModel {

    function 
getFeed($cat$offset$limit$keyword=NULL){

      
$db =& JFactory::getDBO();
      
//$session =&JFactory::getSession();

      
if(empty($cat))
        
$cat="all";

      
$params = &JComponentHelper::getParams'com_yoflash' );
      
$publisherid=$params->get('publisherid');

      
$game=array();
      if(
$params->get('JSON_or_RSS')=="rss") {
           if(
$params->get('curl_or_fopen')=="curl") {
               
//Curl support
               
$link="http://www.mochimedia.com/feeds/games/".$publisherid."/".$cat."/?limit=".$limit."&offset=".$offset."";
               if(
$keyword$link=$link."&tag=".$keyword;
               
$ch curl_init();
               
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
              
curl_setopt($chCURLOPT_URL$link);
              
curl_setopt($chCURLOPT_HEADERFALSE);

              
$ref curl_exec  (  $ch  );
              
curl_close($ch);
              
$feed=simplexml_load_string($ref);
           }
           else {
         
//fopen support
         
$link="http://www.mochimedia.com/feeds/games/".$publisherid."/".$cat."/?limit=".$limit."&offset=".$offset."";
            if(
$keyword$link=$link."&tag=".$keyword;
              
$feed simplexml_load_file($link);
           }
          for(
$i=0;$i<count($feed->entry);$i++) {
            
$entry=$feed->entry[$i];
              
$game[$i]->title=(string)$entry->title;;
            
$game[$i]->author=(string)$entry->author->name;
            
$game[$i]->file_swf=(string)$entry->link[1]->attributes()->href;
            
$game[$i]->file_type=(string)$entry->link[1]->attributes()->type;
            
$game[$i]->file_img=(string)$entry->summary->div->a->img->attributes()->src;
            
$summary=array();
            for(
$j=0;$j<count($entry->summary->div->dl->dt);$j++) {
              
$summary[(string)$entry->summary->div->dl->dt[$j]] = (string)$entry->summary->div->dl->dd[$j];
              
//=array((string)$entry->summary->div->dl->dt[$j] => $entry->summary->div->dl->dd[$j]);
            
}

            
$game[$i]->uid $summary['Tag'];
            
$game[$i]->slug $summary['Slug'];
            
$game[$i]->description $summary['Description'];
            
$game[$i]->res $summary['Resolution'];
            
$resolution=explode("x"$summary['Resolution']);
            
$game[$i]->x=$resolution[0];
            
$game[$i]->y=$resolution[1];
            
$game[$i]->instruction $summary['Instructions'];
            
$game[$i]->categories $summary['Categories'];
            
$game[$i]->rating $summary['Rating'];
            
$game[$i]->leaderboard$summary['Leaderboards'];
            @
$game[$i]->file_size$summary['SWF file size'];
            
$game[$i]->keywords$summary['Keywords'];

          }

      }
      else if (
$params->get('JSON_or_RSS')=="json") {
           if(
$params->get('curl_or_fopen')=="curl") {
             
//Curl support
             
$link="http://www.mochimedia.com/feeds/games/".$publisherid."/".$cat."/?limit=".$limit."&offset=".$offset."&format=json";
              if(
$keyword$link=$link."&tag=".$keyword;
               
$ch curl_init();
               
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
              
curl_setopt($chCURLOPT_URL$link);
              
curl_setopt($chCURLOPT_HEADERFALSE);

              
$json curl_exec  (  $ch  );
              
curl_close($ch);
           }
           else {
          
//fopen support
             
$link="http://www.mochimedia.com/feeds/games/".$publisherid."/".$cat."/?limit=".$limit."&offset=".$offset."&format=json";
            if(
$keyword$link=$link."&tag=".$keyword;
              
$json =  file_get_contents($link);
           }
           
$feed=json_decode($json);
         
$feeds=$feed->games;
         for(
$i=0;$i<count($feeds);$i++) {
            
$entry=$feeds[$i];
              
$game[$i]->title=$entry->name;
              
$game[$i]->slug=$entry->slug;
              
$game[$i]->author=$entry->author;
            
$game[$i]->file_swf=$entry->swf_url;
            
$game[$i]->file_type="application/x-shockwave-flash";
            
$game[$i]->file_img=$entry->thumbnail_url;
               
$game[$i]->uid $entry->game_tag;
            
$game[$i]->description $entry->description;
            
$game[$i]->res $entry->resolution;
            
$resolution=explode("x"$entry->resolution);
            
$game[$i]->x=$resolution[0];
            
$game[$i]->y=$resolution[1];
            
$game[$i]->instruction $entry->instructions;
            
$game[$i]->categories implode(", ",$entry->categories);
            
$game[$i]->rating $entry->rating;
            if(
$entry->leaderboard_enabled=="1"$game[$i]->leaderboard="True";
            else 
$game[$i]->leaderboard="False";
            if(
$entry->coins_enabled=="1"$game[$i]->coins="True";
            else 
$game[$i]->coins="False";
            
//Not yet implemented by mochi
            //            if($entry->premium_games=="1") $game[$i]->premium="True";
            //            else $game[$i]->premium="False";
            
@$game[$i]->file_size$entry->swf_file_size;
            
$game[$i]->keywordsimplode(", ",$entry->tags);
         }

      }

      return 
$game;
    }

      function 
getCats() {
           
$filter['premium_games']=JText::_('Premium_Games');
           
$filter['coins_enabled']=JText::_('Coins_Games');
           
$filter['featured_games']=Jtext::_('Featured_Games');
           
$filter['leaderboard_enabled']=Jtext::_('Leaderboard_Games');
           
$filter['all']=Jtext::_('AlL_Games');
           
$filter['action']=Jtext::_('Action');
           
$filter['adventure']=Jtext::_('Adventure');
           
$filter['board_game']=Jtext::_('Board_Game');
           
$filter['casino']=Jtext::_('Casino');
           
$filter['dress-up']=Jtext::_('Dress_Up');
           
$filter['driving']=Jtext::_('Driving');
           
$filter['education']=Jtext::_('Education');
           
$filter['fighting']=Jtext::_('Fighting');
           
$filter['jigsaw']=Jtext::_('Jigsaw');
           
$filter['other']=Jtext::_('Other');
           
$filter['customize']=Jtext::_('Pimp_My___Customize');
           
$filter['puzzles']=Jtext::_('Puzzles');
           
$filter['rhythm']=Jtext::_('Rhythm');
           
$filter['shooting']=Jtext::_('Shooting');
           
$filter['sports']=Jtext::_('Sports');
           
$filter['strategy']=Jtext::_('Strategy');

           return 
$filter;
      }

      function 
getGame($uid) {
          
$params = &JComponentHelper::getParams'com_yoflash' );
          
$publisherid=$params->get('publisherid');
          if(
$params->get('JSON_or_RSS')=="rss") {
               if(
$params->get('curl_or_fopen')=="curl") {
                 
//Curl support
                   
$ch curl_init();
                   
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
                  
curl_setopt($chCURLOPT_URL"http://www.mochimedia.com/feeds/games/".$publisherid."/".$uid."/");
                  
curl_setopt($chCURLOPT_HEADERFALSE);

                  
$ref curl_exec  (  $ch  );
                  
curl_close($ch);
                  
$feed=simplexml_load_string($ref);
               }
               else {
                  
$feed simplexml_load_file("http://www.mochimedia.com/feeds/games/".$publisherid."/".$uid."/");
               }

             
$entry=$feed->entry[0];
             
$game->title=(string)$entry->title;;
             
$game->author=(string)$entry->author->name;
             
$game->file_swf=(string)$entry->link[1]->attributes()->href;
             
$game->file_type=(string)$entry->link[1]->attributes()->type;
             
$game->file_img=(string)$entry->summary->div->a->img->attributes()->src;
             
$summary=array();
             for(
$j=0;$j<count($entry->summary->div->dl->dt);$j++) {
               
$summary[(string)$entry->summary->div->dl->dt[$j]] = (string)$entry->summary->div->dl->dd[$j];
               
//=array((string)$entry->summary->div->dl->dt[$j] => $entry->summary->div->dl->dd[$j]);
             
}

            
$game->uid $summary['Tag'];
            
$game->slug $summary['Slug'];
             
$game->description $summary['Description'];
             
$game->res $summary['Resolution'];
             
$resolution=explode("x"$summary['Resolution']);
             
$game->x=$resolution[0];
             
$game->y=$resolution[1];
             
$game->instruction $summary['Instructions'];
             
$game->categories $summary['Categories'];
             
$game->rating $summary['Rating'];
             
$game->featured $summary['Featured'];
             
$game->leaderboard$summary['Leaderboards'];
             
$game->file_size$summary['SWF file size'];
             
$game->keywords$summary['Keywords'];
          }
          else if (
$params->get('JSON_or_RSS')=="json") {
               if(
$params->get('curl_or_fopen')=="curl") {
                 
//Curl support
                   
$ch curl_init();
                   
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
                  
curl_setopt($chCURLOPT_URL"http://www.mochimedia.com/feeds/games/".$publisherid."/".$uid."/?format=json");
                  
curl_setopt($chCURLOPT_HEADERFALSE);

                  
$json curl_exec  (  $ch  );
                  
curl_close($ch);
               }
               else {
                  
$json =  file_get_contents("http://www.mochimedia.com/feeds/games/".$publisherid."/".$uid."/?format=json");
               }

            
$feed=json_decode($json);
            
$entry=$feed->games[0];
              
$game->title=$entry->name;
              
$game->slug=$entry->slug;
            
$game->author=$entry->author;
            
$game->file_swf=$entry->swf_url;
            
$game->file_type="application/x-shockwave-flash";
            
$game->file_img=$entry->thumbnail_url;
               
$game->uid $entry->game_tag;
            
$game->description $entry->description;
            
$game->res $entry->resolution;
            
$resolution=explode("x"$entry->resolution);
            
$game->x=$resolution[0];
            
$game->y=$resolution[1];
            
$game->instruction $entry->instructions;
            
$game->categories implode(", ",$entry->categories);
            if(@
$entry->featured=="True"$game->catgeories.=", Featured";
            
$game->rating $entry->rating;
            if(
$entry->leaderboard_enabled=="1"$game->leaderboard="True";
            else 
$game->leaderboard="False";
            if(
$entry->coins_enabled=="1"$game->coins="True";
            else 
$game->coins="False";
            
$game->file_size$entry->swf_file_size;
            
$game->keywordsimplode(", ",$entry->tags);
          }

          return 
$game;

      }
}

?>

Because new katalog, whic use new html struture, games filter dont work, and getting game too dont work. So little help or explantation haw this part work, would be good.

Reply With Quote
  #5  
Old November 19th, 2012, 04:51 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
function getGame($uid)
and function getCats() need some update so it can make this two thing work. I think so, but dont know for sure, so that whay i ask you men.

Reply With Quote
  #6  
Old November 19th, 2012, 12:08 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,679 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 46 m 33 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Putting aside the fact that you've given two different URLs for the new search thing,

Describe what is not working. How do you know it's not working? What does it do and what does it not do? I understand that the URL is wrong, but you tried to fix that already, so what is left to fix?

Reply With Quote
  #7  
Old November 19th, 2012, 12:40 PM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Quote:
Originally Posted by requinix
Putting aside the fact that you've given two different URLs for the new search thing,

Describe what is not working. How do you know it's not working? What does it do and what does it not do? I understand that the URL is wrong, but you tried to fix that already, so what is left to fix?

I put onlie one url for new search thing, and second is old url structure.
When i go to this component, i see new games (whic i get when change old url to new), and then if i tray see game filtered bay category, this dont work, and if i go on some game (this game should be opened, and show details about game) but this dont work.
I can see games from catalog, youst can save them on server. :S

Reply With Quote
  #8  
Old November 19th, 2012, 12:53 PM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Quote:
Originally Posted by requinix
Putting aside the fact that you've given two different URLs for the new search thing,

Describe what is not working. How do you know it's not working? What does it do and what does it not do? I understand that the URL is wrong, but you tried to fix that already, so what is left to fix?

Yes, i tray fix links, and that is working, but MM put new code for filteryng games, so old structure dont work, and i can find where to fix that. :/

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Php project, joomla component

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap