WP RSS Aggregator - Version 2.2.3

Version Description

Download this release

Release Info

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

Version 2.2.3

changelog.txt ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2.2.3 (2012-11-01)
2
+ Fixed bug: Tab navigation preventing typing in input boxes
3
+ Removed: Feeds showing up in internal linking pop up
4
+
5
+ 2.2.2 (2012-10-30)
6
+ Removed: Feeds showing up in site search results
7
+ Enhanced: Better tab button navigation when adding a new feed
8
+ Enhanced: Better guidance when a feed URL is invalid
9
+
10
+ 2.2.1 (2012-10-17)
11
+ Fixed bug: wprss_feed_source_order assumes everyone is an admin
12
+
13
+ 2.2 (2012-10-01)
14
+ Italian translation added
15
+ Feed source order changed to alphabetical
16
+ Fixed bug - repeated entries when having a non-valid feed source
17
+ Fixed bug - all imported feeds deleted upon trashing a single feed source
18
+
19
+ 2.1 (2012-09-27)
20
+ Now localised for translations
21
+ Fixed bug with date string
22
+ Fixed $link_before and $link_after, now working
23
+ Added backwards compatibility for wp_rss_aggregator() function
24
+
25
+ 2.0 (2012-09-21)
26
+ Bulk of code rewritten and refactored
27
+ Added install and upgrade functions
28
+ Added DB version setting
29
+ Feed sources now stored as Custom Post Types
30
+ Feed source list sortable ascending or descending by name
31
+ Removed days subsections in feed display
32
+ Ability to limit total number of feeds displayed
33
+ Feeds now fetched via Cron
34
+ Cron job to delete old feed items, keeps max of 50 items in DB
35
+ Now requires WordPress 3.2
36
+ updated colorbox to v1.3.20.1
37
+ Limit of 15 items max imported for each source
38
+ Fixed issue of page content displaying incorrectly after feeds
39
+
40
+ 1.1 (2012-08-13)
41
+ Now requires WordPress 3.0
42
+ More flexible fetching of images directory
43
+ Has its own top level menu item
44
+ Added settings section
45
+ Ability to open in lightbox, new window or default browser behaviour
46
+ Ability to set links as follow or no follow
47
+ Using constants for oftenly used locations
48
+ Code refactoring
49
+ Changes in file and folder structure
50
+
51
+ 1.0 (2012-01-06)
52
+ 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,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ .invalid-feed-url {
66
+ color: red;
67
+ }
68
+
69
+ /*.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,683 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 'exclude_from_search' => true,
37
+ 'publicly_querable' => false,
38
+ 'show_in_nav_menus' => false,
39
+ 'show_in_admin_bar' => true,
40
+ 'public' => false,
41
+ 'show_ui' => true,
42
+ 'query_var' => 'feed_source',
43
+ 'menu_position' => 100,
44
+ 'menu_icon' => WPRSS_IMG . 'icon-adminmenu16-sprite.png',
45
+ 'show_in_menu' => true,
46
+ 'supports' => array( 'title' ),
47
+ 'rewrite' => array(
48
+ 'slug' => 'feeds',
49
+ 'with_front' => false
50
+ ),
51
+ 'labels' => $labels
52
+ )
53
+ );
54
+
55
+ // Register the 'wprss_feed' post type
56
+ register_post_type( 'wprss_feed', $feed_args );
57
+
58
+ // Set up labels for the 'wprss_feed_item' post type
59
+ $labels = apply_filters( 'wprss_feed_item_post_type_labels', array(
60
+ 'name' => __( 'Imported Feeds', 'wprss' ),
61
+ 'singular_name' => __( 'Imported Feed', 'wprss' ),
62
+ 'all_items' => __( 'Imported Feeds', 'wprss' ),
63
+ 'view_item' => __( 'View Imported Feed', 'wprss' ),
64
+ 'search_items' => __( 'Search Imported Feeds', 'wprss' ),
65
+ 'not_found' => __( 'No Imported Feeds Found', 'wprss' ),
66
+ 'not_found_in_trash' => __( 'No Imported Feeds Found In Trash', 'wprss' )
67
+ )
68
+ );
69
+
70
+ // Set up the arguments for the 'wprss_feed_item' post type
71
+ $feed_item_args = apply_filters( 'wprss_feed_item_post_type_args', array(
72
+ 'exclude_from_search' => true,
73
+ 'publicly_querable' => false,
74
+ 'show_in_nav_menus' => false,
75
+ 'show_in_admin_bar' => true,
76
+ 'public' => false,
77
+ 'show_ui' => true,
78
+ 'query_var' => 'feed_item',
79
+ 'show_in_menu' => 'edit.php?post_type=wprss_feed',
80
+ 'rewrite' => array(
81
+ 'slug' => 'feeds/items',
82
+ 'with_front' => false,
83
+ ),
84
+ 'labels' => $labels
85
+ )
86
+ );
87
+
88
+ // Register the 'feed_item' post type
89
+ register_post_type( 'wprss_feed_item', $feed_item_args );
90
+ }
91
+
92
+
93
+ add_filter( 'manage_edit-wprss_feed_columns', 'wprss_set_feed_custom_columns');
94
+ /**
95
+ * Set up the custom columns for the wprss_feed list
96
+ *
97
+ * @since 2.0
98
+ */
99
+ function wprss_set_feed_custom_columns( $columns ) {
100
+
101
+ $columns = array (
102
+ 'cb' => '<input type="checkbox" />',
103
+ 'title' => __( 'Name', 'wprss' ),
104
+ 'url' => __( 'URL', 'wprss' ),
105
+ 'description' => __( 'Description', 'wprss' ),
106
+ );
107
+ return apply_filters( 'wprss_set_feed_custom_columns', $columns );
108
+ }
109
+
110
+
111
+ add_action( "manage_wprss_feed_posts_custom_column", "wprss_show_custom_columns", 10, 2 );
112
+ /**
113
+ * Show up the custom columns for the wprss_feed list
114
+ *
115
+ * @since 2.0
116
+ */
117
+ function wprss_show_custom_columns( $column, $post_id ) {
118
+
119
+ switch ( $column ) {
120
+ case 'url':
121
+ $url = get_post_meta( $post_id, 'wprss_url', true);
122
+ echo '<a href="' . esc_url($url) . '">' . esc_url($url) . '</a>';
123
+ break;
124
+ case 'description':
125
+ $description = get_post_meta( $post_id, 'wprss_description', true);
126
+ echo esc_html( $description );
127
+ break;
128
+ }
129
+ }
130
+
131
+
132
+ /**
133
+ * Make the custom columns sortable for wprss_feed post type
134
+ *
135
+ * @since 2.0
136
+ */
137
+ function wprss_feed_sortable_columns() {
138
+ $sortable_columns = array(
139
+ // meta column id => sortby value used in query
140
+ 'title' => 'title',
141
+ );
142
+ return apply_filters( 'wprss_feed_sortable_columns', $sortable_columns );
143
+ }
144
+
145
+
146
+ add_action( 'pre_get_posts', 'wprss_feed_source_order' );
147
+ /**
148
+ * Change order of feed sources to alphabetical ascending according to feed name
149
+ *
150
+ * @since 2.2
151
+ */
152
+ function wprss_feed_source_order( $query ) {
153
+ if ( ! is_admin() ) {
154
+ return;
155
+ }
156
+
157
+ $post_type = $query->get('post_type');
158
+
159
+ if ( $post_type == 'wprss_feed' ) {
160
+ /* Post Column: e.g. title */
161
+ if ( $query->get( 'orderby' ) == '' ) {
162
+ $query->set( 'orderby', 'title' );
163
+ }
164
+ /* Post Order: ASC / DESC */
165
+ if( $query->get( 'order' ) == '' ){
166
+ $query->set( 'order', 'ASC' );
167
+ }
168
+ }
169
+ }
170
+
171
+
172
+ add_filter( 'manage_edit-wprss_feed_item_columns', 'wprss_set_feed_item_custom_columns');
173
+ /**
174
+ * Set up the custom columns for the wprss_feed source list
175
+ *
176
+ * @since 2.0
177
+ */
178
+ function wprss_set_feed_item_custom_columns( $columns ) {
179
+
180
+ $columns = array (
181
+ 'cb' => '<input type="checkbox" />',
182
+ 'title' => __( 'Name', 'wprss' ),
183
+ 'permalink' => __( 'Permalink', 'wprss' ),
184
+ 'publishdate' => __( 'Date published', 'wprss' ),
185
+ 'source' => __( 'Source', 'wprss' )
186
+ );
187
+ return apply_filters( 'wprss_set_feed_item_custom_columns', $columns );
188
+ }
189
+
190
+
191
+ add_action( "manage_wprss_feed_item_posts_custom_column", "wprss_show_feed_item_custom_columns", 10, 2 );
192
+ /**
193
+ * Show up the custom columns for the wprss_feed list
194
+ *
195
+ * @since 2.0
196
+ */
197
+ function wprss_show_feed_item_custom_columns( $column, $post_id ) {
198
+
199
+ switch ( $column ) {
200
+ case "permalink":
201
+ $url = get_post_meta( $post_id, 'wprss_item_permalink', true);
202
+ echo '<a href="' . $url . '">' . $url. '</a>';
203
+ break;
204
+
205
+ case "publishdate":
206
+ $publishdate = date( 'Y-m-d H:i:s', get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) ;
207
+ echo $publishdate;
208
+ break;
209
+
210
+ case "source":
211
+ $query = new WP_Query();
212
+ $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>';
213
+ echo $source;
214
+ break;
215
+ }
216
+ }
217
+
218
+
219
+ add_filter( "manage_edit-wprss_feed_item_sortable_columns", "wprss_feed_item_sortable_columns" );
220
+ /**
221
+ * Make the custom columns sortable
222
+ *
223
+ * @since 2.0
224
+ */
225
+ function wprss_feed_item_sortable_columns() {
226
+ $sortable_columns = array(
227
+ // meta column id => sortby value used in query
228
+ 'publishdate' => 'publishdate',
229
+ 'source' => 'source'
230
+ );
231
+ return apply_filters( 'wprss_feed_item_sortable_columns', $sortable_columns );
232
+ }
233
+
234
+
235
+ add_action( 'pre_get_posts', 'wprss_feed_item_orderby' );
236
+ /**
237
+ * Change ordering of posts on wprss_feed_item screen
238
+ *
239
+ * @since 2.0
240
+ */
241
+ function wprss_feed_item_orderby( $query ) {
242
+ if( ! is_admin() )
243
+ return;
244
+
245
+ $post_type = $query->get('post_type');
246
+
247
+ // If we're on the feed listing admin page
248
+ if ( $post_type == 'wprss_feed_item') {
249
+ // Set general orderby to date the feed item was published
250
+ $query->set('orderby','publishdate');
251
+ // If user clicks on the reorder link, implement reordering
252
+ $orderby = $query->get( 'orderby');
253
+ if( 'publishdate' == $orderby ) {
254
+ $query->set( 'meta_key', 'wprss_item_date' );
255
+ $query->set( 'orderby', 'meta_value_num' );
256
+ }
257
+ }
258
+ }
259
+
260
+
261
+ add_action( 'add_meta_boxes', 'wprss_add_meta_boxes');
262
+ /**
263
+ * Set up the input boxes for the wprss_feed post type
264
+ *
265
+ * @since 2.0
266
+ */
267
+ function wprss_add_meta_boxes() {
268
+ global $wprss_meta_fields;
269
+
270
+ // Remove the default WordPress Publish box, because we will be using custom ones
271
+ remove_meta_box( 'submitdiv', 'wprss_feed', 'side' );
272
+ add_meta_box(
273
+ 'submitdiv',
274
+ __( 'Save Feed Source', 'wprss' ),
275
+ 'post_submit_meta_box',
276
+ 'wprss_feed',
277
+ 'side',
278
+ 'low');
279
+
280
+ /* add_meta_box(
281
+ 'wprss-save-link-side-meta',
282
+ 'Save Feed Source',
283
+ 'wprss_save_feed_source_meta_box',
284
+ 'wprss_feed',
285
+ 'side',
286
+ 'high'
287
+ );
288
+
289
+ add_meta_box(
290
+ 'wprss-save-link-bottom-meta',
291
+ __( 'Save Feed Source', 'wprss' ),
292
+ 'wprss_save_feed_source_meta_box',
293
+ 'wprss_feed',
294
+ 'normal',
295
+ 'low'
296
+ );*/
297
+
298
+ add_meta_box(
299
+ 'wprss-help-meta',
300
+ __( 'WP RSS Aggregator Help', 'wprss' ),
301
+ 'wprss_help_meta_box',
302
+ 'wprss_feed',
303
+ 'side',
304
+ 'low'
305
+ );
306
+
307
+ add_meta_box(
308
+ 'wprss-like-meta',
309
+ __( 'Like this plugin?', 'wprss' ),
310
+ 'wprss_like_meta_box',
311
+ 'wprss_feed',
312
+ 'side',
313
+ 'low'
314
+ );
315
+
316
+ add_meta_box(
317
+ 'wprss-follow-meta',
318
+ __( 'Follow us', 'wprss' ),
319
+ 'wprss_follow_meta_box',
320
+ 'wprss_feed',
321
+ 'side',
322
+ 'low'
323
+ );
324
+
325
+ add_meta_box(
326
+ 'custom_meta_box', // $id
327
+ __( 'Feed Source Details', 'wprss' ), // $title
328
+ 'wprss_show_meta_box', // $callback
329
+ 'wprss_feed', // $page
330
+ 'normal', // $context
331
+ 'high'); // $priority
332
+
333
+
334
+ add_meta_box(
335
+ 'preview_meta_box', // $id
336
+ __( 'Feed Preview', 'wprss' ), // $title
337
+ 'wprss_preview_meta_box', // $callback
338
+ 'wprss_feed', // $page
339
+ 'normal', // $context
340
+ 'low'); // $priority
341
+ }
342
+
343
+
344
+ /**
345
+ * Set up fields for the meta box for the wprss_feed post type
346
+ *
347
+ * @since 2.0
348
+ */
349
+ function wprss_custom_fields() {
350
+ $prefix = 'wprss_';
351
+
352
+ // Field Array
353
+ $wprss_meta_fields[ 'url' ] = array(
354
+ 'label' => __( 'URL', 'wprss' ),
355
+ 'desc' => __( 'Enter feed URL (including http://)', 'wprss' ),
356
+ 'id' => $prefix.'url',
357
+ 'type' => 'text'
358
+ );
359
+
360
+ $wprss_meta_fields[' description' ] = array(
361
+ 'label' => __( 'Description', 'wprss' ),
362
+ 'desc' => __( 'A short description about this feed source (optional)', 'wprss' ),
363
+ 'id' => $prefix.'description',
364
+ 'type' => 'textarea'
365
+ );
366
+
367
+ // for extensibility, allows more meta fields to be added
368
+ return apply_filters( 'wprss_fields', $wprss_meta_fields );
369
+ }
370
+
371
+
372
+ /**
373
+ * Set up the meta box for the wprss_feed post type
374
+ *
375
+ * @since 2.0
376
+ */
377
+ function wprss_show_meta_box() {
378
+ global $post;
379
+ $meta_fields = wprss_custom_fields();
380
+
381
+ // Use nonce for verification
382
+ echo '<input type="hidden" name="wprss_meta_box_nonce" value="' . wp_create_nonce( basename( __FILE__ ) ) . '" />';
383
+
384
+ // Begin the field table and loop
385
+ echo '<table class="form-table">';
386
+ foreach ( $meta_fields as $field ) {
387
+ // get value of this field if it exists for this post
388
+ $meta = get_post_meta( $post->ID, $field['id'], true );
389
+ // begin a table row with
390
+ echo '<tr>
391
+ <th><label for="' . $field['id'] . '">' . $field['label'] . '</label></th>
392
+ <td>';
393
+
394
+ switch( $field['type'] ) {
395
+
396
+ // text
397
+ case 'text':
398
+ echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="55" />
399
+ <br /><span class="description">'.$field['desc'].'</span>';
400
+ break;
401
+
402
+ // textarea
403
+ case 'textarea':
404
+ echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
405
+ <br /><span class="description">'.$field['desc'].'</span>';
406
+ break;
407
+
408
+ // checkbox
409
+ case 'checkbox':
410
+ echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/>
411
+ <label for="'.$field['id'].'">'.$field['desc'].'</label>';
412
+ break;
413
+
414
+ // select
415
+ case 'select':
416
+ echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';
417
+ foreach ($field['options'] as $option) {
418
+ echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';
419
+ }
420
+ echo '</select><br /><span class="description">'.$field['desc'].'</span>';
421
+ break;
422
+
423
+ } //end switch
424
+ echo '</td></tr>';
425
+ } // end foreach
426
+ echo '</table>'; // end table
427
+ }
428
+
429
+
430
+ add_action( 'save_post', 'wprss_save_custom_fields' );
431
+ /**
432
+ * Save the custom fields
433
+ *
434
+ * @since 2.0
435
+ */
436
+ function wprss_save_custom_fields( $post_id ) {
437
+ $meta_fields = wprss_custom_fields();
438
+
439
+ // verify nonce
440
+ if ( ! wp_verify_nonce( $_POST[ 'wprss_meta_box_nonce' ], basename( __FILE__ ) ) )
441
+ return $post_id;
442
+
443
+ // check autosave
444
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE)
445
+ return $post_id;
446
+
447
+ // check permissions
448
+ if ( 'page' == $_POST[ 'post_type' ] ) {
449
+ if ( ! current_user_can( 'edit_page', $post_id ) )
450
+ return $post_id;
451
+ } elseif ( ! current_user_can( 'edit_post', $post_id ) ) {
452
+ return $post_id;
453
+ }
454
+
455
+ // loop through fields and save the data
456
+ foreach ( $meta_fields as $field ) {
457
+ $old = get_post_meta( $post_id, $field[ 'id' ], true );
458
+ $new = $_POST[ $field[ 'id' ] ];
459
+ if ( $new && $new != $old ) {
460
+ update_post_meta( $post_id, $field[ 'id' ], $new );
461
+ } elseif ( '' == $new && $old ) {
462
+ delete_post_meta( $post_id, $field[ 'id' ], $old );
463
+ }
464
+ } // end foreach
465
+ }
466
+
467
+
468
+ /**
469
+ * Generate the Save Feed Source meta box
470
+ *
471
+ * @since 2.0
472
+ */
473
+ function wprss_save_feed_source_meta_box() {
474
+ global $post;
475
+
476
+ // insert nonce??
477
+
478
+ echo '<input type="submit" name="publish" id="publish" class="button-primary" value="Save" tabindex="5" accesskey="s">';
479
+
480
+ /**
481
+ * Check if user has disabled trash, in that case he can only delete feed sources permanently,
482
+ * else he can deactivate them. By default, if not modified in wp_config.php, EMPTY_TRASH_DAYS is set to 30.
483
+ */
484
+ if ( current_user_can( "delete_post", $post->ID ) ) {
485
+ if ( ! EMPTY_TRASH_DAYS )
486
+ $delete_text = __( 'Delete Permanently', 'wprss' );
487
+ else
488
+ $delete_text = __( 'Move to Trash', 'wprss' );
489
+
490
+ echo '&nbsp;&nbsp;<a class="submitdelete deletion" href="' . get_delete_post_link( $post->ID ) . '">' . $delete_text . '</a>';
491
+ }
492
+ }
493
+
494
+
495
+ /**
496
+ * Generate a preview of the latest 5 posts from the feed source being added/edited
497
+ *
498
+ * @since 2.0
499
+ */
500
+ function wprss_preview_meta_box() {
501
+ global $post;
502
+ $feed_url = get_post_meta( $post->ID, 'wprss_url', true );
503
+
504
+ if( ! empty( $feed_url ) ) {
505
+ $feed = fetch_feed( $feed_url );
506
+ if ( ! is_wp_error( $feed ) ) {
507
+ $items = $feed->get_items();
508
+
509
+ echo '<h4>Latest 5 feeds available from ' . get_the_title() . '</h4>';
510
+ $count = 0;
511
+ $feedlimit = 5;
512
+ foreach ( $items as $item ) {
513
+ echo '<ul>';
514
+ echo '<li>' . $item->get_title() . '</li>';
515
+ echo '</ul>';
516
+ if( ++$count == $feedlimit ) break; //break if count is met
517
+ }
518
+ }
519
+ else _e( '<span class="invalid-feed-url"><strong>Invalid feed URL</strong> - Double check the feed source URL setting above.</span>
520
+ <p>Not sure where to find the RSS feed on a website?
521
+ <a target="_blank" href="http://webtrends.about.com/od/webfeedsyndicationrss/ss/rss_howto.htm">Click here</a> for a visual guide' , 'wprss' );
522
+ }
523
+
524
+ else _e( 'No feed URL defined yet', 'wprss' );
525
+ }
526
+
527
+
528
+ /**
529
+ * Generate Help meta box
530
+ *
531
+ * @since 2.0
532
+ *
533
+ */
534
+ function wprss_help_meta_box() {
535
+ echo '<p><strong>';
536
+ _e( 'Need help?', 'wprss' );
537
+ echo '</strong> <a target="_blank" href="http://wordpress.org/support/plugin/wp-rss-aggregator">';
538
+ _e( 'Check out the support forum', 'wprss' );
539
+ echo '</a></p>';
540
+ }
541
+
542
+ /**
543
+ * Generate Like this plugin meta box
544
+ *
545
+ * @since 2.0
546
+ *
547
+ */
548
+ function wprss_like_meta_box() { ?>
549
+ <p><?php _e( 'Why not do any or all of the following', 'wprss' ) ?>:</p>
550
+ <ul>
551
+ <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>
552
+ <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>
553
+ </ul>
554
+ </p>
555
+ <?php }
556
+
557
+
558
+ /**
559
+ * Generate Like this plugin meta box
560
+ *
561
+ * @since 2.0
562
+ *
563
+ */
564
+ function wprss_follow_meta_box() {
565
+ ?>
566
+ <ul>
567
+ <li class="twitter"><a href="http://twitter.com/wpmayor"><?php _e( 'Follow WP Mayor on Twitter.', 'wprss' ) ?></a></li>
568
+ <li class="facebook"><a href="https://www.facebook.com/wpmayor"><?php _e( 'Like WP Mayor on Facebook.', 'wprss' ) ?></a></li>
569
+
570
+ </ul>
571
+ <?php }
572
+
573
+
574
+ add_filter( 'post_updated_messages', 'wprss_feed_updated_messages' );
575
+ /**
576
+ * Change default notification message when new feed is added or updated
577
+ *
578
+ * @since 2.0
579
+ */
580
+ function wprss_feed_updated_messages( $messages ) {
581
+ global $post, $post_ID;
582
+
583
+ $messages[ 'wprss_feed' ] = array(
584
+ 0 => '', // Unused. Messages start at index 1.
585
+ 1 => __( 'Feed source updated. ', 'wprss' ),
586
+ 2 => __( 'Custom field updated.', 'wprss' ),
587
+ 3 => __( 'Custom field deleted.', 'wprss' ),
588
+ 4 => __( 'Feed source updated.', 'wprss' ),
589
+ 5 => '',
590
+ 6 => __( 'Feed source saved.', 'wprss' ),
591
+ 7 => __( 'Feed source saved.', 'wprss' ),
592
+ 8 => __( 'Feed source submitted.', 'wprss' ),
593
+ 9 => '',
594
+ 10 => __( 'Feed source updated.', 'wprss' )
595
+ );
596
+
597
+ return apply_filters( 'wprss_feed_updated_messages', $messages );
598
+ }
599
+
600
+
601
+ add_filter( 'post_row_actions', 'wprss_remove_row_actions', 10, 1 );
602
+ /**
603
+ * Remove actions row for imported feed items, we don't want them to be editable or viewable
604
+ *
605
+ * @since 2.0
606
+ */
607
+ function wprss_remove_row_actions( $actions )
608
+ {
609
+ if ( get_post_type() === 'wprss_feed_item' ) {
610
+ unset( $actions[ 'edit' ] );
611
+ unset( $actions[ 'view' ] );
612
+ //unset( $actions[ 'trash' ] );
613
+ unset( $actions[ 'inline hide-if-no-js' ] );
614
+ }
615
+ return apply_filters( 'wprss_remove_row_actions', $actions );
616
+ }
617
+
618
+
619
+ add_filter( 'bulk_actions-edit-wprss_feed_item', 'wprss_custom_feed_item_bulk_actions' );
620
+ /**
621
+ * Remove bulk action link to edit imported feed items
622
+ *
623
+ * @since 2.0
624
+ */
625
+ function wprss_custom_feed_item_bulk_actions( $actions ){
626
+ unset( $actions[ 'edit' ] );
627
+ return apply_filters( 'wprss_custom_feed_item_bulk_actions', $actions );
628
+ }
629
+
630
+
631
+ add_action( 'admin_footer-edit.php', 'wprss_remove_a_from_feed_title' );
632
+ /**
633
+ * Remove hyperlink from imported feed titles in list posts screen
634
+ *
635
+ * @since 2.0
636
+ */
637
+ function wprss_remove_a_from_feed_title() {
638
+ if ( 'edit-wprss_feed_item' !== get_current_screen()->id )
639
+ return;
640
+ ?>
641
+
642
+ <script type="text/javascript">
643
+ jQuery('table.wp-list-table a.row-title').contents().unwrap();
644
+ </script>
645
+ <?php
646
+ }
647
+
648
+
649
+ add_action( 'add_meta_boxes', 'wprss_remove_meta_boxes', 100 );
650
+ /**
651
+ * Remove unneeded meta boxes from add feed source screen
652
+ *
653
+ * @since 2.0
654
+ */
655
+ function wprss_remove_meta_boxes() {
656
+ if ( 'wprss_feed' !== get_current_screen()->id ) return;
657
+ remove_meta_box( 'wpseo_meta', 'wprss_feed' ,'normal' );
658
+ remove_meta_box( 'woothemes-settings', 'wprss_feed' ,'normal' );
659
+ remove_meta_box( 'wpcf-post-relationship', 'wprss_feed' ,'normal' );
660
+ remove_meta_box( 'sharing_meta', 'wprss_feed' ,'advanced' );
661
+ remove_meta_box( 'content-permissions-meta-box', 'wprss_feed' ,'advanced' );
662
+ remove_meta_box( 'theme-layouts-post-meta-box', 'wprss_feed' ,'side' );
663
+ remove_meta_box( 'post-stylesheets', 'wprss_feed' ,'side' );
664
+ remove_meta_box( 'hybrid-core-post-template', 'wprss_feed' ,'side' );
665
+ remove_meta_box( 'wpcf-marketing', 'wprss_feed' ,'side' );
666
+ remove_meta_box( 'trackbacksdiv22', 'wprss_feed' ,'advanced' );
667
+ remove_action( 'post_submitbox_start', 'fpp_post_submitbox_start_action' );
668
+ }
669
+
670
+
671
+ add_filter( 'gettext', 'wprss_change_publish_button_text', 10, 2 );
672
+ /**
673
+ * Modify 'Publish' button text when adding a new feed source
674
+ *
675
+ * @since 2.0
676
+ */
677
+ function wprss_change_publish_button_text( $translation, $text ) {
678
+ if ( 'wprss_feed' == get_post_type()) {
679
+ if ( $text == 'Publish' )
680
+ return __( 'Publish Feed', 'wprss' );
681
+ }
682
+ return apply_filters( 'wprss_change_publish_button_text', $translation );
683
+ }
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/admin-custom.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function() {
2
+
3
+ // On TAB pressed when on title input field, go to URL input field
4
+ jQuery('input#title').on( 'keydown', function( event ) {
5
+
6
+ if ( event.which == 9 ) {
7
+ event.preventDefault();
8
+ jQuery('input#wprss_url').focus();
9
+ }
10
+ }
11
+ );
12
+
13
+ // On TAB pressed when on description textarea field, go to Publish submit button
14
+ jQuery('textarea#wprss_description').on( 'keydown', function( event ) {
15
+
16
+ if ( event.which == 9 ) {
17
+ event.preventDefault();
18
+ jQuery('input#publish').focus();
19
+ }
20
+ }
21
+ );
22
+ });
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,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.3
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 [FitForBlogging.com Internet Marketing News page](http://www.fitforblogging.com/news) or [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.3 (2012-11-01) =
92
+ Fixed bug: Tab navigation preventing typing in input boxes
93
+ Removed: Feeds showing up in internal linking pop up
94
+
95
+ = Version 2.2.2 (2012-10-30) =
96
+ Removed: Feeds showing up in site search results
97
+ Enhanced: Better tab button navigation when adding a new feed
98
+ Enhanced: Better guidance when a feed URL is invalid
99
+
100
+ = Version 2.2.1 (2012-10-17) =
101
+ * Fixed bug: wprss_feed_source_order assumes everyone is an admin
102
+
103
+ = Version 2.2 (2012-10-01) =
104
+ * Italian translation added
105
+ * Feed source order changed to alphabetical
106
+ * Fixed bug - repeated entries when having a non-valid feed source
107
+ * Fixed bug - all imported feeds deleted upon trashing a single feed source
108
+
109
+ = Version 2.1 (2012-09-27) =
110
+ * Now localised for translations
111
+ * Fixed bug with date string
112
+ * Fixed $link_before and $link_after, now working
113
+ * Added backwards compatibility for wp_rss_aggregator() function
114
+
115
+ = Version 2.0 (2012-09-21) =
116
+ * Bulk of code rewritten and refactored
117
+ * Added install and upgrade functions
118
+ * Added DB version setting
119
+ * Feed sources now stored as Custom Post Types
120
+ * Feed source list sortable ascending or descending by name
121
+ * Removed days subsections in feed display
122
+ * Ability to limit total number of feeds displayed
123
+ * Feeds now fetched via Cron
124
+ * Cron job to delete old feed items, keeps max of 50 items in DB
125
+ * Now requires WordPress 3.2
126
+ * Updated colorbox to v1.3.20.1
127
+ * Limit of 15 items max imported for each source
128
+ * Fixed issue of page content displaying incorrectly after feeds
129
+
130
+
131
+ = Version 1.1 (2012-08-13) =
132
+ * Now requires WordPress 3.0
133
+ * More flexible fetching of images directory
134
+ * Has its own top level menu item
135
+ * Added settings section
136
+ * Ability to open in lightbox, new window or default browser behaviour
137
+ * Ability to set links as follow or no follow
138
+ * Using constants for oftenly used locations
139
+ * Code refactoring
140
+ * Changes in file and folder structure
141
+
142
+
143
+ = Version 1.0 (2012-01-06) =
144
+ * 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,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.3
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.3
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.3', 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
+ wp_enqueue_script( 'admin-custom', WPRSS_JS .'admin-custom.js', array('jquery') );
146
+ if ( 'post' === $screen->base && 'wprss_feed' === $screen->post_type ) {
147
+ // Change text on post screen from 'Enter title here' to 'Enter feed name here'
148
+ add_filter( 'enter_title_here', 'wprss_change_title_text' );
149
+ }
150
+ }
151
+ } // end wprss_admin_scripts_styles
152
+
153
+
154
+ /**
155
+ * Change title on wprss_feed post type screen
156
+ *
157
+ * @since 2.0
158
+ */
159
+ function wprss_change_title_text() {
160
+ return __( 'Enter feed name here (e.g. WP Mayor)', 'wprss' );
161
+ } // end wprss_change_title_text
162
+
163
+
164
+ add_action( 'wp_head', 'wprss_head_scripts_styles' );
165
+ /**
166
+ * Scripts and styles to be inserted into <head> section in front end
167
+ *
168
+ * @since 2.0
169
+ */
170
+ function wprss_head_scripts_styles() {
171
+ wp_enqueue_style( 'colorbox', WPRSS_CSS . 'colorbox.css' );
172
+ wp_enqueue_script( 'jquery.colorbox-min', WPRSS_JS .'jquery.colorbox-min.js', array('jquery') );
173
+ wp_enqueue_script( 'custom', WPRSS_JS .'custom.js', array('jquery','jquery.colorbox-min') );
174
+ } // end wprss_head_scripts_styles
175
+
176
+
177
+ /**
178
+ * Change the default feed cache recreation period to 2 hours
179
+ *
180
+ * @since 2.1
181
+ */
182
+ function wprss_return_7200( $seconds )
183
+ {
184
+ return 7200;
185
+ }
186
+
187
+
188
+ /**
189
+ * Fetches feed items from sources provided
190
+ *
191
+ * @since 2.0
192
+ */
193
+ function wprss_fetch_all_feed_items( ) {
194
+
195
+ // Get all feed sources
196
+ $feed_sources = new WP_Query( array(
197
+ 'post_type' => 'wprss_feed',
198
+ 'post_status' => 'publish',
199
+ 'posts_per_page' => -1,
200
+ ) );
201
+
202
+ if( $feed_sources->have_posts() ) {
203
+ /* Start by getting one feed source, we will cycle through them one by one,
204
+ fetching feed items and adding them to the database in each pass */
205
+ while ( $feed_sources->have_posts() ) {
206
+ $feed_sources->the_post();
207
+
208
+ $feed_ID = get_the_ID();
209
+ $feed_url = get_post_meta( get_the_ID(), 'wprss_url', true );
210
+
211
+ // Use the URL custom field to fetch the feed items for this source
212
+ if( !empty( $feed_url ) ) {
213
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
214
+ $feed = fetch_feed( $feed_url );
215
+ remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
216
+ if ( !is_wp_error( $feed ) ) {
217
+ // Figure out how many total items there are, but limit it to 10.
218
+ $maxitems = $feed->get_item_quantity(10);
219
+
220
+ // Build an array of all the items, starting with element 0 (first element).
221
+ $items = $feed->get_items( 0, $maxitems );
222
+ }
223
+ else { return; }
224
+ }
225
+
226
+ if ( ! empty( $items ) ) {
227
+ // Gather the permalinks of existing feed item's related to this feed source
228
+ global $wpdb;
229
+ $existing_permalinks = $wpdb->get_col(
230
+ "SELECT meta_value
231
+ FROM $wpdb->postmeta
232
+ WHERE meta_key = 'wprss_item_permalink'
233
+ AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID)
234
+ ");
235
+
236
+ foreach ( $items as $item ) {
237
+
238
+ // Check if newly fetched item already present in existing feed item item,
239
+ // if not insert it into wp_posts and insert post meta.
240
+ if ( ! ( in_array( $item->get_permalink(), $existing_permalinks ) ) ) {
241
+ // Create post object
242
+ $feed_item = array(
243
+ 'post_title' => $item->get_title(),
244
+ 'post_content' => '',
245
+ 'post_status' => 'publish',
246
+ 'post_type' => 'wprss_feed_item'
247
+ );
248
+ $inserted_ID = wp_insert_post( $feed_item );
249
+
250
+ update_post_meta( $inserted_ID, 'wprss_item_permalink', $item->get_permalink() );
251
+ update_post_meta( $inserted_ID, 'wprss_item_description', $item->get_description() );
252
+ update_post_meta( $inserted_ID, 'wprss_item_date', $item->get_date( 'U' ) ); // Save as Unix timestamp format
253
+ update_post_meta( $inserted_ID, 'wprss_feed_id', $feed_ID);
254
+ } //end if
255
+ } //end foreach
256
+ } // end if
257
+ } // end $feed_sources while loop
258
+ wp_reset_postdata(); // Restore the $post global to the current post in the main query
259
+ // } // end if
260
+ } // end if
261
+ } // end wprss_fetch_all_feed_items
262
+
263
+
264
+ add_action( 'wprss_items_post_meta', 'wprss_items_create_post_meta');
265
+ /**
266
+ * Creates meta entries for feed items while they are being imported
267
+ *
268
+ * @since 2.3
269
+ */
270
+ function wprss_items_create_post_meta( $inserted_ID, $item, $feed_ID) {
271
+ update_post_meta( $inserted_ID, 'wprss_item_permalink', $item->get_permalink() );
272
+ update_post_meta( $inserted_ID, 'wprss_item_description', $item->get_description() );
273
+ update_post_meta( $inserted_ID, 'wprss_item_date', $item->get_date( 'U' ) ); // Save as Unix timestamp format
274
+ update_post_meta( $inserted_ID, 'wprss_feed_id', $feed_ID);
275
+ }
276
+
277
+
278
+ add_action('wp_insert_post', 'wprss_fetch_feed_items');
279
+ /**
280
+ * Fetches feed items from sources provided
281
+ *
282
+ * @since 2.0
283
+ */
284
+ function wprss_fetch_feed_items( $post_id ) {
285
+
286
+ // Get current post that triggered the hook, $post_id passed via the hook
287
+ $post = get_post( $post_id );
288
+
289
+ if( ( $post->post_type == 'wprss_feed' ) && ( $post->post_status == 'publish' ) ) {
290
+
291
+ // Get all feed sources
292
+ $feed_sources = new WP_Query( array(
293
+ 'post_type' => 'wprss_feed',
294
+ 'post_status' => 'publish',
295
+ 'posts_per_page' => -1,
296
+ ) );
297
+
298
+ if( $feed_sources->have_posts() ) {
299
+ // Start by getting one feed source, we will cycle through them one by one,
300
+ // fetching feed items and adding them to the database in each pass
301
+ while ( $feed_sources->have_posts() ) {
302
+ $feed_sources->the_post();
303
+
304
+ $feed_ID = get_the_ID();
305
+ $feed_url = get_post_meta( get_the_ID(), 'wprss_url', true );
306
+
307
+ // Use the URL custom field to fetch the feed items for this source
308
+ if( !empty( $feed_url ) ) {
309
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
310
+ $feed = fetch_feed( $feed_url );
311
+ remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
312
+ if ( !is_wp_error( $feed ) ) {
313
+ // Figure out how many total items there are, but limit it to 10.
314
+ $maxitems = $feed->get_item_quantity(10);
315
+
316
+ // Build an array of all the items, starting with element 0 (first element).
317
+ $items = $feed->get_items( 0, $maxitems );
318
+ }
319
+ else { return; }
320
+ }
321
+
322
+ if ( ! empty( $items ) ) {
323
+ // Gather the permalinks of existing feed item's related to this feed source
324
+ global $wpdb;
325
+ $existing_permalinks = $wpdb->get_col(
326
+ "SELECT meta_value
327
+ FROM $wpdb->postmeta
328
+ WHERE meta_key = 'wprss_item_permalink'
329
+ AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID)
330
+ ");
331
+
332
+ foreach ( $items as $item ) {
333
+
334
+ // Check if newly fetched item already present in existing feed item item,
335
+ // if not insert it into wp_posts and insert post meta.
336
+ if ( ! ( in_array( $item->get_permalink(), $existing_permalinks ) ) ) {
337
+ // Create post object
338
+ $feed_item = array(
339
+ 'post_title' => $item->get_title(),
340
+ 'post_content' => '',
341
+ 'post_status' => 'publish',
342
+ 'post_type' => 'wprss_feed_item'
343
+ );
344
+ $inserted_ID = wp_insert_post( $feed_item );
345
+ wprss_items_create_post_meta( $inserted_ID, $item, $feed_ID );
346
+ } //end if
347
+ } //end foreach
348
+ } // end if
349
+ } // end $feed_sources while loop
350
+ wp_reset_postdata(); // Restore the $post global to the current post in the main query
351
+ } // end if
352
+ } // end if
353
+ } // end wprss_fetch_feed_items
354
+
355
+
356
+ /**
357
+ * Redirects to wprss_display_feed_items
358
+ * It is used for backwards compatibility to versions < 2.0
359
+ *
360
+ * @since 2.1
361
+ */
362
+ function wp_rss_aggregator( $args = array() ) {
363
+ wprss_display_feed_items( $args );
364
+ }
365
+
366
+
367
+ /**
368
+ * Display feed items on the front end (via shortcode or function)
369
+ *
370
+ * @since 2.0
371
+ */
372
+ function wprss_display_feed_items( $args = array() ) {
373
+ $defaults = array(
374
+ 'links_before' => '<ul>',
375
+ 'links_after' => '</ul>',
376
+ 'link_before' => '<li>',
377
+ 'link_after' => '</li>'
378
+ );
379
+
380
+ $settings = get_option( 'wprss_settings' );
381
+ $class = '';
382
+ $open_setting = '';
383
+ $follow_setting = '';
384
+
385
+ switch ( $settings['open_dd'] ) {
386
+
387
+ case 'Lightbox' :
388
+ $class = 'class="colorbox"';
389
+ break;
390
+
391
+ case 'New window' :
392
+ $open_setting = 'target="_blank"';
393
+ break;
394
+ }
395
+
396
+ switch ( $settings['follow_dd'] ) {
397
+
398
+ case 'No follow' :
399
+ $follow_setting = 'rel="nofollow"';
400
+ break;
401
+ }
402
+
403
+ // Parse incoming $args into an array and merge it with $defaults
404
+ $args = wp_parse_args( $args, $defaults );
405
+ // Declare each item in $args as its own variable
406
+ extract( $args, EXTR_SKIP );
407
+
408
+ // Arguments for the next query to fetch all feed items
409
+ $feed_items_args = array(
410
+ 'post_type' => 'wprss_feed_item',
411
+ 'posts_per_page' => $settings['feed_limit'],
412
+ 'orderby' => 'meta_value',
413
+ 'meta_key' => 'wprss_item_date',
414
+ 'order' => 'DESC',
415
+ );
416
+
417
+ // Query to get all feed items for display
418
+ $feed_items = new WP_Query( apply_filters( 'wprss_display_feed_items_query', $feed_items_args ) );
419
+
420
+ if( $feed_items->have_posts() ) {
421
+ echo "$links_before\n";
422
+ while ( $feed_items->have_posts() ) {
423
+ $feed_items->the_post();
424
+ $permalink = get_post_meta( get_the_ID(), 'wprss_item_permalink', true );
425
+ $feed_source_id = get_post_meta( get_the_ID(), 'wprss_feed_id', true );
426
+ $source_name = get_the_title( $feed_source_id );
427
+
428
+ // convert from Unix timestamp
429
+ $date = date( 'Y-m-d', intval( get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) );
430
+ echo "\t\t" . "$link_before" . '<a ' . $class . $open_setting . ' ' . $follow_setting . ' href="'. $permalink . '">'. get_the_title(). '</a><br>' . "\n";
431
+ echo "\t\t".'<span class="feed-source">' . __( "Source: ") . $source_name . ' | ' . $date . '</span>' . "$link_after" . "\n\n";
432
+ }
433
+ echo "\t\t $links_after";
434
+ echo paginate_links();
435
+
436
+ wp_reset_postdata();
437
+
438
+ } else {
439
+ _e( 'No feed items found', 'wprss' );
440
+ }
441
+ } // end wprss_display_feed_items
442
+
443
+
444
+ add_action( 'trash_wprss_feed', 'wprss_delete_feed_items' );
445
+ /**
446
+ * Delete feed items on trashing of corresponding feed source
447
+ *
448
+ * @since 2.0
449
+ */
450
+ function wprss_delete_feed_items() {
451
+ global $post;
452
+
453
+ $args = array(
454
+ 'post_type' => 'wprss_feed_item',
455
+ 'meta_query' => array(
456
+ array(
457
+ 'key' => 'wprss_feed_id',
458
+ 'value' => $post->ID,
459
+ 'compare' => 'LIKE'
460
+ )
461
+ )
462
+ );
463
+
464
+ $feed_items = new WP_Query( $args );
465
+
466
+ if ( $feed_items->have_posts() ) :
467
+ while ( $feed_items->have_posts() ) : $feed_items->the_post();
468
+ $postid = get_the_ID();
469
+
470
+ $purge = wp_delete_post( $postid, true );
471
+ endwhile;
472
+ endif;
473
+
474
+ wp_reset_postdata();
475
+ } // end wprss_delete_feed_items
476
+
477
+
478
+ /**
479
+ * Delete old feed items from the database to avoid bloat
480
+ *
481
+ * @since 2.0
482
+ */
483
+ function wprss_truncate_posts() {
484
+ global $wpdb;
485
+
486
+ // Set your threshold of max posts and post_type name
487
+ $threshold = 50;
488
+ $post_type = 'wprss_feed_item';
489
+
490
+ // Query post type
491
+ // $wpdb query allows me to select specific columns instead of grabbing the entire post object.
492
+ $query = "
493
+ SELECT ID, post_title FROM $wpdb->posts
494
+ WHERE post_type = '$post_type'
495
+ AND post_status = 'publish'
496
+ ORDER BY post_modified DESC
497
+ ";
498
+ $results = $wpdb->get_results( $query );
499
+
500
+ // Check if there are any results
501
+ if ( count( $results ) ){
502
+ foreach ( $results as $post ) {
503
+ $i++;
504
+
505
+ // Skip any posts within our threshold
506
+ if ( $i <= $threshold )
507
+ continue;
508
+
509
+ // Let the WordPress API do the heavy lifting for cleaning up entire post trails
510
+ $purge = wp_delete_post( $post->ID, true );
511
+ }
512
+ }
513
+ } // end wprss_truncate_posts