<3 We Support 1337 RSS Feed';
// always return
return $content;
}
add_shortcode('elitesharebtn', 'elitesharebtn_shortcode');
}
add_action('init', 'elitesharebtn_shortcodes_init');
class eliterssfeed_widget extends WP_Widget {
public function __construct() {
parent::__construct(
'eliterssfeed_widget',
__( '1337 RSS Feed | Made for sharing', 'LightWRSSFeed' ),
array(
'classname' => 'eliterssfeed_widget',
'description' => __( 'Made by an 1337 so the world can easily share ( RSS FEED )', 'LightWRSSFeed' )
)
);
load_plugin_textdomain( 'LightWRSSFeed', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
$message = $instance['message'];
$rssurl = $instance['rssurl'];
$rsstitle = $instance['rsstitle'];
$socialbtntwitterhashtag = $instance['socialbtntwitterhashtag'];
$twittertext = $instance['twittertext'];
$adspace = $instance['adspace'];
$postcount = $instance['postcount'];
$tcolor = $instance['tcolor'];
$tfsize = $instance['tfsize'];
echo $before_widget;
if ( $title ) {
echo $before_title . $title . $after_title;
}
// WidgetWP
echo ' '.$rsstitle.'
';
echo' Full RSS Feed';
$rss = new DOMDocument();
$rss->load(''.$rssurl.'');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = $postcount;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
echo '
';
echo ' ';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo ''.$title.'
';
echo 'Posted on '.$date.'
';
}
// WidgetWP
echo $after_widget;
}
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['message'] = strip_tags( $new_instance['message'] );
$instance['rssurl'] = strip_tags( $new_instance['rssurl'] );
$instance['rsstitle'] = strip_tags( $new_instance['rsstitle'] );
$instance['socialbtntwitterhashtag'] = strip_tags( $new_instance['socialbtntwitterhashtag'] );
$instance['twittertext'] = strip_tags( $new_instance['twittertext'] );
$instance['postcount'] = strip_tags( $new_instance['postcount'] );
$instance['tcolor'] = strip_tags( $new_instance['tcolor'] );
$instance['tfsize'] = strip_tags( $new_instance['tfsize'] );
return $instance;
}
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
function wp_enqueue_style( $handle, $src = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', $deps = array(), $ver = false, $media = 'all' ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
$wp_styles = wp_styles();
if ( $src ) {
$_handle = explode('?', $handle);
$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
}
$wp_styles->enqueue( $handle );
}
public function form( $instance ) {
$title = esc_attr( $instance['title'] );
$message = esc_attr( $instance['message'] );
$rssurl = esc_attr( $instance['rssurl'] );
$rsstitle = esc_attr( $instance['rsstitle'] );
$socialbtntwitterhashtag = esc_attr( $instance['socialbtntwitterhashtag'] );
$twittertext = esc_attr( $instance['twittertext'] );
$postcount = esc_attr( $instance['postcount'] );
$tcolor = esc_attr( $instance['tcolor'] );
$tfsize = esc_attr( $instance['tfsize'] );
?>
Support Codelyfe