WP RSS Aggregator - Version 2.2.1

Version Description

Download this release

Release Info

Developer jeangalea
Plugin Icon 128x128 WP RSS Aggregator
Version 2.2.1
Comparing to
See all releases

Version 2.2.1

changelog.txt ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2.2.1 (2012-10-17)
2
+ Fixed bug: wprss_feed_source_order assumes everyone is an admin
3
+
4
+ 2.2 (2012-10-01)
5
+ Italian translation added
6
+ Feed source order changed to alphabetical
7
+ Fixed bug - repeated entries when having a non-valid feed source
8
+ Fixed bug - all imported feeds deleted upon trashing a single feed source
9
+
10
+ 2.1 (2012-09-27)
11
+ Now localised for translations
12
+ Fixed bug with date string
13
+ Fixed $link_before and $link_after, now working
14
+ Added backwards compatibility for wp_rss_aggregator() function
15
+
16
+ 2.0 (2012-09-21)
17
+ Bulk of code rewritten and refactored
18
+ Added install and upgrade functions
19
+ Added DB version setting
20
+ Feed sources now stored as Custom Post Types
21
+ Feed source list sortable ascending or descending by name
22
+ Removed days subsections in feed display
23
+ Ability to limit total number of feeds displayed
24
+ Feeds now fetched via Cron
25
+ Cron job to delete old feed items, keeps max of 50 items in DB
26
+ Now requires WordPress 3.2
27
+ updated colorbox to v1.3.20.1
28
+ Limit of 15 items max imported for each source
29
+ Fixed issue of page content displaying incorrectly after feeds
30
+
31
+ 1.1 (2012-08-13)
32
+ Now requires WordPress 3.0
33
+ More flexible fetching of images directory
34
+ Has its own top level menu item
35
+ Added settings section
36
+ Ability to open in lightbox, new window or default browser behaviour
37
+ Ability to set links as follow or no follow
38
+ Using constants for oftenly used locations
39
+ Code refactoring
40
+ Changes in file and folder structure
41
+
42
+ 1.0 (2012-01-06)
43
+ First release
css/colorbox.css ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ColorBox Core Style:
3
+ The following CSS is consistent between example themes and should not be altered.
4
+ */
5
+ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
6
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
7
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8
+ #cboxContent{position:relative;}
9
+ #cboxLoadedContent{overflow:auto;}
10
+ #cboxTitle{margin:0;}
11
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
12
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13
+ .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
14
+ .cboxIframe{width:100%; height:100%; display:block; border:0;}
15
+ #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box;}
16
+
17
+ /*
18
+ User Style:
19
+ Change the following styles to modify the appearance of ColorBox. They are
20
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
21
+ */
22
+ #cboxOverlay{background:url(../img/colorbox/overlay.png) repeat 0 0;}
23
+ #colorbox{}
24
+ #cboxTopLeft{width:21px; height:21px; background:url(../img/colorbox/controls.png) no-repeat -101px 0;}
25
+ #cboxTopRight{width:21px; height:21px; background:url(../img/colorbox/controls.png) no-repeat -130px 0;}
26
+ #cboxBottomLeft{width:21px; height:21px; background:url(../img/colorbox/controls.png) no-repeat -101px -29px;}
27
+ #cboxBottomRight{width:21px; height:21px; background:url(../img/colorbox/controls.png) no-repeat -130px -29px;}
28
+ #cboxMiddleLeft{width:21px; background:url(../img/colorbox/controls.png) left top repeat-y;}
29
+ #cboxMiddleRight{width:21px; background:url(../img/colorbox/controls.png) right top repeat-y;}
30
+ #cboxTopCenter{height:21px; background:url(../img/colorbox/border.png) 0 0 repeat-x;}
31
+ #cboxBottomCenter{height:21px; background:url(../img/colorbox/border.png) 0 -29px repeat-x;}
32
+ #cboxContent{background:#fff; overflow:hidden;}
33
+ .cboxIframe{background:#fff;}
34
+ #cboxError{padding:50px; border:1px solid #ccc;}
35
+ #cboxLoadedContent{margin-bottom:28px;}
36
+ #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
37
+ #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
38
+ #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
39
+ #cboxPrevious{position:absolute; bottom:0; left:0; background:url(../img/colorbox/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
40
+ #cboxPrevious:hover{background-position:-75px -25px;}
41
+ #cboxNext{position:absolute; bottom:0; left:27px; background:url(../img/colorbox/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
42
+ #cboxNext:hover{background-position:-50px -25px;}
43
+ #cboxLoadingOverlay{background:url(../img/colorbox/loading_background.png) no-repeat center center;}
44
+ #cboxLoadingGraphic{background:url(../img/colorbox/loading.gif) no-repeat center center;}
45
+ #cboxClose{position:absolute; bottom:0; right:0; background:url(../img/colorbox/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
46
+ #cboxClose:hover{background-position:-25px -25px;}
47
+
48
+ /*
49
+ The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
50
+ when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
51
+ See: http://jacklmoore.com/notes/ie-transparency-problems/
52
+ */
53
+ .cboxIE #cboxTopLeft,
54
+ .cboxIE #cboxTopCenter,
55
+ .cboxIE #cboxTopRight,
56
+ .cboxIE #cboxBottomLeft,
57
+ .cboxIE #cboxBottomCenter,
58
+ .cboxIE #cboxBottomRight,
59
+ .cboxIE #cboxMiddleLeft,
60
+ .cboxIE #cboxMiddleRight {
61
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
62
+ }
css/styles.css ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wprss-input {
2
+ background: none repeat scroll 0 0 #EAF2FA;
3
+ margin-bottom: 20px;
4
+ padding-bottom: 10px;
5
+ padding-left: 10px;
6
+ padding-top: 10px;
7
+ width: 600px;
8
+ }
9
+
10
+ .wprss-input p { line-height: 28px; }
11
+
12
+ .wprss-input label {
13
+ float: left;
14
+ width: 95px !important;
15
+ }
16
+
17
+ .wprss-input input {
18
+ height: 28px;
19
+ margin-bottom: 0;
20
+ padding: 0 0 0 5px;
21
+ width: 400px;
22
+ }
23
+
24
+ #icon-wprss-aggregator {
25
+ background: transparent url( '../img/icon-adminpage32.png' ) no-repeat !important;
26
+ }
27
+
28
+ body.post-type-wprss_feed #titlediv div.inside { display: none !important; }
29
+
30
+ #misc-publishing-actions,
31
+ #minor-publishing-actions { display: none; }
32
+
33
+ #custom_meta_box .form-table th { width: 100px; }
34
+
35
+ body.post-type-wprss_feed_item .add-new-h2,
36
+ body.post-type-wprss_feed_item .tablenav select[name="m"],
37
+ body.post-type-wprss_feed_item #post-query-submit
38
+ { display: none; }
39
+
40
+ body.post-type-wprss_feed_item a.row-title {
41
+ cursor: default;
42
+ font-weight: normal;
43
+ color: #555;
44
+ }
45
+
46
+ #latest-news-cpac-settings li {
47
+ list-style: none;
48
+ line-height: 16px;
49
+ }
50
+
51
+ li.twitter a {
52
+ background: transparent url('../img/twitter.png') no-repeat 0;
53
+ padding-left: 20px;
54
+ }
55
+
56
+ li.facebook a {
57
+ background: transparent url('../img/facebook.png') no-repeat 0;
58
+ padding-left: 20px;
59
+ }
60
+
61
+ li.donate_link a:hover {
62
+ color: darkGreen;
63
+ }
64
+
65
+ /*.rss-aggregator_page_wprss-aggregator-settings .form-table th { width: 80px; }*/
img/colorbox/border.png ADDED
Binary file
img/colorbox/controls.png ADDED
Binary file
img/colorbox/loading.gif ADDED
Binary file
img/colorbox/loading_background.png ADDED
Binary file
img/colorbox/overlay.png ADDED
Binary file
img/facebook.png ADDED
Binary file
img/icon-adminmenu16-sprite.png ADDED
Binary file
img/icon-adminpage32.png ADDED
Binary file
img/twitter.png ADDED
Binary file
inc/activation.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin activation procedure
4
+ *
5
+ * @since 1.0
6
+ */
7
+ function wprss_activate() {
8
+ // Activates the plugin and checks for compatible version of WordPress
9
+ if ( version_compare( get_bloginfo( 'version' ), '3.2', '<' ) ) {
10
+ deactivate_plugins ( basename( __FILE__ )); // Deactivate plugin
11
+ wp_die( __('This plugin requires WordPress version 3.2 or higher.') );
12
+ }
13
+ wprss_schedule_fetch_feeds_cron();
14
+ }
inc/admin-options.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin administration related functions
4
+ *
5
+ * Note: Wording of options and settings is confusing, due to the plugin originally only having
6
+ * an 'options' page to enter feed sources, and now needing two screens, one for feed sources and one for
7
+ * general settings. Might implement something cleaner in the future.
8
+ *
9
+ * @package WPRSSAggregator
10
+ */
11
+
12
+
13
+ /**
14
+ * Custom Post Type Icon for Admin Menu & Post Screen
15
+ * @since 2.0
16
+ */
17
+ add_action( 'admin_head', 'wprss_custom_post_type_icon' );
18
+
19
+ function wprss_custom_post_type_icon() {
20
+ ?>
21
+ <style>
22
+ /* Post Screen - 32px */
23
+ .icon32-posts-wprss_feed {
24
+ background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
25
+ }
26
+ /* Post Screen - 32px */
27
+ .icon32-posts-wprss_feed_item {
28
+ background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
29
+ }
30
+ </style>
31
+ <?php }
32
+
33
+
34
+ /**
35
+ * Register menu and submenus
36
+ * @since 2.0
37
+ */
38
+
39
+ // Add the admin options pages as submenus to the Feed CPT
40
+ add_action( 'admin_menu', 'wprss_register_menu_pages' );
41
+
42
+ function wprss_register_menu_pages() {
43
+
44
+ //create submenu items
45
+ add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'WP RSS Aggregator Settings', 'wprss' ), __( 'Settings', 'wprss' ), 'manage_options', 'wprss-aggregator-settings', 'wprss_settings_page' );
46
+ }
47
+
48
+
49
+ /**
50
+ * Register and define options and settings
51
+ * @since 2.0
52
+ * @todo add option for cron frequency
53
+ */
54
+
55
+ add_action( 'admin_init', 'wprss_admin_init' );
56
+
57
+ function wprss_admin_init() {
58
+ register_setting( 'wprss_options', 'wprss_options' );
59
+ add_settings_section( 'wprss_main', '', 'wprss_section_text', 'wprss' );
60
+
61
+ register_setting( 'wprss_settings', 'wprss_settings' );
62
+
63
+
64
+ add_settings_section( 'wprss-settings-main', '', 'wprss_settings_section_text', 'wprss-aggregator-settings' );
65
+
66
+ add_settings_field( 'wprss-settings-open-dd', __( 'Open links behaviour', 'wprss' ),
67
+ 'wprss_setting_open_dd', 'wprss-aggregator-settings', 'wprss-settings-main');
68
+
69
+ add_settings_field( 'wprss-settings-follow-dd', __( 'Set links as', 'wprss' ),
70
+ 'wprss_setting_follow_dd', 'wprss-aggregator-settings', 'wprss-settings-main');
71
+
72
+ add_settings_field( 'wprss-settings-feed-limit', __( 'Feed limit', 'wprss' ),
73
+ 'wprss_setting_feed_limit', 'wprss-aggregator-settings', 'wprss-settings-main');
74
+
75
+ }
76
+
77
+
78
+ /**
79
+ * Build the plugin settings page, used to save general settings like whether a link should be follow or no follow
80
+ * @since 1.1
81
+ */
82
+ function wprss_settings_page() {
83
+ ?>
84
+ <div class="wrap">
85
+ <?php screen_icon( 'wprss-aggregator' ); ?>
86
+
87
+ <h2><?php _e( 'WP RSS Aggregator Settings' ); ?></h2>
88
+
89
+ <form action="options.php" method="post">
90
+ <?php settings_fields( 'wprss_settings' ) ?>
91
+ <?php do_settings_sections( 'wprss-aggregator-settings' ); ?>
92
+ <p class="submit"><input type="submit" value="<?php _e( 'Save Settings', 'wprss' ); ?>" name="submit" class="button-primary"></p>
93
+ </form>
94
+ </div>
95
+ <?php
96
+ }
97
+
98
+
99
+ // Draw the section header
100
+ function wprss_settings_section_text() {
101
+ // echo '<p>Enter your settings here.</p>';
102
+ }
103
+
104
+
105
+ /**
106
+ * Follow or No Follow dropdown
107
+ * @since 1.1
108
+ */
109
+ function wprss_setting_follow_dd() {
110
+ $options = get_option( 'wprss_settings' );
111
+ $items = array(
112
+ __( 'No follow', 'wprss' ),
113
+ __( 'Follow', 'wprss' )
114
+ );
115
+ echo "<select id='follow-dd' name='wprss_settings[follow_dd]'>";
116
+ foreach( $items as $item ) {
117
+ $selected = ( $options['follow_dd'] == $item) ? 'selected="selected"' : '';
118
+ echo "<option value='$item' $selected>$item</option>";
119
+ }
120
+ echo "</select>";
121
+ }
122
+
123
+
124
+ /**
125
+ * Link open setting dropdown
126
+ * @since 1.1
127
+ */
128
+ function wprss_setting_open_dd() {
129
+ $options = get_option( 'wprss_settings' );
130
+ $items = array(
131
+ __( 'Lightbox', 'wprss' ),
132
+ __( 'New window', 'wprss' ),
133
+ __( 'None', 'wprss' )
134
+ );
135
+ echo "<select id='open-dd' name='wprss_settings[open_dd]'>";
136
+ foreach( $items as $item ) {
137
+ $selected = ( $options['open_dd'] == $item) ? 'selected="selected"' : '';
138
+ echo "<option value='$item' $selected>$item</option>";
139
+ }
140
+ echo "</select>";
141
+ }
142
+
143
+
144
+ /**
145
+ * Set limit for feeds on frontend
146
+ * @since 2.0
147
+ */
148
+ function wprss_setting_feed_limit() {
149
+ $options = get_option( 'wprss_settings' );
150
+ // echo the field
151
+
152
+ echo "<input id='feed-limit' name='wprss_settings[feed_limit]' type='text' value='$options[feed_limit]' />";
153
+ }
154
+
155
+
156
+ /**
157
+ * Set body class for admin screens
158
+ * http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/
159
+ * @since 2.0
160
+ */
161
+ function wprss_base_admin_body_class( $classes )
162
+ {
163
+ // Current action
164
+ if ( is_admin() && isset($_GET['action']) ) {
165
+ $classes .= 'action-'.$_GET['action'];
166
+ }
167
+ // Current post ID
168
+ if ( is_admin() && isset($_GET['post']) ) {
169
+ $classes .= ' ';
170
+ $classes .= 'post-'.$_GET['post'];
171
+ }
172
+ // New post type & listing page
173
+ if ( isset($_GET['post_type']) ) $post_type = $_GET['post_type'];
174
+ if ( isset($post_type) ) {
175
+ $classes .= ' ';
176
+ $classes .= 'post-type-'.$post_type;
177
+ }
178
+ // Editting a post type
179
+ if ( isset( $_GET['post'] ) ) {
180
+ $post_query = $_GET['post'];
181
+ }
182
+ if ( isset($post_query) ) {
183
+ $current_post_edit = get_post($post_query);
184
+ $current_post_type = $current_post_edit->post_type;
185
+ if ( !empty($current_post_type) ) {
186
+ $classes .= ' ';
187
+ $classes .= 'post-type-'.$current_post_type;
188
+ }
189
+ }
190
+ // Return the $classes array
191
+ return $classes;
192
+ }
193
+ add_filter('admin_body_class', 'wprss_base_admin_body_class');
inc/cron-jobs.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contains all the cron jobs in use by WP RSS Aggregator
4
+ *
5
+ * @package WPRSSAggregator
6
+ */
7
+
8
+
9
+ /**
10
+ * Creates the cron to fetch feeds every hour
11
+ *
12
+ * @since 2.0
13
+ */
14
+ function wprss_schedule_fetch_feeds_cron() {
15
+
16
+ // verify event has not been scheduled
17
+ if ( ! wp_next_scheduled( 'wprss_fetch_feeds_hook' ) ) {
18
+ // Schedule to run hourly
19
+ wp_schedule_event( time(), 'hourly', 'wprss_fetch_feeds_hook' );
20
+ }
21
+
22
+ add_action( 'wprss_fetch_feeds_hook', 'wprss_fetch_all_feed_items' );
23
+ }
24
+
25
+
26
+ /**
27
+ * Creates the cron to truncate wprss_feed_item posts daily
28
+ *
29
+ * @since 2.0
30
+ */
31
+ function wprss_schedule_truncate_posts_cron() {
32
+
33
+ // verify event has not been scheduled
34
+ if ( ! wp_next_scheduled( 'wprss_truncate_posts_hook') ) {
35
+ // Schedule to run daily
36
+ wp_schedule_event( time(), 'daily', 'wprss_truncate_posts_hook' );
37
+ }
38
+
39
+ add_action( 'wprss_truncate_posts_hook', 'wprss_truncate_posts' );
40
+ }
41
+
42
+
43
+ //add_filter( 'cron_schedules', 'wprss_cron_add_weekly' );
44
+ /**
45
+ * Not actually used at the moment, might use later on for custom scheduling
46
+ *
47
+ * @since 2.0
48
+ */
49
+ function wprss_cron_add_weekly( $schedules ) {
50
+ // Adds once weekly to the existing schedules.
51
+ $schedules['weekly'] = array(
52
+ 'interval' => 60, // 60*60*24*7
53
+ 'display' => __( 'Once Weekly' )
54
+ );
55
+ return $schedules;
56
+ }
inc/custom-post-types.php ADDED
@@ -0,0 +1,671 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contains all custom post type related functions
4
+ *
5
+ * @package WPRSSAggregator
6
+ */
7
+
8
+
9
+ add_action( 'init', 'wprss_register_post_types' );
10
+ /**
11
+ * Create Custom Post Types wprss_feed and wprss_feed_item
12
+ *
13
+ * @since 2.0
14
+ */
15
+ function wprss_register_post_types() {
16
+
17
+ // Set up labels for the 'wprss_feed' post type
18
+ $labels = apply_filters( 'wprss_feed_post_type_labels', array(
19
+ 'name' => __( 'Feed Sources', 'wprss' ),
20
+ 'singular_name' => __( 'Feed', 'wprss' ),
21
+ 'add_new' => __( 'Add New Feed Source', 'wprss' ),
22
+ 'all_items' => __( 'All Feed Sources', 'wprss' ),
23
+ 'add_new_item' => __( 'Add New Feed Source', 'wprss' ),
24
+ 'edit_item' => __( 'Edit Feed Source', 'wprss' ),
25
+ 'new_item' => __( 'New Feed Source', 'wprss' ),
26
+ 'view_item' => __( 'View Feed Source', 'wprss' ),
27
+ 'search_items' => __( 'Search Feeds', 'wprss' ),
28
+ 'not_found' => __( 'No Feed Sources Found', 'wprss' ),
29
+ 'not_found_in_trash' => __( 'No Feed Sources Found In Trash', 'wprss' ),
30
+ 'menu_name' => __( 'RSS Aggregator', 'wprss' )
31
+ )
32
+ );
33
+
34
+ // Set up the arguments for the 'wprss_feed' post type
35
+ $feed_args = apply_filters( 'wprss_feed_post_type_args', array(
36
+ 'public' => true,
37
+ 'query_var' => 'feed_source',
38
+ 'menu_position' => 100,
39
+ 'menu_icon' => WPRSS_IMG . 'icon-adminmenu16-sprite.png',
40
+ 'show_in_menu' => true,
41
+ 'supports' => array( 'title' ),
42
+ 'rewrite' => array(
43
+ 'slug' => 'feeds',
44
+ 'with_front' => false
45
+ ),
46
+ 'labels' => $labels
47
+ )
48
+ );
49
+
50
+ // Register the 'wprss_feed' post type
51
+ register_post_type( 'wprss_feed', $feed_args );
52
+
53
+ // Set up labels for the 'wprss_feed_item' post type
54
+ $labels = apply_filters( 'wprss_feed_item_post_type_labels', array(
55
+ 'name' => __( 'Imported Feeds', 'wprss' ),
56
+ 'singular_name' => __( 'Imported Feed', 'wprss' ),
57
+ 'all_items' => __( 'Imported Feeds', 'wprss' ),
58
+ 'view_item' => __( 'View Imported Feed', 'wprss' ),
59
+ 'search_items' => __( 'Search Imported Feeds', 'wprss' ),
60
+ 'not_found' => __( 'No Imported Feeds Found', 'wprss' ),
61
+ 'not_found_in_trash' => __( 'No Imported Feeds Found In Trash', 'wprss' )
62
+ )
63
+ );
64
+
65
+ // Set up the arguments for the 'wprss_feed_item' post type
66
+ $feed_item_args = apply_filters( 'wprss_feed_item_post_type_args', array(
67
+ 'public' => true,
68
+ 'query_var' => 'feed_item',
69
+ 'show_in_menu' => 'edit.php?post_type=wprss_feed',
70
+ 'rewrite' => array(
71
+ 'slug' => 'feeds/items',
72
+ 'with_front' => false,
73
+ ),
74
+ 'labels' => $labels
75
+ )
76
+ );
77
+
78
+ // Register the 'feed_item' post type
79
+ register_post_type( 'wprss_feed_item', $feed_item_args );
80
+ }
81
+
82
+
83
+ add_filter( 'manage_edit-wprss_feed_columns', 'wprss_set_feed_custom_columns');
84
+ /**
85
+ * Set up the custom columns for the wprss_feed list
86
+ *
87
+ * @since 2.0
88
+ */
89
+ function wprss_set_feed_custom_columns( $columns ) {
90
+
91
+ $columns = array (
92
+ 'cb' => '<input type="checkbox" />',
93
+ 'title' => __( 'Name', 'wprss' ),
94
+ 'url' => __( 'URL', 'wprss' ),
95
+ 'description' => __( 'Description', 'wprss' ),
96
+ );
97
+ return apply_filters( 'wprss_set_feed_custom_columns', $columns );
98
+ }
99
+
100
+
101
+ add_action( "manage_wprss_feed_posts_custom_column", "wprss_show_custom_columns", 10, 2 );
102
+ /**
103
+ * Show up the custom columns for the wprss_feed list
104
+ *
105
+ * @since 2.0
106
+ */
107
+ function wprss_show_custom_columns( $column, $post_id ) {
108
+
109
+ switch ( $column ) {
110
+ case 'url':
111
+ $url = get_post_meta( $post_id, 'wprss_url', true);
112
+ echo '<a href="' . esc_url($url) . '">' . esc_url($url) . '</a>';
113
+ break;
114
+ case 'description':
115
+ $description = get_post_meta( $post_id, 'wprss_description', true);
116
+ echo esc_html( $description );
117
+ break;
118
+ }
119
+ }
120
+
121
+
122
+ /**
123
+ * Make the custom columns sortable for wprss_feed post type
124
+ *
125
+ * @since 2.0
126
+ */
127
+ function wprss_feed_sortable_columns() {
128
+ $sortable_columns = array(
129
+ // meta column id => sortby value used in query
130
+ 'title' => 'title',
131
+ );
132
+ return apply_filters( 'wprss_feed_sortable_columns', $sortable_columns );
133
+ }
134
+
135
+
136
+ add_action( 'pre_get_posts', 'wprss_feed_source_order' );
137
+ /**
138
+ * Change order of feed sources to alphabetical ascending according to feed name
139
+ *
140
+ * @since 2.2
141
+ */
142
+ function wprss_feed_source_order( $query ) {
143
+ if ( ! is_admin() ) {
144
+ return;
145
+ }
146
+
147
+ $post_type = $query->get('post_type');
148
+
149
+ if ( $post_type == 'wprss_feed' ) {
150
+ /* Post Column: e.g. title */
151
+ if ( $query->get( 'orderby' ) == '' ) {
152
+ $query->set( 'orderby', 'title' );
153
+ }
154
+ /* Post Order: ASC / DESC */
155
+ if( $query->get( 'order' ) == '' ){
156
+ $query->set( 'order', 'ASC' );
157
+ }
158
+ }
159
+ }
160
+
161
+
162
+ add_filter( 'manage_edit-wprss_feed_item_columns', 'wprss_set_feed_item_custom_columns');
163
+ /**
164
+ * Set up the custom columns for the wprss_feed source list
165
+ *
166
+ * @since 2.0
167
+ */
168
+ function wprss_set_feed_item_custom_columns( $columns ) {
169
+
170
+ $columns = array (
171
+ 'cb' => '<input type="checkbox" />',
172
+ 'title' => __( 'Name', 'wprss' ),
173
+ 'permalink' => __( 'Permalink', 'wprss' ),
174
+ 'publishdate' => __( 'Date published', 'wprss' ),
175
+ 'source' => __( 'Source', 'wprss' )
176
+ );
177
+ return apply_filters( 'wprss_set_feed_item_custom_columns', $columns );
178
+ }
179
+
180
+
181
+ add_action( "manage_wprss_feed_item_posts_custom_column", "wprss_show_feed_item_custom_columns", 10, 2 );
182
+ /**
183
+ * Show up the custom columns for the wprss_feed list
184
+ *
185
+ * @since 2.0
186
+ */
187
+ function wprss_show_feed_item_custom_columns( $column, $post_id ) {
188
+
189
+ switch ( $column ) {
190
+ case "permalink":
191
+ $url = get_post_meta( $post_id, 'wprss_item_permalink', true);
192
+ echo '<a href="' . $url . '">' . $url. '</a>';
193
+ break;
194
+
195
+ case "publishdate":
196
+ $publishdate = date( 'Y-m-d H:i:s', get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) ;
197
+ echo $publishdate;
198
+ break;
199
+
200
+ case "source":
201
+ $query = new WP_Query();
202
+ $source = '<a href="' . get_edit_post_link( get_post_meta( $post_id, 'wprss_feed_id', true ) ) . '">' . get_the_title( get_post_meta( $post_id, 'wprss_feed_id', true ) ) . '</a>';
203
+ echo $source;
204
+ break;
205
+ }
206
+ }
207
+
208
+
209
+ add_filter( "manage_edit-wprss_feed_item_sortable_columns", "wprss_feed_item_sortable_columns" );
210
+ /**
211
+ * Make the custom columns sortable
212
+ *
213
+ * @since 2.0
214
+ */
215
+ function wprss_feed_item_sortable_columns() {
216
+ $sortable_columns = array(
217
+ // meta column id => sortby value used in query
218
+ 'publishdate' => 'publishdate',
219
+ 'source' => 'source'
220
+ );
221
+ return apply_filters( 'wprss_feed_item_sortable_columns', $sortable_columns );
222
+ }
223
+
224
+
225
+ add_action( 'pre_get_posts', 'wprss_feed_item_orderby' );
226
+ /**
227
+ * Change ordering of posts on wprss_feed_item screen
228
+ *
229
+ * @since 2.0
230
+ */
231
+ function wprss_feed_item_orderby( $query ) {
232
+ if( ! is_admin() )
233
+ return;
234
+
235
+ $post_type = $query->get('post_type');
236
+
237
+ // If we're on the feed listing admin page
238
+ if ( $post_type == 'wprss_feed_item') {
239
+ // Set general orderby to date the feed item was published
240
+ $query->set('orderby','publishdate');
241
+ // If user clicks on the reorder link, implement reordering
242
+ $orderby = $query->get( 'orderby');
243
+ if( 'publishdate' == $orderby ) {
244
+ $query->set( 'meta_key', 'wprss_item_date' );
245
+ $query->set( 'orderby', 'meta_value_num' );
246
+ }
247
+ }
248
+ }
249
+
250
+
251
+ add_action( 'add_meta_boxes', 'wprss_add_meta_boxes');
252
+ /**
253
+ * Set up the input boxes for the wprss_feed post type
254
+ *
255
+ * @since 2.0
256
+ */
257
+ function wprss_add_meta_boxes() {
258
+ global $wprss_meta_fields;
259
+
260
+ // Remove the default WordPress Publish box, because we will be using custom ones
261
+ remove_meta_box( 'submitdiv', 'wprss_feed', 'side' );
262
+ add_meta_box(
263
+ 'submitdiv',
264
+ __( 'Save Feed Source', 'wprss' ),
265
+ 'post_submit_meta_box',
266
+ 'wprss_feed',
267
+ 'side',
268
+ 'low');
269
+
270
+ /* add_meta_box(
271
+ 'wprss-save-link-side-meta',
272
+ 'Save Feed Source',
273
+ 'wprss_save_feed_source_meta_box',
274
+ 'wprss_feed',
275
+ 'side',
276
+ 'high'
277
+ );
278
+
279
+ add_meta_box(
280
+ 'wprss-save-link-bottom-meta',
281
+ __( 'Save Feed Source', 'wprss' ),
282
+ 'wprss_save_feed_source_meta_box',
283
+ 'wprss_feed',
284
+ 'normal',
285
+ 'low'
286
+ );*/
287
+
288
+ add_meta_box(
289
+ 'wprss-help-meta',
290
+ __( 'WP RSS Aggregator Help', 'wprss' ),
291
+ 'wprss_help_meta_box',
292
+ 'wprss_feed',
293
+ 'side',
294
+ 'low'
295
+ );
296
+
297
+ add_meta_box(
298
+ 'wprss-like-meta',
299
+ __( 'Like this plugin?', 'wprss' ),
300
+ 'wprss_like_meta_box',
301
+ 'wprss_feed',
302
+ 'side',
303
+ 'low'
304
+ );
305
+
306
+ add_meta_box(
307
+ 'wprss-follow-meta',
308
+ __( 'Follow us', 'wprss' ),
309
+ 'wprss_follow_meta_box',
310
+ 'wprss_feed',
311
+ 'side',
312
+ 'low'
313
+ );
314
+
315
+ add_meta_box(
316
+ 'custom_meta_box', // $id
317
+ __( 'Feed Source Details', 'wprss' ), // $title
318
+ 'wprss_show_meta_box', // $callback
319
+ 'wprss_feed', // $page
320
+ 'normal', // $context
321
+ 'high'); // $priority
322
+
323
+
324
+ add_meta_box(
325
+ 'preview_meta_box', // $id
326
+ __( 'Feed Preview', 'wprss' ), // $title
327
+ 'wprss_preview_meta_box', // $callback
328
+ 'wprss_feed', // $page
329
+ 'normal', // $context
330
+ 'low'); // $priority
331
+ }
332
+
333
+
334
+ /**
335
+ * Set up fields for the meta box for the wprss_feed post type
336
+ *
337
+ * @since 2.0
338
+ */
339
+ function wprss_custom_fields() {
340
+ $prefix = 'wprss_';
341
+
342
+ // Field Array
343
+ $wprss_meta_fields[ 'url' ] = array(
344
+ 'label' => __( 'URL', 'wprss' ),
345
+ 'desc' => __( 'Enter feed URL (including http://)', 'wprss' ),
346
+ 'id' => $prefix.'url',
347
+ 'type' => 'text'
348
+ );
349
+
350
+ $wprss_meta_fields[' description' ] = array(
351
+ 'label' => __( 'Description', 'wprss' ),
352
+ 'desc' => __( 'A short description about this feed source (optional)', 'wprss' ),
353
+ 'id' => $prefix.'description',
354
+ 'type' => 'textarea'
355
+ );
356
+
357
+ // for extensibility, allows more meta fields to be added
358
+ return apply_filters( 'wprss_fields', $wprss_meta_fields );
359
+ }
360
+
361
+
362
+ /**
363
+ * Set up the meta box for the wprss_feed post type
364
+ *
365
+ * @since 2.0
366
+ */
367
+ function wprss_show_meta_box() {
368
+ global $post;
369
+ $meta_fields = wprss_custom_fields();
370
+
371
+ // Use nonce for verification
372
+ echo '<input type="hidden" name="wprss_meta_box_nonce" value="' . wp_create_nonce( basename( __FILE__ ) ) . '" />';
373
+
374
+ // Begin the field table and loop
375
+ echo '<table class="form-table">';
376
+ foreach ( $meta_fields as $field ) {
377
+ // get value of this field if it exists for this post
378
+ $meta = get_post_meta( $post->ID, $field['id'], true );
379
+ // begin a table row with
380
+ echo '<tr>
381
+ <th><label for="' . $field['id'] . '">' . $field['label'] . '</label></th>
382
+ <td>';
383
+
384
+ switch( $field['type'] ) {
385
+
386
+ // text
387
+ case 'text':
388
+ echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="55" />
389
+ <br /><span class="description">'.$field['desc'].'</span>';
390
+ break;
391
+
392
+ // textarea
393
+ case 'textarea':
394
+ echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
395
+ <br /><span class="description">'.$field['desc'].'</span>';
396
+ break;
397
+
398
+ // checkbox
399
+ case 'checkbox':
400
+ echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/>
401
+ <label for="'.$field['id'].'">'.$field['desc'].'</label>';
402
+ break;
403
+
404
+ // select
405
+ case 'select':
406
+ echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';
407
+ foreach ($field['options'] as $option) {
408
+ echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';
409
+ }
410
+ echo '</select><br /><span class="description">'.$field['desc'].'</span>';
411
+ break;
412
+
413
+ } //end switch
414
+ echo '</td></tr>';
415
+ } // end foreach
416
+ echo '</table>'; // end table
417
+ }
418
+
419
+
420
+ add_action( 'save_post', 'wprss_save_custom_fields' );
421
+ /**
422
+ * Save the custom fields
423
+ *
424
+ * @since 2.0
425
+ */
426
+ function wprss_save_custom_fields( $post_id ) {
427
+ $meta_fields = wprss_custom_fields();
428
+
429
+ // verify nonce
430
+ if ( ! wp_verify_nonce( $_POST[ 'wprss_meta_box_nonce' ], basename( __FILE__ ) ) )
431
+ return $post_id;
432
+
433
+ // check autosave
434
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE)
435
+ return $post_id;
436
+
437
+ // check permissions
438
+ if ( 'page' == $_POST[ 'post_type' ] ) {
439
+ if ( ! current_user_can( 'edit_page', $post_id ) )
440
+ return $post_id;
441
+ } elseif ( ! current_user_can( 'edit_post', $post_id ) ) {
442
+ return $post_id;
443
+ }
444
+
445
+ // loop through fields and save the data
446
+ foreach ( $meta_fields as $field ) {
447
+ $old = get_post_meta( $post_id, $field[ 'id' ], true );
448
+ $new = $_POST[ $field[ 'id' ] ];
449
+ if ( $new && $new != $old ) {
450
+ update_post_meta( $post_id, $field[ 'id' ], $new );
451
+ } elseif ( '' == $new && $old ) {
452
+ delete_post_meta( $post_id, $field[ 'id' ], $old );
453
+ }
454
+ } // end foreach
455
+ }
456
+
457
+
458
+ /**
459
+ * Generate the Save Feed Source meta box
460
+ *
461
+ * @since 2.0
462
+ */
463
+ function wprss_save_feed_source_meta_box() {
464
+ global $post;
465
+
466
+ // insert nonce??
467
+
468
+ echo '<input type="submit" name="publish" id="publish" class="button-primary" value="Save" tabindex="5" accesskey="s">';
469
+
470
+ /**
471
+ * Check if user has disabled trash, in that case he can only delete feed sources permanently,
472
+ * else he can deactivate them. By default, if not modified in wp_config.php, EMPTY_TRASH_DAYS is set to 30.
473
+ */
474
+ if ( current_user_can( "delete_post", $post->ID ) ) {
475
+ if ( ! EMPTY_TRASH_DAYS )
476
+ $delete_text = __( 'Delete Permanently', 'wprss' );
477
+ else
478
+ $delete_text = __( 'Move to Trash', 'wprss' );
479
+
480
+ echo '&nbsp;&nbsp;<a class="submitdelete deletion" href="' . get_delete_post_link( $post->ID ) . '">' . $delete_text . '</a>';
481
+ }
482
+ }
483
+
484
+
485
+ /**
486
+ * Generate a preview of the latest 5 posts from the feed source being added/edited
487
+ *
488
+ * @since 2.0
489
+ */
490
+ function wprss_preview_meta_box() {
491
+ global $post;
492
+ $feed_url = get_post_meta( $post->ID, 'wprss_url', true );
493
+
494
+ if( ! empty( $feed_url ) ) {
495
+ $feed = fetch_feed( $feed_url );
496
+ if ( ! is_wp_error( $feed ) ) {
497
+ $items = $feed->get_items();
498
+
499
+ echo '<h4>Latest 5 feeds available from ' . get_the_title() . '</h4>';
500
+ $count = 0;
501
+ $feedlimit = 5;
502
+ foreach ( $items as $item ) {
503
+ echo '<ul>';
504
+ echo '<li>' . $item->get_title() . '</li>';
505
+ echo '</ul>';
506
+ if( ++$count == $feedlimit ) break; //break if count is met
507
+ }
508
+ }
509
+ else _e( '<strong>Invalid feed URL</strong> - Double check the feed source URL setting above.', 'wprss' );
510
+ }
511
+
512
+ else _e( 'No feed URL defined yet', 'wprss' );
513
+ }
514
+
515
+
516
+ /**
517
+ * Generate Help meta box
518
+ *
519
+ * @since 2.0
520
+ *
521
+ */
522
+ function wprss_help_meta_box() {
523
+ echo '<p><strong>';
524
+ _e( 'Need help?', 'wprss' );
525
+ echo '</strong> <a target="_blank" href="http://wordpress.org/support/plugin/wp-rss-aggregator">';
526
+ _e( 'Check out the support forum', 'wprss' );
527
+ echo '</a></p>';
528
+ }
529
+
530
+ /**
531
+ * Generate Like this plugin meta box
532
+ *
533
+ * @since 2.0
534
+ *
535
+ */
536
+ function wprss_like_meta_box() { ?>
537
+ <p><?php _e( 'Why not do any or all of the following', 'wprss' ) ?>:</p>
538
+ <ul>
539
+ <li><a href="http://wordpress.org/extend/plugins/wp-rss-aggregator/"><?php _e( 'Give it a 5 star rating on WordPress.org.', 'wprss' ) ?></a></li>
540
+ <li class="donate_link"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ"><?php _e('Donate a token of your appreciation.', 'wprss' ); ?></a></li>
541
+ </ul>
542
+ </p>
543
+ <?php }
544
+
545
+
546
+ /**
547
+ * Generate Like this plugin meta box
548
+ *
549
+ * @since 2.0
550
+ *
551
+ */
552
+ function wprss_follow_meta_box() {
553
+ ?>
554
+ <ul>
555
+ <li class="twitter"><a href="http://twitter.com/wpmayor"><?php _e( 'Follow WP Mayor on Twitter.', 'wprss' ) ?></a></li>
556
+ <li class="facebook"><a href="https://www.facebook.com/wpmayor"><?php _e( 'Like WP Mayor on Facebook.', 'wprss' ) ?></a></li>
557
+
558
+ </ul>
559
+ <?php }
560
+
561
+
562
+ add_filter( 'post_updated_messages', 'wprss_feed_updated_messages' );
563
+ /**
564
+ * Change default notification message when new feed is added or updated
565
+ *
566
+ * @since 2.0
567
+ */
568
+ function wprss_feed_updated_messages( $messages ) {
569
+ global $post, $post_ID;
570
+
571
+ $messages[ 'wprss_feed' ] = array(
572
+ 0 => '', // Unused. Messages start at index 1.
573
+ 1 => __( 'Feed source updated. ', 'wprss' ),
574
+ 2 => __( 'Custom field updated.', 'wprss' ),
575
+ 3 => __( 'Custom field deleted.', 'wprss' ),
576
+ 4 => __( 'Feed source updated.', 'wprss' ),
577
+ 5 => '',
578
+ 6 => __( 'Feed source saved.', 'wprss' ),
579
+ 7 => __( 'Feed source saved.', 'wprss' ),
580
+ 8 => __( 'Feed source submitted.', 'wprss' ),
581
+ 9 => '',
582
+ 10 => __( 'Feed source updated.', 'wprss' )
583
+ );
584
+
585
+ return apply_filters( 'wprss_feed_updated_messages', $messages );
586
+ }
587
+
588
+
589
+ add_filter( 'post_row_actions', 'wprss_remove_row_actions', 10, 1 );
590
+ /**
591
+ * Remove actions row for imported feed items, we don't want them to be editable or viewable
592
+ *
593
+ * @since 2.0
594
+ */
595
+ function wprss_remove_row_actions( $actions )
596
+ {
597
+ if ( get_post_type() === 'wprss_feed_item' ) {
598
+ unset( $actions[ 'edit' ] );
599
+ unset( $actions[ 'view' ] );
600
+ //unset( $actions[ 'trash' ] );
601
+ unset( $actions[ 'inline hide-if-no-js' ] );
602
+ }
603
+ return apply_filters( 'wprss_remove_row_actions', $actions );
604
+ }
605
+
606
+
607
+ add_filter( 'bulk_actions-edit-wprss_feed_item', 'wprss_custom_feed_item_bulk_actions' );
608
+ /**
609
+ * Remove bulk action link to edit imported feed items
610
+ *
611
+ * @since 2.0
612
+ */
613
+ function wprss_custom_feed_item_bulk_actions( $actions ){
614
+ unset( $actions[ 'edit' ] );
615
+ return apply_filters( 'wprss_custom_feed_item_bulk_actions', $actions );
616
+ }
617
+
618
+
619
+ add_action( 'admin_footer-edit.php', 'wprss_remove_a_from_feed_title' );
620
+ /**
621
+ * Remove hyperlink from imported feed titles in list posts screen
622
+ *
623
+ * @since 2.0
624
+ */
625
+ function wprss_remove_a_from_feed_title() {
626
+ if ( 'edit-wprss_feed_item' !== get_current_screen()->id )
627
+ return;
628
+ ?>
629
+
630
+ <script type="text/javascript">
631
+ jQuery('table.wp-list-table a.row-title').contents().unwrap();
632
+ </script>
633
+ <?php
634
+ }
635
+
636
+
637
+ add_action( 'add_meta_boxes', 'wprss_remove_meta_boxes', 100 );
638
+ /**
639
+ * Remove unneeded meta boxes from add feed source screen
640
+ *
641
+ * @since 2.0
642
+ */
643
+ function wprss_remove_meta_boxes() {
644
+ if ( 'wprss_feed' !== get_current_screen()->id ) return;
645
+ remove_meta_box( 'wpseo_meta', 'wprss_feed' ,'normal' );
646
+ remove_meta_box( 'woothemes-settings', 'wprss_feed' ,'normal' );
647
+ remove_meta_box( 'wpcf-post-relationship', 'wprss_feed' ,'normal' );
648
+ remove_meta_box( 'sharing_meta', 'wprss_feed' ,'advanced' );
649
+ remove_meta_box( 'content-permissions-meta-box', 'wprss_feed' ,'advanced' );
650
+ remove_meta_box( 'theme-layouts-post-meta-box', 'wprss_feed' ,'side' );
651
+ remove_meta_box( 'post-stylesheets', 'wprss_feed' ,'side' );
652
+ remove_meta_box( 'hybrid-core-post-template', 'wprss_feed' ,'side' );
653
+ remove_meta_box( 'wpcf-marketing', 'wprss_feed' ,'side' );
654
+ remove_meta_box( 'trackbacksdiv22', 'wprss_feed' ,'advanced' );
655
+ remove_action( 'post_submitbox_start', 'fpp_post_submitbox_start_action' );
656
+ }
657
+
658
+
659
+ add_filter( 'gettext', 'wprss_change_publish_button_text', 10, 2 );
660
+ /**
661
+ * Modify 'Publish' button text when adding a new feed source
662
+ *
663
+ * @since 2.0
664
+ */
665
+ function wprss_change_publish_button_text( $translation, $text ) {
666
+ if ( 'wprss_feed' == get_post_type()) {
667
+ if ( $text == 'Publish' )
668
+ return __( 'Publish Feed', 'wprss' );
669
+ }
670
+ return apply_filters( 'wprss_change_publish_button_text', $translation );
671
+ }
inc/deactivation.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin deactivation procedure
4
+ * @since 1.0
5
+ */
6
+ function wprss_deactivate() {
7
+ // on deactivation remove the cron job
8
+ if ( wp_next_scheduled( 'wprss_cron_hook' ) )
9
+ wp_clear_scheduled_hook( 'wprss_cron_hook' );
10
+ }
inc/shortcodes.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Set up shortcodes and call the main function for output
4
+ *
5
+ * @since 1.0
6
+ */
7
+ function wprss_shortcode( $atts ) {
8
+ if ( !empty ($atts) ) {
9
+ foreach ( $atts as $key => &$val ) {
10
+ $val = html_entity_decode($val);
11
+ }
12
+ }
13
+ ob_start(); //start an output buffer to output of the following function
14
+ wprss_display_feed_items( $atts );
15
+ return ob_get_clean(); //return the current buffer and clear it
16
+ }
17
+
18
+ // Register shortcodes
19
+ add_shortcode( 'wp_rss_aggregator', 'wprss_shortcode');
20
+ add_shortcode( 'wp-rss-aggregator', 'wprss_shortcode');
inc/update.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contains all the functions related to updating the plugin from
4
+ * one version to another
5
+ *
6
+ * @package WPRSSAggregator
7
+ */
8
+
9
+ add_action( 'init', 'wprss_version_check' );
10
+ /**
11
+ * Checks the version number and runs install or update functions if needed.
12
+ *
13
+ * @since 2.0
14
+ */
15
+ function wprss_version_check() {
16
+
17
+ // Get the old database version.
18
+ $old_db_version = get_option( 'wprss_db_version' );
19
+
20
+ // Get the plugin settings.
21
+ $settings = get_option( 'wprss_settings' );
22
+
23
+ // Get the plugin options
24
+ $options = get_option( 'wprss_options' );
25
+
26
+ // For fresh installs
27
+ // If there is no old database version and no settings, run the install.
28
+ if ( empty( $old_db_version ) && false === $settings && false === $options ) {
29
+ wprss_install();
30
+ }
31
+
32
+ // For version 1.0 to 2.0
33
+ // If there is no old database version and no settings, but only options
34
+ elseif ( empty( $old_db_version ) && false === $settings && !empty( $options ) ) {
35
+ wp_clear_scheduled_hook( 'wprss_generate_hook' );
36
+ wprss_install();
37
+ wprss_migrate();
38
+ wprss_fetch_all_feed_items();
39
+ }
40
+
41
+ // For version 1.1 to 2.0
42
+ // If there is no old database version, but only settings and options
43
+ elseif ( empty( $old_db_version ) && !empty( $settings ) && !empty( $options ) ) {
44
+ wp_clear_scheduled_hook( 'wprss_generate_hook' );
45
+ wprss_update();
46
+ wprss_migrate();
47
+ wprss_fetch_all_feed_items();
48
+ }
49
+
50
+ // For any future versions where DB changes
51
+ // If the old version is less than the new version, run the update.
52
+ elseif ( intval( $old_db_version ) < intval( WPRSS_DB_VERSION ) ) {
53
+ wprss_update();
54
+ wprss_fetch_all_feed_items();
55
+ }
56
+ }
57
+
58
+
59
+ /**
60
+ * Adds the plugin settings on install.
61
+ *
62
+ * @since 2.0
63
+ */
64
+ function wprss_install() {
65
+
66
+ // Add the database version setting.
67
+ add_option( 'wprss_db_version', WPRSS_DB_VERSION );
68
+
69
+ // Add the default plugin settings.
70
+ add_option( 'wprss_settings', wprss_get_default_settings() );
71
+ }
72
+
73
+
74
+ /**
75
+ * Updates plugin settings if there are new settings to add.
76
+ *
77
+ * @since 2.0
78
+ */
79
+ function wprss_update() {
80
+
81
+ // Update the database version setting.
82
+ update_option( 'wprss_db_version', WPRSS_DB_VERSION );
83
+
84
+ // Get the settings from the database.
85
+ $settings = get_option( 'wprss_settings' );
86
+
87
+ // Get the default plugin settings.
88
+ $default_settings = wprss_get_default_settings();
89
+
90
+ // Loop through each of the default plugin settings.
91
+ foreach ( $default_settings as $setting_key => $setting_value ) {
92
+
93
+ // If the setting didn't previously exist, add the default value to the $settings array.
94
+ if ( ! isset( $settings[ $setting_key ] ) )
95
+ $settings[ $setting_key ] = $setting_value;
96
+ }
97
+
98
+ // Update the plugin settings.
99
+ update_option( 'wprss_settings', $settings );
100
+ }
101
+
102
+
103
+ /**
104
+ * Migrates the feed sources from the wprss_options field to the wp_posts table
105
+ *
106
+ * @since 2.0
107
+ */
108
+ function wprss_migrate() {
109
+
110
+ // Get the plugin options
111
+ $options = get_option( 'wprss_options' );
112
+
113
+ $feed_sources = array_chunk( $options, 2 );
114
+
115
+ foreach ( $feed_sources as $feed_source ) {
116
+ $feed_title = $feed_source[0];
117
+ $feed_url = $feed_source[1];
118
+
119
+ // Create post object
120
+ $feed_item = array(
121
+ 'post_title' => $feed_title,
122
+ 'post_content' => '',
123
+ 'post_status' => 'publish',
124
+ 'post_type' => 'wprss_feed'
125
+ );
126
+
127
+ $inserted_ID = wp_insert_post( $feed_item, $wp_error );
128
+ // insert post meta
129
+ update_post_meta( $inserted_ID, 'wprss_url', $feed_url );
130
+ }
131
+ // delete unneeded option
132
+ delete_option( 'wprss_options' );
133
+ }
134
+
135
+
136
+ /**
137
+ * Returns an array of the default plugin settings. These are only used on initial setup.
138
+ *
139
+ * @since 2.0
140
+ */
141
+ function wprss_get_default_settings() {
142
+
143
+ // Set up the default plugin settings
144
+ $settings = array(
145
+
146
+ // from version 1.1
147
+ 'open_dd' => __( 'New window' ),
148
+ 'follow_dd' => __( 'No follow' ),
149
+ // from version 2.0
150
+ 'feed_limit' => 10
151
+ );
152
+
153
+ // Return the default settings
154
+ return $settings;
155
+ }
js/custom.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ jQuery( document ).ready( function() {
2
+ jQuery( 'a.colorbox' ).colorbox(
3
+ {iframe:true, width:'80%', height:'80%'}
4
+ );
5
+ });
js/jquery.colorbox-min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ // ColorBox v1.3.20.1 - jQuery lightbox plugin
2
+ // (c) 2012 Jack Moore - jacklmoore.com
3
+ // License: http://www.opensource.org/licenses/mit-license.php
4
+ (function(e,t,n){function G(n,r,i){var o=t.createElement(n);return r&&(o.id=s+r),i&&(o.style.cssText=i),e(o)}function Y(e){var t=T.length,n=(U+e)%t;return n<0?t+n:n}function Z(e,t){return Math.round((/%/.test(e)?(t==="x"?tt():nt())/100:1)*parseInt(e,10))}function et(e){return B.photo||/\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(e)}function tt(){return n.innerWidth||N.width()}function nt(){return n.innerHeight||N.height()}function rt(){var t,n=e.data(R,i);n==null?(B=e.extend({},r),console&&console.log&&console.log("Error: cboxElement missing settings object")):B=e.extend({},n);for(t in B)e.isFunction(B[t])&&t.slice(0,2)!=="on"&&(B[t]=B[t].call(R));B.rel=B.rel||R.rel||"nofollow",B.href=B.href||e(R).attr("href"),B.title=B.title||R.title,typeof B.href=="string"&&(B.href=e.trim(B.href))}function it(t,n){e.event.trigger(t),n&&n.call(R)}function st(){var e,t=s+"Slideshow_",n="click."+s,r,i,o;B.slideshow&&T[1]?(r=function(){M.text(B.slideshowStop).unbind(n).bind(f,function(){if(B.loop||T[U+1])e=setTimeout(J.next,B.slideshowSpeed)}).bind(a,function(){clearTimeout(e)}).one(n+" "+l,i),g.removeClass(t+"off").addClass(t+"on"),e=setTimeout(J.next,B.slideshowSpeed)},i=function(){clearTimeout(e),M.text(B.slideshowStart).unbind([f,a,l,n].join(" ")).one(n,function(){J.next(),r()}),g.removeClass(t+"on").addClass(t+"off")},B.slideshowAuto?r():i()):g.removeClass(t+"off "+t+"on")}function ot(t){V||(R=t,rt(),T=e(R),U=0,B.rel!=="nofollow"&&(T=e("."+o).filter(function(){var t=e.data(this,i),n;return t&&(n=t.rel||this.rel),n===B.rel}),U=T.index(R),U===-1&&(T=T.add(R),U=T.length-1)),W||(W=X=!0,g.show(),B.returnFocus&&e(R).blur().one(c,function(){e(this).focus()}),m.css({opacity:+B.opacity,cursor:B.overlayClose?"pointer":"auto"}).show(),B.w=Z(B.initialWidth,"x"),B.h=Z(B.initialHeight,"y"),J.position(),d&&N.bind("resize."+v+" scroll."+v,function(){m.css({width:tt(),height:nt(),top:N.scrollTop(),left:N.scrollLeft()})}).trigger("resize."+v),it(u,B.onOpen),H.add(A).hide(),P.html(B.close).show()),J.load(!0))}function ut(){!g&&t.body&&(Q=!1,N=e(n),g=G(K).attr({id:i,"class":p?s+(d?"IE6":"IE"):""}).hide(),m=G(K,"Overlay",d?"position:absolute":"").hide(),L=G(K,"LoadingOverlay").add(G(K,"LoadingGraphic")),y=G(K,"Wrapper"),b=G(K,"Content").append(C=G(K,"LoadedContent","width:0; height:0; overflow:hidden"),A=G(K,"Title"),O=G(K,"Current"),_=G(K,"Next"),D=G(K,"Previous"),M=G(K,"Slideshow").bind(u,st),P=G(K,"Close")),y.append(G(K).append(G(K,"TopLeft"),w=G(K,"TopCenter"),G(K,"TopRight")),G(K,!1,"clear:left").append(E=G(K,"MiddleLeft"),b,S=G(K,"MiddleRight")),G(K,!1,"clear:left").append(G(K,"BottomLeft"),x=G(K,"BottomCenter"),G(K,"BottomRight"))).find("div div").css({"float":"left"}),k=G(K,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),H=_.add(D).add(O).add(M),e(t.body).append(m,g.append(y,k)))}function at(){return g?(Q||(Q=!0,j=w.height()+x.height()+b.outerHeight(!0)-b.height(),F=E.width()+S.width()+b.outerWidth(!0)-b.width(),I=C.outerHeight(!0),q=C.outerWidth(!0),g.css({"padding-bottom":j,"padding-right":F}),_.click(function(){J.next()}),D.click(function(){J.prev()}),P.click(function(){J.close()}),m.click(function(){B.overlayClose&&J.close()}),e(t).bind("keydown."+s,function(e){var t=e.keyCode;W&&B.escKey&&t===27&&(e.preventDefault(),J.close()),W&&B.arrowKey&&T[1]&&(t===37?(e.preventDefault(),D.click()):t===39&&(e.preventDefault(),_.click()))}),e("."+o,t).live("click",function(e){e.which>1||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),ot(this))})),!0):!1}var r={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:undefined},i="colorbox",s="cbox",o=s+"Element",u=s+"_open",a=s+"_load",f=s+"_complete",l=s+"_cleanup",c=s+"_closed",h=s+"_purge",p=!e.support.opacity&&!e.support.style,d=p&&!n.XMLHttpRequest,v=s+"_IE6",m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K="div",Q;if(e.colorbox)return;e(ut),J=e.fn[i]=e[i]=function(t,n){var s=this;t=t||{},ut();if(at()){if(!s[0]){if(s.selector)return s;s=e("<a/>"),t.open=!0}n&&(t.onComplete=n),s.each(function(){e.data(this,i,e.extend({},e.data(this,i)||r,t))}).addClass(o),(e.isFunction(t.open)&&t.open.call(s)||t.open)&&ot(s[0])}return s},J.position=function(e,t){function f(e){w[0].style.width=x[0].style.width=b[0].style.width=e.style.width,b[0].style.height=E[0].style.height=S[0].style.height=e.style.height}var n,r=0,i=0,o=g.offset(),u,a;N.unbind("resize."+s),g.css({top:-9e4,left:-9e4}),u=N.scrollTop(),a=N.scrollLeft(),B.fixed&&!d?(o.top-=u,o.left-=a,g.css({position:"fixed"})):(r=u,i=a,g.css({position:"absolute"})),B.right!==!1?i+=Math.max(tt()-B.w-q-F-Z(B.right,"x"),0):B.left!==!1?i+=Z(B.left,"x"):i+=Math.round(Math.max(tt()-B.w-q-F,0)/2),B.bottom!==!1?r+=Math.max(nt()-B.h-I-j-Z(B.bottom,"y"),0):B.top!==!1?r+=Z(B.top,"y"):r+=Math.round(Math.max(nt()-B.h-I-j,0)/2),g.css({top:o.top,left:o.left}),e=g.width()===B.w+q&&g.height()===B.h+I?0:e||0,y[0].style.width=y[0].style.height="9999px",n={width:B.w+q,height:B.h+I,top:r,left:i},e===0&&g.css(n),g.dequeue().animate(n,{duration:e,complete:function(){f(this),X=!1,y[0].style.width=B.w+q+F+"px",y[0].style.height=B.h+I+j+"px",B.reposition&&setTimeout(function(){N.bind("resize."+s,J.position)},1),t&&t()},step:function(){f(this)}})},J.resize=function(e){W&&(e=e||{},e.width&&(B.w=Z(e.width,"x")-q-F),e.innerWidth&&(B.w=Z(e.innerWidth,"x")),C.css({width:B.w}),e.height&&(B.h=Z(e.height,"y")-I-j),e.innerHeight&&(B.h=Z(e.innerHeight,"y")),!e.innerHeight&&!e.height&&(C.css({height:"auto"}),B.h=C.height()),C.css({height:B.h}),J.position(B.transition==="none"?0:B.speed))},J.prep=function(t){function o(){return B.w=B.w||C.width(),B.w=B.mw&&B.mw<B.w?B.mw:B.w,B.w}function u(){return B.h=B.h||C.height(),B.h=B.mh&&B.mh<B.h?B.mh:B.h,B.h}if(!W)return;var n,r=B.transition==="none"?0:B.speed;C.remove(),C=G(K,"LoadedContent").append(t),C.hide().appendTo(k.show()).css({width:o(),overflow:B.scrolling?"auto":"hidden"}).css({height:u()}).prependTo(b),k.hide(),e(z).css({"float":"none"}),d&&e("select").not(g.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(l,function(){this.style.visibility="inherit"}),n=function(){function y(){p&&g[0].style.removeAttribute("filter")}var t,n,o=T.length,u,a="frameBorder",l="allowTransparency",c,d,v,m;if(!W)return;c=function(){clearTimeout($),L.detach().hide(),it(f,B.onComplete)},p&&z&&C.fadeIn(100),A.html(B.title).add(C).show();if(o>1){typeof B.current=="string"&&O.html(B.current.replace("{current}",U+1).replace("{total}",o)).show(),_[B.loop||U<o-1?"show":"hide"]().html(B.next),D[B.loop||U?"show":"hide"]().html(B.previous),B.slideshow&&M.show();if(B.preloading){t=[Y(-1),Y(1)];while(n=T[t.pop()])m=e.data(n,i),m&&m.href?(d=m.href,e.isFunction(d)&&(d=d.call(n))):d=n.href,et(d)&&(v=new Image,v.src=d)}}else H.hide();B.iframe?(u=G("iframe")[0],a in u&&(u[a]=0),l in u&&(u[l]="true"),u.name=s+ +(new Date),B.fastIframe?c():e(u).one("load",c),u.src=B.href,B.scrolling||(u.scrolling="no"),e(u).addClass(s+"Iframe").appendTo(C).one(h,function(){u.src="//about:blank"})):c(),B.transition==="fade"?g.fadeTo(r,1,y):y()},B.transition==="fade"?g.fadeTo(r,0,function(){J.position(0,n)}):J.position(r,n)},J.load=function(t){var n,r,i=J.prep;X=!0,z=!1,R=T[U],t||rt(),it(h),it(a,B.onLoad),B.h=B.height?Z(B.height,"y")-I-j:B.innerHeight&&Z(B.innerHeight,"y"),B.w=B.width?Z(B.width,"x")-q-F:B.innerWidth&&Z(B.innerWidth,"x"),B.mw=B.w,B.mh=B.h,B.maxWidth&&(B.mw=Z(B.maxWidth,"x")-q-F,B.mw=B.w&&B.w<B.mw?B.w:B.mw),B.maxHeight&&(B.mh=Z(B.maxHeight,"y")-I-j,B.mh=B.h&&B.h<B.mh?B.h:B.mh),n=B.href,$=setTimeout(function(){L.show().appendTo(b)},100),B.inline?(G(K).hide().insertBefore(e(n)[0]).one(h,function(){e(this).replaceWith(C.children())}),i(e(n))):B.iframe?i(" "):B.html?i(B.html):et(n)?(e(z=new Image).addClass(s+"Photo").error(function(){B.title=!1,i(G(K,"Error").html(B.imgError))}).load(function(){var e;z.onload=null,B.scalePhotos&&(r=function(){z.height-=z.height*e,z.width-=z.width*e},B.mw&&z.width>B.mw&&(e=(z.width-B.mw)/z.width,r()),B.mh&&z.height>B.mh&&(e=(z.height-B.mh)/z.height,r())),B.h&&(z.style.marginTop=Math.max(B.h-z.height,0)/2+"px"),T[1]&&(B.loop||T[U+1])&&(z.style.cursor="pointer",z.onclick=function(){J.next()}),p&&(z.style.msInterpolationMode="bicubic"),setTimeout(function(){i(z)},1)}),setTimeout(function(){z.src=n},1)):n&&k.load(n,B.data,function(t,n,r){i(n==="error"?G(K,"Error").html(B.xhrError):e(this).contents())})},J.next=function(){!X&&T[1]&&(B.loop||T[U+1])&&(U=Y(1),J.load())},J.prev=function(){!X&&T[1]&&(B.loop||U)&&(U=Y(-1),J.load())},J.close=function(){W&&!V&&(V=!0,W=!1,it(l,B.onCleanup),N.unbind("."+s+" ."+v),m.fadeTo(200,0),g.stop().fadeTo(300,0,function(){g.add(m).css({opacity:1,cursor:"auto"}).hide(),it(h),C.remove(),setTimeout(function(){V=!1,it(c,B.onClosed)},1)}))},J.remove=function(){e([]).add(g).add(m).remove(),g=null,e("."+o).removeData(i).removeClass(o).die()},J.element=function(){return e(R)},J.settings=r})(jQuery,document,this);
lang/default.mo ADDED
Binary file
lang/default.po ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: wprss\n"
4
+ "POT-Creation-Date: 2012-09-25 12:09+0100\n"
5
+ "PO-Revision-Date: 2012-09-25 13:52+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.5.3\n"
12
+ "X-Poedit-KeywordsList: _;__;_e\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-SearchPath-0: .\n"
15
+
16
+ #: wp-rss-aggregator.php:152
17
+ msgid "Enter feed name here (e.g. WP Mayor)"
18
+ msgstr ""
19
+
20
+ #: wp-rss-aggregator.php:394
21
+ msgid "No feed items found"
22
+ msgstr ""
23
+
24
+ #: inc/activation.php:11
25
+ msgid "This plugin requires WordPress version 3.2 or higher."
26
+ msgstr ""
27
+
28
+ #: inc/admin-options.php:45 inc/admin-options.php:88
29
+ msgid "WP RSS Aggregator Settings"
30
+ msgstr ""
31
+
32
+ #: inc/admin-options.php:45
33
+ msgid "Settings"
34
+ msgstr ""
35
+
36
+ #: inc/admin-options.php:67
37
+ msgid "Open links behaviour"
38
+ msgstr ""
39
+
40
+ #: inc/admin-options.php:70
41
+ msgid "Set links as"
42
+ msgstr ""
43
+
44
+ #: inc/admin-options.php:73
45
+ msgid "Feed limit"
46
+ msgstr ""
47
+
48
+ #: inc/admin-options.php:93
49
+ msgid "Save Settings"
50
+ msgstr ""
51
+
52
+ #: inc/admin-options.php:113
53
+ msgid "No follow"
54
+ msgstr ""
55
+
56
+ #: inc/admin-options.php:114
57
+ msgid "Follow"
58
+ msgstr ""
59
+
60
+ #: inc/admin-options.php:132
61
+ msgid "Lightbox"
62
+ msgstr ""
63
+
64
+ #: inc/admin-options.php:133
65
+ msgid "New window"
66
+ msgstr ""
67
+
68
+ #: inc/admin-options.php:134
69
+ msgid "None"
70
+ msgstr ""
71
+
72
+ #: inc/cron-jobs.php:53
73
+ msgid "Once Weekly"
74
+ msgstr ""
75
+
76
+ #: inc/custom-post-types.php:30
77
+ msgid "Feed Sources"
78
+ msgstr ""
79
+
80
+ #: inc/custom-post-types.php:31
81
+ msgid "Feed"
82
+ msgstr ""
83
+
84
+ #: inc/custom-post-types.php:32 inc/custom-post-types.php:34
85
+ msgid "Add New Feed Source"
86
+ msgstr ""
87
+
88
+ #: inc/custom-post-types.php:33
89
+ msgid "All Feed Sources"
90
+ msgstr ""
91
+
92
+ #: inc/custom-post-types.php:35
93
+ msgid "Edit Feed Source"
94
+ msgstr ""
95
+
96
+ #: inc/custom-post-types.php:36
97
+ msgid "New Feed Source"
98
+ msgstr ""
99
+
100
+ #: inc/custom-post-types.php:37
101
+ msgid "View Feed Source"
102
+ msgstr ""
103
+
104
+ #: inc/custom-post-types.php:38
105
+ msgid "Search Feeds"
106
+ msgstr ""
107
+
108
+ #: inc/custom-post-types.php:39
109
+ msgid "No Feed Sources Found"
110
+ msgstr ""
111
+
112
+ #: inc/custom-post-types.php:40
113
+ msgid "No Feed Sources Found In Trash"
114
+ msgstr ""
115
+
116
+ #: inc/custom-post-types.php:41
117
+ msgid "RSS Aggregator"
118
+ msgstr ""
119
+
120
+ #: inc/custom-post-types.php:58 inc/custom-post-types.php:60
121
+ msgid "Imported Feeds"
122
+ msgstr ""
123
+
124
+ #: inc/custom-post-types.php:59
125
+ msgid "Imported Feed"
126
+ msgstr ""
127
+
128
+ #: inc/custom-post-types.php:61
129
+ msgid "View Imported Feed"
130
+ msgstr ""
131
+
132
+ #: inc/custom-post-types.php:62
133
+ msgid "Search Imported Feeds"
134
+ msgstr ""
135
+
136
+ #: inc/custom-post-types.php:63
137
+ msgid "No Imported Feeds Found"
138
+ msgstr ""
139
+
140
+ #: inc/custom-post-types.php:64
141
+ msgid "No Imported Feeds Found In Trash"
142
+ msgstr ""
143
+
144
+ #: inc/custom-post-types.php:83 inc/custom-post-types.php:135
145
+ msgid "Name"
146
+ msgstr ""
147
+
148
+ #: inc/custom-post-types.php:84 inc/custom-post-types.php:306
149
+ msgid "URL"
150
+ msgstr ""
151
+
152
+ #: inc/custom-post-types.php:85 inc/custom-post-types.php:313
153
+ msgid "Description"
154
+ msgstr ""
155
+
156
+ #: inc/custom-post-types.php:136
157
+ msgid "Permalink"
158
+ msgstr ""
159
+
160
+ #: inc/custom-post-types.php:137
161
+ msgid "Date published"
162
+ msgstr ""
163
+
164
+ #: inc/custom-post-types.php:138
165
+ msgid "Source"
166
+ msgstr ""
167
+
168
+ #: inc/custom-post-types.php:226
169
+ msgid "Save Feed Source"
170
+ msgstr ""
171
+
172
+ #: inc/custom-post-types.php:252
173
+ msgid "WP RSS Aggregator Help"
174
+ msgstr ""
175
+
176
+ #: inc/custom-post-types.php:261
177
+ msgid "Like this plugin?"
178
+ msgstr ""
179
+
180
+ #: inc/custom-post-types.php:270
181
+ msgid "Follow us"
182
+ msgstr ""
183
+
184
+ #: inc/custom-post-types.php:279
185
+ msgid "Feed Source Details"
186
+ msgstr ""
187
+
188
+ #: inc/custom-post-types.php:288
189
+ msgid "Feed Preview"
190
+ msgstr ""
191
+
192
+ #: inc/custom-post-types.php:307
193
+ msgid "Enter feed URL (including http://)"
194
+ msgstr ""
195
+
196
+ #: inc/custom-post-types.php:314
197
+ msgid "A short description about this feed source (optional)"
198
+ msgstr ""
199
+
200
+ #: inc/custom-post-types.php:438
201
+ msgid "Delete Permanently"
202
+ msgstr ""
203
+
204
+ #: inc/custom-post-types.php:440
205
+ msgid "Move to Trash"
206
+ msgstr ""
207
+
208
+ #: inc/custom-post-types.php:471
209
+ msgid ""
210
+ "<strong>Invalid feed URL</strong> - Double check the feed source URL setting "
211
+ "above."
212
+ msgstr ""
213
+
214
+ #: inc/custom-post-types.php:474
215
+ msgid "No feed URL defined yet"
216
+ msgstr ""
217
+
218
+ #: inc/custom-post-types.php:486
219
+ msgid "Need help?"
220
+ msgstr ""
221
+
222
+ #: inc/custom-post-types.php:488
223
+ msgid "Check out the support forum"
224
+ msgstr ""
225
+
226
+ #: inc/custom-post-types.php:499
227
+ msgid "Why not do any or all of the following"
228
+ msgstr ""
229
+
230
+ #: inc/custom-post-types.php:501
231
+ msgid "Give it a 5 star rating on WordPress.org."
232
+ msgstr ""
233
+
234
+ #: inc/custom-post-types.php:502
235
+ msgid "Donate a token of your appreciation."
236
+ msgstr ""
237
+
238
+ #: inc/custom-post-types.php:517
239
+ msgid "Follow WP Mayor on Twitter."
240
+ msgstr ""
241
+
242
+ #: inc/custom-post-types.php:518
243
+ msgid "Like WP Mayor on Facebook."
244
+ msgstr ""
245
+
246
+ #: inc/custom-post-types.php:535
247
+ msgid "Feed source updated. "
248
+ msgstr ""
249
+
250
+ #: inc/custom-post-types.php:536
251
+ msgid "Custom field updated."
252
+ msgstr ""
253
+
254
+ #: inc/custom-post-types.php:537
255
+ msgid "Custom field deleted."
256
+ msgstr ""
257
+
258
+ #: inc/custom-post-types.php:538 inc/custom-post-types.php:544
259
+ msgid "Feed source updated."
260
+ msgstr ""
261
+
262
+ #: inc/custom-post-types.php:540 inc/custom-post-types.php:541
263
+ msgid "Feed source saved."
264
+ msgstr ""
265
+
266
+ #: inc/custom-post-types.php:542
267
+ msgid "Feed source submitted."
268
+ msgstr ""
269
+
270
+ #: inc/custom-post-types.php:628
271
+ msgid "Publish Feed"
272
+ msgstr ""
lang/it.mo ADDED
Binary file
lang/it.po ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: wprss\n"
4
+ "POT-Creation-Date: 2012-09-25 12:09+0100\n"
5
+ "PO-Revision-Date: 2012-09-30 11:18+0100\n"
6
+ "Last-Translator: Davide De Maestri <davide.demaestri@gmail.com>\n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.5.3\n"
12
+ "X-Poedit-KeywordsList: _;__;_e\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-SearchPath-0: .\n"
15
+
16
+ #: wp-rss-aggregator.php:152
17
+ msgid "Enter feed name here (e.g. WP Mayor)"
18
+ msgstr "Inserisci il nome del feed qui (es: WP Mayor)"
19
+
20
+ #: wp-rss-aggregator.php:394
21
+ msgid "No feed items found"
22
+ msgstr "Nessun feed trovato"
23
+
24
+ #: inc/activation.php:11
25
+ msgid "This plugin requires WordPress version 3.2 or higher."
26
+ msgstr "Questo plugin richiede la versione di WordPress 3.2 o superiore"
27
+
28
+ #: inc/admin-options.php:45 inc/admin-options.php:88
29
+ msgid "WP RSS Aggregator Settings"
30
+ msgstr "Impostazioni WP RSS Aggregator"
31
+
32
+ #: inc/admin-options.php:45
33
+ msgid "Settings"
34
+ msgstr "Impostazioni"
35
+
36
+ #: inc/admin-options.php:67
37
+ msgid "Open links behaviour"
38
+ msgstr "Comportamento di apertura dei links"
39
+
40
+ #: inc/admin-options.php:70
41
+ msgid "Set links as"
42
+ msgstr "Imposta links come"
43
+
44
+ #: inc/admin-options.php:73
45
+ msgid "Feed limit"
46
+ msgstr "Limite Feed"
47
+
48
+ #: inc/admin-options.php:93
49
+ msgid "Save Settings"
50
+ msgstr "Salva impostazioni"
51
+
52
+ #: inc/admin-options.php:113
53
+ msgid "No follow"
54
+ msgstr "No follow"
55
+
56
+ #: inc/admin-options.php:114
57
+ msgid "Follow"
58
+ msgstr "Follow"
59
+
60
+ #: inc/admin-options.php:132
61
+ msgid "Lightbox"
62
+ msgstr "Lightbox"
63
+
64
+ #: inc/admin-options.php:133
65
+ msgid "New window"
66
+ msgstr "Nuova finestra"
67
+
68
+ #: inc/admin-options.php:134
69
+ msgid "None"
70
+ msgstr "Nessuno"
71
+
72
+ #: inc/cron-jobs.php:53
73
+ msgid "Once Weekly"
74
+ msgstr "Una volta alla settimana"
75
+
76
+ #: inc/custom-post-types.php:30
77
+ msgid "Feed Sources"
78
+ msgstr "Sorgenti Feed"
79
+
80
+ #: inc/custom-post-types.php:31
81
+ msgid "Feed"
82
+ msgstr "Feed"
83
+
84
+ #: inc/custom-post-types.php:32 inc/custom-post-types.php:34
85
+ msgid "Add New Feed Source"
86
+ msgstr "Aggiungi nuova sorgente Feed"
87
+
88
+ #: inc/custom-post-types.php:33
89
+ msgid "All Feed Sources"
90
+ msgstr "Tutte le sorgenti feed"
91
+
92
+ #: inc/custom-post-types.php:35
93
+ msgid "Edit Feed Source"
94
+ msgstr "Modifica sorgente feed"
95
+
96
+ #: inc/custom-post-types.php:36
97
+ msgid "New Feed Source"
98
+ msgstr "Nuova sorgente feed"
99
+
100
+ #: inc/custom-post-types.php:37
101
+ msgid "View Feed Source"
102
+ msgstr "Visualizza sorgente feed"
103
+
104
+ #: inc/custom-post-types.php:38
105
+ msgid "Search Feeds"
106
+ msgstr "Cerca feeds"
107
+
108
+ #: inc/custom-post-types.php:39
109
+ msgid "No Feed Sources Found"
110
+ msgstr "Nessuna sorgente di feed trovata"
111
+
112
+ #: inc/custom-post-types.php:40
113
+ msgid "No Feed Sources Found In Trash"
114
+ msgstr "Nessuna sorgente di feed trovata nel cestino"
115
+
116
+ #: inc/custom-post-types.php:41
117
+ msgid "RSS Aggregator"
118
+ msgstr "Aggregatore RSS"
119
+
120
+ #: inc/custom-post-types.php:58 inc/custom-post-types.php:60
121
+ msgid "Imported Feeds"
122
+ msgstr "Feeds importati"
123
+
124
+ #: inc/custom-post-types.php:59
125
+ msgid "Imported Feed"
126
+ msgstr "Feed importato"
127
+
128
+ #: inc/custom-post-types.php:61
129
+ msgid "View Imported Feed"
130
+ msgstr "Visualizza feed importato"
131
+
132
+ #: inc/custom-post-types.php:62
133
+ msgid "Search Imported Feeds"
134
+ msgstr "Cerca feeds importati"
135
+
136
+ #: inc/custom-post-types.php:63
137
+ msgid "No Imported Feeds Found"
138
+ msgstr "Nessun feed importato trovato"
139
+
140
+ #: inc/custom-post-types.php:64
141
+ msgid "No Imported Feeds Found In Trash"
142
+ msgstr "Nessun feed importato trovato nel cestino"
143
+
144
+ #: inc/custom-post-types.php:83 inc/custom-post-types.php:135
145
+ msgid "Name"
146
+ msgstr "Nome"
147
+
148
+ #: inc/custom-post-types.php:84 inc/custom-post-types.php:306
149
+ msgid "URL"
150
+ msgstr "URL"
151
+
152
+ #: inc/custom-post-types.php:85 inc/custom-post-types.php:313
153
+ msgid "Description"
154
+ msgstr "Descrizione"
155
+
156
+ #: inc/custom-post-types.php:136
157
+ msgid "Permalink"
158
+ msgstr "Permalink"
159
+
160
+ #: inc/custom-post-types.php:137
161
+ msgid "Date published"
162
+ msgstr "Data di pubblicazione"
163
+
164
+ #: inc/custom-post-types.php:138
165
+ msgid "Source"
166
+ msgstr "Sorgente"
167
+
168
+ #: inc/custom-post-types.php:226
169
+ msgid "Save Feed Source"
170
+ msgstr "Salva sorgente feed"
171
+
172
+ #: inc/custom-post-types.php:252
173
+ msgid "WP RSS Aggregator Help"
174
+ msgstr "Aiuto WP RSS Aggregator"
175
+
176
+ #: inc/custom-post-types.php:261
177
+ msgid "Like this plugin?"
178
+ msgstr "Ti piace questo plugin?"
179
+
180
+ #: inc/custom-post-types.php:270
181
+ msgid "Follow us"
182
+ msgstr "Seguici"
183
+
184
+ #: inc/custom-post-types.php:279
185
+ msgid "Feed Source Details"
186
+ msgstr "Dettagli sorgente feed"
187
+
188
+ #: inc/custom-post-types.php:288
189
+ msgid "Feed Preview"
190
+ msgstr "Anteprima Feed"
191
+
192
+ #: inc/custom-post-types.php:307
193
+ msgid "Enter feed URL (including http://)"
194
+ msgstr "Inserisci l'URL del feed (includi http://)"
195
+
196
+ #: inc/custom-post-types.php:314
197
+ msgid "A short description about this feed source (optional)"
198
+ msgstr "Una breve descrizione di questa sorgente feed (opzionale)"
199
+
200
+ #: inc/custom-post-types.php:438
201
+ msgid "Delete Permanently"
202
+ msgstr "Elimina permanentemente"
203
+
204
+ #: inc/custom-post-types.php:440
205
+ msgid "Move to Trash"
206
+ msgstr "Sposta nel cestino"
207
+
208
+ #: inc/custom-post-types.php:471
209
+ msgid ""
210
+ "<strong>Invalid feed URL</strong> - Double check the feed source URL setting "
211
+ "above."
212
+ msgstr ""
213
+ "<strong>URL del feed non valido</strong> - Ricontrolla l'URL della sorgente "
214
+ "del feed nelle impostazioni sopra."
215
+
216
+ #: inc/custom-post-types.php:474
217
+ msgid "No feed URL defined yet"
218
+ msgstr "Nessun URL del feed ancora definito"
219
+
220
+ #: inc/custom-post-types.php:486
221
+ msgid "Need help?"
222
+ msgstr "Hai bisogno di aiuto?"
223
+
224
+ #: inc/custom-post-types.php:488
225
+ msgid "Check out the support forum"
226
+ msgstr "Controlla il forum di supporto"
227
+
228
+ #: inc/custom-post-types.php:499
229
+ msgid "Why not do any or all of the following"
230
+ msgstr "Perchè non fare alcuna o tutte delle seguenti cose"
231
+
232
+ #: inc/custom-post-types.php:501
233
+ msgid "Give it a 5 star rating on WordPress.org."
234
+ msgstr "Dare 5 stelle su WordPress.org"
235
+
236
+ #: inc/custom-post-types.php:502
237
+ msgid "Donate a token of your appreciation."
238
+ msgstr "Donare una moneta come ringraziamento."
239
+
240
+ #: inc/custom-post-types.php:517
241
+ msgid "Follow WP Mayor on Twitter."
242
+ msgstr "Segui WP Mayor su Twitter"
243
+
244
+ #: inc/custom-post-types.php:518
245
+ msgid "Like WP Mayor on Facebook."
246
+ msgstr "Segui WP Mayor su Facebook"
247
+
248
+ #: inc/custom-post-types.php:535
249
+ msgid "Feed source updated. "
250
+ msgstr "Sorgente feed aggiornata."
251
+
252
+ #: inc/custom-post-types.php:536
253
+ msgid "Custom field updated."
254
+ msgstr "Campo personalizzato aggiornato."
255
+
256
+ #: inc/custom-post-types.php:537
257
+ msgid "Custom field deleted."
258
+ msgstr "Campo personalizzato cancellato."
259
+
260
+ #: inc/custom-post-types.php:538 inc/custom-post-types.php:544
261
+ msgid "Feed source updated."
262
+ msgstr "Sorgente feed aggiornata."
263
+
264
+ #: inc/custom-post-types.php:540 inc/custom-post-types.php:541
265
+ msgid "Feed source saved."
266
+ msgstr "Sorgente feed salvata."
267
+
268
+ #: inc/custom-post-types.php:542
269
+ msgid "Feed source submitted."
270
+ msgstr "Sorgente feed inviata."
271
+
272
+ #: inc/custom-post-types.php:628
273
+ msgid "Publish Feed"
274
+ msgstr "Pubblica Feed"
readme.txt ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP RSS Aggregator ===
2
+ Contributors: jeangalea
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ
4
+ Plugin URI: http://www.wprssaggregator.com
5
+ Tags: rss, feeds, aggregation, aggregator, import, feed aggregator, rss aggregator, multiple rss feeds, multi rss feeds, multi rss, rss import, feed import, feed import, multiple feed import, feed aggregation, multiple feeds
6
+ Requires at least: 3.3
7
+ Tested up to: 3.4
8
+ Stable tag: 2.2
9
+ Imports and merges multiple RSS Feeds using SimplePie. Outputs feeds sorted by date (latest first).
10
+
11
+ == Description ==
12
+
13
+ WP RSS Aggregator helps you create a feed reader on your WordPress site. It works in a similar fashion to RSS readers like for example Netvibes.
14
+ You can add any number of feeds through an administration panel, the plugin will then pull all the feeds from these sites, merge them and sort them by date.
15
+
16
+ The plugin uses SimplePie for the feed operations. The actual news feeds are not stored in your databases but only cached for faster response times.
17
+ You can call the function from within the theme or even use a shortcode with parameters.
18
+
19
+ = Demo =
20
+ The plugin can be seen in use on the [WPMayor.com WordPress News page](http://www.wpmayor.com/wordpress-news/)
21
+
22
+ = Credit =
23
+ Created by Jean Galea. Need a [WordPress Freelance Developer](http://www.jeangalea.com/services/wordpress-consultancy-development/)?
24
+
25
+ = Translations =
26
+ Italian - Davide De Maestri
27
+
28
+ == Installation ==
29
+
30
+ 1. Upload the `wp-rss-aggregator` folder to the `/wp-content/plugins/` directory
31
+ 2. Activate the WP RSS Aggregator plugin through the 'Plugins' menu in WordPress
32
+ 3. Configure the plugin by going to the `RSS Aggregator` menu item that appears in your dashboard menu.
33
+ 3. Use the shortcode in your posts or pages: `[wp_rss_aggregator]`
34
+
35
+ The parameters accepted are:
36
+
37
+ * links_before
38
+ * links_after
39
+ * link_before
40
+ * link_after
41
+
42
+ An example of a shortcode with parameters:
43
+ `[wp_rss_aggregator link_before='<li class="feed-link">' link_after='</li>']`
44
+ It is advisable to use the 'HTML' view of the editor when inserting the shortcode with paramters.
45
+
46
+ An example of a function call from within the template files:
47
+ `
48
+ <?php
49
+ wprss_display_feed_items( $args = array(
50
+ 'links_before' => '<ul>',
51
+ 'links_after' => '</ul>',
52
+ 'link_before' => '<li>',
53
+ 'link_after' => '</li>'
54
+ ));
55
+ ?>
56
+ `
57
+
58
+ OR
59
+
60
+ `<?php do_shortcode('[wp-rss-aggregator]'); ?>`
61
+
62
+ You can also set whether the feed links should open in a new window, current window or even a lightbox, via the settings panel.
63
+
64
+ The settings panel also has an option to set links as nofollow for SEO purposes.
65
+
66
+ Since version 2.0 you can also specify the number of feed items shown on the frontend.
67
+
68
+ == Frequently Asked Questions ==
69
+ = How can I output the feeds in my theme? =
70
+
71
+ You can either call the function directly within the theme:
72
+ `<?php wprss_display_feed_items(); ?>`
73
+
74
+ Or use the shortcode in your posts and pages:
75
+ [wp_rss_aggregator]
76
+
77
+ == Screenshots ==
78
+
79
+ 1. The output of this plugin on the frontend, as seen on www.wpmayor.com.
80
+
81
+ 2. Feed sources list.
82
+
83
+ 3. Adding a new feed source.
84
+
85
+ 4. Imported feeds.
86
+
87
+ 5. Plugin settings page.
88
+
89
+ == Changelog ==
90
+
91
+ = Version 2.2.1 (2012-10-17) =
92
+ * Fixed bug: wprss_feed_source_order assumes everyone is an admin
93
+
94
+ = Version 2.2 (2012-10-01) =
95
+ * Italian translation added
96
+ * Feed source order changed to alphabetical
97
+ * Fixed bug - repeated entries when having a non-valid feed source
98
+ * Fixed bug - all imported feeds deleted upon trashing a single feed source
99
+
100
+ = Version 2.1 (2012-09-27) =
101
+ * Now localised for translations
102
+ * Fixed bug with date string
103
+ * Fixed $link_before and $link_after, now working
104
+ * Added backwards compatibility for wp_rss_aggregator() function
105
+
106
+ = Version 2.0 (2012-09-21) =
107
+ * Bulk of code rewritten and refactored
108
+ * Added install and upgrade functions
109
+ * Added DB version setting
110
+ * Feed sources now stored as Custom Post Types
111
+ * Feed source list sortable ascending or descending by name
112
+ * Removed days subsections in feed display
113
+ * Ability to limit total number of feeds displayed
114
+ * Feeds now fetched via Cron
115
+ * Cron job to delete old feed items, keeps max of 50 items in DB
116
+ * Now requires WordPress 3.2
117
+ * Updated colorbox to v1.3.20.1
118
+ * Limit of 15 items max imported for each source
119
+ * Fixed issue of page content displaying incorrectly after feeds
120
+
121
+
122
+ = Version 1.1 (2012-08-13) =
123
+ * Now requires WordPress 3.0
124
+ * More flexible fetching of images directory
125
+ * Has its own top level menu item
126
+ * Added settings section
127
+ * Ability to open in lightbox, new window or default browser behaviour
128
+ * Ability to set links as follow or no follow
129
+ * Using constants for oftenly used locations
130
+ * Code refactoring
131
+ * Changes in file and folder structure
132
+
133
+
134
+ = Version 1.0 (2012-01-06) =
135
+ * Initial release.
uninstall.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // If uninstall not called from WordPress exit
3
+ if( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
4
+ exit ();
5
+
6
+ // Delete option from options table
7
+ delete_option( 'wprss_options' );
8
+ delete_option( 'wprss_settings' );
9
+ delete_option( 'wprss_db_version' );
10
+
wp-rss-aggregator.php ADDED
@@ -0,0 +1,502 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP RSS Aggregator
4
+ Plugin URI: http://www.wprssaggregator.com
5
+ Description: Imports and merges multiple RSS Feeds using SimplePie
6
+ Version: 2.2.1
7
+ Author: Jean Galea
8
+ Author URI: http://www.jeangalea.com
9
+ License: GPLv3
10
+ */
11
+
12
+ /*
13
+ Copyright 2011-2012 Jean Galea (email : jean@jpgalea.com)
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License as published by
16
+ the Free Software Foundation; either version 2 of the License, or
17
+ (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program; if not, write to the Free Software
26
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
+ */
28
+
29
+ /*
30
+ @version 2.2.1
31
+ @author Jean Galea <info@jeangalea.com>
32
+ @copyright Copyright (c) 2012, Jean Galea
33
+ @link http://www.jeangalea.com/
34
+ @license http://www.gnu.org/licenses/gpl.html
35
+ */
36
+
37
+
38
+ /**
39
+ * Define constants used by the plugin.
40
+ *
41
+ * We're not checking if constants are defined before setting them, as the prefix 'wprss' pretty
42
+ * much eliminates the possibility of them being set before. If there is a reasonable chance
43
+ * that they would have been set earlier or by another plugin, it's better to check before
44
+ * setting them via if !(defined).
45
+ *
46
+ */
47
+
48
+ /* Set the version number of the plugin. */
49
+ define( 'WPRSS_VERSION', '2.2.1', true );
50
+
51
+ /* Set the database version number of the plugin. */
52
+ define( 'WPRSS_DB_VERSION', 2 );
53
+
54
+ /* Set the plugin prefix */
55
+ define( 'WPRSS_PREFIX', 'wprss', true );
56
+
57
+ /* Set constant path to the plugin directory. */
58
+ define( 'WPRSS_DIR', plugin_dir_path( __FILE__ ) );
59
+
60
+ /* Set constant URI to the plugin URL. */
61
+ define( 'WPRSS_URI', plugin_dir_url( __FILE__ ) );
62
+
63
+ /* Set the constant path to the plugin's javascript directory. */
64
+ define( 'WPRSS_JS', WPRSS_URI . trailingslashit( 'js' ), true );
65
+
66
+ /* Set the constant path to the plugin's CSS directory. */
67
+ define( 'WPRSS_CSS', WPRSS_URI . trailingslashit( 'css' ), true );
68
+
69
+ /* Set the constant path to the plugin's images directory. */
70
+ define( 'WPRSS_IMG', WPRSS_URI . trailingslashit( 'img' ), true );
71
+
72
+ /* Set the constant path to the plugin's includes directory. */
73
+ define( 'WPRSS_INC', WPRSS_DIR . trailingslashit( 'inc' ), true );
74
+
75
+
76
+ /**
77
+ * Load required files.
78
+ */
79
+
80
+ /* Load the activation functions file. */
81
+ require_once ( WPRSS_INC . 'activation.php' );
82
+
83
+ /* Load the deactivation functions file. */
84
+ require_once ( WPRSS_INC . 'deactivation.php' );
85
+
86
+ /* Load install, upgrade and migration code. */
87
+ require_once ( WPRSS_INC . 'update.php' );
88
+
89
+ /* Load the shortcodes functions file. */
90
+ require_once ( WPRSS_INC . 'shortcodes.php' );
91
+
92
+ /* Load the admin functions file. */
93
+ require_once ( WPRSS_INC . 'admin-options.php' );
94
+
95
+ /* Load the custom post types and taxonomies. */
96
+ require_once ( WPRSS_INC . 'custom-post-types.php' );
97
+
98
+ /* Load the cron job scheduling functions. */
99
+ require_once ( WPRSS_INC . 'cron-jobs.php' );
100
+
101
+ add_action( 'init', 'wprss_schedule_fetch_feeds_cron' );
102
+ add_action( 'init', 'wprss_schedule_truncate_posts_cron' );
103
+
104
+
105
+ add_action( 'init', 'wprss_init' );
106
+ /**
107
+ * Initialise the plugin
108
+ *
109
+ * @since 2.0
110
+ */
111
+ function wprss_init() {
112
+ register_activation_hook( WPRSS_INC . 'activation.php', 'wprss_activate' );
113
+ register_deactivation_hook( WPRSS_INC . 'deactivation.php', 'wprss_deactivate' );
114
+ } // end wprss_int
115
+
116
+
117
+ add_action( 'plugins_loaded', 'wprss_load_textdomain' );
118
+ /**
119
+ * Loads the plugin's translated strings.
120
+ *
121
+ * @since 2.1
122
+ */
123
+ function wprss_load_textdomain() {
124
+ load_plugin_textdomain( 'wprss', false, plugin_basename( __FILE__ ) . '/lang/' );
125
+ }
126
+
127
+
128
+ add_action( 'admin_enqueue_scripts', 'wprss_admin_scripts_styles' );
129
+ /**
130
+ * Insert required scripts, styles and filters on the admin side
131
+ *
132
+ * @since 2.0
133
+ */
134
+ function wprss_admin_scripts_styles() {
135
+ // Only load scripts if we are on this plugin's options or settings pages (admin)
136
+ if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'wprss-aggregator' || $_GET['page'] == 'wprss-aggregator-settings' ) ) {
137
+ wp_enqueue_style( 'styles', WPRSS_CSS . 'styles.css' );
138
+ }
139
+
140
+ // Only load scripts if we are on wprss_feed add post or edit post screens
141
+ $screen = get_current_screen();
142
+
143
+ if ( ( 'post' === $screen->base || 'edit' === $screen->base ) && ( 'wprss_feed' === $screen->post_type || 'wprss_feed_item' === $screen->post_type ) ) {
144
+ wp_enqueue_style( 'styles', WPRSS_CSS . 'styles.css' );
145
+ if ( 'post' === $screen->base && 'wprss_feed' === $screen->post_type ) {
146
+ // Change text on post screen from 'Enter title here' to 'Enter feed name here'
147
+ add_filter( 'enter_title_here', 'wprss_change_title_text' );
148
+ }
149
+ }
150
+ } // end wprss_admin_scripts_styles
151
+
152
+
153
+ /**
154
+ * Change title on wprss_feed post type screen
155
+ *
156
+ * @since 2.0
157
+ */
158
+ function wprss_change_title_text() {
159
+ return __( 'Enter feed name here (e.g. WP Mayor)', 'wprss' );
160
+ } // end wprss_change_title_text
161
+
162
+
163
+ add_action( 'wp_head', 'wprss_head_scripts_styles' );
164
+ /**
165
+ * Scripts and styles to be inserted into <head> section in front end
166
+ *
167
+ * @since 2.0
168
+ */
169
+ function wprss_head_scripts_styles() {
170
+ wp_enqueue_style( 'colorbox', WPRSS_CSS . 'colorbox.css' );
171
+ wp_enqueue_script( 'jquery.colorbox-min', WPRSS_JS .'jquery.colorbox-min.js', array('jquery') );
172
+ wp_enqueue_script( 'custom', WPRSS_JS .'custom.js', array('jquery','jquery.colorbox-min') );
173
+ } // end wprss_head_scripts_styles
174
+
175
+
176
+ /**
177
+ * Change the default feed cache recreation period to 2 hours
178
+ *
179
+ * @since 2.1
180
+ */
181
+ function wprss_return_7200( $seconds )
182
+ {
183
+ return 7200;
184
+ }
185
+
186
+
187
+ /**
188
+ * Fetches feed items from sources provided
189
+ *
190
+ * @since 2.0
191
+ */
192
+ function wprss_fetch_all_feed_items( ) {
193
+
194
+ // Get all feed sources
195
+ $feed_sources = new WP_Query( array(
196
+ 'post_type' => 'wprss_feed',
197
+ 'post_status' => 'publish',
198
+ 'posts_per_page' => -1,
199
+ ) );
200
+
201
+ if( $feed_sources->have_posts() ) {
202
+ /* Start by getting one feed source, we will cycle through them one by one,
203
+ fetching feed items and adding them to the database in each pass */
204
+ while ( $feed_sources->have_posts() ) {
205
+ $feed_sources->the_post();
206
+
207
+ $feed_ID = get_the_ID();
208
+ $feed_url = get_post_meta( get_the_ID(), 'wprss_url', true );
209
+
210
+ // Use the URL custom field to fetch the feed items for this source
211
+ if( !empty( $feed_url ) ) {
212
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
213
+ $feed = fetch_feed( $feed_url );
214
+ remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
215
+ if ( !is_wp_error( $feed ) ) {
216
+ // Figure out how many total items there are, but limit it to 10.
217
+ $maxitems = $feed->get_item_quantity(10);
218
+
219
+ // Build an array of all the items, starting with element 0 (first element).
220
+ $items = $feed->get_items( 0, $maxitems );
221
+ }
222
+ else { return; }
223
+ }
224
+
225
+ if ( ! empty( $items ) ) {
226
+ // Gather the permalinks of existing feed item's related to this feed source
227
+ global $wpdb;
228
+ $existing_permalinks = $wpdb->get_col(
229
+ "SELECT meta_value
230
+ FROM $wpdb->postmeta
231
+ WHERE meta_key = 'wprss_item_permalink'
232
+ AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID)
233
+ ");
234
+
235
+ foreach ( $items as $item ) {
236
+
237
+ // Check if newly fetched item already present in existing feed item item,
238
+ // if not insert it into wp_posts and insert post meta.
239
+ if ( ! ( in_array( $item->get_permalink(), $existing_permalinks ) ) ) {
240
+ // Create post object
241
+ $feed_item = array(
242
+ 'post_title' => $item->get_title(),
243
+ 'post_content' => '',
244
+ 'post_status' => 'publish',
245
+ 'post_type' => 'wprss_feed_item'
246
+ );
247
+ $inserted_ID = wp_insert_post( $feed_item );
248
+
249
+ update_post_meta( $inserted_ID, 'wprss_item_permalink', $item->get_permalink() );
250
+ update_post_meta( $inserted_ID, 'wprss_item_description', $item->get_description() );
251
+ update_post_meta( $inserted_ID, 'wprss_item_date', $item->get_date( 'U' ) ); // Save as Unix timestamp format
252
+ update_post_meta( $inserted_ID, 'wprss_feed_id', $feed_ID);
253
+ } //end if
254
+ } //end foreach
255
+ } // end if
256
+ } // end $feed_sources while loop
257
+ wp_reset_postdata(); // Restore the $post global to the current post in the main query
258
+ // } // end if
259
+ } // end if
260
+ } // end wprss_fetch_all_feed_items
261
+
262
+
263
+ add_action('wp_insert_post', 'wprss_fetch_feed_items');
264
+ /**
265
+ * Fetches feed items from sources provided
266
+ *
267
+ * @since 2.0
268
+ */
269
+ function wprss_fetch_feed_items( $post_id ) {
270
+
271
+ // Get current post that triggered the hook, $post_id passed via the hook
272
+ $post = get_post( $post_id );
273
+
274
+ if( ( $post->post_type == 'wprss_feed' ) && ( $post->post_status == 'publish' ) ) {
275
+
276
+ // Get all feed sources
277
+ $feed_sources = new WP_Query( array(
278
+ 'post_type' => 'wprss_feed',
279
+ 'post_status' => 'publish',
280
+ 'posts_per_page' => -1,
281
+ ) );
282
+
283
+ if( $feed_sources->have_posts() ) {
284
+ // Start by getting one feed source, we will cycle through them one by one,
285
+ // fetching feed items and adding them to the database in each pass
286
+ while ( $feed_sources->have_posts() ) {
287
+ $feed_sources->the_post();
288
+
289
+ $feed_ID = get_the_ID();
290
+ $feed_url = get_post_meta( get_the_ID(), 'wprss_url', true );
291
+
292
+ // Use the URL custom field to fetch the feed items for this source
293
+ if( !empty( $feed_url ) ) {
294
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
295
+ $feed = fetch_feed( $feed_url );
296
+ remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
297
+ if ( !is_wp_error( $feed ) ) {
298
+ // Figure out how many total items there are, but limit it to 10.
299
+ $maxitems = $feed->get_item_quantity(10);
300
+
301
+ // Build an array of all the items, starting with element 0 (first element).
302
+ $items = $feed->get_items( 0, $maxitems );
303
+ }
304
+ else { return; }
305
+ }
306
+
307
+ if ( ! empty( $items ) ) {
308
+ // Gather the permalinks of existing feed item's related to this feed source
309
+ global $wpdb;
310
+ $existing_permalinks = $wpdb->get_col(
311
+ "SELECT meta_value
312
+ FROM $wpdb->postmeta
313
+ WHERE meta_key = 'wprss_item_permalink'
314
+ AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID)
315
+ ");
316
+
317
+ foreach ( $items as $item ) {
318
+
319
+ // Check if newly fetched item already present in existing feed item item,
320
+ // if not insert it into wp_postsm and insert post meta.
321
+ if ( ! ( in_array( $item->get_permalink(), $existing_permalinks ) ) ) {
322
+ // Create post object
323
+ $feed_item = array(
324
+ 'post_title' => $item->get_title(),
325
+ 'post_content' => '',
326
+ 'post_status' => 'publish',
327
+ 'post_type' => 'wprss_feed_item'
328
+ );
329
+ $inserted_ID = wp_insert_post( $feed_item );
330
+
331
+ update_post_meta( $inserted_ID, 'wprss_item_permalink', $item->get_permalink() );
332
+ update_post_meta( $inserted_ID, 'wprss_item_description', $item->get_description() );
333
+ update_post_meta( $inserted_ID, 'wprss_item_date', $item->get_date( 'U' ) ); // Save as Unix timestamp format
334
+ update_post_meta( $inserted_ID, 'wprss_feed_id', $feed_ID);
335
+ } //end if
336
+ } //end foreach
337
+ } // end if
338
+ } // end $feed_sources while loop
339
+ wp_reset_postdata(); // Restore the $post global to the current post in the main query
340
+ } // end if
341
+ } // end if
342
+ } // end wprss_fetch_feed_items
343
+
344
+
345
+ /**
346
+ * Redirects to wprss_display_feed_items
347
+ * It is used for backwards compatibility to versions < 2.0
348
+ *
349
+ * @since 2.1
350
+ */
351
+ function wp_rss_aggregator( $args = array() ) {
352
+ wprss_display_feed_items( $args );
353
+ }
354
+
355
+
356
+ /**
357
+ * Display feed items on the front end (via shortcode or function)
358
+ *
359
+ * @since 2.0
360
+ */
361
+ function wprss_display_feed_items( $args = array() ) {
362
+ $defaults = array(
363
+ 'links_before' => '<ul>',
364
+ 'links_after' => '</ul>',
365
+ 'link_before' => '<li>',
366
+ 'link_after' => '</li>'
367
+ );
368
+
369
+ $settings = get_option( 'wprss_settings' );
370
+ $class = '';
371
+ $open_setting = '';
372
+ $follow_setting = '';
373
+
374
+ switch ( $settings['open_dd'] ) {
375
+
376
+ case 'Lightbox' :
377
+ $class = 'class="colorbox"';
378
+ break;
379
+
380
+ case 'New window' :
381
+ $open_setting = 'target="_blank"';
382
+ break;
383
+ }
384
+
385
+ switch ( $settings['follow_dd'] ) {
386
+
387
+ case 'No follow' :
388
+ $follow_setting = 'rel="nofollow"';
389
+ break;
390
+ }
391
+
392
+ // Parse incoming $args into an array and merge it with $defaults
393
+ $args = wp_parse_args( $args, $defaults );
394
+ // Declare each item in $args as its own variable
395
+ extract( $args, EXTR_SKIP );
396
+
397
+ // Arguments for the next query to fetch all feed items
398
+ $feed_items_args = array(
399
+ 'post_type' => 'wprss_feed_item',
400
+ 'posts_per_page' => $settings['feed_limit'],
401
+ 'orderby' => 'meta_value',
402
+ 'meta_key' => 'wprss_item_date',
403
+ 'order' => 'DESC',
404
+ );
405
+
406
+ // Query to get all feed items for display
407
+ $feed_items = new WP_Query( apply_filters( 'wprss_display_feed_items_query', $feed_items_args ) );
408
+
409
+ if( $feed_items->have_posts() ) {
410
+ echo "$links_before\n";
411
+ while ( $feed_items->have_posts() ) {
412
+ $feed_items->the_post();
413
+ $permalink = get_post_meta( get_the_ID(), 'wprss_item_permalink', true );
414
+ $feed_source_id = get_post_meta( get_the_ID(), 'wprss_feed_id', true );
415
+ $source_name = get_the_title( $feed_source_id );
416
+
417
+ // convert from Unix timestamp
418
+ $date = date( 'Y-m-d', intval( get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) );
419
+ echo "\t\t" . "$link_before" . '<a ' . $class . $open_setting . ' ' . $follow_setting . ' href="'. $permalink . '">'. get_the_title(). '</a><br>' . "\n";
420
+ echo "\t\t".'<span class="feed-source">' . __( "Source: ") . $source_name . ' | ' . $date . '</span>' . "$link_after" . "\n\n";
421
+ }
422
+ echo "\t\t $links_after";
423
+ echo paginate_links();
424
+
425
+ wp_reset_postdata();
426
+
427
+ } else {
428
+ _e( 'No feed items found', 'wprss' );
429
+ }
430
+ } // end wprss_display_feed_items
431
+
432
+
433
+ add_action( 'trash_wprss_feed', 'wprss_delete_feed_items' );
434
+ /**
435
+ * Delete feed items on trashing of corresponding feed source
436
+ *
437
+ * @since 2.0
438
+ */
439
+ function wprss_delete_feed_items() {
440
+ global $post;
441
+
442
+ $args = array(
443
+ 'post_type' => 'wprss_feed_item',
444
+ 'meta_query' => array(
445
+ array(
446
+ 'key' => 'wprss_feed_id',
447
+ 'value' => $post->ID,
448
+ 'compare' => 'LIKE'
449
+ )
450
+ )
451
+ );
452
+
453
+ $feed_items = new WP_Query( $args );
454
+
455
+ if ( $feed_items->have_posts() ) :
456
+ while ( $feed_items->have_posts() ) : $feed_items->the_post();
457
+ $postid = get_the_ID();
458
+
459
+ $purge = wp_delete_post( $postid, true );
460
+ endwhile;
461
+ endif;
462
+
463
+ wp_reset_postdata();
464
+ } // end wprss_delete_feed_items
465
+
466
+
467
+ /**
468
+ * Delete old feed items from the database to avoid bloat
469
+ *
470
+ * @since 2.0
471
+ */
472
+ function wprss_truncate_posts() {
473
+ global $wpdb;
474
+
475
+ // Set your threshold of max posts and post_type name
476
+ $threshold = 50;
477
+ $post_type = 'wprss_feed_item';
478
+
479
+ // Query post type
480
+ // $wpdb query allows me to select specific columns instead of grabbing the entire post object.
481
+ $query = "
482
+ SELECT ID, post_title FROM $wpdb->posts
483
+ WHERE post_type = '$post_type'
484
+ AND post_status = 'publish'
485
+ ORDER BY post_modified DESC
486
+ ";
487
+ $results = $wpdb->get_results( $query );
488
+
489
+ // Check if there are any results
490
+ if ( count( $results ) ){
491
+ foreach ( $results as $post ) {
492
+ $i++;
493
+
494
+ // Skip any posts within our threshold
495
+ if ( $i <= $threshold )
496
+ continue;
497
+
498
+ // Let the WordPress API do the heavy lifting for cleaning up entire post trails
499
+ $purge = wp_delete_post( $post->ID, true );
500
+ }
501
+ }
502
+ } // end wprss_truncate_posts