HEX
Server: Apache
System: Linux web2213.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: clinicamaciel (596848)
PHP: 7.3.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,eval,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/clinicamaciel/www/wp-content/plugins/magee-shortcodes/shortcodes/class-rss-feed.php
<?php
if( !class_exists('Magee_RSS_feed') ):
class Magee_RSS_feed {

	public static $args;
    private  $id;

	/**
	 * Initiate the shortcode
	 */
	public function __construct() {

        add_shortcode( 'ms_rss_feed', array( $this, 'render' ) );
	}

	/**
	 * Render the shortcode
	 * @param  array $args     Shortcode paramters
	 * @param  string $content Content between shortcode
	 * @return string          HTML output
	 */
	function render( $args, $content = '') {

		$defaults =	Magee_Core::set_shortcode_defaults(
			array(
				'url'      => '',
				'number'      => 3,
				'class'      => '',
				'id'    => '',
			), $args
		);
		extract( $defaults );
		self::$args = $defaults;
		$html = '';
		//$html = '<h2>'._e( 'Recent news from Some-Other Blog:', 'my-text-domain' ).'<h2>';
		if( $url !== ''):
		include_once( ABSPATH . WPINC . '/feed.php' );
		$rss = fetch_feed( esc_url($url) );
		$maxitems = 0 ;
		if(! is_wp_error($rss)):
		$maxitems = $rss->get_item_quantity(esc_attr($number));
		$rss_items = $rss->get_items( 0, $maxitems );
		endif;
		$html  = '<ul class="'.esc_attr($class).'" id="'.esc_attr($id).'">';
		if($maxitems == 0):
		$html .= '<li>'._e( 'No items', 'magee-shortcodes').'</li>' ;
		else:
		foreach ( $rss_items as $item){
		$html .= '<li>';
		$html .= '<a target="_blank" href="'.esc_url($item->get_permalink()).'" ' ;
		$html .= 'title="'.__( 'Posted '.$item->get_date('j F Y | g:i a'), 'magee-shortcodes').'">';
		$html .= $item->get_title();
		$html .= '</a>' ;
		$html .= '</li>' ;
		}
		endif;
		$html .= '</ul>' ;
		
		endif;
		return $html;
	}   
	
}

new Magee_RSS_feed();	
endif;