tmpdata = simplexml_load_file( $url ); if (( is_object($this->tmpdata->item) == false) || (sizeof($this->tmpdata->item) <= 0 )) { $this->rssdata = $this->tmpdata->channel; } else { $this->rssdata = $this->tmpdata; } } function getlink( $num, $desc, $header, $footer, $itemheader, $itemfooter ) { $this->num_of_data = intval($num) ; $this->length_of_desc = intval($desc); $this->outdata = $header; for ( $i=0; $i<$this->num_of_data; $i++ ) { $this->outdata .= $itemheader; $this->outdata .= "rssdata->item[$i]->link, ENT_QUOTES) . "\">" . htmlspecialchars($this->rssdata->item[$i]->title, ENT_QUOTES) . ""; $this->outdata .= mb_strimwidth(htmlspecialchars($this->rssdata->item[$i]->description, ENT_QUOTES),0,$this->length_of_desc,"..."); $this->outdata .= $itemfooter; } $this->outdata .= $footer; return $this->outdata; } } function rsshtml_output_func( $atts, $content = null ) { extract( shortcode_atts( array( 'num' => '3', 'desc' => '100', 'header' => '', 'itemheader' => '
  • ', 'itemfooter' => '
  • ', ), $atts )); if ( $content ) { $obj = new Rsshtml($content); $outdata = $obj->getlink( $num, $desc, $header, $footer, $itemheader, $itemfooter ); if ( "UTF-8" != get_bloginfo('charset') ) { return mb_convert_encoding( $outdata, get_bloginfo('charset'), "UTF-8" ); } else { return $outdata; } } } add_shortcode( 'rsshtml', 'rsshtml_output_func' ); ?>