| 1 |
<?php |
| 2 |
/** |
| 3 |
* Contains WordPress widget class |
| 4 |
* |
| 5 |
*/ |
| 6 |
|
| 7 |
class super_rss_reader_widget extends WP_Widget{ |
| 8 |
|
| 9 |
// Initialize |
| 10 |
public function __construct(){ |
| 11 |
$widget_ops = array( |
| 12 |
'classname' => 'widget_super_rss_reader', |
| 13 |
'description' => __( 'An RSS feed reader widget with advanced features', 'super-rss-reader' ) |
| 14 |
); |
| 15 |
|
| 16 |
$control_ops = array( 'width' => 500, 'height' => 500 ); |
| 17 |
parent::__construct( 'super_rss_reader', 'Super RSS Reader', $widget_ops, $control_ops ); |
| 18 |
} |
| 19 |
|
| 20 |
// Display the Widget |
| 21 |
public function widget( $args, $instance ){ |
| 22 |
|
| 23 |
extract( $args ); |
| 24 |
|
| 25 |
if( empty( $instance[ 'title' ] ) ){ |
| 26 |
$title = ''; |
| 27 |
}else{ |
| 28 |
$title = $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; |
| 29 |
} |
| 30 |
|
| 31 |
echo $before_widget . $title; |
| 32 |
|
| 33 |
echo '<!-- Start - Super RSS Reader v' . SRR_VERSION . '--> |
| 34 |
<div class="super-rss-reader-widget">'; |
| 35 |
|
| 36 |
SRR_Widget::render_feed( $instance ); |
| 37 |
|
| 38 |
echo '</div><!-- End - Super RSS Reader -->'; |
| 39 |
echo $after_widget; |
| 40 |
|
| 41 |
} |
| 42 |
|
| 43 |
// Save settings |
| 44 |
public function update( $new_instance, $old_instance ){ |
| 45 |
|
| 46 |
$instance = $old_instance; |
| 47 |
|
| 48 |
$instance[ 'title' ] = sanitize_text_field( $new_instance['title'] ); |
| 49 |
$instance[ 'urls' ] = sanitize_textarea_field( $new_instance['urls'] ) ; |
| 50 |
$instance[ 'tab_titles' ] = wp_kses_post( $new_instance['tab_titles'] ); |
| 51 |
|
| 52 |
$instance[ 'count' ] = intval( $new_instance['count'] ); |
| 53 |
$instance[ 'show_title' ] = intval( isset( $new_instance['show_title'] ) ? $new_instance['show_title'] : 0 ); |
| 54 |
$instance[ 'show_date' ] = intval( isset( $new_instance['show_date'] ) ? $new_instance['show_date'] : 0 ); |
| 55 |
$instance[ 'show_desc' ] = intval( isset( $new_instance['show_desc'] ) ? $new_instance['show_desc'] : 0 ); |
| 56 |
$instance[ 'show_author' ] = intval( isset( $new_instance['show_author'] ) ? $new_instance['show_author'] : 0 ); |
| 57 |
$instance[ 'show_thumb' ] = intval( isset( $new_instance['show_thumb'] ) ? $new_instance['show_thumb'] : 0 ); |
| 58 |
$instance[ 'strip_desc' ] = intval( $new_instance['strip_desc'] ); |
| 59 |
$instance[ 'strip_title' ] = intval( $new_instance['strip_title'] ); |
| 60 |
$instance[ 'offset' ] = intval( $new_instance['offset'] ); |
| 61 |
$instance[ 'date_format' ] = sanitize_text_field( $new_instance['date_format'] ); |
| 62 |
$instance[ 'date_timezone' ] = sanitize_text_field( $new_instance['date_timezone'] ); |
| 63 |
$instance[ 'order_by' ] = sanitize_text_field( $new_instance['order_by'] ); |
| 64 |
$instance[ 'read_more' ] = sanitize_text_field( $new_instance['read_more'] ); |
| 65 |
$instance[ 'add_nofollow' ] = intval( isset( $new_instance['add_nofollow'] ) ? $new_instance['add_nofollow'] : 0 ); |
| 66 |
$instance[ 'open_newtab' ] = intval( isset( $new_instance['open_newtab'] ) ? $new_instance['open_newtab'] : 0 ); |
| 67 |
$instance[ 'rich_desc' ] = intval( isset( $new_instance['rich_desc'] ) ? $new_instance['rich_desc'] : 0 ); |
| 68 |
$instance[ 'link_desc' ] = intval( isset( $new_instance['link_desc'] ) ? $new_instance['link_desc'] : 0 ); |
| 69 |
$instance[ 'desc_type' ] = sanitize_text_field( $new_instance['desc_type'] ); |
| 70 |
$instance[ 'thumbnail_position' ] = sanitize_text_field( $new_instance['thumbnail_position'] ); |
| 71 |
$instance[ 'thumbnail_crop_position' ] = sanitize_text_field( $new_instance['thumbnail_crop_position'] ); |
| 72 |
$instance[ 'thumbnail_size' ] = sanitize_text_field( $new_instance['thumbnail_size'] ); |
| 73 |
$instance[ 'thumbnail_default' ] = sanitize_text_field( $new_instance['thumbnail_default'] ); |
| 74 |
$instance[ 'thumbnail_type' ] = sanitize_text_field( $new_instance['thumbnail_type'] ); |
| 75 |
$instance[ 'no_feed_text' ] = wp_kses_post( $new_instance['no_feed_text'] ); |
| 76 |
|
| 77 |
$instance[ 'color_style' ] = sanitize_text_field( $new_instance['color_style']); |
| 78 |
$instance[ 'display_type' ] = sanitize_text_field( $new_instance['display_type']); |
| 79 |
$instance[ 'visible_items' ] = intval( $new_instance['visible_items'] ); |
| 80 |
$instance[ 'ticker_speed' ] = intval( $new_instance['ticker_speed'] ); |
| 81 |
$instance[ 'scroll_height' ] = sanitize_text_field( $new_instance['scroll_height'] ); |
| 82 |
|
| 83 |
return $instance; |
| 84 |
} |
| 85 |
|
| 86 |
// Widget form |
| 87 |
public function form( $instance ){ |
| 88 |
|
| 89 |
$instance = wp_parse_args( (array) $instance, SRR_Options::defaults() ); |
| 90 |
|
| 91 |
$title = isset( $instance['title'] ) ? $instance[ 'title' ] : ''; |
| 92 |
$urls = $instance['urls']; |
| 93 |
$tab_titles = $instance['tab_titles']; |
| 94 |
|
| 95 |
$count = $instance['count']; |
| 96 |
$show_title = $instance['show_title']; |
| 97 |
$show_date = $instance['show_date']; |
| 98 |
$show_desc = $instance['show_desc']; |
| 99 |
$show_author = $instance['show_author']; |
| 100 |
$show_thumb = $instance['show_thumb']; |
| 101 |
$open_newtab = $instance['open_newtab']; |
| 102 |
$add_nofollow = $instance['add_nofollow']; |
| 103 |
$strip_desc = $instance['strip_desc']; |
| 104 |
$strip_title = $instance['strip_title']; |
| 105 |
$offset = $instance['offset']; |
| 106 |
$date_format = $instance['date_format']; |
| 107 |
$date_timezone = $instance['date_timezone']; |
| 108 |
$order_by = $instance['order_by']; |
| 109 |
$read_more = $instance['read_more']; |
| 110 |
$rich_desc = $instance['rich_desc']; |
| 111 |
$desc_type = $instance['desc_type']; |
| 112 |
$link_desc = $instance['link_desc']; |
| 113 |
$thumbnail_position = $instance['thumbnail_position']; |
| 114 |
$thumbnail_crop_position = $instance['thumbnail_crop_position']; |
| 115 |
$thumbnail_size = $instance['thumbnail_size']; |
| 116 |
$thumbnail_default = $instance['thumbnail_default']; |
| 117 |
$thumbnail_type = $instance['thumbnail_type']; |
| 118 |
$no_feed_text = $instance['no_feed_text']; |
| 119 |
|
| 120 |
$color_style = $instance['color_style']; |
| 121 |
$display_type = $instance['display_type']; |
| 122 |
$visible_items = $instance['visible_items']; |
| 123 |
$ticker_speed = $instance['ticker_speed']; |
| 124 |
$scroll_height = $instance['scroll_height']; |
| 125 |
|
| 126 |
$option_lists = SRR_Options::select_options(); |
| 127 |
|
| 128 |
// Replacing commas with new lines |
| 129 |
$urls = str_replace( ',', "\n", $urls ); |
| 130 |
$tab_titles = str_replace( ',', "\n", $tab_titles ); |
| 131 |
|
| 132 |
?> |
| 133 |
|
| 134 |
<div class="srr_settings"> |
| 135 |
|
| 136 |
<div class="srr_row"> |
| 137 |
<div class="srr_label srr_xsm"><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php esc_html_e( 'Title', 'super-rss-reader' ); ?></label></div> |
| 138 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('title') ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" class="widefat"/></div> |
| 139 |
</div> |
| 140 |
|
| 141 |
<div class="srr_row"> |
| 142 |
<div class="srr_label srr_xsm"><label for="<?php echo esc_attr( $this->get_field_id('urls') ); ?>"><?php esc_html_e( 'URL(s)', 'super-rss-reader' ); ?></label></div> |
| 143 |
<div class="srr_field"><textarea id="<?php echo esc_attr( $this->get_field_id('urls') ); ?>" name="<?php echo esc_attr( $this->get_field_name('urls') ); ?>" class="widefat"><?php echo esc_html( $urls ); ?></textarea> |
| 144 |
<small class="srr_small_text"><?php esc_html_e( 'Can enter multiple RSS/atom feed URLs in new line', 'super-rss-reader' ); ?></small></div> |
| 145 |
</div> |
| 146 |
|
| 147 |
<div class="srr_row"> |
| 148 |
<div class="srr_label srr_xsm"><label for="<?php echo esc_attr( $this->get_field_id('tab_titles') ); ?>"><?php esc_html_e( 'Tab titles', 'super-rss-reader' ); ?></label></div> |
| 149 |
<div class="srr_field"><textarea id="<?php echo esc_attr( $this->get_field_id('tab_titles') ); ?>" name="<?php echo esc_attr( $this->get_field_name('tab_titles') ); ?>" class="widefat"><?php echo esc_html( $tab_titles ); ?></textarea> |
| 150 |
<small class="srr_small_text"><?php esc_html_e( 'Enter corresponding tab titles in new line. Leave empty to take from feed.', 'super-rss-reader' ); ?></small></div> |
| 151 |
</div> |
| 152 |
|
| 153 |
<ul class="srr_tab_list"> |
| 154 |
<li><a href="#" data-tab="general" class="active"><?php esc_html_e( 'General', 'super-rss-reader' ); ?></a></li> |
| 155 |
<li><a href="#" data-tab="content"><?php esc_html_e( 'Content', 'super-rss-reader' ); ?></a></li> |
| 156 |
<li><a href="#" data-tab="display"><?php esc_html_e( 'Display', 'super-rss-reader' ); ?></a></li> |
| 157 |
<li><a href="#" data-tab="filter"><?php esc_html_e( 'Filter', 'super-rss-reader' ); ?><span class="srr_pro_tag">PRO</span></a></li> |
| 158 |
</ul> |
| 159 |
|
| 160 |
<section data-tab-id="general" class="active"> |
| 161 |
|
| 162 |
<div class="srr_row"> |
| 163 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('count') ); ?>"><?php esc_html_e( 'Total items to show', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'Number of feed items to be displayed', 'super-rss-reader' ) ); ?></div> |
| 164 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('count') ); ?>" name="<?php echo esc_attr( $this->get_field_name('count') ); ?>" type="number" value="<?php echo esc_attr( $count ); ?>" class="widefat" /></div> |
| 165 |
</div> |
| 166 |
|
| 167 |
<div class="srr_row"> |
| 168 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('show_title') ); ?>"><?php esc_html_e( 'Show title', 'super-rss-reader' ); ?></label></div> |
| 169 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('show_title') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('show_title') ); ?>" value="1" <?php echo $show_title == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 170 |
</div> |
| 171 |
|
| 172 |
<div class="srr_row"> |
| 173 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('show_desc') ); ?>"><?php esc_html_e( 'Show Description', 'super-rss-reader' ); ?></label></div> |
| 174 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('show_desc') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('show_desc') ); ?>" value="1" <?php echo $show_desc == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 175 |
</div> |
| 176 |
|
| 177 |
<div class="srr_row"> |
| 178 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('show_date') ); ?>"><?php esc_html_e( 'Show Date', 'super-rss-reader' ); ?></label></div> |
| 179 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('show_date') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('show_date') ); ?>" value="1" <?php echo $show_date == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 180 |
</div> |
| 181 |
|
| 182 |
<div class="srr_row"> |
| 183 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('show_author') ); ?>"><?php esc_html_e( 'Show Author', 'super-rss-reader' ); ?></label></div> |
| 184 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('show_author') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('show_author') ); ?>" value="1" <?php echo $show_author == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 185 |
</div> |
| 186 |
|
| 187 |
<div class="srr_row"> |
| 188 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('show_thumb') ); ?>"><?php esc_html_e( 'Show thumbnail if present', 'super-rss-reader' ); ?></label></div> |
| 189 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('show_thumb') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('show_thumb') ); ?>" value="1" <?php echo $show_thumb == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 190 |
</div> |
| 191 |
</section> |
| 192 |
|
| 193 |
<section data-tab-id="content"> |
| 194 |
|
| 195 |
<div class="srr_row"> |
| 196 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('add_nofollow') ); ?>"><?php esc_html_e( 'Add "no follow" attribute to links', 'super-rss-reader' ); ?></label></div> |
| 197 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('add_nofollow') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('add_nofollow') ); ?>" value="1" <?php echo $add_nofollow == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 198 |
</div> |
| 199 |
|
| 200 |
<div class="srr_row"> |
| 201 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('open_newtab') ); ?>"><?php esc_html_e( 'Open links in new tab', 'super-rss-reader' ); ?></label></div> |
| 202 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('open_newtab') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('open_newtab') ); ?>" value="1" <?php echo $open_newtab == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 203 |
</div> |
| 204 |
|
| 205 |
<div class="srr_row"> |
| 206 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('strip_title') ); ?>"><?php esc_html_e( 'Trim title to words', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The number of words to be displayed. Use 0 to disable trimming', 'super-rss-reader' ) ); ?></div> |
| 207 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('strip_title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('strip_title') ); ?>" type="number" value="<?php echo esc_attr( $strip_title ); ?>" class="widefat" /></div> |
| 208 |
</div> |
| 209 |
|
| 210 |
<div class="srr_row"> |
| 211 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('offset') ); ?>"><?php esc_html_e( 'Offset', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The number of RSS feed items to skip from the top', 'super-rss-reader' ) ); ?></div> |
| 212 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('offset') ); ?>" name="<?php echo esc_attr( $this->get_field_name('offset') ); ?>" type="number" value="<?php echo esc_attr( $offset ); ?>" class="widefat" /></div> |
| 213 |
</div> |
| 214 |
|
| 215 |
<div class="srr_row"> |
| 216 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('order_by') ); ?>"><?php esc_html_e( 'Order feed items by', 'super-rss-reader' ); ?></label></div> |
| 217 |
<div class="srr_field"> |
| 218 |
<?php |
| 219 |
echo '<select name="' . $this->get_field_name('order_by') . '" id="' . $this->get_field_id('order_by') . '">'; |
| 220 |
foreach( $option_lists[ 'order_by' ] as $k => $v ){ |
| 221 |
echo '<option value="' . $k . '" ' . selected( $order_by, $k, false ) . '>' . $v . '</option>'; |
| 222 |
} |
| 223 |
echo '</select>'; |
| 224 |
?> |
| 225 |
</div> |
| 226 |
</div> |
| 227 |
|
| 228 |
<div class="srr_row"> |
| 229 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('date_format') ); ?>"><?php esc_html_e( 'Date format', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The format of the feed item date.', 'super-rss-reader' ) ); ?></div> |
| 230 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('date_format') ); ?>" name="<?php echo esc_attr( $this->get_field_name('date_format') ); ?>" type="text" value="<?php echo esc_attr( $date_format ); ?>" class="widefat" /> |
| 231 |
<small class="srr_small_text"><a href="https://wordpress.org/support/article/formatting-date-and-time/" target="_blank"><?php esc_html_e( 'Refer format codes here', 'super-rss-reader' ); ?></a> <?php echo wp_kses( __( 'Default: <code>j F Y</code> or type <code>relative</code> for relative format (example 2 days ago)', 'super-rss-reader' ), array( 'code' => array() ) ); ?></small> |
| 232 |
</div> |
| 233 |
</div> |
| 234 |
|
| 235 |
<h4><?php esc_html_e( 'Description', 'super-rss-reader' ); ?></h4> |
| 236 |
|
| 237 |
<div class="srr_row"> |
| 238 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('desc_type') ); ?>"><?php esc_html_e( 'Description to prefer', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'Sometimes feed items have both summary and the full post content. Select the type to prefer.', 'super-rss-reader' ) ); ?></div> |
| 239 |
<div class="srr_field"> |
| 240 |
<?php |
| 241 |
echo '<select name="' . esc_attr( $this->get_field_name('desc_type') ) . '" id="' . esc_attr( $this->get_field_id('desc_type') ) . '">'; |
| 242 |
foreach( $option_lists[ 'desc_type' ] as $k => $v ){ |
| 243 |
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $desc_type, $k, false ) . '>' . esc_html( $v ) . '</option>'; |
| 244 |
} |
| 245 |
echo '</select>'; |
| 246 |
?> |
| 247 |
</div> |
| 248 |
</div> |
| 249 |
|
| 250 |
<div class="srr_row"> |
| 251 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('strip_desc') ); ?>"><?php esc_html_e( 'Trim description to words', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The number of words to be displayed. Use 0 to disable trimming', 'super-rss-reader' ) ); ?></div> |
| 252 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('strip_desc') ); ?>" name="<?php echo esc_attr( $this->get_field_name('strip_desc') ); ?>" type="number" value="<?php echo esc_attr( $strip_desc ); ?>" class="widefat" /></div> |
| 253 |
</div> |
| 254 |
|
| 255 |
<div class="srr_row"> |
| 256 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('read_more') ); ?>"><?php esc_html_e( 'Read more text', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'Leave blank to hide read more text', 'super-rss-reader' ) ); ?></div> |
| 257 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('read_more') ); ?>" name="<?php echo esc_attr( $this->get_field_name('read_more') ); ?>" type="text" value="<?php echo esc_attr( $read_more ); ?>" class="widefat" /></div> |
| 258 |
</div> |
| 259 |
|
| 260 |
<div class="srr_row"> |
| 261 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('link_desc') ); ?>"><?php esc_html_e( 'Link description text', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'Wrap the description text with the link of the RSS feed item. Works only when rich description is disabled.', 'super-rss-reader' ) ); ?></div> |
| 262 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('link_desc') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('link_desc') ); ?>" value="1" <?php echo $link_desc == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 263 |
</div> |
| 264 |
|
| 265 |
<div class="srr_row"> |
| 266 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('rich_desc') ); ?>"><?php esc_html_e( 'Enable rich description', 'super-rss-reader' ); ?></label></div> |
| 267 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('rich_desc') ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name('rich_desc') ); ?>" value="1" <?php echo $rich_desc == "1" ? 'checked="checked"' : ""; ?> /></div> |
| 268 |
</div> |
| 269 |
|
| 270 |
<?php if( $rich_desc == 1 ): ?> |
| 271 |
<span class="srr_note"><?php esc_html_e( 'Note: You have enabled "Full/Rich HTML". If no description is present, then the full content will be displayed. Please make sure that the feed(s) are from trusted sources and do not contain any harmful scripts. If there are some alignment issues in the description, please use custom CSS to fix that.', 'super-rss-reader' ); ?></span> |
| 272 |
<?php endif; ?> |
| 273 |
|
| 274 |
<h4><?php esc_html_e( 'Thumbnail', 'super-rss-reader' ); ?></h4> |
| 275 |
|
| 276 |
<div class="srr_row"> |
| 277 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('thumbnail_position') ); ?>"><?php esc_html_e( 'Thumbnail position', 'super-rss-reader' ); ?></label></div> |
| 278 |
<div class="srr_field"> |
| 279 |
<?php |
| 280 |
echo '<select name="' . esc_attr( $this->get_field_name('thumbnail_position') ) . '" id="' . esc_attr( $this->get_field_id('thumbnail_position') ) . '">'; |
| 281 |
foreach( $option_lists[ 'thumbnail_position' ] as $k => $v ){ |
| 282 |
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $thumbnail_position, $k, false ) . '>' . esc_html( $v ) . '</option>'; |
| 283 |
} |
| 284 |
echo '</select>'; |
| 285 |
?> |
| 286 |
</div> |
| 287 |
</div> |
| 288 |
|
| 289 |
<div class="srr_row"> |
| 290 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('thumbnail_crop_position') ); ?>"><?php esc_html_e( 'Thumbnail crop position', 'super-rss-reader' ); ?></label></div> |
| 291 |
<div class="srr_field"> |
| 292 |
<?php |
| 293 |
echo '<select name="' . esc_attr( $this->get_field_name('thumbnail_crop_position') ) . '" id="' . esc_attr( $this->get_field_id('thumbnail_crop_position') ) . '">'; |
| 294 |
foreach( $option_lists[ 'thumbnail_crop_position' ] as $k => $v ){ |
| 295 |
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $thumbnail_crop_position, $k, false ) . '>' . esc_html( $v ) . '</option>'; |
| 296 |
} |
| 297 |
echo '</select>'; |
| 298 |
?> |
| 299 |
</div> |
| 300 |
</div> |
| 301 |
|
| 302 |
<div class="srr_row"> |
| 303 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('thumbnail_size') ); ?>"><?php esc_html_e( 'Thumbnail size', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The size of the thumbnail including the units. Example 64px, 10%', 'super-rss-reader' ) ); ?></div> |
| 304 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('thumbnail_size') ); ?>" name="<?php echo esc_attr( $this->get_field_name('thumbnail_size') ); ?>" type="text" value="<?php echo esc_attr( $thumbnail_size ); ?>" class="widefat" /></div> |
| 305 |
</div> |
| 306 |
|
| 307 |
<div class="srr_row"> |
| 308 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('thumbnail_force') ); ?>"><?php esc_html_e( 'Fetch thumbnail from the page (feed URL) directly if not available.', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'If feed item does not have an image, then fetch it from the page directly. This feature is available in the PRO version', 'super-rss-reader' ) ); ?></div> |
| 309 |
<div class="srr_field"> |
| 310 |
<select> |
| 311 |
<option disabled selected>No</option> |
| 312 |
<option disabled>When absent in feed item</option> |
| 313 |
<option disabled>Always</option> |
| 314 |
</select> |
| 315 |
<a class="srr_pro_tag" href="https://www.aakashweb.com/wordpress-plugins/super-rss-reader/?utm_source=admin&utm_medium=thumbnail&utm_campaign=srr-pro#pro" target="_blank" title="Upgrade to PRO version">PRO</a> |
| 316 |
</div> |
| 317 |
</div> |
| 318 |
|
| 319 |
<div class="srr_row"> |
| 320 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('thumbnail_type') ); ?>"><?php esc_html_e( 'The size of image to pick', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'If the feed contains both thumbnail and full-size images, choose which image size to use.', 'super-rss-reader' ) ); ?></div> |
| 321 |
<div class="srr_field"> |
| 322 |
<?php |
| 323 |
echo '<select name="' . esc_attr( $this->get_field_name('thumbnail_type') ) . '" id="' . esc_attr( $this->get_field_id('thumbnail_type') ) . '">'; |
| 324 |
foreach( $option_lists[ 'thumbnail_type' ] as $k => $v ){ |
| 325 |
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $thumbnail_type, $k, false ) . '>' . esc_html( $v ) . '</option>'; |
| 326 |
} |
| 327 |
echo '</select>'; |
| 328 |
?> |
| 329 |
</div> |
| 330 |
</div> |
| 331 |
|
| 332 |
<div class="srr_row"> |
| 333 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('thumbnail_default') ); ?>"><?php esc_html_e( 'Default thumbnail image', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The URL of the default thumbnail image if not present. Leave empty to skip thumbnail if not present.', 'super-rss-reader' ) ); ?></div> |
| 334 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('thumbnail_default') ); ?>" name="<?php echo esc_attr( $this->get_field_name('thumbnail_default') ); ?>" type="text" value="<?php echo esc_attr( $thumbnail_default ); ?>" class="widefat" /></div> |
| 335 |
</div> |
| 336 |
|
| 337 |
<h4><?php esc_html_e( 'Misc', 'super-rss-reader' ); ?></h4> |
| 338 |
|
| 339 |
<div class="srr_row"> |
| 340 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('date_timezone') ); ?>"><?php esc_html_e( 'Date timezone', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The timezone of the feed item date.', 'super-rss-reader' ) ); ?></div> |
| 341 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('date_timezone') ); ?>" name="<?php echo esc_attr( $this->get_field_name('date_timezone') ); ?>" type="text" value="<?php echo esc_attr( $date_timezone ); ?>" class="widefat" /> |
| 342 |
<small class="srr_small_text"><a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" target="_blank"><?php esc_html_e( 'Refer timezone name here', 'super-rss-reader' ); ?>.</a> <?php esc_html_e( 'Example: ', 'super-rss-reader' ); ?> <code>Asia/Taipei</code> <?php esc_html_e( 'Default: ', 'super-rss-reader' ); ?> <code>UTC</code></small> |
| 343 |
</div> |
| 344 |
</div> |
| 345 |
|
| 346 |
<div class="srr_row"> |
| 347 |
<div class="srr_label"><label for="<?php echo esc_attr( $this->get_field_id('no_feed_text') ); ?>"><?php esc_html_e( 'No feed items text', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'Text to display when there are no feed items', 'super-rss-reader' ) ); ?></div> |
| 348 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('no_feed_text') ); ?>" name="<?php echo esc_attr( $this->get_field_name('no_feed_text') ); ?>" type="text" value="<?php echo esc_attr( $no_feed_text ); ?>" class="widefat" /></div> |
| 349 |
</div> |
| 350 |
|
| 351 |
</section> |
| 352 |
|
| 353 |
<section data-tab-id="display"> |
| 354 |
|
| 355 |
<div class="srr_row"> |
| 356 |
<div class="srr_label srr_sm"><label for="<?php echo esc_attr( $this->get_field_id('color_style') ); ?>"><?php esc_html_e( 'Color theme', 'super-rss-reader' ); ?></label></div> |
| 357 |
<div class="srr_field"> |
| 358 |
<?php |
| 359 |
echo '<select name="' . esc_attr( $this->get_field_name('color_style') ) . '" id="' . esc_attr( $this->get_field_id('color_style') ) . '">'; |
| 360 |
foreach( $option_lists[ 'color_style' ] as $k => $v ){ |
| 361 |
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $color_style, $k, false ) . '>' . esc_html( $v ) . '</option>'; |
| 362 |
} |
| 363 |
echo '</select>'; |
| 364 |
?> |
| 365 |
</div> |
| 366 |
</div> |
| 367 |
|
| 368 |
<div class="srr_row"> |
| 369 |
<div class="srr_label srr_sm"><label for="<?php echo esc_attr( $this->get_field_id('display_type') ); ?>"><?php esc_html_e( 'Display type', 'super-rss-reader' ); ?></label></div> |
| 370 |
<div class="srr_field"> |
| 371 |
<?php |
| 372 |
echo '<select name="' . esc_attr( $this->get_field_name('display_type') ) . '" id="' . esc_attr( $this->get_field_id('display_type') ) . '">'; |
| 373 |
foreach( $option_lists[ 'display_type' ] as $k => $v ){ |
| 374 |
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $display_type, $k, false ) . '>' . esc_html( $v ) . '</option>'; |
| 375 |
} |
| 376 |
echo '</select>'; |
| 377 |
?> |
| 378 |
</div> |
| 379 |
</div> |
| 380 |
|
| 381 |
<h4><?php esc_html_e( 'Ticker type settings', 'super-rss-reader' ); ?></h4> |
| 382 |
|
| 383 |
<div class="srr_row"> |
| 384 |
<div class="srr_label srr_sm"><label for="<?php echo esc_attr( $this->get_field_id('ticker_speed') ); ?>"><?php esc_html_e( 'Ticker speed', 'super-rss-reader' ); ?></label></div> |
| 385 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('ticker_speed') ); ?>" name="<?php echo esc_attr( $this->get_field_name('ticker_speed') ); ?>" type="number" value="<?php echo esc_attr( $ticker_speed ); ?>" title="Speed of the ticker in seconds"/> seconds</div> |
| 386 |
</div> |
| 387 |
|
| 388 |
<div class="srr_row"> |
| 389 |
<div class="srr_label srr_sm"><label for="<?php echo esc_attr( $this->get_field_id('visible_items') ); ?>"><?php esc_html_e( 'Widget height', 'super-rss-reader' ); ?><?php $this->tt( __( 'The height of the widget when display type is "ticker"', 'super-rss-reader' ) ); ?></label></div> |
| 390 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('visible_items') ); ?>" name="<?php echo esc_attr( $this->get_field_name('visible_items') ); ?>" type="number" value="<?php echo esc_attr( $visible_items ); ?>" /><br/> |
| 391 |
<small class="srr_small_text"><?php esc_html_e( 'Set value less than 20 to show visible feed items. Example: 5 items', 'super-rss-reader' ); ?></small></br> |
| 392 |
<small class="srr_small_text"><?php esc_html_e( 'Set value greater than 20 for fixed widget height. Example: 400 px', 'super-rss-reader' ); ?></small></div> |
| 393 |
</div> |
| 394 |
|
| 395 |
<h4><?php esc_html_e( 'Scroll type settings', 'super-rss-reader' ); ?></h4> |
| 396 |
|
| 397 |
<div class="srr_row"> |
| 398 |
<div class="srr_label srr_sm"><label for="<?php echo esc_attr( $this->get_field_id('scroll_height') ); ?>"><?php esc_html_e( 'Maximum height of the widget', 'super-rss-reader' ); ?></label></div> |
| 399 |
<div class="srr_field"><input id="<?php echo esc_attr( $this->get_field_id('scroll_height') ); ?>" name="<?php echo esc_attr( $this->get_field_name('scroll_height') ); ?>" type="text" value="<?php echo esc_attr( $scroll_height ); ?>" title="Maximum height of the widget"/><br/> |
| 400 |
<small class="srr_small_text"><?php esc_html_e( 'Example: 400px', 'super-rss-reader' ); ?></small> |
| 401 |
</div> |
| 402 |
</div> |
| 403 |
|
| 404 |
</section> |
| 405 |
|
| 406 |
<section data-tab-id="filter" class="srr_pro_sec"> |
| 407 |
|
| 408 |
<p>You can build rules to show/hide feed items based on feed title, URL and description. This feature is available in the <a href="https://www.aakashweb.com/wordpress-plugins/super-rss-reader/?utm_source=admin&utm_medium=filter&utm_campaign=srr-pro#pro" target="_blank">PRO version</a>.</p> |
| 409 |
|
| 410 |
<div> |
| 411 |
<h4><?php esc_html_e( 'Filter RSS feed items', 'super-rss-reader' ); ?></h4> |
| 412 |
|
| 413 |
<div class="srr_row"> |
| 414 |
<div class="srr_label"><label><?php esc_html_e( 'Filter type', 'super-rss-reader' ); ?></label></div> |
| 415 |
<div class="srr_field"> |
| 416 |
<?php |
| 417 |
echo '<select disabled="disabled">'; |
| 418 |
echo '<option>Show items based on filter</option>'; |
| 419 |
echo '</select>'; |
| 420 |
?> |
| 421 |
</div> |
| 422 |
</div> |
| 423 |
|
| 424 |
<div class="srr_row"> |
| 425 |
<div class="srr_label"><label><?php esc_html_e( 'Filter rules', 'super-rss-reader' ); ?></label><?php $this->tt( __( 'The rules for the keyword filters', 'super-rss-reader' ) ); ?></div> |
| 426 |
<div class="srr_field"><a href="#"><?php esc_html_e( 'View/Edit filter rules', 'super-rss-reader' ); ?></a></div> |
| 427 |
</div> |
| 428 |
</div> |
| 429 |
|
| 430 |
</section> |
| 431 |
|
| 432 |
</div> |
| 433 |
|
| 434 |
<div class="srr_pro"> |
| 435 |
<div class="srr_pro_intro"> |
| 436 |
<div><span class="srr_pro_label">PRO</span></div> |
| 437 |
<p>Get the PRO version to enjoy more features like<br/> <span>Shortcode, Grid display, Filter by keyword, Pagination</span> and more !</p> |
| 438 |
<div><span class="dashicons dashicons-arrow-down-alt2 srr_pro_more"></span></div> |
| 439 |
</div> |
| 440 |
<div class="srr_pro_details"> |
| 441 |
<ul class="srr_pro_features"> |
| 442 |
<li>Merge feeds - <span>Merge multiple feeds into one</span></li> |
| 443 |
<li>Shortcode - <span>Display RSS feed anywhere in your website</span></li> |
| 444 |
<li>Grid display - <span>Display feed item in rows and columns</span></li> |
| 445 |
<li>Paginated display - <span>Display feed item in different pages.</span></li> |
| 446 |
<li>Filter by keyword - <span>Show/hide feed items based on keyword</span></li> |
| 447 |
<li>Custom template - <span>Change order of feed item content, add HTML</span></li> |
| 448 |
<li>Fetch thumbnail - <span>Forcefully fetches the thumbnail from feed URL.</span></li> |
| 449 |
<li>4+ new color themes</li> |
| 450 |
<li>Updates and support for 1 year</li> |
| 451 |
</ul> |
| 452 |
<p><a href="https://www.aakashweb.com/wordpress-plugins/super-rss-reader/?utm_source=admin&utm_medium=widget-get&utm_campaign=srr-pro#pro" class="button button-primary">Get PRO version</a> <a href="https://www.aakashweb.com/wordpress-plugins/super-rss-reader/?utm_source=admin&utm_medium=widget-info&utm_campaign=srr-pro" class="button">More information</a></p> |
| 453 |
</div> |
| 454 |
</div> |
| 455 |
|
| 456 |
<div class="srr_info"> |
| 457 |
<p><a href="https://www.aakashweb.com/docs/super-rss-reader/" target="_blank">Docs</a> | <a href="https://www.aakashweb.com/forum/discuss/wordpress-plugins/super-rss-reader/" target="_blank">Report issue</a> | <a href="https://wordpress.org/support/plugin/super-rss-reader/reviews/?rate=5#new-post" target="_blank">Rate 5 stars & review</a> | v<?php echo SRR_VERSION; ?></p> |
| 458 |
</div> |
| 459 |
|
| 460 |
<?php |
| 461 |
} |
| 462 |
|
| 463 |
public function tt( $text ){ |
| 464 |
echo '<div class="srr_tt" tabindex="0"><span class="dashicons dashicons-editor-help"></span><span class="srr_tt_text"><span>' . esc_html( $text ) . '</span></span></div>'; |
| 465 |
} |
| 466 |
|
| 467 |
} |
| 468 |
|
| 469 |
?> |