Eigen twitter class

Gestart doorMaartenl23 reacties20 weergaven

24 berichten · pagina 2 van 2

Maartenl

Lid · Topicstarter

Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Fass schreef:
doe eens var_dump($tweets);?
object(SimpleXMLElement)#2 (2) { ["@attributes"]=> array(1) { ["version"]=> string(3) "2.0" } ["channel"]=> object(SimpleXMLElement)#3 devil { ["title"]=> string(24) "Twitter / MaartenLefever" ["link"]=> string(33) "http://twitter.com/MaartenLefever" ["description"]=> string(54) "Twitter updates from Maarten Lefever / MaartenLefever." ["language"]=> string(5) "en-us" ["ttl"]=> string(2) "40" ["item"]=> array(2) { [0]=> object(SimpleXMLElement)#4 (5) { ["title"]=> string(24) "MaartenLefever: Twitter!" ["description"]=> string(24) "MaartenLefever: Twitter!" ["pubDate"]=> string(31) "Fri, 13 Apr 2012 20:28:48 +0000" ["guid"]=> string(61) "http://twitter.com/MaartenLefever/statuses/190899359796305921" ["link"]=> string(61) "http://twitter.com/MaartenLefever/statuses/190899359796305921" } [1]=> object(SimpleXMLElement)#5 (5) { ["title"]=> string(51) "MaartenLefever: Plugin is klaar om te publiceren biggrin" ["description"]=> string(51) "MaartenLefever: Plugin is klaar om te publiceren biggrin" ["pubDate"]=> string(31) "Fri, 13 Apr 2012 181248 +0000" ["guid"]=> string(61) "http://twitter.com/MaartenLefever/statuses/190865133478744064" ["link"]=> string(61) "http://twitter.com/MaartenLefever/statuses/190865133478744064" } } } }
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
upload je scriptje eens en plaats deze var_dump binnen textarea. Dan krijgen we een mooi uitgelijnde versie smile
0
Maartenl

Lid · Topicstarter

Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rogier schreef:
upload je scriptje eens en plaats deze var_dump binnen textarea. Dan krijgen we een mooi uitgelijnde versie smile
object(SimpleXMLElement)#2 (2) {
  ["@attributes"]=>
  array(1) {
    ["version"]=>
    string(3) "2.0"
  }
  ["channel"]=>
  object(SimpleXMLElement)#3 (6) {
    ["title"]=>
    string(24) "Twitter / MaartenLefever"
    ["link"]=>
    string(33) "http://twitter.com/MaartenLefever"
    ["description"]=>
    string(54) "Twitter updates from Maarten Lefever / MaartenLefever."
    ["language"]=>
    string(5) "en-us"
    ["ttl"]=>
    string(2) "40"
    ["item"]=>
    array(2) {
      [0]=>
      object(SimpleXMLElement)#4 (5) {
        ["title"]=>
        string(40) "MaartenLefever: Zometeen gaan voetballen"
        ["description"]=>
        string(40) "MaartenLefever: Zometeen gaan voetballen"
        ["pubDate"]=>
        string(31) "Sat, 14 Apr 2012 08:07:29 +0000"
        ["guid"]=>
        string(61) "http://twitter.com/MaartenLefever/statuses/191075189356900353"
        ["link"]=>
        string(61) "http://twitter.com/MaartenLefever/statuses/191075189356900353"
      }
      [1]=>
      object(SimpleXMLElement)#5 (5) {
        ["title"]=>
        string(24) "MaartenLefever: Twitter!"
        ["description"]=>
        string(24) "MaartenLefever: Twitter!"
        ["pubDate"]=>
        string(31) "Fri, 13 Apr 2012 20:28:48 +0000"
        ["guid"]=>
        string(61) "http://twitter.com/MaartenLefever/statuses/190899359796305921"
        ["link"]=>
        string(61) "http://twitter.com/MaartenLefever/statuses/190899359796305921"
      }
    }
  }
}
0
Fass

Lid

Berichten
3.771
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maartenl schreef:
Hallo,

Ik ben bezig met classes te bestuderen en had nu dit gemaakt :

