Version Description
Download this release
Release Info
Developer | jeangalea |
Plugin | WP RSS Aggregator |
Version | 3.0 |
Comparing to | |
See all releases |
Version 3.0
- changelog.txt +72 -0
- css/admin-styles.css +184 -0
- css/colorbox.css +93 -0
- css/styles.css +14 -0
- images/colorbox/border.png +0 -0
- images/colorbox/controls.png +0 -0
- images/colorbox/ie6/borderBottomCenter.png +0 -0
- images/colorbox/ie6/borderBottomLeft.png +0 -0
- images/colorbox/ie6/borderBottomRight.png +0 -0
- images/colorbox/ie6/borderMiddleLeft.png +0 -0
- images/colorbox/ie6/borderMiddleRight.png +0 -0
- images/colorbox/ie6/borderTopCenter.png +0 -0
- images/colorbox/ie6/borderTopLeft.png +0 -0
- images/colorbox/ie6/borderTopRight.png +0 -0
- images/colorbox/loading.gif +0 -0
- images/colorbox/loading_background.png +0 -0
- images/colorbox/overlay.png +0 -0
- images/facebook.png +0 -0
- images/icon-adminmenu16-sprite.png +0 -0
- images/icon-adminpage32.png +0 -0
- images/twitter.png +0 -0
- includes/admin-ajax-notice.php +78 -0
- includes/admin-debugging.php +96 -0
- includes/admin-display.php +258 -0
- includes/admin-import-export.php +97 -0
- includes/admin-metaboxes.php +322 -0
- includes/admin-options.php +520 -0
- includes/admin.php +111 -0
- includes/cron-jobs.php +80 -0
- includes/custom-feed.php +56 -0
- includes/custom-post-types.php +98 -0
- includes/deprecated-functions.php +83 -0
- includes/feed-display.php +213 -0
- includes/feed-processing.php +379 -0
- includes/libraries/WP_Logging.php +360 -0
- includes/libraries/browser.php +1082 -0
- includes/scripts.php +115 -0
- includes/shortcodes.php +20 -0
- includes/system-info.php +152 -0
- includes/update.php +208 -0
- js/admin-custom.js +69 -0
- js/custom.js +5 -0
- js/jquery.colorbox-min.js +6 -0
- languages/default.mo +0 -0
- languages/default.po +272 -0
- languages/it.mo +0 -0
- languages/it.po +274 -0
- readme.txt +167 -0
- templates/wprss.css +9 -0
- uninstall.php +11 -0
- wp-rss-aggregator.php +186 -0
changelog.txt
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
3.0 (2013-03-16)
|
2 |
+
New feature: Option to select cron frequency
|
3 |
+
New feature: Code extensibility added to be compatible with add-ons
|
4 |
+
New feature: Option to set a limit to the number of feeds stored (previously 50, hard coded)
|
5 |
+
New feature: Option to define the format of the date shown below each feed item
|
6 |
+
New feature: Option to show or hide source of feed item
|
7 |
+
New feature: Option to show or hide publish date of feed item
|
8 |
+
New feature: Option to set text preceding publish date
|
9 |
+
New feature: Option to set text preceding source of feed item
|
10 |
+
New feature: Option to link title or not
|
11 |
+
New feature: Limit of 5 items imported for each source instead of 10
|
12 |
+
Enhanced: Performance improvement when publishing new feeds in admin
|
13 |
+
Enhanced: Query tuning for better performance
|
14 |
+
Enhanced: Major code rewrite, refactoring and inclusion of hooks
|
15 |
+
Enhanced: Updated Colorbox to v1.4.1
|
16 |
+
Enhanced: Better security implementations
|
17 |
+
Enhanced: Better feed preview display
|
18 |
+
Fixed bug: Deletion of items upon source deletion not working properly
|
19 |
+
Requires: WordPress 3.3
|
20 |
+
|
21 |
+
2.2.3 (2012-11-01)
|
22 |
+
Fixed bug: Tab navigation preventing typing in input boxes
|
23 |
+
Removed: Feeds showing up in internal linking pop up
|
24 |
+
|
25 |
+
2.2.2 (2012-10-30)
|
26 |
+
Removed: Feeds showing up in site search results
|
27 |
+
Enhanced: Better tab button navigation when adding a new feed
|
28 |
+
Enhanced: Better guidance when a feed URL is invalid
|
29 |
+
|
30 |
+
2.2.1 (2012-10-17)
|
31 |
+
Fixed bug: wprss_feed_source_order assumes everyone is an admin
|
32 |
+
|
33 |
+
2.2 (2012-10-01)
|
34 |
+
New feature: Italian translation added
|
35 |
+
Enhanced: Feed source order changed to alphabetical
|
36 |
+
Fixed bug: repeated entries when having a non-valid feed source
|
37 |
+
Fixed bug: all imported feeds deleted upon trashing a single feed source
|
38 |
+
|
39 |
+
2.1 (2012-09-27)
|
40 |
+
New feature: Now localised for translations
|
41 |
+
Fixed bug: with date string
|
42 |
+
Fixed bug: $link_before and $link_after, now working
|
43 |
+
Enhanced: Added backwards compatibility for wp_rss_aggregator() function
|
44 |
+
|
45 |
+
2.0 (2012-09-21)
|
46 |
+
Bulk of code rewritten and refactored
|
47 |
+
Added install and upgrade functions
|
48 |
+
Added DB version setting
|
49 |
+
Feed sources now stored as Custom Post Types
|
50 |
+
Feed source list sortable ascending or descending by name
|
51 |
+
Removed days subsections in feed display
|
52 |
+
Ability to limit total number of feeds displayed
|
53 |
+
Feeds now fetched via Cron
|
54 |
+
Cron job to delete old feed items, keeps max of 50 items in DB
|
55 |
+
Now requires WordPress 3.2
|
56 |
+
updated colorbox to v1.3.20.1
|
57 |
+
Limit of 15 items max imported for each source
|
58 |
+
Fixed issue of page content displaying incorrectly after feeds
|
59 |
+
|
60 |
+
1.1 (2012-08-13)
|
61 |
+
Now requires WordPress 3.0
|
62 |
+
More flexible fetching of images directory
|
63 |
+
Has its own top level menu item
|
64 |
+
Added settings section
|
65 |
+
Ability to open in lightbox, new window or default browser behaviour
|
66 |
+
Ability to set links as follow or no follow
|
67 |
+
Using constants for oftenly used locations
|
68 |
+
Code refactoring
|
69 |
+
Changes in file and folder structure
|
70 |
+
|
71 |
+
1.0 (2012-01-06)
|
72 |
+
First release
|
css/admin-styles.css
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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( '../images/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('../images/twitter.png') no-repeat 0;
|
53 |
+
padding-left: 20px;
|
54 |
+
}
|
55 |
+
|
56 |
+
li.facebook a {
|
57 |
+
background: transparent url('../images/facebook.png') no-repeat 0;
|
58 |
+
padding-left: 20px;
|
59 |
+
}
|
60 |
+
|
61 |
+
li.donate_link a:hover {
|
62 |
+
color: darkGreen;
|
63 |
+
}
|
64 |
+
|
65 |
+
#preview_meta_box ul {
|
66 |
+
list-style: disc;
|
67 |
+
margin-left: 16px;
|
68 |
+
}
|
69 |
+
|
70 |
+
#preview_meta_box .invalid-feed-url {
|
71 |
+
color: red;
|
72 |
+
}
|
73 |
+
|
74 |
+
#preview_meta_box .rss-date {
|
75 |
+
color: #666;
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
/*.rss-aggregator_page_wprss-aggregator-settings .form-table th { width: 80px; }*/
|
80 |
+
|
81 |
+
|
82 |
+
/* For excerpts and thumbnails admin screens */
|
83 |
+
.wprss_feed_page_wprss-aggregator-settings input,
|
84 |
+
.wprss_feed_page_wprss-aggregator-settings input[type="checkbox"],
|
85 |
+
.wprss_feed_page_wprss-aggregator-settings input[type="radio"] {
|
86 |
+
margin-right: 8px;
|
87 |
+
}
|
88 |
+
|
89 |
+
input#default-thumbnail { width: 300px; }
|
90 |
+
|
91 |
+
input#thumbnails-height,
|
92 |
+
input#thumbnails-width {
|
93 |
+
/*width: 29px;*/
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/* Red Button */
|
98 |
+
|
99 |
+
.wp-core-ui .button-red {
|
100 |
+
background-color: #9B2124;
|
101 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#C5292E), to(#9B2124));
|
102 |
+
background-image: -webkit-linear-gradient(top, #C5292E, #9B2124);
|
103 |
+
background-image: -moz-linear-gradient(top, #C5292E, #9B2124);
|
104 |
+
background-image: -ms-linear-gradient(top, #C5292E, #9B2124);
|
105 |
+
background-image: -o-linear-gradient(top, #C5292E, #9B2124);
|
106 |
+
background-image: linear-gradient(to bottom, #C5292E, #9B2124);
|
107 |
+
border-color: #9B2124;
|
108 |
+
border-bottom-color: #8D1F21;
|
109 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
|
110 |
+
box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
|
111 |
+
color: #fff;
|
112 |
+
text-decoration: none;
|
113 |
+
text-shadow: 0 1px 0 rgba(0,0,0,0.1);
|
114 |
+
/*float: right;*/
|
115 |
+
}
|
116 |
+
|
117 |
+
.wp-core-ui .button-red.hover,
|
118 |
+
.wp-core-ui .button-red:hover,
|
119 |
+
.wp-core-ui .button-red.focus,
|
120 |
+
.wp-core-ui .button-red:focus {
|
121 |
+
background-color: #B72629;
|
122 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#D22E30), to(#9B2124));
|
123 |
+
background-image: -webkit-linear-gradient(top, #D22E30, #9B2124);
|
124 |
+
background-image: -moz-linear-gradient(top, #D22E30, #9B2124);
|
125 |
+
background-image: -ms-linear-gradient(top, #D22E30, #9B2124);
|
126 |
+
background-image: -o-linear-gradient(top, #D22E30, #9B2124);
|
127 |
+
background-image: linear-gradient(to bottom, #D22E30, #9B2124);
|
128 |
+
border-color: #7F1C1F;
|
129 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
|
130 |
+
box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
|
131 |
+
color: #fff;
|
132 |
+
text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
|
133 |
+
}
|
134 |
+
|
135 |
+
.wp-core-ui .button-red.focus,
|
136 |
+
.wp-core-ui .button-red:focus {
|
137 |
+
border-color: #500F0E;
|
138 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6), 1px 1px 2px rgba(0,0,0,0.4);
|
139 |
+
box-shadow: inset 0 1px 0 rgba(120,200,230,0.6), 1px 1px 2px rgba(0,0,0,0.4);
|
140 |
+
}
|
141 |
+
|
142 |
+
.wp-core-ui .button-red.active,
|
143 |
+
.wp-core-ui .button-red.active:hover,
|
144 |
+
.wp-core-ui .button-red.active:focus,
|
145 |
+
.wp-core-ui .button-red:active {
|
146 |
+
background: #7F1C1F;
|
147 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#9B2124), to(#B72629));
|
148 |
+
background-image: -webkit-linear-gradient(top, #9B2124, #B72629);
|
149 |
+
background-image: -moz-linear-gradient(top, #9B2124, #B72629);
|
150 |
+
background-image: -ms-linear-gradient(top, #9B2124, #B72629);
|
151 |
+
background-image: -o-linear-gradient(top, #9B2124, #B72629);
|
152 |
+
background-image: linear-gradient(to bottom, #9B2124, #B72629);
|
153 |
+
border-color: #601312 #AE2426 #AE2426 #AE2426;
|
154 |
+
color: rgba(255,255,255,0.95);
|
155 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
|
156 |
+
box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
|
157 |
+
text-shadow: 0 1px 0 rgba(0,0,0,0.1);
|
158 |
+
}
|
159 |
+
|
160 |
+
.wp-core-ui .button-red[disabled],
|
161 |
+
.wp-core-ui .button-red:disabled,
|
162 |
+
.wp-core-ui .button-red-disabled {
|
163 |
+
color: #E79496 !important;
|
164 |
+
background: #BA292B !important;
|
165 |
+
border-color: #7F1C1F !important;
|
166 |
+
-webkit-box-shadow: none !important;
|
167 |
+
box-shadow: none !important;
|
168 |
+
text-shadow: 0 -1px 0 rgba(0,0,0,0.1) !important;
|
169 |
+
cursor: default;
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
/* Excerpts and Thumbnails */
|
175 |
+
|
176 |
+
input#thumbnails-height,
|
177 |
+
input#thumbnails-width {
|
178 |
+
margin-right: 2px;
|
179 |
+
}
|
180 |
+
|
181 |
+
label[for=thumbnails-height],
|
182 |
+
label[for=thumbnails-width] {
|
183 |
+
margin-left: 8px;
|
184 |
+
}
|
css/colorbox.css
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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; -webkit-overflow-scrolling: touch;}
|
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; -moz-box-sizing:content-box; -webkit-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(../images/colorbox/overlay.png) repeat 0 0;}
|
23 |
+
#colorbox{outline:0;}
|
24 |
+
#cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px 0;}
|
25 |
+
#cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px 0;}
|
26 |
+
#cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px -29px;}
|
27 |
+
#cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px -29px;}
|
28 |
+
#cboxMiddleLeft{width:21px; background:url(../images/colorbox/controls.png) left top repeat-y;}
|
29 |
+
#cboxMiddleRight{width:21px; background:url(../images/colorbox/controls.png) right top repeat-y;}
|
30 |
+
#cboxTopCenter{height:21px; background:url(../images/colorbox/border.png) 0 0 repeat-x;}
|
31 |
+
#cboxBottomCenter{height:21px; background:url(../images/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 |
+
#cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;}
|
39 |
+
#cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;}
|
40 |
+
|
41 |
+
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
42 |
+
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
|
43 |
+
|
44 |
+
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
45 |
+
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
|
46 |
+
|
47 |
+
#cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
|
48 |
+
#cboxPrevious{position:absolute; bottom:0; left:0; background:url(../images/colorbox/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
|
49 |
+
#cboxPrevious:hover{background-position:-75px -25px;}
|
50 |
+
#cboxNext{position:absolute; bottom:0; left:27px; background:url(../images/colorbox/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
|
51 |
+
#cboxNext:hover{background-position:-50px -25px;}
|
52 |
+
#cboxClose{position:absolute; bottom:0; right:0; background:url(../images/colorbox/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
|
53 |
+
#cboxClose:hover{background-position:-25px -25px;}
|
54 |
+
|
55 |
+
/*
|
56 |
+
The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
|
57 |
+
when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
|
58 |
+
See: http://jacklmoore.com/notes/ie-transparency-problems/
|
59 |
+
*/
|
60 |
+
.cboxIE #cboxTopLeft,
|
61 |
+
.cboxIE #cboxTopCenter,
|
62 |
+
.cboxIE #cboxTopRight,
|
63 |
+
.cboxIE #cboxBottomLeft,
|
64 |
+
.cboxIE #cboxBottomCenter,
|
65 |
+
.cboxIE #cboxBottomRight,
|
66 |
+
.cboxIE #cboxMiddleLeft,
|
67 |
+
.cboxIE #cboxMiddleRight {
|
68 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
|
69 |
+
}
|
70 |
+
|
71 |
+
/*
|
72 |
+
The following provides PNG transparency support for IE6
|
73 |
+
Feel free to remove this and the /ie6/ directory if you have dropped IE6 support.
|
74 |
+
*/
|
75 |
+
.cboxIE6 #cboxTopLeft{background:url(../images/colorbox/ie6/borderTopLeft.png);}
|
76 |
+
.cboxIE6 #cboxTopCenter{background:url(../images/colorbox/ie6/borderTopCenter.png);}
|
77 |
+
.cboxIE6 #cboxTopRight{background:url(../images/colorbox/ie6/borderTopRight.png);}
|
78 |
+
.cboxIE6 #cboxBottomLeft{background:url(../images/colorbox/ie6/borderBottomLeft.png);}
|
79 |
+
.cboxIE6 #cboxBottomCenter{background:url(../images/colorbox/ie6/borderBottomCenter.png);}
|
80 |
+
.cboxIE6 #cboxBottomRight{background:url(../images/colorbox/ie6/borderBottomRight.png);}
|
81 |
+
.cboxIE6 #cboxMiddleLeft{background:url(../images/colorbox/ie6/borderMiddleLeft.png);}
|
82 |
+
.cboxIE6 #cboxMiddleRight{background:url(../images/colorbox/ie6/borderMiddleRight.png);}
|
83 |
+
|
84 |
+
.cboxIE6 #cboxTopLeft,
|
85 |
+
.cboxIE6 #cboxTopCenter,
|
86 |
+
.cboxIE6 #cboxTopRight,
|
87 |
+
.cboxIE6 #cboxBottomLeft,
|
88 |
+
.cboxIE6 #cboxBottomCenter,
|
89 |
+
.cboxIE6 #cboxBottomRight,
|
90 |
+
.cboxIE6 #cboxMiddleLeft,
|
91 |
+
.cboxIE6 #cboxMiddleRight {
|
92 |
+
_behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
|
93 |
+
}
|
css/styles.css
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
li.feed-item { margin-bottom: 10px; }
|
2 |
+
|
3 |
+
.thumbnail-excerpt {
|
4 |
+
overflow:hidden;
|
5 |
+
margin-bottom: 5px;
|
6 |
+
}
|
7 |
+
|
8 |
+
.thumbnail-excerpt img {
|
9 |
+
max-width:100%; float:left; margin-top: 0.5em; margin-right:10px;
|
10 |
+
}
|
11 |
+
|
12 |
+
div.source-date { clear: both; }
|
13 |
+
|
14 |
+
span.feed-source { font-size: 90%; }
|
images/colorbox/border.png
ADDED
Binary file
|
images/colorbox/controls.png
ADDED
Binary file
|
images/colorbox/ie6/borderBottomCenter.png
ADDED
Binary file
|
images/colorbox/ie6/borderBottomLeft.png
ADDED
Binary file
|
images/colorbox/ie6/borderBottomRight.png
ADDED
Binary file
|
images/colorbox/ie6/borderMiddleLeft.png
ADDED
Binary file
|
images/colorbox/ie6/borderMiddleRight.png
ADDED
Binary file
|
images/colorbox/ie6/borderTopCenter.png
ADDED
Binary file
|
images/colorbox/ie6/borderTopLeft.png
ADDED
Binary file
|
images/colorbox/ie6/borderTopRight.png
ADDED
Binary file
|
images/colorbox/loading.gif
ADDED
Binary file
|
images/colorbox/loading_background.png
ADDED
Binary file
|
images/colorbox/overlay.png
ADDED
Binary file
|
images/facebook.png
ADDED
Binary file
|
images/icon-adminmenu16-sprite.png
ADDED
Binary file
|
images/icon-adminpage32.png
ADDED
Binary file
|
images/twitter.png
ADDED
Binary file
|
includes/admin-ajax-notice.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Serves up a notice to leave a review for this plugin
|
5 |
+
*
|
6 |
+
* @link http://wp.tutsplus.com/tutorials/creative-coding/a-primer-on-ajax-in-the-wordpress-dashboard-requesting-and-responding/
|
7 |
+
* @link http://wptheming.com/2011/08/admin-notices-in-wordpress/
|
8 |
+
*
|
9 |
+
* @since 3.0
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
add_action( 'admin_init', 'wprss_admin_notice' );
|
15 |
+
/**
|
16 |
+
* Serves up a notice to leave a review for this plugin
|
17 |
+
*
|
18 |
+
* @since 3.0
|
19 |
+
*/
|
20 |
+
function wprss_admin_notice() {
|
21 |
+
global $pagenow, $typenow;
|
22 |
+
if ( empty( $typenow ) && !empty( $_GET['post'] ) ) {
|
23 |
+
$post = get_post( $_GET['post'] );
|
24 |
+
$typenow = $post->post_type;
|
25 |
+
}
|
26 |
+
$notices_settings = get_option( 'wprss_settings_notices' );
|
27 |
+
|
28 |
+
// Display the admin notice only if it hasn't been hidden and we are on a screen of WP RSS Aggregator
|
29 |
+
if ( ( false == $notices_settings ) && ( ( $typenow == 'wprss_feed' ) || ( $typenow == 'wprss_feed_item' ) ) ) {
|
30 |
+
add_action( 'admin_notices', 'wprss_display_admin_notice' );
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Renders the administration notice. Also renders a hidden nonce used for security when processing the Ajax request.
|
38 |
+
*
|
39 |
+
* @since 3.0
|
40 |
+
*/
|
41 |
+
function wprss_display_admin_notice() {
|
42 |
+
|
43 |
+
$html = '<div id="ajax-notification" class="updated">';
|
44 |
+
$html .= '<p>';
|
45 |
+
$html .= __( 'If you like this RSS Aggregator plugin, please <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wp-rss-aggregator">give it a good rating and leave a review</a>. Your feedback will help me improve this plugin further. Thank you. <a href="javascript:;"
|
46 |
+
id="dismiss-ajax-notification" style="float:right;">Dismiss this notification</a>', 'wprss' );
|
47 |
+
$html .= '</p>';
|
48 |
+
$html .= '<span id="ajax-notification-nonce" class="hidden">' . wp_create_nonce( 'ajax-notification-nonce' ) . '</span>';
|
49 |
+
$html .= '</div><!-- /.updated -->';
|
50 |
+
|
51 |
+
echo $html;
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
add_action( 'wp_ajax_wprss_hide_admin_notification', 'wprss_hide_admin_notification' );
|
56 |
+
/**
|
57 |
+
* JavaScript callback used to hide the administration notice when the 'Dismiss' anchor is clicked on the front end.
|
58 |
+
*
|
59 |
+
* @since 3.0
|
60 |
+
*/
|
61 |
+
function wprss_hide_admin_notification() {
|
62 |
+
|
63 |
+
// First, check the nonce to make sure it matches what we created when displaying the message.
|
64 |
+
// If not, we won't do anything.
|
65 |
+
if( wp_verify_nonce( $_REQUEST['nonce'], 'ajax-notification-nonce' ) ) {
|
66 |
+
|
67 |
+
// If the update to the option is successful, send 1 back to the browser;
|
68 |
+
// Otherwise, send 0.
|
69 |
+
$general_settings = get_option( 'wprss_settings_notices' );
|
70 |
+
$general_settings = true;
|
71 |
+
|
72 |
+
if( update_option( 'wprss_settings_notices', $general_settings ) ) {
|
73 |
+
die( '1' );
|
74 |
+
} else {
|
75 |
+
die( '0' );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
includes/admin-debugging.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin debugging
|
4 |
+
*
|
5 |
+
* @package WPRSSAggregator
|
6 |
+
* @subpackage Includes
|
7 |
+
* @since 3.0
|
8 |
+
* @author Jean Galea <info@jeangalea.com>
|
9 |
+
* @copyright Copyright(c) 2012-2013, Jean Galea
|
10 |
+
* @link http://www.wpmayor.com
|
11 |
+
* @license http://www.gnu.org/licenses/gpl.html
|
12 |
+
*/
|
13 |
+
|
14 |
+
//allow redirection, even if my theme starts to send output to the browser
|
15 |
+
add_action('admin_init', 'do_output_buffer');
|
16 |
+
function do_output_buffer() {
|
17 |
+
// ob_start();
|
18 |
+
}
|
19 |
+
/**
|
20 |
+
* Build the debugging page
|
21 |
+
*
|
22 |
+
* @since 3.0
|
23 |
+
*/
|
24 |
+
function wprss_debugging_page_display() {
|
25 |
+
// If page loading after having clicked 'Update all fields'
|
26 |
+
if ( isset( $_POST['update-feeds'] ) && check_admin_referer( 'wprss-update-feed-items' ) ) {
|
27 |
+
wprss_fetch_insert_all_feed_items();
|
28 |
+
wp_redirect( "edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=1" );
|
29 |
+
}
|
30 |
+
|
31 |
+
// If page loading after having clicked 'Delete and re-import all fields'
|
32 |
+
else if ( isset( $_POST['reimport-feeds'] ) && check_admin_referer( 'wprss-delete-import-feed-items' ) ) {
|
33 |
+
wprss_feed_reset();
|
34 |
+
wp_redirect( "edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=2" );
|
35 |
+
}
|
36 |
+
?>
|
37 |
+
|
38 |
+
<div class="wrap">
|
39 |
+
<?php screen_icon( 'wprss-aggregator' ); ?>
|
40 |
+
|
41 |
+
<h2><?php _e( 'Debugging', 'wprss' ); ?></h2>
|
42 |
+
<?php
|
43 |
+
if ( isset( $_GET['debug_message'] )) {//&& ( check_admin_referer( 'wprss-delete-import-feed-items' ) || check_admin_referer( 'wprss-update-feed-items' ) ) ) {
|
44 |
+
$message = $_GET['debug_message'];
|
45 |
+
|
46 |
+
switch ( $message ) {
|
47 |
+
case 1 :
|
48 |
+
wprss_debugging_admin_notice_update_feeds();
|
49 |
+
break;
|
50 |
+
case 2 :
|
51 |
+
wprss_debugging_admin_notice_reimport_feeds();
|
52 |
+
break;
|
53 |
+
}
|
54 |
+
} ?>
|
55 |
+
<h3><?php _e( 'Update All Feeds Now', 'wprss' ); ?></h3>
|
56 |
+
<p><?php _e( 'Click the blue button to update all feed items now.', 'wprss' ); ?></p>
|
57 |
+
<p><?php _e( '<strong>Note:</strong> This might take more than a few seconds if you have many feed sources.', 'wprss' ); ?></p>
|
58 |
+
|
59 |
+
<form action="edit.php?post_type=wprss_feed&page=wprss-debugging" method="post">
|
60 |
+
|
61 |
+
<?php wp_nonce_field( 'wprss-update-feed-items' );
|
62 |
+
submit_button( __( 'Update all feeds', 'wprss' ), 'primary', 'update-feeds', true ); ?>
|
63 |
+
|
64 |
+
</form>
|
65 |
+
|
66 |
+
<h3><?php _e( 'Delete and Re-import Feeds', 'wprss' ); ?></h3>
|
67 |
+
<p><?php _e( 'Click the red button to delete all imported feed items and re-import them.', 'wprss' ); ?></p>
|
68 |
+
<p><?php _e( '<em><strong>Note:</strong> This is a server-intensive process and should only be used when instructed to by support staff.</em>', 'wprss' ); ?></p>
|
69 |
+
|
70 |
+
<form action="edit.php?post_type=wprss_feed&page=wprss-debugging" method="post">
|
71 |
+
|
72 |
+
<?php wp_nonce_field( 'wprss-delete-import-feed-items' );
|
73 |
+
submit_button( __( 'Delete and Re-import all feeds', 'wprss' ), 'button-red', 'reimport-feeds', true ); ?>
|
74 |
+
|
75 |
+
</form>
|
76 |
+
</div>
|
77 |
+
<?php
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Output admin notice that feeds have been updated successfully
|
82 |
+
*
|
83 |
+
* @since 3.0
|
84 |
+
*/
|
85 |
+
function wprss_debugging_admin_notice_update_feeds() {
|
86 |
+
echo '<div class="updated"><p>Feeds have been updated successfully.</p></div>';
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Output admin notice that feeds have been deleted and re-imported successfully
|
91 |
+
*
|
92 |
+
* @since 3.0
|
93 |
+
*/
|
94 |
+
function wprss_debugging_admin_notice_reimport_feeds() {
|
95 |
+
echo '<div class="updated"><p>Feeds deleted and re-imported successfully.</p></div>';
|
96 |
+
}
|
includes/admin-display.php
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'manage_edit-wprss_feed_columns', 'wprss_set_feed_custom_columns');
|
4 |
+
/**
|
5 |
+
* Set up the custom columns for the wprss_feed list
|
6 |
+
*
|
7 |
+
* @since 2.0
|
8 |
+
*/
|
9 |
+
function wprss_set_feed_custom_columns( $columns ) {
|
10 |
+
|
11 |
+
$columns = array(
|
12 |
+
'cb' => '<input type="checkbox" />',
|
13 |
+
'title' => __( 'Name', 'wprss' ),
|
14 |
+
'url' => __( 'URL', 'wprss' ),
|
15 |
+
'description' => __( 'Description', 'wprss' ),
|
16 |
+
);
|
17 |
+
return apply_filters( 'wprss_set_feed_custom_columns', $columns );
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
add_action( "manage_wprss_feed_posts_custom_column", "wprss_show_custom_columns", 10, 2 );
|
22 |
+
/**
|
23 |
+
* Show up the custom columns for the wprss_feed list
|
24 |
+
*
|
25 |
+
* @since 2.0
|
26 |
+
*/
|
27 |
+
function wprss_show_custom_columns( $column, $post_id ) {
|
28 |
+
|
29 |
+
switch ( $column ) {
|
30 |
+
case 'url':
|
31 |
+
$url = get_post_meta( $post_id, 'wprss_url', true);
|
32 |
+
echo '<a href="' . esc_url($url) . '">' . esc_url($url) . '</a>';
|
33 |
+
break;
|
34 |
+
case 'description':
|
35 |
+
$description = get_post_meta( $post_id, 'wprss_description', true);
|
36 |
+
echo esc_html( $description );
|
37 |
+
break;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Make the custom columns sortable for wprss_feed post type
|
44 |
+
*
|
45 |
+
* @since 2.0
|
46 |
+
*/
|
47 |
+
function wprss_feed_sortable_columns() {
|
48 |
+
$sortable_columns = array(
|
49 |
+
// meta column id => sortby value used in query
|
50 |
+
'title' => 'title',
|
51 |
+
);
|
52 |
+
return apply_filters( 'wprss_feed_sortable_columns', $sortable_columns );
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
add_action( 'pre_get_posts', 'wprss_feed_source_order' );
|
57 |
+
/**
|
58 |
+
* Change order of feed sources to alphabetical ascending according to feed name
|
59 |
+
*
|
60 |
+
* @since 2.2
|
61 |
+
*/
|
62 |
+
function wprss_feed_source_order( $query ) {
|
63 |
+
if ( ! is_admin() ) {
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
$post_type = $query->get('post_type');
|
68 |
+
|
69 |
+
if ( $post_type == 'wprss_feed' ) {
|
70 |
+
/* Post Column: e.g. title */
|
71 |
+
if ( $query->get( 'orderby' ) == '' ) {
|
72 |
+
$query->set( 'orderby', 'title' );
|
73 |
+
}
|
74 |
+
/* Post Order: ASC / DESC */
|
75 |
+
if( $query->get( 'order' ) == '' ){
|
76 |
+
$query->set( 'order', 'ASC' );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
add_filter( 'manage_edit-wprss_feed_item_columns', 'wprss_set_feed_item_custom_columns');
|
83 |
+
/**
|
84 |
+
* Set up the custom columns for the wprss_feed source list
|
85 |
+
*
|
86 |
+
* @since 2.0
|
87 |
+
*/
|
88 |
+
function wprss_set_feed_item_custom_columns( $columns ) {
|
89 |
+
|
90 |
+
$columns = array (
|
91 |
+
'cb' => '<input type="checkbox" />',
|
92 |
+
'title' => __( 'Name', 'wprss' ),
|
93 |
+
'permalink' => __( 'Permalink', 'wprss' ),
|
94 |
+
'publishdate' => __( 'Date published', 'wprss' ),
|
95 |
+
'source' => __( 'Source', 'wprss' )
|
96 |
+
);
|
97 |
+
return apply_filters( 'wprss_set_feed_item_custom_columns', $columns );
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
add_action( "manage_wprss_feed_item_posts_custom_column", "wprss_show_feed_item_custom_columns", 10, 2 );
|
102 |
+
/**
|
103 |
+
* Show up the custom columns for the wprss_feed list
|
104 |
+
*
|
105 |
+
* @since 2.0
|
106 |
+
*/
|
107 |
+
function wprss_show_feed_item_custom_columns( $column, $post_id ) {
|
108 |
+
|
109 |
+
switch ( $column ) {
|
110 |
+
case "permalink":
|
111 |
+
$url = get_post_meta( $post_id, 'wprss_item_permalink', true);
|
112 |
+
echo '<a href="' . $url . '">' . $url. '</a>';
|
113 |
+
break;
|
114 |
+
|
115 |
+
case "publishdate":
|
116 |
+
$publishdate = date( 'Y-m-d H:i:s', get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) ;
|
117 |
+
echo $publishdate;
|
118 |
+
break;
|
119 |
+
|
120 |
+
case "source":
|
121 |
+
$query = new WP_Query();
|
122 |
+
$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>';
|
123 |
+
echo $source;
|
124 |
+
break;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
add_filter( "manage_edit-wprss_feed_item_sortable_columns", "wprss_feed_item_sortable_columns" );
|
130 |
+
/**
|
131 |
+
* Make the custom columns sortable
|
132 |
+
*
|
133 |
+
* @since 2.0
|
134 |
+
*/
|
135 |
+
function wprss_feed_item_sortable_columns() {
|
136 |
+
$sortable_columns = array(
|
137 |
+
// meta column id => sortby value used in query
|
138 |
+
'publishdate' => 'publishdate',
|
139 |
+
'source' => 'source'
|
140 |
+
);
|
141 |
+
return apply_filters( 'wprss_feed_item_sortable_columns', $sortable_columns );
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
add_action( 'pre_get_posts', 'wprss_feed_item_orderby' );
|
146 |
+
/**
|
147 |
+
* Change ordering of posts on wprss_feed_item screen
|
148 |
+
*
|
149 |
+
* @since 2.0
|
150 |
+
*/
|
151 |
+
function wprss_feed_item_orderby( $query ) {
|
152 |
+
if( ! is_admin() )
|
153 |
+
return;
|
154 |
+
|
155 |
+
$post_type = $query->get('post_type');
|
156 |
+
|
157 |
+
// If we're on the feed listing admin page
|
158 |
+
if ( $post_type == 'wprss_feed_item') {
|
159 |
+
// Set general orderby to date the feed item was published
|
160 |
+
$query->set('orderby','publishdate');
|
161 |
+
// If user clicks on the reorder link, implement reordering
|
162 |
+
$orderby = $query->get( 'orderby');
|
163 |
+
if( 'publishdate' == $orderby ) {
|
164 |
+
$query->set( 'meta_key', 'wprss_item_date' );
|
165 |
+
$query->set( 'orderby', 'meta_value_num' );
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
add_filter( 'post_updated_messages', 'wprss_feed_updated_messages' );
|
172 |
+
/**
|
173 |
+
* Change default notification message when new feed is added or updated
|
174 |
+
*
|
175 |
+
* @since 2.0
|
176 |
+
*/
|
177 |
+
function wprss_feed_updated_messages( $messages ) {
|
178 |
+
global $post, $post_ID;
|
179 |
+
|
180 |
+
$messages[ 'wprss_feed' ] = array(
|
181 |
+
0 => '', // Unused. Messages start at index 1.
|
182 |
+
1 => __( 'Feed source updated. ', 'wprss' ),
|
183 |
+
2 => __( 'Custom field updated.', 'wprss' ),
|
184 |
+
3 => __( 'Custom field deleted.', 'wprss' ),
|
185 |
+
4 => __( 'Feed source updated.', 'wprss' ),
|
186 |
+
5 => '',
|
187 |
+
6 => __( 'Feed source saved.', 'wprss' ),
|
188 |
+
7 => __( 'Feed source saved.', 'wprss' ),
|
189 |
+
8 => __( 'Feed source submitted.', 'wprss' ),
|
190 |
+
9 => '',
|
191 |
+
10 => __( 'Feed source updated.', 'wprss' )
|
192 |
+
);
|
193 |
+
|
194 |
+
return apply_filters( 'wprss_feed_updated_messages', $messages );
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
add_filter( 'post_row_actions', 'wprss_remove_row_actions', 10, 1 );
|
199 |
+
/**
|
200 |
+
* Remove actions row for imported feed items, we don't want them to be editable or viewable
|
201 |
+
*
|
202 |
+
* @since 2.0
|
203 |
+
*/
|
204 |
+
function wprss_remove_row_actions( $actions )
|
205 |
+
{
|
206 |
+
if ( get_post_type() === 'wprss_feed_item' ) {
|
207 |
+
unset( $actions[ 'edit' ] );
|
208 |
+
unset( $actions[ 'view' ] );
|
209 |
+
//unset( $actions[ 'trash' ] );
|
210 |
+
unset( $actions[ 'inline hide-if-no-js' ] );
|
211 |
+
}
|
212 |
+
return apply_filters( 'wprss_remove_row_actions', $actions );
|
213 |
+
}
|
214 |
+
|
215 |
+
|
216 |
+
add_filter( 'bulk_actions-edit-wprss_feed_item', 'wprss_custom_feed_item_bulk_actions' );
|
217 |
+
/**
|
218 |
+
* Remove bulk action link to edit imported feed items
|
219 |
+
*
|
220 |
+
* @since 2.0
|
221 |
+
*/
|
222 |
+
function wprss_custom_feed_item_bulk_actions( $actions ){
|
223 |
+
unset( $actions[ 'edit' ] );
|
224 |
+
return apply_filters( 'wprss_custom_feed_item_bulk_actions', $actions );
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
add_action( 'admin_footer-edit.php', 'wprss_remove_a_from_feed_title' );
|
229 |
+
/**
|
230 |
+
* Remove hyperlink from imported feed titles in list posts screen
|
231 |
+
*
|
232 |
+
* @since 2.0
|
233 |
+
*/
|
234 |
+
function wprss_remove_a_from_feed_title() {
|
235 |
+
if ( 'edit-wprss_feed_item' !== get_current_screen()->id )
|
236 |
+
return;
|
237 |
+
?>
|
238 |
+
|
239 |
+
<script type="text/javascript">
|
240 |
+
jQuery('table.wp-list-table a.row-title').contents().unwrap();
|
241 |
+
</script>
|
242 |
+
<?php
|
243 |
+
}
|
244 |
+
|
245 |
+
|
246 |
+
add_filter( 'gettext', 'wprss_change_publish_button_text', 10, 2 );
|
247 |
+
/**
|
248 |
+
* Modify 'Publish' button text when adding a new feed source
|
249 |
+
*
|
250 |
+
* @since 2.0
|
251 |
+
*/
|
252 |
+
function wprss_change_publish_button_text( $translation, $text ) {
|
253 |
+
if ( 'wprss_feed' == get_post_type()) {
|
254 |
+
if ( $text == 'Publish' )
|
255 |
+
return __( 'Publish Feed', 'wprss' );
|
256 |
+
}
|
257 |
+
return apply_filters( 'wprss_change_publish_button_text', $translation );
|
258 |
+
}
|
includes/admin-import-export.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Build the import/export settings page, used to import and export the plugin's settings
|
4 |
+
* Based on http://wp.tutsplus.com/tutorials/creative-coding/creating-a-simple-backuprestore-settings-feature/
|
5 |
+
* @since 3.0
|
6 |
+
* @todo not working properly, need to fix it and also include other settings (excerpts and thumbnails)
|
7 |
+
*/
|
8 |
+
|
9 |
+
function wprss_import_export_settings_page_display() {
|
10 |
+
ob_start(); // for import and export functionality, need to check about whether this is needed
|
11 |
+
if ( !isset( $_POST['export'] ) ) {
|
12 |
+
?>
|
13 |
+
<div class="wrap">
|
14 |
+
<?php screen_icon( 'wprss-aggregator' ); ?>
|
15 |
+
|
16 |
+
<h2><?php _e( 'Import & Export Settings', 'wprss' ); ?></h2>
|
17 |
+
|
18 |
+
<h3><?php _e( 'Export Settings', 'wprss' ); ?></h3>
|
19 |
+
<p><?php _e( 'Click the <strong>Export Settings</strong> button to generate a file containing all the settings used by WP RSS Aggregator', 'wprss' ); ?></p>
|
20 |
+
<p><?php _e( 'After exporting, you can either use the backup file to restore your settings to this site or to another WordPress site.</p>', 'wprss' ); ?></p>
|
21 |
+
|
22 |
+
<form method="post">
|
23 |
+
<p class="submit">
|
24 |
+
<?php wp_nonce_field( 'wprss-settings-export' ); ?>
|
25 |
+
<input type="submit" name="export" value="<?php _e( 'Export Settings', 'wprss' ); ?>" class="button" />
|
26 |
+
</p>
|
27 |
+
</form>
|
28 |
+
|
29 |
+
<h3><?php _e( 'Import Settings', 'wprss' ); ?></h3>
|
30 |
+
<p><?php _e( 'Click the <strong>Choose file</strong> button and choose a backup file.', 'wprss' ); ?></p>
|
31 |
+
<p><?php _e( 'Press the <strong>Import Settings</strong> button, and WordPress will do the rest for you.', 'wprss' ); ?></p>
|
32 |
+
<form method='post' enctype='multipart/form-data'>
|
33 |
+
<p class="submit">
|
34 |
+
<?php wp_nonce_field( 'wprss-settings-import' ); ?>
|
35 |
+
<input type='file' name='import' />
|
36 |
+
<input type='submit' name='import' value="<?php _e( 'Import Settings', 'wprss' ); ?>" class="button" />
|
37 |
+
</p>
|
38 |
+
</form>
|
39 |
+
|
40 |
+
<h3><?php _e( 'Importing/Exporting Feed Sources', 'wprss' ); ?></h3>
|
41 |
+
<p><?php _e( 'To import/export your feed sources, please use the standard WordPress <a href="' . get_admin_url() . 'import.php">Import</a> and <a href="' . get_admin_url() . 'export.php">Export</a> functionality.', 'wprss' ); ?></p>
|
42 |
+
<p><?php _e( 'On the <a href="' . get_admin_url() . 'export.php">Export</a> page, check the <strong>Feed Sources</strong> radio button and click the <strong>Download Export File</strong> button. WordPress will then create an XML file containing all the feed sources.', 'wprss' ); ?></p>
|
43 |
+
<p><?php _e( 'On the <a href="' . get_admin_url() . 'import.php">Import</a> page, choose the previously created file and click the <strong>Upload file and import</strong> button.', 'wprss' ); ?></p>
|
44 |
+
|
45 |
+
</div>
|
46 |
+
<?php
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( isset( $_FILES['import'] ) && check_admin_referer( 'wprss-settings-import' ) ) {
|
50 |
+
if ( $_FILES['import']['error'] > 0)
|
51 |
+
wp_die( "Error during import" );
|
52 |
+
else {
|
53 |
+
$file_name = $_FILES['import']['name'];
|
54 |
+
$file_ext = strtolower( end( explode( ".", $file_name ) ) );
|
55 |
+
$file_size = $_FILES['import']['size'];
|
56 |
+
if ( ( $file_ext == "json" ) && ( $file_size < 500000 ) ) {
|
57 |
+
$encode_options = file_get_contents( $_FILES['import']['tmp_name'] );
|
58 |
+
$options = json_decode( $encode_options, true );
|
59 |
+
foreach ( $options as $key => $value ) {
|
60 |
+
update_option( $key, $value );
|
61 |
+
}
|
62 |
+
echo '<div class="updated"><p>' . __( 'All options are restored successfully.', 'wprss' ) . '</p></div>';
|
63 |
+
}
|
64 |
+
else
|
65 |
+
echo '<div class="error"><p>' . __( 'Invalid file or file size too big.', 'wprss' ) . '</p></div>';
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
else if ( isset( $_POST['export'] ) && check_admin_referer( 'wprss-settings-export' ) ) {
|
70 |
+
$blogname = str_replace( " ", "", get_option( 'blogname' ) );
|
71 |
+
$date = date( "m-d-Y" );
|
72 |
+
$json_name = $blogname . "-" . $date; // Naming the filename that will be generated.
|
73 |
+
|
74 |
+
$options = apply_filters(
|
75 |
+
'wprss_fields_export',
|
76 |
+
array(
|
77 |
+
'wprss_settings_general' => get_option( 'wprss_settings_general' )
|
78 |
+
)
|
79 |
+
);
|
80 |
+
$json_file = json_encode( $options );
|
81 |
+
|
82 |
+
foreach ( $options as $key => $value ) {
|
83 |
+
$value = maybe_unserialize( $value );
|
84 |
+
$need_options[ $key ] = $value;
|
85 |
+
}
|
86 |
+
|
87 |
+
$json_file = json_encode( $need_options ); // Encode data into json data
|
88 |
+
|
89 |
+
ob_clean();
|
90 |
+
echo $json_file;
|
91 |
+
header( "Content-Type: text/json; charset=" . get_option( 'blog_charset' ) );
|
92 |
+
header( "Content-Disposition: attachment; filename=$json_name.json" );
|
93 |
+
add_action( 'admin_notices', 'my_admin_notice' );
|
94 |
+
exit();
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
includes/admin-metaboxes.php
ADDED
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action( 'add_meta_boxes', 'wprss_add_meta_boxes');
|
4 |
+
/**
|
5 |
+
* Set up the input boxes for the wprss_feed post type
|
6 |
+
*
|
7 |
+
* @since 2.0
|
8 |
+
*/
|
9 |
+
function wprss_add_meta_boxes() {
|
10 |
+
global $wprss_meta_fields;
|
11 |
+
|
12 |
+
// Remove the default WordPress Publish box, because we will be using custom ones
|
13 |
+
remove_meta_box( 'submitdiv', 'wprss_feed', 'side' );
|
14 |
+
|
15 |
+
add_meta_box(
|
16 |
+
'submitdiv', // $id
|
17 |
+
__( 'Save Feed Source', 'wprss' ), // $title
|
18 |
+
'post_submit_meta_box', // $callback
|
19 |
+
'wprss_feed', // $page
|
20 |
+
'side', // $context
|
21 |
+
'low' // $priority
|
22 |
+
);
|
23 |
+
|
24 |
+
add_meta_box(
|
25 |
+
'custom_meta_box',
|
26 |
+
__( 'Feed Source Details', 'wprss' ),
|
27 |
+
'wprss_show_meta_box_callback',
|
28 |
+
'wprss_feed',
|
29 |
+
'normal',
|
30 |
+
'high'
|
31 |
+
);
|
32 |
+
|
33 |
+
add_meta_box(
|
34 |
+
'wprss-help-meta',
|
35 |
+
__( 'WP RSS Aggregator Help', 'wprss' ),
|
36 |
+
'wprss_help_meta_box_callback',
|
37 |
+
'wprss_feed',
|
38 |
+
'side',
|
39 |
+
'low'
|
40 |
+
);
|
41 |
+
|
42 |
+
add_meta_box(
|
43 |
+
'wprss-like-meta',
|
44 |
+
__( 'Like this plugin?', 'wprss' ),
|
45 |
+
'wprss_like_meta_box_callback',
|
46 |
+
'wprss_feed',
|
47 |
+
'side',
|
48 |
+
'low'
|
49 |
+
);
|
50 |
+
|
51 |
+
add_meta_box(
|
52 |
+
'wprss-follow-meta',
|
53 |
+
__( 'Follow us', 'wprss' ),
|
54 |
+
'wprss_follow_meta_box_callback',
|
55 |
+
'wprss_feed',
|
56 |
+
'side',
|
57 |
+
'low'
|
58 |
+
);
|
59 |
+
|
60 |
+
add_meta_box(
|
61 |
+
'preview_meta_box',
|
62 |
+
__( 'Feed Preview', 'wprss' ),
|
63 |
+
'wprss_preview_meta_box_callback',
|
64 |
+
'wprss_feed',
|
65 |
+
'normal',
|
66 |
+
'low'
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Set up fields for the meta box for the wprss_feed post type
|
73 |
+
*
|
74 |
+
* @since 2.0
|
75 |
+
*/
|
76 |
+
function wprss_get_custom_fields() {
|
77 |
+
$prefix = 'wprss_';
|
78 |
+
|
79 |
+
// Field Array
|
80 |
+
$wprss_meta_fields[ 'url' ] = array(
|
81 |
+
'label' => __( 'URL', 'wprss' ),
|
82 |
+
'desc' => __( 'Enter feed URL (including http://)', 'wprss' ),
|
83 |
+
'id' => $prefix .'url',
|
84 |
+
'type' => 'text'
|
85 |
+
);
|
86 |
+
|
87 |
+
$wprss_meta_fields[' description' ] = array(
|
88 |
+
'label' => __( 'Description', 'wprss' ),
|
89 |
+
'desc' => __( 'A short description about this feed source (optional)', 'wprss' ),
|
90 |
+
'id' => $prefix .'description',
|
91 |
+
'type' => 'textarea'
|
92 |
+
);
|
93 |
+
|
94 |
+
// for extensibility, allows more meta fields to be added
|
95 |
+
return apply_filters( 'wprss_fields', $wprss_meta_fields );
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Set up the meta box for the wprss_feed post type
|
101 |
+
*
|
102 |
+
* @since 2.0
|
103 |
+
*/
|
104 |
+
function wprss_show_meta_box_callback() {
|
105 |
+
global $post;
|
106 |
+
$meta_fields = wprss_get_custom_fields();
|
107 |
+
|
108 |
+
// Use nonce for verification
|
109 |
+
wp_nonce_field( basename( __FILE__ ), 'wprss_meta_box_nonce' );
|
110 |
+
|
111 |
+
// Begin the field table and loop
|
112 |
+
echo '<table class="form-table">';
|
113 |
+
|
114 |
+
foreach ( $meta_fields as $field ) {
|
115 |
+
|
116 |
+
// get value of this field if it exists for this post
|
117 |
+
$meta = get_post_meta( $post->ID, $field['id'], true );
|
118 |
+
// begin a table row with
|
119 |
+
echo '<tr>
|
120 |
+
<th><label for="' . $field['id'] . '">' . $field['label'] . '</label></th>
|
121 |
+
<td>';
|
122 |
+
|
123 |
+
switch( $field['type'] ) {
|
124 |
+
|
125 |
+
// text
|
126 |
+
case 'text':
|
127 |
+
echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'. esc_attr( $meta ) .'" size="55" />
|
128 |
+
<br><span class="description">'.$field['desc'].'</span>';
|
129 |
+
break;
|
130 |
+
|
131 |
+
// textarea
|
132 |
+
case 'textarea':
|
133 |
+
echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'. esc_attr( $meta ) .'</textarea>
|
134 |
+
<br><span class="description">'.$field['desc'].'</span>';
|
135 |
+
break;
|
136 |
+
|
137 |
+
// checkbox
|
138 |
+
case 'checkbox':
|
139 |
+
echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ', esc_attr( $meta ) ? ' checked="checked"' : '','/>
|
140 |
+
<label for="'.$field['id'].'">'.$field['desc'].'</label>';
|
141 |
+
break;
|
142 |
+
|
143 |
+
// select
|
144 |
+
case 'select':
|
145 |
+
echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';
|
146 |
+
foreach ($field['options'] as $option) {
|
147 |
+
echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';
|
148 |
+
}
|
149 |
+
echo '</select><br><span class="description">'.$field['desc'].'</span>';
|
150 |
+
break;
|
151 |
+
|
152 |
+
} //end switch
|
153 |
+
echo '</td></tr>';
|
154 |
+
} // end foreach
|
155 |
+
echo '</table>'; // end table
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
add_action( 'save_post', 'wprss_save_custom_fields', 10, 2 );
|
160 |
+
/**
|
161 |
+
* Save the custom fields
|
162 |
+
*
|
163 |
+
* @since 2.0
|
164 |
+
*/
|
165 |
+
function wprss_save_custom_fields( $post_id, $post ) {
|
166 |
+
$meta_fields = wprss_get_custom_fields();
|
167 |
+
|
168 |
+
/* Verify the nonce before proceeding. */
|
169 |
+
if ( !isset( $_POST['wprss_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wprss_meta_box_nonce'], basename( __FILE__ ) ) )
|
170 |
+
return $post_id;
|
171 |
+
|
172 |
+
/* Get the post type object. */
|
173 |
+
$post_type = get_post_type_object( $post->post_type );
|
174 |
+
|
175 |
+
/* Check if the current user has permission to edit the post. */
|
176 |
+
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
|
177 |
+
return $post_id;
|
178 |
+
|
179 |
+
/* // Stop WP from clearing custom fields on autosave - maybe not needed
|
180 |
+
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
181 |
+
return;
|
182 |
+
|
183 |
+
// Prevent quick edit from clearing custom fields - maybe not needed
|
184 |
+
if (defined('DOING_AJAX') && DOING_AJAX)
|
185 |
+
return; */
|
186 |
+
|
187 |
+
/** Bail out if running an autosave, ajax or a cron */
|
188 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
189 |
+
return;
|
190 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
191 |
+
return;
|
192 |
+
if ( defined( 'DOING_CRON' ) && DOING_CRON )
|
193 |
+
return;
|
194 |
+
|
195 |
+
// loop through fields and save the data
|
196 |
+
foreach ( $meta_fields as $field ) {
|
197 |
+
$old = get_post_meta( $post_id, $field[ 'id' ], true );
|
198 |
+
$new = $_POST[ $field[ 'id' ] ];
|
199 |
+
if ( $new && $new != $old ) {
|
200 |
+
update_post_meta( $post_id, $field[ 'id' ], $new );
|
201 |
+
} elseif ( '' == $new && $old ) {
|
202 |
+
delete_post_meta( $post_id, $field[ 'id' ], $old );
|
203 |
+
}
|
204 |
+
} // end foreach
|
205 |
+
}
|
206 |
+
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Generate a preview of the latest 5 posts from the feed source being added/edited
|
210 |
+
*
|
211 |
+
* @since 2.0
|
212 |
+
*/
|
213 |
+
function wprss_preview_meta_box_callback() {
|
214 |
+
global $post;
|
215 |
+
$feed_url = get_post_meta( $post->ID, 'wprss_url', true );
|
216 |
+
|
217 |
+
if( ! empty( $feed_url ) ) {
|
218 |
+
$feed = fetch_feed( $feed_url );
|
219 |
+
if ( ! is_wp_error( $feed ) ) {
|
220 |
+
$items = $feed->get_items();
|
221 |
+
// Figure out how many total items there are, but limit it to 5.
|
222 |
+
$maxitems = $feed->get_item_quantity(5);
|
223 |
+
|
224 |
+
// Build an array of all the items, starting with element 0 (first element).
|
225 |
+
$items = $feed->get_items( 0, $maxitems );
|
226 |
+
echo '<h4>Latest 5 feeds available from ' . get_the_title() . '</h4>';
|
227 |
+
echo '<ul>';
|
228 |
+
foreach ( $items as $item ) {
|
229 |
+
// Get human date (comment if you want to use non human date)
|
230 |
+
$item_date = human_time_diff( $item->get_date('U'), current_time('timestamp')).' '.__( 'ago', 'rc_mdm' );
|
231 |
+
// Start displaying item content within a <li> tag
|
232 |
+
echo '<li>';
|
233 |
+
// create item link
|
234 |
+
//echo '<a href="'.esc_url( $item->get_permalink() ).'" title="'.$item_date.'">';
|
235 |
+
// Get item title
|
236 |
+
echo esc_html( $item->get_title() );
|
237 |
+
//echo '</a>';
|
238 |
+
// Display date
|
239 |
+
echo ' <div class="rss-date"><small>'.$item_date.'</small></div>';
|
240 |
+
// End <li> tag
|
241 |
+
echo '</li>';
|
242 |
+
}
|
243 |
+
echo '</ul>';
|
244 |
+
}
|
245 |
+
else _e( '<span class="invalid-feed-url"><strong>Invalid feed URL</strong> - Double check the feed source URL setting above.</span>
|
246 |
+
<p>Not sure where to find the RSS feed on a website?
|
247 |
+
<a target="_blank" href="http://webtrends.about.com/od/webfeedsyndicationrss/ss/rss_howto.htm">Click here</a> for a visual guide' , 'wprss' );
|
248 |
+
}
|
249 |
+
|
250 |
+
else _e( 'No feed URL defined yet', 'wprss' );
|
251 |
+
}
|
252 |
+
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Generate Help meta box
|
256 |
+
*
|
257 |
+
* @since 2.0
|
258 |
+
*
|
259 |
+
*/
|
260 |
+
function wprss_help_meta_box_callback() {
|
261 |
+
echo '<p><strong>';
|
262 |
+
_e( 'Need help?', 'wprss' );
|
263 |
+
echo '</strong> <a target="_blank" href="http://wordpress.org/support/plugin/wp-rss-aggregator">';
|
264 |
+
_e( 'Check out the support forum', 'wprss' );
|
265 |
+
echo '</a></p>';
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Generate Like this plugin meta box
|
270 |
+
*
|
271 |
+
* @since 2.0
|
272 |
+
*
|
273 |
+
*/
|
274 |
+
function wprss_like_meta_box_callback() { ?>
|
275 |
+
<p><?php _e( 'Why not do any or all of the following', 'wprss' ) ?>:</p>
|
276 |
+
<ul>
|
277 |
+
<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>
|
278 |
+
<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>
|
279 |
+
</ul>
|
280 |
+
</p>
|
281 |
+
<?php }
|
282 |
+
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Generate Like this plugin meta box
|
286 |
+
*
|
287 |
+
* @since 2.0
|
288 |
+
*
|
289 |
+
*/
|
290 |
+
function wprss_follow_meta_box_callback() {
|
291 |
+
?>
|
292 |
+
<ul>
|
293 |
+
<li class="twitter"><a href="http://twitter.com/wpmayor"><?php _e( 'Follow WP Mayor on Twitter.', 'wprss' ) ?></a></li>
|
294 |
+
<li class="facebook"><a href="https://www.facebook.com/wpmayor"><?php _e( 'Like WP Mayor on Facebook.', 'wprss' ) ?></a></li>
|
295 |
+
</ul>
|
296 |
+
<?php }
|
297 |
+
|
298 |
+
|
299 |
+
add_action( 'add_meta_boxes', 'wprss_remove_meta_boxes', 100 );
|
300 |
+
/**
|
301 |
+
* Remove unneeded meta boxes from add feed source screen
|
302 |
+
*
|
303 |
+
* @since 2.0
|
304 |
+
*/
|
305 |
+
function wprss_remove_meta_boxes() {
|
306 |
+
if ( 'wprss_feed' !== get_current_screen()->id ) return;
|
307 |
+
// Remove meta boxes of other plugins that tend to appear on all posts
|
308 |
+
remove_meta_box( 'wpseo_meta', 'wprss_feed' ,'normal' );
|
309 |
+
remove_meta_box( 'postpsp', 'wprss_feed' ,'normal' );
|
310 |
+
remove_meta_box( 'su_postmeta', 'wprss_feed' ,'normal' );
|
311 |
+
remove_meta_box( 'woothemes-settings', 'wprss_feed' ,'normal' );
|
312 |
+
remove_meta_box( 'wpcf-post-relationship', 'wprss_feed' ,'normal' );
|
313 |
+
remove_meta_box( 'sharing_meta', 'wprss_feed' ,'advanced' );
|
314 |
+
remove_meta_box( 'content-permissions-meta-box', 'wprss_feed' ,'advanced' );
|
315 |
+
remove_meta_box( 'theme-layouts-post-meta-box', 'wprss_feed' ,'side' );
|
316 |
+
remove_meta_box( 'post-stylesheets', 'wprss_feed' ,'side' );
|
317 |
+
remove_meta_box( 'hybrid-core-post-template', 'wprss_feed' ,'side' );
|
318 |
+
remove_meta_box( 'wpcf-marketing', 'wprss_feed' ,'side' );
|
319 |
+
remove_meta_box( 'trackbacksdiv22', 'wprss_feed' ,'advanced' );
|
320 |
+
remove_meta_box( 'aiosp', 'wprss_feed' ,'advanced' );
|
321 |
+
remove_action( 'post_submitbox_start', 'fpp_post_submitbox_start_action' );
|
322 |
+
}
|
includes/admin-options.php
ADDED
@@ -0,0 +1,520 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin settings 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 WP PRSS Aggregator
|
10 |
+
*/
|
11 |
+
|
12 |
+
add_action( 'admin_init', 'wprss_admin_init' );
|
13 |
+
/**
|
14 |
+
* Register and define options and settings
|
15 |
+
* @since 2.0
|
16 |
+
* @todo add option for cron frequency
|
17 |
+
*
|
18 |
+
* Note: In the future might change to
|
19 |
+
* the way EDD builds the settings pages, cleaner method.
|
20 |
+
*/
|
21 |
+
function wprss_admin_init() {
|
22 |
+
|
23 |
+
register_setting(
|
24 |
+
'wprss_settings_general', // A settings group name.
|
25 |
+
'wprss_settings_general', // The name of an option to sanitize and save.
|
26 |
+
'wprss_settings_general_validate' // A callback function that sanitizes the option's value.
|
27 |
+
);
|
28 |
+
|
29 |
+
add_settings_section(
|
30 |
+
'wprss_settings_general_section', // ID used to identify this section and with which to register options
|
31 |
+
__( 'General plugin settings', 'wprss' ), // Section title that shows within <H3> tags
|
32 |
+
'wprss_settings_general_callback', // Callback function that echoes some explanations
|
33 |
+
'wprss_settings_general' // Settings page on which to show this section
|
34 |
+
);
|
35 |
+
|
36 |
+
add_settings_section(
|
37 |
+
'wprss_settings_styles_section',
|
38 |
+
__( 'Styles', 'wprss' ),
|
39 |
+
'wprss_settings_styles_callback',
|
40 |
+
'wprss_settings_general'
|
41 |
+
);
|
42 |
+
|
43 |
+
add_settings_field(
|
44 |
+
'wprss-settings-open-dd', // ID used to identify the field
|
45 |
+
__( 'Open links behaviour', 'wprss' ), // Text printed next to the field
|
46 |
+
'wprss_setting_open_dd_callback', // Callback function that echoes the field
|
47 |
+
'wprss_settings_general', // Settings page on which to show this field
|
48 |
+
'wprss_settings_general_section' // Section of the settings page on which to show this field
|
49 |
+
);
|
50 |
+
|
51 |
+
add_settings_field(
|
52 |
+
'wprss-settings-follow-dd',
|
53 |
+
__( 'Set links as', 'wprss' ),
|
54 |
+
'wprss_setting_follow_dd_callback',
|
55 |
+
'wprss_settings_general',
|
56 |
+
'wprss_settings_general_section'
|
57 |
+
);
|
58 |
+
|
59 |
+
add_settings_field(
|
60 |
+
'wprss-settings-feed-limit',
|
61 |
+
__( 'Feed display limit', 'wprss' ),
|
62 |
+
'wprss_setting_feed_limit_callback',
|
63 |
+
'wprss_settings_general',
|
64 |
+
'wprss_settings_general_section'
|
65 |
+
);
|
66 |
+
|
67 |
+
add_settings_field(
|
68 |
+
'wprss-settings-date-format',
|
69 |
+
__( 'Date format', 'wprss' ),
|
70 |
+
'wprss_setting_date_format_callback',
|
71 |
+
'wprss_settings_general',
|
72 |
+
'wprss_settings_general_section'
|
73 |
+
);
|
74 |
+
|
75 |
+
add_settings_field(
|
76 |
+
'wprss-settings-limit-feed-items-db',
|
77 |
+
__( 'Limit feed items stored', 'wprss' ),
|
78 |
+
'wprss_setting_limit_feed_items_callback',
|
79 |
+
'wprss_settings_general',
|
80 |
+
'wprss_settings_general_section'
|
81 |
+
);
|
82 |
+
|
83 |
+
add_settings_field(
|
84 |
+
'wprss-settings-cron-interval',
|
85 |
+
__( 'Cron interval', 'wprss' ),
|
86 |
+
'wprss_setting_cron_interval_callback',
|
87 |
+
'wprss_settings_general',
|
88 |
+
'wprss_settings_general_section'
|
89 |
+
);
|
90 |
+
|
91 |
+
add_settings_field(
|
92 |
+
'wprss-settings-title-link-enable',
|
93 |
+
__( 'Link title', 'wprss' ),
|
94 |
+
'wprss_setting_title_link_callback',
|
95 |
+
'wprss_settings_general',
|
96 |
+
'wprss_settings_general_section'
|
97 |
+
);
|
98 |
+
|
99 |
+
add_settings_field(
|
100 |
+
'wprss-settings-source-enable',
|
101 |
+
__( 'Show source', 'wprss' ),
|
102 |
+
'wprss_setting_source_enable_callback',
|
103 |
+
'wprss_settings_general',
|
104 |
+
'wprss_settings_general_section'
|
105 |
+
);
|
106 |
+
|
107 |
+
add_settings_field(
|
108 |
+
'wprss-settings-text-preceding-source',
|
109 |
+
__( 'Text preceding source', 'wprss' ),
|
110 |
+
'wprss_setting_text_preceding_source_callback',
|
111 |
+
'wprss_settings_general',
|
112 |
+
'wprss_settings_general_section'
|
113 |
+
);
|
114 |
+
|
115 |
+
add_settings_field(
|
116 |
+
'wprss-settings-date-enable',
|
117 |
+
__( 'Show date', 'wprss' ),
|
118 |
+
'wprss_setting_date_enable_callback',
|
119 |
+
'wprss_settings_general',
|
120 |
+
'wprss_settings_general_section'
|
121 |
+
);
|
122 |
+
|
123 |
+
add_settings_field(
|
124 |
+
'wprss-settings-text-preceding-date',
|
125 |
+
__( 'Text preceding date', 'wprss' ),
|
126 |
+
'wprss_setting_text_preceding_date_callback',
|
127 |
+
'wprss_settings_general',
|
128 |
+
'wprss_settings_general_section'
|
129 |
+
);
|
130 |
+
|
131 |
+
add_settings_field(
|
132 |
+
'wprss-settings-styles-disable',
|
133 |
+
__( 'Disable Styles', 'wprss' ),
|
134 |
+
'wprss_setting_styles_disable_callback',
|
135 |
+
'wprss_settings_general',
|
136 |
+
'wprss_settings_styles_section'
|
137 |
+
);
|
138 |
+
|
139 |
+
do_action( 'wprss_admin_init' );
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Build the plugin settings page, used to save general settings like whether a link should be follow or no follow
|
145 |
+
* @since 1.1
|
146 |
+
*/
|
147 |
+
function wprss_settings_page_display() {
|
148 |
+
?>
|
149 |
+
<div class="wrap">
|
150 |
+
<?php screen_icon( 'wprss-aggregator' ); ?>
|
151 |
+
|
152 |
+
<h2><?php _e( 'WP RSS Aggregator Settings', 'wprss' ); ?></h2>
|
153 |
+
|
154 |
+
<?php settings_errors(); ?>
|
155 |
+
|
156 |
+
<?php $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general_settings'; ?>
|
157 |
+
|
158 |
+
<?php
|
159 |
+
|
160 |
+
$tabs = apply_filters(
|
161 |
+
'wprss_options_tabs',
|
162 |
+
array(
|
163 |
+
'General' => array(
|
164 |
+
'label' => __( 'General', 'wprss' ),
|
165 |
+
'slug' => 'general_settings',
|
166 |
+
)
|
167 |
+
)
|
168 |
+
);
|
169 |
+
|
170 |
+
if ( is_plugin_active( 'wp-rss-excerpts-thumbnails/wp-rss-excerpts-thumbnails.php' ) ) {
|
171 |
+
// Might be a better idea to grey out the tabs when the addon is not activated, and use
|
172 |
+
// an action hook to insert the code relative to sections of addon. ?>
|
173 |
+
<h2 class="nav-tab-wrapper">
|
174 |
+
<?php
|
175 |
+
foreach ( $tabs as $tab => $tab_property ) { ?>
|
176 |
+
<a href="?post_type=wprss_feed&page=wprss-aggregator-settings&tab=<?php echo esc_attr( $tab_property['slug'] ); ?>"
|
177 |
+
class="nav-tab <?php echo $active_tab == $tab_property['slug'] ? 'nav-tab-active' : ''; ?>"><?php echo esc_html( $tab_property['label'] ); ?></a>
|
178 |
+
<?php } ?>
|
179 |
+
<?php } ?>
|
180 |
+
</h2>
|
181 |
+
|
182 |
+
<form action="options.php" method="post">
|
183 |
+
|
184 |
+
<?php
|
185 |
+
if ( is_plugin_active( 'wp-rss-excerpts-thumbnails/wp-rss-excerpts-thumbnails.php' ) ) {
|
186 |
+
if ( $active_tab == 'general_settings' ) {
|
187 |
+
settings_fields( 'wprss_settings_general' );
|
188 |
+
do_settings_sections( 'wprss_settings_general' );
|
189 |
+
}
|
190 |
+
|
191 |
+
do_action( 'wprss_add_settings_fields_sections', $active_tab );
|
192 |
+
}
|
193 |
+
else {
|
194 |
+
settings_fields( 'wprss_settings_general' );
|
195 |
+
do_settings_sections( 'wprss_settings_general' );
|
196 |
+
}
|
197 |
+
submit_button( __( 'Save Settings', 'wprss' ) );
|
198 |
+
?>
|
199 |
+
</form>
|
200 |
+
</div>
|
201 |
+
<?php
|
202 |
+
}
|
203 |
+
|
204 |
+
|
205 |
+
/**
|
206 |
+
* General settings section header
|
207 |
+
* @since 3.0
|
208 |
+
*/
|
209 |
+
function wprss_settings_general_callback() {
|
210 |
+
echo '<p>' . __( 'These are the general settings for WP RSS Aggregator.', 'wprss' ) . '</p>';
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
/**
|
215 |
+
* General settings section header
|
216 |
+
* @since 3.0
|
217 |
+
*/
|
218 |
+
function wprss_settings_styles_callback() {
|
219 |
+
echo '<p>' . __( 'If you would like to disable all styles used in this plugin, tick the checkbox.', 'wprss' ) . '</p>';
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Follow or No Follow dropdown
|
225 |
+
* @since 1.1
|
226 |
+
*/
|
227 |
+
function wprss_setting_follow_dd_callback() {
|
228 |
+
$options = get_option( 'wprss_settings_general' );
|
229 |
+
$items = array(
|
230 |
+
__( 'No follow', 'wprss' ),
|
231 |
+
__( 'Follow', 'wprss' )
|
232 |
+
);
|
233 |
+
echo "<select id='follow-dd' name='wprss_settings_general[follow_dd]'>";
|
234 |
+
foreach( $items as $item ) {
|
235 |
+
$selected = ( $options['follow_dd'] == $item) ? 'selected="selected"' : '';
|
236 |
+
echo "<option value='$item' $selected>$item</option>";
|
237 |
+
}
|
238 |
+
echo "</select>";
|
239 |
+
}
|
240 |
+
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Link open setting dropdown
|
244 |
+
* @since 1.1
|
245 |
+
*/
|
246 |
+
function wprss_setting_open_dd_callback() {
|
247 |
+
$options = get_option( 'wprss_settings_general' );
|
248 |
+
$items = array(
|
249 |
+
__( 'Lightbox', 'wprss' ),
|
250 |
+
__( 'New window', 'wprss' ),
|
251 |
+
__( 'None', 'wprss' )
|
252 |
+
);
|
253 |
+
echo "<select id='open-dd' name='wprss_settings_general[open_dd]'>";
|
254 |
+
foreach( $items as $item ) {
|
255 |
+
$selected = ( $options['open_dd'] == $item ) ? 'selected="selected"' : '';
|
256 |
+
echo "<option value='$item' $selected>$item</option>";
|
257 |
+
}
|
258 |
+
echo "</select>";
|
259 |
+
}
|
260 |
+
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Set limit for feeds on frontend
|
264 |
+
* @since 2.0
|
265 |
+
*/
|
266 |
+
function wprss_setting_feed_limit_callback() {
|
267 |
+
$options = get_option( 'wprss_settings_general' );
|
268 |
+
echo "<input id='feed-limit' name='wprss_settings_general[feed_limit]' type='text' value='{$options['feed_limit']}' />";
|
269 |
+
echo "<label for='feed-limit'>Enter the number of feeds to display on the front end</label>";
|
270 |
+
}
|
271 |
+
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Set date format
|
275 |
+
* @since 3.0
|
276 |
+
*/
|
277 |
+
function wprss_setting_date_format_callback() {
|
278 |
+
$options = get_option( 'wprss_settings_general' );
|
279 |
+
echo "<input id='date-format' name='wprss_settings_general[date_format]' type='text' value='{$options['date_format']}' />";
|
280 |
+
echo "<label for='date-format'>Date formatting, using the <a href='http://codex.wordpress.org/Formatting_Date_and_Time'>PHP date formats</a></label>";
|
281 |
+
}
|
282 |
+
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Limit number of feed items stored
|
286 |
+
* @since 3.0
|
287 |
+
*/
|
288 |
+
function wprss_setting_limit_feed_items_callback() {
|
289 |
+
$options = get_option( 'wprss_settings_general' );
|
290 |
+
echo "<input id='limit-feed-items-db' name='wprss_settings_general[limit_feed_items_db]' type='text' value='{$options['limit_feed_items_db']}' />";
|
291 |
+
echo "<label for='limit-feed-items-db'>Enter the maximum number of feeds to store in the database; enter 0 for unlimited feed items</label>";
|
292 |
+
}
|
293 |
+
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Gets a sorted (according to interval) list of the cron schedules
|
297 |
+
* @since 3.0
|
298 |
+
*/
|
299 |
+
function wprss_get_schedules() {
|
300 |
+
$schedules = wp_get_schedules();
|
301 |
+
uasort( $schedules, create_function( '$a,$b', 'return $a["interval"]-$b["interval"];' ) );
|
302 |
+
return $schedules;
|
303 |
+
}
|
304 |
+
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Cron interval dropdown callback
|
308 |
+
* @since 3.0
|
309 |
+
*/
|
310 |
+
function wprss_setting_cron_interval_callback() {
|
311 |
+
$options = get_option( 'wprss_settings_general' );
|
312 |
+
$current = $options['cron_interval'];
|
313 |
+
|
314 |
+
$schedules = wprss_get_schedules();
|
315 |
+
// Set the allowed Cron schedules, we don't want any intervals that can lead to issues with server load
|
316 |
+
$wprss_schedules = array( 'fifteen_min', 'thirty_min', 'hourly', 'two_hours', 'twicedaily', 'daily' );
|
317 |
+
//var_dump($schedules);
|
318 |
+
echo "<select id='cron-interval' name='wprss_settings_general[cron_interval]'>";
|
319 |
+
foreach( $schedules as $schedule_name => $schedule_data ) {
|
320 |
+
if ( in_array( $schedule_name, $wprss_schedules ) ) { ?>
|
321 |
+
<option value="<?php echo $schedule_name; ?>" <?php selected( $current, $schedule_name ); ?> >
|
322 |
+
<?php echo $schedule_data['display']; ?> (<?php echo wprss_interval( $schedule_data['interval'] ); ?>)
|
323 |
+
</option>
|
324 |
+
<?php } ?>
|
325 |
+
<?php } ?>
|
326 |
+
</select><?php
|
327 |
+
}
|
328 |
+
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Enable linked title
|
332 |
+
* @since 3.0
|
333 |
+
*/
|
334 |
+
function wprss_setting_title_link_callback( $args ) {
|
335 |
+
$options = get_option( 'wprss_settings_general' );
|
336 |
+
echo "<input id='title-link' name='wprss_settings_general[title_link]' type='checkbox' value='1' " . checked( 1, $options['title_link'], false ) . " />";
|
337 |
+
echo "<label for='title-link'>Check this box to enable linked titles</label>";
|
338 |
+
}
|
339 |
+
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Enable source
|
343 |
+
* @since 3.0
|
344 |
+
*/
|
345 |
+
function wprss_setting_source_enable_callback( $args ) {
|
346 |
+
$options = get_option( 'wprss_settings_general' );
|
347 |
+
echo "<input id='source-enable' name='wprss_settings_general[source_enable]' type='checkbox' value='1' " . checked( 1, $options['source_enable'], false ) . " />";
|
348 |
+
echo "<label for='source-enable'>Check this box to enable feed source display</label>";
|
349 |
+
}
|
350 |
+
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Set text preceding source
|
354 |
+
* @since 3.0
|
355 |
+
*/
|
356 |
+
function wprss_setting_text_preceding_source_callback() {
|
357 |
+
$options = get_option( 'wprss_settings_general' );
|
358 |
+
echo "<input id='text-preceding-source' name='wprss_settings_general[text_preceding_source]' type='text' value='{$options['text_preceding_source']}' />";
|
359 |
+
echo "<label for='text-preceding-source'>Enter the text you want shown before the feed item's source</label>";
|
360 |
+
}
|
361 |
+
/**
|
362 |
+
* Enable date
|
363 |
+
* @since 3.0
|
364 |
+
*/
|
365 |
+
function wprss_setting_date_enable_callback( $args ) {
|
366 |
+
$options = get_option( 'wprss_settings_general' );
|
367 |
+
echo "<input id='date-enable' name='wprss_settings_general[date_enable]' type='checkbox' value='1' " . checked( 1, $options['date_enable'], false ) . " />";
|
368 |
+
echo "<label for='date-enable'>Check this box to enable display of date published</label>";
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Set text preceding date
|
373 |
+
* @since 3.0
|
374 |
+
*/
|
375 |
+
function wprss_setting_text_preceding_date_callback() {
|
376 |
+
$options = get_option( 'wprss_settings_general' );
|
377 |
+
echo "<input id='text-preceding-date' name='wprss_settings_general[text_preceding_date]' type='text' value='{$options['text_preceding_date']}' />";
|
378 |
+
echo "<label for='text-preceding-date'>Enter the text you want shown before the feed item's publish date</label>";
|
379 |
+
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* Disable styles
|
383 |
+
* @since 3.0
|
384 |
+
*/
|
385 |
+
function wprss_setting_styles_disable_callback( $args ) {
|
386 |
+
$options = get_option( 'wprss_settings_general' );
|
387 |
+
echo "<input id='styles-disable' name='wprss_settings_general[styles_disable]' type='checkbox' value='1' " . checked( 1, $options['styles_disable'], false ) . " />";
|
388 |
+
echo "<label for='styles-disable'>Check this box to disable all plugin styles</label>";
|
389 |
+
echo "<p class='description'>You will then be responsible for providing your own CSS styles.</p>";
|
390 |
+
}
|
391 |
+
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Pretty-prints the difference in two times.
|
395 |
+
*
|
396 |
+
* @since 3.0
|
397 |
+
* @param time $older_date
|
398 |
+
* @param time $newer_date
|
399 |
+
* @return string The pretty time_since value
|
400 |
+
* @link http://wordpress.org/extend/plugins/wp-crontrol/
|
401 |
+
*/
|
402 |
+
function wprss_time_since( $older_date, $newer_date ) {
|
403 |
+
return wprss_interval( $newer_date - $older_date );
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Calculates difference between times
|
408 |
+
*
|
409 |
+
* Taken from the WP-Crontrol plugin
|
410 |
+
* @link http://wordpress.org/extend/plugins/wp-crontrol/
|
411 |
+
* @since 3.0
|
412 |
+
*
|
413 |
+
*/
|
414 |
+
function wprss_interval( $since ) {
|
415 |
+
// array of time period chunks
|
416 |
+
$chunks = array(
|
417 |
+
array(60 * 60 * 24 * 365 , _n_noop('%s year', '%s years', 'crontrol')),
|
418 |
+
array(60 * 60 * 24 * 30 , _n_noop('%s month', '%s months', 'crontrol')),
|
419 |
+
array(60 * 60 * 24 * 7, _n_noop('%s week', '%s weeks', 'crontrol')),
|
420 |
+
array(60 * 60 * 24 , _n_noop('%s day', '%s days', 'crontrol')),
|
421 |
+
array(60 * 60 , _n_noop('%s hour', '%s hours', 'crontrol')),
|
422 |
+
array(60 , _n_noop('%s minute', '%s minutes', 'crontrol')),
|
423 |
+
array( 1 , _n_noop('%s second', '%s seconds', 'crontrol')),
|
424 |
+
);
|
425 |
+
|
426 |
+
|
427 |
+
if( $since <= 0 ) {
|
428 |
+
return __( 'now', 'wprss' );
|
429 |
+
}
|
430 |
+
|
431 |
+
// we only want to output two chunks of time here, eg:
|
432 |
+
// x years, xx months
|
433 |
+
// x days, xx hours
|
434 |
+
// so there's only two bits of calculation below:
|
435 |
+
|
436 |
+
// step one: the first chunk
|
437 |
+
for ($i = 0, $j = count($chunks); $i < $j; $i++)
|
438 |
+
{
|
439 |
+
$seconds = $chunks[$i][0];
|
440 |
+
$name = $chunks[$i][1];
|
441 |
+
|
442 |
+
// finding the biggest chunk (if the chunk fits, break)
|
443 |
+
if (($count = floor($since / $seconds)) != 0)
|
444 |
+
{
|
445 |
+
break;
|
446 |
+
}
|
447 |
+
}
|
448 |
+
|
449 |
+
// set output var
|
450 |
+
$output = sprintf(_n($name[0], $name[1], $count, 'wprss'), $count);
|
451 |
+
|
452 |
+
// step two: the second chunk
|
453 |
+
if ($i + 1 < $j)
|
454 |
+
{
|
455 |
+
$seconds2 = $chunks[$i + 1][0];
|
456 |
+
$name2 = $chunks[$i + 1][1];
|
457 |
+
|
458 |
+
if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0)
|
459 |
+
{
|
460 |
+
// add to output var
|
461 |
+
$output .= ' '.sprintf(_n($name2[0], $name2[1], $count2, 'wprss'), $count2);
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
return $output;
|
466 |
+
}
|
467 |
+
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Validate inputs from the general settings page
|
471 |
+
* @since 3.0
|
472 |
+
*/
|
473 |
+
function wprss_settings_general_validate( $input ) {
|
474 |
+
$options = get_option( 'wprss_settings_general' );
|
475 |
+
$current_cron_interval = $options['cron_interval'];
|
476 |
+
|
477 |
+
// Create our array for storing the validated options
|
478 |
+
$output = array();
|
479 |
+
|
480 |
+
// Loop through each of the incoming options
|
481 |
+
foreach( $input as $key => $value ) {
|
482 |
+
|
483 |
+
// Check to see if the current option has a value. If so, process it.
|
484 |
+
if( isset( $input[ $key ] ) ) {
|
485 |
+
|
486 |
+
// Strip all HTML and PHP tags and properly handle quoted strings
|
487 |
+
$output[ $key ] = strip_tags( stripslashes( $input[ $key ] ) );
|
488 |
+
|
489 |
+
} // end if
|
490 |
+
|
491 |
+
} // end foreach
|
492 |
+
|
493 |
+
if ( ! isset( $input['title_link'] ) || $input['title_link'] != '1' )
|
494 |
+
$output['title_link'] = 0;
|
495 |
+
else
|
496 |
+
$output['title_link'] = 1;
|
497 |
+
|
498 |
+
if ( ! isset( $input['source_enable'] ) || $input['source_enable'] != '1' )
|
499 |
+
$output['source_enable'] = 0;
|
500 |
+
else
|
501 |
+
$output['source_enable'] = 1;
|
502 |
+
|
503 |
+
if ( ! isset( $input['date_enable'] ) || $input['date_enable'] != '1' )
|
504 |
+
$output['date_enable'] = 0;
|
505 |
+
else
|
506 |
+
$output['date_enable'] = 1;
|
507 |
+
|
508 |
+
if ( ! isset( $input['styles_disable'] ) || $input['styles_disable'] != '1' )
|
509 |
+
$output['styles_disable'] = 0;
|
510 |
+
else
|
511 |
+
$output['styles_disable'] = 1;
|
512 |
+
|
513 |
+
if ( $input['cron_interval'] != $current_cron_interval ) {
|
514 |
+
wp_clear_scheduled_hook( 'wprss_fetch_all_feeds_hook' );
|
515 |
+
wp_schedule_event( time(), $input['cron_interval'], 'wprss_fetch_all_feeds_hook' );
|
516 |
+
}
|
517 |
+
|
518 |
+
// Return the array processing any additional functions filtered by this action
|
519 |
+
return apply_filters( 'wprss_settings_general_validate', $output, $input );
|
520 |
+
}
|
includes/admin.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin administration related functions
|
4 |
+
*
|
5 |
+
* @package WPRSSAggregator
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
add_action( 'admin_head', 'wprss_custom_post_type_icon' );
|
10 |
+
/**
|
11 |
+
* Custom Post Type Icon for Admin Menu & Post Screen
|
12 |
+
* @since 2.0
|
13 |
+
*/
|
14 |
+
function wprss_custom_post_type_icon() {
|
15 |
+
?>
|
16 |
+
<style>
|
17 |
+
/* Post Screen - 32px */
|
18 |
+
.icon32-posts-wprss_feed {
|
19 |
+
background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
|
20 |
+
}
|
21 |
+
/* Post Screen - 32px */
|
22 |
+
.icon32-posts-wprss_feed_item {
|
23 |
+
background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
|
24 |
+
}
|
25 |
+
</style>
|
26 |
+
<?php }
|
27 |
+
|
28 |
+
|
29 |
+
add_action( 'admin_menu', 'wprss_register_menu_pages' );
|
30 |
+
/**
|
31 |
+
* Register menu and submenus
|
32 |
+
* @since 2.0
|
33 |
+
*/
|
34 |
+
|
35 |
+
// Add the admin options pages as submenus to the Feed CPT
|
36 |
+
function wprss_register_menu_pages() {
|
37 |
+
|
38 |
+
//create submenu items
|
39 |
+
add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'WP RSS Aggregator Settings', 'wprss' ), __( 'Settings', 'wprss' ), 'manage_options', 'wprss-aggregator-settings', 'wprss_settings_page_display' );
|
40 |
+
//add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Export & Import Settings', 'wprss' ), __( 'Import & Export', 'wprss' ), 'manage_options', 'wprss-import-export-settings', 'wprss_import_export_settings_page_display' );
|
41 |
+
//add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Debugging', 'wprss' ), __( 'Debugging', 'wprss' ), 'manage_options', 'wprss-debugging', 'wprss_debugging_page_display' );
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
add_filter('admin_body_class', 'wprss_base_admin_body_class');
|
46 |
+
/**
|
47 |
+
* Set body class for admin screens
|
48 |
+
* http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/
|
49 |
+
* @since 2.0
|
50 |
+
*/
|
51 |
+
function wprss_base_admin_body_class( $classes )
|
52 |
+
{
|
53 |
+
// Current action
|
54 |
+
if ( is_admin() && isset($_GET['action']) ) {
|
55 |
+
$classes .= 'action-'.$_GET['action'];
|
56 |
+
}
|
57 |
+
// Current post ID
|
58 |
+
if ( is_admin() && isset($_GET['post']) ) {
|
59 |
+
$classes .= ' ';
|
60 |
+
$classes .= 'post-'.$_GET['post'];
|
61 |
+
}
|
62 |
+
// New post type & listing page
|
63 |
+
if ( isset($_GET['post_type']) ) $post_type = $_GET['post_type'];
|
64 |
+
if ( isset($post_type) ) {
|
65 |
+
$classes .= ' ';
|
66 |
+
$classes .= 'post-type-'.$post_type;
|
67 |
+
}
|
68 |
+
// Editting a post type
|
69 |
+
if ( isset( $_GET['post'] ) ) {
|
70 |
+
$post_query = $_GET['post'];
|
71 |
+
}
|
72 |
+
if ( isset($post_query) ) {
|
73 |
+
$current_post_edit = get_post($post_query);
|
74 |
+
$current_post_type = $current_post_edit->post_type;
|
75 |
+
if ( !empty($current_post_type) ) {
|
76 |
+
$classes .= ' ';
|
77 |
+
$classes .= 'post-type-'.$current_post_type;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
// Return the $classes array
|
81 |
+
return $classes;
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Change title on wprss_feed post type screen
|
87 |
+
*
|
88 |
+
* @since 2.0
|
89 |
+
* @return void
|
90 |
+
*/
|
91 |
+
function wprss_change_title_text() {
|
92 |
+
return __( 'Enter feed name here (e.g. WP Mayor)', 'wprss' );
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
add_filter( 'plugin_action_links', 'wprss_plugin_action_links', 10, 2 );
|
97 |
+
/**
|
98 |
+
* Add Settings action link in plugin listing
|
99 |
+
*
|
100 |
+
* @since 3.0
|
101 |
+
* @param array $action_links
|
102 |
+
* @param string $plugin_file
|
103 |
+
* @return array
|
104 |
+
*/
|
105 |
+
function wprss_plugin_action_links( $action_links, $plugin_file ) {
|
106 |
+
if ( $plugin_file == plugin_basename( __FILE__ ) ) {
|
107 |
+
$settings_link = '<a href="' . get_admin_url() . 'edit.php?post_type=wprss_feed&page=wprss-aggregator-settings">' . __("Settings") . '</a>';
|
108 |
+
array_unshift( $action_links, $settings_link );
|
109 |
+
}
|
110 |
+
return $action_links;
|
111 |
+
}
|
includes/cron-jobs.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains all the cron jobs in use by WP RSS Aggregator
|
4 |
+
*
|
5 |
+
* @package WPRSSAggregator
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
add_action( 'init', 'wprss_schedule_fetch_all_feeds_cron' );
|
10 |
+
/**
|
11 |
+
* Creates the cron to fetch feeds every hour
|
12 |
+
*
|
13 |
+
* @since 2.0
|
14 |
+
*/
|
15 |
+
function wprss_schedule_fetch_all_feeds_cron() {
|
16 |
+
|
17 |
+
$options = get_option( 'wprss_settings_general' );
|
18 |
+
|
19 |
+
$cron_interval = $options['cron_interval'];
|
20 |
+
|
21 |
+
// verify event has not been scheduled
|
22 |
+
if ( ! wp_next_scheduled( 'wprss_fetch_all_feeds_hook' ) ) {
|
23 |
+
// Schedule to run hourly
|
24 |
+
wp_schedule_event( time(), $cron_interval, 'wprss_fetch_all_feeds_hook' );
|
25 |
+
}
|
26 |
+
|
27 |
+
add_action( 'wprss_fetch_all_feeds_hook', 'wprss_fetch_insert_all_feed_items' );
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
add_action( 'init', 'wprss_schedule_truncate_posts_cron' );
|
32 |
+
/**
|
33 |
+
* Creates the cron to truncate wprss_feed_item posts daily
|
34 |
+
*
|
35 |
+
* @since 2.0
|
36 |
+
*/
|
37 |
+
function wprss_schedule_truncate_posts_cron() {
|
38 |
+
|
39 |
+
// verify event has not been scheduled
|
40 |
+
if ( ! wp_next_scheduled( 'wprss_truncate_posts_hook') ) {
|
41 |
+
// Schedule to run daily
|
42 |
+
wp_schedule_event( time(), 'daily', 'wprss_truncate_posts_hook' );
|
43 |
+
}
|
44 |
+
|
45 |
+
add_action( 'wprss_truncate_posts_hook', 'wprss_truncate_posts' );
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
// filter to add new possible frequencies to the cron
|
50 |
+
add_filter( 'cron_schedules', 'wprss_filter_cron_schedules' );
|
51 |
+
/**
|
52 |
+
* Adding a few more handy cron schedules to the default ones
|
53 |
+
* @since 3.0
|
54 |
+
*/
|
55 |
+
function wprss_filter_cron_schedules( $schedules) {
|
56 |
+
$frequencies = array(
|
57 |
+
'five_min' => array(
|
58 |
+
'interval' => 300,
|
59 |
+
'display' => __( 'Once every five minutes', 'wprss' )
|
60 |
+
),
|
61 |
+
'ten_min' => array(
|
62 |
+
'interval' => 600,
|
63 |
+
'display' => __( 'Once every ten minutes', 'wprss' )
|
64 |
+
),
|
65 |
+
'fifteen_min' => array(
|
66 |
+
'interval' => 900,
|
67 |
+
'display' => __( 'Once every fifteen minutes', 'wprss' )
|
68 |
+
),
|
69 |
+
'thirty_min' => array(
|
70 |
+
'interval' => 1800,
|
71 |
+
'display' => __( 'Once every thirty minutes', 'wprss' )
|
72 |
+
),
|
73 |
+
'two_hours' => array(
|
74 |
+
'interval' => 7200,
|
75 |
+
'display' => __( 'Once every two hours', 'wprss' )
|
76 |
+
),
|
77 |
+
);
|
78 |
+
|
79 |
+
return array_merge( $schedules, $frequencies );
|
80 |
+
}
|
includes/custom-feed.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Function to create a custom feed with the latest imported feed items
|
4 |
+
*
|
5 |
+
* @package WP RSS Aggregator
|
6 |
+
* @todo needs implementation, not currently used
|
7 |
+
*/
|
8 |
+
|
9 |
+
|
10 |
+
add_filter( 'init', 'wprss_addfeed_add_feed' );
|
11 |
+
/**
|
12 |
+
* Adds feed named 'wprss'
|
13 |
+
*
|
14 |
+
* @since 3.0
|
15 |
+
*/
|
16 |
+
function wprss_addfeed_add_feed() {
|
17 |
+
add_feed( 'wprss', 'wprss_addfeed_do_feed' );
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Echo the feed
|
23 |
+
*
|
24 |
+
* @since 3.0
|
25 |
+
*/
|
26 |
+
function wprss_addfeed_do_feed( $in ) {
|
27 |
+
// Make custom query to get latest feed items
|
28 |
+
query_posts( array(
|
29 |
+
'post_type' => 'wprss_feed_item',
|
30 |
+
'post_status' => 'publish'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
// Send content header and start ATOM output
|
35 |
+
header('Content-Type: application/atom+xml');
|
36 |
+
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
|
37 |
+
?>
|
38 |
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
39 |
+
<title type="text">Latest imported feed items on <?php bloginfo_rss('name'); ?></title>
|
40 |
+
<?php
|
41 |
+
// Start the Loop
|
42 |
+
while ( have_posts() ) : the_post();
|
43 |
+
?>
|
44 |
+
<entry>
|
45 |
+
<title><![CDATA[<?php the_title_rss(); ?>]]></title>
|
46 |
+
<link href="<?php the_permalink_rss(); ?>" />
|
47 |
+
<published><?php echo get_post_time( 'Y-m-d\TH:i:s\Z' ); ?></published>
|
48 |
+
<content type="html"><![CDATA[<?php the_content(); ?>]]></content>
|
49 |
+
</entry>
|
50 |
+
<?php
|
51 |
+
// End of the Loop
|
52 |
+
endwhile;
|
53 |
+
?>
|
54 |
+
</feed>
|
55 |
+
<?php
|
56 |
+
}
|
includes/custom-post-types.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
19 |
+
'wprss_feed_post_type_labels',
|
20 |
+
array(
|
21 |
+
'name' => __( 'Feed Sources', 'wprss' ),
|
22 |
+
'singular_name' => __( 'Feed', 'wprss' ),
|
23 |
+
'add_new' => __( 'Add New Feed Source', 'wprss' ),
|
24 |
+
'all_items' => __( 'All Feed Sources', 'wprss' ),
|
25 |
+
'add_new_item' => __( 'Add New Feed Source', 'wprss' ),
|
26 |
+
'edit_item' => __( 'Edit Feed Source', 'wprss' ),
|
27 |
+
'new_item' => __( 'New Feed Source', 'wprss' ),
|
28 |
+
'view_item' => __( 'View Feed Source', 'wprss' ),
|
29 |
+
'search_items' => __( 'Search Feeds', 'wprss' ),
|
30 |
+
'not_found' => __( 'No Feed Sources Found', 'wprss' ),
|
31 |
+
'not_found_in_trash' => __( 'No Feed Sources Found In Trash', 'wprss' ),
|
32 |
+
'menu_name' => __( 'RSS Aggregator', 'wprss' )
|
33 |
+
)
|
34 |
+
);
|
35 |
+
|
36 |
+
// Set up the arguments for the 'wprss_feed' post type
|
37 |
+
$feed_args = apply_filters(
|
38 |
+
'wprss_feed_post_type_args',
|
39 |
+
array(
|
40 |
+
'exclude_from_search' => true,
|
41 |
+
'publicly_querable' => false,
|
42 |
+
'show_in_nav_menus' => false,
|
43 |
+
'show_in_admin_bar' => true,
|
44 |
+
'public' => false,
|
45 |
+
'show_ui' => true,
|
46 |
+
'query_var' => 'feed_source',
|
47 |
+
'menu_position' => 100,
|
48 |
+
'menu_icon' => WPRSS_IMG . 'icon-adminmenu16-sprite.png',
|
49 |
+
'show_in_menu' => true,
|
50 |
+
'rewrite' => array(
|
51 |
+
'slug' => 'feeds',
|
52 |
+
'with_front' => false
|
53 |
+
),
|
54 |
+
'supports' => array( 'title' ),
|
55 |
+
'labels' => $labels
|
56 |
+
)
|
57 |
+
);
|
58 |
+
|
59 |
+
// Register the 'wprss_feed' post type
|
60 |
+
register_post_type( 'wprss_feed', $feed_args );
|
61 |
+
|
62 |
+
// Set up labels for the 'wprss_feed_item' post type
|
63 |
+
$labels = apply_filters(
|
64 |
+
'wprss_feed_item_post_type_labels',
|
65 |
+
array(
|
66 |
+
'name' => __( 'Imported Feeds', 'wprss' ),
|
67 |
+
'singular_name' => __( 'Imported Feed', 'wprss' ),
|
68 |
+
'all_items' => __( 'Imported Feeds', 'wprss' ),
|
69 |
+
'view_item' => __( 'View Imported Feed', 'wprss' ),
|
70 |
+
'search_items' => __( 'Search Imported Feeds', 'wprss' ),
|
71 |
+
'not_found' => __( 'No Imported Feeds Found', 'wprss' ),
|
72 |
+
'not_found_in_trash' => __( 'No Imported Feeds Found In Trash', 'wprss' )
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
// Set up the arguments for the 'wprss_feed_item' post type
|
77 |
+
$feed_item_args = apply_filters(
|
78 |
+
'wprss_feed_item_post_type_args',
|
79 |
+
array(
|
80 |
+
'exclude_from_search' => true,
|
81 |
+
'publicly_querable' => false,
|
82 |
+
'show_in_nav_menus' => false,
|
83 |
+
'show_in_admin_bar' => true,
|
84 |
+
'public' => false,
|
85 |
+
'show_ui' => true,
|
86 |
+
'query_var' => 'feed_item',
|
87 |
+
'show_in_menu' => 'edit.php?post_type=wprss_feed',
|
88 |
+
'rewrite' => array(
|
89 |
+
'slug' => 'feeds/items',
|
90 |
+
'with_front' => false,
|
91 |
+
),
|
92 |
+
'labels' => $labels
|
93 |
+
)
|
94 |
+
);
|
95 |
+
|
96 |
+
// Register the 'feed_item' post type
|
97 |
+
register_post_type( 'wprss_feed_item', $feed_item_args );
|
98 |
+
}
|
includes/deprecated-functions.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fetches feed items from sources provided
|
5 |
+
* DEPRECATED - JUST FOR REFERENCE
|
6 |
+
*
|
7 |
+
* @since 2.0
|
8 |
+
* @deprecated 3.0
|
9 |
+
*/
|
10 |
+
function wprss_fetch_all_feed_items( ) {
|
11 |
+
|
12 |
+
// Get all feed sources
|
13 |
+
$feed_sources = new WP_Query( array(
|
14 |
+
'post_type' => 'wprss_feed',
|
15 |
+
'post_status' => 'publish',
|
16 |
+
'posts_per_page' => -1,
|
17 |
+
) );
|
18 |
+
|
19 |
+
if( $feed_sources->have_posts() ) {
|
20 |
+
/* Start by getting one feed source, we will cycle through them one by one,
|
21 |
+
fetching feed items and adding them to the database in each pass */
|
22 |
+
while ( $feed_sources->have_posts() ) {
|
23 |
+
$feed_sources->the_post();
|
24 |
+
|
25 |
+
$feed_ID = get_the_ID();
|
26 |
+
$feed_url = get_post_meta( get_the_ID(), 'wprss_url', true );
|
27 |
+
|
28 |
+
// Use the URL custom field to fetch the feed items for this source
|
29 |
+
if( !empty( $feed_url ) ) {
|
30 |
+
|
31 |
+
add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
|
32 |
+
//$feed = fetch_feed( $feed_url );
|
33 |
+
$feed = wprss_fetch_feed( $feed_url );
|
34 |
+
remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
|
35 |
+
|
36 |
+
// $feed->strip_htmltags( array_merge( $feed->strip_htmltags, array('h1', 'a', 'img') ) );
|
37 |
+
|
38 |
+
if ( !is_wp_error( $feed ) ) {
|
39 |
+
// Figure out how many total items there are, but limit it to 10.
|
40 |
+
$maxitems = $feed->get_item_quantity(10);
|
41 |
+
|
42 |
+
// Build an array of all the items, starting with element 0 (first element).
|
43 |
+
$items = $feed->get_items( 0, $maxitems );
|
44 |
+
}
|
45 |
+
else { return; }
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( ! empty( $items ) ) {
|
49 |
+
// Gather the permalinks of existing feed item's related to this feed source
|
50 |
+
global $wpdb;
|
51 |
+
$existing_permalinks = $wpdb->get_col(
|
52 |
+
"SELECT meta_value
|
53 |
+
FROM $wpdb->postmeta
|
54 |
+
WHERE meta_key = 'wprss_item_permalink'
|
55 |
+
AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID)
|
56 |
+
");
|
57 |
+
|
58 |
+
foreach ( $items as $item ) {
|
59 |
+
// Check if newly fetched item already present in existing feed item item,
|
60 |
+
// if not insert it into wp_posts and insert post meta.
|
61 |
+
if ( ! ( in_array( $item->get_permalink(), $existing_permalinks ) ) ) {
|
62 |
+
// Create post object
|
63 |
+
$feed_item = array(
|
64 |
+
'post_title' => $item->get_title(),
|
65 |
+
'post_content' => '',
|
66 |
+
'post_status' => 'publish',
|
67 |
+
'post_type' => 'wprss_feed_item'
|
68 |
+
);
|
69 |
+
$inserted_ID = wp_insert_post( $feed_item );
|
70 |
+
wprss_items_create_post_meta( $inserted_ID, $item, $feed_ID );
|
71 |
+
} //end if
|
72 |
+
} //end foreach
|
73 |
+
} // end if
|
74 |
+
} // end $feed_sources while loop
|
75 |
+
wp_reset_postdata(); // Restore the $post global to the current post in the main query
|
76 |
+
// } // end if
|
77 |
+
} // end if
|
78 |
+
}
|
79 |
+
|
80 |
+
// For testing query speed
|
81 |
+
// $time_start = microtime( true );
|
82 |
+
// wp_die(number_format( microtime( true ) - $time_start, 10 ));
|
83 |
+
|
includes/feed-display.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Feed display related functions
|
4 |
+
*
|
5 |
+
* @package WPRSSAggregator
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Retrieve settings and prepare them for use in the display function
|
11 |
+
*
|
12 |
+
* @since 3.0
|
13 |
+
*/
|
14 |
+
function wprss_get_display_settings( $settings ) {
|
15 |
+
|
16 |
+
switch ( $settings['open_dd'] ) {
|
17 |
+
|
18 |
+
case 'Lightbox' :
|
19 |
+
$display_settings['open'] = 'class="colorbox"';
|
20 |
+
break;
|
21 |
+
|
22 |
+
case 'New window' :
|
23 |
+
$display_settings['open'] = 'target="_blank"';
|
24 |
+
break;
|
25 |
+
}
|
26 |
+
|
27 |
+
switch ( $settings['follow_dd'] ) {
|
28 |
+
|
29 |
+
case 'No follow' :
|
30 |
+
$display_settings['follow'] = 'rel="nofollow"';
|
31 |
+
break;
|
32 |
+
}
|
33 |
+
|
34 |
+
do_action( 'wprss_get_settings' );
|
35 |
+
|
36 |
+
return $display_settings;
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Merges the default arguments with the user set arguments
|
42 |
+
*
|
43 |
+
* @since 3.0
|
44 |
+
*/
|
45 |
+
function wprss_get_args( $args ) {
|
46 |
+
// Default shortcode/function arguments for displaying feed items
|
47 |
+
$default_args = apply_filters(
|
48 |
+
'default_args',
|
49 |
+
array(
|
50 |
+
'links_before' => '<ul class="rss-aggregator">',
|
51 |
+
'links_after' => '</ul>',
|
52 |
+
'link_before' => '<li class="feed-item">',
|
53 |
+
'link_after' => '</li>'
|
54 |
+
)
|
55 |
+
);
|
56 |
+
|
57 |
+
// Parse incoming $args into an array and merge it with $default_args
|
58 |
+
$args = wp_parse_args( $args, $default_args );
|
59 |
+
|
60 |
+
return $args;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Prepares and builds the query for fetching the feed items
|
66 |
+
*
|
67 |
+
* @since 3.0
|
68 |
+
*/
|
69 |
+
function wprss_get_feed_items_query( $settings ) {
|
70 |
+
// Arguments for the next query to fetch all feed items
|
71 |
+
$feed_items_args = apply_filters(
|
72 |
+
'wprss_display_feed_items_query',
|
73 |
+
array(
|
74 |
+
'post_type' => 'wprss_feed_item',
|
75 |
+
'posts_per_page' => $settings['feed_limit'],
|
76 |
+
'orderby' => 'meta_value',
|
77 |
+
'meta_key' => 'wprss_item_date',
|
78 |
+
'order' => 'DESC'
|
79 |
+
)
|
80 |
+
);
|
81 |
+
|
82 |
+
// Query to get all feed items for display
|
83 |
+
$feed_items = new WP_Query( $feed_items_args );
|
84 |
+
|
85 |
+
return $feed_items;
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
add_action( 'wprss_display_template', 'wprss_default_display_template', 10, 3 );
|
90 |
+
/**
|
91 |
+
* Default template for feed items display
|
92 |
+
*
|
93 |
+
* @since 3.0
|
94 |
+
*/
|
95 |
+
function wprss_default_display_template( $display_settings, $args, $feed_items ) {
|
96 |
+
|
97 |
+
$general_settings = get_option( 'wprss_settings_general' );
|
98 |
+
$excerpts_settings = get_option( 'wprss_settings_excerpts' );
|
99 |
+
$thumbnails_settings = get_option( 'wprss_settings_thumbnails' );
|
100 |
+
// Declare each item in $args as its own variable
|
101 |
+
extract( $args, EXTR_SKIP );
|
102 |
+
|
103 |
+
$output = '';
|
104 |
+
|
105 |
+
if( $feed_items->have_posts() ) {
|
106 |
+
|
107 |
+
$output .= "$links_before";
|
108 |
+
|
109 |
+
while ( $feed_items->have_posts() ) {
|
110 |
+
$feed_items->the_post();
|
111 |
+
$permalink = get_post_meta( get_the_ID(), 'wprss_item_permalink', true );
|
112 |
+
$feed_source_id = get_post_meta( get_the_ID(), 'wprss_feed_id', true );
|
113 |
+
$source_name = get_the_title( $feed_source_id );
|
114 |
+
do_action( 'wprss_get_post_data' );
|
115 |
+
|
116 |
+
// convert from Unix timestamp
|
117 |
+
$date = date( $general_settings['date_format'], intval( get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) );
|
118 |
+
|
119 |
+
if ( $general_settings['title_link'] == 1 ) {
|
120 |
+
$output .= "$link_before" . '<a ' . $display_settings['open'] . ' ' . $display_settings['follow'] . ' href="'. $permalink . '">'. get_the_title(). '</a>';
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
$output .= get_the_title();
|
124 |
+
}
|
125 |
+
|
126 |
+
if ( ( $general_settings['source_enable'] == 1 ) && ( $general_settings['date_enable'] == 1 ) ) {
|
127 |
+
$output .= '<div class="source-date"><span class="feed-source">' .
|
128 |
+
( !empty( $general_settings['text_preceding_source'] ) ? $general_settings['text_preceding_source'] . ' ' : '' ) . $source_name . ' | ' .
|
129 |
+
( !empty( $general_settings['text_preceding_date'] ) ? $general_settings['text_preceding_date'] . ' ' : '' ) . $date .
|
130 |
+
'</span></div>' . "$link_after";
|
131 |
+
}
|
132 |
+
|
133 |
+
else if ( ( $general_settings['source_enable'] == 1 ) && ( $general_settings['date_enable'] == 0 ) ) {
|
134 |
+
$output .= '<div class="source-date"><span class="feed-source">' .
|
135 |
+
( !empty( $general_settings['text_preceding_source'] ) ? $general_settings['text_preceding_source'] . ' ' : '' ) . $source_name .
|
136 |
+
'</span></div>' . "$link_after";
|
137 |
+
}
|
138 |
+
|
139 |
+
else if ( ( $general_settings['source_enable'] == 0 ) && ( $general_settings['date_enable'] == 1 ) ) {
|
140 |
+
$output .= '<div class="source-date"><span class="feed-source">' .
|
141 |
+
( !empty( $general_settings['text_preceding_date'] ) ? $general_settings['text_preceding_date'] . ' ' : '' ) . $date .
|
142 |
+
'</span></div>' . "$link_after";
|
143 |
+
}
|
144 |
+
|
145 |
+
else {}
|
146 |
+
|
147 |
+
}
|
148 |
+
$output .= "$links_after";
|
149 |
+
$output = apply_filters( 'feed_output', $output );
|
150 |
+
|
151 |
+
echo $output;
|
152 |
+
|
153 |
+
// echo paginate_links();
|
154 |
+
|
155 |
+
wp_reset_postdata();
|
156 |
+
|
157 |
+
} else {
|
158 |
+
$output = apply_filters( 'no_feed_items_found', __( 'No feed items found.', 'wprss' ) );
|
159 |
+
echo $output;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Display feed items on the front end (via shortcode or function)
|
166 |
+
*
|
167 |
+
* @since 2.0
|
168 |
+
*/
|
169 |
+
function wprss_display_feed_items( $args = array() ) {
|
170 |
+
$settings = get_option( 'wprss_settings_general' );
|
171 |
+
$display_settings = wprss_get_display_settings( $settings );
|
172 |
+
$args = wprss_get_args( $args );
|
173 |
+
$feed_items = wprss_get_feed_items_query( $settings );
|
174 |
+
do_action( 'wprss_display_template', $display_settings, $args, $feed_items );
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Redirects to wprss_display_feed_items
|
180 |
+
* It is used for backwards compatibility to versions < 2.0
|
181 |
+
*
|
182 |
+
* @since 2.1
|
183 |
+
*/
|
184 |
+
function wp_rss_aggregator( $args = array() ) {
|
185 |
+
wprss_display_feed_items( $args );
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Limits a phrase/content to a defined number of words
|
191 |
+
*
|
192 |
+
* NOT BEING USED as we're using the native WP function, although the native one strips tags, so I'll
|
193 |
+
* probably revisit this one again soon.
|
194 |
+
*
|
195 |
+
* @since 3.0
|
196 |
+
* @param string $words
|
197 |
+
* @param integer $limit
|
198 |
+
* @param string $append
|
199 |
+
* @return string
|
200 |
+
*/
|
201 |
+
function wprss_limit_words( $words, $limit, $append = '' ) {
|
202 |
+
/* Add 1 to the specified limit becuase arrays start at 0 */
|
203 |
+
$limit = $limit + 1;
|
204 |
+
/* Store each individual word as an array element
|
205 |
+
up to the limit */
|
206 |
+
$words = explode( ' ', $words, $limit );
|
207 |
+
/* Shorten the array by 1 because that final element will be the sum of all the words after the limit */
|
208 |
+
array_pop( $words );
|
209 |
+
/* Implode the array for output, and append an ellipse */
|
210 |
+
$words = implode( ' ', $words ) . $append;
|
211 |
+
/* Return the result */
|
212 |
+
return rtrim( $words );
|
213 |
+
}
|
includes/feed-processing.php
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Feed processing related functions
|
4 |
+
*
|
5 |
+
* @package WPRSSAggregator
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Change the default feed cache recreation period to 2 hours
|
11 |
+
*
|
12 |
+
* Probably not needed since we are now disabling caching altogether
|
13 |
+
*
|
14 |
+
* @since 2.1
|
15 |
+
*/
|
16 |
+
function wprss_feed_cache_lifetime( $seconds )
|
17 |
+
{
|
18 |
+
return 1; // one second
|
19 |
+
//return 7200; // 2 hours
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Disable caching of feeds in transients, we don't need it as we are storing them in the wp_posts table
|
25 |
+
*
|
26 |
+
* @since 3.0
|
27 |
+
*/
|
28 |
+
function wprss_do_not_cache_feeds( &$feed ) {
|
29 |
+
$feed->enable_cache( false );
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Parameters for query to get all feed sources
|
35 |
+
*
|
36 |
+
* @since 3.0
|
37 |
+
*/
|
38 |
+
function wprss_get_all_feed_sources() {
|
39 |
+
// Get all feed sources
|
40 |
+
$feed_sources = new WP_Query( apply_filters(
|
41 |
+
'wprss_get_all_feed_sources',
|
42 |
+
array(
|
43 |
+
'post_type' => 'wprss_feed',
|
44 |
+
'post_status' => 'publish',
|
45 |
+
'cache_results' => false, // Disable caching, used for one-off queries
|
46 |
+
'no_found_rows' => true, // We don't need pagination, so disable it
|
47 |
+
'posts_per_page' => -1
|
48 |
+
)
|
49 |
+
) );
|
50 |
+
return $feed_sources;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Parameters for query to get feed sources
|
56 |
+
*
|
57 |
+
* @since 3.0
|
58 |
+
*/
|
59 |
+
function wprss_get_feed_source() {
|
60 |
+
// Get all feed sources
|
61 |
+
$feed_sources = new WP_Query( apply_filters(
|
62 |
+
'wprss_get_all_feed_sources',
|
63 |
+
array(
|
64 |
+
'post_type' => 'wprss_feed',
|
65 |
+
'post_status' => 'publish',
|
66 |
+
'cache_results' => false, // Disable caching, used for one-off queries
|
67 |
+
'no_found_rows' => true, // We don't need pagination, so disable it
|
68 |
+
'posts_per_page' => -1
|
69 |
+
)
|
70 |
+
) );
|
71 |
+
return $feed_sources;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Database query to get existing permalinks
|
77 |
+
*
|
78 |
+
* @since 3.0
|
79 |
+
*/
|
80 |
+
function get_existing_permalinks( $feed_ID ) {
|
81 |
+
global $wpdb;
|
82 |
+
|
83 |
+
$existing_permalinks = $wpdb->get_col(
|
84 |
+
"SELECT meta_value
|
85 |
+
FROM $wpdb->postmeta
|
86 |
+
WHERE meta_key = 'wprss_item_permalink'
|
87 |
+
AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID )"
|
88 |
+
);
|
89 |
+
|
90 |
+
return $existing_permalinks;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
function wprss_get_feed_items( $feed_url ) {
|
95 |
+
add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_feed_cache_lifetime' );
|
96 |
+
|
97 |
+
/* Disable caching of feeds */
|
98 |
+
add_action( 'wp_feed_options', 'wprss_do_not_cache_feeds' );
|
99 |
+
/* Fetch the feed from the soure URL specified */
|
100 |
+
$feed = fetch_feed( $feed_url );
|
101 |
+
/* Remove action here because we only don't want it active feed imports outside of our plugin */
|
102 |
+
remove_action( 'wp_feed_options', 'wprss_do_not_cache_feeds' );
|
103 |
+
|
104 |
+
//$feed = wprss_fetch_feed( $feed_url );
|
105 |
+
remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_feed_cache_lifetime' );
|
106 |
+
|
107 |
+
if ( !is_wp_error( $feed ) ) {
|
108 |
+
|
109 |
+
// Figure out how many total items there are, but limit it to 5.
|
110 |
+
$maxitems = $feed->get_item_quantity(5);
|
111 |
+
|
112 |
+
if ( $maxitems == 0 ) { return; }
|
113 |
+
|
114 |
+
// Build an array of all the items, starting with element 0 (first element).
|
115 |
+
$items = $feed->get_items( 0, $maxitems );
|
116 |
+
return $items;
|
117 |
+
}
|
118 |
+
|
119 |
+
else { return; }
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
function wprss_items_insert_post( $items, $feed_ID ) {
|
124 |
+
|
125 |
+
// Gather the permalinks of existing feed item's related to this feed source
|
126 |
+
$existing_permalinks = get_existing_permalinks( $feed_ID );
|
127 |
+
|
128 |
+
foreach ( $items as $item ) {
|
129 |
+
// Check if newly fetched item already present in existing feed items,
|
130 |
+
// if not insert it into wp_posts and insert post meta.
|
131 |
+
if ( ! ( in_array( $item->get_permalink(), $existing_permalinks ) ) ) {
|
132 |
+
$feed_item = apply_filters(
|
133 |
+
'wprss_populate_post_data',
|
134 |
+
array(
|
135 |
+
'post_title' => $item->get_title(),
|
136 |
+
'post_content' => '',
|
137 |
+
'post_status' => 'publish',
|
138 |
+
'post_type' => 'wprss_feed_item',
|
139 |
+
),
|
140 |
+
$item
|
141 |
+
);
|
142 |
+
// Create and insert post object into the DB
|
143 |
+
$inserted_ID = wp_insert_post( $feed_item );
|
144 |
+
|
145 |
+
// Create and insert post meta into the DB
|
146 |
+
wprss_items_insert_post_meta( $inserted_ID, $item, $feed_ID );
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Creates meta entries for feed items while they are being imported
|
154 |
+
*
|
155 |
+
* @since 2.3
|
156 |
+
*/
|
157 |
+
function wprss_items_insert_post_meta( $inserted_ID, $item, $feed_ID) {
|
158 |
+
update_post_meta( $inserted_ID, 'wprss_item_permalink', $item->get_permalink() );
|
159 |
+
update_post_meta( $inserted_ID, 'wprss_item_description', $item->get_description() );
|
160 |
+
update_post_meta( $inserted_ID, 'wprss_item_date', $item->get_date( 'U' ) ); // Save as Unix timestamp format
|
161 |
+
update_post_meta( $inserted_ID, 'wprss_feed_id', $feed_ID);
|
162 |
+
do_action( 'wprss_items_create_post_meta', $inserted_ID, $item, $feed_ID );
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
add_action( 'wp_insert_post', 'wprss_fetch_insert_feed_items', '', 2 );
|
167 |
+
/**
|
168 |
+
* Fetches feed items from source provided and inserts into db
|
169 |
+
*
|
170 |
+
* This function is used when inserting or untrashing a new feed source, it only gets feeds from that particular source
|
171 |
+
*
|
172 |
+
* @since 3.0
|
173 |
+
*/
|
174 |
+
function wprss_fetch_insert_feed_items( $post_id, $post ) {
|
175 |
+
|
176 |
+
// Only run the rest of the function if the post is a feed source and it has just been published
|
177 |
+
if( ( $post->post_type == 'wprss_feed' ) && ( $post->post_status == 'publish' ) ) {
|
178 |
+
|
179 |
+
$feed_ID = $post_id;
|
180 |
+
|
181 |
+
$feed_url = get_post_meta( $feed_ID, 'wprss_url', true );
|
182 |
+
|
183 |
+
// Use the URL custom field to fetch the feed items for this source
|
184 |
+
if( !empty( $feed_url ) ) {
|
185 |
+
$items = wprss_get_feed_items( $feed_url );
|
186 |
+
}
|
187 |
+
|
188 |
+
if ( ! empty( $items ) ) {
|
189 |
+
wprss_items_insert_post( $items, $feed_ID );
|
190 |
+
}
|
191 |
+
wp_reset_postdata(); // Restore the $post global to the current post in the main query
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Fetches all feed items from sources provided and inserts into db
|
198 |
+
*
|
199 |
+
* This function is used by the cron job or the debugging functions to get all feeds from all feed sources
|
200 |
+
*
|
201 |
+
* @since 3.0
|
202 |
+
*/
|
203 |
+
function wprss_fetch_insert_all_feed_items() {
|
204 |
+
|
205 |
+
// Get all feed sources
|
206 |
+
$feed_sources = wprss_get_all_feed_sources();
|
207 |
+
|
208 |
+
if( $feed_sources->have_posts() ) {
|
209 |
+
// Start by getting one feed source, we will cycle through them one by one,
|
210 |
+
// fetching feed items and adding them to the database in each pass
|
211 |
+
while ( $feed_sources->have_posts() ) {
|
212 |
+
$feed_sources->the_post();
|
213 |
+
|
214 |
+
$feed_ID = get_the_ID();
|
215 |
+
$feed_url = get_post_meta( get_the_ID(), 'wprss_url', true );
|
216 |
+
|
217 |
+
// Use the URL custom field to fetch the feed items for this source
|
218 |
+
if( !empty( $feed_url ) ) {
|
219 |
+
$items = wprss_get_feed_items( $feed_url );
|
220 |
+
}
|
221 |
+
|
222 |
+
if ( ! empty( $items ) ) {
|
223 |
+
wprss_items_insert_post( $items, $feed_ID );
|
224 |
+
}
|
225 |
+
}
|
226 |
+
wp_reset_postdata(); // Restore the $post global to the current post in the main query
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
|
231 |
+
add_action( 'trash_wprss_feed', 'wprss_delete_feed_items' ); // maybe use wp_trash_post action? wp_trash_wprss_feed
|
232 |
+
/**
|
233 |
+
* Delete feed items on trashing of corresponding feed source
|
234 |
+
*
|
235 |
+
* @since 2.0
|
236 |
+
*/
|
237 |
+
function wprss_delete_feed_items( $postid ) {
|
238 |
+
|
239 |
+
$args = array(
|
240 |
+
'post_type' => 'wprss_feed_item',
|
241 |
+
// Next 3 parameters for performance, see http://thomasgriffinmedia.com/blog/2012/10/optimize-wordpress-queries
|
242 |
+
'cache_results' => false, // Disable caching, used for one-off queries
|
243 |
+
'no_found_rows' => true, // We don't need pagination, so disable it
|
244 |
+
'fields' => 'ids', // Returns post IDs only
|
245 |
+
'meta_query' => array(
|
246 |
+
array(
|
247 |
+
'key' => 'wprss_feed_id',
|
248 |
+
'value' => $postid,
|
249 |
+
'compare' => 'LIKE'
|
250 |
+
)
|
251 |
+
)
|
252 |
+
);
|
253 |
+
|
254 |
+
$feed_item_ids = get_posts( $args );
|
255 |
+
foreach( $feed_item_ids as $feed_item_id ) {
|
256 |
+
$purge = wp_delete_post( $feed_item_id, true ); // delete the feed item, skipping trash
|
257 |
+
}
|
258 |
+
wp_reset_postdata();
|
259 |
+
}
|
260 |
+
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Delete all feed items
|
264 |
+
*
|
265 |
+
* @since 3.0
|
266 |
+
*/
|
267 |
+
function wprss_delete_all_feed_items() {
|
268 |
+
$args = array(
|
269 |
+
'post_type' => 'wprss_feed_item',
|
270 |
+
'cache_results' => false, // Disable caching, used for one-off queries
|
271 |
+
'no_found_rows' => true, // We don't need pagination, so disable it
|
272 |
+
'fields' => 'ids', // Returns post IDs only
|
273 |
+
'posts_per_page' => -1,
|
274 |
+
);
|
275 |
+
|
276 |
+
//$feed_items = new WP_Query( $args );
|
277 |
+
|
278 |
+
$feed_item_ids = get_posts( $args );
|
279 |
+
foreach( $feed_item_ids as $feed_item_id ) {
|
280 |
+
$purge = wp_delete_post( $feed_item_id, true ); // delete the feed item, skipping trash
|
281 |
+
}
|
282 |
+
wp_reset_postdata();
|
283 |
+
}
|
284 |
+
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Delete old feed items from the database to avoid bloat
|
288 |
+
*
|
289 |
+
* @since 2.0
|
290 |
+
*/
|
291 |
+
function wprss_truncate_posts() {
|
292 |
+
global $wpdb;
|
293 |
+
$general_settings = get_option( 'wprss_settings_general' );
|
294 |
+
|
295 |
+
if ( $general_settings['limit_feed_items'] == 0 ) {
|
296 |
+
return;
|
297 |
+
}
|
298 |
+
|
299 |
+
// Set your threshold of max posts and post_type name
|
300 |
+
$threshold = $general_settings['limit_feed_items'];
|
301 |
+
$post_type = 'wprss_feed_item';
|
302 |
+
|
303 |
+
// Query post type
|
304 |
+
// $wpdb query allows me to select specific columns instead of grabbing the entire post object.
|
305 |
+
$query = "
|
306 |
+
SELECT ID, post_title FROM $wpdb->posts
|
307 |
+
WHERE post_type = '$post_type'
|
308 |
+
AND post_status = 'publish'
|
309 |
+
ORDER BY post_modified DESC
|
310 |
+
";
|
311 |
+
$results = $wpdb->get_results( $query );
|
312 |
+
|
313 |
+
// Check if there are any results
|
314 |
+
if ( count( $results ) ){
|
315 |
+
foreach ( $results as $post ) {
|
316 |
+
$i++;
|
317 |
+
|
318 |
+
// Skip any posts within our threshold
|
319 |
+
if ( $i <= $threshold )
|
320 |
+
continue;
|
321 |
+
|
322 |
+
// Let the WordPress API do the heavy lifting for cleaning up entire post trails
|
323 |
+
$purge = wp_delete_post( $post->ID, true );
|
324 |
+
}
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Custom version of the WP fetch_feed() function, since we want custom sanitization of a feed
|
331 |
+
*
|
332 |
+
* Not being used at the moment, until we decide whether we can still use fetch_feed and modify its handling of sanitization
|
333 |
+
*
|
334 |
+
* @since 3.0
|
335 |
+
*
|
336 |
+
*/
|
337 |
+
/*function wprss_fetch_feed($url) {
|
338 |
+
require_once (ABSPATH . WPINC . '/class-feed.php');
|
339 |
+
|
340 |
+
$feed = new SimplePie();
|
341 |
+
|
342 |
+
// $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
|
343 |
+
// We must manually overwrite $feed->sanitize because SimplePie's
|
344 |
+
// constructor sets it before we have a chance to set the sanitization class
|
345 |
+
// $feed->sanitize = new WP_SimplePie_Sanitize_KSES();
|
346 |
+
|
347 |
+
$feed->set_cache_class( 'WP_Feed_Cache' );
|
348 |
+
$feed->set_file_class( 'WP_SimplePie_File' );
|
349 |
+
|
350 |
+
$feed->set_feed_url($url);
|
351 |
+
$feed->strip_htmltags(array_merge($feed->strip_htmltags, array( 'h1', 'h2', 'h3', 'h4', 'h5', 'a' )));
|
352 |
+
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
|
353 |
+
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
|
354 |
+
$feed->init();
|
355 |
+
$feed->handle_content_type();
|
356 |
+
|
357 |
+
if ( $feed->error() )
|
358 |
+
return new WP_Error('simplepie-error', $feed->error());
|
359 |
+
|
360 |
+
return $feed;
|
361 |
+
}*/
|
362 |
+
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Deletes all imported feeds and re-imports everything
|
366 |
+
*
|
367 |
+
* @since 3.0
|
368 |
+
*/
|
369 |
+
function wprss_feed_reset() {
|
370 |
+
wprss_delete_all_feed_items();
|
371 |
+
wprss_fetch_insert_all_feed_items();
|
372 |
+
}
|
373 |
+
|
374 |
+
/* add_action( 'wp_feed_options', 'wprss_feed_options' );
|
375 |
+
function wprss_feed_options( $feed) {
|
376 |
+
$feed->strip_htmltags(array_merge($feed->strip_htmltags, array('h1', 'a', 'img','em')));
|
377 |
+
}
|
378 |
+
|
379 |
+
*/
|
includes/libraries/WP_Logging.php
ADDED
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class for logging events and errors
|
5 |
+
*
|
6 |
+
* @package WP Logging Class
|
7 |
+
* @copyright Copyright (c) 2012, Pippin Williamson
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
*/
|
10 |
+
|
11 |
+
class WP_Logging {
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class constructor.
|
16 |
+
*
|
17 |
+
* @since 1.0
|
18 |
+
*
|
19 |
+
* @access public
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
function __construct() {
|
23 |
+
|
24 |
+
// create the log post type
|
25 |
+
add_action( 'init', array( $this, 'register_post_type' ) );
|
26 |
+
|
27 |
+
// create types taxonomy and default types
|
28 |
+
add_action( 'init', array( $this, 'register_taxonomy' ) );
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Log types
|
35 |
+
*
|
36 |
+
* Sets up the default log types and allows for new ones to be created
|
37 |
+
*
|
38 |
+
* @access private
|
39 |
+
* @since 1.0
|
40 |
+
*
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
|
44 |
+
private function log_types() {
|
45 |
+
$terms = array(
|
46 |
+
'error', 'event'
|
47 |
+
);
|
48 |
+
|
49 |
+
return apply_filters( 'wp_log_types', $terms );
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Registers the wp_log Post Type
|
55 |
+
*
|
56 |
+
* @access public
|
57 |
+
* @since 1.0
|
58 |
+
*
|
59 |
+
* @uses register_post_type()
|
60 |
+
*
|
61 |
+
* @return void
|
62 |
+
*/
|
63 |
+
|
64 |
+
public function register_post_type() {
|
65 |
+
|
66 |
+
/* logs post type */
|
67 |
+
|
68 |
+
$log_args = array(
|
69 |
+
'labels' => array( 'name' => __( 'Logs', 'wp-logging' ) ),
|
70 |
+
'public' => false,
|
71 |
+
'query_var' => false,
|
72 |
+
'rewrite' => false,
|
73 |
+
'capability_type' => 'post',
|
74 |
+
'supports' => array( 'title', 'editor' ),
|
75 |
+
'can_export' => false
|
76 |
+
);
|
77 |
+
register_post_type( 'wp_log', apply_filters( 'wp_logging_post_type_args', $log_args ) );
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Registers the Type Taxonomy
|
84 |
+
*
|
85 |
+
* The Type taxonomy is used to determine the type of log entry
|
86 |
+
*
|
87 |
+
* @access public
|
88 |
+
* @since 1.0
|
89 |
+
*
|
90 |
+
* @uses register_taxonomy()
|
91 |
+
* @uses term_exists()
|
92 |
+
* @uses wp_insert_term()
|
93 |
+
*
|
94 |
+
* @return void
|
95 |
+
*/
|
96 |
+
|
97 |
+
public function register_taxonomy() {
|
98 |
+
|
99 |
+
register_taxonomy( 'wp_log_type', 'wp_log' );
|
100 |
+
|
101 |
+
$types = self::log_types();
|
102 |
+
|
103 |
+
foreach ( $types as $type ) {
|
104 |
+
if( ! term_exists( $type, 'wp_log_type' ) ) {
|
105 |
+
wp_insert_term( $type, 'wp_log_type' );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Check if a log type is valid
|
113 |
+
*
|
114 |
+
* Checks to see if the specified type is in the registered list of types
|
115 |
+
*
|
116 |
+
* @access private
|
117 |
+
* @since 1.0
|
118 |
+
*
|
119 |
+
*
|
120 |
+
* @return array
|
121 |
+
*/
|
122 |
+
|
123 |
+
private function valid_type( $type ) {
|
124 |
+
return in_array( $type, self::log_types() );
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Create new log entry
|
130 |
+
*
|
131 |
+
* This is just a simple and fast way to log something. Use self::insert_log()
|
132 |
+
* if you need to store custom meta data
|
133 |
+
*
|
134 |
+
* @access private
|
135 |
+
* @since 1.0
|
136 |
+
*
|
137 |
+
* @uses self::insert_log()
|
138 |
+
*
|
139 |
+
* @return int The ID of the new log entry
|
140 |
+
*/
|
141 |
+
|
142 |
+
public static function add( $title = '', $message = '', $parent = 0, $type = null ) {
|
143 |
+
|
144 |
+
$log_data = array(
|
145 |
+
'post_title' => $title,
|
146 |
+
'post_content' => $message,
|
147 |
+
'post_parent' => $parent,
|
148 |
+
'log_type' => $type
|
149 |
+
);
|
150 |
+
|
151 |
+
return self::insert_log( $log_data );
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Stores a log entry
|
158 |
+
*
|
159 |
+
* @access private
|
160 |
+
* @since 1.0
|
161 |
+
*
|
162 |
+
* @uses wp_parse_args()
|
163 |
+
* @uses wp_insert_post()
|
164 |
+
* @uses update_post_meta()
|
165 |
+
* @uses wp_set_object_terms()
|
166 |
+
* @uses sanitize_key()
|
167 |
+
*
|
168 |
+
* @return int The ID of the newly created log item
|
169 |
+
*/
|
170 |
+
|
171 |
+
public static function insert_log( $log_data = array(), $log_meta = array() ) {
|
172 |
+
|
173 |
+
$defaults = array(
|
174 |
+
'post_type' => 'wp_log',
|
175 |
+
'post_status' => 'publish',
|
176 |
+
'post_parent' => 0,
|
177 |
+
'post_content' => '',
|
178 |
+
'log_type' => false
|
179 |
+
);
|
180 |
+
|
181 |
+
$args = wp_parse_args( $log_data, $defaults );
|
182 |
+
|
183 |
+
do_action( 'wp_pre_insert_log' );
|
184 |
+
|
185 |
+
// store the log entry
|
186 |
+
$log_id = wp_insert_post( $args );
|
187 |
+
|
188 |
+
// set the log type, if any
|
189 |
+
if( $log_data['log_type'] && self::valid_type( $log_data['log_type'] ) ) {
|
190 |
+
wp_set_object_terms( $log_id, $log_data['log_type'], 'wp_log_type', false );
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
// set log meta, if any
|
195 |
+
if( $log_id && ! empty( $log_meta ) ) {
|
196 |
+
foreach( (array) $log_meta as $key => $meta ) {
|
197 |
+
update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
do_action( 'wp_post_insert_log', $log_id );
|
202 |
+
|
203 |
+
return $log_id;
|
204 |
+
|
205 |
+
}
|
206 |
+
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Update and existing log item
|
210 |
+
*
|
211 |
+
* @access private
|
212 |
+
* @since 1.0
|
213 |
+
*
|
214 |
+
* @uses wp_parse_args()
|
215 |
+
* @uses wp_update_post()
|
216 |
+
* @uses update_post_meta()
|
217 |
+
*
|
218 |
+
* @return bool True if successful, false otherwise
|
219 |
+
*/
|
220 |
+
public static function update_log( $log_data = array(), $log_meta = array() ) {
|
221 |
+
|
222 |
+
do_action( 'wp_pre_update_log', $log_id );
|
223 |
+
|
224 |
+
$defaults = array(
|
225 |
+
'post_type' => 'wp_log',
|
226 |
+
'post_status' => 'publish',
|
227 |
+
'post_parent' => 0
|
228 |
+
);
|
229 |
+
|
230 |
+
$args = wp_parse_args( $log_data, $defaults );
|
231 |
+
|
232 |
+
// store the log entry
|
233 |
+
$log_id = wp_update_post( $args );
|
234 |
+
|
235 |
+
if( $log_id && ! empty( $log_meta ) ) {
|
236 |
+
foreach( (array) $log_meta as $key => $meta ) {
|
237 |
+
if( ! empty( $meta ) )
|
238 |
+
update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
do_action( 'wp_post_update_log', $log_id );
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Easily retrieves log items for a particular object ID
|
249 |
+
*
|
250 |
+
* @access private
|
251 |
+
* @since 1.0
|
252 |
+
*
|
253 |
+
* @uses self::get_connected_logs()
|
254 |
+
*
|
255 |
+
* @return array
|
256 |
+
*/
|
257 |
+
|
258 |
+
public static function get_logs( $object_id = 0, $type = null, $paged = null ) {
|
259 |
+
return self::get_connected_logs( array( 'post_parent' => $object_id, 'paged' => $paged, 'log_type' => $type ) );
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Retrieve all connected logs
|
266 |
+
*
|
267 |
+
* Used for retrieving logs related to particular items, such as a specific purchase.
|
268 |
+
*
|
269 |
+
* @access private
|
270 |
+
* @since 1.0
|
271 |
+
*
|
272 |
+
* @uses wp_parse_args()
|
273 |
+
* @uses get_posts()
|
274 |
+
* @uses get_query_var()
|
275 |
+
* @uses self::valid_type()
|
276 |
+
*
|
277 |
+
* @return array / false
|
278 |
+
*/
|
279 |
+
|
280 |
+
public static function get_connected_logs( $args = array() ) {
|
281 |
+
|
282 |
+
$defaults = array(
|
283 |
+
'post_parent' => 0,
|
284 |
+
'post_type' => 'wp_log',
|
285 |
+
'posts_per_page' => 10,
|
286 |
+
'post_status' => 'publish',
|
287 |
+
'paged' => get_query_var( 'paged' ),
|
288 |
+
'log_type' => false
|
289 |
+
);
|
290 |
+
|
291 |
+
$query_args = wp_parse_args( $args, $defaults );
|
292 |
+
|
293 |
+
if( $query_args['log_type'] && self::valid_type( $query_args['log_type'] ) ) {
|
294 |
+
|
295 |
+
$query_args['tax_query'] = array(
|
296 |
+
array(
|
297 |
+
'taxonomy' => 'wp_log_type',
|
298 |
+
'field' => 'slug',
|
299 |
+
'terms' => $query_args['log_type']
|
300 |
+
)
|
301 |
+
);
|
302 |
+
|
303 |
+
}
|
304 |
+
|
305 |
+
$logs = get_posts( $query_args );
|
306 |
+
|
307 |
+
if( $logs )
|
308 |
+
return $logs;
|
309 |
+
|
310 |
+
// no logs found
|
311 |
+
return false;
|
312 |
+
|
313 |
+
}
|
314 |
+
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Retrieves number of log entries connected to particular object ID
|
318 |
+
*
|
319 |
+
* @access private
|
320 |
+
* @since 1.0
|
321 |
+
*
|
322 |
+
* @uses WP_Query()
|
323 |
+
* @uses self::valid_type()
|
324 |
+
*
|
325 |
+
* @return int
|
326 |
+
*/
|
327 |
+
|
328 |
+
public static function get_log_count( $object_id = 0, $type = null, $meta_query = null ) {
|
329 |
+
|
330 |
+
$query_args = array(
|
331 |
+
'post_parent' => $object_id,
|
332 |
+
'post_type' => 'wp_log',
|
333 |
+
'posts_per_page' => -1,
|
334 |
+
'post_status' => 'publish'
|
335 |
+
);
|
336 |
+
|
337 |
+
if( ! empty( $type ) && self::valid_type( $type ) ) {
|
338 |
+
|
339 |
+
$query_args['tax_query'] = array(
|
340 |
+
array(
|
341 |
+
'taxonomy' => 'wp_log_type',
|
342 |
+
'field' => 'slug',
|
343 |
+
'terms' => $type
|
344 |
+
)
|
345 |
+
);
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
if( ! empty( $meta_query ) ) {
|
350 |
+
$query_args['meta_query'] = $meta_query;
|
351 |
+
}
|
352 |
+
|
353 |
+
$logs = new WP_Query( $query_args );
|
354 |
+
|
355 |
+
return (int) $logs->post_count;
|
356 |
+
|
357 |
+
}
|
358 |
+
|
359 |
+
}
|
360 |
+
$GLOBALS['wp_logs'] = new WP_Logging();
|
includes/libraries/browser.php
ADDED
@@ -0,0 +1,1082 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Modified to remove var
|
4 |
+
* Chris Christoff on 12/26/2012
|
5 |
+
* Changes: Changes vars to publics
|
6 |
+
*
|
7 |
+
* Modified to work for EDD by
|
8 |
+
* Chris Christoff on 12/23/2012
|
9 |
+
* Changes: Removed the browser string return and added spacing. Also removed return HTML formatting.
|
10 |
+
*
|
11 |
+
* Modified to add formatted User Agent string for EDD System Info by
|
12 |
+
* Chris Christoff on 12/23/2012
|
13 |
+
* Changes: Split user string and add formatting so we can print a nicely
|
14 |
+
* formatted user agent string on the EDD System Info
|
15 |
+
*
|
16 |
+
* File: Browser.php
|
17 |
+
* Author: Chris Schuld (http://chrisschuld.com/)
|
18 |
+
* Last Modified: August 20th, 2010
|
19 |
+
* @version 1.9
|
20 |
+
* @package PegasusPHP
|
21 |
+
*
|
22 |
+
* Copyright (C) 2008-2010 Chris Schuld (chris@chrisschuld.com)
|
23 |
+
*
|
24 |
+
* This program is free software; you can redistribute it and/or
|
25 |
+
* modify it under the terms of the GNU General Public License as
|
26 |
+
* published by the Free Software Foundation; either version 2 of
|
27 |
+
* the License, or (at your option) any later version.
|
28 |
+
*
|
29 |
+
* This program is distributed in the hope that it will be useful,
|
30 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
31 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
32 |
+
* GNU General Public License for more details at:
|
33 |
+
* http://www.gnu.org/copyleft/gpl.html
|
34 |
+
*
|
35 |
+
*
|
36 |
+
* Typical Usage:
|
37 |
+
*
|
38 |
+
* $browser = new Browser();
|
39 |
+
* if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
|
40 |
+
* echo 'You have FireFox version 2 or greater';
|
41 |
+
* }
|
42 |
+
*
|
43 |
+
* User Agents Sampled from: http://www.useragentstring.com/
|
44 |
+
*
|
45 |
+
* This implementation is based on the original work from Gary White
|
46 |
+
* http://apptools.com/phptools/browser/
|
47 |
+
*
|
48 |
+
* UPDATES:
|
49 |
+
*
|
50 |
+
* 2010-08-20 (v1.9):
|
51 |
+
* + Added MSN Explorer Browser (legacy)
|
52 |
+
* + Added Bing/MSN Robot (Thanks Rob MacDonald)
|
53 |
+
* + Added the Android Platform (PLATFORM_ANDROID)
|
54 |
+
* + Fixed issue with Android 1.6/2.2 (Thanks Tom Hirashima)
|
55 |
+
*
|
56 |
+
* 2010-04-27 (v1.8):
|
57 |
+
* + Added iPad Support
|
58 |
+
*
|
59 |
+
* 2010-03-07 (v1.7):
|
60 |
+
* + *MAJOR* Rebuild (preg_match and other "slow" routine removal(s))
|
61 |
+
* + Almost allof Gary's original code has been replaced
|
62 |
+
* + Large PHPUNIT testing environment created to validate new releases and additions
|
63 |
+
* + Added FreeBSD Platform
|
64 |
+
* + Added OpenBSD Platform
|
65 |
+
* + Added NetBSD Platform
|
66 |
+
* + Added SunOS Platform
|
67 |
+
* + Added OpenSolaris Platform
|
68 |
+
* + Added support of the Iceweazel Browser
|
69 |
+
* + Added isChromeFrame() call to check if chromeframe is in use
|
70 |
+
* + Moved the Opera check in front of the Firefox check due to legacy Opera User Agents
|
71 |
+
* + Added the __toString() method (Thanks Deano)
|
72 |
+
*
|
73 |
+
* 2009-11-15:
|
74 |
+
* + Updated the checkes for Firefox
|
75 |
+
* + Added the NOKIA platform
|
76 |
+
* + Added Checks for the NOKIA brower(s)
|
77 |
+
*
|
78 |
+
* 2009-11-08:
|
79 |
+
* + PHP 5.3 Support
|
80 |
+
* + Added support for BlackBerry OS and BlackBerry browser
|
81 |
+
* + Added support for the Opera Mini browser
|
82 |
+
* + Added additional documenation
|
83 |
+
* + Added support for isRobot() and isMobile()
|
84 |
+
* + Added support for Opera version 10
|
85 |
+
* + Added support for deprecated Netscape Navigator version 9
|
86 |
+
* + Added support for IceCat
|
87 |
+
* + Added support for Shiretoko
|
88 |
+
*
|
89 |
+
* 2010-04-27 (v1.8):
|
90 |
+
* + Added iPad Support
|
91 |
+
*
|
92 |
+
* 2009-08-18:
|
93 |
+
* + Updated to support PHP 5.3 - removed all deprecated function calls
|
94 |
+
* + Updated to remove all double quotes (") -- converted to single quotes (')
|
95 |
+
*
|
96 |
+
* 2009-04-27:
|
97 |
+
* + Updated the IE check to remove a typo and bug (thanks John)
|
98 |
+
*
|
99 |
+
* 2009-04-22:
|
100 |
+
* + Added detection for GoogleBot
|
101 |
+
* + Added detection for the W3C Validator.
|
102 |
+
* + Added detection for Yahoo! Slurp
|
103 |
+
*
|
104 |
+
* 2009-03-14:
|
105 |
+
* + Added detection for iPods.
|
106 |
+
* + Added Platform detection for iPhones
|
107 |
+
* + Added Platform detection for iPods
|
108 |
+
*
|
109 |
+
* 2009-02-16: (Rick Hale)
|
110 |
+
* + Added version detection for Android phones.
|
111 |
+
*
|
112 |
+
* 2008-12-09:
|
113 |
+
* + Removed unused constant
|
114 |
+
*
|
115 |
+
* 2008-11-07:
|
116 |
+
* + Added Google's Chrome to the detection list
|
117 |
+
* + Added isBrowser(string) to the list of functions special thanks to
|
118 |
+
* Daniel 'mavrick' Lang for the function concept (http://mavrick.id.au)
|
119 |
+
*
|
120 |
+
*
|
121 |
+
* Gary White noted: "Since browser detection is so unreliable, I am
|
122 |
+
* no longer maintaining this script. You are free to use and or
|
123 |
+
* modify/update it as you want, however the author assumes no
|
124 |
+
* responsibility for the accuracy of the detected values."
|
125 |
+
*
|
126 |
+
* Anyone experienced with Gary's script might be interested in these notes:
|
127 |
+
*
|
128 |
+
* Added class constants
|
129 |
+
* Added detection and version detection for Google's Chrome
|
130 |
+
* Updated the version detection for Amaya
|
131 |
+
* Updated the version detection for Firefox
|
132 |
+
* Updated the version detection for Lynx
|
133 |
+
* Updated the version detection for WebTV
|
134 |
+
* Updated the version detection for NetPositive
|
135 |
+
* Updated the version detection for IE
|
136 |
+
* Updated the version detection for OmniWeb
|
137 |
+
* Updated the version detection for iCab
|
138 |
+
* Updated the version detection for Safari
|
139 |
+
* Updated Safari to remove mobile devices (iPhone)
|
140 |
+
* Added detection for iPhone
|
141 |
+
* Added detection for robots
|
142 |
+
* Added detection for mobile devices
|
143 |
+
* Added detection for BlackBerry
|
144 |
+
* Removed Netscape checks (matches heavily with firefox & mozilla)
|
145 |
+
*
|
146 |
+
*/
|
147 |
+
|
148 |
+
class Browser {
|
149 |
+
public $_agent = '';
|
150 |
+
public $_browser_name = '';
|
151 |
+
public $_version = '';
|
152 |
+
public $_platform = '';
|
153 |
+
public $_os = '';
|
154 |
+
public $_is_aol = false;
|
155 |
+
public $_is_mobile = false;
|
156 |
+
public $_is_robot = false;
|
157 |
+
public $_aol_version = '';
|
158 |
+
|
159 |
+
public $BROWSER_UNKNOWN = 'unknown';
|
160 |
+
public $VERSION_UNKNOWN = 'unknown';
|
161 |
+
|
162 |
+
public $BROWSER_OPERA = 'Opera'; // Http://www.opera.com/
|
163 |
+
public $BROWSER_OPERA_MINI = 'Opera Mini'; // Http://www.opera.com/mini/
|
164 |
+
public $BROWSER_WEBTV = 'WebTV'; // Http://www.webtv.net/pc/
|
165 |
+
public $BROWSER_IE = 'Internet Explorer'; // Http://www.microsoft.com/ie/
|
166 |
+
public $BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // Http://en.wikipedia.org/wiki/Internet_Explorer_Mobile
|
167 |
+
public $BROWSER_KONQUEROR = 'Konqueror'; // Http://www.konqueror.org/
|
168 |
+
public $BROWSER_ICAB = 'iCab'; // Http://www.icab.de/
|
169 |
+
public $BROWSER_OMNIWEB = 'OmniWeb'; // Http://www.omnigroup.com/applications/omniweb/
|
170 |
+
public $BROWSER_FIREBIRD = 'Firebird'; // Http://www.ibphoenix.com/
|
171 |
+
public $BROWSER_FIREFOX = 'Firefox'; // Http://www.mozilla.com/en-US/firefox/firefox.html
|
172 |
+
public $BROWSER_ICEWEASEL = 'Iceweasel'; // Http://www.geticeweasel.org/
|
173 |
+
public $BROWSER_SHIRETOKO = 'Shiretoko'; // Http://wiki.mozilla.org/Projects/shiretoko
|
174 |
+
public $BROWSER_MOZILLA = 'Mozilla'; // Http://www.mozilla.com/en-US/
|
175 |
+
public $BROWSER_AMAYA = 'Amaya'; // Http://www.w3.org/Amaya/
|
176 |
+
public $BROWSER_LYNX = 'Lynx'; // Http://en.wikipedia.org/wiki/Lynx
|
177 |
+
public $BROWSER_SAFARI = 'Safari'; // Http://apple.com
|
178 |
+
public $BROWSER_IPHONE = 'iPhone'; // Http://apple.com
|
179 |
+
public $BROWSER_IPOD = 'iPod'; // Http://apple.com
|
180 |
+
public $BROWSER_IPAD = 'iPad'; // Http://apple.com
|
181 |
+
public $BROWSER_CHROME = 'Chrome'; // Http://www.google.com/chrome
|
182 |
+
public $BROWSER_ANDROID = 'Android'; // Http://www.android.com/
|
183 |
+
public $BROWSER_GOOGLEBOT = 'GoogleBot'; // Http://en.wikipedia.org/wiki/Googlebot
|
184 |
+
public $BROWSER_SLURP = 'Yahoo! Slurp'; // Http://en.wikipedia.org/wiki/Yahoo!_Slurp
|
185 |
+
public $BROWSER_W3CVALIDATOR = 'W3C Validator'; // Http://validator.w3.org/
|
186 |
+
public $BROWSER_BLACKBERRY = 'BlackBerry'; // Http://www.blackberry.com/
|
187 |
+
public $BROWSER_ICECAT = 'IceCat'; // Http://en.wikipedia.org/wiki/GNU_IceCat
|
188 |
+
public $BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // Http://en.wikipedia.org/wiki/Web_Browser_for_S60
|
189 |
+
public $BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform
|
190 |
+
public $BROWSER_MSN = 'MSN Browser'; // Http://explorer.msn.com/
|
191 |
+
public $BROWSER_MSNBOT = 'MSN Bot'; // Http://search.msn.com/msnbot.htm
|
192 |
+
// Http://en.wikipedia.org/wiki/Msnbot (used for Bing as well)
|
193 |
+
|
194 |
+
public $BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // Http://browser.netscape.com/ (DEPRECATED)
|
195 |
+
public $BROWSER_GALEON = 'Galeon'; // Http://galeon.sourceforge.net/ (DEPRECATED)
|
196 |
+
public $BROWSER_NETPOSITIVE = 'NetPositive'; // Http://en.wikipedia.org/wiki/NetPositive (DEPRECATED)
|
197 |
+
public $BROWSER_PHOENIX = 'Phoenix'; // Http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED)
|
198 |
+
|
199 |
+
public $PLATFORM_UNKNOWN = 'unknown';
|
200 |
+
public $PLATFORM_WINDOWS = 'Windows';
|
201 |
+
public $PLATFORM_WINDOWS_CE = 'Windows CE';
|
202 |
+
public $PLATFORM_APPLE = 'Apple';
|
203 |
+
public $PLATFORM_LINUX = 'Linux';
|
204 |
+
public $PLATFORM_OS2 = 'OS/2';
|
205 |
+
public $PLATFORM_BEOS = 'BeOS';
|
206 |
+
public $PLATFORM_IPHONE = 'iPhone';
|
207 |
+
public $PLATFORM_IPOD = 'iPod';
|
208 |
+
public $PLATFORM_IPAD = 'iPad';
|
209 |
+
public $PLATFORM_BLACKBERRY = 'BlackBerry';
|
210 |
+
public $PLATFORM_NOKIA = 'Nokia';
|
211 |
+
public $PLATFORM_FREEBSD = 'FreeBSD';
|
212 |
+
public $PLATFORM_OPENBSD = 'OpenBSD';
|
213 |
+
public $PLATFORM_NETBSD = 'NetBSD';
|
214 |
+
public $PLATFORM_SUNOS = 'SunOS';
|
215 |
+
public $PLATFORM_OPENSOLARIS = 'OpenSolaris';
|
216 |
+
public $PLATFORM_ANDROID = 'Android';
|
217 |
+
|
218 |
+
public $OPERATING_SYSTEM_UNKNOWN = 'unknown';
|
219 |
+
|
220 |
+
function Browser($useragent="") {
|
221 |
+
$this->reset();
|
222 |
+
if( $useragent != "" ) {
|
223 |
+
$this->setUserAgent($useragent);
|
224 |
+
}
|
225 |
+
else {
|
226 |
+
$this->determine();
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Reset all properties
|
232 |
+
*/
|
233 |
+
function reset() {
|
234 |
+
$this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
|
235 |
+
$this->_browser_name = $this->BROWSER_UNKNOWN;
|
236 |
+
$this->_version = $this->VERSION_UNKNOWN;
|
237 |
+
$this->_platform = $this->PLATFORM_UNKNOWN;
|
238 |
+
$this->_os = $this->OPERATING_SYSTEM_UNKNOWN;
|
239 |
+
$this->_is_aol = false;
|
240 |
+
$this->_is_mobile = false;
|
241 |
+
$this->_is_robot = false;
|
242 |
+
$this->_aol_version = $this->VERSION_UNKNOWN;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Check to see if the specific browser is valid
|
247 |
+
* @param string $browserName
|
248 |
+
* @return True if the browser is the specified browser
|
249 |
+
*/
|
250 |
+
function isBrowser($browserName) { return( 0 == strcasecmp($this->_browser_name, trim($browserName))); }
|
251 |
+
|
252 |
+
/**
|
253 |
+
* The name of the browser. All return types are from the class contants
|
254 |
+
* @return string Name of the browser
|
255 |
+
*/
|
256 |
+
function getBrowser() { return $this->_browser_name; }
|
257 |
+
/**
|
258 |
+
* Set the name of the browser
|
259 |
+
* @param $browser The name of the Browser
|
260 |
+
*/
|
261 |
+
function setBrowser($browser) { return $this->_browser_name = $browser; }
|
262 |
+
/**
|
263 |
+
* The name of the platform. All return types are from the class contants
|
264 |
+
* @return string Name of the browser
|
265 |
+
*/
|
266 |
+
function getPlatform() { return $this->_platform; }
|
267 |
+
/**
|
268 |
+
* Set the name of the platform
|
269 |
+
* @param $platform The name of the Platform
|
270 |
+
*/
|
271 |
+
function setPlatform($platform) { return $this->_platform = $platform; }
|
272 |
+
/**
|
273 |
+
* The version of the browser.
|
274 |
+
* @return string Version of the browser (will only contain alpha-numeric characters and a period)
|
275 |
+
*/
|
276 |
+
function getVersion() { return $this->_version; }
|
277 |
+
/**
|
278 |
+
* Set the version of the browser
|
279 |
+
* @param $version The version of the Browser
|
280 |
+
*/
|
281 |
+
function setVersion($version) { $this->_version = preg_replace('/[^0-9,.,a-z,A-Z-]/','',$version); }
|
282 |
+
/**
|
283 |
+
* The version of AOL.
|
284 |
+
* @return string Version of AOL (will only contain alpha-numeric characters and a period)
|
285 |
+
*/
|
286 |
+
function getAolVersion() { return $this->_aol_version; }
|
287 |
+
/**
|
288 |
+
* Set the version of AOL
|
289 |
+
* @param $version The version of AOL
|
290 |
+
*/
|
291 |
+
function setAolVersion($version) { $this->_aol_version = preg_replace('/[^0-9,.,a-z,A-Z]/','',$version); }
|
292 |
+
/**
|
293 |
+
* Is the browser from AOL?
|
294 |
+
* @return boolean True if the browser is from AOL otherwise false
|
295 |
+
*/
|
296 |
+
function isAol() { return $this->_is_aol; }
|
297 |
+
/**
|
298 |
+
* Is the browser from a mobile device?
|
299 |
+
* @return boolean True if the browser is from a mobile device otherwise false
|
300 |
+
*/
|
301 |
+
function isMobile() { return $this->_is_mobile; }
|
302 |
+
/**
|
303 |
+
* Is the browser from a robot (ex Slurp,GoogleBot)?
|
304 |
+
* @return boolean True if the browser is from a robot otherwise false
|
305 |
+
*/
|
306 |
+
function isRobot() { return $this->_is_robot; }
|
307 |
+
/**
|
308 |
+
* Set the browser to be from AOL
|
309 |
+
* @param $isAol
|
310 |
+
*/
|
311 |
+
function setAol($isAol) { $this->_is_aol = $isAol; }
|
312 |
+
/**
|
313 |
+
* Set the Browser to be mobile
|
314 |
+
* @param boolean $value is the browser a mobile brower or not
|
315 |
+
*/
|
316 |
+
function setMobile($value=true) { $this->_is_mobile = $value; }
|
317 |
+
/**
|
318 |
+
* Set the Browser to be a robot
|
319 |
+
* @param boolean $value is the browser a robot or not
|
320 |
+
*/
|
321 |
+
function setRobot($value=true) { $this->_is_robot = $value; }
|
322 |
+
/**
|
323 |
+
* Get the user agent value in use to determine the browser
|
324 |
+
* @return string The user agent from the HTTP header
|
325 |
+
*/
|
326 |
+
function getUserAgent() { return $this->_agent; }
|
327 |
+
/**
|
328 |
+
* Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
|
329 |
+
* @param $agent_string The value for the User Agent
|
330 |
+
*/
|
331 |
+
function setUserAgent($agent_string) {
|
332 |
+
$this->reset();
|
333 |
+
$this->_agent = $agent_string;
|
334 |
+
$this->determine();
|
335 |
+
}
|
336 |
+
/**
|
337 |
+
* Used to determine if the browser is actually "chromeframe"
|
338 |
+
* @since 1.7
|
339 |
+
* @return boolean True if the browser is using chromeframe
|
340 |
+
*/
|
341 |
+
function isChromeFrame() {
|
342 |
+
return( strpos($this->_agent,"chromeframe") !== false );
|
343 |
+
}
|
344 |
+
/**
|
345 |
+
* Returns a formatted string with a summary of the details of the browser.
|
346 |
+
* @return string formatted string with a summary of the browser
|
347 |
+
*/
|
348 |
+
function __toString() {
|
349 |
+
$text1 = $this->getUserAgent(); //grabs the UA (user agent) string
|
350 |
+
$UAline1 = substr($text1, 0, 32); //the first line we print should only be the first 32 characters of the UA string
|
351 |
+
$text2 = $this->getUserAgent();//now we grab it again and save it to a string
|
352 |
+
$towrapUA = str_replace($UAline1, '', $text2);//the rest of the printoff (other than first line) is equivolent
|
353 |
+
// To the whole string minus the part we printed off. IE
|
354 |
+
// User Agent: thefirst32charactersfromUAline1
|
355 |
+
// the rest of it is now stored in
|
356 |
+
// $text2 to be printed off
|
357 |
+
// But we need to add spaces before each line that is split other than line 1
|
358 |
+
$space = '';
|
359 |
+
for($i = 0; $i < 25; $i++) {
|
360 |
+
$space .= ' ';
|
361 |
+
}
|
362 |
+
// Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting
|
363 |
+
$wordwrapped = chunk_split($towrapUA, 32, "\n $space");
|
364 |
+
return "Platform: {$this->getPlatform()} \n".
|
365 |
+
"Browser Name: {$this->getBrowser()} \n" .
|
366 |
+
"Browser Version: {$this->getVersion()} \n" .
|
367 |
+
"User Agent String: $UAline1 \n\t\t\t " .
|
368 |
+
"$wordwrapped";
|
369 |
+
}
|
370 |
+
/**
|
371 |
+
* Protected routine to calculate and determine what the browser is in use (including platform)
|
372 |
+
*/
|
373 |
+
function determine() {
|
374 |
+
$this->checkPlatform();
|
375 |
+
$this->checkBrowsers();
|
376 |
+
$this->checkForAol();
|
377 |
+
}
|
378 |
+
/**
|
379 |
+
* Protected routine to determine the browser type
|
380 |
+
* @return boolean True if the browser was detected otherwise false
|
381 |
+
*/
|
382 |
+
function checkBrowsers() {
|
383 |
+
return (
|
384 |
+
// Well-known, well-used
|
385 |
+
// Special Notes:
|
386 |
+
// (1) Opera must be checked before FireFox due to the odd
|
387 |
+
// user agents used in some older versions of Opera
|
388 |
+
// (2) WebTV is strapped onto Internet Explorer so we must
|
389 |
+
// check for WebTV before IE
|
390 |
+
// (3) (deprecated) Galeon is based on Firefox and needs to be
|
391 |
+
// tested before Firefox is tested
|
392 |
+
// (4) OmniWeb is based on Safari so OmniWeb check must occur
|
393 |
+
// before Safari
|
394 |
+
// (5) Netscape 9+ is based on Firefox so Netscape checks
|
395 |
+
// before FireFox are necessary
|
396 |
+
$this->checkBrowserWebTv() ||
|
397 |
+
$this->checkBrowserInternetExplorer() ||
|
398 |
+
$this->checkBrowserOpera() ||
|
399 |
+
$this->checkBrowserGaleon() ||
|
400 |
+
$this->checkBrowserNetscapeNavigator9Plus() ||
|
401 |
+
$this->checkBrowserFirefox() ||
|
402 |
+
$this->checkBrowserChrome() ||
|
403 |
+
$this->checkBrowserOmniWeb() ||
|
404 |
+
|
405 |
+
// Common mobile
|
406 |
+
$this->checkBrowserAndroid() ||
|
407 |
+
$this->checkBrowseriPad() ||
|
408 |
+
$this->checkBrowseriPod() ||
|
409 |
+
$this->checkBrowseriPhone() ||
|
410 |
+
$this->checkBrowserBlackBerry() ||
|
411 |
+
$this->checkBrowserNokia() ||
|
412 |
+
|
413 |
+
// Common bots
|
414 |
+
$this->checkBrowserGoogleBot() ||
|
415 |
+
$this->checkBrowserMSNBot() ||
|
416 |
+
$this->checkBrowserSlurp() ||
|
417 |
+
|
418 |
+
// WebKit base check (post mobile and others)
|
419 |
+
$this->checkBrowserSafari() ||
|
420 |
+
|
421 |
+
// Everyone else
|
422 |
+
$this->checkBrowserNetPositive() ||
|
423 |
+
$this->checkBrowserFirebird() ||
|
424 |
+
$this->checkBrowserKonqueror() ||
|
425 |
+
$this->checkBrowserIcab() ||
|
426 |
+
$this->checkBrowserPhoenix() ||
|
427 |
+
$this->checkBrowserAmaya() ||
|
428 |
+
$this->checkBrowserLynx() ||
|
429 |
+
|
430 |
+
$this->checkBrowserShiretoko() ||
|
431 |
+
$this->checkBrowserIceCat() ||
|
432 |
+
$this->checkBrowserW3CValidator() ||
|
433 |
+
$this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
|
434 |
+
);
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Determine if the user is using a BlackBerry (last updated 1.7)
|
439 |
+
* @return boolean True if the browser is the BlackBerry browser otherwise false
|
440 |
+
*/
|
441 |
+
function checkBrowserBlackBerry() {
|
442 |
+
if( stripos($this->_agent,'blackberry') !== false ) {
|
443 |
+
$aresult = explode("/",stristr($this->_agent,"BlackBerry"));
|
444 |
+
$aversion = explode(' ',$aresult[1]);
|
445 |
+
$this->setVersion($aversion[0]);
|
446 |
+
$this->_browser_name = $this->BROWSER_BLACKBERRY;
|
447 |
+
$this->setMobile(true);
|
448 |
+
return true;
|
449 |
+
}
|
450 |
+
return false;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Determine if the user is using an AOL User Agent (last updated 1.7)
|
455 |
+
* @return boolean True if the browser is from AOL otherwise false
|
456 |
+
*/
|
457 |
+
function checkForAol() {
|
458 |
+
$this->setAol(false);
|
459 |
+
$this->setAolVersion($this->VERSION_UNKNOWN);
|
460 |
+
|
461 |
+
if( stripos($this->_agent,'aol') !== false ) {
|
462 |
+
$aversion = explode(' ',stristr($this->_agent, 'AOL'));
|
463 |
+
$this->setAol(true);
|
464 |
+
$this->setAolVersion(preg_replace('/[^0-9\.a-z]/i', '', $aversion[1]));
|
465 |
+
return true;
|
466 |
+
}
|
467 |
+
return false;
|
468 |
+
}
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Determine if the browser is the GoogleBot or not (last updated 1.7)
|
472 |
+
* @return boolean True if the browser is the GoogletBot otherwise false
|
473 |
+
*/
|
474 |
+
function checkBrowserGoogleBot() {
|
475 |
+
if( stripos($this->_agent,'googlebot') !== false ) {
|
476 |
+
$aresult = explode('/',stristr($this->_agent,'googlebot'));
|
477 |
+
$aversion = explode(' ',$aresult[1]);
|
478 |
+
$this->setVersion(str_replace(';','',$aversion[0]));
|
479 |
+
$this->_browser_name = $this->BROWSER_GOOGLEBOT;
|
480 |
+
$this->setRobot(true);
|
481 |
+
return true;
|
482 |
+
}
|
483 |
+
return false;
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Determine if the browser is the MSNBot or not (last updated 1.9)
|
488 |
+
* @return boolean True if the browser is the MSNBot otherwise false
|
489 |
+
*/
|
490 |
+
function checkBrowserMSNBot() {
|
491 |
+
if( stripos($this->_agent,"msnbot") !== false ) {
|
492 |
+
$aresult = explode("/",stristr($this->_agent,"msnbot"));
|
493 |
+
$aversion = explode(" ",$aresult[1]);
|
494 |
+
$this->setVersion(str_replace(";","",$aversion[0]));
|
495 |
+
$this->_browser_name = $this->BROWSER_MSNBOT;
|
496 |
+
$this->setRobot(true);
|
497 |
+
return true;
|
498 |
+
}
|
499 |
+
return false;
|
500 |
+
}
|
501 |
+
|
502 |
+
/**
|
503 |
+
* Determine if the browser is the W3C Validator or not (last updated 1.7)
|
504 |
+
* @return boolean True if the browser is the W3C Validator otherwise false
|
505 |
+
*/
|
506 |
+
function checkBrowserW3CValidator() {
|
507 |
+
if( stripos($this->_agent,'W3C-checklink') !== false ) {
|
508 |
+
$aresult = explode('/',stristr($this->_agent,'W3C-checklink'));
|
509 |
+
$aversion = explode(' ',$aresult[1]);
|
510 |
+
$this->setVersion($aversion[0]);
|
511 |
+
$this->_browser_name = $this->BROWSER_W3CVALIDATOR;
|
512 |
+
return true;
|
513 |
+
}
|
514 |
+
else if( stripos($this->_agent,'W3C_Validator') !== false ) {
|
515 |
+
// Some of the Validator versions do not delineate w/ a slash - add it back in
|
516 |
+
$ua = str_replace("W3C_Validator ", "W3C_Validator/", $this->_agent);
|
517 |
+
$aresult = explode('/',stristr($ua,'W3C_Validator'));
|
518 |
+
$aversion = explode(' ',$aresult[1]);
|
519 |
+
$this->setVersion($aversion[0]);
|
520 |
+
$this->_browser_name = $this->BROWSER_W3CVALIDATOR;
|
521 |
+
return true;
|
522 |
+
}
|
523 |
+
return false;
|
524 |
+
}
|
525 |
+
|
526 |
+
/**
|
527 |
+
* Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
|
528 |
+
* @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false
|
529 |
+
*/
|
530 |
+
function checkBrowserSlurp() {
|
531 |
+
if( stripos($this->_agent,'slurp') !== false ) {
|
532 |
+
$aresult = explode('/',stristr($this->_agent,'Slurp'));
|
533 |
+
$aversion = explode(' ',$aresult[1]);
|
534 |
+
$this->setVersion($aversion[0]);
|
535 |
+
$this->_browser_name = $this->BROWSER_SLURP;
|
536 |
+
$this->setRobot(true);
|
537 |
+
$this->setMobile(false);
|
538 |
+
return true;
|
539 |
+
}
|
540 |
+
return false;
|
541 |
+
}
|
542 |
+
|
543 |
+
/**
|
544 |
+
* Determine if the browser is Internet Explorer or not (last updated 1.7)
|
545 |
+
* @return boolean True if the browser is Internet Explorer otherwise false
|
546 |
+
*/
|
547 |
+
function checkBrowserInternetExplorer() {
|
548 |
+
|
549 |
+
// Test for v1 - v1.5 IE
|
550 |
+
if( stripos($this->_agent,'microsoft internet explorer') !== false ) {
|
551 |
+
$this->setBrowser($this->BROWSER_IE);
|
552 |
+
$this->setVersion('1.0');
|
553 |
+
$aresult = stristr($this->_agent, '/');
|
554 |
+
if( preg_match('/308|425|426|474|0b1/i', $aresult) ) {
|
555 |
+
$this->setVersion('1.5');
|
556 |
+
}
|
557 |
+
return true;
|
558 |
+
}
|
559 |
+
// Test for versions > 1.5
|
560 |
+
else if( stripos($this->_agent,'msie') !== false && stripos($this->_agent,'opera') === false ) {
|
561 |
+
// See if the browser is the odd MSN Explorer
|
562 |
+
if( stripos($this->_agent,'msnb') !== false ) {
|
563 |
+
$aresult = explode(' ',stristr(str_replace(';','; ',$this->_agent),'MSN'));
|
564 |
+
$this->setBrowser( $this->BROWSER_MSN );
|
565 |
+
$this->setVersion(str_replace(array('(',')',';'),'',$aresult[1]));
|
566 |
+
return true;
|
567 |
+
}
|
568 |
+
$aresult = explode(' ',stristr(str_replace(';','; ',$this->_agent),'msie'));
|
569 |
+
$this->setBrowser( $this->BROWSER_IE );
|
570 |
+
$this->setVersion(str_replace(array('(',')',';'),'',$aresult[1]));
|
571 |
+
return true;
|
572 |
+
}
|
573 |
+
// Test for Pocket IE
|
574 |
+
else if( stripos($this->_agent,'mspie') !== false || stripos($this->_agent,'pocket') !== false ) {
|
575 |
+
$aresult = explode(' ',stristr($this->_agent,'mspie'));
|
576 |
+
$this->setPlatform( $this->PLATFORM_WINDOWS_CE );
|
577 |
+
$this->setBrowser( $this->BROWSER_POCKET_IE );
|
578 |
+
$this->setMobile(true);
|
579 |
+
|
580 |
+
if( stripos($this->_agent,'mspie') !== false ) {
|
581 |
+
$this->setVersion($aresult[1]);
|
582 |
+
}
|
583 |
+
else {
|
584 |
+
$aversion = explode('/',$this->_agent);
|
585 |
+
$this->setVersion($aversion[1]);
|
586 |
+
}
|
587 |
+
return true;
|
588 |
+
}
|
589 |
+
return false;
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* Determine if the browser is Opera or not (last updated 1.7)
|
594 |
+
* @return boolean True if the browser is Opera otherwise false
|
595 |
+
*/
|
596 |
+
function checkBrowserOpera() {
|
597 |
+
if( stripos($this->_agent,'opera mini') !== false ) {
|
598 |
+
$resultant = stristr($this->_agent, 'opera mini');
|
599 |
+
if( preg_match('/\//',$resultant) ) {
|
600 |
+
$aresult = explode('/',$resultant);
|
601 |
+
$aversion = explode(' ',$aresult[1]);
|
602 |
+
$this->setVersion($aversion[0]);
|
603 |
+
}
|
604 |
+
else {
|
605 |
+
$aversion = explode(' ',stristr($resultant,'opera mini'));
|
606 |
+
$this->setVersion($aversion[1]);
|
607 |
+
}
|
608 |
+
$this->_browser_name = $this->BROWSER_OPERA_MINI;
|
609 |
+
$this->setMobile(true);
|
610 |
+
return true;
|
611 |
+
}
|
612 |
+
else if( stripos($this->_agent,'opera') !== false ) {
|
613 |
+
$resultant = stristr($this->_agent, 'opera');
|
614 |
+
if( preg_match('/Version\/(10.*)$/',$resultant,$matches) ) {
|
615 |
+
$this->setVersion($matches[1]);
|
616 |
+
}
|
617 |
+
else if( preg_match('/\//',$resultant) ) {
|
618 |
+
$aresult = explode('/',str_replace("("," ",$resultant));
|
619 |
+
$aversion = explode(' ',$aresult[1]);
|
620 |
+
$this->setVersion($aversion[0]);
|
621 |
+
}
|
622 |
+
else {
|
623 |
+
$aversion = explode(' ',stristr($resultant,'opera'));
|
624 |
+
$this->setVersion(isset($aversion[1])?$aversion[1]:"");
|
625 |
+
}
|
626 |
+
$this->_browser_name = $this->BROWSER_OPERA;
|
627 |
+
return true;
|
628 |
+
}
|
629 |
+
return false;
|
630 |
+
}
|
631 |
+
|
632 |
+
/**
|
633 |
+
* Determine if the browser is Chrome or not (last updated 1.7)
|
634 |
+
* @return boolean True if the browser is Chrome otherwise false
|
635 |
+
*/
|
636 |
+
function checkBrowserChrome() {
|
637 |
+
if( stripos($this->_agent,'Chrome') !== false ) {
|
638 |
+
$aresult = explode('/',stristr($this->_agent,'Chrome'));
|
639 |
+
$aversion = explode(' ',$aresult[1]);
|
640 |
+
$this->setVersion($aversion[0]);
|
641 |
+
$this->setBrowser($this->BROWSER_CHROME);
|
642 |
+
return true;
|
643 |
+
}
|
644 |
+
return false;
|
645 |
+
}
|
646 |
+
|
647 |
+
|
648 |
+
/**
|
649 |
+
* Determine if the browser is WebTv or not (last updated 1.7)
|
650 |
+
* @return boolean True if the browser is WebTv otherwise false
|
651 |
+
*/
|
652 |
+
function checkBrowserWebTv() {
|
653 |
+
if( stripos($this->_agent,'webtv') !== false ) {
|
654 |
+
$aresult = explode('/',stristr($this->_agent,'webtv'));
|
655 |
+
$aversion = explode(' ',$aresult[1]);
|
656 |
+
$this->setVersion($aversion[0]);
|
657 |
+
$this->setBrowser($this->BROWSER_WEBTV);
|
658 |
+
return true;
|
659 |
+
}
|
660 |
+
return false;
|
661 |
+
}
|
662 |
+
|
663 |
+
/**
|
664 |
+
* Determine if the browser is NetPositive or not (last updated 1.7)
|
665 |
+
* @return boolean True if the browser is NetPositive otherwise false
|
666 |
+
*/
|
667 |
+
function checkBrowserNetPositive() {
|
668 |
+
if( stripos($this->_agent,'NetPositive') !== false ) {
|
669 |
+
$aresult = explode('/',stristr($this->_agent,'NetPositive'));
|
670 |
+
$aversion = explode(' ',$aresult[1]);
|
671 |
+
$this->setVersion(str_replace(array('(',')',';'),'',$aversion[0]));
|
672 |
+
$this->setBrowser($this->BROWSER_NETPOSITIVE);
|
673 |
+
return true;
|
674 |
+
}
|
675 |
+
return false;
|
676 |
+
}
|
677 |
+
|
678 |
+
/**
|
679 |
+
* Determine if the browser is Galeon or not (last updated 1.7)
|
680 |
+
* @return boolean True if the browser is Galeon otherwise false
|
681 |
+
*/
|
682 |
+
function checkBrowserGaleon() {
|
683 |
+
if( stripos($this->_agent,'galeon') !== false ) {
|
684 |
+
$aresult = explode(' ',stristr($this->_agent,'galeon'));
|
685 |
+
$aversion = explode('/',$aresult[0]);
|
686 |
+
$this->setVersion($aversion[1]);
|
687 |
+
$this->setBrowser($this->BROWSER_GALEON);
|
688 |
+
return true;
|
689 |
+
}
|
690 |
+
return false;
|
691 |
+
}
|
692 |
+
|
693 |
+
/**
|
694 |
+
* Determine if the browser is Konqueror or not (last updated 1.7)
|
695 |
+
* @return boolean True if the browser is Konqueror otherwise false
|
696 |
+
*/
|
697 |
+
function checkBrowserKonqueror() {
|
698 |
+
if( stripos($this->_agent,'Konqueror') !== false ) {
|
699 |
+
$aresult = explode(' ',stristr($this->_agent,'Konqueror'));
|
700 |
+
$aversion = explode('/',$aresult[0]);
|
701 |
+
$this->setVersion($aversion[1]);
|
702 |
+
$this->setBrowser($this->BROWSER_KONQUEROR);
|
703 |
+
return true;
|
704 |
+
}
|
705 |
+
return false;
|
706 |
+
}
|
707 |
+
|
708 |
+
/**
|
709 |
+
* Determine if the browser is iCab or not (last updated 1.7)
|
710 |
+
* @return boolean True if the browser is iCab otherwise false
|
711 |
+
*/
|
712 |
+
function checkBrowserIcab() {
|
713 |
+
if( stripos($this->_agent,'icab') !== false ) {
|
714 |
+
$aversion = explode(' ',stristr(str_replace('/',' ',$this->_agent),'icab'));
|
715 |
+
$this->setVersion($aversion[1]);
|
716 |
+
$this->setBrowser($this->BROWSER_ICAB);
|
717 |
+
return true;
|
718 |
+
}
|
719 |
+
return false;
|
720 |
+
}
|
721 |
+
|
722 |
+
/**
|
723 |
+
* Determine if the browser is OmniWeb or not (last updated 1.7)
|
724 |
+
* @return boolean True if the browser is OmniWeb otherwise false
|
725 |
+
*/
|
726 |
+
function checkBrowserOmniWeb() {
|
727 |
+
if( stripos($this->_agent,'omniweb') !== false ) {
|
728 |
+
$aresult = explode('/',stristr($this->_agent,'omniweb'));
|
729 |
+
$aversion = explode(' ',isset($aresult[1])?$aresult[1]:"");
|
730 |
+
$this->setVersion($aversion[0]);
|
731 |
+
$this->setBrowser($this->BROWSER_OMNIWEB);
|
732 |
+
return true;
|
733 |
+
}
|
734 |
+
return false;
|
735 |
+
}
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Determine if the browser is Phoenix or not (last updated 1.7)
|
739 |
+
* @return boolean True if the browser is Phoenix otherwise false
|
740 |
+
*/
|
741 |
+
function checkBrowserPhoenix() {
|
742 |
+
if( stripos($this->_agent,'Phoenix') !== false ) {
|
743 |
+
$aversion = explode('/',stristr($this->_agent,'Phoenix'));
|
744 |
+
$this->setVersion($aversion[1]);
|
745 |
+
$this->setBrowser($this->BROWSER_PHOENIX);
|
746 |
+
return true;
|
747 |
+
}
|
748 |
+
return false;
|
749 |
+
}
|
750 |
+
|
751 |
+
/**
|
752 |
+
* Determine if the browser is Firebird or not (last updated 1.7)
|
753 |
+
* @return boolean True if the browser is Firebird otherwise false
|
754 |
+
*/
|
755 |
+
function checkBrowserFirebird() {
|
756 |
+
if( stripos($this->_agent,'Firebird') !== false ) {
|
757 |
+
$aversion = explode('/',stristr($this->_agent,'Firebird'));
|
758 |
+
$this->setVersion($aversion[1]);
|
759 |
+
$this->setBrowser($this->BROWSER_FIREBIRD);
|
760 |
+
return true;
|
761 |
+
}
|
762 |
+
return false;
|
763 |
+
}
|
764 |
+
|
765 |
+
/**
|
766 |
+
* Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7)
|
767 |
+
* NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008)
|
768 |
+
* @return boolean True if the browser is Netscape Navigator 9+ otherwise false
|
769 |
+
*/
|
770 |
+
function checkBrowserNetscapeNavigator9Plus() {
|
771 |
+
if( stripos($this->_agent,'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i',$this->_agent,$matches) ) {
|
772 |
+
$this->setVersion($matches[1]);
|
773 |
+
$this->setBrowser($this->BROWSER_NETSCAPE_NAVIGATOR);
|
774 |
+
return true;
|
775 |
+
}
|
776 |
+
else if( stripos($this->_agent,'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i',$this->_agent,$matches) ) {
|
777 |
+
$this->setVersion($matches[1]);
|
778 |
+
$this->setBrowser($this->BROWSER_NETSCAPE_NAVIGATOR);
|
779 |
+
return true;
|
780 |
+
}
|
781 |
+
return false;
|
782 |
+
}
|
783 |
+
|
784 |
+
/**
|
785 |
+
* Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
|
786 |
+
* @return boolean True if the browser is Shiretoko otherwise false
|
787 |
+
*/
|
788 |
+
function checkBrowserShiretoko() {
|
789 |
+
if( stripos($this->_agent,'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i',$this->_agent,$matches) ) {
|
790 |
+
$this->setVersion($matches[1]);
|
791 |
+
$this->setBrowser($this->BROWSER_SHIRETOKO);
|
792 |
+
return true;
|
793 |
+
}
|
794 |
+
return false;
|
795 |
+
}
|
796 |
+
|
797 |
+
/**
|
798 |
+
* Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
|
799 |
+
* @return boolean True if the browser is Ice Cat otherwise false
|
800 |
+
*/
|
801 |
+
function checkBrowserIceCat() {
|
802 |
+
if( stripos($this->_agent,'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i',$this->_agent,$matches) ) {
|
803 |
+
$this->setVersion($matches[1]);
|
804 |
+
$this->setBrowser($this->BROWSER_ICECAT);
|
805 |
+
return true;
|
806 |
+
}
|
807 |
+
return false;
|
808 |
+
}
|
809 |
+
|
810 |
+
/**
|
811 |
+
* Determine if the browser is Nokia or not (last updated 1.7)
|
812 |
+
* @return boolean True if the browser is Nokia otherwise false
|
813 |
+
*/
|
814 |
+
function checkBrowserNokia() {
|
815 |
+
if( preg_match("/Nokia([^\/]+)\/([^ SP]+)/i",$this->_agent,$matches) ) {
|
816 |
+
$this->setVersion($matches[2]);
|
817 |
+
if( stripos($this->_agent,'Series60') !== false || strpos($this->_agent,'S60') !== false ) {
|
818 |
+
$this->setBrowser($this->BROWSER_NOKIA_S60);
|
819 |
+
}
|
820 |
+
else {
|
821 |
+
$this->setBrowser( $this->BROWSER_NOKIA );
|
822 |
+
}
|
823 |
+
$this->setMobile(true);
|
824 |
+
return true;
|
825 |
+
}
|
826 |
+
return false;
|
827 |
+
}
|
828 |
+
|
829 |
+
/**
|
830 |
+
* Determine if the browser is Firefox or not (last updated 1.7)
|
831 |
+
* @return boolean True if the browser is Firefox otherwise false
|
832 |
+
*/
|
833 |
+
function checkBrowserFirefox() {
|
834 |
+
if( stripos($this->_agent,'safari') === false ) {
|
835 |
+
if( preg_match("/Firefox[\/ \(]([^ ;\)]+)/i",$this->_agent,$matches) ) {
|
836 |
+
$this->setVersion($matches[1]);
|
837 |
+
$this->setBrowser($this->BROWSER_FIREFOX);
|
838 |
+
return true;
|
839 |
+
}
|
840 |
+
else if( preg_match("/Firefox$/i",$this->_agent,$matches) ) {
|
841 |
+
$this->setVersion("");
|
842 |
+
$this->setBrowser($this->BROWSER_FIREFOX);
|
843 |
+
return true;
|
844 |
+
}
|
845 |
+
}
|
846 |
+
return false;
|
847 |
+
}
|
848 |
+
|
849 |
+
/**
|
850 |
+
* Determine if the browser is Firefox or not (last updated 1.7)
|
851 |
+
* @return boolean True if the browser is Firefox otherwise false
|
852 |
+
*/
|
853 |
+
function checkBrowserIceweasel() {
|
854 |
+
if( stripos($this->_agent,'Iceweasel') !== false ) {
|
855 |
+
$aresult = explode('/',stristr($this->_agent,'Iceweasel'));
|
856 |
+
$aversion = explode(' ',$aresult[1]);
|
857 |
+
$this->setVersion($aversion[0]);
|
858 |
+
$this->setBrowser($this->BROWSER_ICEWEASEL);
|
859 |
+
return true;
|
860 |
+
}
|
861 |
+
return false;
|
862 |
+
}
|
863 |
+
/**
|
864 |
+
* Determine if the browser is Mozilla or not (last updated 1.7)
|
865 |
+
* @return boolean True if the browser is Mozilla otherwise false
|
866 |
+
*/
|
867 |
+
function checkBrowserMozilla() {
|
868 |
+
if( stripos($this->_agent,'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i',$this->_agent) && stripos($this->_agent,'netscape') === false) {
|
869 |
+
$aversion = explode(' ',stristr($this->_agent,'rv:'));
|
870 |
+
preg_match('/rv:[0-9].[0-9][a-b]?/i',$this->_agent,$aversion);
|
871 |
+
$this->setVersion(str_replace('rv:','',$aversion[0]));
|
872 |
+
$this->setBrowser($this->BROWSER_MOZILLA);
|
873 |
+
return true;
|
874 |
+
}
|
875 |
+
else if( stripos($this->_agent,'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i',$this->_agent) && stripos($this->_agent,'netscape') === false ) {
|
876 |
+
$aversion = explode('',stristr($this->_agent,'rv:'));
|
877 |
+
$this->setVersion(str_replace('rv:','',$aversion[0]));
|
878 |
+
$this->setBrowser($this->BROWSER_MOZILLA);
|
879 |
+
return true;
|
880 |
+
}
|
881 |
+
else if( stripos($this->_agent,'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i',$this->_agent,$matches) && stripos($this->_agent,'netscape') === false ) {
|
882 |
+
$this->setVersion($matches[1]);
|
883 |
+
$this->setBrowser($this->BROWSER_MOZILLA);
|
884 |
+
return true;
|
885 |
+
}
|
886 |
+
return false;
|
887 |
+
}
|
888 |
+
|
889 |
+
/**
|
890 |
+
* Determine if the browser is Lynx or not (last updated 1.7)
|
891 |
+
* @return boolean True if the browser is Lynx otherwise false
|
892 |
+
*/
|
893 |
+
function checkBrowserLynx() {
|
894 |
+
if( stripos($this->_agent,'lynx') !== false ) {
|
895 |
+
$aresult = explode('/',stristr($this->_agent,'Lynx'));
|
896 |
+
$aversion = explode(' ',(isset($aresult[1])?$aresult[1]:""));
|
897 |
+
$this->setVersion($aversion[0]);
|
898 |
+
$this->setBrowser($this->BROWSER_LYNX);
|
899 |
+
return true;
|
900 |
+
}
|
901 |
+
return false;
|
902 |
+
}
|
903 |
+
|
904 |
+
/**
|
905 |
+
* Determine if the browser is Amaya or not (last updated 1.7)
|
906 |
+
* @return boolean True if the browser is Amaya otherwise false
|
907 |
+
*/
|
908 |
+
function checkBrowserAmaya() {
|
909 |
+
if( stripos($this->_agent,'amaya') !== false ) {
|
910 |
+
$aresult = explode('/',stristr($this->_agent,'Amaya'));
|
911 |
+
$aversion = explode(' ',$aresult[1]);
|
912 |
+
$this->setVersion($aversion[0]);
|
913 |
+
$this->setBrowser($this->BROWSER_AMAYA);
|
914 |
+
return true;
|
915 |
+
}
|
916 |
+
return false;
|
917 |
+
}
|
918 |
+
|
919 |
+
/**
|
920 |
+
* Determine if the browser is Safari or not (last updated 1.7)
|
921 |
+
* @return boolean True if the browser is Safari otherwise false
|
922 |
+
*/
|
923 |
+
function checkBrowserSafari() {
|
924 |
+
if( stripos($this->_agent,'Safari') !== false && stripos($this->_agent,'iPhone') === false && stripos($this->_agent,'iPod') === false ) {
|
925 |
+
$aresult = explode('/',stristr($this->_agent,'Version'));
|
926 |
+
if( isset($aresult[1]) ) {
|
927 |
+
$aversion = explode(' ',$aresult[1]);
|
928 |
+
$this->setVersion($aversion[0]);
|
929 |
+
}
|
930 |
+
else {
|
931 |
+
$this->setVersion($this->VERSION_UNKNOWN);
|
932 |
+
}
|
933 |
+
$this->setBrowser($this->BROWSER_SAFARI);
|
934 |
+
return true;
|
935 |
+
}
|
936 |
+
return false;
|
937 |
+
}
|
938 |
+
|
939 |
+
/**
|
940 |
+
* Determine if the browser is iPhone or not (last updated 1.7)
|
941 |
+
* @return boolean True if the browser is iPhone otherwise false
|
942 |
+
*/
|
943 |
+
function checkBrowseriPhone() {
|
944 |
+
if( stripos($this->_agent,'iPhone') !== false ) {
|
945 |
+
$aresult = explode('/',stristr($this->_agent,'Version'));
|
946 |
+
if( isset($aresult[1]) ) {
|
947 |
+
$aversion = explode(' ',$aresult[1]);
|
948 |
+
$this->setVersion($aversion[0]);
|
949 |
+
}
|
950 |
+
else {
|
951 |
+
$this->setVersion($this->VERSION_UNKNOWN);
|
952 |
+
}
|
953 |
+
$this->setMobile(true);
|
954 |
+
$this->setBrowser($this->BROWSER_IPHONE);
|
955 |
+
return true;
|
956 |
+
}
|
957 |
+
return false;
|
958 |
+
}
|
959 |
+
|
960 |
+
/**
|
961 |
+
* Determine if the browser is iPod or not (last updated 1.7)
|
962 |
+
* @return boolean True if the browser is iPod otherwise false
|
963 |
+
*/
|
964 |
+
function checkBrowseriPad() {
|
965 |
+
if( stripos($this->_agent,'iPad') !== false ) {
|
966 |
+
$aresult = explode('/',stristr($this->_agent,'Version'));
|
967 |
+
if( isset($aresult[1]) ) {
|
968 |
+
$aversion = explode(' ',$aresult[1]);
|
969 |
+
$this->setVersion($aversion[0]);
|
970 |
+
}
|
971 |
+
else {
|
972 |
+
$this->setVersion($this->VERSION_UNKNOWN);
|
973 |
+
}
|
974 |
+
$this->setMobile(true);
|
975 |
+
$this->setBrowser($this->BROWSER_IPAD);
|
976 |
+
return true;
|
977 |
+
}
|
978 |
+
return false;
|
979 |
+
}
|
980 |
+
|
981 |
+
/**
|
982 |
+
* Determine if the browser is iPod or not (last updated 1.7)
|
983 |
+
* @return boolean True if the browser is iPod otherwise false
|
984 |
+
*/
|
985 |
+
function checkBrowseriPod() {
|
986 |
+
if( stripos($this->_agent,'iPod') !== false ) {
|
987 |
+
$aresult = explode('/',stristr($this->_agent,'Version'));
|
988 |
+
if( isset($aresult[1]) ) {
|
989 |
+
$aversion = explode(' ',$aresult[1]);
|
990 |
+
$this->setVersion($aversion[0]);
|
991 |
+
}
|
992 |
+
else {
|
993 |
+
$this->setVersion($this->VERSION_UNKNOWN);
|
994 |
+
}
|
995 |
+
$this->setMobile(true);
|
996 |
+
$this->setBrowser($this->BROWSER_IPOD);
|
997 |
+
return true;
|
998 |
+
}
|
999 |
+
return false;
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
/**
|
1003 |
+
* Determine if the browser is Android or not (last updated 1.7)
|
1004 |
+
* @return boolean True if the browser is Android otherwise false
|
1005 |
+
*/
|
1006 |
+
function checkBrowserAndroid() {
|
1007 |
+
if( stripos($this->_agent,'Android') !== false ) {
|
1008 |
+
$aresult = explode(' ',stristr($this->_agent,'Android'));
|
1009 |
+
if( isset($aresult[1]) ) {
|
1010 |
+
$aversion = explode(' ',$aresult[1]);
|
1011 |
+
$this->setVersion($aversion[0]);
|
1012 |
+
}
|
1013 |
+
else {
|
1014 |
+
$this->setVersion($this->VERSION_UNKNOWN);
|
1015 |
+
}
|
1016 |
+
$this->setMobile(true);
|
1017 |
+
$this->setBrowser($this->BROWSER_ANDROID);
|
1018 |
+
return true;
|
1019 |
+
}
|
1020 |
+
return false;
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
/**
|
1024 |
+
* Determine the user's platform (last updated 1.7)
|
1025 |
+
*/
|
1026 |
+
function checkPlatform() {
|
1027 |
+
if( stripos($this->_agent, 'windows') !== false ) {
|
1028 |
+
$this->_platform = $this->PLATFORM_WINDOWS;
|
1029 |
+
}
|
1030 |
+
else if( stripos($this->_agent, 'iPad') !== false ) {
|
1031 |
+
$this->_platform = $this->PLATFORM_IPAD;
|
1032 |
+
}
|
1033 |
+
else if( stripos($this->_agent, 'iPod') !== false ) {
|
1034 |
+
$this->_platform = $this->PLATFORM_IPOD;
|
1035 |
+
}
|
1036 |
+
else if( stripos($this->_agent, 'iPhone') !== false ) {
|
1037 |
+
$this->_platform = $this->PLATFORM_IPHONE;
|
1038 |
+
}
|
1039 |
+
elseif( stripos($this->_agent, 'mac') !== false ) {
|
1040 |
+
$this->_platform = $this->PLATFORM_APPLE;
|
1041 |
+
}
|
1042 |
+
elseif( stripos($this->_agent, 'android') !== false ) {
|
1043 |
+
$this->_platform = $this->PLATFORM_ANDROID;
|
1044 |
+
}
|
1045 |
+
elseif( stripos($this->_agent, 'linux') !== false ) {
|
1046 |
+
$this->_platform = $this->PLATFORM_LINUX;
|
1047 |
+
}
|
1048 |
+
else if( stripos($this->_agent, 'Nokia') !== false ) {
|
1049 |
+
$this->_platform = $this->PLATFORM_NOKIA;
|
1050 |
+
}
|
1051 |
+
else if( stripos($this->_agent, 'BlackBerry') !== false ) {
|
1052 |
+
$this->_platform = $this->PLATFORM_BLACKBERRY;
|
1053 |
+
}
|
1054 |
+
elseif( stripos($this->_agent,'FreeBSD') !== false ) {
|
1055 |
+
$this->_platform = $this->PLATFORM_FREEBSD;
|
1056 |
+
}
|
1057 |
+
elseif( stripos($this->_agent,'OpenBSD') !== false ) {
|
1058 |
+
$this->_platform = $this->PLATFORM_OPENBSD;
|
1059 |
+
}
|
1060 |
+
elseif( stripos($this->_agent,'NetBSD') !== false ) {
|
1061 |
+
$this->_platform = $this->PLATFORM_NETBSD;
|
1062 |
+
}
|
1063 |
+
elseif( stripos($this->_agent, 'OpenSolaris') !== false ) {
|
1064 |
+
$this->_platform = $this->PLATFORM_OPENSOLARIS;
|
1065 |
+
}
|
1066 |
+
elseif( stripos($this->_agent, 'SunOS') !== false ) {
|
1067 |
+
$this->_platform = $this->PLATFORM_SUNOS;
|
1068 |
+
}
|
1069 |
+
elseif( stripos($this->_agent, 'OS\/2') !== false ) {
|
1070 |
+
$this->_platform = $this->PLATFORM_OS2;
|
1071 |
+
}
|
1072 |
+
elseif( stripos($this->_agent, 'BeOS') !== false ) {
|
1073 |
+
$this->_platform = $this->PLATFORM_BEOS;
|
1074 |
+
}
|
1075 |
+
elseif( stripos($this->_agent, 'win') !== false ) {
|
1076 |
+
$this->_platform = $this->PLATFORM_WINDOWS;
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
}
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
?>
|
includes/scripts.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Scripts
|
4 |
+
*
|
5 |
+
* @package WPRSSAggregator
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
add_action( 'admin_enqueue_scripts', 'wprss_admin_scripts_styles' );
|
10 |
+
/**
|
11 |
+
* Insert required scripts, styles and filters on the admin side
|
12 |
+
*
|
13 |
+
* @since 2.0
|
14 |
+
*/
|
15 |
+
function wprss_admin_scripts_styles() {
|
16 |
+
|
17 |
+
// Only load scripts if we are on this plugin's options or settings pages (admin)
|
18 |
+
if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'wprss-aggregator' || $_GET['page'] == 'wprss-aggregator-settings'
|
19 |
+
|| $_GET['page'] == 'wprss-import-export-settings' || $_GET['page'] == 'wprss-debugging' ) ) {
|
20 |
+
wp_enqueue_style( 'styles', WPRSS_CSS . 'admin-styles.css' );
|
21 |
+
}
|
22 |
+
|
23 |
+
// Only load scripts if we are on wprss_feed add post or edit post screens
|
24 |
+
$screen = get_current_screen();
|
25 |
+
|
26 |
+
if ( ( 'post' === $screen->base || 'edit' === $screen->base ) && ( 'wprss_feed' === $screen->post_type
|
27 |
+
|| 'wprss_feed_item' === $screen->post_type ) ) {
|
28 |
+
wp_enqueue_style( 'admin-styles', WPRSS_CSS . 'admin-styles.css' );
|
29 |
+
wp_enqueue_script( 'admin-custom', WPRSS_JS .'admin-custom.js', array('jquery') );
|
30 |
+
if ( 'post' === $screen->base && 'wprss_feed' === $screen->post_type ) {
|
31 |
+
// Change text on post screen from 'Enter title here' to 'Enter feed name here'
|
32 |
+
add_filter( 'enter_title_here', 'wprss_change_title_text' );
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
do_action( 'wprss_admin_scripts_styles' );
|
37 |
+
} // end wprss_admin_scripts_styles
|
38 |
+
|
39 |
+
|
40 |
+
add_action( 'wp_enqueue_scripts', 'wprss_load_scripts' );
|
41 |
+
/**
|
42 |
+
* Enqueues the required scripts.
|
43 |
+
*
|
44 |
+
* @since 3.0
|
45 |
+
*/
|
46 |
+
function wprss_load_scripts() {
|
47 |
+
wp_enqueue_script( 'jquery.colorbox-min', WPRSS_JS . 'jquery.colorbox-min.js', array( 'jquery' ) );
|
48 |
+
wp_enqueue_script( 'custom', WPRSS_JS . 'custom.js', array( 'jquery', 'jquery.colorbox-min' ) );
|
49 |
+
do_action( 'wprss_register_scripts' );
|
50 |
+
} // end wprss_head_scripts_styles
|
51 |
+
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns the path to the WPRSS templates directory
|
55 |
+
*
|
56 |
+
* @since 3.0
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
function wprss_get_templates_dir() {
|
60 |
+
return WPRSS_DIR . 'templates';
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns the URL to the WPRSS templates directory
|
66 |
+
*
|
67 |
+
* @since 3.0
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
function wprss_get_templates_uri() {
|
71 |
+
return WPRSS_URI . 'templates';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
add_action( 'wp_enqueue_scripts', 'wprss_register_styles' );
|
76 |
+
/**
|
77 |
+
* Register front end CSS styling files
|
78 |
+
* Inspiration from Easy Digital Downloads
|
79 |
+
*
|
80 |
+
* @since 3.0
|
81 |
+
*/
|
82 |
+
function wprss_register_styles() {
|
83 |
+
|
84 |
+
$general_settings = get_option( 'wprss_settings_general' );
|
85 |
+
|
86 |
+
if( $general_settings['styles_disable'] == 1 )
|
87 |
+
return;
|
88 |
+
wp_enqueue_style( 'colorbox', WPRSS_CSS . 'colorbox.css', array(), '1.4.1' );
|
89 |
+
wp_enqueue_style( 'styles', WPRSS_CSS . 'styles.css', array(), '' );
|
90 |
+
|
91 |
+
/* If using DISABLE CSS option:
|
92 |
+
global $edd_options;
|
93 |
+
|
94 |
+
if( isset( $edd_options['disable_styles'] ) )
|
95 |
+
return;
|
96 |
+
|
97 |
+
*/
|
98 |
+
|
99 |
+
/* $file = 'wprss.css';
|
100 |
+
|
101 |
+
// Check child theme first
|
102 |
+
if ( file_exists( trailingslashit( get_stylesheet_directory() ) . 'wprss_templates/' . $file ) ) {
|
103 |
+
$url = trailingslashit( get_stylesheet_directory_uri() ) . 'wprss_templates/' . $file;
|
104 |
+
|
105 |
+
// Check parent theme next
|
106 |
+
} elseif ( file_exists( trailingslashit( get_template_directory() ) . 'wprss_templates/' . $file ) ) {
|
107 |
+
$url = trailingslashit( get_template_directory_uri() ) . 'wprss_templates/' . $file;
|
108 |
+
|
109 |
+
// Check theme compatibility last
|
110 |
+
} elseif ( file_exists( trailingslashit( wprss_get_templates_dir() ) . $file ) ) {
|
111 |
+
$url = trailingslashit( wprss_get_templates_uri() ) . $file;
|
112 |
+
}
|
113 |
+
|
114 |
+
wp_enqueue_style( 'wprss-styles', $url, WPRSS_VERSION );*/
|
115 |
+
}
|
includes/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');
|
includes/system-info.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @todo to implement within the context of WP RSS Aggregator
|
5 |
+
* System Info
|
6 |
+
*
|
7 |
+
* These are functions are used for exporting data from Easy Digital Downloads.
|
8 |
+
*
|
9 |
+
* @package Easy Digital Downloads
|
10 |
+
* @subpackage System Info
|
11 |
+
* @copyright Copyright (c) 2013, Pippin Williamson
|
12 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
+
*/
|
14 |
+
|
15 |
+
// Exit if accessed directly
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* System info
|
21 |
+
*
|
22 |
+
* Shows the system info panel which contains version data and debug info
|
23 |
+
*
|
24 |
+
* @since 1.4
|
25 |
+
* @usedby edd_settings()
|
26 |
+
* @author Chris Christoff
|
27 |
+
*/
|
28 |
+
|
29 |
+
function edd_system_info() {
|
30 |
+
global $wpdb, $edd_options;
|
31 |
+
|
32 |
+
if ( ! class_exists( 'Browser' ) )
|
33 |
+
require_once EDD_PLUGIN_DIR . 'includes/libraries/browser.php';
|
34 |
+
|
35 |
+
$browser = new Browser();
|
36 |
+
|
37 |
+
?>
|
38 |
+
<div class="wrap">
|
39 |
+
<h2><?php _e( 'System Information', 'edd' ) ?></h2><br/>
|
40 |
+
<form action="edit.php?post_type=download&page=edd-system-info" method="post">
|
41 |
+
<textarea readonly="readonly" id="system-info-textarea" name="edd-sysinfo" title="<?php _e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd' ); ?>">
|
42 |
+
### Begin System Info ###
|
43 |
+
|
44 |
+
## Please include this information when posting support requests ##
|
45 |
+
|
46 |
+
Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
|
47 |
+
|
48 |
+
SITE_URL: <?php echo site_url() . "\n"; ?>
|
49 |
+
HOME_URL: <?php echo home_url() . "\n"; ?>
|
50 |
+
|
51 |
+
EDD Version: <?php echo EDD_VERSION . "\n"; ?>
|
52 |
+
WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
|
53 |
+
|
54 |
+
Ajax Enabled: <?php echo edd_is_ajax_enabled() ? "Yes\n" : "No\n"; ?>
|
55 |
+
jQuery Validation: <?php echo isset( $edd_options['jquery_validation'] ) ? "Yes\n" : "No\n"; ?>
|
56 |
+
Guest Checkout Enabled: <?php echo edd_no_guest_checkout() ? "No\n" : "Yes\n"; ?>
|
57 |
+
|
58 |
+
Checkout: <?php echo ! empty( $edd_options['purchase_page'] ) ? "Valid\n" : "Invalid\n"; ?>
|
59 |
+
|
60 |
+
Taxes Enabled: <?php echo edd_use_taxes() ? "Yes\n" : "No\n"; ?>
|
61 |
+
Local Taxes Only: <?php echo edd_local_taxes_only() ? "Yes\n" : "No\n"; ?>
|
62 |
+
Taxes After Discounts: <?php echo edd_taxes_after_discounts() ? "Yes\n" : "No\n"; ?>
|
63 |
+
|
64 |
+
<?php echo $browser ; ?>
|
65 |
+
|
66 |
+
PHP Version: <?php echo PHP_VERSION . "\n"; ?>
|
67 |
+
MySQL Version: <?php echo mysql_get_server_info() . "\n"; ?>
|
68 |
+
Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
|
69 |
+
|
70 |
+
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
|
71 |
+
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
|
72 |
+
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
|
73 |
+
|
74 |
+
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
|
75 |
+
|
76 |
+
WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo " Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?>
|
77 |
+
|
78 |
+
Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?>
|
79 |
+
Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?>
|
80 |
+
Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?>
|
81 |
+
|
82 |
+
Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
|
83 |
+
Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
|
84 |
+
Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
|
85 |
+
Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
|
86 |
+
Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
87 |
+
Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
88 |
+
|
89 |
+
UPLOAD_MAX_FILESIZE: <?php if ( function_exists( 'phpversion' ) ) echo ( edd_let_to_num( ini_get( 'upload_max_filesize' ) )/( 1024*1024 ) )."MB"; ?><?php echo "\n"; ?>
|
90 |
+
POST_MAX_SIZE: <?php if ( function_exists( 'phpversion' ) ) echo ( edd_let_to_num( ini_get( 'post_max_size' ) )/( 1024*1024 ) )."MB"; ?><?php echo "\n"; ?>
|
91 |
+
WordPress Memory Limit: <?php echo ( edd_let_to_num( WP_MEMORY_LIMIT )/( 1024*1024 ) )."MB"; ?><?php echo "\n"; ?>
|
92 |
+
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
|
93 |
+
FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? __( 'Your server supports fsockopen.', 'edd' ) : __( 'Your server does not support fsockopen.', 'edd' ); ?><?php echo "\n"; ?>
|
94 |
+
|
95 |
+
ACTIVE PLUGINS:
|
96 |
+
|
97 |
+
<?php
|
98 |
+
$plugins = get_plugins();
|
99 |
+
$active_plugins = get_option( 'active_plugins', array() );
|
100 |
+
|
101 |
+
foreach ( $plugins as $plugin_path => $plugin ):
|
102 |
+
// If the plugin isn't active, don't show it.
|
103 |
+
if ( ! in_array( $plugin_path, $active_plugins ) )
|
104 |
+
continue;
|
105 |
+
|
106 |
+
echo $plugin['Name']; ?>: <?php echo $plugin['Version'] ."\n";
|
107 |
+
|
108 |
+
endforeach; ?>
|
109 |
+
|
110 |
+
CURRENT THEME:
|
111 |
+
|
112 |
+
<?php
|
113 |
+
if ( get_bloginfo( 'version' ) < '3.4' ) {
|
114 |
+
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
|
115 |
+
echo $theme_data['Name'] . ': ' . $theme_data['Version'];
|
116 |
+
} else {
|
117 |
+
$theme_data = wp_get_theme();
|
118 |
+
echo $theme_data->Name . ': ' . $theme_data->Version;
|
119 |
+
}
|
120 |
+
?>
|
121 |
+
|
122 |
+
|
123 |
+
### End System Info ###
|
124 |
+
</textarea>
|
125 |
+
<p class="submit">
|
126 |
+
<input type="hidden" name="edd-action" value="download_sysinfo" />
|
127 |
+
<?php submit_button( __( 'Download System Info File', 'edd' ), 'primary', 'edd-download-sysinfo', false ); ?>
|
128 |
+
</p>
|
129 |
+
</form>
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
<?php
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Generates the System Info Download file
|
138 |
+
*
|
139 |
+
* @since 1.4
|
140 |
+
* @return void
|
141 |
+
*/
|
142 |
+
|
143 |
+
function edd_generate_sysinfo_download() {
|
144 |
+
nocache_headers();
|
145 |
+
|
146 |
+
header( "Content-type: text/plain" );
|
147 |
+
header( 'Content-Disposition: attachment; filename="edd-system-info.txt"' );
|
148 |
+
|
149 |
+
echo wp_strip_all_tags( $_POST['edd-sysinfo'] );
|
150 |
+
exit;
|
151 |
+
}
|
152 |
+
add_action( 'edd_download_sysinfo', 'edd_generate_sysinfo_download' );
|
includes/update.php
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains all the functions related to updating the plugin from
|
4 |
+
* one version to another
|
5 |
+
*
|
6 |
+
* @package WP RSS Aggregator
|
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 3.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_insert_all_feed_items();
|
39 |
+
}
|
40 |
+
|
41 |
+
// For version 1.1 to 3.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_insert_all_feed_items();
|
48 |
+
}
|
49 |
+
|
50 |
+
// For version 2+ to 3.0
|
51 |
+
// We check if wprss_settings option exists, as this only exists prior to version 3.0
|
52 |
+
// Settings field changed, and another added
|
53 |
+
elseif ( intval( $old_db_version ) < intval( WPRSS_DB_VERSION ) && ( FALSE != get_option( 'wprss_settings' ) ) ) {
|
54 |
+
wprss_upgrade_30();
|
55 |
+
wprss_update();
|
56 |
+
wprss_fetch_insert_all_feed_items();
|
57 |
+
}
|
58 |
+
|
59 |
+
// For any future versions where DB changes
|
60 |
+
// If the old version is less than the new version, run the update.
|
61 |
+
elseif ( intval( $old_db_version ) < intval( WPRSS_DB_VERSION ) ) {
|
62 |
+
wprss_update();
|
63 |
+
wprss_fetch_insert_all_feed_items();
|
64 |
+
}
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Adds the plugin settings on install.
|
71 |
+
*
|
72 |
+
* @since 2.0
|
73 |
+
*/
|
74 |
+
function wprss_install() {
|
75 |
+
|
76 |
+
// Add the database version setting.
|
77 |
+
add_option( 'wprss_db_version', WPRSS_DB_VERSION );
|
78 |
+
|
79 |
+
// Add the default plugin settings.
|
80 |
+
add_option( 'wprss_settings_general', wprss_get_default_settings_general() );
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Update settings of plugin to reflect new version
|
86 |
+
*
|
87 |
+
* @since 2.0
|
88 |
+
*/
|
89 |
+
function wprss_update() {
|
90 |
+
|
91 |
+
// Update the database version setting.
|
92 |
+
update_option( 'wprss_db_version', WPRSS_DB_VERSION );
|
93 |
+
// Initialize settings
|
94 |
+
wprss_settings_initialize();
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Initialize settings to default ones if they are not yet set
|
100 |
+
*
|
101 |
+
* @since 3.0
|
102 |
+
*/
|
103 |
+
function wprss_settings_initialize() {
|
104 |
+
// Get the settings from the new field in the database
|
105 |
+
$settings = get_option( 'wprss_settings_general' );
|
106 |
+
|
107 |
+
// Get the default plugin settings.
|
108 |
+
$default_settings = wprss_get_default_settings_general();
|
109 |
+
|
110 |
+
// Loop through each of the default plugin settings.
|
111 |
+
foreach ( $default_settings as $setting_key => $setting_value ) {
|
112 |
+
|
113 |
+
// If the setting didn't previously exist, add the default value to the $settings array.
|
114 |
+
if ( ! isset( $settings[ $setting_key ] ) )
|
115 |
+
$settings[ $setting_key ] = $setting_value;
|
116 |
+
}
|
117 |
+
|
118 |
+
// Update the plugin settings.
|
119 |
+
update_option( 'wprss_settings_general', $settings );
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Takes care of cron and DB changes between versions 2+ and 3
|
125 |
+
*
|
126 |
+
* @since 3.0
|
127 |
+
*/
|
128 |
+
function wprss_upgrade_30() {
|
129 |
+
wp_clear_scheduled_hook( 'wprss_fetch_feeds_hook' );
|
130 |
+
|
131 |
+
// Get the settings from the database.
|
132 |
+
$settings = get_option( 'wprss_settings' );
|
133 |
+
|
134 |
+
// Put them into our new field
|
135 |
+
update_option( 'wprss_settings_general', $settings );
|
136 |
+
|
137 |
+
// Remove old options field, we are now using wprss_settings_general
|
138 |
+
delete_option( 'wprss_settings' );
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Migrates the feed sources from the wprss_options field to the wp_posts table (for older versions)
|
144 |
+
*
|
145 |
+
* @since 2.0
|
146 |
+
*/
|
147 |
+
function wprss_migrate() {
|
148 |
+
|
149 |
+
// Get the plugin options
|
150 |
+
$options = get_option( 'wprss_options' );
|
151 |
+
|
152 |
+
$feed_sources = array_chunk( $options, 2 );
|
153 |
+
|
154 |
+
foreach ( $feed_sources as $feed_source ) {
|
155 |
+
$feed_title = $feed_source[0];
|
156 |
+
$feed_url = $feed_source[1];
|
157 |
+
|
158 |
+
// Create post object
|
159 |
+
$feed_item = array(
|
160 |
+
'post_title' => $feed_title,
|
161 |
+
'post_content' => '',
|
162 |
+
'post_status' => 'publish',
|
163 |
+
'post_type' => 'wprss_feed'
|
164 |
+
);
|
165 |
+
|
166 |
+
$inserted_ID = wp_insert_post( $feed_item, $wp_error );
|
167 |
+
// insert post meta
|
168 |
+
update_post_meta( $inserted_ID, 'wprss_url', $feed_url );
|
169 |
+
}
|
170 |
+
// delete unneeded option
|
171 |
+
delete_option( 'wprss_options' );
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Returns an array of the default plugin settings. These are only used on initial setup.
|
177 |
+
*
|
178 |
+
* @since 2.0
|
179 |
+
*/
|
180 |
+
function wprss_get_default_settings_general() {
|
181 |
+
|
182 |
+
// Set up the default plugin settings
|
183 |
+
$settings = apply_filters(
|
184 |
+
'wprss_default_settings_general',
|
185 |
+
array(
|
186 |
+
// from version 1.1
|
187 |
+
'open_dd' => __( 'New window' ),
|
188 |
+
'follow_dd' => __( 'No follow' ),
|
189 |
+
|
190 |
+
// from version 2.0
|
191 |
+
'feed_limit' => 15,
|
192 |
+
|
193 |
+
// from version 3.0
|
194 |
+
'date_format' => 'Y-m-d',
|
195 |
+
'limit_feed_items_db' => 200,
|
196 |
+
'cron_interval' => 'hourly',
|
197 |
+
'styles_disable' => 0,
|
198 |
+
'title_link' => 1,
|
199 |
+
'source_enable' => 1,
|
200 |
+
'text_preceding_source' => 'Source:',
|
201 |
+
'date_enable' => 1,
|
202 |
+
'text_preceding_date' => 'Published on',
|
203 |
+
)
|
204 |
+
);
|
205 |
+
|
206 |
+
// Return the default settings
|
207 |
+
return $settings;
|
208 |
+
}
|
js/admin-custom.js
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
});
|
23 |
+
|
24 |
+
|
25 |
+
/* JS for admin notice - Leave a review */
|
26 |
+
|
27 |
+
(function ($) {
|
28 |
+
"use strict";
|
29 |
+
$(function () {
|
30 |
+
|
31 |
+
// Check to see if the Ajax Notification is visible
|
32 |
+
if ($('#dismiss-ajax-notification').length > 0) {
|
33 |
+
|
34 |
+
// If so, we need to setup an event handler to trigger it's dismissal
|
35 |
+
$('#dismiss-ajax-notification').click(function (evt) {
|
36 |
+
|
37 |
+
evt.preventDefault();
|
38 |
+
|
39 |
+
// Initiate a request to the server-side
|
40 |
+
$.post(ajaxurl, {
|
41 |
+
|
42 |
+
// The name of the function to fire on the server
|
43 |
+
action: 'wprss_hide_admin_notification',
|
44 |
+
|
45 |
+
// The nonce value to send for the security check
|
46 |
+
nonce: $.trim($('#ajax-notification-nonce').text())
|
47 |
+
|
48 |
+
}, function (response) {
|
49 |
+
|
50 |
+
// If the response was successful (that is, 1 was returned), hide the notification;
|
51 |
+
// Otherwise, we'll change the class name of the notification
|
52 |
+
if ('1' === response) {
|
53 |
+
$('#ajax-notification').fadeOut('slow');
|
54 |
+
} else {
|
55 |
+
|
56 |
+
$('#ajax-notification')
|
57 |
+
.removeClass('updated')
|
58 |
+
.addClass('error');
|
59 |
+
|
60 |
+
} // end if
|
61 |
+
|
62 |
+
});
|
63 |
+
|
64 |
+
});
|
65 |
+
|
66 |
+
} // end if
|
67 |
+
|
68 |
+
});
|
69 |
+
}(jQuery));
|
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,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
jQuery ColorBox v1.4.1 - 2013-02-14
|
3 |
+
(c) 2013 Jack Moore - jacklmoore.com/colorbox
|
4 |
+
license: http://www.opensource.org/licenses/mit-license.php
|
5 |
+
*/
|
6 |
+
(function(e,t,i){function o(i,o,n){var r=t.createElement(i);return o&&(r.id=Y+o),n&&(r.style.cssText=n),e(r)}function n(e){var t=T.length,i=(A+e)%t;return 0>i?t+i:i}function r(e,t){return Math.round((/%/.test(e)?("x"===t?k.width():k.height())/100:1)*parseInt(e,10))}function h(e){return K.photo||K.photoRegex.test(e)}function l(e){return K.retinaUrl&&i.devicePixelRatio>1?e.replace(K.photoRegex,K.retinaSuffix):e}function s(t){e.contains(w[0],t.target)||w[0]===t.target||(t.stopPropagation(),w.focus())}function a(){var t,i=e.data(N,V);null==i?(K=e.extend({},J),console&&console.log&&console.log("Error: cboxElement missing settings object")):K=e.extend({},i);for(t in K)e.isFunction(K[t])&&"on"!==t.slice(0,2)&&(K[t]=K[t].call(N));K.rel=K.rel||N.rel||e(N).data("rel")||"nofollow",K.href=K.href||e(N).attr("href"),K.title=K.title||N.title,"string"==typeof K.href&&(K.href=e.trim(K.href))}function d(i,o){e(t).trigger(i),at.trigger(i),e.isFunction(o)&&o.call(N)}function c(){var e,t,i,o,n,r=Y+"Slideshow_",h="click."+Y;K.slideshow&&T[1]?(t=function(){clearTimeout(e)},i=function(){(K.loop||T[A+1])&&(e=setTimeout(G.next,K.slideshowSpeed))},o=function(){M.html(K.slideshowStop).unbind(h).one(h,n),at.bind(it,i).bind(tt,t).bind(ot,n),w.removeClass(r+"off").addClass(r+"on")},n=function(){t(),at.unbind(it,i).unbind(tt,t).unbind(ot,n),M.html(K.slideshowStart).unbind(h).one(h,function(){G.next(),o()}),w.removeClass(r+"on").addClass(r+"off")},K.slideshowAuto?o():n()):w.removeClass(r+"off "+r+"on")}function u(i){U||(N=i,a(),T=e(N),A=0,"nofollow"!==K.rel&&(T=e("."+Z).filter(function(){var t,i=e.data(this,V);return i&&(t=e(this).data("rel")||i.rel||this.rel),t===K.rel}),A=T.index(N),-1===A&&(T=T.add(N),A=T.length-1)),m.css({opacity:parseFloat(K.opacity),cursor:K.overlayClose?"pointer":"auto",visibility:"visible"}).show(),j||(j=q=!0,w.css({visibility:"hidden",display:"block"}),E=o(dt,"LoadedContent","width:0; height:0; overflow:hidden").appendTo(v),_=x.height()+C.height()+v.outerHeight(!0)-v.height(),z=y.width()+b.width()+v.outerWidth(!0)-v.width(),D=E.outerHeight(!0),B=E.outerWidth(!0),K.w=r(K.initialWidth,"x"),K.h=r(K.initialHeight,"y"),G.position(),lt&&k.bind("resize."+st+" scroll."+st,function(){m.css({width:k.width(),height:k.height(),top:k.scrollTop(),left:k.scrollLeft()})}).trigger("resize."+st),c(),d(et,K.onOpen),P.add(W).hide(),R.html(K.close).show(),w.focus(),t.addEventListener&&(t.addEventListener("focus",s,!0),at.one(nt,function(){t.removeEventListener("focus",s,!0)})),K.returnFocus&&at.one(nt,function(){e(N).focus()})),G.load(!0))}function f(){!w&&t.body&&(X=!1,k=e(i),w=o(dt).attr({id:V,"class":ht?Y+(lt?"IE6":"IE"):"",role:"dialog",tabindex:"-1"}).hide(),m=o(dt,"Overlay",lt?"position:absolute":"").hide(),L=o(dt,"LoadingOverlay").add(o(dt,"LoadingGraphic")),g=o(dt,"Wrapper"),v=o(dt,"Content").append(W=o(dt,"Title"),H=o(dt,"Current"),F=o("button","Previous"),S=o("button","Next"),M=o("button","Slideshow"),L,R=o("button","Close")),g.append(o(dt).append(o(dt,"TopLeft"),x=o(dt,"TopCenter"),o(dt,"TopRight")),o(dt,!1,"clear:left").append(y=o(dt,"MiddleLeft"),v,b=o(dt,"MiddleRight")),o(dt,!1,"clear:left").append(o(dt,"BottomLeft"),C=o(dt,"BottomCenter"),o(dt,"BottomRight"))).find("div div").css({"float":"left"}),I=o(dt,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),P=S.add(F).add(H).add(M),e(t.body).append(m,w.append(g,I)))}function p(){function i(e){e.which>1||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),u(this))}return w?(X||(X=!0,S.click(function(){G.next()}),F.click(function(){G.prev()}),R.click(function(){G.close()}),m.click(function(){K.overlayClose&&G.close()}),e(t).bind("keydown."+Y,function(e){var t=e.keyCode;j&&K.escKey&&27===t&&(e.preventDefault(),G.close()),j&&K.arrowKey&&T[1]&&!e.altKey&&(37===t?(e.preventDefault(),F.click()):39===t&&(e.preventDefault(),S.click()))}),e.isFunction(e.fn.on)?e(t).on("click."+Y,"."+Z,i):e("."+Z).live("click."+Y,i)),!0):!1}var m,w,g,v,x,y,b,C,T,k,E,I,L,W,H,M,S,F,R,P,K,_,z,D,B,N,A,O,j,q,U,$,G,Q,X,J={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,className:!1,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",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",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i,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:void 0},V="colorbox",Y="cbox",Z=Y+"Element",et=Y+"_open",tt=Y+"_load",it=Y+"_complete",ot=Y+"_cleanup",nt=Y+"_closed",rt=Y+"_purge",ht=!e.support.leadingWhitespace,lt=ht&&!i.XMLHttpRequest,st=Y+"_IE6",at=e({}),dt="div";e.colorbox||(e(f),G=e.fn[V]=e[V]=function(t,i){var o=this;if(t=t||{},f(),p()){if(e.isFunction(o))o=e("<a/>"),t.open=!0;else if(!o[0])return o;i&&(t.onComplete=i),o.each(function(){e.data(this,V,e.extend({},e.data(this,V)||J,t))}).addClass(Z),(e.isFunction(t.open)&&t.open.call(o)||t.open)&&u(o[0])}return o},G.position=function(e,t){function i(e){x[0].style.width=C[0].style.width=v[0].style.width=parseInt(e.style.width,10)-z+"px",v[0].style.height=y[0].style.height=b[0].style.height=parseInt(e.style.height,10)-_+"px"}var o,n,h,l=0,s=0,a=w.offset();k.unbind("resize."+Y),w.css({top:-9e4,left:-9e4}),n=k.scrollTop(),h=k.scrollLeft(),K.fixed&&!lt?(a.top-=n,a.left-=h,w.css({position:"fixed"})):(l=n,s=h,w.css({position:"absolute"})),s+=K.right!==!1?Math.max(k.width()-K.w-B-z-r(K.right,"x"),0):K.left!==!1?r(K.left,"x"):Math.round(Math.max(k.width()-K.w-B-z,0)/2),l+=K.bottom!==!1?Math.max(k.height()-K.h-D-_-r(K.bottom,"y"),0):K.top!==!1?r(K.top,"y"):Math.round(Math.max(k.height()-K.h-D-_,0)/2),w.css({top:a.top,left:a.left,visibility:"visible"}),e=w.width()===K.w+B&&w.height()===K.h+D?0:e||0,g[0].style.width=g[0].style.height="9999px",o={width:K.w+B+z,height:K.h+D+_,top:l,left:s},0===e&&w.css(o),w.dequeue().animate(o,{duration:e,complete:function(){i(this),q=!1,g[0].style.width=K.w+B+z+"px",g[0].style.height=K.h+D+_+"px",K.reposition&&setTimeout(function(){k.bind("resize."+Y,G.position)},1),t&&t()},step:function(){i(this)}})},G.resize=function(e){j&&(e=e||{},e.width&&(K.w=r(e.width,"x")-B-z),e.innerWidth&&(K.w=r(e.innerWidth,"x")),E.css({width:K.w}),e.height&&(K.h=r(e.height,"y")-D-_),e.innerHeight&&(K.h=r(e.innerHeight,"y")),e.innerHeight||e.height||(E.css({height:"auto"}),K.h=E.height()),E.css({height:K.h}),G.position("none"===K.transition?0:K.speed))},G.prep=function(t){function i(){return K.w=K.w||E.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function r(){return K.h=K.h||E.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(j){var l,s="none"===K.transition?0:K.speed;E.empty().remove(),E=o(dt,"LoadedContent").append(t),E.hide().appendTo(I.show()).css({width:i(),overflow:K.scrolling?"auto":"hidden"}).css({height:r()}).prependTo(v),I.hide(),e(O).css({"float":"none"}),l=function(){function t(){ht&&w[0].style.removeAttribute("filter")}var i,r,l=T.length,a="frameBorder",c="allowTransparency";j&&(r=function(){clearTimeout($),L.hide(),d(it,K.onComplete)},ht&&O&&E.fadeIn(100),W.html(K.title).add(E).show(),l>1?("string"==typeof K.current&&H.html(K.current.replace("{current}",A+1).replace("{total}",l)).show(),S[K.loop||l-1>A?"show":"hide"]().html(K.next),F[K.loop||A?"show":"hide"]().html(K.previous),K.slideshow&&M.show(),K.preloading&&e.each([n(-1),n(1)],function(){var t,i,o=T[this],n=e.data(o,V);n&&n.href?(t=n.href,e.isFunction(t)&&(t=t.call(o))):t=e(o).attr("href"),t&&(h(t)||n.photo)&&(i=new Image,i.src=t)})):P.hide(),K.iframe?(i=o("iframe")[0],a in i&&(i[a]=0),c in i&&(i[c]="true"),K.scrolling||(i.scrolling="no"),e(i).attr({src:K.href,name:(new Date).getTime(),"class":Y+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",r).appendTo(E),at.one(rt,function(){i.src="//about:blank"}),K.fastIframe&&e(i).trigger("load")):r(),"fade"===K.transition?w.fadeTo(s,1,t):t())},"fade"===K.transition?w.fadeTo(s,0,function(){G.position(0,l)}):G.position(s,l)}},G.load=function(t){var n,s,c,u=G.prep;q=!0,O=!1,N=T[A],t||a(),Q&&w.add(m).removeClass(Q),K.className&&w.add(m).addClass(K.className),Q=K.className,d(rt),d(tt,K.onLoad),K.h=K.height?r(K.height,"y")-D-_:K.innerHeight&&r(K.innerHeight,"y"),K.w=K.width?r(K.width,"x")-B-z:K.innerWidth&&r(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=r(K.maxWidth,"x")-B-z,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=r(K.maxHeight,"y")-D-_,K.mh=K.h&&K.h<K.mh?K.h:K.mh),n=K.href,$=setTimeout(function(){L.show()},100),K.inline?(c=o(dt).hide().insertBefore(e(n)[0]),at.one(rt,function(){c.replaceWith(E.children())}),u(e(n))):K.iframe?u(" "):K.html?u(K.html):h(n)?(n=l(n),e(O=new Image).addClass(Y+"Photo").bind("error",function(){K.title=!1,u(o(dt,"Error").html(K.imgError))}).one("load",function(){var e;K.retinaImage&&i.devicePixelRatio>1&&(O.height=O.height/i.devicePixelRatio,O.width=O.width/i.devicePixelRatio),K.scalePhotos&&(s=function(){O.height-=O.height*e,O.width-=O.width*e},K.mw&&O.width>K.mw&&(e=(O.width-K.mw)/O.width,s()),K.mh&&O.height>K.mh&&(e=(O.height-K.mh)/O.height,s())),K.h&&(O.style.marginTop=Math.max(K.mh-O.height,0)/2+"px"),T[1]&&(K.loop||T[A+1])&&(O.style.cursor="pointer",O.onclick=function(){G.next()}),ht&&(O.style.msInterpolationMode="bicubic"),setTimeout(function(){u(O)},1)}),setTimeout(function(){O.src=n},1)):n&&I.load(n,K.data,function(t,i){u("error"===i?o(dt,"Error").html(K.xhrError):e(this).contents())})},G.next=function(){!q&&T[1]&&(K.loop||T[A+1])&&(A=n(1),G.load())},G.prev=function(){!q&&T[1]&&(K.loop||A)&&(A=n(-1),G.load())},G.close=function(){j&&!U&&(U=!0,j=!1,d(ot,K.onCleanup),k.unbind("."+Y+" ."+st),m.fadeTo(200,0),w.stop().fadeTo(300,0,function(){w.add(m).css({opacity:1,cursor:"auto"}).hide(),d(rt),E.empty().remove(),setTimeout(function(){U=!1,d(nt,K.onClosed)},1)}))},G.remove=function(){e([]).add(w).add(m).remove(),w=null,e("."+Z).removeData(V).removeClass(Z),e(t).unbind("click."+Y)},G.element=function(){return e(N)},G.settings=J)})(jQuery,document,window);
|
languages/default.mo
ADDED
Binary file
|
languages/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 ""
|
languages/it.mo
ADDED
Binary file
|
languages/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,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, multi feed importer, multi feed import, multi import, autoblog, autoblogging, autoblogger
|
6 |
+
Requires at least: 3.3
|
7 |
+
Tested up to: 3.5.1
|
8 |
+
Stable tag: 3.0
|
9 |
+
Imports and aggregates 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/aggregator on your WordPress site. It works in a similar fashion to RSS readers like for example Google Reader.
|
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.
|
17 |
+
You can call the function from within the theme or even use a shortcode with parameters.
|
18 |
+
|
19 |
+
Since the plugin uses Custom Post Types to store the imported feeds, you are also free to display them in any way you want, in a similar fashion as you
|
20 |
+
would with other post types such as Posts or Pages.
|
21 |
+
|
22 |
+
= Demo =
|
23 |
+
The plugin can be seen in use on the [WPMayor.com WordPress News page](http://www.wpmayor.com/wordpress-news/)
|
24 |
+
|
25 |
+
= Credit =
|
26 |
+
Created by Jean Galea from [WP Mayor](http://www.wpmayor.com)
|
27 |
+
|
28 |
+
= Translations =
|
29 |
+
Italian - Davide De Maestri
|
30 |
+
|
31 |
+
== Installation ==
|
32 |
+
|
33 |
+
1. Upload the `wp-rss-aggregator` folder to the `/wp-content/plugins/` directory
|
34 |
+
2. Activate the WP RSS Aggregator plugin through the 'Plugins' menu in WordPress
|
35 |
+
3. Configure the plugin by going to the `RSS Aggregator` menu item that appears in your dashboard menu.
|
36 |
+
3. Use the shortcode in your posts or pages: `[wp_rss_aggregator]`
|
37 |
+
|
38 |
+
The parameters accepted are:
|
39 |
+
|
40 |
+
* links_before
|
41 |
+
* links_after
|
42 |
+
* link_before
|
43 |
+
* link_after
|
44 |
+
|
45 |
+
An example of a shortcode with parameters:
|
46 |
+
`[wp_rss_aggregator link_before='<li class="feed-link">' link_after='</li>']`
|
47 |
+
It is advisable to use the 'HTML' view of the editor when inserting the shortcode with paramters.
|
48 |
+
|
49 |
+
An example of a function call from within the template files:
|
50 |
+
`
|
51 |
+
<?php
|
52 |
+
wprss_display_feed_items( $args = array(
|
53 |
+
'links_before' => '<ul>',
|
54 |
+
'links_after' => '</ul>',
|
55 |
+
'link_before' => '<li>',
|
56 |
+
'link_after' => '</li>'
|
57 |
+
));
|
58 |
+
?>
|
59 |
+
`
|
60 |
+
|
61 |
+
OR
|
62 |
+
|
63 |
+
`<?php do_shortcode('[wp-rss-aggregator]'); ?>`
|
64 |
+
|
65 |
+
You can also set whether the feed links should open in a new window, current window or even a lightbox, via the settings panel.
|
66 |
+
|
67 |
+
The settings panel also has an option to set links as nofollow for SEO purposes.
|
68 |
+
|
69 |
+
Since version 2.0 you can also specify the number of feed items shown on the frontend.
|
70 |
+
|
71 |
+
== Frequently Asked Questions ==
|
72 |
+
= How can I output the feeds in my theme? =
|
73 |
+
|
74 |
+
You can either call the function directly within the theme:
|
75 |
+
`<?php wprss_display_feed_items(); ?>`
|
76 |
+
|
77 |
+
Or use the shortcode in your posts and pages:
|
78 |
+
[wp_rss_aggregator]
|
79 |
+
|
80 |
+
== Screenshots ==
|
81 |
+
|
82 |
+
1. The output of this plugin on the frontend, as seen on www.wpmayor.com.
|
83 |
+
|
84 |
+
2. Feed sources list.
|
85 |
+
|
86 |
+
3. Adding a new feed source.
|
87 |
+
|
88 |
+
4. Imported feeds.
|
89 |
+
|
90 |
+
5. Plugin settings page.
|
91 |
+
|
92 |
+
== Changelog ==
|
93 |
+
|
94 |
+
= Version 3.0 (2013-03-16) =
|
95 |
+
* New feature: Option to select cron frequency
|
96 |
+
* New feature: Code extensibility added to be compatible with add-ons
|
97 |
+
* New feature: Option to set a limit to the number of feeds stored (previously 50, hard coded)
|
98 |
+
* New feature: Option to define the format of the date shown below each feed item
|
99 |
+
* New feature: Option to show or hide source of feed item
|
100 |
+
* New feature: Option to show or hide publish date of feed item
|
101 |
+
* New feature: Option to set text preceding publish date
|
102 |
+
* New feature: Option to set text preceding source of feed item
|
103 |
+
* New feature: Option to link title or not
|
104 |
+
* New feature: Limit of 5 items imported for each source instead of 10
|
105 |
+
* Enhanced: Performance improvement when publishing * New feeds in admin
|
106 |
+
* Enhanced: Query tuning for better performance
|
107 |
+
* Enhanced: Major code rewrite, refactoring and inclusion of hooks
|
108 |
+
* Enhanced: Updated Colorbox to v1.4.1
|
109 |
+
* Enhanced: Better security implementations
|
110 |
+
* Enhanced: Better feed preview display
|
111 |
+
* Fixed bug: Deletion of items upon source deletion not working properly
|
112 |
+
* Requires: WordPress 3.3
|
113 |
+
|
114 |
+
= Version 2.2.3 (2012-11-01) =
|
115 |
+
* Fixed bug: Tab navigation preventing typing in input boxes
|
116 |
+
* Removed: Feeds showing up in internal linking pop up
|
117 |
+
|
118 |
+
= Version 2.2.2 (2012-10-30) =
|
119 |
+
* Removed: Feeds showing up in site search results
|
120 |
+
* Enhanced: Better tab button navigation when adding a new feed
|
121 |
+
* Enhanced: Better guidance when a feed URL is invalid
|
122 |
+
|
123 |
+
= Version 2.2.1 (2012-10-17) =
|
124 |
+
* Fixed bug: wprss_feed_source_order assumes everyone is an admin
|
125 |
+
|
126 |
+
= Version 2.2 (2012-10-01) =
|
127 |
+
* Italian translation added
|
128 |
+
* Feed source order changed to alphabetical
|
129 |
+
* Fixed bug - repeated entries when having a non-valid feed source
|
130 |
+
* Fixed bug - all imported feeds deleted upon trashing a single feed source
|
131 |
+
|
132 |
+
= Version 2.1 (2012-09-27) =
|
133 |
+
* Now localised for translations
|
134 |
+
* Fixed bug with date string
|
135 |
+
* Fixed $link_before and $link_after, now working
|
136 |
+
* Added backwards compatibility for wp_rss_aggregator() function
|
137 |
+
|
138 |
+
= Version 2.0 (2012-09-21) =
|
139 |
+
* Bulk of code rewritten and refactored
|
140 |
+
* Added install and upgrade functions
|
141 |
+
* Added DB version setting
|
142 |
+
* Feed sources now stored as Custom Post Types
|
143 |
+
* Feed source list sortable ascending or descending by name
|
144 |
+
* Removed days subsections in feed display
|
145 |
+
* Ability to limit total number of feeds displayed
|
146 |
+
* Feeds now fetched via Cron
|
147 |
+
* Cron job to delete old feed items, keeps max of 50 items in DB
|
148 |
+
* Now requires WordPress 3.2
|
149 |
+
* Updated colorbox to v1.3.20.1
|
150 |
+
* Limit of 15 items max imported for each source
|
151 |
+
* Fixed issue of page content displaying incorrectly after feeds
|
152 |
+
|
153 |
+
|
154 |
+
= Version 1.1 (2012-08-13) =
|
155 |
+
* Now requires WordPress 3.0
|
156 |
+
* More flexible fetching of images directory
|
157 |
+
* Has its own top level menu item
|
158 |
+
* Added settings section
|
159 |
+
* Ability to open in lightbox, new window or default browser behaviour
|
160 |
+
* Ability to set links as follow or no follow
|
161 |
+
* Using constants for oftenly used locations
|
162 |
+
* Code refactoring
|
163 |
+
* Changes in file and folder structure
|
164 |
+
|
165 |
+
|
166 |
+
= Version 1.0 (2012-01-06) =
|
167 |
+
* Initial release.
|
templates/wprss.css
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WP RSS Aggregator Styles
|
3 |
+
*
|
4 |
+
* @package WP RSS Aggregator
|
5 |
+
* @subpackage CSS
|
6 |
+
* @copyright Copyright (c) 2013, Jean Galea
|
7 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
8 |
+
*/
|
9 |
+
|
uninstall.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_settings_general' );
|
10 |
+
delete_option( 'wprss_db_version' );
|
11 |
+
delete_option( 'wprss_settings_notices' );
|
wp-rss-aggregator.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP RSS Aggregator
|
4 |
+
Plugin URI: http://www.wpmayor.com
|
5 |
+
Description: Imports and aggregates multiple RSS Feeds using SimplePie
|
6 |
+
Version: 3.0
|
7 |
+
Author: Jean Galea
|
8 |
+
Author URI: http://www.wpmayor.com
|
9 |
+
License: GPLv3
|
10 |
+
*/
|
11 |
+
|
12 |
+
/*
|
13 |
+
Copyright 2012-2013 Jean Galea (email : info@jeangalea.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 |
+
* @package WPRSSAggregator
|
31 |
+
* @version 3.0
|
32 |
+
* @since 1.0
|
33 |
+
* @author Jean Galea <info@jeangalea.com>
|
34 |
+
* @copyright Copyright (c) 2012-2013, Jean Galea
|
35 |
+
* @link http://www.wpmayor.com/
|
36 |
+
* @license http://www.gnu.org/licenses/gpl.html
|
37 |
+
*/
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Define constants used by the plugin.
|
41 |
+
*/
|
42 |
+
|
43 |
+
// Set the version number of the plugin.
|
44 |
+
if( !defined( 'WPRSS_VERSION' ) )
|
45 |
+
define( 'WPRSS_VERSION', '3.0', true );
|
46 |
+
|
47 |
+
// Set the database version number of the plugin.
|
48 |
+
if( !defined( 'WPRSS_DB_VERSION' ) )
|
49 |
+
define( 'WPRSS_DB_VERSION', 3 );
|
50 |
+
|
51 |
+
// Set the plugin prefix
|
52 |
+
if( !defined( 'WPRSS_PREFIX' ) )
|
53 |
+
define( 'WPRSS_PREFIX', 'wprss', true );
|
54 |
+
|
55 |
+
// Set constant path to the plugin directory.
|
56 |
+
if( !defined( 'WPRSS_DIR' ) )
|
57 |
+
define( 'WPRSS_DIR', plugin_dir_path( __FILE__ ) );
|
58 |
+
|
59 |
+
// Set constant URI to the plugin URL.
|
60 |
+
if( !defined( 'WPRSS_URI' ) )
|
61 |
+
define( 'WPRSS_URI', plugin_dir_url( __FILE__ ) );
|
62 |
+
|
63 |
+
// Set the constant path to the plugin's javascript directory.
|
64 |
+
if( !defined( 'WPRSS_JS' ) )
|
65 |
+
define( 'WPRSS_JS', WPRSS_URI . trailingslashit( 'js' ), true );
|
66 |
+
|
67 |
+
// Set the constant path to the plugin's CSS directory.
|
68 |
+
if( !defined( 'WPRSS_CSS' ) )
|
69 |
+
define( 'WPRSS_CSS', WPRSS_URI . trailingslashit( 'css' ), true );
|
70 |
+
|
71 |
+
// Set the constant path to the plugin's images directory.
|
72 |
+
if( !defined( 'WPRSS_IMG' ) )
|
73 |
+
define( 'WPRSS_IMG', WPRSS_URI . trailingslashit( 'images' ), true );
|
74 |
+
|
75 |
+
// Set the constant path to the plugin's includes directory.
|
76 |
+
if( !defined( 'WPRSS_INC' ) )
|
77 |
+
define( 'WPRSS_INC', WPRSS_DIR . trailingslashit( 'includes' ), true );
|
78 |
+
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Load required files.
|
82 |
+
*/
|
83 |
+
|
84 |
+
/* Load install, upgrade and migration code. */
|
85 |
+
require_once ( WPRSS_INC . 'update.php' );
|
86 |
+
|
87 |
+
/* Load the shortcodes functions file. */
|
88 |
+
require_once ( WPRSS_INC . 'shortcodes.php' );
|
89 |
+
|
90 |
+
/* Load the custom post types and taxonomies. */
|
91 |
+
require_once ( WPRSS_INC . 'custom-post-types.php' );
|
92 |
+
|
93 |
+
/* Load the feed processing functions file */
|
94 |
+
require_once ( WPRSS_INC . 'feed-processing.php' );
|
95 |
+
|
96 |
+
/* Load the feed display functions file */
|
97 |
+
require_once ( WPRSS_INC . 'feed-display.php' );
|
98 |
+
|
99 |
+
/* Load the cron job scheduling functions. */
|
100 |
+
require_once ( WPRSS_INC . 'cron-jobs.php' );
|
101 |
+
|
102 |
+
/* Load the admin functions file. */
|
103 |
+
require_once ( WPRSS_INC . 'admin.php' );
|
104 |
+
|
105 |
+
/* Load the admin options functions file. */
|
106 |
+
require_once ( WPRSS_INC . 'admin-options.php' );
|
107 |
+
|
108 |
+
/* Load the settings import/export file */
|
109 |
+
//require_once ( WPRSS_INC . 'admin-import-export.php' );
|
110 |
+
|
111 |
+
/* Load the debugging file */
|
112 |
+
//require_once ( WPRSS_INC . 'admin-debugging.php' );
|
113 |
+
|
114 |
+
/* Load the admin display-related functions */
|
115 |
+
require_once ( WPRSS_INC . 'admin-display.php' );
|
116 |
+
|
117 |
+
/* Load the admin metaboxes functions */
|
118 |
+
require_once ( WPRSS_INC . 'admin-metaboxes.php' );
|
119 |
+
|
120 |
+
/* Load the scripts loading functions file */
|
121 |
+
require_once ( WPRSS_INC . 'scripts.php' );
|
122 |
+
|
123 |
+
/* Load the Ajax notification file */
|
124 |
+
require_once ( WPRSS_INC . 'admin-ajax-notice.php' );
|
125 |
+
|
126 |
+
/* Load the logging class */
|
127 |
+
require_once ( WPRSS_INC . 'libraries/WP_Logging.php' );
|
128 |
+
|
129 |
+
register_activation_hook( __FILE__ , 'wprss_activate' );
|
130 |
+
register_deactivation_hook( __FILE__ , 'wprss_deactivate' );
|
131 |
+
|
132 |
+
|
133 |
+
add_action( 'init', 'wprss_init' );
|
134 |
+
/**
|
135 |
+
* Initialise the plugin
|
136 |
+
*
|
137 |
+
* @since 1.0
|
138 |
+
* @return void
|
139 |
+
*/
|
140 |
+
function wprss_init() {
|
141 |
+
do_action( 'wprss_init' );
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Plugin activation procedure
|
147 |
+
*
|
148 |
+
* @since 1.0
|
149 |
+
* @return void
|
150 |
+
*/
|
151 |
+
function wprss_activate() {
|
152 |
+
/* Prevents activation of plugin if compatible version of WordPress not found */
|
153 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
|
154 |
+
deactivate_plugins ( basename( __FILE__ )); // Deactivate plugin
|
155 |
+
wp_die( __( 'This plugin requires WordPress version 3.3 or higher.' ), 'WP RSS Aggregator', array( 'back_link' => true ) );
|
156 |
+
}
|
157 |
+
wprss_settings_initialize();
|
158 |
+
flush_rewrite_rules();
|
159 |
+
wprss_schedule_fetch_all_feeds_cron();
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Plugin deactivation procedure
|
165 |
+
*
|
166 |
+
* @since 1.0
|
167 |
+
*/
|
168 |
+
function wprss_deactivate() {
|
169 |
+
// on deactivation remove the cron job
|
170 |
+
if ( wp_next_scheduled( 'wprss_fetch_all_feeds_hook' ) ) {
|
171 |
+
wp_clear_scheduled_hook( 'wprss_fetch_all_feeds_hook' );
|
172 |
+
}
|
173 |
+
flush_rewrite_rules();
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
add_action( 'plugins_loaded', 'wprss_load_textdomain' );
|
178 |
+
/**
|
179 |
+
* Loads the plugin's translated strings.
|
180 |
+
*
|
181 |
+
* @since 2.1
|
182 |
+
* @return void
|
183 |
+
*/
|
184 |
+
function wprss_load_textdomain() {
|
185 |
+
load_plugin_textdomain( 'wprss', false, plugin_basename( __FILE__ ) . '/languages/' );
|
186 |
+
}
|