| @@ -1,495 +1,480 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | - * Plugin Name: Super RSS Reader | |
| 4 | - * Plugin URI: https://www.aakashweb.com/wordpress-plugins/super-rss-reader/ | |
| 5 | - * Author URI: https://www.aakashweb.com/ | |
| 6 | - * Description: Super RSS Reader is jQuery based RSS reader widget, which displays the RSS feeds in the widget in an attractive way. It uses the jQuery easy ticker plugin to add a news ticker like effect to the RSS feeds. Multiple RSS feeds can be added for a single widget and they get separated in tabs. | |
| 7 | - * Author: Aakash Chakravarthy | |
| 8 | - * Version: 2.8 | |
| 9 | - */ | |
| 3 | +Plugin Name: Super RSS Reader | |
| 4 | +Plugin URI: http://www.aakashweb.com/wordpress-plugins/super-rss-reader/ | |
| 5 | +Author URI: http://www.aakashweb.com/ | |
| 6 | +Description: Super RSS Reader is jQuery based RSS reader widget, which displays the RSS feeds in the widget in an attractive way. It uses the jQuery easy ticker plugin to add a news ticker like effect to the RSS feeds. Multiple RSS feeds can be added for a single widget and they get seperated in tabs. <a href="http://www.youtube.com/watch?v=02aOG_-98Tg" target="_blank" title="Super RSS Reader demo video">Check out the demo video</a>. | |
| 7 | +Author: Aakash Chakravarthy | |
| 8 | +Version: 2.4 | |
| 9 | +*/ | |
| 10 | 10 | |
| 11 | -define('SRR_VERSION', '2.8'); | |
| 12 | -define('SRR_URL', plugin_dir_url( __FILE__ )); | |
| 11 | +if(!defined('WP_CONTENT_URL')) { | |
| 12 | + $srr_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__)).'/'; | |
| 13 | +}else{ | |
| 14 | + $srr_url = WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/'; | |
| 15 | +} | |
| 13 | 16 | |
| 14 | -// Include the required scripts & styles | |
| 17 | +define('SRR_VERSION', '2.4'); | |
| 18 | +define('SRR_AUTHOR', 'Aakash Chakravarthy'); | |
| 19 | +define('SRR_URL', $srr_url); | |
| 20 | + | |
| 21 | +## Include the required scripts | |
| 15 | 22 | function srr_public_scripts(){ |
| 16 | - wp_enqueue_script('jquery-easy-ticker-js', SRR_URL . 'public/js/jquery.easy-ticker.min.js', array( 'jquery', 'super-rss-reader-js' )); | |
| 17 | - wp_enqueue_script('super-rss-reader-js', SRR_URL . 'public/js/script.min.js', array( 'jquery' )); | |
| 18 | - wp_enqueue_style('super-rss-reader-css', SRR_URL . 'public/css/style.min.css'); | |
| 23 | + // jQuery | |
| 24 | + wp_enqueue_script('jquery'); | |
| 25 | + | |
| 26 | + // Super RSS Reader JS and CSS | |
| 27 | + wp_register_script('super-rss-reader-js', SRR_URL . 'public/srr-js.js'); | |
| 28 | + wp_enqueue_script(array('jquery', 'super-rss-reader-js')); | |
| 19 | 29 | } |
| 20 | 30 | add_action('wp_enqueue_scripts', 'srr_public_scripts'); |
| 21 | 31 | |
| 22 | -// Default color styles | |
| 23 | -function srr_color_styles(){ | |
| 24 | - return array( | |
| 25 | - 'No style' => 'none', | |
| 26 | - 'Grey' => 'grey', | |
| 27 | - 'Dark' => 'dark', | |
| 28 | - 'Orange' => 'orange', | |
| 29 | - 'Simple modern' => 'smodern' | |
| 30 | - ); | |
| 32 | +## Include the required styles | |
| 33 | +function srr_public_styles(){ | |
| 34 | + wp_register_style('super-rss-reader-css', SRR_URL . 'public/srr-css.css'); | |
| 35 | + wp_enqueue_style('super-rss-reader-css'); | |
| 31 | 36 | } |
| 37 | +add_action('wp_enqueue_scripts', 'srr_public_styles'); | |
| 32 | 38 | |
| 33 | -function srr_defaults(){ | |
| 34 | - return array( | |
| 35 | - 'title' => '', | |
| 36 | - 'urls' => '', | |
| 37 | - 'tab_titles' => '', | |
| 38 | - 'count' => 5, | |
| 39 | - 'show_date' => 0, | |
| 40 | - 'show_desc' => 1, | |
| 41 | - 'show_author' => 0, | |
| 42 | - 'show_thumb' => 1, | |
| 43 | - 'open_newtab' => 1, | |
| 44 | - 'strip_desc' => 100, | |
| 45 | - 'add_nofollow' => 1, | |
| 46 | - 'read_more' => '[...]', | |
| 47 | - 'rich_desc' => 0 , | |
| 48 | - 'color_style' => 'none', | |
| 49 | - 'enable_ticker' => 1, | |
| 50 | - 'visible_items' => 5, | |
| 51 | - 'strip_title' => 0, | |
| 52 | - 'ticker_speed' => 4, | |
| 53 | - ); | |
| 54 | -} | |
| 39 | +## Default color styles | |
| 40 | +$srr_color_styles = array( | |
| 41 | + 'No style' => 'none', | |
| 42 | + 'Grey' => 'grey', | |
| 43 | + 'Dark' => 'dark', | |
| 44 | + 'Orange' => 'orange', | |
| 45 | + 'Simple modern' => 'smodern' | |
| 46 | +); | |
| 55 | 47 | |
| 56 | -// The main RSS Parser | |
| 48 | +## The main RSS Parser | |
| 57 | 49 | function srr_rss_parser($instance){ |
| 58 | - | |
| 59 | - $instance = wp_parse_args($instance, srr_defaults()); | |
| 60 | - | |
| 61 | - $urls = stripslashes($instance['urls']); | |
| 62 | - $tab_titles = stripslashes($instance['tab_titles']); | |
| 63 | - $count = intval($instance['count']); | |
| 64 | - | |
| 65 | - $show_date = intval($instance['show_date']); | |
| 66 | - $show_desc = intval($instance['show_desc']); | |
| 67 | - $show_author = intval($instance['show_author']); | |
| 68 | - $show_thumb = stripslashes($instance['show_thumb']); | |
| 69 | - $open_newtab = intval($instance['open_newtab']); | |
| 70 | - $add_nofollow = intval($instance['add_nofollow']); | |
| 71 | - $strip_desc = intval($instance['strip_desc']); | |
| 72 | - $strip_title = intval($instance['strip_title']); | |
| 73 | - $read_more = htmlspecialchars($instance['read_more']); | |
| 74 | - $rich_desc = intval($instance['rich_desc']); | |
| 75 | - | |
| 76 | - $color_style = stripslashes($instance['color_style']); | |
| 77 | - $enable_ticker = intval($instance['enable_ticker']); | |
| 78 | - $visible_items = intval($instance['visible_items']); | |
| 79 | - $ticker_speed = intval($instance['ticker_speed']) * 1000; | |
| 80 | - | |
| 81 | - if(empty($urls)){ | |
| 82 | - return ''; | |
| 83 | - } | |
| 84 | - | |
| 85 | - $rand = array(); | |
| 86 | - $url = explode(',', $urls); | |
| 87 | - $tab_title = explode(',', $tab_titles); | |
| 88 | - $ucount = count($url); | |
| 89 | - | |
| 90 | - // Generate the Tabs | |
| 91 | - if($ucount > 1){ | |
| 92 | - echo '<ul class="srr-tab-wrap srr-tab-style-' . $color_style . ' srr-clearfix">'; | |
| 93 | - for( $i=0; $i < $ucount; $i++ ){ | |
| 94 | - // Get the Feed URL | |
| 95 | - $feedUrl = trim( $url[$i] ); | |
| 96 | - $rss = fetch_feed( $feedUrl ); | |
| 97 | - $rand[$i] = rand(0, 999); | |
| 98 | - | |
| 99 | - if (!is_wp_error($rss)){ | |
| 100 | - | |
| 101 | - if( isset( $tab_title[$i] ) && !empty( $tab_title[$i]) ){ | |
| 102 | - $rss_title = $tab_title[$i]; | |
| 103 | - }else{ | |
| 104 | - $rss_title = esc_attr(strip_tags($rss->get_title())); | |
| 105 | - } | |
| 106 | - | |
| 107 | - echo '<li data-tab="srr-tab-' . $rand[$i] . '">' . $rss_title . '</li>'; | |
| 108 | - }else{ | |
| 109 | - echo '<li data-tab="srr-tab-' . $rand[$i] . '">Error</li>'; | |
| 110 | - } | |
| 111 | - | |
| 112 | - } | |
| 113 | - echo '</ul>'; | |
| 114 | - } | |
| 115 | - | |
| 116 | - for($i=0; $i<$ucount; $i++){ | |
| 117 | - // Get the Feed URL | |
| 118 | - $feedUrl = trim($url[$i]); | |
| 119 | - if(isset($url[$i])){ | |
| 120 | - $rss = fetch_feed($feedUrl); | |
| 121 | - }else{ | |
| 122 | - return ''; | |
| 123 | - } | |
| 124 | - | |
| 125 | - if( method_exists( $rss, 'enable_order_by_date' ) ){ | |
| 126 | - $rss->enable_order_by_date(false); | |
| 127 | - } | |
| 128 | - | |
| 129 | - // Check for feed errors | |
| 130 | - if (!is_wp_error( $rss ) ){ | |
| 131 | - $maxitems = $rss->get_item_quantity($count); | |
| 132 | - $rss_items = $rss->get_items(0, $maxitems); | |
| 133 | - $rss_title = esc_attr(strip_tags($rss->get_title())); | |
| 134 | - $rss_desc = esc_attr(strip_tags($rss->get_description())); | |
| 135 | - }else{ | |
| 136 | - echo '<div class="srr-wrap srr-style-' . $color_style .'" data-id="srr-tab-' . $rand[$i] . '"><p>RSS Error: ' . $rss->get_error_message() . '</p></div>'; | |
| 137 | - continue; | |
| 138 | - } | |
| 139 | - | |
| 140 | - $randAttr = isset($rand[$i]) ? ' data-id="srr-tab-' . $rand[$i] . '" ' : ''; | |
| 141 | - | |
| 142 | - // Outer Wrap start | |
| 143 | - echo '<div class="srr-wrap ' . (($enable_ticker == 1 ) ? 'srr-vticker' : '' ) . ' srr-style-' . $color_style . '" data-visible="' . $visible_items . '" data-speed="' . $ticker_speed . '"' . $randAttr . '><div>'; | |
| 144 | - | |
| 145 | - // Check feed items | |
| 146 | - if ($maxitems == 0){ | |
| 147 | - echo '<div>No items.</div>'; | |
| 148 | - }else{ | |
| 149 | - $j=1; | |
| 150 | - // Loop through each feed item | |
| 151 | - foreach ($rss_items as $item){ | |
| 152 | - // Get the link | |
| 153 | - $link = $item->get_link(); | |
| 154 | - while ( stristr($link, 'http') != $link ){ $link = substr($link, 1); } | |
| 155 | - $link = esc_url(strip_tags($link)); | |
| 156 | - | |
| 157 | - // Get the item title | |
| 158 | - $title = esc_attr(strip_tags($item->get_title())); | |
| 159 | - if ( empty($title) ) | |
| 160 | - $title = __('No Title'); | |
| 161 | - | |
| 162 | - if( $strip_title != 0 ){ | |
| 163 | - $titleLen = strlen($title); | |
| 164 | - $title = wp_html_excerpt( $title, $strip_title ); | |
| 165 | - $title = ($titleLen > $strip_title) ? $title . ' ...' : $title; | |
| 166 | - } | |
| 167 | - | |
| 168 | - // Open links in new tab | |
| 169 | - $newtab = ($open_newtab) ? ' target="_blank"' : ''; | |
| 170 | - | |
| 171 | - // Add no follow attribute | |
| 172 | - $nofollow = ($add_nofollow) ? ' rel="nofollow"' : ''; | |
| 173 | - | |
| 174 | - // Get the date | |
| 175 | - $date = $item->get_date('j F Y'); | |
| 176 | - | |
| 177 | - // Get thumbnail if present @since v2.2 | |
| 178 | - $thumb = ''; | |
| 179 | - if ($show_thumb == 1 && $enclosure = $item->get_enclosure()){ | |
| 180 | - $thumburl = $enclosure->get_thumbnail(); | |
| 181 | - if(!empty($thumburl)) | |
| 182 | - $thumb = '<img src="' . $thumburl . '" alt="' . $title . '" class="srr-thumb" align="left"/>'; | |
| 183 | - } | |
| 184 | - | |
| 185 | - // Get the description | |
| 186 | - $desc = ''; | |
| 187 | - if( $rich_desc == 1 ){ | |
| 188 | - $desc = strip_tags( str_replace( 'eval', '', $item->get_description() ) , '<p><a><img><em><strong><font><strike><s><u><i>'); | |
| 189 | - | |
| 190 | - }else{ | |
| 191 | - $rmore = ''; | |
| 192 | - $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); | |
| 193 | - if($strip_desc != 0){ | |
| 194 | - $desc = wp_html_excerpt( $desc, $strip_desc ); | |
| 195 | - $rmore = (!empty($read_more)) ? '<a href="' . $link . '" title="Read more"' . $newtab . $nofollow . '>' . $read_more . '</a>' : ''; | |
| 196 | - | |
| 197 | - if ( '[...]' == substr( $desc, -5 ) ) | |
| 198 | - $desc = substr( $desc, 0, -5 ); | |
| 199 | - elseif ( '[…]' != substr( $desc, -10 ) ) | |
| 200 | - $desc .= ''; | |
| 201 | - | |
| 202 | - $desc = esc_html( $desc ); | |
| 203 | - } | |
| 204 | - | |
| 205 | - $desc = $thumb . $desc . ' ' . $rmore; | |
| 206 | - | |
| 207 | - } | |
| 208 | - | |
| 209 | - // Get the author | |
| 210 | - $author = $item->get_author(); | |
| 211 | - if ( is_object($author) ) { | |
| 212 | - $author = $author->get_name(); | |
| 213 | - $author = esc_html(strip_tags($author)); | |
| 214 | - } | |
| 215 | - | |
| 216 | - echo "\n\n\t"; | |
| 217 | - | |
| 218 | - // Display the feed items | |
| 219 | - echo '<div class="srr-item ' . (($j%2 == 0) ? 'even' : 'odd') . '">'; | |
| 220 | - echo '<div class="srr-title"><a href="' . $link . '"' . $newtab . $nofollow . ' title="Posted on ' . $date . '">' . $title . '</a></div>'; | |
| 221 | - echo '<div class="srr-meta">'; | |
| 222 | - | |
| 223 | - if($show_date && !empty($date)) | |
| 224 | - echo '<time class="srr-date">' . $date . '</time>'; | |
| 225 | - | |
| 226 | - if($show_author && !empty($author)) | |
| 227 | - echo ' - <cite class="srr-author">' . $author . '</cite>'; | |
| 228 | - | |
| 229 | - echo '</div>'; | |
| 230 | - | |
| 231 | - if($show_desc) | |
| 232 | - echo '<p class="srr-summary srr-clearfix">' . $desc . '</p>'; | |
| 233 | - | |
| 234 | - echo '</div>'; | |
| 235 | - // End display | |
| 236 | - | |
| 237 | - $j++; | |
| 238 | - } | |
| 239 | - } | |
| 240 | - | |
| 241 | - // Outer wrap end | |
| 242 | - echo "\n\n</div> | |
| 243 | - </div> \n\n" ; | |
| 244 | - | |
| 245 | - if ( ! is_wp_error($rss) ) | |
| 246 | - $rss->__destruct(); | |
| 247 | - | |
| 248 | - unset($rss); | |
| 249 | - | |
| 250 | - } | |
| 50 | + | |
| 51 | + $urls = stripslashes($instance['urls']); | |
| 52 | + $count = intval($instance['count']); | |
| 53 | + $show_date = intval($instance['show_date']); | |
| 54 | + $show_desc = intval($instance['show_desc']); | |
| 55 | + $show_author = intval($instance['show_author']); | |
| 56 | + $show_thumb = stripslashes($instance['show_thumb']); | |
| 57 | + $open_newtab = intval($instance['open_newtab']); | |
| 58 | + $strip_desc = intval($instance['strip_desc']); | |
| 59 | + $strip_title = intval($instance['strip_title']); | |
| 60 | + $read_more = htmlspecialchars($instance['read_more']); | |
| 61 | + $color_style = stripslashes($instance['color_style']); | |
| 62 | + $enable_ticker = intval($instance['enable_ticker']); | |
| 63 | + $visible_items = intval($instance['visible_items']); | |
| 64 | + $ticker_speed = intval($instance['ticker_speed']) * 1000; | |
| 65 | + | |
| 66 | + if(empty($urls)){ | |
| 67 | + return ''; | |
| 68 | + } | |
| 69 | + | |
| 70 | + $rand = array(); | |
| 71 | + $url = explode(',', $urls); | |
| 72 | + $ucount = count($url); | |
| 73 | + | |
| 74 | + // Generate the Tabs | |
| 75 | + if($ucount > 1){ | |
| 76 | + echo '<ul class="srr-tab-wrap srr-tab-style-' . $color_style . ' srr-clearfix">'; | |
| 77 | + for($i=0; $i<$ucount; $i++){ | |
| 78 | + // Get the Feed URL | |
| 79 | + $feedUrl = trim($url[$i]); | |
| 80 | + $rss = fetch_feed($feedUrl); | |
| 81 | + $rand[$i] = rand(0, 999); | |
| 82 | + | |
| 83 | + if (!is_wp_error($rss)){ | |
| 84 | + $rss_title = esc_attr(strip_tags($rss->get_title())); | |
| 85 | + echo '<li data-tab="srr-tab-' . $rand[$i] . '">' . $rss_title . '</li>'; | |
| 86 | + }else{ | |
| 87 | + echo '<li data-tab="srr-tab-' . $rand[$i] . '">Error</li>'; | |
| 88 | + } | |
| 89 | + | |
| 90 | + } | |
| 91 | + echo '</ul>'; | |
| 92 | + } | |
| 93 | + | |
| 94 | + for($i=0; $i<$ucount; $i++){ | |
| 95 | + // Get the Feed URL | |
| 96 | + $feedUrl = trim($url[$i]); | |
| 97 | + if(isset($url[$i])){ | |
| 98 | + $rss = fetch_feed($feedUrl); | |
| 99 | + }else{ | |
| 100 | + return ''; | |
| 101 | + } | |
| 102 | + | |
| 103 | + // Check for feed errors | |
| 104 | + if (!is_wp_error( $rss ) ){ | |
| 105 | + $maxitems = $rss->get_item_quantity($count); | |
| 106 | + $rss_items = $rss->get_items(0, $maxitems); | |
| 107 | + $rss_title = esc_attr(strip_tags($rss->get_title())); | |
| 108 | + $rss_desc = esc_attr(strip_tags($rss->get_description())); | |
| 109 | + }else{ | |
| 110 | + echo '<div class="srr-wrap srr-style-' . $color_style .'" data-id="srr-tab-' . $rand[$i] . '"><p>RSS Error: ' . $rss->get_error_message() . '</p></div>'; | |
| 111 | + continue; | |
| 112 | + } | |
| 113 | + | |
| 114 | + $randAttr = isset($rand[$i]) ? ' data-id="srr-tab-' . $rand[$i] . '" ' : ''; | |
| 115 | + | |
| 116 | + // Outer Wrap start | |
| 117 | + echo '<div class="srr-wrap ' . (($enable_ticker == 1 ) ? 'srr-vticker' : '' ) . ' srr-style-' . $color_style . '" data-visible="' . $visible_items . '" data-speed="' . $ticker_speed . '"' . $randAttr . '><div>'; | |
| 118 | + | |
| 119 | + // Check feed items | |
| 120 | + if ($maxitems == 0){ | |
| 121 | + echo '<div>No items.</div>'; | |
| 122 | + }else{ | |
| 123 | + $j=1; | |
| 124 | + // Loop through each feed item | |
| 125 | + foreach ($rss_items as $item){ | |
| 126 | + // Get the link | |
| 127 | + $link = $item->get_link(); | |
| 128 | + while ( stristr($link, 'http') != $link ){ $link = substr($link, 1); } | |
| 129 | + $link = esc_url(strip_tags($link)); | |
| 130 | + | |
| 131 | + // Get the item title | |
| 132 | + $title = esc_attr(strip_tags($item->get_title())); | |
| 133 | + if ( empty($title) ) | |
| 134 | + $title = __('No Title'); | |
| 135 | + | |
| 136 | + if($strip_title != 0){ | |
| 137 | + $titleLen = strlen($title); | |
| 138 | + $title = wp_html_excerpt( $title, $strip_title ); | |
| 139 | + $title = ($titleLen > $strip_title) ? $title . ' ...' : $title; | |
| 140 | + } | |
| 141 | + | |
| 142 | + // Get the date | |
| 143 | + $date = $item->get_date('j F Y'); | |
| 144 | + | |
| 145 | + // Get thumbnail if present @since v2.2 | |
| 146 | + $thumb = ''; | |
| 147 | + if ($show_thumb == 1 && $enclosure = $item->get_enclosure()){ | |
| 148 | + $thumburl = $enclosure->get_thumbnail(); | |
| 149 | + if(!empty($thumburl)) | |
| 150 | + $thumb = '<img src="' . $thumburl . '" alt="' . $title . '" class="srr-thumb" align="left"/>'; | |
| 151 | + } | |
| 152 | + | |
| 153 | + // Get the description | |
| 154 | + $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); | |
| 155 | + if($strip_desc != 0){ | |
| 156 | + $desc = wp_html_excerpt( $desc, $strip_desc ); | |
| 157 | + $rmore = (!empty($read_more)) ? '<a href="' . $link . '" title="Read more">' . $read_more . '</a>' : ''; | |
| 158 | + | |
| 159 | + if ( '[...]' == substr( $desc, -5 ) ) | |
| 160 | + $desc = substr( $desc, 0, -5 ); | |
| 161 | + elseif ( '[…]' != substr( $desc, -10 ) ) | |
| 162 | + $desc .= ''; | |
| 163 | + | |
| 164 | + $desc = esc_html( $desc ); | |
| 165 | + } | |
| 166 | + $desc = $thumb . $desc . ' ' . $rmore; | |
| 167 | + | |
| 168 | + // Get the author | |
| 169 | + $author = $item->get_author(); | |
| 170 | + if ( is_object($author) ) { | |
| 171 | + $author = $author->get_name(); | |
| 172 | + $author = esc_html(strip_tags($author)); | |
| 173 | + } | |
| 174 | + | |
| 175 | + // Open links in new tab | |
| 176 | + $newtab = ($open_newtab) ? ' target="_blank"' : ''; | |
| 177 | + | |
| 178 | + echo "\n\n\t"; | |
| 179 | + | |
| 180 | + // Display the feed items | |
| 181 | + echo '<div class="srr-item ' . (($j%2 == 0) ? 'even' : 'odd') . '">'; | |
| 182 | + echo '<div class="srr-title"><a href="' . $link . '"' . $newtab . ' title="Posted on ' . $date . '">' . $title . '</a></div>'; | |
| 183 | + echo '<div class="srr-meta">'; | |
| 184 | + | |
| 185 | + if($show_date && !empty($date)) | |
| 186 | + echo '<time class="srr-date">' . $date . '</time>'; | |
| 187 | + | |
| 188 | + if($show_author && !empty($author)) | |
| 189 | + echo ' - <cite class="srr-author">' . $author . '</cite>'; | |
| 190 | + | |
| 191 | + echo '</div>'; | |
| 192 | + | |
| 193 | + if($show_desc) | |
| 194 | + echo '<p class="srr-summary srr-clearfix">' . $desc . '</p>'; | |
| 195 | + | |
| 196 | + echo '</div>'; | |
| 197 | + // End display | |
| 198 | + | |
| 199 | + $j++; | |
| 200 | + } | |
| 201 | + } | |
| 202 | + | |
| 203 | + // Outer wrap end | |
| 204 | + echo "\n\n</div> | |
| 205 | + </div> \n\n" ; | |
| 206 | + | |
| 207 | + } | |
| 251 | 208 | } |
| 252 | 209 | |
| 253 | 210 | class super_rss_reader_widget extends WP_Widget{ |
| 254 | - // Initialize | |
| 255 | - public function __construct(){ | |
| 256 | - $widget_ops = array( | |
| 257 | - 'classname' => 'widget_super_rss_reader', | |
| 258 | - 'description' => 'Enhanced RSS feed reader widget with advanced features.' | |
| 259 | - ); | |
| 260 | - | |
| 261 | - $control_ops = array('width' => 500, 'height' => 500); | |
| 262 | - parent::__construct('super_rss_reader', 'Super RSS Reader', $widget_ops, $control_ops); | |
| 263 | - } | |
| 264 | - | |
| 265 | - // Display the Widget | |
| 266 | - public function widget($args, $instance){ | |
| 267 | - extract($args); | |
| 268 | - if(empty($instance['title'])){ | |
| 269 | - $title = ''; | |
| 270 | - }else{ | |
| 271 | - $title = $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; | |
| 272 | - } | |
| 273 | - | |
| 274 | - echo $before_widget . $title; | |
| 275 | - echo "\n" . ' | |
| 276 | - <!-- Start - Super RSS Reader v' . SRR_VERSION . '--> | |
| 277 | - <div class="super-rss-reader-widget">' . "\n"; | |
| 278 | - | |
| 279 | - srr_rss_parser($instance); | |
| 280 | - | |
| 281 | - echo "\n" . '</div> | |
| 282 | - <!-- End - Super RSS Reader --> | |
| 283 | - ' . "\n"; | |
| 284 | - echo $after_widget; | |
| 285 | - } | |
| 286 | - | |
| 287 | - // Save settings | |
| 288 | - public function update($new_instance, $old_instance){ | |
| 289 | - $instance = $old_instance; | |
| 290 | - $instance['title'] = stripslashes($new_instance['title']); | |
| 291 | - $instance['urls'] = stripslashes($new_instance['urls']); | |
| 292 | - $instance['tab_titles'] = stripslashes($new_instance['tab_titles']); | |
| 293 | - | |
| 294 | - $instance['count'] = intval($new_instance['count']); | |
| 295 | - $instance['show_date'] = intval($new_instance['show_date']); | |
| 296 | - $instance['show_desc'] = intval($new_instance['show_desc']); | |
| 297 | - $instance['show_author'] = intval($new_instance['show_author']); | |
| 298 | - $instance['show_thumb'] = stripslashes($new_instance['show_thumb']); | |
| 299 | - $instance['open_newtab'] = intval($new_instance['open_newtab']); | |
| 300 | - $instance['add_nofollow'] = intval($new_instance['add_nofollow']); | |
| 301 | - $instance['strip_desc'] = intval($new_instance['strip_desc']); | |
| 302 | - $instance['strip_title'] = intval($new_instance['strip_title']); | |
| 303 | - $instance['read_more'] = stripslashes($new_instance['read_more']); | |
| 304 | - $instance['rich_desc'] = stripslashes($new_instance['rich_desc']); | |
| 305 | - | |
| 306 | - $instance['color_style'] = stripslashes($new_instance['color_style']); | |
| 307 | - $instance['enable_ticker'] = intval($new_instance['enable_ticker']); | |
| 308 | - $instance['visible_items'] = intval($new_instance['visible_items']); | |
| 309 | - $instance['ticker_speed'] = intval($new_instance['ticker_speed']); | |
| 310 | - | |
| 311 | - return $instance; | |
| 312 | - } | |
| 313 | - | |
| 314 | - // Widget form | |
| 315 | - public function form($instance){ | |
| 316 | - | |
| 317 | - $instance = wp_parse_args((array) $instance, srr_defaults()); | |
| 318 | - | |
| 319 | - $title = htmlspecialchars($instance['title']); | |
| 320 | - $urls = htmlspecialchars($instance['urls']); | |
| 321 | - $tab_titles = htmlspecialchars($instance['tab_titles']); | |
| 322 | - | |
| 323 | - $count = intval($instance['count']); | |
| 324 | - $show_date = intval($instance['show_date']); | |
| 325 | - $show_desc = intval($instance['show_desc']); | |
| 326 | - $show_author = intval($instance['show_author']); | |
| 327 | - $show_thumb = intval($instance['show_thumb']); | |
| 328 | - $open_newtab = intval($instance['open_newtab']); | |
| 329 | - $add_nofollow = intval($instance['add_nofollow']); | |
| 330 | - $strip_desc = intval($instance['strip_desc']); | |
| 331 | - $strip_title = intval($instance['strip_title']); | |
| 332 | - $read_more = htmlspecialchars($instance['read_more']); | |
| 333 | - $rich_desc = htmlspecialchars($instance['rich_desc']); | |
| 334 | - | |
| 335 | - $color_style = stripslashes($instance['color_style']); | |
| 336 | - $enable_ticker = intval($instance['enable_ticker']); | |
| 337 | - $visible_items = intval($instance['visible_items']); | |
| 338 | - $ticker_speed = intval($instance['ticker_speed']); | |
| 339 | - | |
| 340 | - ?> | |
| 341 | - <div class="srr_settings"> | |
| 342 | - <table width="100%" height="72" border="0"> | |
| 343 | - <tr> | |
| 344 | - <td width="13%" height="33"><label for="<?php echo $this->get_field_id('title'); ?>">Title: </label></td> | |
| 345 | - <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> | |
| 346 | - </tr> | |
| 347 | - <tr> | |
| 348 | - <td><label for="<?php echo $this->get_field_id('urls'); ?>">URLs: </label></td> | |
| 349 | - <td><input id="<?php echo $this->get_field_id('urls');?>" name="<?php echo $this->get_field_name('urls'); ?>" type="text" value="<?php echo $urls; ?>" class="widefat"/> | |
| 350 | - <small class="srr_smalltext">Can enter multiple RSS/atom feed URLs seperated by a comma.</small> | |
| 351 | - </td> | |
| 352 | - </tr> | |
| 353 | - | |
| 354 | - <tr> | |
| 355 | - <td><label for="<?php echo $this->get_field_id('tab_titles'); ?>">Tab titles: </label></td> | |
| 356 | - <td><input id="<?php echo $this->get_field_id('tab_titles');?>" name="<?php echo $this->get_field_name('tab_titles'); ?>" type="text" value="<?php echo $tab_titles; ?>" class="widefat"/> | |
| 357 | - <small class="srr_smalltext">Enter corresponding tab titles seperated by a comma.</small> | |
| 358 | - </td> | |
| 359 | - </tr> | |
| 360 | - | |
| 361 | - </table> | |
| 362 | - </div> | |
| 363 | - | |
| 364 | - <div class="srr_settings"> | |
| 365 | - <h4>Settings</h4> | |
| 366 | - <table width="100%" border="0"> | |
| 367 | - <tr> | |
| 368 | - <td width="7%" height="28"><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> | |
| 369 | - <td width="40%"><label for="<?php echo $this->get_field_id('show_desc'); ?>">Show Description</label></td> | |
| 370 | - <td width="28%"><label for="<?php echo $this->get_field_id('count');?>">Total items to show:</label></td> | |
| 371 | - <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> | |
| 372 | - </tr> | |
| 373 | - <tr> | |
| 374 | - <td height="32"><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> | |
| 375 | - <td><label for="<?php echo $this->get_field_id('show_date'); ?>">Show Date</label></td> | |
| 376 | - <td><label for="<?php echo $this->get_field_id('strip_desc');?>">Strip description characters:</label></td> | |
| 377 | - <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> | |
| 378 | - </tr> | |
| 379 | - <tr> | |
| 380 | - <td height="29"><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> | |
| 381 | - <td><label for="<?php echo $this->get_field_id('show_author'); ?>">Show Author</label></td> | |
| 382 | - <td><label for="<?php echo $this->get_field_id('strip_title'); ?>">Strip title characters:</label></td> | |
| 383 | - <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> | |
| 384 | - </tr> | |
| 385 | - <tr> | |
| 386 | - <td height="29"><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> | |
| 387 | - <td><label for="<?php echo $this->get_field_id('open_newtab'); ?>">Open links in new tab</label></td> | |
| 388 | - <td><label for="<?php echo $this->get_field_id('read_more'); ?>">Read more text:</label></td> | |
| 389 | - <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> | |
| 390 | - </tr> | |
| 391 | - <tr> | |
| 392 | - <td height="29"><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> | |
| 393 | - <td><label for="<?php echo $this->get_field_id('show_thumb'); ?>">Show thumbnail if present</label></td> | |
| 394 | - <td> </td> | |
| 395 | - <td> </td> | |
| 396 | - </tr> | |
| 397 | - | |
| 398 | - <tr> | |
| 399 | - <td height="29"><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> | |
| 400 | - <td><label for="<?php echo $this->get_field_id('rich_desc'); ?>">Enable full or rich description</label></td> | |
| 401 | - <td> </td> | |
| 402 | - <td> </td> | |
| 403 | - </tr> | |
| 404 | - | |
| 405 | - <tr> | |
| 406 | - <td height="29"><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> | |
| 407 | - <td><label for="<?php echo $this->get_field_id('add_nofollow'); ?>">Add "no follow" attribute to links</label></td> | |
| 408 | - <td> </td> | |
| 409 | - <td> </td> | |
| 410 | - </tr> | |
| 411 | - | |
| 412 | - </table> | |
| 413 | - </div> | |
| 414 | - | |
| 415 | - <?php if( $rich_desc == 1 ): ?> | |
| 416 | - <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 aligment issues in the description, please use custom CSS to fix that. </span> | |
| 417 | - <?php endif; ?> | |
| 418 | - | |
| 419 | - <div class="srr_settings"> | |
| 420 | - <h4>Other settings</h4> | |
| 421 | - <table width="100%" height="109" border="0"> | |
| 422 | - <tr> | |
| 423 | - <td height="32"><label for="<?php echo $this->get_field_id('color_style');?>">Color style: </label></td> | |
| 424 | - <td> | |
| 425 | - <?php | |
| 426 | - $color_styles = srr_color_styles(); | |
| 427 | - echo '<select name="' . $this->get_field_name('color_style') . '" id="' . $this->get_field_id('color_style') . '">'; | |
| 428 | - foreach($color_styles as $k => $v){ | |
| 429 | - echo '<option value="' . $v . '" ' . ($color_style == $v ? 'selected="selected"' : "") . '>' . $k . '</option>'; | |
| 430 | - } | |
| 431 | - echo '</select>'; | |
| 432 | - ?> | |
| 433 | - </td> | |
| 434 | - </tr> | |
| 435 | - <tr> | |
| 436 | - <td height="36"><label for="<?php echo $this->get_field_id('visible_items');?>">Widget height:</label></td> | |
| 437 | - <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/> | |
| 438 | - <small>Set value less than 20 to show visible feed items. Example: <b>5</b> items</small></br> | |
| 439 | - <small>Set value greater than 20 for fixed widget height. Example: <b>400</b> px</small></br> | |
| 440 | - </td> | |
| 441 | - </tr> | |
| 442 | - <tr> | |
| 443 | - <td height="33"><label for="<?php echo $this->get_field_id('enable_ticker'); ?>">Ticker animation:</label> </td> | |
| 444 | - <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> | |
| 445 | - </tr> | |
| 446 | - <tr> | |
| 447 | - <td height="36"><label for="<?php echo $this->get_field_id('ticker_speed');?>">Ticker speed: </label></td> | |
| 448 | - <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 | |
| 449 | - </td> | |
| 450 | - </tr> | |
| 451 | - </table> | |
| 452 | - </div> | |
| 453 | - | |
| 454 | - <div class="srr_coffee"> | |
| 455 | - <p>Thank you for using Super RSS Reader. If you found it useful, please buy me a coffee !</p> | |
| 456 | - <div class="srr_coffee_wrap"> | |
| 457 | - <select class="srr_coffee_amt"> | |
| 458 | - <option value="2">$2</option> | |
| 459 | - <option value="3">$3</option> | |
| 460 | - <option value="4">$4</option> | |
| 461 | - <option value="5">$5</option> | |
| 462 | - <option value="6" selected="selected">$6</option> | |
| 463 | - <option value="7">$7</option> | |
| 464 | - <option value="8">$8</option> | |
| 465 | - <option value="9">$9</option> | |
| 466 | - <option value="10">$10</option> | |
| 467 | - <option value="11">$11</option> | |
| 468 | - <option value="12">$12</option> | |
| 469 | - <option value="">Custom</option> | |
| 470 | - </select> | |
| 471 | - <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> | |
| 472 | - </div> | |
| 473 | - </div> | |
| 474 | - | |
| 475 | - <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> | |
| 476 | - | |
| 477 | - <?php | |
| 478 | - } | |
| 211 | + ## Initialize | |
| 212 | + function super_rss_reader_widget(){ | |
| 213 | + $widget_ops = array( | |
| 214 | + 'classname' => 'widget_super_rss_reader', | |
| 215 | + 'description' => "Enhanced RSS feed reader widget with advanced features." | |
| 216 | + ); | |
| 217 | + | |
| 218 | + $control_ops = array('width' => 430, 'height' => 500); | |
| 219 | + parent::WP_Widget('super_rss_reader', 'Super RSS Reader', $widget_ops, $control_ops); | |
| 220 | + } | |
| 221 | + | |
| 222 | + ## Display the Widget | |
| 223 | + function widget($args, $instance){ | |
| 224 | + extract($args); | |
| 225 | + if(empty($instance['title'])){ | |
| 226 | + $title = ''; | |
| 227 | + }else{ | |
| 228 | + $title = $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; | |
| 229 | + } | |
| 230 | + | |
| 231 | + echo $before_widget . $title; | |
| 232 | + echo "\n" . ' | |
| 233 | + <!-- Start - Super RSS Reader v' . SRR_VERSION . '--> | |
| 234 | + <div class="super-rss-reader-widget">' . "\n"; | |
| 235 | + | |
| 236 | + srr_rss_parser($instance); | |
| 237 | + | |
| 238 | + echo "\n" . '</div> | |
| 239 | + <!-- End - Super RSS Reader --> | |
| 240 | + ' . "\n"; | |
| 241 | + echo $after_widget; | |
| 242 | + } | |
| 243 | + | |
| 244 | + ## Save settings | |
| 245 | + function update($new_instance, $old_instance){ | |
| 246 | + $instance = $old_instance; | |
| 247 | + $instance['title'] = stripslashes($new_instance['title']); | |
| 248 | + $instance['urls'] = stripslashes($new_instance['urls']); | |
| 249 | + | |
| 250 | + $instance['count'] = intval($new_instance['count']); | |
| 251 | + $instance['show_date'] = intval($new_instance['show_date']); | |
| 252 | + $instance['show_desc'] = intval($new_instance['show_desc']); | |
| 253 | + $instance['show_author'] = intval($new_instance['show_author']); | |
| 254 | + $instance['show_thumb'] = stripslashes($new_instance['show_thumb']); | |
| 255 | + $instance['open_newtab'] = intval($new_instance['open_newtab']); | |
| 256 | + $instance['strip_desc'] = intval($new_instance['strip_desc']); | |
| 257 | + $instance['strip_title'] = intval($new_instance['strip_title']); | |
| 258 | + $instance['read_more'] = stripslashes($new_instance['read_more']); | |
| 259 | + | |
| 260 | + $instance['color_style'] = stripslashes($new_instance['color_style']); | |
| 261 | + $instance['enable_ticker'] = intval($new_instance['enable_ticker']); | |
| 262 | + $instance['visible_items'] = intval($new_instance['visible_items']); | |
| 263 | + $instance['ticker_speed'] = intval($new_instance['ticker_speed']); | |
| 264 | + | |
| 265 | + return $instance; | |
| 266 | + } | |
| 267 | + | |
| 268 | + ## HJA Widget form | |
| 269 | + function form($instance){ | |
| 270 | + global $srr_color_styles; | |
| 271 | + | |
| 272 | + $instance = wp_parse_args( (array) $instance, array( | |
| 273 | + 'title' => '', 'urls' => '', 'count' => 5, | |
| 274 | + 'show_date' => 0, 'show_desc' => 1, 'show_author' => 0, 'show_thumb' => 1, | |
| 275 | + 'open_newtab' => 1, 'strip_desc' => 100, 'read_more' => '[...]', | |
| 276 | + 'color_style' => 'none', 'enable_ticker' => 1, 'visible_items' => 5, | |
| 277 | + 'strip_title' => 0, 'ticker_speed' => 2, | |
| 278 | + )); | |
| 279 | + | |
| 280 | + $title = htmlspecialchars($instance['title']); | |
| 281 | + $urls = htmlspecialchars($instance['urls']); | |
| 282 | + | |
| 283 | + $count = intval($instance['count']); | |
| 284 | + $show_date = intval($instance['show_date']); | |
| 285 | + $show_desc = intval($instance['show_desc']); | |
| 286 | + $show_author = intval($instance['show_author']); | |
| 287 | + $show_thumb = intval($instance['show_thumb']); | |
| 288 | + $open_newtab = intval($instance['open_newtab']); | |
| 289 | + $strip_desc = intval($instance['strip_desc']); | |
| 290 | + $strip_title = intval($instance['strip_title']); | |
| 291 | + $read_more = htmlspecialchars($instance['read_more']); | |
| 292 | + | |
| 293 | + $color_style = stripslashes($instance['color_style']); | |
| 294 | + $enable_ticker = intval($instance['enable_ticker']); | |
| 295 | + $visible_items = intval($instance['visible_items']); | |
| 296 | + $ticker_speed = intval($instance['ticker_speed']); | |
| 297 | + | |
| 298 | + ?> | |
| 299 | + <div class="srr_settings"> | |
| 300 | + <table width="100%" height="72" border="0"> | |
| 301 | + <tr> | |
| 302 | + <td width="13%" height="33"><label for="<?php echo $this->get_field_id('title'); ?>">Title: </label></td> | |
| 303 | + <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> | |
| 304 | + </tr> | |
| 305 | + <tr> | |
| 306 | + <td><label for="<?php echo $this->get_field_id('urls'); ?>">URLs: </label></td> | |
| 307 | + <td><input id="<?php echo $this->get_field_id('urls');?>" name="<?php echo $this->get_field_name('urls'); ?>" type="text" value="<?php echo $urls; ?>" class="widefat"/> | |
| 308 | + <small class="srr_smalltext">Can enter multiple RSS/atom feed URLs seperated by a comma.</small> | |
| 309 | + </td> | |
| 310 | + </tr> | |
| 311 | + </table> | |
| 312 | + </div> | |
| 313 | + | |
| 314 | + <div class="srr_settings"> | |
| 315 | + <h4>Settings</h4> | |
| 316 | + <table width="100%" border="0"> | |
| 317 | + <tr> | |
| 318 | + <td width="7%" height="28"><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> | |
| 319 | + <td width="40%"><label for="<?php echo $this->get_field_id('show_desc'); ?>">Show Description</label></td> | |
| 320 | + <td width="28%"><label for="<?php echo $this->get_field_id('count');?>">Count</label></td> | |
| 321 | + <td width="25%"><input id="<?php echo $this->get_field_id('count');?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo $count; ?>" class="widefat" title="No of feed items to parse"/></td> | |
| 322 | + </tr> | |
| 323 | + <tr> | |
| 324 | + <td height="32"><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> | |
| 325 | + <td><label for="<?php echo $this->get_field_id('show_date'); ?>">Show Date</label></td> | |
| 326 | + <td><label for="<?php echo $this->get_field_id('strip_desc');?>">Strip description</label></td> | |
| 327 | + <td><input id="<?php echo $this->get_field_id('strip_desc');?>" name="<?php echo $this->get_field_name('strip_desc'); ?>" type="text" value="<?php echo $strip_desc; ?>" class="widefat" title="The number of charaters to be displayed. Use 0 to disable stripping"/> </td> | |
| 328 | + </tr> | |
| 329 | + <tr> | |
| 330 | + <td height="29"><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> | |
| 331 | + <td><label for="<?php echo $this->get_field_id('show_author'); ?>">Show Author</label></td> | |
| 332 | + <td><label for="<?php echo $this->get_field_id('read_more'); ?>">Read more text</label></td> | |
| 333 | + <td><input id="<?php echo $this->get_field_name('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> | |
| 334 | + </tr> | |
| 335 | + <tr> | |
| 336 | + <td height="29"><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> | |
| 337 | + <td><label for="<?php echo $this->get_field_id('open_newtab'); ?>">Open links in new tab</label></td> | |
| 338 | + <td><label for="<?php echo $this->get_field_id('strip_title'); ?>">Strip Title</label></td> | |
| 339 | + <td><input id="<?php echo $this->get_field_id('strip_title');?>" name="<?php echo $this->get_field_name('strip_title'); ?>" type="text" value="<?php echo $strip_title; ?>" class="widefat" title="The number of charaters to be displayed. Use 0 to disable stripping"/></td> | |
| 340 | + </tr> | |
| 341 | + <tr> | |
| 342 | + <td height="29"><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> | |
| 343 | + <td><label for="<?php echo $this->get_field_id('show_thumb'); ?>">Show thumbnail if present</label></td> | |
| 344 | + <td> </td> | |
| 345 | + <td> </td> | |
| 346 | + </tr> | |
| 347 | + </table> | |
| 348 | + </div> | |
| 349 | + | |
| 350 | + <div class="srr_settings"> | |
| 351 | + <h4>Other settings</h4> | |
| 352 | + <table width="100%" height="109" border="0"> | |
| 353 | + <tr> | |
| 354 | + <td height="32"><label>Color style: </label></td> | |
| 355 | + <td> | |
| 356 | + <?php | |
| 357 | + echo '<select name="' . $this->get_field_name('color_style') . '" id="' . $this->get_field_id('color_style') . '">'; | |
| 358 | + foreach($srr_color_styles as $k => $v){ | |
| 359 | + echo '<option value="' . $v . '" ' . ($color_style == $v ? 'selected="selected"' : "") . '>' . $k . '</option>'; | |
| 360 | + } | |
| 361 | + echo '</select>'; | |
| 362 | + ?> | |
| 363 | + </td> | |
| 364 | + </tr> | |
| 365 | + <tr> | |
| 366 | + <td height="33"><label for="<?php echo $this->get_field_id('enable_ticker'); ?>">Ticker animation:</label> </td> | |
| 367 | + <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> | |
| 368 | + </tr> | |
| 369 | + <tr> | |
| 370 | + <td height="36"><label for="<?php echo $this->get_field_id('visible_items');?>">Visible items: </label></td> | |
| 371 | + <td><input id="<?php echo $this->get_field_id('visible_items');?>" name="<?php echo $this->get_field_name('visible_items'); ?>" type="text" value="<?php echo $visible_items; ?>" class="widefat" title="The no of feed items to be visible."/> | |
| 372 | + </td> | |
| 373 | + </tr> | |
| 374 | + <tr> | |
| 375 | + <td height="36"><label for="<?php echo $this->get_field_id('ticker_speed');?>">Ticker speed: </label></td> | |
| 376 | + <td><input id="<?php echo $this->get_field_id('ticker_speed');?>" name="<?php echo $this->get_field_name('ticker_speed'); ?>" type="text" value="<?php echo $ticker_speed; ?>" title="Speed of the ticker in seconds"/> seconds | |
| 377 | + </td> | |
| 378 | + </tr> | |
| 379 | + </table> | |
| 380 | + </div> | |
| 381 | + | |
| 382 | + <div class="srr_support"> <a href="http://facebook.com/aakashweb" class="srr_fblike" target="_blank">Like</a> | <a href="http://bit.ly/srrDonate" target="_blank" style="color: #FF6600" title="If you like this plugin, then just make a small donation and it will be helpful for the plugin's development.">Donate</a> | <a href="http://www.aakashweb.com/wordpress-plugins/super-rss-reader/" target="_blank">Support</a></div> | |
| 383 | + <small>Please donate and share this plugin to show your support. Thank you :)</small> | |
| 384 | + | |
| 385 | + <?php | |
| 386 | + } | |
| 479 | 387 | } |
| 480 | 388 | |
| 481 | 389 | function super_rss_reader_init(){ |
| 482 | - register_widget('super_rss_reader_widget'); | |
| 390 | + register_widget('super_rss_reader_widget'); | |
| 483 | 391 | } |
| 484 | 392 | add_action('widgets_init', 'super_rss_reader_init'); |
| 485 | 393 | |
| 486 | - | |
| 487 | -function srr_admin_scripts( $hook ){ | |
| 488 | - if( $hook == 'widgets.php' ){ | |
| 489 | - wp_enqueue_style( 'srr_admin_css', SRR_URL . 'admin/css/style.css' ); | |
| 490 | - wp_enqueue_script( 'srr_admin_js', SRR_URL . 'admin/js/script.js' ); | |
| 491 | - } | |
| 394 | +function srr_widget_scripts(){ | |
| 395 | + if(in_array($GLOBALS['pagenow'], array('widgets.php'))){ | |
| 396 | + ?> | |
| 397 | + <style type="text/css"> | |
| 398 | + .srr_settings h4{ | |
| 399 | + border-bottom: 1px solid #DFDFDF; | |
| 400 | + margin: 20px -11px 10px -11px; | |
| 401 | + padding: 5px 11px 5px 11px; | |
| 402 | + border-top: 1px solid #DFDFDF; | |
| 403 | + background-color: #fff; | |
| 404 | + background-image: -ms-linear-gradient(top,#fff,#f9f9f9); | |
| 405 | + background-image: -moz-linear-gradient(top,#fff,#f9f9f9); | |
| 406 | + background-image: -o-linear-gradient(top,#fff,#f9f9f9); | |
| 407 | + background-image: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#f9f9f9)); | |
| 408 | + background-image: -webkit-linear-gradient(top,#fff,#f9f9f9); | |
| 409 | + background-image: linear-gradient(top,#fff,#f9f9f9); | |
| 410 | + } | |
| 411 | + .srr_support{ | |
| 412 | + border: 1px solid #DFDFDF; | |
| 413 | + padding: 5px 13px; | |
| 414 | + background: #F9F9F9; | |
| 415 | + text-decoration:none; | |
| 416 | + margin: 10px -13px; | |
| 417 | + } | |
| 418 | + .srr_support a{ | |
| 419 | + text-decoration: none; | |
| 420 | + } | |
| 421 | + .srr_support a:hover{ | |
| 422 | + text-decoration: underline; | |
| 423 | + } | |
| 424 | + .srr_smalltext{ | |
| 425 | + font-size: 11px; | |
| 426 | + color: #666666; | |
| 427 | + } | |
| 428 | + .srr_support{ | |
| 429 | + border: 1px solid #DFDFDF; | |
| 430 | + padding: 5px 13px; | |
| 431 | + background: #F9F9F9; | |
| 432 | + text-decoration:none; | |
| 433 | + margin: 10px -13px; | |
| 434 | + } | |
| 435 | + .srr_support a{ | |
| 436 | + text-decoration: none; | |
| 437 | + } | |
| 438 | + .srr_support a:hover{ | |
| 439 | + text-decoration: underline; | |
| 440 | + } | |
| 441 | + .srr_fblike{ | |
| 442 | + background: url('<?php echo SRR_URL; ?>images/like-button.png') no-repeat; | |
| 443 | + padding-left: 19px; | |
| 444 | + } | |
| 445 | + .srr_fblike span{ | |
| 446 | + display: none; | |
| 447 | + } | |
| 448 | + .srr_fblike:hover span{ | |
| 449 | + display: inline; | |
| 450 | + padding:10px; | |
| 451 | + margin: -15px 0px 0px -50px; | |
| 452 | + position:absolute; | |
| 453 | + background:#ffffff; | |
| 454 | + border:1px solid #cccccc; | |
| 455 | + -webkit-box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.09); | |
| 456 | + -moz-box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.09); | |
| 457 | + box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.09); | |
| 458 | + -moz-border-radius: 5px; | |
| 459 | + border-radius: 5px; | |
| 460 | + } | |
| 461 | + </style> | |
| 462 | + | |
| 463 | + <script type="text/javascript"> | |
| 464 | + jQuery(document).ready(function(){ | |
| 465 | + var social = '<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Faakashweb&send=false&layout=button_count&width=75&show_faces=true&action=like&colorscheme=light&font&height=21&appId=106994469342299" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:75px; height:21px;" allowTransparency="true"></iframe>'; | |
| 466 | + | |
| 467 | + jQuery('.srr_fblike').live('mouseenter', function(){ | |
| 468 | + if(jQuery('.srr_fblike span').length == 0) | |
| 469 | + jQuery(this).prepend('<span>' + social + '</span>'); | |
| 470 | + }); | |
| 471 | + | |
| 472 | + }); | |
| 473 | + </script> | |
| 474 | + | |
| 475 | + <?php | |
| 476 | + } | |
| 492 | 477 | } |
| 493 | -add_action( 'admin_enqueue_scripts', 'srr_admin_scripts' ); | |
| 478 | +add_action('admin_footer', 'srr_widget_scripts'); | |
| 494 | 479 | |
| 495 | 480 | ?> |