[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/class"]class[/URL] twitter
[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$tweetArray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$datumArray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] set_naam[COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]naam [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] laad_tweets[COLOR= #007700]()
    {[/COLOR]
        [COLOR= #0000BB]$twitterFeed[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://twitter.com/statuses/user_timeline.rss?screen_name=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]naam[COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$tweets[/COLOR] [COLOR= #007700]= new[/COLOR] SimpleXMLElement[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterFeed[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$tweets[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]item[COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$key[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700])
                {[/COLOR]
                      [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweetArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700]->[/COLOR]title[COLOR= #007700];[/COLOR]
              [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datumArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700]->[/COLOR]pubDate[COLOR= #007700];
                }
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] verwerk[COLOR= #007700]()
    {[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweet[COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])([w]+?://[w]+[^ "nrt< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])((www|ftp).[^ "tnr< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="http://2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/@(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://www.twitter.com/1" target="_blank">@1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/#(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://search.twitter.com/search?q=1" target="_blank">#1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweet [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] tweet[COLOR= #007700]([/COLOR][COLOR= #0000BB]$num[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$date[/COLOR][COLOR= #007700])
    {[/COLOR]
               [COLOR= #0000BB]$myTweets[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
           [URL="http://www.php.net/for"]for[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$num[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++){[/COLOR]
                     [COLOR= #0000BB]$rtrn[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweetArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]];[/COLOR]
                     [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$date[/COLOR][COLOR= #007700])
                     {[/COLOR]
                            [COLOR= #0000BB]$datumEtc[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]" "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]{datum}[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datumArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$date[/COLOR][COLOR= #007700]);
                     }[/COLOR] [URL="http://www.php.net/else"]else[/URL]
                     [COLOR= #007700]{[/COLOR]
                            [COLOR= #0000BB]$datumEtc[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];
                      }[/COLOR]
                      [COLOR= #0000BB]$myTweets[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #0000BB]$rtrn[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$datumEtc[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
               }[/COLOR]
               [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$myTweets[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] datum[COLOR= #007700]()
    {[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datum[COLOR= #007700];
    }
}[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR] [COLOR= #007700]= new[/COLOR] Twitter[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]set_naam[COLOR= #007700]([/COLOR][COLOR= #DD0000]maartenlefever[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]laad_tweets[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]verwerk[COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]tweet[COLOR= #007700]([/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"op {datum}"[/COLOR][COLOR= #007700]);[/COLOR]
?>
Nu wil ik dat niet enkel de laatste tweet maar ook de voorlaatste wordt opgehaald. Hoe doe ik dit ?

Groetjes, Maarten

Quote ge-edit. Zoiets zou het moeten doen?

// Het is überscheef uitgelijnd, maar het leek recht in dit textboxje. Excuses!

// // Hierbij zet hij ze trouwens onder elkaar gewoon, als je styles enzo wil toevoegen moet je toch gaan foreachen buiten de class of de voor en na styles meegeven aan de functie (ik zou dat laatste doen, maar iedereen zijn persoonlijke voorkeur).
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zou de class een array laten maken. En dan dat je in tweet() alles kan aanpassen.

Ik vraag me trouwens wel af wat het nu is van 2 arrays. Waarom maaken je niet gewoon een array met alles?

je kan ook arrays binnen arrays maken he!
0
Fass

Lid

Berichten
3.771
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/class"]class[/URL] twitter
[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$tweetArray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$datumArray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] set_naam[COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]naam [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] laad_tweets[COLOR= #007700]()
    {[/COLOR]
        [COLOR= #0000BB]$twitterFeed[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://twitter.com/statuses/user_timeline.rss?screen_name=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]naam[COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$tweets[/COLOR] [COLOR= #007700]= new[/COLOR] SimpleXMLElement[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterFeed[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$tweets[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]item[COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$key[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700])
                {[/COLOR]
                      [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweetArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700]->[/COLOR]title[COLOR= #007700];[/COLOR]
              [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datumArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700]->[/COLOR]pubDate[COLOR= #007700];
                }
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] verwerk[COLOR= #007700]()
    {[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweet[COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])([w]+?://[w]+[^ "nrt< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])((www|ftp).[^ "tnr< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="http://2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/@(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://www.twitter.com/1" target="_blank">@1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/#(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://search.twitter.com/search?q=1" target="_blank">#1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweet [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] tweet[COLOR= #007700]([/COLOR][COLOR= #0000BB]$num[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$date[/COLOR][COLOR= #007700])
    {[/COLOR]
               [COLOR= #0000BB]$myTweets[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
           [URL="http://www.php.net/for"]for[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$num[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++){[/COLOR]
                     [COLOR= #0000BB]$rtrn[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweetArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]];[/COLOR]
                     [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$date[/COLOR][COLOR= #007700])
                     {[/COLOR]
                            [COLOR= #0000BB]$datumEtc[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]" "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]{datum}[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datumArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$date[/COLOR][COLOR= #007700]);
                     }[/COLOR] [URL="http://www.php.net/else"]else[/URL]
                     [COLOR= #007700]{[/COLOR]
                            [COLOR= #0000BB]$datumEtc[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];
                      }[/COLOR]
                      [COLOR= #0000BB]$myTweets[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #0000BB]$rtrn[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$datumEtc[/COLOR][COLOR= #007700];
               }[/COLOR]
               [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$myTweets[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] datum[COLOR= #007700]()
    {[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datum[COLOR= #007700];
    }
}[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR] [COLOR= #007700]= new[/COLOR] Twitter[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]set_naam[COLOR= #007700]([/COLOR][COLOR= #DD0000]maartenlefever[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]laad_tweets[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]verwerk[COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]tweet[COLOR= #007700]([/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"op {datum}"[/COLOR][COLOR= #007700]) as[/COLOR] [COLOR= #0000BB]$var[/COLOR][COLOR= #007700])
{[/COLOR]
       [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$var[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
}[/COLOR]
?>


Bedoel je dat dan?

of

[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/class"]class[/URL] twitter
[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$tweetArray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #0000BB]$datumArray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] set_naam[COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]naam [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] laad_tweets[COLOR= #007700]()
    {[/COLOR]
        [COLOR= #0000BB]$twitterFeed[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://twitter.com/statuses/user_timeline.rss?screen_name=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]naam[COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$tweets[/COLOR] [COLOR= #007700]= new[/COLOR] SimpleXMLElement[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterFeed[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$tweets[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]item[COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$key[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700])
                {[/COLOR]
                      [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweetArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700]->[/COLOR]title[COLOR= #007700];[/COLOR]
              [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datumArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$sth[/COLOR][COLOR= #007700]->[/COLOR]pubDate[COLOR= #007700];
                }
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] verwerk[COLOR= #007700]()
    {[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweet[COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])([w]+?://[w]+[^ "nrt< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])((www|ftp).[^ "tnr< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="http://2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/@(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://www.twitter.com/1" target="_blank">@1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/#(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://search.twitter.com/search?q=1" target="_blank">#1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweet [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] tweet[COLOR= #007700]()
    {[/COLOR]
                  [COLOR= #0000BB]$ret[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
                  [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweetArray[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$key[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$firstHalf[/COLOR][COLOR= #007700])
                  {[/COLOR]
                         [COLOR= #0000BB]$ret[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]datum[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datumArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #DD0000]tweet[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]tweetArray[COLOR= #007700][[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]]);
                   }[/COLOR]
                   [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$ret[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] datum[COLOR= #007700]()
    {[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]datum[COLOR= #007700];
    }
}[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR] [COLOR= #007700]= new[/COLOR] Twitter[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]set_naam[COLOR= #007700]([/COLOR][COLOR= #DD0000]maartenlefever[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]laad_tweets[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]verwerk[COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]->[/COLOR]tweet[COLOR= #007700]() as[/COLOR] [COLOR= #0000BB]$var[/COLOR][COLOR= #007700])
{[/COLOR]
       [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$var[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tweet[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000] op [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$var[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]datum[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
http://www.phphulp.nl/php/script/php-algemeen/twitter-op-je-website/1774/twitterwidgetphp/1285/
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]

    [COLOR= #FF8000]//////////////////////////////////////////////
    //        TWITTER WIDGET VERSION 1.2.1        //
    //        Justin Streuper | streuper.com        //
    //////////////////////////////////////////////[/COLOR]
    
    [COLOR= #0000BB]$username[/COLOR]        [COLOR= #007700]=[/COLOR]    [COLOR= #DD0000]username[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// gebruikersnaam[/COLOR]
    [COLOR= #0000BB]$tweetCount[/COLOR]        [COLOR= #007700]=[/COLOR]    [COLOR= #0000BB]5[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// aantal tweets[/COLOR]
    [COLOR= #0000BB]$twitterFeed[/COLOR]     [COLOR= #007700]=[/COLOR]     [COLOR= #DD0000]http://api.twitter.com/1/statuses/user_timeline/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000].xml?count=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweetCount[/COLOR][COLOR= #007700];
    
    function[/COLOR] timeAgo[COLOR= #007700]([/COLOR][COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700])
        {[/COLOR]
            [COLOR= #0000BB]$timestamp[/COLOR]    [COLOR= #007700]=[/COLOR]    [URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]);[/COLOR]
            [COLOR= #0000BB]$now[/COLOR]        [COLOR= #007700]=[/COLOR]    [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]();[/COLOR]
            [COLOR= #0000BB]$timediff[/COLOR]    [COLOR= #007700]=[/COLOR]    [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$now[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]);[/COLOR]
            
            [URL="http://www.php.net/switch"]switch[/URL][COLOR= #007700]([/COLOR]true[COLOR= #007700])
                {
                    case ([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]60[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$timediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] seconds ago[/COLOR][COLOR= #007700];
                    
                    case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]60[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]3600[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]60[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] minutes ago[/COLOR][COLOR= #007700];
                    
                    case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]3600[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]7200[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]3600[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] hour ago[/COLOR][COLOR= #007700];
                    
                    case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]7200[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]86400[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]3600[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] hours ago[/COLOR][COLOR= #007700];
                    
                    case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]86400[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]172800[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]86400[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] day ago[/COLOR][COLOR= #007700];
                    
                    case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]172800[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]602800[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]86400[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] days ago[/COLOR][COLOR= #007700];
                    
                    case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]602800[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]1209600[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]602800[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] week ago[/COLOR][COLOR= #007700];
                    
                    case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]1209600[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]3026000[/COLOR][COLOR= #007700]):[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]602800[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] weeks ago[/COLOR][COLOR= #007700];
                    
                    default:[/COLOR]
                    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]);
                }
        }

        
    
    function[/COLOR] makeLinksClickable[COLOR= #007700]([/COLOR][COLOR= #0000BB]$text[/COLOR][COLOR= #007700])
        {[/COLOR]
            [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])([w]+?://[w]+[^ "nrt< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
            [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[n ])((www|ftp).[^ "tnr< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1<a href="http://2" target="_blank">2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
            [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/@(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://www.twitter.com/1" target="_blank">@1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
            [COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/#(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://search.twitter.com/search?q=1" target="_blank">#1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700];
        }[/COLOR]
    
    [COLOR= #0000BB]$twitterCurl[/COLOR] [COLOR= #007700]=[/COLOR]     curl_init[COLOR= #007700]();[/COLOR]
                    curl_setopt[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700],[/COLOR] CURLOPT_URL[COLOR= #007700],[/COLOR] [COLOR= #0000BB]$twitterFeed[/COLOR][COLOR= #007700]);[/COLOR]
                    curl_setopt[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700],[/COLOR] CURLOPT_RETURNTRANSFER[COLOR= #007700],[/COLOR] TRUE[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$twitter[/COLOR]     [COLOR= #007700]=[/COLOR]    curl_exec[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$tweets[/COLOR]     [COLOR= #007700]=    new[/COLOR] SimpleXMLElement[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweets[/COLOR][COLOR= #007700]->[/COLOR]status [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]    [COLOR= #DD0000]<div class="tweet-container">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-user-image">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            [COLOR= #DD0000]<img src="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]profile_image_url[COLOR= #007700].[/COLOR][COLOR= #DD0000]" alt="" />[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-username">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            [COLOR= #DD0000]<a href="http://www.twitter.com/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]screen_name[COLOR= #007700].[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]name[COLOR= #007700].[/COLOR][COLOR= #DD0000]</a>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-message">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            makeLinksClickable[COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]text[COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-post-datetime">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            timeAgo[COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]created_at[COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            [COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]    [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];
            
        }[/COLOR]
    
    curl_close[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Rogier schreef:
upload je scriptje eens en plaats deze var_dump binnen textarea. Dan krijgen we een mooi uitgelijnde versie smile
Pre-tags zijn cooler smile

is Tweet trouwens niet zo langzamer hand een werkwoord? Ik zou eerder voor getTweet() kiezen.
Dit brengt straks nog verwarring dat mensen kunnen denken dat ze zelf Tweets kunnen sturen.
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
is Tweet trouwens niet zo langzamer hand een werkwoord? Ik zou eerder voor getTweet() kiezen.
Dit brengt straks nog verwarring dat mensen kunnen denken dat ze zelf Tweets kunnen sturen.
Ik zou ook getTweet gebruiken, probeer zoveel mogelijk om je functies op werkwoorden te baseren, dus als je een waarde krijgt gebruik je getWaarde en als je iets wil setten gebruik dan setWaarde, das ook een stuk handiger voor documentatie, een mogelijke koper of gebruiker van je systeem weet precies welke functie wat doet
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren