| 1 |
<?php |
| 2 |
/** |
| 3 |
* Contains the widget admin and its registration |
| 4 |
* |
| 5 |
*/ |
| 6 |
|
| 7 |
if( ! defined( 'ABSPATH' ) ) exit; |
| 8 |
|
| 9 |
class SRR_Widget{ |
| 10 |
|
| 11 |
public static function init(){ |
| 12 |
|
| 13 |
add_action( 'widgets_init', array( __CLASS__, 'init_widget' ) ); |
| 14 |
|
| 15 |
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'public_scripts' ) ); |
| 16 |
|
| 17 |
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_scripts' ) ); |
| 18 |
|
| 19 |
add_filter( 'plugin_action_links_' . SRR_BASE_NAME, array( __CLASS__, 'action_links' ) ); |
| 20 |
|
| 21 |
} |
| 22 |
|
| 23 |
public static function init_widget(){ |
| 24 |
|
| 25 |
register_widget( 'super_rss_reader_widget' ); |
| 26 |
|
| 27 |
} |
| 28 |
|
| 29 |
public static function public_scripts(){ |
| 30 |
|
| 31 |
wp_enqueue_script( 'jquery-easy-ticker', SRR_URL . 'public/js/jquery.easy-ticker.min.js', array( 'jquery' ), SRR_VERSION ); |
| 32 |
wp_enqueue_script( 'super-rss-reader', SRR_URL . 'public/js/script.min.js', array( 'jquery' ), SRR_VERSION ); |
| 33 |
|
| 34 |
wp_enqueue_style( 'super-rss-reader', SRR_URL . 'public/css/style.min.css', array(), SRR_VERSION ); |
| 35 |
|
| 36 |
} |
| 37 |
|
| 38 |
public static function admin_scripts( $hook ){ |
| 39 |
|
| 40 |
if( $hook == 'widgets.php' ){ |
| 41 |
wp_enqueue_style( 'srr_admin_css', SRR_URL . 'admin/css/style-widget.css', array(), SRR_VERSION ); |
| 42 |
wp_enqueue_script( 'srr_admin_js', SRR_URL . 'admin/js/script-widget.js', array( 'jquery' ), SRR_VERSION ); |
| 43 |
} |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
public static function render_feed( $options ){ |
| 48 |
|
| 49 |
$feed = new SRR_Feed( $options ); |
| 50 |
echo $feed->html(); |
| 51 |
|
| 52 |
} |
| 53 |
|
| 54 |
public static function action_links( $links ){ |
| 55 |
array_unshift( $links, '<a href="https://www.aakashweb.com/wordpress-plugins/super-rss-reader/?utm_source=admin&utm_medium=plugin-list&utm_campaign=srr-pro" target="_blank"><b>' . esc_html__( 'Upgrade to PRO', 'super-rss-reader' ) . '</b></a>' ); |
| 56 |
return $links; |
| 57 |
} |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
SRR_Widget::init(); |
| 62 |
|
| 63 |
?> |