PluginProbe
Super RSS Reader – Add attractive RSS Feed Widget / 3.1
Super RSS Reader – Add attractive RSS Feed Widget v3.1
trunk 0.8 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 3.0 3.1 3.2 4.0 4.0.1 4.1 4.2 4.3 4.4 4.4.1 4.5 4.6 4.7 4.8 All 33 releases
super-rss-reader / includes / widget-admin.php

widget-admin.php in Super RSS Reader – Add attractive RSS Feed Widget 3.1, at includes/widget-admin.php

253 lines 14.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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' => 'Enhanced RSS feed reader widget with advanced features.'
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 "\n" . '
34 <!-- Start - Super RSS Reader v' . SRR_VERSION . '-->
35 <div class="super-rss-reader-widget">' . "\n";
36
37 SRR_Widget::render_feed( $instance );
38
39 echo "\n" . '</div>
40 <!-- End - Super RSS Reader -->
41 ' . "\n";
42 echo $after_widget;
43
44 }
45
46 // Save settings
47 public function update( $new_instance, $old_instance ){
48
49 $instance = $old_instance;
50
51 $instance[ 'title' ] = stripslashes( $new_instance['title'] );
52 $instance[ 'urls' ] = stripslashes( $new_instance['urls']) ;
53 $instance[ 'tab_titles' ] = stripslashes( $new_instance['tab_titles'] );
54
55 $instance[ 'count' ] = intval( $new_instance['count'] );
56 $instance[ 'show_date' ] = intval( $new_instance['show_date'] );
57 $instance[ 'show_desc' ] = intval( $new_instance['show_desc'] );
58 $instance[ 'show_author' ] = intval( $new_instance['show_author'] );
59 $instance[ 'show_thumb' ] = stripslashes( $new_instance['show_thumb'] );
60 $instance[ 'open_newtab' ] = intval( $new_instance['open_newtab'] );
61 $instance[ 'add_nofollow' ] = intval( $new_instance['add_nofollow'] );
62 $instance[ 'strip_desc' ] = intval( $new_instance['strip_desc'] );
63 $instance[ 'strip_title' ] = intval( $new_instance['strip_title'] );
64 $instance[ 'read_more' ] = stripslashes( $new_instance['read_more'] );
65 $instance[ 'rich_desc' ] = stripslashes( $new_instance['rich_desc'] );
66
67 $instance[ 'color_style' ] = stripslashes( $new_instance['color_style']);
68 $instance[ 'enable_ticker' ] = intval( $new_instance['enable_ticker']);
69 $instance[ 'visible_items' ] = intval( $new_instance['visible_items']);
70 $instance[ 'ticker_speed' ] = intval( $new_instance['ticker_speed']);
71
72 return $instance;
73 }
74
75 // Widget form
76 public function form( $instance ){
77
78 $instance = wp_parse_args((array) $instance, SRR_Widget::default_settings());
79
80 $title = htmlspecialchars($instance['title']);
81 $urls = htmlspecialchars($instance['urls']);
82 $tab_titles = htmlspecialchars($instance['tab_titles']);
83
84 $count = intval($instance['count']);
85 $show_date = intval($instance['show_date']);
86 $show_desc = intval($instance['show_desc']);
87 $show_author = intval($instance['show_author']);
88 $show_thumb = intval($instance['show_thumb']);
89 $open_newtab = intval($instance['open_newtab']);
90 $add_nofollow = intval($instance['add_nofollow']);
91 $strip_desc = intval($instance['strip_desc']);
92 $strip_title = intval($instance['strip_title']);
93 $read_more = htmlspecialchars($instance['read_more']);
94 $rich_desc = htmlspecialchars($instance['rich_desc']);
95
96 $color_style = stripslashes($instance['color_style']);
97 $enable_ticker = intval($instance['enable_ticker']);
98 $visible_items = intval($instance['visible_items']);
99 $ticker_speed = intval($instance['ticker_speed']);
100
101 // Replacing commas with new lines
102 $urls = str_replace( ',', "\n", $urls );
103 $tab_titles = str_replace( ',', "\n", $tab_titles );
104
105 ?>
106 <div class="srr_settings">
107 <table width="100%" height="72" border="0">
108 <tr>
109 <td width="13%" height="33"><label for="<?php echo $this->get_field_id('title'); ?>">Title</label></td>
110 <td width="87%"><input id="<?php echo $this->get_field_id('title');?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" class="widefat"/></td>
111 </tr>
112 <tr>
113 <td><label for="<?php echo $this->get_field_id('urls'); ?>">URL(s)</label></td>
114 <td><textarea id="<?php echo $this->get_field_id('urls');?>" name="<?php echo $this->get_field_name('urls'); ?>" class="widefat"><?php echo $urls; ?></textarea>
115 <small class="srr_small_text">Can enter multiple RSS/atom feed URLs in new line</small>
116 </td>
117 </tr>
118
119 <tr>
120 <td><label for="<?php echo $this->get_field_id('tab_titles'); ?>">Tab titles</label></td>
121 <td><textarea id="<?php echo $this->get_field_id('tab_titles');?>" name="<?php echo $this->get_field_name('tab_titles'); ?>" class="widefat"><?php echo $tab_titles; ?></textarea>
122 <small class="srr_small_text">Enter corresponding tab titles in new line.</small>
123 </td>
124 </tr>
125
126 </table>
127 </div>
128
129 <div class="srr_settings">
130 <h4>Settings</h4>
131 <table width="100%" border="0">
132 <tr height="30px">
133 <td width="7%"><input id="<?php echo $this->get_field_id('show_desc'); ?>" type="checkbox" name="<?php echo $this->get_field_name('show_desc'); ?>" value="1" <?php echo $show_desc == "1" ? 'checked="checked"' : ""; ?> /></td>
134 <td width="43%"><label for="<?php echo $this->get_field_id('show_desc'); ?>">Show Description</label></td>
135 <td width="7%"><input id="<?php echo $this->get_field_id('show_date'); ?>" type="checkbox" name="<?php echo $this->get_field_name('show_date'); ?>" value="1" <?php echo $show_date == "1" ? 'checked="checked"' : ""; ?> /></td>
136 <td width="43%"><label for="<?php echo $this->get_field_id('show_date'); ?>">Show Date</label></td>
137 </tr>
138
139 <tr height="30px">
140 <td><input id="<?php echo $this->get_field_id('show_author'); ?>" type="checkbox" name="<?php echo $this->get_field_name('show_author'); ?>" value="1" <?php echo $show_author == "1" ? 'checked="checked"' : ""; ?> /></td>
141 <td><label for="<?php echo $this->get_field_id('show_author'); ?>">Show Author</label></td>
142 <td><input id="<?php echo $this->get_field_id('show_thumb'); ?>" type="checkbox" name="<?php echo $this->get_field_name('show_thumb'); ?>" value="1" <?php echo $show_thumb == "1" ? 'checked="checked"' : ""; ?> /></td>
143 <td><label for="<?php echo $this->get_field_id('show_thumb'); ?>">Show thumbnail if present</label></td>
144 </tr>
145
146 </table>
147
148 <h4></h4>
149
150 <table width="100%" border="0">
151 <tr height="30px">
152 <td width="7%"><input id="<?php echo $this->get_field_id('rich_desc'); ?>" type="checkbox" name="<?php echo $this->get_field_name('rich_desc'); ?>" value="1" <?php echo $rich_desc == "1" ? 'checked="checked"' : ""; ?> /></td>
153 <td width="40%"><label for="<?php echo $this->get_field_id('rich_desc'); ?>">Enable full or rich description</label></td>
154 <td width="28%"><label for="<?php echo $this->get_field_id('count');?>">Total items to show:</label></td>
155 <td width="25%"><input id="<?php echo $this->get_field_id('count');?>" name="<?php echo $this->get_field_name('count'); ?>" type="number" value="<?php echo $count; ?>" class="widefat" title="No of feed items to parse"/></td>
156 </tr>
157
158 <tr height="30">
159 <td><input id="<?php echo $this->get_field_id('add_nofollow'); ?>" type="checkbox" name="<?php echo $this->get_field_name('add_nofollow'); ?>" value="1" <?php echo $add_nofollow == "1" ? 'checked="checked"' : ""; ?> /></td>
160 <td><label for="<?php echo $this->get_field_id('add_nofollow'); ?>">Add "no follow" attribute to links</label></td>
161 <td><label for="<?php echo $this->get_field_id('strip_desc');?>">Strip description characters:</label></td>
162 <td><input id="<?php echo $this->get_field_id('strip_desc');?>" name="<?php echo $this->get_field_name('strip_desc'); ?>" type="number" value="<?php echo $strip_desc; ?>" class="widefat" title="The number of charaters to be displayed. Use 0 to disable stripping"/> </td>
163 </tr>
164
165 <tr height="30">
166 <td><input id="<?php echo $this->get_field_id('open_newtab'); ?>" type="checkbox" name="<?php echo $this->get_field_name('open_newtab'); ?>" value="1" <?php echo $open_newtab == "1" ? 'checked="checked"' : ""; ?> /></td>
167 <td><label for="<?php echo $this->get_field_id('open_newtab'); ?>">Open links in new tab</label></td>
168 <td><label for="<?php echo $this->get_field_id('read_more'); ?>">Read more text:</label></td>
169 <td><input id="<?php echo $this->get_field_id('read_more'); ?>" name="<?php echo $this->get_field_name('read_more'); ?>" type="text" value="<?php echo $read_more; ?>" class="widefat" title="Leave blank to hide read more text"/></td>
170 </tr>
171
172 <tr height="30">
173 <td></td>
174 <td></td>
175 <td><label for="<?php echo $this->get_field_id('strip_title'); ?>">Strip title characters:</label></td>
176 <td><input id="<?php echo $this->get_field_id('strip_title');?>" name="<?php echo $this->get_field_name('strip_title'); ?>" type="number" value="<?php echo $strip_title; ?>" class="widefat" title="The number of charaters to be displayed. Use 0 to disable stripping"/></td>
177 </tr>
178
179 </table>
180 </div>
181
182 <?php if( $rich_desc == 1 ): ?>
183 <span class="srr_note">Note: You have enabled "Full/Rich HTML" 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. </span>
184 <?php endif; ?>
185
186 <div class="srr_settings">
187 <h4>Customization</h4>
188 <table width="100%" height="109" border="0">
189 <tr>
190 <td height="32"><label for="<?php echo $this->get_field_id('color_style');?>">Color theme: </label></td>
191 <td>
192 <?php
193 $color_themes = SRR_Widget::color_themes();
194 echo '<select name="' . $this->get_field_name('color_style') . '" id="' . $this->get_field_id('color_style') . '">';
195 foreach($color_themes as $k => $v){
196 echo '<option value="' . $v . '" ' . ($color_style == $v ? 'selected="selected"' : "") . '>' . $k . '</option>';
197 }
198 echo '</select>';
199 ?>
200 </td>
201 </tr>
202 <tr>
203 <td height="36"><label for="<?php echo $this->get_field_id('visible_items');?>">Widget height:</label></td>
204 <td><input id="<?php echo $this->get_field_id('visible_items');?>" name="<?php echo $this->get_field_name('visible_items'); ?>" type="number" value="<?php echo $visible_items; ?>" title="Height of the RSS feed."/><br/>
205 <small class="srr_small_text">Set value less than 20 to show visible feed items. Example: <b>5</b> items</small></br>
206 <small class="srr_small_text">Set value greater than 20 for fixed widget height. Example: <b>400</b> px</small></br>
207 </td>
208 </tr>
209 <tr>
210 <td height="33"><label for="<?php echo $this->get_field_id('enable_ticker'); ?>">Ticker animation:</label> </td>
211 <td><input id="<?php echo $this->get_field_id('enable_ticker'); ?>" type="checkbox" name="<?php echo $this->get_field_name('enable_ticker'); ?>" value="1" <?php echo $enable_ticker == "1" ? 'checked="checked"' : ""; ?> /></td>
212 </tr>
213 <tr>
214 <td height="36"><label for="<?php echo $this->get_field_id('ticker_speed');?>">Ticker speed: </label></td>
215 <td><input id="<?php echo $this->get_field_id('ticker_speed');?>" name="<?php echo $this->get_field_name('ticker_speed'); ?>" type="number" value="<?php echo $ticker_speed; ?>" title="Speed of the ticker in seconds"/> seconds
216 </td>
217 </tr>
218 </table>
219 </div>
220
221 <div class="srr_coffee">
222 <p>Thank you for using Super RSS Reader. If you found it useful, please buy me a coffee !</p>
223 <div class="srr_coffee_wrap">
224 <select class="srr_coffee_amt">
225 <option value="6" selected="selected">$6</option>
226 <option value="7">$7</option>
227 <option value="8">$8</option>
228 <option value="9">$9</option>
229 <option value="10">$10</option>
230 <option value="11">$11</option>
231 <option value="12">$12</option>
232 <option value="13">$13</option>
233 <option value="14">$14</option>
234 <option value="15">$15</option>
235 <option value="">Custom</option>
236 </select>
237 <a class="button button-primary srr_coffee_btn" href="https://www.paypal.me/vaakash/6" data-link="https://www.paypal.me/vaakash/" target="_blank">Buy me a coffee !</a>
238 </div>
239 </div>
240
241 <div class="srr_survey">
242 <p><a href="https://forms.gle/cvzQ7k2Lex5xZLDf9" class="button button-primary" target="_blank">Share a feature</a><span>Request feature</span> Want any feature you would like to see in Super RSS Reader plugin ? Please share your requirements and features in a quick form.</p>
243 </div>
244
245 <div class="srr_info">
246 <p><a href="https://www.aakashweb.com/docs/super-rss-reader-doc/faq/" target="_blank">FAQ</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>
247 </div>
248
249 <?php
250 }
251 }
252
253 ?>