Version Description
(2014-10-15) = * Enhanced: Improved plugin responsiveness. * Enhanced: Updated some help text in tooltips with better explainations and added clarity. * Enhanced: Optimized some old SQL queries. * Enhanced: Added better debug logging. * Enhanced: Added a new filter to modify the text shown before author names. * Fixed bug: Licenses were not showing as active, even though they were activated.
Download this release
Release Info
Developer | Mekku |
Plugin | WP RSS Aggregator |
Version | 4.6.2 |
Comparing to | |
See all releases |
Code changes from version 4.6.1 to 4.6.2
- changelog.txt +8 -0
- css/admin-styles.css +73 -1
- includes/admin-help-metaboxes.php +4 -2
- includes/admin-log.php +177 -6
- includes/feed-display.php +6 -2
- includes/feed-importing.php +68 -7
- includes/feed-processing.php +5 -7
- includes/licensing.php +40 -10
- readme.txt +11 -1
- wp-rss-aggregator.php +16 -13
changelog.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
4.6.1 (2014-10-06)
|
2 |
Enhanced: Improved internationalization in the plugin, for better translations.
|
3 |
Fixed bug: If the feed source age limit was left empty, the global setting was used instead of ignoring the limit.
|
1 |
+
4.6.2 (2014-10-15)
|
2 |
+
Enhanced: Improved plugin responsiveness.
|
3 |
+
Enhanced: Updated some help text in tooltips with better explainations and added clarity.
|
4 |
+
Enhanced: Optimized some old SQL queries.
|
5 |
+
Enhanced: Added better debug logging.
|
6 |
+
Enhanced: Added a new filter to modify the text shown before author names.
|
7 |
+
Fixed bug: Licenses were not showing as active, even though they were activated.
|
8 |
+
|
9 |
4.6.1 (2014-10-06)
|
10 |
Enhanced: Improved internationalization in the plugin, for better translations.
|
11 |
Fixed bug: If the feed source age limit was left empty, the global setting was used instead of ignoring the limit.
|
css/admin-styles.css
CHANGED
@@ -568,7 +568,7 @@ body.post-type-wprss_blacklist .alignleft.actions.bulkactions {
|
|
568 |
|
569 |
.wprss-tooltip-handle {
|
570 |
margin-left: 5px;
|
571 |
-
font-size:
|
572 |
color: rgb(190, 190, 190);
|
573 |
vertical-align: middle;
|
574 |
}
|
@@ -604,4 +604,76 @@ body.post-type-wprss_blacklist .alignleft.actions.bulkactions {
|
|
604 |
}
|
605 |
.wprss-ui-tooltip hr {
|
606 |
margin: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
}
|
568 |
|
569 |
.wprss-tooltip-handle {
|
570 |
margin-left: 5px;
|
571 |
+
font-size: 15px;
|
572 |
color: rgb(190, 190, 190);
|
573 |
vertical-align: middle;
|
574 |
}
|
604 |
}
|
605 |
.wprss-ui-tooltip hr {
|
606 |
margin: 0;
|
607 |
+
}
|
608 |
+
|
609 |
+
/* For non settings page screens */
|
610 |
+
@media only screen and (max-width: 1026px) {
|
611 |
+
|
612 |
+
body:not(.wprss_feed_page_wprss-aggregator-settings)
|
613 |
+
.wprss-tooltip-handle {
|
614 |
+
color: #999;
|
615 |
+
font-size: 1em;
|
616 |
+
padding: 6px 10px;
|
617 |
+
margin-left: 0;
|
618 |
+
background: #e5e5e5;
|
619 |
+
border-radius: 3px;
|
620 |
+
vertical-align: middle;
|
621 |
+
}
|
622 |
+
|
623 |
+
body:not(.wprss_feed_page_wprss-aggregator-settings)
|
624 |
+
select + .wprss-tooltip-handle,
|
625 |
+
body:not(.wprss_feed_page_wprss-aggregator-settings)
|
626 |
+
input[type="input"] + .wprss-tooltip-handle,
|
627 |
+
body:not(.wprss_feed_page_wprss-aggregator-settings)
|
628 |
+
input[type="password"] + .wprss-tooltip-handle {
|
629 |
+
margin-top: 5px;
|
630 |
+
}
|
631 |
+
|
632 |
+
body:not(.wprss_feed_page_wprss-aggregator-settings)
|
633 |
+
.wprss-tooltip-handle:after {
|
634 |
+
content: 'Help';
|
635 |
+
margin-left: 5px;
|
636 |
+
font-family: 'Open Sans', sans-serif;
|
637 |
+
}
|
638 |
+
|
639 |
+
}
|
640 |
+
|
641 |
+
|
642 |
+
/* For settings page screens */
|
643 |
+
@media only screen and (max-width: 782px) {
|
644 |
+
|
645 |
+
body.wprss_feed_page_wprss-aggregator-settings
|
646 |
+
.wprss-tooltip-handle {
|
647 |
+
color: #999;
|
648 |
+
font-size: 1em;
|
649 |
+
padding: 6px 10px;
|
650 |
+
margin-left: 0;
|
651 |
+
background: #e5e5e5;
|
652 |
+
border-radius: 3px;
|
653 |
+
vertical-align: middle;
|
654 |
+
}
|
655 |
+
|
656 |
+
body.wprss_feed_page_wprss-aggregator-settings
|
657 |
+
select + .wprss-tooltip-handle,
|
658 |
+
body.wprss_feed_page_wprss-aggregator-settings
|
659 |
+
input[type="input"] + .wprss-tooltip-handle,
|
660 |
+
body.wprss_feed_page_wprss-aggregator-settings
|
661 |
+
input[type="password"] + .wprss-tooltip-handle {
|
662 |
+
margin-top: 5px;
|
663 |
+
}
|
664 |
+
|
665 |
+
body.wprss_feed_page_wprss-aggregator-settings
|
666 |
+
.wprss-tooltip-handle:after {
|
667 |
+
content: 'Help';
|
668 |
+
margin-left: 5px;
|
669 |
+
font-family: 'Open Sans', sans-serif;
|
670 |
+
}
|
671 |
+
|
672 |
+
}
|
673 |
+
|
674 |
+
|
675 |
+
@media only screen and (max-width: 1026px) {
|
676 |
+
.wprss-tr-hr th {
|
677 |
+
padding-top: 10px;
|
678 |
+
}
|
679 |
}
|
includes/admin-help-metaboxes.php
CHANGED
@@ -21,9 +21,11 @@ if( class_exists('WPRSS_Help') ) {
|
|
21 |
|
22 |
If you already have items imported from this feed source, setting this option now may delete some of your items, in order to comply with the limit.',
|
23 |
// Link to Enclosure
|
24 |
-
'wprss_enclosure' => 'Tick this box to make feed items link to
|
25 |
|
26 |
-
Enclosure tags are RSS tags that may be included with a feed items. These tags typically contain links to images, audio, videos, attachment files or even flash content.
|
|
|
|
|
27 |
|
28 |
/* -------------------------
|
29 |
* Feed Processing Metabox
|
21 |
|
22 |
If you already have items imported from this feed source, setting this option now may delete some of your items, in order to comply with the limit.',
|
23 |
// Link to Enclosure
|
24 |
+
'wprss_enclosure' => 'Tick this box to make feed items link to the URL in the enclosure tag, rather than link to the original article.
|
25 |
|
26 |
+
Enclosure tags are RSS tags that may be included with a feed items. These tags typically contain links to images, audio, videos, attachment files or even flash content.
|
27 |
+
|
28 |
+
If you are not sure leave this setting blank.',
|
29 |
|
30 |
/* -------------------------
|
31 |
* Feed Processing Metabox
|
includes/admin-log.php
CHANGED
@@ -1,5 +1,16 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
/**
|
4 |
* Returns the log file path.
|
5 |
*
|
@@ -28,6 +39,111 @@
|
|
28 |
function wprss_reset_log() {
|
29 |
wprss_clear_log();
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
|
33 |
/**
|
@@ -35,14 +151,17 @@
|
|
35 |
*
|
36 |
* @since 3.9.6
|
37 |
*/
|
38 |
-
function wprss_log( $message, $src = NULL ) {
|
|
|
|
|
39 |
if ( $src === NULL ) {
|
40 |
$callers = debug_backtrace();
|
41 |
$src = $callers[1]['function'];
|
42 |
}
|
|
|
43 |
$date = date( 'd-m-Y H:i:s' );
|
44 |
$source = 'WPRSS' . ( ( strlen( $src ) > 0 )? " > $src" : '' ) ;
|
45 |
-
$str = "[$date] $source:\n";
|
46 |
$str .= "$message\n";
|
47 |
file_put_contents( wprss_log_file() , $str, FILE_APPEND );
|
48 |
|
@@ -55,8 +174,8 @@
|
|
55 |
*
|
56 |
* @since 3.9.6
|
57 |
*/
|
58 |
-
function wprss_log_obj( $message, $obj, $src = '' ) {
|
59 |
-
wprss_log( "$message: " . print_r( $obj, TRUE ), $src );
|
60 |
}
|
61 |
|
62 |
|
@@ -71,7 +190,7 @@
|
|
71 |
}
|
72 |
$contents = file_get_contents( wprss_log_file() , '' );
|
73 |
// Trim the log file to a fixed number of chars
|
74 |
-
$limit =
|
75 |
if ( strlen( $contents ) > $limit ) {
|
76 |
file_put_contents( wprss_log_file(), substr( $contents, 0, $limit ) );
|
77 |
return wprss_get_log();
|
@@ -91,4 +210,56 @@
|
|
91 |
*/
|
92 |
function wprss_log_separator() {
|
93 |
file_put_contents( wprss_log_file(), "\n", FILE_APPEND );
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
+
define( 'WPRSS_LOG_DISPLAY_LIMIT', 100000 ); // Number of chars to display in log
|
4 |
+
define( 'WPRSS_OPTION_CODE_LOG_LEVEL', 'log_level' );
|
5 |
+
define( 'WPRSS_LOG_LEVEL_NONE', 0 );
|
6 |
+
define( 'WPRSS_LOG_LEVEL_SYSTEM', 1 );
|
7 |
+
define( 'WPRSS_LOG_LEVEL_INFO', 2 );
|
8 |
+
define( 'WPRSS_LOG_LEVEL_NOTICE', 4 );
|
9 |
+
define( 'WPRSS_LOG_LEVEL_WARNING', 8 );
|
10 |
+
define( 'WPRSS_LOG_LEVEL_ERROR', 16 );
|
11 |
+
define( 'WPRSS_LOG_LEVEL_DEFAULT', 'default' );
|
12 |
+
|
13 |
+
|
14 |
/**
|
15 |
* Returns the log file path.
|
16 |
*
|
39 |
function wprss_reset_log() {
|
40 |
wprss_clear_log();
|
41 |
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Gets log level from the database.
|
45 |
+
* @return string The string representing the log level threshold or type.
|
46 |
+
*/
|
47 |
+
function wprss_log_get_level_db() {
|
48 |
+
return wprss_get_general_setting( WPRSS_OPTION_CODE_LOG_LEVEL );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Gets log level used.
|
53 |
+
* @return string The string representing the log level threshold.
|
54 |
+
*/
|
55 |
+
function wprss_log_get_level() {
|
56 |
+
$log_level = wprss_log_get_level_db();
|
57 |
+
if ( $log_level === WPRSS_LOG_LEVEL_DEFAULT )
|
58 |
+
$log_level = WPRSS_LOG_LEVEL;
|
59 |
+
|
60 |
+
return apply_filters( 'wprss_log_level', $log_level );
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Check whether or not the specified logging level is the same as, or one of (only for positive),
|
66 |
+
* the currently used logging level.
|
67 |
+
*
|
68 |
+
* @param int $log_level The log level to check. Must be an unsiged whole number.
|
69 |
+
*/
|
70 |
+
function wprss_log_is_level( $log_level, $used_log_level = null ) {
|
71 |
+
$used_log_level = is_null( $used_log_level ) ? wprss_log_get_level() : $used_log_level;
|
72 |
+
|
73 |
+
if( is_numeric( $log_level ) ) {
|
74 |
+
$log_level = intval( $log_level );
|
75 |
+
$used_log_level = intval( $used_log_level );
|
76 |
+
|
77 |
+
return ($log_level > 0 && $used_log_level > 0)
|
78 |
+
// Mostly for the case of 0
|
79 |
+
? intval( $log_level ) & intval( $used_log_level )
|
80 |
+
: $log_level === $used_log_level;
|
81 |
+
}
|
82 |
+
|
83 |
+
return trim( $log_level ) === trim( $used_log_level );
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Check whether or not messages with the specified logging level should be logged.
|
89 |
+
*
|
90 |
+
* @param int $log_level The log level to check. Must be an unsigned whole number
|
91 |
+
* @return bool True if messages with the specified logging level should be logged; false otherwise.
|
92 |
+
*/
|
93 |
+
function wprss_log_is_logging_level( $log_level ) {
|
94 |
+
$original_used_level = $used_log_level = wprss_log_get_level();
|
95 |
+
|
96 |
+
// Whether to use the indicated level and below
|
97 |
+
$is_below = ( substr( $used_log_level, 0, 1 ) === '-' );
|
98 |
+
if ( $is_below )
|
99 |
+
$used_log_level = substr( $used_log_level, 1 );
|
100 |
+
|
101 |
+
if( (int)$used_log_level === WPRSS_LOG_LEVEL_NONE ) {
|
102 |
+
$is_log_level = WPRSS_LOG_LEVEL_NONE;
|
103 |
+
}
|
104 |
+
else {
|
105 |
+
$is_log_level = $is_below
|
106 |
+
? ((int)$log_level <= (int)$used_log_level && (int)$log_level !== WPRSS_LOG_LEVEL_NONE)
|
107 |
+
: wprss_log_is_level( (int)$log_level, $used_log_level );
|
108 |
+
}
|
109 |
+
|
110 |
+
return apply_filters( 'wprss_is_logging_level', $is_log_level, $log_level, $used_log_level, $is_below );
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Get the available log levels.
|
116 |
+
*
|
117 |
+
* @param bool $levels_only Whether or not only numeric actual levels are to be returned.
|
118 |
+
* If false, returns other types as well.
|
119 |
+
* @return array An array, where key is level, and value is level's human-readable name
|
120 |
+
*/
|
121 |
+
function wprss_log_get_levels( $levels_only = true ) {
|
122 |
+
$log_levels = array(
|
123 |
+
WPRSS_LOG_LEVEL_NONE => 'None',
|
124 |
+
WPRSS_LOG_LEVEL_SYSTEM => 'System',
|
125 |
+
WPRSS_LOG_LEVEL_INFO => 'Info',
|
126 |
+
WPRSS_LOG_LEVEL_NOTICE => 'Notice',
|
127 |
+
WPRSS_LOG_LEVEL_WARNING => 'Warning',
|
128 |
+
WPRSS_LOG_LEVEL_ERROR => 'Error'
|
129 |
+
);
|
130 |
+
|
131 |
+
if( !$levels_only )
|
132 |
+
$log_levels[ WPRSS_LOG_LEVEL_DEFAULT ] = 'Default';
|
133 |
+
|
134 |
+
return apply_filters( 'wprss_log_levels', $log_levels, $levels_only );
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
/**
|
139 |
+
*
|
140 |
+
* @param string|int $level Any valid level value.
|
141 |
+
* @return string The untranslated label of the specified level, or $default if no such level exists.
|
142 |
+
*/
|
143 |
+
function wprss_log_get_level_label( $level, $default = 'N/A' ) {
|
144 |
+
$levels = wprss_log_get_levels( false );
|
145 |
+
return isset( $levels[$level] ) ? $levels[ $level ] : $default;
|
146 |
+
}
|
147 |
|
148 |
|
149 |
/**
|
151 |
*
|
152 |
* @since 3.9.6
|
153 |
*/
|
154 |
+
function wprss_log( $message, $src = NULL, $log_level = WPRSS_LOG_LEVEL_ERROR ) {
|
155 |
+
if( !wprss_log_is_logging_level( $log_level ) ) return;
|
156 |
+
|
157 |
if ( $src === NULL ) {
|
158 |
$callers = debug_backtrace();
|
159 |
$src = $callers[1]['function'];
|
160 |
}
|
161 |
+
$log_level_label = wprss_log_get_level_label( $log_level );
|
162 |
$date = date( 'd-m-Y H:i:s' );
|
163 |
$source = 'WPRSS' . ( ( strlen( $src ) > 0 )? " > $src" : '' ) ;
|
164 |
+
$str = "[$date] [$log_level_label] $source:\n";
|
165 |
$str .= "$message\n";
|
166 |
file_put_contents( wprss_log_file() , $str, FILE_APPEND );
|
167 |
|
174 |
*
|
175 |
* @since 3.9.6
|
176 |
*/
|
177 |
+
function wprss_log_obj( $message, $obj, $src = '', $log_level = WPRSS_LOG_LEVEL_ERROR ) {
|
178 |
+
wprss_log( "$message: " . print_r( $obj, TRUE ), $src, $log_level );
|
179 |
}
|
180 |
|
181 |
|
190 |
}
|
191 |
$contents = file_get_contents( wprss_log_file() , '' );
|
192 |
// Trim the log file to a fixed number of chars
|
193 |
+
$limit = WPRSS_LOG_DISPLAY_LIMIT;
|
194 |
if ( strlen( $contents ) > $limit ) {
|
195 |
file_put_contents( wprss_log_file(), substr( $contents, 0, $limit ) );
|
196 |
return wprss_get_log();
|
210 |
*/
|
211 |
function wprss_log_separator() {
|
212 |
file_put_contents( wprss_log_file(), "\n", FILE_APPEND );
|
213 |
+
}
|
214 |
+
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Adding the default setting value.
|
218 |
+
*/
|
219 |
+
add_filter( 'wprss_default_settings_general', 'wprss_log_default_settings_general' );
|
220 |
+
function wprss_log_default_settings_general( $settings ) {
|
221 |
+
/* @todo Add version info */
|
222 |
+
$settings[ WPRSS_OPTION_CODE_LOG_LEVEL ] = WPRSS_LOG_LEVEL_DEFAULT;
|
223 |
+
return $settings;
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Adding the setting field
|
229 |
+
*/
|
230 |
+
add_filter( 'wprss_settings_array', 'wprss_log_settings_array' );
|
231 |
+
function wprss_log_settings_array( $sections ) {
|
232 |
+
$sections['general'][ WPRSS_OPTION_CODE_LOG_LEVEL ] = array(
|
233 |
+
'label' => __( 'Log level threshold', WPRSS_TEXT_DOMAIN ),
|
234 |
+
'callback' => 'wprss_setting_' . WPRSS_OPTION_CODE_LOG_LEVEL . '_callback'
|
235 |
+
);
|
236 |
+
return $sections;
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Renders the 'log_level' setting field.
|
242 |
+
*
|
243 |
+
* @param array $field Info about the field
|
244 |
+
*/
|
245 |
+
function wprss_setting_log_level_callback( $field ) {
|
246 |
+
$log_level = wprss_get_general_setting( $field['field_id'] );
|
247 |
+
|
248 |
+
foreach( wprss_log_get_levels( false ) as $_level => $_label ) {
|
249 |
+
$options[ $_level ] = $_label;
|
250 |
+
if( is_numeric( $_level ) && ($_level/2 >= 1) ) $options[ (int)$_level * -1 ] = $_label . ' and below';
|
251 |
+
}
|
252 |
+
|
253 |
+
krsort($options, SORT_NATURAL);
|
254 |
+
?>
|
255 |
+
<select id="<?php echo $field['field_id'] ?>" name="wprss_settings_general[<?php echo $field['field_id'] ?>]">
|
256 |
+
<?php
|
257 |
+
foreach( $options as $value => $text ) {
|
258 |
+
$selected = ( (string)$value === (string)$log_level )? 'selected="selected"' : '';
|
259 |
+
?><option value="<?php echo $value ?>" <?php echo $selected ?>><?php echo __( $text, WPRSS_TEXT_DOMAIN ) ?></option><?php
|
260 |
+
}
|
261 |
+
?>
|
262 |
+
</select>
|
263 |
+
<?php echo wprss_settings_inline_help( $field['field_id'], $field['tooltip'] );
|
264 |
+
}
|
265 |
+
|
includes/feed-display.php
CHANGED
@@ -258,8 +258,12 @@
|
|
258 |
<?php $author = get_post_meta( get_the_ID(), 'wprss_item_author', TRUE );
|
259 |
if ( wprss_get_general_setting('authors_enable') == 1 && $author !== NULL && is_string( $author ) && $author !== '' ) : ?>
|
260 |
<span class="feed-author">
|
261 |
-
<?php
|
262 |
-
|
|
|
|
|
|
|
|
|
263 |
</span>
|
264 |
<?php endif; ?>
|
265 |
|
258 |
<?php $author = get_post_meta( get_the_ID(), 'wprss_item_author', TRUE );
|
259 |
if ( wprss_get_general_setting('authors_enable') == 1 && $author !== NULL && is_string( $author ) && $author !== '' ) : ?>
|
260 |
<span class="feed-author">
|
261 |
+
<?php
|
262 |
+
$author_text = apply_filters( 'wprss_item_author', $author );
|
263 |
+
$author_prefix_text = apply_filters( 'wprss_author_prefix_text', 'By' );
|
264 |
+
_e( $author_prefix_text, WPRSS_TEXT_DOMAIN );
|
265 |
+
echo ' ' . $author_text;
|
266 |
+
?>
|
267 |
</span>
|
268 |
<?php endif; ?>
|
269 |
|
includes/feed-importing.php
CHANGED
@@ -22,27 +22,36 @@
|
|
22 |
* @since 3.2
|
23 |
*/
|
24 |
function wprss_fetch_insert_single_feed_items( $feed_ID ) {
|
|
|
|
|
25 |
// Check if the feed source is active.
|
26 |
if ( wprss_is_feed_source_active( $feed_ID ) === FALSE && wprss_feed_source_force_next_fetch( $feed_ID ) === FALSE ) {
|
27 |
// If it is not active ( paused ), return without fetching the feed items.
|
|
|
28 |
return;
|
29 |
}
|
30 |
// If the feed source is forced for next fetch, remove the force next fetch data
|
31 |
if ( wprss_feed_source_force_next_fetch( $feed_ID ) ) {
|
32 |
delete_post_meta( $feed_ID, 'wprss_force_next_fetch' );
|
|
|
33 |
}
|
34 |
|
35 |
-
update_post_meta( $feed_ID, 'wprss_feed_is_updating', time() );
|
|
|
36 |
|
37 |
// Get the feed source URL from post meta, and filter it
|
38 |
$feed_url = get_post_meta( $feed_ID, 'wprss_url', true );
|
|
|
39 |
$feed_url = apply_filters( 'wprss_feed_source_url', $feed_url, $feed_ID );
|
|
|
40 |
|
41 |
// Get the feed limit from post meta
|
42 |
$feed_limit = get_post_meta( $feed_ID, 'wprss_limit', true );
|
|
|
43 |
|
44 |
// If the feed has no individual limit
|
45 |
-
if ( $feed_limit === '' || intval($feed_limit) <= 0 ) {
|
|
|
46 |
// Get the global limit
|
47 |
$global_limit = wprss_get_general_setting('limit_feed_items_imported');
|
48 |
// If no global limit is set, mark as NULL
|
@@ -51,37 +60,62 @@
|
|
51 |
}
|
52 |
else $feed_limit = $global_limit;
|
53 |
}
|
|
|
54 |
|
55 |
// Filter the URL for validaty
|
56 |
if ( filter_var( $feed_url, FILTER_VALIDATE_URL ) ) {
|
|
|
57 |
// Get the feed items from the source
|
58 |
$items = wprss_get_feed_items( $feed_url, $feed_ID );
|
59 |
// If got NULL, convert to an empty array
|
60 |
-
if ( $items === NULL )
|
|
|
|
|
|
|
61 |
|
62 |
// If using a limit ...
|
63 |
if ( $feed_limit === NULL ) {
|
64 |
$items_to_insert = $items;
|
65 |
} else {
|
66 |
$items_to_insert = array_slice( $items, 0, $feed_limit );
|
|
|
67 |
}
|
68 |
|
69 |
// Gather the permalinks of existing feed item's related to this feed source
|
70 |
$existing_permalinks = get_existing_permalinks( $feed_ID );
|
|
|
71 |
|
72 |
// Generate a list of items fetched, that are not already in the DB
|
73 |
$new_items = array();
|
74 |
foreach( $items_to_insert as $item ) {
|
75 |
$permalink = wprss_normalize_permalink( $item->get_permalink() );
|
|
|
76 |
// Check if not blacklisted and not already imported
|
77 |
-
|
|
|
|
|
78 |
$new_items[] = $item;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
$items_to_insert = $new_items;
|
82 |
|
83 |
// If using a limit - delete any excess items to make room for the new items
|
84 |
if ( $feed_limit !== NULL ) {
|
|
|
|
|
85 |
// Get the number of feed items in DB, and their count
|
86 |
$db_feed_items = wprss_get_feed_items_for_source( $feed_ID );
|
87 |
$num_db_feed_items = $db_feed_items->post_count;
|
@@ -95,17 +129,23 @@
|
|
95 |
$db_feed_items_reversed = array_reverse( $db_feed_items->posts );
|
96 |
// Cut the array to get only the first few that are to be deleted ( equal to $num_feed_items_to_delete )
|
97 |
$feed_items_to_delete = array_slice( $db_feed_items_reversed, 0, $num_feed_items_to_delete );
|
|
|
98 |
|
99 |
// Iterate the feed items and delete them
|
100 |
foreach ( $feed_items_to_delete as $key => $post ) {
|
101 |
wp_delete_post( $post->ID, TRUE );
|
102 |
}
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
-
update_post_meta( $feed_ID, 'wprss_last_update', time() );
|
|
|
106 |
|
107 |
// Insert the items into the db
|
108 |
if ( !empty( $items_to_insert ) ) {
|
|
|
109 |
wprss_items_insert_post( $items_to_insert, $feed_ID );
|
110 |
}
|
111 |
} else {
|
@@ -113,12 +153,15 @@
|
|
113 |
}
|
114 |
|
115 |
$next_scheduled = get_post_meta( $feed_ID, 'wprss_reschedule_event', TRUE );
|
|
|
116 |
if ( $next_scheduled !== '' ) {
|
117 |
wprss_feed_source_update_start_schedule( $feed_ID );
|
118 |
delete_post_meta( $feed_ID, 'wprss_reschedule_event' );
|
|
|
119 |
}
|
120 |
|
121 |
delete_post_meta( $feed_ID, 'wprss_feed_is_updating' );
|
|
|
122 |
}
|
123 |
|
124 |
|
@@ -358,7 +401,8 @@
|
|
358 |
* @since 3.0
|
359 |
*/
|
360 |
function wprss_items_insert_post( $items, $feed_ID ) {
|
361 |
-
update_post_meta( $feed_ID, 'wprss_feed_is_updating', time() );
|
|
|
362 |
|
363 |
// Gather the permalinks of existing feed item's related to this feed source
|
364 |
$existing_permalinks = get_existing_permalinks( $feed_ID );
|
@@ -370,12 +414,16 @@
|
|
370 |
|
371 |
// Normalize the URL
|
372 |
$permalink = wprss_normalize_permalink( $item->get_permalink() );
|
|
|
|
|
373 |
|
374 |
// Save the enclosure URL
|
375 |
$enclosure_url = '';
|
376 |
if ( $enclosure = $item->get_enclosure(0) ) {
|
|
|
377 |
if ( $enclosure->get_link() ) {
|
378 |
$enclosure_url = $enclosure->get_link();
|
|
|
379 |
}
|
380 |
}
|
381 |
|
@@ -388,6 +436,7 @@
|
|
388 |
// Check if newly fetched item already present in existing feed items,
|
389 |
// if not insert it into wp_posts and insert post meta.
|
390 |
if ( ! ( in_array( $permalink, $existing_permalinks ) ) ) {
|
|
|
391 |
|
392 |
// Apply filters that determine if the feed item should be inserted into the DB or not.
|
393 |
$item = apply_filters( 'wprss_insert_post_item_conditionals', $item, $feed_ID, $permalink );
|
@@ -397,6 +446,8 @@
|
|
397 |
|
398 |
// If the item is not NULL, continue to inserting the feed item post into the DB
|
399 |
if ( $item !== NULL && !is_bool($item) ) {
|
|
|
|
|
400 |
// Get the date and GTM date and normalize if not valid dor not present
|
401 |
$format = 'Y-m-d H:i:s';
|
402 |
$has_date = $item->get_date( 'U' ) ? TRUE : FALSE;
|
@@ -416,11 +467,14 @@
|
|
416 |
),
|
417 |
$item
|
418 |
);
|
|
|
419 |
|
420 |
if ( defined('ICL_SITEPRESS_VERSION') )
|
421 |
@include_once( WP_PLUGIN_DIR . '/sitepress-multilingual-cms/inc/wpml-api.php' );
|
422 |
-
if ( defined('ICL_LANGUAGE_CODE') )
|
423 |
$_POST['icl_post_language'] = $language_code = ICL_LANGUAGE_CODE;
|
|
|
|
|
424 |
|
425 |
// Create and insert post object into the DB
|
426 |
$inserted_ID = wp_insert_post( $feed_item );
|
@@ -444,6 +498,7 @@
|
|
444 |
|
445 |
// Remember newly added permalink
|
446 |
$existing_permalinks[] = $permalink;
|
|
|
447 |
}
|
448 |
else {
|
449 |
update_post_meta( $source, "wprss_error_last_import", "true" );
|
@@ -456,9 +511,15 @@
|
|
456 |
$items_inserted++;
|
457 |
}
|
458 |
}
|
|
|
|
|
|
|
|
|
|
|
459 |
}
|
460 |
|
461 |
update_post_meta( $feed_ID, 'wprss_last_update_items', $items_inserted );
|
|
|
462 |
}
|
463 |
|
464 |
|
22 |
* @since 3.2
|
23 |
*/
|
24 |
function wprss_fetch_insert_single_feed_items( $feed_ID ) {
|
25 |
+
wprss_log_obj( 'Starting import of feed', $feed_ID, null, WPRSS_LOG_LEVEL_INFO );
|
26 |
+
|
27 |
// Check if the feed source is active.
|
28 |
if ( wprss_is_feed_source_active( $feed_ID ) === FALSE && wprss_feed_source_force_next_fetch( $feed_ID ) === FALSE ) {
|
29 |
// If it is not active ( paused ), return without fetching the feed items.
|
30 |
+
wprss_log( 'Feed is not active and not forced. Import cancelled.', null, WPRSS_LOG_LEVEL_INFO );
|
31 |
return;
|
32 |
}
|
33 |
// If the feed source is forced for next fetch, remove the force next fetch data
|
34 |
if ( wprss_feed_source_force_next_fetch( $feed_ID ) ) {
|
35 |
delete_post_meta( $feed_ID, 'wprss_force_next_fetch' );
|
36 |
+
wprss_log( 'Force feed flag removed', null, WPRSS_LOG_LEVEL_SYSTEM );
|
37 |
}
|
38 |
|
39 |
+
update_post_meta( $feed_ID, 'wprss_feed_is_updating', $start_of_update = time() );
|
40 |
+
wprss_log_obj( 'Start of import time updated', $start_of_update, null, WPRSS_LOG_LEVEL_SYSTEM );
|
41 |
|
42 |
// Get the feed source URL from post meta, and filter it
|
43 |
$feed_url = get_post_meta( $feed_ID, 'wprss_url', true );
|
44 |
+
wprss_log_obj( 'Original feed source URL', $feed_url, null, WPRSS_LOG_LEVEL_SYSTEM );
|
45 |
$feed_url = apply_filters( 'wprss_feed_source_url', $feed_url, $feed_ID );
|
46 |
+
wprss_log_obj( 'Actual feed source URL', $feed_url, null, WPRSS_LOG_LEVEL_INFO );
|
47 |
|
48 |
// Get the feed limit from post meta
|
49 |
$feed_limit = get_post_meta( $feed_ID, 'wprss_limit', true );
|
50 |
+
wprss_log_obj( 'Feed limit value is', $feed_limit, null, WPRSS_LOG_LEVEL_SYSTEM );
|
51 |
|
52 |
// If the feed has no individual limit
|
53 |
+
if ( $feed_limit === '' || intval( $feed_limit ) <= 0 ) {
|
54 |
+
wprss_log_obj( 'Using global limit', $feed_limit, null, WPRSS_LOG_LEVEL_NOTICE );
|
55 |
// Get the global limit
|
56 |
$global_limit = wprss_get_general_setting('limit_feed_items_imported');
|
57 |
// If no global limit is set, mark as NULL
|
60 |
}
|
61 |
else $feed_limit = $global_limit;
|
62 |
}
|
63 |
+
wprss_log_obj( 'Feed import limit', $feed_limit, null, WPRSS_LOG_LEVEL_INFO );
|
64 |
|
65 |
// Filter the URL for validaty
|
66 |
if ( filter_var( $feed_url, FILTER_VALIDATE_URL ) ) {
|
67 |
+
wprss_log_obj( 'Feed URL is valid', $feed_url, null, WPRSS_LOG_LEVEL_INFO );
|
68 |
// Get the feed items from the source
|
69 |
$items = wprss_get_feed_items( $feed_url, $feed_ID );
|
70 |
// If got NULL, convert to an empty array
|
71 |
+
if ( $items === NULL ) {
|
72 |
+
$items = array();
|
73 |
+
wprss_log( 'Items were NULL. Using empty array', null, WPRSS_LOG_LEVEL_WARNING );
|
74 |
+
}
|
75 |
|
76 |
// If using a limit ...
|
77 |
if ( $feed_limit === NULL ) {
|
78 |
$items_to_insert = $items;
|
79 |
} else {
|
80 |
$items_to_insert = array_slice( $items, 0, $feed_limit );
|
81 |
+
wprss_log_obj( 'Sliced a segment of items', count($items_to_insert), null, WPRSS_LOG_LEVEL_SYSTEM );
|
82 |
}
|
83 |
|
84 |
// Gather the permalinks of existing feed item's related to this feed source
|
85 |
$existing_permalinks = get_existing_permalinks( $feed_ID );
|
86 |
+
wprss_log_obj( 'Retrieved existing permalinks', count($existing_permalinks), null, WPRSS_LOG_LEVEL_SYSTEM );
|
87 |
|
88 |
// Generate a list of items fetched, that are not already in the DB
|
89 |
$new_items = array();
|
90 |
foreach( $items_to_insert as $item ) {
|
91 |
$permalink = wprss_normalize_permalink( $item->get_permalink() );
|
92 |
+
wprss_log_obj( 'Normalizing permalink', sprintf('%1$s -> %2$s', $item->get_permalink(), $permalink), null, WPRSS_LOG_LEVEL_SYSTEM );
|
93 |
// Check if not blacklisted and not already imported
|
94 |
+
$is_blacklisted = wprss_is_blacklisted( $permalink );
|
95 |
+
$already_exists = in_array( trim($permalink), $existing_permalinks );
|
96 |
+
if ( $is_blacklisted === FALSE && !$already_exists ) {
|
97 |
$new_items[] = $item;
|
98 |
+
wprss_log( 'Permalink OK', $permalink, null, WPRSS_LOG_LEVEL_SYSTEM );
|
99 |
+
}
|
100 |
+
else {
|
101 |
+
if ( $is_blacklisted )
|
102 |
+
wprss_log( 'Permalink blacklisted', null, WPRSS_LOG_LEVEL_SYSTEM );
|
103 |
+
if( $already_exists)
|
104 |
+
wprss_log( 'Permalink already exists', null, WPRSS_LOG_LEVEL_SYSTEM );
|
105 |
}
|
106 |
}
|
107 |
+
|
108 |
+
$original_count = count( $items_to_insert );
|
109 |
+
$new_count = count( $new_items );
|
110 |
+
if( $new_count !== $original_count )
|
111 |
+
wprss_log_obj( 'Items filtered out', $original_count - $new_count, null, WPRSS_LOG_LEVEL_NOTICE );
|
112 |
+
|
113 |
$items_to_insert = $new_items;
|
114 |
|
115 |
// If using a limit - delete any excess items to make room for the new items
|
116 |
if ( $feed_limit !== NULL ) {
|
117 |
+
wprss_log_obj( 'Some items may be deleted due to limit', $feed_limit, null, WPRSS_LOG_LEVEL_SYSTEM );
|
118 |
+
|
119 |
// Get the number of feed items in DB, and their count
|
120 |
$db_feed_items = wprss_get_feed_items_for_source( $feed_ID );
|
121 |
$num_db_feed_items = $db_feed_items->post_count;
|
129 |
$db_feed_items_reversed = array_reverse( $db_feed_items->posts );
|
130 |
// Cut the array to get only the first few that are to be deleted ( equal to $num_feed_items_to_delete )
|
131 |
$feed_items_to_delete = array_slice( $db_feed_items_reversed, 0, $num_feed_items_to_delete );
|
132 |
+
wprss_log( sprintf( 'There already are %1$d items in the database. %2$d items can be inserted. %3$d items will be deleted', $num_db_feed_items, $num_can_insert, $feed_items_to_delete ), null, WPRSS_LOG_LEVEL_SYSTEM );
|
133 |
|
134 |
// Iterate the feed items and delete them
|
135 |
foreach ( $feed_items_to_delete as $key => $post ) {
|
136 |
wp_delete_post( $post->ID, TRUE );
|
137 |
}
|
138 |
+
|
139 |
+
if( $deleted_items_count = count($feed_items_to_delete) )
|
140 |
+
wprss_log_obj( 'Items deleted due to limit', $deleted_items_count, null, WPRSS_LOG_LEVEL_NOTICE );
|
141 |
}
|
142 |
|
143 |
+
update_post_meta( $feed_ID, 'wprss_last_update', $last_update_time = time() );
|
144 |
+
wprss_log_obj( 'Last import time updated', $last_update_time, null, WPRSS_LOG_LEVEL_SYSTEM );
|
145 |
|
146 |
// Insert the items into the db
|
147 |
if ( !empty( $items_to_insert ) ) {
|
148 |
+
wprss_log_obj( 'There are items to insert', count($items_to_insert), null, WPRSS_LOG_LEVEL_INFO );
|
149 |
wprss_items_insert_post( $items_to_insert, $feed_ID );
|
150 |
}
|
151 |
} else {
|
153 |
}
|
154 |
|
155 |
$next_scheduled = get_post_meta( $feed_ID, 'wprss_reschedule_event', TRUE );
|
156 |
+
|
157 |
if ( $next_scheduled !== '' ) {
|
158 |
wprss_feed_source_update_start_schedule( $feed_ID );
|
159 |
delete_post_meta( $feed_ID, 'wprss_reschedule_event' );
|
160 |
+
wprss_log( 'Next update rescheduled', null, WPRSS_LOG_LEVEL_SYSTEM );
|
161 |
}
|
162 |
|
163 |
delete_post_meta( $feed_ID, 'wprss_feed_is_updating' );
|
164 |
+
wprss_log_obj( 'Import complete', $feed_ID, __FUNCTION__, WPRSS_LOG_LEVEL_INFO );
|
165 |
}
|
166 |
|
167 |
|
401 |
* @since 3.0
|
402 |
*/
|
403 |
function wprss_items_insert_post( $items, $feed_ID ) {
|
404 |
+
update_post_meta( $feed_ID, 'wprss_feed_is_updating', $update_started_at = time() );
|
405 |
+
wprss_log_obj( 'Starting import of items for feed ' . $feed_ID, $update_started_at, null, WPRSS_LOG_LEVEL_INFO );
|
406 |
|
407 |
// Gather the permalinks of existing feed item's related to this feed source
|
408 |
$existing_permalinks = get_existing_permalinks( $feed_ID );
|
414 |
|
415 |
// Normalize the URL
|
416 |
$permalink = wprss_normalize_permalink( $item->get_permalink() );
|
417 |
+
wprss_log_obj( 'Importing item', $permalink, null, WPRSS_LOG_LEVEL_INFO );
|
418 |
+
wprss_log_obj( 'Original permalink', $item->get_permalink(), null, WPRSS_LOG_LEVEL_SYSTEM );
|
419 |
|
420 |
// Save the enclosure URL
|
421 |
$enclosure_url = '';
|
422 |
if ( $enclosure = $item->get_enclosure(0) ) {
|
423 |
+
wprss_log( 'Item has an enclosure', null, WPRSS_LOG_LEVEL_SYSTEM );
|
424 |
if ( $enclosure->get_link() ) {
|
425 |
$enclosure_url = $enclosure->get_link();
|
426 |
+
wprss_log_obj( 'Enclosure has link', $enclosure_url, null, WPRSS_LOG_LEVEL_SYSTEM );
|
427 |
}
|
428 |
}
|
429 |
|
436 |
// Check if newly fetched item already present in existing feed items,
|
437 |
// if not insert it into wp_posts and insert post meta.
|
438 |
if ( ! ( in_array( $permalink, $existing_permalinks ) ) ) {
|
439 |
+
wprss_log( 'Importing unique item', null, WPRSS_LOG_LEVEL_INFO );
|
440 |
|
441 |
// Apply filters that determine if the feed item should be inserted into the DB or not.
|
442 |
$item = apply_filters( 'wprss_insert_post_item_conditionals', $item, $feed_ID, $permalink );
|
446 |
|
447 |
// If the item is not NULL, continue to inserting the feed item post into the DB
|
448 |
if ( $item !== NULL && !is_bool($item) ) {
|
449 |
+
wprss_log( 'Using core logic', null, WPRSS_LOG_LEVEL_SYSTEM );
|
450 |
+
|
451 |
// Get the date and GTM date and normalize if not valid dor not present
|
452 |
$format = 'Y-m-d H:i:s';
|
453 |
$has_date = $item->get_date( 'U' ) ? TRUE : FALSE;
|
467 |
),
|
468 |
$item
|
469 |
);
|
470 |
+
wprss_log( 'Post data filters applied', null, WPRSS_LOG_LEVEL_SYSTEM );
|
471 |
|
472 |
if ( defined('ICL_SITEPRESS_VERSION') )
|
473 |
@include_once( WP_PLUGIN_DIR . '/sitepress-multilingual-cms/inc/wpml-api.php' );
|
474 |
+
if ( defined('ICL_LANGUAGE_CODE') ) {
|
475 |
$_POST['icl_post_language'] = $language_code = ICL_LANGUAGE_CODE;
|
476 |
+
wprss_log_obj( 'WPML detected. Language code determined', $language_code, null, WPRSS_LOG_LEVEL_SYSTEM );
|
477 |
+
}
|
478 |
|
479 |
// Create and insert post object into the DB
|
480 |
$inserted_ID = wp_insert_post( $feed_item );
|
498 |
|
499 |
// Remember newly added permalink
|
500 |
$existing_permalinks[] = $permalink;
|
501 |
+
wprss_log_obj( 'Item imported', $inserted_ID, null, WPRSS_LOG_LEVEL_INFO );
|
502 |
}
|
503 |
else {
|
504 |
update_post_meta( $source, "wprss_error_last_import", "true" );
|
511 |
$items_inserted++;
|
512 |
}
|
513 |
}
|
514 |
+
else {
|
515 |
+
wprss_log( 'Item already exists and will be skipped', null, WPRSS_LOG_LEVEL_NOTICE );
|
516 |
+
}
|
517 |
+
|
518 |
+
wprss_log_obj( 'Finished importing item', $permalink, null, WPRSS_LOG_LEVEL_INFO );
|
519 |
}
|
520 |
|
521 |
update_post_meta( $feed_ID, 'wprss_last_update_items', $items_inserted );
|
522 |
+
wprss_log_obj( sprintf( 'Finished importing %1$d items for feed source', $items_inserted ), $feed_ID, null, WPRSS_LOG_LEVEL_INFO );
|
523 |
}
|
524 |
|
525 |
|
includes/feed-processing.php
CHANGED
@@ -120,14 +120,12 @@
|
|
120 |
function get_existing_permalinks( $feed_ID ) {
|
121 |
global $wpdb;
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
);
|
129 |
-
|
130 |
-
return $existing_permalinks;
|
131 |
}
|
132 |
|
133 |
|
120 |
function get_existing_permalinks( $feed_ID ) {
|
121 |
global $wpdb;
|
122 |
|
123 |
+
return $wpdb->get_col(
|
124 |
+
"SELECT q.`meta_value`
|
125 |
+
FROM {$wpdb->postmeta} AS p
|
126 |
+
JOIN {$wpdb->postmeta} AS q ON (q.`meta_key` = 'wprss_item_permalink' AND p.`post_id` = q.`post_id`)
|
127 |
+
WHERE p.`meta_key` = 'wprss_feed_id' AND p.`meta_value` = {$feed_ID}"
|
128 |
);
|
|
|
|
|
129 |
}
|
130 |
|
131 |
|
includes/licensing.php
CHANGED
@@ -16,7 +16,7 @@ function wprss_get_addons() {
|
|
16 |
*
|
17 |
* @since 4.4.5
|
18 |
*/
|
19 |
-
function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_license' ) {
|
20 |
// If no license argument was given
|
21 |
if ( $license_key === NULL ) {
|
22 |
// Get the license key
|
@@ -33,11 +33,13 @@ function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_
|
|
33 |
// data to send in our API request
|
34 |
$api_params = array(
|
35 |
'edd_action' => $action,
|
36 |
-
'license' => $license_key,
|
37 |
-
'item_name' => urlencode( $item_name_constant )
|
|
|
|
|
38 |
);
|
39 |
-
|
40 |
-
//
|
41 |
$response = wp_remote_get( add_query_arg( $api_params, $store_url_constant ) );
|
42 |
|
43 |
// If the response is an error, return the value in the DB
|
@@ -50,8 +52,12 @@ function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_
|
|
50 |
$license_statuses["{$addon}_license_status"] = $license_data->license;
|
51 |
update_option( 'wprss_settings_license_statuses', $license_statuses );
|
52 |
|
53 |
-
// Return
|
54 |
-
return
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
|
@@ -60,8 +66,8 @@ function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_
|
|
60 |
*
|
61 |
* @since 4.4.5
|
62 |
*/
|
63 |
-
function wprss_edd_check_license( $addon, $license_key = NULL ) {
|
64 |
-
return wprss_edd_licensing_api( $addon, $license_key, 'check_license' );
|
65 |
}
|
66 |
|
67 |
|
@@ -199,8 +205,10 @@ function wprss_license_key_field( $args ) {
|
|
199 |
*/
|
200 |
function wprss_activate_license_button( $args ) {
|
201 |
$addon_id = $args[0];
|
202 |
-
$
|
|
|
203 |
if ( $status === 'site_inactive' ) $status = 'inactive';
|
|
|
204 |
|
205 |
$valid = $status == 'valid';
|
206 |
$btn_text = $valid ? 'Deactivate License' : 'Activate License';
|
@@ -223,6 +231,28 @@ function wprss_activate_license_button( $args ) {
|
|
223 |
</span>
|
224 |
</span>
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
<style type="text/css">
|
227 |
.wprss-<?php echo $addon_id; ?>-license-valid {
|
228 |
color: green;
|
16 |
*
|
17 |
* @since 4.4.5
|
18 |
*/
|
19 |
+
function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_license', $return = 'license' ) {
|
20 |
// If no license argument was given
|
21 |
if ( $license_key === NULL ) {
|
22 |
// Get the license key
|
33 |
// data to send in our API request
|
34 |
$api_params = array(
|
35 |
'edd_action' => $action,
|
36 |
+
'license' => sanitize_text_field( $license_key ),
|
37 |
+
'item_name' => urlencode( $item_name_constant ),
|
38 |
+
'url' => urlencode( network_site_url() ),
|
39 |
+
'time' => time(),
|
40 |
);
|
41 |
+
|
42 |
+
// Send the request to the API
|
43 |
$response = wp_remote_get( add_query_arg( $api_params, $store_url_constant ) );
|
44 |
|
45 |
// If the response is an error, return the value in the DB
|
52 |
$license_statuses["{$addon}_license_status"] = $license_data->license;
|
53 |
update_option( 'wprss_settings_license_statuses', $license_statuses );
|
54 |
|
55 |
+
// Return the data
|
56 |
+
if ( strtoupper( $return ) === 'ALL' ) {
|
57 |
+
return $license_data;
|
58 |
+
} else {
|
59 |
+
return $license_data->$return;
|
60 |
+
}
|
61 |
}
|
62 |
|
63 |
|
66 |
*
|
67 |
* @since 4.4.5
|
68 |
*/
|
69 |
+
function wprss_edd_check_license( $addon, $license_key = NULL, $return = 'license' ) {
|
70 |
+
return wprss_edd_licensing_api( $addon, $license_key, 'check_license', $return );
|
71 |
}
|
72 |
|
73 |
|
205 |
*/
|
206 |
function wprss_activate_license_button( $args ) {
|
207 |
$addon_id = $args[0];
|
208 |
+
$data = wprss_edd_check_license( $addon_id, NULL, 'ALL' );
|
209 |
+
$status = $data->license;
|
210 |
if ( $status === 'site_inactive' ) $status = 'inactive';
|
211 |
+
if ( $status === 'item_name_mismatch' ) $status = 'invalid';
|
212 |
|
213 |
$valid = $status == 'valid';
|
214 |
$btn_text = $valid ? 'Deactivate License' : 'Activate License';
|
231 |
</span>
|
232 |
</span>
|
233 |
|
234 |
+
<p>
|
235 |
+
<?php
|
236 |
+
$license_key = wprss_get_license_key( $addon_id );
|
237 |
+
$acts_current = $data->site_count;
|
238 |
+
$acts_left = $data->activations_left;
|
239 |
+
$acts_limit = $data->license_limit;
|
240 |
+
$expires = $data->expires;
|
241 |
+
$expires = substr( $expires, 0, strpos( $expires, " " ) );
|
242 |
+
if ( ! empty( $license_key ) ) : ?>
|
243 |
+
<small>
|
244 |
+
<strong>Activations:</strong>
|
245 |
+
<?php echo $acts_current.'/'.$acts_limit; ?> (<?php echo $acts_left; ?> left)
|
246 |
+
<br/>
|
247 |
+
<strong>Expires on:</strong>
|
248 |
+
<code><?php echo $expires; ?></code>
|
249 |
+
<br/>
|
250 |
+
<strong>Registered to:</strong>
|
251 |
+
<?php echo $data->customer_name; ?> (<code><?php echo $data->customer_email; ?></code>)
|
252 |
+
</small>
|
253 |
+
<?php endif; ?>
|
254 |
+
</p>
|
255 |
+
|
256 |
<style type="text/css">
|
257 |
.wprss-<?php echo $addon_id; ?>-license-valid {
|
258 |
color: green;
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.wprssaggregator.com
|
|
5 |
Tags: rss, feeds, aggregation, rss to post, autoblog aggregator, rss import, feed aggregator, rss aggregator, multiple rss feeds, multi rss feeds, rss multi importer, feed import, feed import, multiple feed import, feed aggregation, rss feader, feed reader, feed to post, multiple feeds, multi feed importer, multi feed import, multi import, autoblogging, autoblogger
|
6 |
Requires at least: 3.3
|
7 |
Tested up to: 4.0
|
8 |
-
Stable tag: 4.6.
|
9 |
License: GPLv2 or later
|
10 |
The no.1 RSS feed importer for WordPress. Premium add-ons available for more functionality.
|
11 |
|
@@ -54,6 +54,8 @@ Add-Ons that add more functionality to the core plugin are [available for purcha
|
|
54 |
* [WordAi](http://www.wprssaggregator.com/extension/wordai/) - WordAi allows users to take an RSS feed and turn it into new content that is both completely unique and completely readable.
|
55 |
* [Full Text RSS Feeds](http://www.wprssaggregator.com/extension/full-text-rss-feeds/) - connectivity to our Full Text Premium service, which gives you unlimited feed items returned per feed source.
|
56 |
|
|
|
|
|
57 |
= Demo =
|
58 |
The core plugin can be seen in use on the [demo page](http://www.wprssaggregator.com/demo/).
|
59 |
|
@@ -165,6 +167,14 @@ The full documentation section can be found on the [WP RSS Aggregator website](w
|
|
165 |
|
166 |
== Changelog ==
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
= 4.6.1 (2014-10-06) =
|
169 |
* Enhanced: Improved internationalization in the plugin, for better translations.
|
170 |
* Fixed bug: If the feed source age limit was left empty, the global setting was used instead of ignoring the limit.
|
5 |
Tags: rss, feeds, aggregation, rss to post, autoblog aggregator, rss import, feed aggregator, rss aggregator, multiple rss feeds, multi rss feeds, rss multi importer, feed import, feed import, multiple feed import, feed aggregation, rss feader, feed reader, feed to post, multiple feeds, multi feed importer, multi feed import, multi import, autoblogging, autoblogger
|
6 |
Requires at least: 3.3
|
7 |
Tested up to: 4.0
|
8 |
+
Stable tag: 4.6.2
|
9 |
License: GPLv2 or later
|
10 |
The no.1 RSS feed importer for WordPress. Premium add-ons available for more functionality.
|
11 |
|
54 |
* [WordAi](http://www.wprssaggregator.com/extension/wordai/) - WordAi allows users to take an RSS feed and turn it into new content that is both completely unique and completely readable.
|
55 |
* [Full Text RSS Feeds](http://www.wprssaggregator.com/extension/full-text-rss-feeds/) - connectivity to our Full Text Premium service, which gives you unlimited feed items returned per feed source.
|
56 |
|
57 |
+
We also provide a [Feed Creator](http://createfeed.wprssaggregator.com) service, that allows you to generate RSS feeds from any webpage, even if it doesn't have its own RSS feed.
|
58 |
+
|
59 |
= Demo =
|
60 |
The core plugin can be seen in use on the [demo page](http://www.wprssaggregator.com/demo/).
|
61 |
|
167 |
|
168 |
== Changelog ==
|
169 |
|
170 |
+
= 4.6.2 (2014-10-15) =
|
171 |
+
* Enhanced: Improved plugin responsiveness.
|
172 |
+
* Enhanced: Updated some help text in tooltips with better explainations and added clarity.
|
173 |
+
* Enhanced: Optimized some old SQL queries.
|
174 |
+
* Enhanced: Added better debug logging.
|
175 |
+
* Enhanced: Added a new filter to modify the text shown before author names.
|
176 |
+
* Fixed bug: Licenses were not showing as active, even though they were activated.
|
177 |
+
|
178 |
= 4.6.1 (2014-10-06) =
|
179 |
* Enhanced: Improved internationalization in the plugin, for better translations.
|
180 |
* Fixed bug: If the feed source age limit was left empty, the global setting was used instead of ignoring the limit.
|
wp-rss-aggregator.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP RSS Aggregator
|
4 |
Plugin URI: http://www.wprssaggregator.com
|
5 |
Description: Imports and aggregates multiple RSS Feeds using SimplePie
|
6 |
-
Version: 4.6.
|
7 |
Author: Jean Galea
|
8 |
Author URI: http://www.wprssaggregator.com
|
9 |
License: GPLv2
|
@@ -29,7 +29,7 @@
|
|
29 |
|
30 |
/**
|
31 |
* @package WPRSSAggregator
|
32 |
-
* @version 4.6.
|
33 |
* @since 1.0
|
34 |
* @author Jean Galea <info@wprssaggregator.com>
|
35 |
* @copyright Copyright (c) 2012-2014, Jean Galea
|
@@ -43,7 +43,7 @@
|
|
43 |
|
44 |
// Set the version number of the plugin.
|
45 |
if( !defined( 'WPRSS_VERSION' ) )
|
46 |
-
define( 'WPRSS_VERSION', '4.6.
|
47 |
|
48 |
// Set the database version number of the plugin.
|
49 |
if( !defined( 'WPRSS_DB_VERSION' ) )
|
@@ -160,16 +160,7 @@
|
|
160 |
require_once ( WPRSS_INC . 'opml-importer.php' );
|
161 |
|
162 |
/* Load the admin debugging page file */
|
163 |
-
require_once ( WPRSS_INC . 'admin-debugging.php' );
|
164 |
-
|
165 |
-
/* Load the admin help file */
|
166 |
-
require_once ( WPRSS_INC . 'admin-help.php' );
|
167 |
-
|
168 |
-
/* Load the admin metaboxes help file */
|
169 |
-
require_once ( WPRSS_INC . 'admin-help-metaboxes.php' );
|
170 |
-
|
171 |
-
/* Load the admin settings help file */
|
172 |
-
require_once ( WPRSS_INC . 'admin-help-settings.php' );
|
173 |
|
174 |
/* Load the addons page file */
|
175 |
require_once ( WPRSS_INC . 'admin-addons.php' );
|
@@ -209,6 +200,18 @@
|
|
209 |
|
210 |
// Load the logging functions file
|
211 |
require_once ( WPRSS_INC . 'admin-log.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
|
214 |
register_activation_hook( __FILE__ , 'wprss_activate' );
|
3 |
Plugin Name: WP RSS Aggregator
|
4 |
Plugin URI: http://www.wprssaggregator.com
|
5 |
Description: Imports and aggregates multiple RSS Feeds using SimplePie
|
6 |
+
Version: 4.6.2
|
7 |
Author: Jean Galea
|
8 |
Author URI: http://www.wprssaggregator.com
|
9 |
License: GPLv2
|
29 |
|
30 |
/**
|
31 |
* @package WPRSSAggregator
|
32 |
+
* @version 4.6.2
|
33 |
* @since 1.0
|
34 |
* @author Jean Galea <info@wprssaggregator.com>
|
35 |
* @copyright Copyright (c) 2012-2014, Jean Galea
|
43 |
|
44 |
// Set the version number of the plugin.
|
45 |
if( !defined( 'WPRSS_VERSION' ) )
|
46 |
+
define( 'WPRSS_VERSION', '4.6.2', true );
|
47 |
|
48 |
// Set the database version number of the plugin.
|
49 |
if( !defined( 'WPRSS_DB_VERSION' ) )
|
160 |
require_once ( WPRSS_INC . 'opml-importer.php' );
|
161 |
|
162 |
/* Load the admin debugging page file */
|
163 |
+
require_once ( WPRSS_INC . 'admin-debugging.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
/* Load the addons page file */
|
166 |
require_once ( WPRSS_INC . 'admin-addons.php' );
|
200 |
|
201 |
// Load the logging functions file
|
202 |
require_once ( WPRSS_INC . 'admin-log.php' );
|
203 |
+
|
204 |
+
if ( !defined( 'WPRSS_LOG_LEVEL' ) )
|
205 |
+
define( 'WPRSS_LOG_LEVEL', WPRSS_LOG_LEVEL_ERROR );
|
206 |
+
|
207 |
+
/* Load the admin help file */
|
208 |
+
require_once ( WPRSS_INC . 'admin-help.php' );
|
209 |
+
|
210 |
+
/* Load the admin metaboxes help file */
|
211 |
+
require_once ( WPRSS_INC . 'admin-help-metaboxes.php' );
|
212 |
+
|
213 |
+
/* Load the admin settings help file */
|
214 |
+
require_once ( WPRSS_INC . 'admin-help-settings.php' );
|
215 |
|
216 |
|
217 |
register_activation_hook( __FILE__ , 'wprss_activate' );
|