PHP – Эхо внутри существующей функции

Я использую следующий код, чтобы вытащить в Twitter сообщения:

<?php class TwitterFeed { public $tweets = array(); public function __construct($user, $limit = 5) { $user = str_replace(' OR ', '%20OR%20', $user); $feed = curl_init('http://search.twitter.com/search.atom?q=from:'. $user .'&rpp='. $limit); curl_setopt($feed, CURLOPT_RETURNTRANSFER, true); curl_setopt($feed, CURLOPT_HEADER, 0); $xml = curl_exec($feed); curl_close($feed); $result = new SimpleXMLElement($xml); foreach($result->entry as $entry) { $tweet = new stdClass(); $tweet->id = (string) $entry->id; $user = explode(' ', $entry->author->name); $tweet->user = (string) $user[0]; $tweet->author = (string) substr($entry->author->name, strlen($user[0])+2, -1); $tweet->title = (string) $entry->title; $tweet->content = (string) $entry->content; $tweet->updated = (int) strtotime($entry->updated); $tweet->permalink = (string) $entry->link[0]->attributes()->href; $tweet->avatar = (string) $entry->link[1]->attributes()->href; array_push($this->tweets, $tweet); } unset($feed, $xml, $result, $tweet); } public function getTweets() { return $this->tweets; } } $feed = new TwitterFeed('trekradio', 4); $tweets = $feed->getTweets(); ?> 

На этой строке: $ feed = new TwitterFeed ('trekradio', 4); – Я хочу изменить «trekradio», поэтому он получает следующее значение:

 <?php if (have_posts()) { $flag = true; while (have_posts()) { the_post(); if ($flag) { $value = get_cimyFieldValue(get_the_author_ID(), 'twitter-username'); if ($value != NULL) echo "<p><strong>Twitter: </strong> You can follow me on Twitter by <a href=\"http://www.twitter.com/" . cimy_uef_sanitize_content($value) . "\">clicking here!</a></p>"; $flag = false; }}} ?> 

Как я могу это сделать?

Related of "PHP – Эхо внутри существующей функции"

Я предполагаю, что:

 cimy_uef_sanitize_content(get_cimyFieldValue(1, 'twitter-username')) 

это то же самое, что и «trekradio»

Если это так, используйте:

 $feed = new TwitterFeed(cimy_uef_sanitize_content(get_cimyFieldValue(1, 'twitter-username')), 4); 

Замените 'trekradio' на cimy_uef_sanitize_content(get_cimyFieldValue(1, 'twitter-username')) .

В зависимости от того, что cimy_uef_sanitize_content функция cimy_uef_sanitize_content , может быть, вам просто нужно get_cimyFieldValue(1, 'twitter-username') .