Ignoren el llamado & la asociación con CI, esto no se junta en nada con lo otro & el error no es de CI.
Código PHP:
Ver original
<?php class youtubevid { var $id; var $data; var $xml; private $_ci; function __construct() { $this->_ci =& get_instance(); } function get_videodata($id) { { $this->id = $_id['v']; } else { $this->id = $id; } $url = 'http://gdata.youtube.com/feeds/videos/' . $this->id; $server_output = $this->_yt_curl($url); if($server_output == 'Invalid id') { return false; } else { $this->data = $server_output; $description = $this->prep_desc(); $this->xml = new SimpleXMLElement($this->data); $this->xml->addChild('description', $description); return true; } } public function is_valid() { { return false; } else { return true; } } public function get_data() { return $this->data; } public function get_xml() { return $this->xml; } public function get_title() { if ($this->is_valid()) { return $this->xml->title; } else { return false; } } public function get_published() { if ($this->is_valid()) { return $this->xml->published; } else { return false; } } public function get_updated() { if ($this->is_valid()) { return $this->xml->updated; } else { return false; } } public function get_category() { if ($this->is_valid()) { $category = ''; { if($this->xml->category[$i]['scheme'] == 'http://gdata.youtube.com/schemas/2007/categories.cat') { $category = $this->xml->category[$i]['label']; break; } } return $category; } else { return false; } } public function get_tags() { if ($this->is_valid()) { { if ($this->xml->category[$i]['scheme'] == 'http://gdata.youtube.com/schemas/2007/keywords.cat') { $name = $this->xml->category[$i]['term']; } } return $tags; } else { return false; } } public function get_content() { if ($this->valid()) { return $this->xml->content; } else { return false; } } public function get_description() { if($this->is_valid()) { return $this->xml->description; } else { return false; } } public function get_url() { if ($this->is_valid()) { return 'http://www.youtube.com/watch?v=' . $this->id; } else { return false; } } public function get_img_url($option) { if($this->is_valid()) { if($option == 0) { return 'http://i.ytimg.com/vi/'.$this->id.'/0.jpg'; } elseif($option == 1) { return 'http://i.ytimg.com/vi/'.$this->id.'/1.jpg'; } elseif($option == 2) { return 'http://i.ytimg.com/vi/'.$this->id.'/2.jpg'; } elseif($option == 3) { return 'http://i.ytimg.com/vi/'.$this->id.'/3.jpg'; } else { return 'http://i.ytimg.com/vi/'.$this->id.'/default.jpg'; } } else { return false; } } public function get_author_name() { if($this->is_valid()) { return $this->xml->author->name; } else { return false; } } public function get_author_url() { if ($this->is_valid()) { return 'http://www.youtube.com/user/' . $this->get_author_name(); } else { return false; } } public function get_author_uri() { if ($this->is_valid()) { return $this->xml->author->uri; } else { return false; } } public function get_embeb($options = NULL) { $width = $options['width']; { $width = 640; } $height = $options['height']; { $height = 390; } $secure = ''; { if($options['https'] == 1) { $secure = 's'; } else { $secure = ''; } } { $exclamation = '"'; } else { $exclamation = '?'; } $autoplay = $options['autoplay']; { $autoplay = 1; } $embeb_code = '<iframe class="youtube-player" type="text/html" width="' . $width . '" height="' . $height . '" frameborder="0" src="http' . $secure . '://www.youtube.com/embed/' . $this->id /*. $exclamation */ . '?autoplay=' . $autoplay . $exclamation; /* $i = 1; foreach($options as $key => $value) { if($i == count($options)) { $embeb_code .= $key.'='.$value.'"'; } else { $embeb_code .= $key.'='.$value.'&'; } $i++; } */ $embeb_code .= '></iframe>'; return $embeb_code; } private function _yt_curl($url) { if($this->_ci->agent->is_browser()) { $agent = $this->_ci->agent->browser().' '.$this->_ci->agent->version(); } elseif($this->_ci->agent->is_robot()) { $agent = $this->_ci->agent->robot(); } elseif($this->_ci->agent->is_mobile()) { $agent = $this->_ci->agent->mobile(); } else { $agent = 'none'; } ( CURLOPT_URL => $url, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_USERAGENT => $agent ); return $server_output; } private function prep_desc() { $startstring = "<media:description type='plain'>"; $endstring = "</media:description>"; { $description = FALSE; } else { } return $description; } } ?>
Cuando llamo la función get_tags me devuelve solo array's un ejemplo sería este..
Código PHP:
Ver original
( [0] => SimpleXMLElement Object ( [0] => donato ) [1] => SimpleXMLElement Object ( [0] => estefano ) [2] => SimpleXMLElement Object ( [0] => estoy ) [3] => SimpleXMLElement Object ( [0] => enamorado ) [4] => SimpleXMLElement Object ( [0] => cucho ) [5] => SimpleXMLElement Object ( [0] => gamboa ) [6] => SimpleXMLElement Object ( [0] => ellos ) [7] => SimpleXMLElement Object ( [0] => cover ) [8] => SimpleXMLElement Object ( [0] => cuchogol ) )
Pero quiero me muestre solo las tags del video & que se muestren separadas por comas.. como lo puedo hacer?
De antemano, gracias.