|
@@ -1,49 +1,28 @@ |
|
1
|
1
|
<?php |
|
2
|
|
-/** |
|
3
|
|
- * feedwordpresssyndicationpage.class.php |
|
4
|
|
- * feedwordpress |
|
5
|
|
- * |
|
6
|
|
- * @author radgeek |
|
7
|
|
- */ |
|
8
|
|
-require_once dirname(__FILE__) . '/admin-ui.php'; |
|
9
|
|
-require_once dirname(__FILE__) . '/feedfinder.class.php'; |
|
2
|
+require_once(dirname(__FILE__) . '/admin-ui.php'); |
|
3
|
+require_once(dirname(__FILE__) . '/feedfinder.class.php'); |
|
10
|
4
|
|
|
11
|
5
|
################################################################################ |
|
12
|
6
|
## ADMIN MENU ADD-ONS: implement Dashboard management pages #################### |
|
13
|
7
|
################################################################################ |
|
14
|
8
|
|
|
15
|
|
-define( 'FWP_PROJECT_WEBSITE_URL', 'https://fwpplugin.com/' ); |
|
9
|
+define('FWP_UPDATE_CHECKED', 'Update Checked'); |
|
10
|
+define('FWP_UNSUB_CHECKED', 'Unsubscribe'); |
|
11
|
+define('FWP_DELETE_CHECKED', 'Delete'); |
|
12
|
+define('FWP_RESUB_CHECKED', 'Re-subscribe'); |
|
13
|
+define('FWP_SYNDICATE_NEW', 'Add →'); |
|
14
|
+define('FWP_UNSUB_FULL', 'Unsubscribe from selected feeds →'); |
|
15
|
+define('FWP_CANCEL_BUTTON', '× Cancel'); |
|
16
|
+define('FWP_CHECK_FOR_UPDATES', 'Update'); |
|
16
|
17
|
|
|
17
|
|
-define( 'FWP_UPDATE_CHECKED', 'Update Checked' ); |
|
18
|
|
-define( 'FWP_UNSUB_CHECKED', 'Unsubscribe' ); |
|
19
|
|
-define( 'FWP_DELETE_CHECKED', 'Delete' ); |
|
20
|
|
-define( 'FWP_RESUB_CHECKED', 'Re-subscribe' ); |
|
21
|
|
-define( 'FWP_SYNDICATE_NEW', 'Add →' ); |
|
22
|
|
-define( 'FWP_UNSUB_FULL', 'Unsubscribe from selected feeds →' ); |
|
23
|
|
-define( 'FWP_CANCEL_BUTTON', '× Cancel' ); |
|
24
|
|
-define( 'FWP_CHECK_FOR_UPDATES', 'Update' ); |
|
18
|
+class FeedWordPressSyndicationPage extends FeedWordPressAdminPage { |
|
19
|
+ function FeedWordPressSyndicationPage ($filename = NULL) { |
|
20
|
+ FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', /*link=*/ NULL); |
|
25
|
21
|
|
|
26
|
|
-/** |
|
27
|
|
- * Tab for the admin page where syndication is dealt with. |
|
28
|
|
- * |
|
29
|
|
- * @extends FeedWordPressAdminPage |
|
30
|
|
- * |
|
31
|
|
- * @uses MyPHP |
|
32
|
|
- * @uses FeedFinder |
|
33
|
|
- * @uses FeedWordPress |
|
34
|
|
- * @uses FeedWordPressCompatibility |
|
35
|
|
- * @uses FeedWordPressDiagnostic |
|
36
|
|
- */ |
|
37
|
|
-class FeedWordPressSyndicationPage extends FeedWordPressAdminPage |
|
38
|
|
-{ |
|
39
|
|
- public function __construct( $filename = NULL ) |
|
40
|
|
- { |
|
41
|
|
- parent::__construct( 'feedwordpresssyndication', /*link=*/ NULL ); |
|
42
|
|
- |
|
43
|
22
|
// No over-arching form element |
|
44
|
23
|
$this->dispatch = NULL; |
|
45
|
|
- if ( is_null( $filename ) ) : |
|
24
|
+ if (is_null($filename)) : |
|
46
|
25
|
$this->filename = __FILE__; |
|
47
|
26
|
else : |
|
48
|
27
|
$this->filename = $filename; |
|
49
|
28
|
endif; |
|
@@ -48,43 +27,22 @@ |
|
48
|
27
|
$this->filename = $filename; |
|
49
|
28
|
endif; |
|
50
|
29
|
} /* FeedWordPressSyndicationPage constructor */ |
|
51
|
30
|
|
|
52
|
|
- /** |
|
53
|
|
- * Stub function to comply with parent class. |
|
54
|
|
- * |
|
55
|
|
- * @return bool Always returns FALSE in this class. |
|
56
|
|
- */ |
|
57
|
|
- function has_link() |
|
58
|
|
- { |
|
59
|
|
- return false; |
|
60
|
|
- } /* FeedWordPressSyndicationPage::has_link() */ |
|
31
|
+ function has_link () { return false; } |
|
61
|
32
|
|
|
62
|
|
- /** @var array|null List of sources which gets initialised by $this->sources('Y') if it's still NULL */ |
|
63
|
33
|
var $_sources = NULL; |
|
64
|
34
|
|
|
65
|
|
- /** |
|
66
|
|
- * Builds _sources (list of visible or invisible links to sources of syndicated links) |
|
67
|
|
- * or returns existing _sources if it's already built. |
|
68
|
|
- * |
|
69
|
|
- * @param string $visibility Unknown flag which toggles source visibility |
|
70
|
|
- * |
|
71
|
|
- * @return array Constructed list of visible/invisible sources |
|
72
|
|
- * |
|
73
|
|
- * @uses FeedWordPress::syndicated_links() |
|
74
|
|
- * |
|
75
|
|
- */ |
|
76
|
|
- function sources( $visibility = 'Y' ) |
|
77
|
|
- { |
|
78
|
|
- if ( is_null( $this->_sources) ) : |
|
79
|
|
- $links = FeedWordPress::syndicated_links( array( "hide_invisible" => false ) ); |
|
80
|
|
- $this->_sources = array( "Y" => array(), "N" => array() ); |
|
81
|
|
- foreach ( $links as $link ) : |
|
35
|
+ function sources ($visibility = 'Y') { |
|
36
|
+ if (is_null($this->_sources)) : |
|
37
|
+ $links = FeedWordPress::syndicated_links(array("hide_invisible" => false)); |
|
38
|
+ $this->_sources = array("Y" => array(), "N" => array()); |
|
39
|
+ foreach ($links as $link) : |
|
82
|
40
|
$this->_sources[$link->link_visible][] = $link; |
|
83
|
41
|
endforeach; |
|
84
|
42
|
endif; |
|
85
|
43
|
$ret = ( |
|
86
|
|
- array_key_exists( $visibility, $this->_sources ) |
|
44
|
+ array_key_exists($visibility, $this->_sources) |
|
87
|
45
|
? $this->_sources[$visibility] |
|
88
|
46
|
: $this->_sources |
|
89
|
47
|
); |
|
90
|
48
|
return $ret; |
|
@@ -89,117 +47,34 @@ |
|
89
|
47
|
); |
|
90
|
48
|
return $ret; |
|
91
|
49
|
} /* FeedWordPressSyndicationPage::sources() */ |
|
92
|
50
|
|
|
93
|
|
- /** |
|
94
|
|
- * Toggles source visibility, using the side-effect of pseudo-getter $this->sources(...) method- |
|
95
|
|
- * |
|
96
|
|
- * @return string |
|
97
|
|
- * |
|
98
|
|
- * @uses FeedWordPress::param() |
|
99
|
|
- */ |
|
100
|
|
- function visibility_toggle() |
|
101
|
|
- { |
|
102
|
|
- $sources = $this->sources( '*' ); // return value unnecessary, it seems the code is just using the side-effect of initialising $this->_sources if it's uninitialised. (gwyneth 20230916) |
|
51
|
+ function visibility_toggle () { |
|
52
|
+ $sources = $this->sources('*'); |
|
103
|
53
|
|
|
104
|
54
|
$defaultVisibility = 'Y'; |
|
105
|
|
- if ( ( count( $this->sources( 'N' ) ) > 0 ) |
|
106
|
|
- and ( count( $this->sources( 'Y' ) ) == 0 ) ) : |
|
55
|
+ if ((count($this->sources('N')) > 0) |
|
56
|
+ and (count($this->sources('Y'))==0)) : |
|
107
|
57
|
$defaultVisibility = 'N'; |
|
108
|
58
|
endif; |
|
109
|
59
|
|
|
110
|
|
- // this may be output into HTML, and it should really only ever be Y or N... |
|
111
|
|
- $sVisibility = FeedWordPress::param( 'visibility', 'REQUEST', $defaultVisibility ); |
|
60
|
+ $visibility = ( |
|
61
|
+ isset($_REQUEST['visibility']) |
|
62
|
+ ? $_REQUEST['visibility'] |
|
63
|
+ : $defaultVisibility |
|
64
|
+ ); |
|
112
|
65
|
|
|
113
|
|
- // Ensure $sVisibility is treated as a string |
|
114
|
|
- $sVisibility = (string) $sVisibility; |
|
115
|
|
- |
|
116
|
|
- // Apply preg_replace to remove unwanted characters |
|
117
|
|
- $visibility = preg_replace('/[^YyNn]+/', '', $sVisibility); |
|
118
|
|
- |
|
119
|
|
- // If preg_replace fails or returns null, ensure $visibility is an empty string |
|
120
|
|
- $visibility = $visibility !== null ? $visibility : ''; |
|
121
|
|
- |
|
122
|
|
- return ( strlen( $visibility ) > 0 ? $visibility : $defaultVisibility ); |
|
66
|
+ return $visibility; |
|
123
|
67
|
} /* FeedWordPressSyndicationPage::visibility_toggle() */ |
|
124
|
68
|
|
|
125
|
|
- /** |
|
126
|
|
- * Shows source feeds that are currently not visible. |
|
127
|
|
- * |
|
128
|
|
- * @return string |
|
129
|
|
- */ |
|
130
|
|
- function show_inactive() |
|
131
|
|
- { |
|
132
|
|
- return ( 'N' == $this->visibility_toggle() ); |
|
69
|
+ function show_inactive () { |
|
70
|
+ return ($this->visibility_toggle() == 'N'); |
|
133
|
71
|
} |
|
134
|
72
|
|
|
135
|
|
- /** |
|
136
|
|
- * sanitize_ids: Protect id numbers from untrusted sources (POST array etc.) |
|
137
|
|
- * from possibility of SQLi attacks. Runs everything through an intval filter |
|
138
|
|
- * and then for good measure through esc_sql() |
|
139
|
|
- * |
|
140
|
|
- * @param array $link_ids An array of one or more putative link IDs |
|
141
|
|
- * @return array |
|
142
|
|
- */ |
|
143
|
|
- public function sanitize_ids_sql( $link_ids ) { |
|
144
|
|
- $link_ids = array_map( |
|
145
|
|
- 'esc_sql', |
|
146
|
|
- array_map( |
|
147
|
|
- 'intval', |
|
148
|
|
- $link_ids |
|
149
|
|
- ) |
|
150
|
|
- ); |
|
151
|
|
- return $link_ids; |
|
152
|
|
- } /* FeedWordPressSyndicationPage::sanitize_ids_sql () */ |
|
153
|
|
- |
|
154
|
|
- /** |
|
155
|
|
- * requested_link_ids_sql() |
|
156
|
|
- * |
|
157
|
|
- * @return string An SQL list literal containing the link IDs, sanitized |
|
158
|
|
- * and escaped for direct use in MySQL queries. |
|
159
|
|
- * |
|
160
|
|
- * @uses sanitize_ids_sql() |
|
161
|
|
- * @uses sanitize_text_field() |
|
162
|
|
- * @uses MyPHP::post() |
|
163
|
|
- * @uses MyPHP::request() |
|
164
|
|
- * @uses FeedWordPress::post() |
|
165
|
|
- */ |
|
166
|
|
- public function requested_link_ids_sql() |
|
167
|
|
- { |
|
168
|
|
- // Multiple link IDs passed in link_ids[]=... |
|
169
|
|
- |
|
170
|
|
- $link_ids = array_map( |
|
171
|
|
- 'sanitize_text_field', |
|
172
|
|
- (array) MyPHP::request( 'link_ids', array() ) |
|
173
|
|
- ); |
|
174
|
|
- |
|
175
|
|
- // Or single in link_id=... |
|
176
|
|
- if ( ! is_null( MyPHP::request( 'link_id' ) ) ) : |
|
177
|
|
- array_push( $link_ids, sanitize_text_field( MyPHP::request( 'link_id' ) ) ); |
|
178
|
|
- endif; |
|
179
|
|
- |
|
180
|
|
- // Now use method to sanitize for safe use in MySQL queries. |
|
181
|
|
- $link_ids = $this->sanitize_ids_sql( $link_ids ); |
|
182
|
|
- |
|
183
|
|
- // Convert to MySQL list literal. |
|
184
|
|
- return "('" . implode( "', '", $link_ids ) . "')"; |
|
185
|
|
- } /* FeedWordPressSyndicationPage::requested_link_ids_sql () */ |
|
186
|
|
- |
|
187
|
|
- /** |
|
188
|
|
- * Returns the list of requested updates. |
|
189
|
|
- * |
|
190
|
|
- * @return array List of requested updates |
|
191
|
|
- * |
|
192
|
|
- * @uses MyPHP::post() |
|
193
|
|
- * @uses MyPHP::request() |
|
194
|
|
- * @uses FeedWordPress::post() |
|
195
|
|
- * @uses FeedWordPressDiagnostic::critical_bug() |
|
196
|
|
- */ |
|
197
|
|
- function updates_requested() |
|
198
|
|
- { |
|
73
|
+ function updates_requested () { |
|
199
|
74
|
global $wpdb; |
|
200
|
75
|
|
|
201
|
|
- if ( FeedWordPress::post( 'update' ) || FeedWordPress::post( 'action' ) || FeedWordPress::post( 'update_uri' ) ) : |
|
76
|
+ if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) : |
|
202
|
77
|
// Only do things with side-effects for HTTP POST or command line |
|
203
|
78
|
$fwp_update_invoke = 'post'; |
|
204
|
79
|
else : |
|
205
|
80
|
$fwp_update_invoke = 'get'; |
|
@@ -205,37 +80,31 @@ |
|
205
|
80
|
$fwp_update_invoke = 'get'; |
|
206
|
81
|
endif; |
|
207
|
82
|
|
|
208
|
83
|
$update_set = array(); |
|
209
|
|
- if ( $fwp_update_invoke != 'get' ) : |
|
210
|
|
- if ( is_array( MyPHP::post( 'link_ids' ) ) |
|
211
|
|
- and ( MyPHP::post( 'action' ) == FWP_UPDATE_CHECKED ) ) : |
|
212
|
|
- // Get single link ID or multiple link IDs from REQUEST parameters |
|
213
|
|
- // if available. Sanitize values for MySQL. |
|
214
|
|
- $link_list = $this->requested_link_ids_sql(); |
|
215
|
|
- |
|
216
|
|
- // $link_list has previously been sanitized for html by self::requested_link_ids_sql |
|
84
|
+ if ($fwp_update_invoke != 'get') : |
|
85
|
+ if (is_array(FeedWordPress::post('link_ids')) |
|
86
|
+ and (FeedWordPress::post('action')==FWP_UPDATE_CHECKED)) : |
|
217
|
87
|
$targets = $wpdb->get_results(" |
|
218
|
88
|
SELECT * FROM $wpdb->links |
|
219
|
|
- WHERE link_id IN {$link_list} |
|
89
|
+ WHERE link_id IN (".implode(",",$_POST['link_ids']).") |
|
220
|
90
|
"); |
|
221
|
|
- if ( is_array( $targets ) ) : |
|
91
|
+ if (is_array($targets)) : |
|
222
|
92
|
foreach ($targets as $target) : |
|
223
|
93
|
$update_set[] = $target->link_rss; |
|
224
|
94
|
endforeach; |
|
225
|
95
|
else : // This should never happen |
|
226
|
|
- FeedWordPressDiagnostic::critical_bug( 'fwp_syndication_manage_page::targets', $targets, __LINE__, __FILE__ ); |
|
96
|
+ FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__, __FILE__); |
|
227
|
97
|
endif; |
|
228
|
|
- elseif ( !is_null( FeedWordPress::post( 'update_uri' ) ) ) : |
|
229
|
|
- $targets = FeedWordPress::post( 'update_uri' ); |
|
230
|
|
- if ( !is_array( $targets ) ) : |
|
231
|
|
- $targets = array( $targets ); |
|
98
|
+ elseif (!is_null(FeedWordPress::post('update_uri'))) : |
|
99
|
+ $targets = FeedWordPress::post('update_uri'); |
|
100
|
+ if (!is_array($targets)) : |
|
101
|
+ $targets = array($targets); |
|
232
|
102
|
endif; |
|
233
|
|
- |
|
234
|
|
- $targets_keys = array_keys( $targets ); |
|
235
|
|
- $first_key = reset( $targets_keys ); |
|
236
|
|
- if ( !is_numeric( $first_key) ) : // URLs in keys |
|
237
|
|
- $targets = $targets_keys; |
|
103
|
+ |
|
104
|
+ $first = each($targets); |
|
105
|
+ if (!is_numeric($first['key'])) : // URLs in keys |
|
106
|
+ $targets = array_keys($targets); |
|
238
|
107
|
endif; |
|
239
|
108
|
$update_set = $targets; |
|
240
|
109
|
endif; |
|
241
|
110
|
endif; |
|
@@ -241,72 +110,25 @@ |
|
241
|
110
|
endif; |
|
242
|
111
|
return $update_set; |
|
243
|
112
|
} |
|
244
|
113
|
|
|
245
|
|
- /** |
|
246
|
|
- * Cancels the request. |
|
247
|
|
- * |
|
248
|
|
- * @return bool Success |
|
249
|
|
- * |
|
250
|
|
- * @uses FeedWordPress::post() |
|
251
|
|
- */ |
|
252
|
|
- public function cancel_requested() |
|
253
|
|
- { |
|
254
|
|
- $cancel = FeedWordPress::post( 'cancel' ); |
|
255
|
|
- return ( $cancel === __( FWP_CANCEL_BUTTON ) ); |
|
256
|
|
- } |
|
114
|
+ function accept_multiadd () { |
|
115
|
+ global $fwp_post; |
|
257
|
116
|
|
|
258
|
|
- /** |
|
259
|
|
- * Adds multiple requests. |
|
260
|
|
- * |
|
261
|
|
- * @return bool Success |
|
262
|
|
- * |
|
263
|
|
- * @uses FeedWordPress::post() |
|
264
|
|
- */ |
|
265
|
|
- public function multiadd_requested() |
|
266
|
|
- { |
|
267
|
|
- $multiadd = FeedWordPress::post( 'multiadd' ); |
|
268
|
|
- return ( $multiadd === FWP_SYNDICATE_NEW ); |
|
269
|
|
- } |
|
270
|
|
- |
|
271
|
|
- /** |
|
272
|
|
- * Confirms that multiple requests were added. |
|
273
|
|
- * |
|
274
|
|
- * @return bool Success |
|
275
|
|
- * |
|
276
|
|
- * @uses FeedWordPress::post() |
|
277
|
|
- */ |
|
278
|
|
- public function multiadd_confirm_requested() |
|
279
|
|
- { |
|
280
|
|
- $confirm = FeedWordPress::post( 'confirm' ); |
|
281
|
|
- return ( $confirm === 'multiadd' ); |
|
282
|
|
- } |
|
283
|
|
- |
|
284
|
|
- /** |
|
285
|
|
- * Accepts multiple requests that were added. |
|
286
|
|
- * |
|
287
|
|
- * @return bool Always true |
|
288
|
|
- * |
|
289
|
|
- * @uses FeedWordPress::post() |
|
290
|
|
- * @uses FeedWordPress::syndicate_link() |
|
291
|
|
- * @uses FeedWordPressCompatibility::validate_http_request() |
|
292
|
|
- */ |
|
293
|
|
- function accept_multiadd() |
|
294
|
|
- { |
|
295
|
|
- if ( $this->cancel_requested() ) : |
|
117
|
+ if (isset($fwp_post['cancel']) and $fwp_post['cancel']==__(FWP_CANCEL_BUTTON)) : |
|
296
|
118
|
return true; // Continue .... |
|
297
|
119
|
endif; |
|
298
|
|
- |
|
120
|
+ |
|
299
|
121
|
// If this is a POST, validate source and user credentials |
|
300
|
122
|
FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_feeds', /*capability=*/ 'manage_links'); |
|
301
|
123
|
|
|
302
|
|
- $in = FeedWordPress::post( 'multilookup', '' ) |
|
303
|
|
- . FeedWordPress::post( 'opml_lookup', '' ); |
|
304
|
|
- if ( $this->multiadd_confirm_requested() ) : |
|
305
|
|
- $chex = FeedWordPress::post( 'multilookup' ); |
|
124
|
+ $in = (isset($fwp_post['multilookup']) ? $fwp_post['multilookup'] : '') |
|
125
|
+ .(isset($fwp_post['opml_lookup']) ? $fwp_post['opml_lookup'] : ''); |
|
126
|
+ if (isset($fwp_post['confirm']) and $fwp_post['confirm']=='multiadd') : |
|
127
|
+ $chex = $fwp_post['multilookup']; |
|
306
|
128
|
$added = array(); $errors = array(); |
|
307
|
|
- foreach ( $chex as $feed ) : |
|
308
|
|
- if ( isset( $feed['add'] ) and $feed['add'] == 'yes' ) : |
|
129
|
+ foreach ($chex as $feed) : |
|
130
|
+ if (isset($feed['add']) and $feed['add']=='yes') : |
|
309
|
131
|
// Then, add in the URL. |
|
310
|
132
|
$link_id = FeedWordPress::syndicate_link( |
|
311
|
133
|
$feed['title'], |
|
312
|
134
|
$feed['link'], |
|
@@ -311,48 +133,43 @@ |
|
311
|
133
|
$feed['title'], |
|
312
|
134
|
$feed['link'], |
|
313
|
135
|
$feed['url'] |
|
314
|
136
|
); |
|
315
|
|
- if ( !empty( $link_id ) and !is_wp_error( $link_id ) ): |
|
316
|
|
- $added[] = $link_id; |
|
137
|
+ if ($link_id and !is_wp_error($link_id)): |
|
138
|
+ $added[] = $link_id; |
|
317
|
139
|
else : |
|
318
|
|
- $errors[] = array( $feed['url'], $link_id ); |
|
140
|
+ $errors[] = array($feed['url'], $link_id); |
|
319
|
141
|
endif; |
|
320
|
142
|
endif; |
|
321
|
143
|
endforeach; |
|
322
|
|
- |
|
144
|
+ |
|
323
|
145
|
print "<div class='updated'>\n"; |
|
324
|
|
- print "<p>Added " . count( $added ) . " new syndicated sources.</p>"; |
|
325
|
|
- if ( count( $errors ) > 0 ) : |
|
146
|
+ print "<p>Added ".count($added)." new syndicated sources.</p>"; |
|
147
|
+ if (count($errors) > 0) : |
|
326
|
148
|
print "<p>FeedWordPress encountered errors trying to add the following sources:</p> |
|
327
|
149
|
<ul>\n"; |
|
328
|
150
|
foreach ($errors as $err) : |
|
329
|
151
|
$url = $err[0]; |
|
330
|
|
- $short = feedwordpress_display_url($url); |
|
331
|
|
- |
|
332
|
|
- printf( |
|
333
|
|
- '<li><a href="%s">%s</a>', |
|
334
|
|
- esc_url( $url ), |
|
335
|
|
- esc_html( $short ) |
|
336
|
|
- ); |
|
337
|
|
- |
|
338
|
|
- if ( is_wp_error( $err[1] ) ) : |
|
152
|
+ $short = esc_html(feedwordpress_display_url($url)); |
|
153
|
+ $url = esc_html($url); |
|
154
|
+ $wp = $err[1]; |
|
155
|
+ if (is_wp_error($err[1])) : |
|
339
|
156
|
$error = $err[1]; |
|
340
|
|
- printf( ' (<code>%s</code>)', esc_html( $error->get_error_messages() ) ); |
|
157
|
+ $mesg = " (<code>".$error->get_error_messages()."</code>)"; |
|
158
|
+ else : |
|
159
|
+ $mesg = ''; |
|
341
|
160
|
endif; |
|
342
|
|
- |
|
343
|
|
- print "</li>\n"; |
|
344
|
|
- |
|
161
|
+ print "<li><a href='$url'>$short</a>$mesg</li>\n"; |
|
345
|
162
|
endforeach; |
|
346
|
163
|
print "</ul>\n"; |
|
347
|
164
|
endif; |
|
348
|
165
|
print "</div>\n"; |
|
349
|
166
|
|
|
350
|
|
- elseif ( is_array( $in ) or strlen( $in ) > 0 ) : |
|
167
|
+ elseif (is_array($in) or strlen($in) > 0) : |
|
351
|
168
|
add_meta_box( |
|
352
|
169
|
/*id=*/ 'feedwordpress_multiadd_box', |
|
353
|
|
- /*title=*/ __( 'Add Feeds' ), |
|
354
|
|
- /*callback=*/ array( $this, 'multiadd_box' ), |
|
170
|
+ /*title=*/ __('Add Feeds'), |
|
171
|
+ /*callback=*/ array($this, 'multiadd_box'), |
|
355
|
172
|
/*page=*/ $this->meta_box_context(), |
|
356
|
173
|
/*context =*/ $this->meta_box_context() |
|
357
|
174
|
); |
|
358
|
175
|
endif; |
|
@@ -357,79 +174,56 @@ |
|
357
|
174
|
); |
|
358
|
175
|
endif; |
|
359
|
176
|
return true; // Continue... |
|
360
|
177
|
} |
|
178
|
+ |
|
179
|
+ function display_multiadd_line ($line) { |
|
180
|
+ $short_feed = esc_html(feedwordpress_display_url($line['feed'])); |
|
181
|
+ $feed = esc_html($line['feed']); |
|
182
|
+ $link = esc_html($line['link']); |
|
183
|
+ $title = esc_html($line['title']); |
|
184
|
+ $checked = $line['checked']; |
|
185
|
+ $i = esc_html($line['i']); |
|
186
|
+ |
|
187
|
+ print "<li><label><input type='checkbox' name='multilookup[$i][add]' value='yes' $checked /> |
|
188
|
+ $title</label> · <a href='$feed'>$short_feed</a>"; |
|
361
|
189
|
|
|
362
|
|
- /** |
|
363
|
|
- * Emits HTML for multiple added lines. |
|
364
|
|
- * |
|
365
|
|
- * @param array $line Line item to be displayed. |
|
366
|
|
- */ |
|
367
|
|
- function display_multiadd_line( $line ) |
|
368
|
|
- { |
|
369
|
|
- $short_feed = feedwordpress_display_url( $line['feed'] ); |
|
370
|
|
- $feed = $line['feed']; |
|
371
|
|
- $link = $line['link']; |
|
372
|
|
- $title = $line['title']; |
|
373
|
|
- $i = $line['i']; |
|
374
|
|
- |
|
375
|
|
- print "<li><label><input type='checkbox' name='multilookup[" . esc_attr( $i ) . "][add]' value='yes'"; |
|
376
|
|
- if ( strlen( $line['checked'] ) > 0 ) : |
|
377
|
|
- print ' checked="checked" '; |
|
190
|
+ if (isset($line['extra'])) : |
|
191
|
+ print " · ".esc_html($line['extra']); |
|
378
|
192
|
endif; |
|
379
|
|
- print "/> " . esc_html( $title ) . "</label> · <a href='" |
|
380
|
|
- . esc_url($feed) . "'>" . esc_html( $short_feed ) . "</a>"; |
|
381
|
|
- |
|
382
|
|
- if ( isset( $line['extra']) ) : |
|
383
|
|
- print " · " . esc_html( $line['extra'] ); |
|
384
|
|
- endif; |
|
385
|
|
- |
|
386
|
|
- print |
|
387
|
|
- "<input type='hidden' name='multilookup[" . esc_attr( $i ) . "][url]' value='" . esc_attr( $feed ) . "' /> |
|
388
|
|
- <input type='hidden' name='multilookup[" . esc_attr( $i ) . "][link]' value='" . esc_attr( $link ) . "' /> |
|
389
|
|
- <input type='hidden' name='multilookup[" . esc_attr( $i ) . "][title]' value='" . esc_attr( $title ) . "' /> |
|
390
|
|
- </li>\n"; |
|
391
|
|
- |
|
193
|
+ |
|
194
|
+ print "<input type='hidden' name='multilookup[$i][url]' value='$feed' /> |
|
195
|
+ <input type='hidden' name='multilookup[$i][link]' value='$link' /> |
|
196
|
+ <input type='hidden' name='multilookup[$i][title]' value='$title' /> |
|
197
|
+ </li>\n"; |
|
198
|
+ |
|
392
|
199
|
flush(); |
|
393
|
200
|
} |
|
394
|
201
|
|
|
395
|
|
- /** |
|
396
|
|
- * Emits HTML for the box that allows adding multiple sources. |
|
397
|
|
- * |
|
398
|
|
- * @param int $page Unknown and unused. |
|
399
|
|
- * @param string|null $box Unknown and unused. |
|
400
|
|
- * |
|
401
|
|
- * @return bool Always true |
|
402
|
|
- * |
|
403
|
|
- * @uses file_get_contents() |
|
404
|
|
- * @uses FeedFinder |
|
405
|
|
- * @uses FeedWordPress::fetch() |
|
406
|
|
- * @uses FeedWordPress::post() |
|
407
|
|
- * @uses FeedWordPressCompatibility::stamp_nonce() |
|
408
|
|
- */ |
|
409
|
|
- function multiadd_box($page, $box = NULL) |
|
410
|
|
- { |
|
202
|
+ function multiadd_box ($page, $box = NULL) { |
|
203
|
+ global $fwp_post; |
|
204
|
+ |
|
411
|
205
|
$localData = NULL; |
|
412
|
206
|
|
|
413
|
|
- if ( isset( $_FILES['opml_upload']['name'] ) |
|
414
|
|
- and ( strlen( $_FILES['opml_upload']['name'] ) > 0 ) ) : |
|
207
|
+ if (isset($_FILES['opml_upload']['name']) and |
|
208
|
+ (strlen($_FILES['opml_upload']['name']) > 0)) : |
|
415
|
209
|
$in = 'tag:localhost'; |
|
416
|
|
- |
|
417
|
|
- /*FIXME: check whether $_FILES['opml_upload']['error'] === UPLOAD_ERR_OK or not...*/ |
|
418
|
|
- $localData = file_get_contents( $_FILES['opml_upload']['tmp_name'] ); |
|
210
|
+ |
|
211
|
+ /*FIXME: check whether $_FILES['opml_upload']['error'] === UPLOAD_ERR_OK or not...*/ |
|
212
|
+ $localData = file_get_contents($_FILES['opml_upload']['tmp_name']); |
|
419
|
213
|
$merge_all = true; |
|
420
|
|
- elseif ( ! is_null( FeedWordPress::post( 'multilookup' ) ) ) : |
|
421
|
|
- $in = FeedWordPress::post( 'multilookup' ); |
|
214
|
+ elseif (isset($fwp_post['multilookup'])) : |
|
215
|
+ $in = $fwp_post['multilookup']; |
|
422
|
216
|
$merge_all = false; |
|
423
|
|
- elseif ( ! is_null( FeedWordPress::post( 'opml_lookup' ) ) ) : |
|
424
|
|
- $in = FeedWordPress::post( 'opml_lookup' ); |
|
217
|
+ elseif (isset($fwp_post['opml_lookup'])) : |
|
218
|
+ $in = $fwp_post['opml_lookup']; |
|
425
|
219
|
$merge_all = true; |
|
426
|
220
|
else : |
|
427
|
221
|
$in = ''; |
|
428
|
222
|
$merge_all = false; |
|
429
|
223
|
endif; |
|
430
|
|
- |
|
431
|
|
- if ( strlen( $in ) > 0 ) : |
|
224
|
+ |
|
225
|
+ if (strlen($in) > 0) : |
|
432
|
226
|
$lines = preg_split( |
|
433
|
227
|
"/\s+/", |
|
434
|
228
|
$in, |
|
435
|
229
|
/*no limit soldier*/ -1, |
|
@@ -437,42 +231,41 @@ |
|
437
|
231
|
); |
|
438
|
232
|
|
|
439
|
233
|
$i = 0; |
|
440
|
234
|
?> |
|
441
|
|
- <!-- Page: <? echo $page; ?> Box: <? echo $box ?: '(empty)'; ?> --> |
|
442
|
|
- <form id="multiadd-form" action="<?php print esc_attr( $this->form_action() ); ?>" method="post"> |
|
443
|
|
- <div><?php FeedWordPressCompatibility::stamp_nonce( 'feedwordpress_feeds' ); ?> |
|
444
|
|
- <input type="hidden" name="multiadd" value="<?php print esc_attr( FWP_SYNDICATE_NEW ); ?>" /> |
|
235
|
+ <form id="multiadd-form" action="<?php print $this->form_action(); ?>" method="post"> |
|
236
|
+ <div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> |
|
237
|
+ <input type="hidden" name="multiadd" value="<?php print FWP_SYNDICATE_NEW; ?>" /> |
|
445
|
238
|
<input type="hidden" name="confirm" value="multiadd" /> |
|
446
|
239
|
|
|
447
|
|
- <input type="hidden" name="multiadd" value="<?php print esc_attr( FWP_SYNDICATE_NEW ); ?>" /> |
|
240
|
+ <input type="hidden" name="multiadd" value="<?php print FWP_SYNDICATE_NEW; ?>" /> |
|
448
|
241
|
<input type="hidden" name="confirm" value="multiadd" /></div> |
|
449
|
242
|
|
|
450
|
243
|
<div id="multiadd-status"> |
|
451
|
|
- <p><img src="<?php print esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> |
|
452
|
|
- <?php esc_html_e( 'Looking up feed information...' ); ?></p> |
|
244
|
+ <p><img src="<?php print esc_url ( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> |
|
245
|
+ Looking up feed information...</p> |
|
453
|
246
|
</div> |
|
454
|
247
|
|
|
455
|
248
|
<div id="multiadd-buttons"> |
|
456
|
|
- <input type="submit" class="button" name="cancel" value="<?php esc_html_e( FWP_CANCEL_BUTTON ); ?>" /> |
|
457
|
|
- <input type="submit" class="button-primary" value="<?php esc_html_e( 'Subscribe to selected sources →' ); ?>" /> |
|
249
|
+ <input type="submit" class="button" name="cancel" value="<?php _e(FWP_CANCEL_BUTTON); ?>" /> |
|
250
|
+ <input type="submit" class="button-primary" value="<?php print _e('Subscribe to selected sources →'); ?>" /> |
|
458
|
251
|
</div> |
|
459
|
|
- |
|
460
|
|
- <p><?php esc_html_e( 'Here are the feeds that FeedWordPress has discovered from the addresses that you provided. To opt out of a subscription, unmark the checkbox next to the feed.' ); ?></p> |
|
461
|
|
- |
|
252
|
+ |
|
253
|
+ <p><?php _e('Here are the feeds that FeedWordPress has discovered from the addresses that you provided. To opt out of a subscription, unmark the checkbox next to the feed.'); ?></p> |
|
254
|
+ |
|
462
|
255
|
<?php |
|
463
|
256
|
print "<ul id=\"multiadd-list\">\n"; flush(); |
|
464
|
|
- foreach ( $lines as $line ) : |
|
465
|
|
- $url = trim( $line ); |
|
466
|
|
- if ( strlen( $url ) > 0) : |
|
257
|
+ foreach ($lines as $line) : |
|
258
|
+ $url = trim($line); |
|
259
|
+ if (strlen($url) > 0) : |
|
467
|
260
|
// First, use FeedFinder to check the URL. |
|
468
|
|
- if ( is_null( $localData ) ) : |
|
469
|
|
- $finder = new FeedFinder( $url, /*verify=*/ false, /*fallbacks=*/ 1 ); |
|
261
|
+ if (is_null($localData)) : |
|
262
|
+ $finder = new FeedFinder($url, /*verify=*/ false, /*fallbacks=*/ 1); |
|
470
|
263
|
else : |
|
471
|
|
- $finder = new FeedFinder( 'tag:localhost', /*verify=*/ false, /*fallbacks=*/ 1 ); |
|
472
|
|
- $finder->upload_data( $localData ); |
|
264
|
+ $finder = new FeedFinder('tag:localhost', /*verify=*/ false, /*fallbacks=*/ 1); |
|
265
|
+ $finder->upload_data($localData); |
|
473
|
266
|
endif; |
|
474
|
|
- |
|
267
|
+ |
|
475
|
268
|
$feeds = array_values( |
|
476
|
269
|
array_unique( |
|
477
|
270
|
$finder->find() |
|
478
|
271
|
) |
|
@@ -478,14 +271,20 @@ |
|
478
|
271
|
) |
|
479
|
272
|
); |
|
480
|
273
|
|
|
481
|
274
|
$found = false; |
|
482
|
|
- if ( count( $feeds ) > 0 ) : |
|
483
|
|
- foreach ( $feeds as $feed ) : |
|
484
|
|
- $pie = FeedWordPress::fetch( $feed ); |
|
485
|
|
- if ( !is_wp_error( $pie ) ) : |
|
275
|
+ if (count($feeds) > 0) : |
|
276
|
+ foreach ($feeds as $feed) : |
|
277
|
+ $pie = FeedWordPress::fetch($feed); |
|
278
|
+ if (!is_wp_error($pie)) : |
|
486
|
279
|
$found = true; |
|
487
|
|
- |
|
280
|
+ |
|
281
|
+ $short_feed = esc_html(feedwordpress_display_url($feed)); |
|
282
|
+ $feed = esc_html($feed); |
|
283
|
+ $title = esc_html($pie->get_title()); |
|
284
|
+ $checked = ' checked="checked"'; |
|
285
|
+ $link = esc_html($pie->get_link()); |
|
286
|
+ |
|
488
|
287
|
$this->display_multiadd_line(array( |
|
489
|
288
|
'feed' => $feed, |
|
490
|
289
|
'title' => $pie->get_title(), |
|
491
|
290
|
'link' => $pie->get_link(), |
|
@@ -491,27 +290,27 @@ |
|
491
|
290
|
'link' => $pie->get_link(), |
|
492
|
291
|
'checked' => ' checked="checked"', |
|
493
|
292
|
'i' => $i, |
|
494
|
293
|
)); |
|
495
|
|
- |
|
294
|
+ |
|
496
|
295
|
$i++; // Increment field counter |
|
497
|
|
- |
|
498
|
|
- if ( ! $merge_all ) : // Break out after first find |
|
296
|
+ |
|
297
|
+ if (!$merge_all) : // Break out after first find |
|
499
|
298
|
break; |
|
500
|
|
- endif; |
|
299
|
+ endif; |
|
501
|
300
|
endif; |
|
502
|
301
|
endforeach; |
|
503
|
302
|
endif; |
|
504
|
|
- |
|
505
|
|
- if ( ! $found ) : |
|
506
|
|
- $this->display_multiadd_line( array( |
|
303
|
+ |
|
304
|
+ if (!$found) : |
|
305
|
+ $this->display_multiadd_line(array( |
|
507
|
306
|
'feed' => $url, |
|
508
|
|
- 'title' => feedwordpress_display_url( $url ), |
|
509
|
|
- 'extra' => __(" [FeedWordPress couldn't detect any feeds for this URL.]" ), |
|
307
|
+ 'title' => feedwordpress_display_url($url), |
|
308
|
+ 'extra' => " [FeedWordPress couldn't detect any feeds for this URL.]", |
|
510
|
309
|
'link' => NULL, |
|
511
|
310
|
'checked' => '', |
|
512
|
311
|
'i' => $i, |
|
513
|
|
- ) ); |
|
312
|
+ )); |
|
514
|
313
|
$i++; // Increment field counter |
|
515
|
314
|
endif; |
|
516
|
315
|
endif; |
|
517
|
316
|
endforeach; |
|
@@ -517,71 +316,67 @@ |
|
517
|
316
|
endforeach; |
|
518
|
317
|
print "</ul>\n"; |
|
519
|
318
|
?> |
|
520
|
319
|
</form> |
|
521
|
|
- |
|
320
|
+ |
|
522
|
321
|
<script type="text/javascript"> |
|
523
|
|
- jQuery( document ).ready( function () { |
|
322
|
+ jQuery(document).ready( function () { |
|
524
|
323
|
// Hide it now that we're done. |
|
525
|
|
- jQuery( '#multiadd-status' ).fadeOut( 500 /*ms*/ ); |
|
324
|
+ jQuery('#multiadd-status').fadeOut(500 /*ms*/); |
|
526
|
325
|
} ); |
|
527
|
326
|
</script> |
|
528
|
327
|
<?php |
|
529
|
328
|
endif; |
|
530
|
|
- |
|
329
|
+ |
|
531
|
330
|
$this->_sources = NULL; // Force reload of sources list |
|
532
|
331
|
return true; // Continue |
|
533
|
332
|
} |
|
534
|
333
|
|
|
535
|
|
- /** |
|
536
|
|
- * Displays the main syndication page. |
|
537
|
|
- * |
|
538
|
|
- * @uses FeedWordPress::needs_upgrade() |
|
539
|
|
- * @uses FeedWordPress::param() |
|
540
|
|
- */ |
|
541
|
|
- function display() |
|
542
|
|
- { |
|
543
|
|
- if ( FeedWordPress::needs_upgrade() ) : |
|
334
|
+ function display () { |
|
335
|
+ global $wpdb; |
|
336
|
+ global $fwp_post; |
|
337
|
+ |
|
338
|
+ if (FeedWordPress::needs_upgrade()) : |
|
544
|
339
|
fwp_upgrade_page(); |
|
545
|
340
|
return; |
|
546
|
341
|
endif; |
|
547
|
|
- |
|
342
|
+ |
|
548
|
343
|
$cont = true; |
|
549
|
344
|
$dispatcher = array( |
|
550
|
|
- "feedfinder" => 'feedfinder_page', |
|
551
|
|
- FWP_SYNDICATE_NEW => 'feedfinder_page', |
|
552
|
|
- "switchfeed" => 'switchfeed_page', |
|
345
|
+ "feedfinder" => 'fwp_feedfinder_page', |
|
346
|
+ FWP_SYNDICATE_NEW => 'fwp_feedfinder_page', |
|
347
|
+ "switchfeed" => 'fwp_switchfeed_page', |
|
553
|
348
|
FWP_UNSUB_CHECKED => 'multidelete_page', |
|
554
|
349
|
FWP_DELETE_CHECKED => 'multidelete_page', |
|
555
|
350
|
'Unsubscribe' => 'multidelete_page', |
|
556
|
351
|
FWP_RESUB_CHECKED => 'multiundelete_page', |
|
557
|
352
|
); |
|
558
|
|
- |
|
559
|
|
- $act = FeedWordPress::param( 'action' ); |
|
560
|
|
- if ( isset( $dispatcher[ $act ] ) ) : |
|
561
|
|
- $method = $dispatcher[ $act ]; |
|
562
|
|
- if ( method_exists( $this, $method ) ) : |
|
353
|
+ |
|
354
|
+ $act = FeedWordPress::param('action'); |
|
355
|
+ if (isset($dispatcher[$act])) : |
|
356
|
+ $method = $dispatcher[$act]; |
|
357
|
+ if (method_exists($this, $method)) : |
|
563
|
358
|
$cont = $this->{$method}(); |
|
564
|
359
|
else : |
|
565
|
|
- $cont = call_user_func( $method ); |
|
360
|
+ $cont = call_user_func($method); |
|
566
|
361
|
endif; |
|
567
|
|
- elseif ( $this->multiadd_requested() ) : |
|
568
|
|
- $cont = $this->accept_multiadd(); |
|
362
|
+ elseif (isset($fwp_post['multiadd']) and $fwp_post['multiadd']==FWP_SYNDICATE_NEW) : |
|
363
|
+ $cont = $this->accept_multiadd($fwp_post); |
|
569
|
364
|
endif; |
|
365
|
+ |
|
366
|
+ if ($cont): |
|
367
|
+ $links = $this->sources('Y'); |
|
368
|
+ $potential_updates = (!$this->show_inactive() and (count($this->sources('Y')) > 0)); |
|
570
|
369
|
|
|
571
|
|
- if ( $cont ) : |
|
572
|
|
- $links = $this->sources( 'Y' ); // side-effect of getting _sources instantiated... (gwyneth 20230916) |
|
573
|
|
- $potential_updates = ( ! $this->show_inactive() and ( count( $this->sources( 'Y' ) ) > 0 ) ); |
|
574
|
|
- |
|
575
|
|
- $this->open_sheet( 'Syndicated Sites' ); |
|
370
|
+ $this->open_sheet('Syndicated Sites'); |
|
576
|
371
|
?> |
|
577
|
372
|
<div id="post-body"> |
|
578
|
373
|
<?php |
|
579
|
|
- if ( $potential_updates |
|
580
|
|
- or ( count( $this->updates_requested() ) > 0 ) ) : |
|
374
|
+ if ($potential_updates |
|
375
|
+ or (count($this->updates_requested()) > 0)) : |
|
581
|
376
|
add_meta_box( |
|
582
|
377
|
/*id=*/ 'feedwordpress_update_box', |
|
583
|
|
- /*title=*/ __( 'Update feeds now' ), |
|
378
|
+ /*title=*/ __('Update feeds now'), |
|
584
|
379
|
/*callback=*/ 'fwp_syndication_manage_page_update_box', |
|
585
|
380
|
/*page=*/ $this->meta_box_context(), |
|
586
|
381
|
/*context =*/ $this->meta_box_context() |
|
587
|
382
|
); |
|
@@ -587,25 +382,25 @@ |
|
587
|
382
|
); |
|
588
|
383
|
endif; |
|
589
|
384
|
add_meta_box( |
|
590
|
385
|
/*id=*/ 'feedwordpress_feeds_box', |
|
591
|
|
- /*title=*/ __( 'Syndicated sources' ), |
|
592
|
|
- /*callback=*/ array( $this, 'syndicated_sources_box' ), |
|
386
|
+ /*title=*/ __('Syndicated sources'), |
|
387
|
+ /*callback=*/ array($this, 'syndicated_sources_box'), |
|
593
|
388
|
/*page=*/ $this->meta_box_context(), |
|
594
|
389
|
/*context =*/ $this->meta_box_context() |
|
595
|
390
|
); |
|
596
|
391
|
|
|
597
|
|
- do_action( 'feedwordpress_admin_page_syndication_meta_boxes', $this ); |
|
392
|
+ do_action('feedwordpress_admin_page_syndication_meta_boxes', $this); |
|
598
|
393
|
?> |
|
599
|
|
- <div class="metabox-holder"> |
|
394
|
+ <div class="metabox-holder"> |
|
600
|
395
|
<?php |
|
601
|
|
- do_meta_boxes( $this->meta_box_context(), $this->meta_box_context(), $this ); |
|
396
|
+ fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); |
|
602
|
397
|
?> |
|
603
|
398
|
</div> <!-- class="metabox-holder" --> |
|
604
|
399
|
</div> <!-- id="post-body" --> |
|
605
|
|
- |
|
606
|
|
- <?php $this->close_sheet( /*dispatch=*/ NULL ); ?> |
|
607
|
|
- |
|
400
|
+ |
|
401
|
+ <?php $this->close_sheet(/*dispatch=*/ NULL); ?> |
|
402
|
+ |
|
608
|
403
|
<div style="display: none"> |
|
609
|
404
|
<div id="tags-input"></div> <!-- avoid JS error from WP 2.5 bug --> |
|
610
|
405
|
</div> |
|
611
|
406
|
<?php |
|
@@ -611,44 +406,40 @@ |
|
611
|
406
|
<?php |
|
612
|
407
|
endif; |
|
613
|
408
|
} /* FeedWordPressSyndicationPage::display () */ |
|
614
|
409
|
|
|
615
|
|
- /** |
|
616
|
|
- * Displays the dashboard box. |
|
617
|
|
- * |
|
618
|
|
- * @param int $page Unknown usage. |
|
619
|
|
- * @param array|null $box Unknown usage. |
|
620
|
|
- */ |
|
621
|
|
- function dashboard_box($page, $box = NULL) |
|
622
|
|
- { |
|
623
|
|
- $links = FeedWordPress::syndicated_links( array( "hide_invisible" => false ) ); // what is $links for? (gwyneth 20230916) |
|
624
|
|
- $sources = $this->sources( '*' ); // uses side-effects to initialise _sources (gwyneth 20230916) |
|
410
|
+ function dashboard_box ($page, $box = NULL) { |
|
411
|
+ global $fwp_path; |
|
625
|
412
|
|
|
626
|
|
- /** @var string what is this used for? (gwyneth 20230915) */ |
|
627
|
|
- $visibility = 'Y'; |
|
628
|
|
- $hrefPrefix = $this->form_action(); |
|
629
|
|
- $activeHref = $hrefPrefix . '&visibility=' . $visibility; |
|
630
|
|
- $inactiveHref = $hrefPrefix . '&visibility=N'; |
|
413
|
+ $links = FeedWordPress::syndicated_links(array("hide_invisible" => false)); |
|
414
|
+ $sources = $this->sources('*'); |
|
631
|
415
|
|
|
632
|
|
- $lastUpdate = get_option( 'feedwordpress_last_update_all', NULL ); |
|
633
|
|
- $automatic_updates = get_option( 'feedwordpress_automatic_updates', NULL ); |
|
634
|
|
- |
|
635
|
|
- /** @var string default value set here, to avoid having a else clause, but also to init the variable in the right scope. (gwyneth 20230915) */ |
|
636
|
|
- $update_setting = __( 'using a cron job or manual check-ins' ); |
|
637
|
|
- if ( 'init' == $automatic_updates ) : |
|
638
|
|
- $update_setting = __( 'automatically before page loads' ); |
|
639
|
|
- elseif ( 'shutdown' == $automatic_updates ) : |
|
640
|
|
- $update_setting = __( 'automatically after page loads' ); |
|
416
|
+ $visibility = 'Y'; |
|
417
|
+ $hrefPrefix = $this->form_action(); |
|
418
|
+ $activeHref = $hrefPrefix.'&visibility=Y'; |
|
419
|
+ $inactiveHref = $hrefPrefix.'&visibility=N'; |
|
420
|
+ |
|
421
|
+ $lastUpdate = get_option('feedwordpress_last_update_all', NULL); |
|
422
|
+ $automatic_updates = get_option('feedwordpress_automatic_updates', NULL); |
|
423
|
+ |
|
424
|
+ if ('init'==$automatic_updates) : |
|
425
|
+ $update_setting = 'automatically before page loads'; |
|
426
|
+ elseif ('shutdown'==$automatic_updates) : |
|
427
|
+ $update_setting = 'automatically after page loads'; |
|
428
|
+ else : |
|
429
|
+ $update_setting = 'using a cron job or manual check-ins'; |
|
641
|
430
|
endif; |
|
431
|
+ |
|
642
|
432
|
// Hey ho, let's go... |
|
643
|
433
|
?> |
|
644
|
|
- <div style="float: left; background: /* #F5F5F5 */ white; padding-top: 5px; padding-right: 5px;"><a href="<?php print esc_url( $this->form_action() ); ?>"><img src="<?php print esc_url( plugins_url( /* "feedwordpress.png" */ "assets/images/icon.svg", __FILE__ ) ); ?>" width="36px" height="36px" alt="FeedWordPress Logo" /></a></div> |
|
645
|
|
- <p class="info" style="margin-bottom: 0px; border-bottom: 1px dotted black;"><?php esc_html_e( 'Managed by' ); ?><a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>">FeedWordPress</a> |
|
646
|
|
- <?php print esc_html( FEEDWORDPRESS_VERSION ); ?>.</p> |
|
647
|
|
- <?php if ( FEEDWORDPRESS_BLEG ) : ?> |
|
648
|
|
- <p class="info" style="margin-top: 0px; font-style: italic; font-size: 75%; color: #666;"><?php esc_html_e( 'If you find this tool useful for your daily work, you can |
|
649
|
|
- contribute to ongoing support and development with '); ?> |
|
650
|
|
- <a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>donate/"><?php esc_html_e('a modest donation'); ?></a>.</p> |
|
434
|
+ <div style="float: left; background: #F5F5F5; padding-top: 5px; padding-right: 5px;"><a href="<?php print $this->form_action(); ?>"><img src="<?php print esc_html(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png'); ?>" alt="" /></a></div> |
|
435
|
+ |
|
436
|
+ <p class="info" style="margin-bottom: 0px; border-bottom: 1px dotted black;">Managed by <a href="http://feedwordpress.radgeek.com/">FeedWordPress</a> |
|
437
|
+ <?php print FEEDWORDPRESS_VERSION; ?>.</p> |
|
438
|
+ <?php if (FEEDWORDPRESS_BLEG) : ?> |
|
439
|
+ <p class="info" style="margin-top: 0px; font-style: italic; font-size: 75%; color: #666;">If you find this tool useful for your daily work, you can |
|
440
|
+ contribute to ongoing support and development with |
|
441
|
+ <a href="http://feedwordpress.radgeek.com/donate/">a modest donation</a>.</p> |
|
651
|
442
|
<br style="clear: left;" /> |
|
652
|
443
|
<?php endif; ?> |
|
653
|
444
|
|
|
654
|
445
|
<div class="feedwordpress-actions"> |
|
@@ -653,32 +444,32 @@ |
|
653
|
444
|
|
|
654
|
445
|
<div class="feedwordpress-actions"> |
|
655
|
446
|
<h4>Updates</h4> |
|
656
|
447
|
<ul class="options"> |
|
657
|
|
- <li><strong><?php esc_html_e( 'Scheduled:' ); ?></strong> <?php print esc_html($update_setting); ?> |
|
658
|
|
- (<a href="<?php print esc_url($this->form_action('feeds-page.php')); ?>"><?php esc_html_e( 'change setting' ); ?></a>)</li> |
|
448
|
+ <li><strong>Scheduled:</strong> <?php print $update_setting; ?> |
|
449
|
+ (<a href="<?php print $this->form_action('feeds-page.php'); ?>">change setting</a>)</li> |
|
659
|
450
|
|
|
660
|
|
- <li><?php if ( !is_null($lastUpdate)) : ?> |
|
661
|
|
- <strong><?php esc_html_e( 'Last checked:' );?></strong> <?php print esc_html(fwp_time_elapsed($lastUpdate)); ?> |
|
451
|
+ <li><?php if (!is_null($lastUpdate)) : ?> |
|
452
|
+ <strong>Last checked:</strong> <?php print fwp_time_elapsed($lastUpdate); ?> |
|
662
|
453
|
<?php else : ?> |
|
663
|
|
- <strong><?php esc_html_e( 'Last checked:' );?> </strong><?php esc_html_e( 'none yet' ); ?> |
|
454
|
+ <strong>Last checked:</strong> none yet |
|
664
|
455
|
<?php endif; ?> </li> |
|
665
|
456
|
|
|
666
|
457
|
</ul> |
|
667
|
458
|
</div> |
|
668
|
|
- |
|
459
|
+ |
|
669
|
460
|
<div class="feedwordpress-stats"> |
|
670
|
|
- <h4><?php esc_html_e( 'Subscriptions' ); ?></h4> |
|
461
|
+ <h4>Subscriptions</h4> |
|
671
|
462
|
<table> |
|
672
|
463
|
<tbody> |
|
673
|
464
|
<tr class="first"> |
|
674
|
|
- <td class="first b b-active"><a href="<?php print esc_url($activeHref); ?>"><?php print esc_html(count($sources['Y'])); ?></a></td> |
|
675
|
|
- <td class="t active"><a href="<?php print esc_url($activeHref); ?>"><?php esc_html_e( 'Active' ); ?></a></td> |
|
465
|
+ <td class="first b b-active"><a href="<?php print esc_html($activeHref); ?>"><?php print count($sources['Y']); ?></a></td> |
|
466
|
+ <td class="t active"><a href="<?php print esc_html($activeHref); ?>">Active</a></td> |
|
676
|
467
|
</tr> |
|
677
|
|
- |
|
468
|
+ |
|
678
|
469
|
<tr> |
|
679
|
|
- <td class="b b-inactive"><a href="<?php print esc_url($inactiveHref); ?>"><?php print esc_html(count($sources['N'])); ?></a></td> |
|
680
|
|
- <td class="t inactive"><a href="<?php print esc_url($inactiveHref); ?>"><?php esc_html_e( 'Inactive' ); ?></a></td> |
|
470
|
+ <td class="b b-inactive"><a href="<?php print esc_html($inactiveHref); ?>"><?php print count($sources['N']); ?></a></td> |
|
471
|
+ <td class="t inactive"><a href="<?php print esc_html($inactiveHref); ?>">Inactive</a></td> |
|
681
|
472
|
</tr> |
|
682
|
473
|
</table> |
|
683
|
474
|
</div> |
|
684
|
475
|
|
|
@@ -683,45 +474,36 @@ |
|
683
|
474
|
</div> |
|
684
|
475
|
|
|
685
|
476
|
<div id="add-single-uri"> |
|
686
|
477
|
<?php if (count($sources['Y']) > 0) : ?> |
|
687
|
|
- <form id="check-for-updates" action="<?php print esc_url( $this->form_action() ); ?>" method="POST"> |
|
688
|
|
- <div class="container"><input type="submit" class="button-primary" name"update" value="<?php print esc_attr(FWP_CHECK_FOR_UPDATES); ?>" /> |
|
478
|
+ <form id="check-for-updates" action="<?php print $this->form_action(); ?>" method="POST"> |
|
479
|
+ <div class="container"><input type="submit" class="button-primary" name"update" value="<?php print FWP_CHECK_FOR_UPDATES; ?>" /> |
|
689
|
480
|
<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> |
|
690
|
481
|
<input type="hidden" name="update_uri" value="*" /></div> |
|
691
|
482
|
</form> |
|
692
|
483
|
<?php endif; ?> |
|
693
|
|
- |
|
694
|
|
- <form id="syndicated-links" action="<?php print esc_url( $this->form_action() ); // TODO: needs to be checked, because it doesn't seem to be defined properly (gwyneth 20230915) ?>" method="post"> |
|
695
|
|
- <div class="container"><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> |
|
696
|
|
- <label for="add-uri">Add: |
|
697
|
|
- <input type="text" name="lookup" id="add-uri" placeholder="Source URL" |
|
698
|
|
- value="Source URL" style="width: 55%;" /></label> |
|
699
|
|
- |
|
700
|
|
- <?php FeedWordPressSettingsUI::magic_input_tip_js('add-uri'); ?> |
|
701
|
|
- <input type="hidden" name="action" value="<?php print esc_attr( FWP_SYNDICATE_NEW ); ?>" /> |
|
702
|
|
- <input style="vertical-align: middle;" type="image" src="<?php print esc_url(plugins_url('plus.png', __FILE__)); ?>" alt="<?php print esc_html(FWP_SYNDICATE_NEW); ?>" /></div> |
|
703
|
|
- </form> |
|
484
|
+ |
|
485
|
+ <form id="syndicated-links" action="<?php print $hrefPrefix; ?>&visibility=<?php print $visibility; ?>" method="post"> |
|
486
|
+ <div class="container"><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> |
|
487
|
+ <label for="add-uri">Add: |
|
488
|
+ <input type="text" name="lookup" id="add-uri" placeholder="Source URL" |
|
489
|
+ value="Source URL" style="width: 55%;" /></label> |
|
490
|
+ |
|
491
|
+ <?php FeedWordPressSettingsUI::magic_input_tip_js('add-uri'); ?> |
|
492
|
+ <input type="hidden" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /> |
|
493
|
+ <input style="vertical-align: middle;" type="image" src="<?php print WP_PLUGIN_URL.'/'.$fwp_path; ?>/plus.png" alt="<?php print FWP_SYNDICATE_NEW; ?>" /></div> |
|
494
|
+ </form> |
|
704
|
495
|
</div> <!-- id="add-single-uri" --> |
|
705
|
|
- |
|
496
|
+ |
|
706
|
497
|
<br style="clear: both;" /> |
|
707
|
|
- |
|
498
|
+ |
|
708
|
499
|
<?php |
|
709
|
500
|
} /* FeedWordPressSyndicationPage::dashboard_box () */ |
|
710
|
|
- |
|
711
|
|
- /** |
|
712
|
|
- * One of the status boxes for the FWP dashboard. |
|
713
|
|
- * |
|
714
|
|
- * @param mixed $page Unused |
|
715
|
|
- * @param mixed|null $box Unused |
|
716
|
|
- * * |
|
717
|
|
- * @uses FeedWordPress::syndicated_links() |
|
718
|
|
- * @uses FeedWordPressCompatibility::stamp_nonce() |
|
719
|
|
- * @uses FeedWordPressSettingsUI::magic_input_tip_js() |
|
720
|
|
- */ |
|
501
|
+ |
|
721
|
502
|
function syndicated_sources_box ($page, $box = NULL) { |
|
503
|
+ global $fwp_path; |
|
722
|
504
|
|
|
723
|
|
- $links = FeedWordPress::syndicated_links(array("hide_invisible" => false)); // what is $links for? (gwyneth 20230916) |
|
505
|
+ $links = FeedWordPress::syndicated_links(array("hide_invisible" => false)); |
|
724
|
506
|
$sources = $this->sources('*'); |
|
725
|
507
|
|
|
726
|
508
|
$visibility = $this->visibility_toggle(); |
|
727
|
509
|
$showInactive = $this->show_inactive(); |
|
@@ -726,62 +508,58 @@ |
|
726
|
508
|
$visibility = $this->visibility_toggle(); |
|
727
|
509
|
$showInactive = $this->show_inactive(); |
|
728
|
510
|
|
|
729
|
511
|
$hrefPrefix = $this->form_action(); |
|
730
|
|
- $formHref = sprintf( '%s&visibility=%s', $hrefPrefix, urlencode($visibility) ); |
|
731
|
512
|
?> |
|
732
|
513
|
<div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> |
|
733
|
514
|
<div class="tablenav"> |
|
734
|
515
|
|
|
735
|
516
|
<div id="add-multiple-uri" class="hide-if-js"> |
|
736
|
|
- <form action="<?php print esc_url( $formHref ); ?>" method="post"> |
|
517
|
+ <form action="<?php print $hrefPrefix; ?>&visibility=<?php print $visibility; ?>" method="post"> |
|
737
|
518
|
<div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> |
|
738
|
|
- <h4><?php esc_html_e( 'Add Multiple Sources' ); ?></h4> |
|
739
|
|
- <div><?php esc_html_e( 'Enter one feed or website URL per line. If a URL links to a website which provides multiple feeds, FeedWordPress will use the first one listed.' ); ?></div> |
|
519
|
+ <h4>Add Multiple Sources</h4> |
|
520
|
+ <div>Enter one feed or website URL per line. If a URL links to a website which provides multiple feeds, FeedWordPress will use the first one listed.</div> |
|
740
|
521
|
<div><textarea name="multilookup" rows="8" cols="60" |
|
741
|
522
|
style="vertical-align: top"></textarea></div> |
|
742
|
523
|
<div style="border-top: 1px dotted black; padding-top: 10px"> |
|
743
|
|
- <div class="alignright"><input type="submit" class="button-primary" name="multiadd" value="<?php print esc_attr(FWP_SYNDICATE_NEW); ?>" /></div> |
|
744
|
|
- <div class="alignleft"><input type="button" class="button-secondary" name="action" value="<?php print esc_attr(FWP_CANCEL_BUTTON); ?>" id="turn-off-multiple-sources" /></div> |
|
524
|
+ <div class="alignright"><input type="submit" class="button-primary" name="multiadd" value="<?php print FWP_SYNDICATE_NEW; ?>" /></div> |
|
525
|
+ <div class="alignleft"><input type="button" class="button-secondary" name="action" value="<?php print FWP_CANCEL_BUTTON; ?>" id="turn-off-multiple-sources" /></div> |
|
745
|
526
|
</div> |
|
746
|
527
|
</form> |
|
747
|
528
|
</div> <!-- id="add-multiple-uri" --> |
|
748
|
529
|
|
|
749
|
530
|
<div id="upload-opml" style="float: right" class="hide-if-js"> |
|
750
|
|
- <h4><?php esc_html_e( 'Import source list' ); ?></h4> |
|
751
|
|
- <p><?php esc_html_e( 'You can import a list of sources in OPML format, either by providing |
|
531
|
+ <h4>Import source list</h4> |
|
532
|
+ <p>You can import a list of sources in OPML format, either by providing |
|
752
|
533
|
a URL for the OPML document, or by uploading a copy from your |
|
753
|
|
- computer.' ); ?></p> |
|
754
|
|
- |
|
755
|
|
- <form enctype="multipart/form-data" action="<?php print esc_url( $formHref ); ?>" method="post"> |
|
534
|
+ computer.</p> |
|
535
|
+ |
|
536
|
+ <form enctype="multipart/form-data" action="<?php print $hrefPrefix; ?>&visibility=<?php print $visibility; ?>" method="post"> |
|
756
|
537
|
<div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?><input type="hidden" name="MAX_FILE_SIZE" value="100000" /></div> |
|
757
|
|
- <div style="clear: both"><label for="opml-lookup" style="float: left; width: 8.0em; margin-top: 5px;"><?php esc_html_e( 'From URL:' ); ?></label> <input type="text" id="opml-lookup" name="opml_lookup" value="OPML document" /></div> |
|
758
|
|
- <div style="clear: both"><label for="opml-upload" style="float: left; width: 8.0em; margin-top: 5px;"><?php esc_html_e( 'From file:' ); ?></label> <input type="file" id="opml-upload" name="opml_upload" /></div> |
|
759
|
|
- |
|
538
|
+ <div style="clear: both"><label for="opml-lookup" style="float: left; width: 8.0em; margin-top: 5px;">From URL:</label> <input type="text" id="opml-lookup" name="opml_lookup" value="OPML document" /></div> |
|
539
|
+ <div style="clear: both"><label for="opml-upload" style="float: left; width: 8.0em; margin-top: 5px;">From file:</label> <input type="file" id="opml-upload" name="opml_upload" /></div> |
|
540
|
+ |
|
760
|
541
|
<div style="border-top: 1px dotted black; padding-top: 10px"> |
|
761
|
|
- <div class="alignright"><input type="submit" class="button-primary" name="action" value="<?php print esc_html(FWP_SYNDICATE_NEW); ?>" /></div> |
|
762
|
|
- <div class="alignleft"><input type="button" class="button-secondary" name="action" value="<?php print esc_html(FWP_CANCEL_BUTTON); ?>" id="turn-off-opml-upload" /></div> |
|
542
|
+ <div class="alignright"><input type="submit" class="button-primary" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /></div> |
|
543
|
+ <div class="alignleft"><input type="button" class="button-secondary" name="action" value="<?php print FWP_CANCEL_BUTTON; ?>" id="turn-off-opml-upload" /></div> |
|
763
|
544
|
</div> |
|
764
|
545
|
</form> |
|
765
|
546
|
</div> <!-- id="upload-opml" --> |
|
766
|
|
- |
|
547
|
+ |
|
767
|
548
|
<div id="add-single-uri" class="alignright"> |
|
768
|
|
- <form id="syndicated-links" action="<?php print esc_url( $formHref ); ?>" method="post"> |
|
549
|
+ <form id="syndicated-links" action="<?php print $hrefPrefix; ?>&visibility=<?php print $visibility; ?>" method="post"> |
|
769
|
550
|
<div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> |
|
770
|
551
|
<ul class="subsubsub"> |
|
771
|
|
- <li><label for="add-uri"><?php esc_html_e( 'New source:' ); ?></label> |
|
552
|
+ <li><label for="add-uri">New source:</label> |
|
772
|
553
|
<input type="text" name="lookup" id="add-uri" value="Website or feed URI" /> |
|
773
|
|
- |
|
554
|
+ |
|
774
|
555
|
<?php FeedWordPressSettingsUI::magic_input_tip_js('add-uri'); FeedWordPressSettingsUI::magic_input_tip_js('opml-lookup'); ?> |
|
775
|
|
- |
|
556
|
+ |
|
776
|
557
|
<input type="hidden" name="action" value="feedfinder" /> |
|
777
|
|
- <input type="submit" class="button-secondary" name="action" value="<?php print esc_html( FWP_SYNDICATE_NEW ); ?>" /> |
|
778
|
|
- <div style="text-align: right; margin-right: 2.0em"> |
|
779
|
|
- <!-- Using WP Dashicon plus and down-arrow symbols below (gwyneth 20210717) --> |
|
780
|
|
- <a id="turn-on-multiple-sources" href="#add-multiple-uri"><span class="dashicons feedwordpress-dashicons dashicons-list-view"></span> <?php esc_html_e( 'add multiple' ); ?></a> |
|
781
|
|
- <span class="screen-reader-text"> or </span> |
|
782
|
|
- <a id="turn-on-opml-upload" href="#upload-opml"><span class="dashicons feedwordpress-dashicons dashicons-upload"></span> <?php esc_html_e( 'import source list' ); ?></a> |
|
783
|
|
- </div> |
|
558
|
+ <input type="submit" class="button-secondary" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /> |
|
559
|
+ <div style="text-align: right; margin-right: 2.0em"><a id="turn-on-multiple-sources" href="#add-multiple-uri"><img style="vertical-align: middle" src="<?php print WP_PLUGIN_URL.'/'.$fwp_path; ?>/down.png" alt="" /> add multiple</a> |
|
560
|
+ <span class="screen-reader-text"> or </span> |
|
561
|
+ <a id="turn-on-opml-upload" href="#upload-opml"><img src="<?php print WP_PLUGIN_URL.'/'.$fwp_path; ?>/plus.png" alt="" style="vertical-align: middle" /> import source list</a></div> |
|
784
|
562
|
</li> |
|
785
|
563
|
</ul> |
|
786
|
564
|
</form> |
|
787
|
565
|
</div> <!-- class="alignright" --> |
|
@@ -788,22 +566,22 @@ |
|
788
|
566
|
|
|
789
|
567
|
<div class="alignleft"> |
|
790
|
568
|
<?php |
|
791
|
569
|
if (count($sources[$visibility]) > 0) : |
|
792
|
|
- $this->manage_page_links_subsubsub($sources, $showInactive); |
|
570
|
+ fwp_syndication_manage_page_links_subsubsub($sources, $showInactive); |
|
793
|
571
|
endif; |
|
794
|
572
|
?> |
|
795
|
573
|
</div> <!-- class="alignleft" --> |
|
796
|
574
|
|
|
797
|
575
|
</div> <!-- class="tablenav" --> |
|
798
|
|
- |
|
799
|
|
- <form id="syndicated-links" action="<?php print esc_url( $formHref ); ?>" method="post"> |
|
576
|
+ |
|
577
|
+ <form id="syndicated-links" action="<?php print $hrefPrefix; ?>&visibility=<?php print $visibility; ?>" method="post"> |
|
800
|
578
|
<div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> |
|
801
|
|
- |
|
579
|
+ |
|
802
|
580
|
<?php if ($showInactive) : ?> |
|
803
|
581
|
<div style="clear: right" class="alignright"> |
|
804
|
|
- <p style="font-size: smaller; font-style: italic"><?php esc_html_e( 'FeedWordPress used to syndicate |
|
805
|
|
- posts from these sources, but you have unsubscribed from them.' ); ?></p> |
|
582
|
+ <p style="font-size: smaller; font-style: italic">FeedWordPress used to syndicate |
|
583
|
+ posts from these sources, but you have unsubscribed from them.</p> |
|
806
|
584
|
</div> |
|
807
|
585
|
<?php |
|
808
|
586
|
endif; |
|
809
|
587
|
?> |
|
@@ -811,11 +589,13 @@ |
|
811
|
589
|
<?php |
|
812
|
590
|
if (count($sources[$visibility]) > 0) : |
|
813
|
591
|
$this->display_button_bar($showInactive); |
|
814
|
592
|
else : |
|
815
|
|
- $this->manage_page_links_subsubsub($sources, $showInactive); |
|
593
|
+ ?> |
|
594
|
+ <?php fwp_syndication_manage_page_links_subsubsub($sources, $showInactive); ?> |
|
595
|
+ <?php |
|
816
|
596
|
endif; |
|
817
|
|
- |
|
597
|
+ |
|
818
|
598
|
fwp_syndication_manage_page_links_table_rows($sources[$visibility], $this, $visibility); |
|
819
|
599
|
$this->display_button_bar($showInactive); |
|
820
|
600
|
?> |
|
821
|
601
|
</form> |
|
@@ -820,177 +600,118 @@ |
|
820
|
600
|
?> |
|
821
|
601
|
</form> |
|
822
|
602
|
<?php |
|
823
|
603
|
} /* FeedWordPressSyndicationPage::syndicated_sources_box() */ |
|
824
|
|
- |
|
825
|
|
- /** |
|
826
|
|
- * Handles subpages on syndication dashboard (showing active/inactive feeds). |
|
827
|
|
- * |
|
828
|
|
- * @param array $sources List of feed URLs (active or inactive). |
|
829
|
|
- * @param bool $showInactive True if we're showing the inactive feeds. |
|
830
|
|
- * |
|
831
|
|
- */ |
|
832
|
|
- function manage_page_links_subsubsub( $sources, $showInactive ) { |
|
833
|
|
- $hrefPrefix = $this->admin_page_href( "syndication.php" ); |
|
834
|
|
- $hrefY = sprintf( "%s&visibility=%s", $hrefPrefix, "Y" ); |
|
835
|
|
- $hrefN = sprintf( "%s&visibility=%s", $hrefPrefix, "N" ); |
|
836
|
|
-?> |
|
837
|
|
- <ul class="subsubsub"> |
|
838
|
|
- <li><a <?php if ( ! $showInactive ) : ?>class="current" <?php endif; ?>href="<?php print esc_url( $hrefY ); ?>"><?php esc_html_e( 'Subscribed' ); ?> |
|
839
|
|
- <span class="count">(<?php print count( $sources['Y'] ); ?>)</span></a></li> |
|
840
|
|
- <?php if ( $showInactive or ( count( $sources['N'] ) > 0 ) ) : ?> |
|
841
|
|
- <li><a <?php if ( $showInactive ) : ?>class="current" <?php endif; ?>href="<?php print esc_url( $hrefN ); ?>"><?php esc_html_e( 'Inactive' ); ?></a> |
|
842
|
|
- <span class="count">(<?php print count( $sources['N'] ); ?>)</span></a></li> |
|
843
|
|
- <?php endif; ?> |
|
844
|
|
- |
|
845
|
|
- </ul> <!-- class="subsubsub" --> |
|
846
|
|
-<?php |
|
847
|
|
- } /* FeedWordPressSyndicationPage::manage_page_links_subsubsub() */ |
|
848
|
|
- |
|
849
|
|
- /** |
|
850
|
|
- * Displays the button bar showing options per feed. |
|
851
|
|
- * |
|
852
|
|
- * @param bool $showInactive True if we're showing inactive feeds. |
|
853
|
|
- */ |
|
854
|
|
- function display_button_bar( $showInactive ) { |
|
604
|
+ |
|
605
|
+ function display_button_bar ($showInactive) { |
|
855
|
606
|
?> |
|
856
|
607
|
<div style="clear: left" class="alignleft"> |
|
857
|
|
- <?php if ( $showInactive ) : ?> |
|
858
|
|
- <input class="button-secondary" type="submit" name="action" value="<?php print esc_attr( FWP_RESUB_CHECKED ); ?>" /> |
|
859
|
|
- <input class="button-secondary" type="submit" name="action" value="<?php print esc_attr( FWP_DELETE_CHECKED ); ?>" /> |
|
608
|
+ <?php if ($showInactive) : ?> |
|
609
|
+ <input class="button-secondary" type="submit" name="action" value="<?php print FWP_RESUB_CHECKED; ?>" /> |
|
610
|
+ <input class="button-secondary" type="submit" name="action" value="<?php print FWP_DELETE_CHECKED; ?>" /> |
|
860
|
611
|
<?php else : ?> |
|
861
|
|
- <input class="button-secondary" type="submit" name="action" value="<?php print esc_attr( FWP_UPDATE_CHECKED ); ?>" /> |
|
862
|
|
- <input class="button-secondary delete" type="submit" name="action" value="<?php print esc_attr( FWP_UNSUB_CHECKED ); ?>" /> |
|
612
|
+ <input class="button-secondary" type="submit" name="action" value="<?php print FWP_UPDATE_CHECKED; ?>" /> |
|
613
|
+ <input class="button-secondary delete" type="submit" name="action" value="<?php print FWP_UNSUB_CHECKED; ?>" /> |
|
863
|
614
|
<?php endif ; ?> |
|
864
|
615
|
</div> <!-- class="alignleft" --> |
|
865
|
|
- |
|
616
|
+ |
|
866
|
617
|
<br class="clear" /> |
|
867
|
618
|
<?php |
|
868
|
619
|
} |
|
869
|
|
- |
|
870
|
|
- /** |
|
871
|
|
- * Displays page to thank user for donation. |
|
872
|
|
- * |
|
873
|
|
- * @param mixed $page Unused. |
|
874
|
|
- * @param mixed|null $box Unused. |
|
875
|
|
- */ |
|
876
|
|
- function bleg_thanks( $page, $box = NULL ) { |
|
620
|
+ |
|
621
|
+ function bleg_thanks ($page, $box = NULL) { |
|
877
|
622
|
?> |
|
878
|
623
|
<div class="donation-thanks"> |
|
879
|
|
- <h4><?php esc_html_e( 'Thank you!' ); ?></h4> |
|
880
|
|
- <p><strong><?php esc_html_e( 'Thank you' ); ?></strong> <?php esc_html_e( ' for your contribution to '); ?> |
|
881
|
|
- <a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>"><?php esc_html_e( 'FeedWordPress development' ); ?></a>. |
|
882
|
|
- <?php esc_html_e( 'Your generous gifts make ongoing support and development for |
|
883
|
|
- FeedWordPress possible.' ); ?></p> |
|
884
|
|
- <p><?php esc_html_e( 'If you have any questions about FeedWordPress, or if there |
|
624
|
+ <h4>Thank you!</h4> |
|
625
|
+ <p><strong>Thank you</strong> for your contribution to <a href="http://feedwordpress.radgeek.com/">FeedWordPress</a> development. |
|
626
|
+ Your generous gifts make ongoing support and development for |
|
627
|
+ FeedWordPress possible.</p> |
|
628
|
+ <p>If you have any questions about FeedWordPress, or if there |
|
885
|
629
|
is anything I can do to help make FeedWordPress more useful for |
|
886
|
|
- you, please '); ?><a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>contact"><?php esc_html_e( 'contact me' ); ?></a> |
|
887
|
|
- <?php esc_html_e(' and let me know what you’re thinking about.' ); ?></p> |
|
888
|
|
- <p class="signature">—<a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>">Charles Johnson</a>, <?php esc_html_e(' Developer' ); ?>, <a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>">FeedWordPress</a>.</p> |
|
630
|
+ you, please <a href="http://feedwordpress.radgeek.com/contact">contact me</a> |
|
631
|
+ and let me know what you're thinking about.</p> |
|
632
|
+ <p class="signature">—<a href="http://radgeek.com/">Charles Johnson</a>, Developer, <a href="http://feedwordpress.radgeek.com/">FeedWordPress</a>.</p> |
|
889
|
633
|
</div> |
|
890
|
634
|
<?php |
|
891
|
635
|
} /* FeedWordPressSyndicationPage::bleg_thanks () */ |
|
892
|
636
|
|
|
893
|
|
- /** |
|
894
|
|
- * Displays a donation form. |
|
895
|
|
- * |
|
896
|
|
- * @note Flattr unfortunately changed their business model :-( |
|
897
|
|
- * (gwyneth 20230917) |
|
898
|
|
- * |
|
899
|
|
- * @param mixed $page Unused. |
|
900
|
|
- * @param mixed|null $box Unused. |
|
901
|
|
- */ |
|
902
|
637
|
function bleg_box ($page, $box = NULL) { |
|
903
|
638
|
?> |
|
904
|
639
|
<div class="donation-form"> |
|
905
|
|
-<h4><?php esc_html_e( 'Consider a Donation to FeedWordPress' ); ?></h4> |
|
640
|
+<h4>Keep FeedWordPress improving</h4> |
|
906
|
641
|
<form action="https://www.paypal.com/cgi-bin/webscr" accept-charset="UTF-8" method="post"><div> |
|
907
|
|
-<p><a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>">FeedWordPress</a> <?php esc_html_e( 'makes syndication |
|
642
|
+<p><a href="http://feedwordpress.radgeek.com/">FeedWordPress</a> makes syndication |
|
908
|
643
|
simple and empowers you to stream content from all over the web into your |
|
909
|
|
-WordPress hub. If you’re finding FWP useful, ' ); ?> |
|
910
|
|
-<a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>donate/"><?php esc_html_e( 'a modest gift' ); ?></a> |
|
911
|
|
-<?php esc_html_e( ' is the best way to support steady progress on development, enhancements, |
|
912
|
|
-support, and documentation.' ); ?></p> |
|
913
|
|
- |
|
914
|
|
-<div class="donate" style="vertical-align: middle"> |
|
915
|
|
- |
|
916
|
|
-<div id="flattr-paypal"> |
|
917
|
|
- |
|
918
|
|
-<div class="hovered-component" style="display: inline-block; vertical-align: bottom"> |
|
919
|
|
-<a href="bitcoin:<?php print esc_attr( FEEDWORDPRESS_BLEG_BTC ); ?>"><img src="<?php print esc_url( plugins_url('/'.FeedWordPress::path('assets/images/btc-qr-128px.png') ) ); ?>" alt="<?php esc_html_e( 'Donate' ); ?>" /></a> |
|
920
|
|
-<div><a href="bitcoin:<?php print esc_attr( FEEDWORDPRESS_BLEG_BTC ); ?>"><?php esc_html_e( 'via' ); ?> bitcoin<span class="hover-on pop-over" style="background-color: #ddffdd; padding: 5px; color: black; border-radius: 5px;">bitcoin:<?php print esc_html( FEEDWORDPRESS_BLEG_BTC ); ?></span></a></div> |
|
921
|
|
-</div> |
|
922
|
|
- |
|
923
|
|
-<div style="display: inline-block; vertical-align: bottom"> |
|
924
|
|
-<input type="image" name="submit" src="<?php print esc_url( plugins_url( '/' . FeedWordPress::path('assets/images/paypal-donation-64px.png' ) ) ); ?>" style="width: 128px; height: 128px;" alt="<?php esc_html_e( 'Donate via PayPal' ); ?>" /> |
|
925
|
|
-<input type="hidden" name="business" value="<?php print esc_attr( FEEDWORDPRESS_BLEG_PAYPAL ); ?>" /> |
|
644
|
+WordPress hub. That's got to be worth a few lattes. If you're finding FWP useful, |
|
645
|
+<a href="http://feedwordpress.radgeek.com/donate/">a modest gift</a> |
|
646
|
+is the best way to support steady progress on development, enhancements, |
|
647
|
+support, and documentation.</p> |
|
648
|
+<div class="donate"> |
|
649
|
+<input type="hidden" name="business" value="commerce@radgeek.com" /> |
|
926
|
650
|
<input type="hidden" name="cmd" value="_xclick" /> |
|
927
|
|
-<input type="hidden" name="item_name" value="<?php esc_html_e( 'FeedWordPress donation' ); ?>" /> |
|
651
|
+<input type="hidden" name="item_name" value="FeedWordPress donation" /> |
|
928
|
652
|
<input type="hidden" name="no_shipping" value="1" /> |
|
929
|
|
-<input type="hidden" name="return" value="<?php print esc_attr( $this->admin_page_href( basename( $this->filename ), array( 'paid' => 'yes' ) ) ); ?>" /> |
|
653
|
+<input type="hidden" name="return" value="<?php print admin_url('admin.php'); ?>?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename($this->filename); ?>&paid=yes" /> |
|
930
|
654
|
<input type="hidden" name="currency_code" value="USD" /> |
|
931
|
|
-<input type="hidden" name="notify_url" value="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ); ?>/ipn/donation" /> |
|
655
|
+<input type="hidden" name="notify_url" value="http://feedwordpress.radgeek.com/ipn/donation" /> |
|
932
|
656
|
<input type="hidden" name="custom" value="1" /> |
|
933
|
|
-<div><?php esc_html_e( 'via PayPal' ); ?></div> |
|
934
|
|
-</div> <!-- style="display: inline-block" --> |
|
657
|
+<input type="image" name="submit" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" alt="Donate through PayPal" /> |
|
658
|
+</div> |
|
659
|
+</div></form> |
|
935
|
660
|
|
|
936
|
|
-</div> <!-- id="flattr-paypal" --> |
|
937
|
|
-</div> <!-- class="donate" --> |
|
661
|
+<p>You can make a gift online (or |
|
662
|
+<a href="http://feedwordpress.radgeek.com/donation">set up an automatic |
|
663
|
+regular donation</a>) using an existing PayPal account or any major credit card.</p> |
|
938
|
664
|
|
|
939
|
|
-</div> <!-- class="donation-form" --> |
|
940
|
|
-</form> |
|
941
|
|
- |
|
942
|
|
-<p><?php esc_html_e( 'You can make a gift online (or ' ); ?><a href="<?php print esc_url( FWP_PROJECT_WEBSITE_URL ) ;?>donation"><?php esc_html_e( 'set up an automatic |
|
943
|
|
-regular donation' ); ?></a><?php esc_html_e( ' using an existing PayPal account or any major credit card.' ); ?></p> |
|
944
|
|
- |
|
945
|
665
|
<div class="sod-off"> |
|
946
|
|
-<form style="text-align: center" action="<?php print esc_url( $this->form_action() ); ?>" method="POST"><div> |
|
947
|
|
-<input class="button" type="submit" name="maybe_later" value="<?php esc_attr_e( 'Maybe Later' ); ?>"/> |
|
948
|
|
-<input class="button" type="submit" name="go_away" value="<?php esc_attr_e( 'Dismiss' ); ?>"/> |
|
666
|
+<form style="text-align: center" action="<?php print $this->form_action(); ?>" method="POST"><div> |
|
667
|
+<input class="button" type="submit" name="maybe_later" value="Maybe Later" /> |
|
668
|
+<input class="button" type="submit" name="go_away" value="Dismiss" /> |
|
949
|
669
|
</div></form> |
|
950
|
670
|
</div> |
|
951
|
671
|
</div> <!-- class="donation-form" --> |
|
952
|
672
|
<?php |
|
953
|
|
- } /* FeedWordPressSyndicationPage::bleg_box() */ |
|
673
|
+ } /* FeedWordPressSyndicationPage::bleg_box () */ |
|
954
|
674
|
|
|
955
|
675
|
/** |
|
956
|
676
|
* Override the default display of a save-settings button and replace |
|
957
|
677
|
* it with nothing. |
|
958
|
678
|
*/ |
|
959
|
|
- function interstitial() { |
|
679
|
+ function interstitial () { |
|
960
|
680
|
/* NOOP */ |
|
961
|
681
|
} /* FeedWordPressSyndicationPage::interstitial() */ |
|
962
|
|
- |
|
963
|
|
- function multidelete_page() { |
|
682
|
+ |
|
683
|
+ function multidelete_page () { |
|
964
|
684
|
global $wpdb; |
|
965
|
|
- |
|
685
|
+ global $fwp_post; |
|
686
|
+ |
|
966
|
687
|
// If this is a POST, validate source and user credentials |
|
967
|
|
- FeedWordPressCompatibility::validate_http_request( /*action=*/ 'feedwordpress_feeds', /*capability=*/ 'manage_links' ); |
|
968
|
|
- |
|
969
|
|
- if ( MyPHP::post( 'submit' ) == FWP_CANCEL_BUTTON ) : |
|
688
|
+ FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_feeds', /*capability=*/ 'manage_links'); |
|
689
|
+ |
|
690
|
+ if (isset($fwp_post['submit']) and $fwp_post['submit']==FWP_CANCEL_BUTTON) : |
|
970
|
691
|
return true; // Continue without further ado. |
|
971
|
692
|
endif; |
|
972
|
|
- |
|
973
|
|
- // Get single link ID or multiple link IDs from REQUEST parameters |
|
974
|
|
- // if available. Sanitize values for MySQL. |
|
975
|
|
- $link_list = $this->requested_link_ids_sql(); |
|
976
|
|
- |
|
977
|
|
- if (MyPHP::post('confirm')=='Delete'): |
|
978
|
|
- $actions = array(); // avoids "else" complaint _and_ guarantees that we don't have any scoping issues (gwyneth 20230916) |
|
979
|
|
- if ( is_array(MyPHP::post('link_action')) ) : |
|
980
|
|
- $actions = MyPHP::post('link_action'); |
|
693
|
+ |
|
694
|
+ $link_ids = (isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array()); |
|
695
|
+ if (isset($_REQUEST['link_id'])) : array_push($link_ids, $_REQUEST['link_id']); endif; |
|
696
|
+ |
|
697
|
+ if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm']=='Delete'): |
|
698
|
+ if (isset($GLOBALS['fwp_post']['link_action']) and is_array($GLOBALS['fwp_post']['link_action'])) : |
|
699
|
+ $actions = $GLOBALS['fwp_post']['link_action']; |
|
700
|
+ else : |
|
701
|
+ $actions = array(); |
|
981
|
702
|
endif; |
|
982
|
|
- |
|
703
|
+ |
|
983
|
704
|
$do_it = array( |
|
984
|
705
|
'hide' => array(), |
|
985
|
706
|
'nuke' => array(), |
|
986
|
707
|
'delete' => array(), |
|
987
|
708
|
); |
|
988
|
|
- |
|
709
|
+ |
|
989
|
710
|
foreach ($actions as $link_id => $what) : |
|
990
|
711
|
$do_it[$what][] = $link_id; |
|
991
|
712
|
endforeach; |
|
992
|
|
- |
|
713
|
+ |
|
993
|
714
|
$alter = array(); |
|
994
|
715
|
if (count($do_it['hide']) > 0) : |
|
995
|
716
|
$hidem = "(".implode(', ', $do_it['hide']).")"; |
|
996
|
717
|
$alter[] = " |
|
@@ -998,12 +719,12 @@ |
|
998
|
719
|
SET link_visible = 'N' |
|
999
|
720
|
WHERE link_id IN {$hidem} |
|
1000
|
721
|
"; |
|
1001
|
722
|
endif; |
|
1002
|
|
- |
|
723
|
+ |
|
1003
|
724
|
if (count($do_it['nuke']) > 0) : |
|
1004
|
725
|
$nukem = "(".implode(', ', $do_it['nuke']).")"; |
|
1005
|
|
- |
|
726
|
+ |
|
1006
|
727
|
// Make a list of the items syndicated from this feed... |
|
1007
|
728
|
$post_ids = $wpdb->get_col(" |
|
1008
|
729
|
SELECT post_id FROM $wpdb->postmeta |
|
1009
|
730
|
WHERE meta_key = 'syndication_feed_id' |
|
@@ -1008,30 +729,34 @@ |
|
1008
|
729
|
SELECT post_id FROM $wpdb->postmeta |
|
1009
|
730
|
WHERE meta_key = 'syndication_feed_id' |
|
1010
|
731
|
AND meta_value IN {$nukem} |
|
1011
|
732
|
"); |
|
1012
|
|
- |
|
733
|
+ |
|
1013
|
734
|
// ... and kill them all |
|
1014
|
735
|
if (count($post_ids) > 0) : |
|
1015
|
736
|
foreach ($post_ids as $post_id) : |
|
1016
|
|
- // Force scrubbing of deleted post |
|
1017
|
|
- // rather than sending to Trashcan |
|
1018
|
|
- wp_delete_post( |
|
1019
|
|
- /*postid=*/ $post_id, |
|
1020
|
|
- /*force_delete=*/ true |
|
1021
|
|
- ); |
|
737
|
+ if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : |
|
738
|
+ // Force scrubbing of deleted post |
|
739
|
+ // rather than sending to Trashcan |
|
740
|
+ wp_delete_post( |
|
741
|
+ /*postid=*/ $post_id, |
|
742
|
+ /*force_delete=*/ true |
|
743
|
+ ); |
|
744
|
+ else : |
|
745
|
+ wp_delete_post($post_id); |
|
746
|
+ endif; |
|
1022
|
747
|
endforeach; |
|
1023
|
748
|
endif; |
|
1024
|
|
- |
|
749
|
+ |
|
1025
|
750
|
$alter[] = " |
|
1026
|
751
|
DELETE FROM $wpdb->links |
|
1027
|
752
|
WHERE link_id IN {$nukem} |
|
1028
|
753
|
"; |
|
1029
|
754
|
endif; |
|
1030
|
|
- |
|
755
|
+ |
|
1031
|
756
|
if (count($do_it['delete']) > 0) : |
|
1032
|
757
|
$deletem = "(".implode(', ', $do_it['delete']).")"; |
|
1033
|
|
- |
|
758
|
+ |
|
1034
|
759
|
// Make the items syndicated from this feed appear to be locally-authored |
|
1035
|
760
|
$alter[] = " |
|
1036
|
761
|
DELETE FROM $wpdb->postmeta |
|
1037
|
762
|
WHERE meta_key = 'syndication_feed_id' |
|
@@ -1036,9 +761,9 @@ |
|
1036
|
761
|
DELETE FROM $wpdb->postmeta |
|
1037
|
762
|
WHERE meta_key = 'syndication_feed_id' |
|
1038
|
763
|
AND meta_value IN {$deletem} |
|
1039
|
764
|
"; |
|
1040
|
|
- |
|
765
|
+ |
|
1041
|
766
|
// ... and delete the links themselves. |
|
1042
|
767
|
$alter[] = " |
|
1043
|
768
|
DELETE FROM $wpdb->links |
|
1044
|
769
|
WHERE link_id IN {$deletem} |
|
@@ -1043,92 +768,89 @@ |
|
1043
|
768
|
DELETE FROM $wpdb->links |
|
1044
|
769
|
WHERE link_id IN {$deletem} |
|
1045
|
770
|
"; |
|
1046
|
771
|
endif; |
|
1047
|
|
- |
|
1048
|
|
- $errs = array(); |
|
772
|
+ |
|
773
|
+ $errs = array(); $success = array (); |
|
1049
|
774
|
foreach ($alter as $sql) : |
|
1050
|
775
|
$result = $wpdb->query($sql); |
|
1051
|
|
- if ( ! $result): |
|
1052
|
|
- $errs[] = $wpdb->last_error; |
|
776
|
+ if (!$result): |
|
777
|
+ $errs[] = mysql_error(); |
|
1053
|
778
|
endif; |
|
1054
|
779
|
endforeach; |
|
1055
|
|
- |
|
780
|
+ |
|
1056
|
781
|
if (count($alter) > 0) : |
|
1057
|
782
|
echo "<div class=\"updated\">\n"; |
|
1058
|
783
|
if (count($errs) > 0) : |
|
1059
|
|
- echo "There were some problems processing your unsubscribe request. [SQL: "; |
|
1060
|
|
- $sep = ''; |
|
1061
|
|
- foreach ( $errs as $err ) : |
|
1062
|
|
- print esc_html($sep); |
|
1063
|
|
- print esc_html($err); |
|
1064
|
|
- $sep = '; '; |
|
1065
|
|
- endforeach; |
|
1066
|
|
- echo "]"; |
|
784
|
+ echo "There were some problems processing your "; |
|
785
|
+ echo "unsubscribe request. [SQL: ".implode('; ', $errs)."]"; |
|
1067
|
786
|
else : |
|
1068
|
787
|
echo "Your unsubscribe request(s) have been processed."; |
|
1069
|
788
|
endif; |
|
1070
|
789
|
echo "</div>\n"; |
|
1071
|
790
|
endif; |
|
1072
|
|
- |
|
791
|
+ |
|
1073
|
792
|
return true; // Continue on to Syndicated Sites listing |
|
1074
|
793
|
else : |
|
1075
|
|
- // $link_list has previously been sanitized for html by self::requested_link_ids_sql |
|
1076
|
794
|
$targets = $wpdb->get_results(" |
|
1077
|
795
|
SELECT * FROM $wpdb->links |
|
1078
|
|
- WHERE link_id IN {$link_list} |
|
796
|
+ WHERE link_id IN (".implode(",",$link_ids).") |
|
1079
|
797
|
"); |
|
1080
|
798
|
?> |
|
1081
|
|
- <form action="<?php print esc_url( $this->form_action() ); ?>" method="post"> |
|
799
|
+ <form action="<?php print $this->form_action(); ?>" method="post"> |
|
1082
|
800
|
<div class="wrap"> |
|
1083
|
801
|
<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> |
|
1084
|
802
|
<input type="hidden" name="action" value="Unsubscribe" /> |
|
1085
|
803
|
<input type="hidden" name="confirm" value="Delete" /> |
|
1086
|
|
- |
|
1087
|
|
- <h2><?php esc_html_e( 'Unsubscribe from Syndicated Links:' ); ?></h2> |
|
804
|
+ |
|
805
|
+ <h2>Unsubscribe from Syndicated Links:</h2> |
|
1088
|
806
|
<?php foreach ($targets as $link) : |
|
1089
|
807
|
$subscribed = ('Y' == strtoupper($link->link_visible)); |
|
808
|
+ $link_url = esc_html($link->link_url); |
|
809
|
+ $link_name = esc_html($link->link_name); |
|
810
|
+ $link_description = esc_html($link->link_description); |
|
811
|
+ $link_rss = esc_html($link->link_rss); |
|
1090
|
812
|
?> |
|
1091
|
813
|
<fieldset> |
|
1092
|
|
- <legend><?php echo esc_html($link->link_name); ?></legend> |
|
814
|
+ <legend><?php echo $link_name; ?></legend> |
|
1093
|
815
|
<table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
|
1094
|
|
- <tr><th scope="row" width="20%"><?php esc_html_e( 'Feed URI:' ) ?></th> |
|
1095
|
|
- <td width="80%"><a href="<?php echo esc_url($link->link_rss); ?>"><?php echo esc_html( $link->link_rss ); ?></a></td></tr> |
|
1096
|
|
- <tr><th scope="row" width="20%"><?php esc_html_e( 'Short description:' ) ?></th> |
|
1097
|
|
- <td width="80%"><?php echo esc_html( $link->link_description ); ?></span></td></tr> |
|
1098
|
|
- <tr><th width="20%" scope="row"><?php esc_html_e( 'Homepage:' ) ?></th> |
|
1099
|
|
- <td width="80%"><a href="<?php echo esc_url($link->link_url); ?>"><?php echo esc_html( $link->link_url ); ?></a></td></tr> |
|
1100
|
|
- <tr style="vertical-align:top"><th width="20%" scope="row"><?php esc_html_e( 'Subscription ' ); ?><?php esc_html_e( 'Options' ); ?>:</th> |
|
816
|
+ <tr><th scope="row" width="20%"><?php _e('Feed URI:') ?></th> |
|
817
|
+ <td width="80%"><a href="<?php echo $link_rss; ?>"><?php echo $link_rss; ?></a></td></tr> |
|
818
|
+ <tr><th scope="row" width="20%"><?php _e('Short description:') ?></th> |
|
819
|
+ <td width="80%"><?php echo $link_description; ?></span></td></tr> |
|
820
|
+ <tr><th width="20%" scope="row"><?php _e('Homepage:') ?></th> |
|
821
|
+ <td width="80%"><a href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td></tr> |
|
822
|
+ <tr style="vertical-align:top"><th width="20%" scope="row">Subscription <?php _e('Options') ?>:</th> |
|
1101
|
823
|
<td width="80%"><ul style="margin:0; padding: 0; list-style: none"> |
|
1102
|
824
|
<?php if ($subscribed) : ?> |
|
1103
|
|
- <li><input type="radio" id="hide-<?php echo esc_attr($link->link_id); ?>" |
|
1104
|
|
- name="link_action[<?php echo esc_attr($link->link_id); ?>]" value="hide" checked="checked" /> |
|
1105
|
|
- <label for="hide-<?php echo esc_attr($link->link_id); ?>"><?php esc_html_e( 'Turn off the subscription for this |
|
825
|
+ <li><input type="radio" id="hide-<?php echo $link->link_id; ?>" |
|
826
|
+ name="link_action[<?php echo $link->link_id; ?>]" value="hide" checked="checked" /> |
|
827
|
+ <label for="hide-<?php echo $link->link_id; ?>">Turn off the subscription for this |
|
1106
|
828
|
syndicated link<br/><span style="font-size:smaller">(Keep the feed information |
|
1107
|
|
- and all the posts from this feed in the database, but don’t syndicate any |
|
1108
|
|
- new posts from the feed.)' ); ?></span></label></li> |
|
829
|
+ and all the posts from this feed in the database, but don't syndicate any |
|
830
|
+ new posts from the feed.)</span></label></li> |
|
1109
|
831
|
<?php endif; ?> |
|
1110
|
|
- <li><input type="radio" id="nuke-<?php echo esc_attr($link->link_id); ?>"<?php if ( ! $subscribed) : ?> checked="checked"<?php endif; ?> |
|
1111
|
|
- name="link_action[<?php echo esc_attr($link->link_id); ?>]" value="nuke" /> |
|
1112
|
|
- <label for="nuke-<?php echo esc_attr($link->link_id); ?>"><?php esc_html_e( 'Delete this syndicated link and all the |
|
1113
|
|
- posts that were syndicated from it' ); ?></label></li> |
|
1114
|
|
- <li><input type="radio" id="delete-<?php echo esc_attr($link->link_id); ?>" |
|
1115
|
|
- name="link_action[<?php echo esc_attr($link->link_id); ?>]" value="delete" /> |
|
1116
|
|
- <label for="delete-<?php echo esc_attr($link->link_id); ?>"><?php esc_html_e( 'Delete this syndicated link, but |
|
832
|
+ <li><input type="radio" id="nuke-<?php echo $link->link_id; ?>"<?php if (!$subscribed) : ?> checked="checked"<?php endif; ?> |
|
833
|
+ name="link_action[<?php echo $link->link_id; ?>]" value="nuke" /> |
|
834
|
+ <label for="nuke-<?php echo $link->link_id; ?>">Delete this syndicated link and all the |
|
835
|
+ posts that were syndicated from it</label></li> |
|
836
|
+ <li><input type="radio" id="delete-<?php echo $link->link_id; ?>" |
|
837
|
+ name="link_action[<?php echo $link->link_id; ?>]" value="delete" /> |
|
838
|
+ <label for="delete-<?php echo $link->link_id; ?>">Delete this syndicated link, but |
|
1117
|
839
|
<em>keep</em> posts that were syndicated from it (as if they were authored |
|
1118
|
|
- locally).' ); ?></label></li> |
|
1119
|
|
- <li><input type="radio" id="nothing-<?php echo esc_attr( $link->link_id ); ?>" |
|
1120
|
|
- name="link_action[<?php echo esc_attr( $link->link_id ); ?>]" value="nothing" /> |
|
1121
|
|
- <label for="nothing-<?php echo esc_attr( $link->link_id ); ?>"><?php esc_html_e( 'Keep this feed as it is. I changed |
|
1122
|
|
- my mind.' ); ?></label></li> |
|
840
|
+ locally).</label></li> |
|
841
|
+ <li><input type="radio" id="nothing-<?php echo $link->link_id; ?>" |
|
842
|
+ name="link_action[<?php echo $link->link_id; ?>]" value="nothing" /> |
|
843
|
+ <label for="nothing-<?php echo $link->link_id; ?>">Keep this feed as it is. I changed |
|
844
|
+ my mind.</label></li> |
|
1123
|
845
|
</ul> |
|
1124
|
846
|
</table> |
|
1125
|
847
|
</fieldset> |
|
1126
|
848
|
<?php endforeach; ?> |
|
1127
|
|
- |
|
849
|
+ |
|
1128
|
850
|
<div class="submit"> |
|
1129
|
|
- <input type="submit" name="submit" value="<?php esc_html_e( FWP_CANCEL_BUTTON ); ?>" /> |
|
1130
|
|
- <input class="delete" type="submit" name="submit" value="<?php esc_html_e( FWP_UNSUB_FULL ) ?>" /> |
|
851
|
+ <input type="submit" name="submit" value="<?php _e(FWP_CANCEL_BUTTON); ?>" /> |
|
852
|
+ <input class="delete" type="submit" name="submit" value="<?php _e(FWP_UNSUB_FULL) ?>" /> |
|
1131
|
853
|
</div> |
|
1132
|
854
|
</div> |
|
1133
|
855
|
<?php |
|
1134
|
856
|
return false; // Don't continue on to Syndicated Sites listing |
|
@@ -1133,34 +855,33 @@ |
|
1133
|
855
|
<?php |
|
1134
|
856
|
return false; // Don't continue on to Syndicated Sites listing |
|
1135
|
857
|
endif; |
|
1136
|
858
|
} /* FeedWordPressSyndicationPage::multidelete_page() */ |
|
1137
|
|
- |
|
859
|
+ |
|
1138
|
860
|
function multiundelete_page () { |
|
1139
|
861
|
global $wpdb; |
|
1140
|
|
- |
|
862
|
+ |
|
1141
|
863
|
// If this is a POST, validate source and user credentials |
|
1142
|
864
|
FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_feeds', /*capability=*/ 'manage_links'); |
|
1143
|
|
- |
|
1144
|
|
- // Get single link ID or multiple link IDs from REQUEST parameters |
|
1145
|
|
- // if available. Sanitize values for MySQL. |
|
1146
|
|
- $link_list = $this->requested_link_ids_sql(); |
|
1147
|
|
- |
|
1148
|
|
- if (MyPHP::post('confirm')=='Undelete'): |
|
1149
|
|
- if ( is_array(MyPHP::post('link_action')) ) : |
|
1150
|
|
- $actions = MyPHP::post('link_action'); |
|
865
|
+ |
|
866
|
+ $link_ids = (isset($_REQUEST['link_ids']) ? $_REQUEST['link_ids'] : array()); |
|
867
|
+ if (isset($_REQUEST['link_id'])) : array_push($link_ids, $_REQUEST['link_id']); endif; |
|
868
|
+ |
|
869
|
+ if (isset($GLOBALS['fwp_post']['confirm']) and $GLOBALS['fwp_post']['confirm']=='Undelete'): |
|
870
|
+ if (isset($GLOBALS['fwp_post']['link_action']) and is_array($GLOBALS['fwp_post']['link_action'])) : |
|
871
|
+ $actions = $GLOBALS['fwp_post']['link_action']; |
|
1151
|
872
|
else : |
|
1152
|
873
|
$actions = array(); |
|
1153
|
874
|
endif; |
|
1154
|
|
- |
|
875
|
+ |
|
1155
|
876
|
$do_it = array( |
|
1156
|
877
|
'unhide' => array(), |
|
1157
|
878
|
); |
|
1158
|
|
- |
|
879
|
+ |
|
1159
|
880
|
foreach ($actions as $link_id => $what) : |
|
1160
|
881
|
$do_it[$what][] = $link_id; |
|
1161
|
882
|
endforeach; |
|
1162
|
|
- |
|
883
|
+ |
|
1163
|
884
|
$alter = array(); |
|
1164
|
885
|
if (count($do_it['unhide']) > 0) : |
|
1165
|
886
|
$unhiddem = "(".implode(', ', $do_it['unhide']).")"; |
|
1166
|
887
|
$alter[] = " |
|
@@ -1168,67 +889,71 @@ |
|
1168
|
889
|
SET link_visible = 'Y' |
|
1169
|
890
|
WHERE link_id IN {$unhiddem} |
|
1170
|
891
|
"; |
|
1171
|
892
|
endif; |
|
1172
|
|
- |
|
1173
|
|
- $errs = array(); |
|
893
|
+ |
|
894
|
+ $errs = array(); $success = array (); |
|
1174
|
895
|
foreach ($alter as $sql) : |
|
1175
|
896
|
$result = $wpdb->query($sql); |
|
1176
|
|
- if ( ! $result): |
|
1177
|
|
- $errs[] = $wpdb->last_error; |
|
897
|
+ if (!$result): |
|
898
|
+ $errs[] = mysql_error(); |
|
1178
|
899
|
endif; |
|
1179
|
900
|
endforeach; |
|
1180
|
|
- |
|
901
|
+ |
|
1181
|
902
|
if (count($alter) > 0) : |
|
1182
|
903
|
echo "<div class=\"updated\">\n"; |
|
1183
|
904
|
if (count($errs) > 0) : |
|
1184
|
|
- esc_html_e( 'There were some problems processing your re-subscribe request. ' ); |
|
1185
|
|
- echo esc_html( "[SQL: ".implode('; ', $errs)."]" ); |
|
905
|
+ echo "There were some problems processing your "; |
|
906
|
+ echo "re-subscribe request. [SQL: ".implode('; ', $errs)."]"; |
|
1186
|
907
|
else : |
|
1187
|
|
- esc_html_e( 'Your re-subscribe request(s) have been processed.' ); |
|
908
|
+ echo "Your re-subscribe request(s) have been processed."; |
|
1188
|
909
|
endif; |
|
1189
|
910
|
echo "</div>\n"; |
|
1190
|
911
|
endif; |
|
1191
|
|
- |
|
912
|
+ |
|
1192
|
913
|
return true; // Continue on to Syndicated Sites listing |
|
1193
|
914
|
else : |
|
1194
|
|
- // $link_list has previously been sanitized for html by self::requested_link_ids_sql |
|
1195
|
915
|
$targets = $wpdb->get_results(" |
|
1196
|
916
|
SELECT * FROM $wpdb->links |
|
1197
|
|
- WHERE link_id IN {$link_list} |
|
917
|
+ WHERE link_id IN (".implode(",",$link_ids).") |
|
1198
|
918
|
"); |
|
1199
|
919
|
?> |
|
1200
|
|
- <form action="<?php print esc_url( $this->form_action() ); ?>" method="post"> |
|
920
|
+ <form action="<?php print $this->form_action(); ?>" method="post"> |
|
1201
|
921
|
<div class="wrap"> |
|
1202
|
922
|
<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?> |
|
1203
|
|
- <input type="hidden" name="action" value="<?php print esc_attr( FWP_RESUB_CHECKED ); ?>" /> |
|
923
|
+ <input type="hidden" name="action" value="<?php print FWP_RESUB_CHECKED; ?>" /> |
|
1204
|
924
|
<input type="hidden" name="confirm" value="Undelete" /> |
|
1205
|
|
- |
|
1206
|
|
- <h2><?php esc_html_e( 'Re-subscribe to Syndicated Links:' ); ?></h2> |
|
925
|
+ |
|
926
|
+ <h2>Re-subscribe to Syndicated Links:</h2> |
|
1207
|
927
|
<?php |
|
1208
|
928
|
foreach ($targets as $link) : |
|
1209
|
|
- $subscribed = ( 'Y' == strtoupper( $link->link_visible ) ); |
|
1210
|
|
- if ( ! $subscribed ) : |
|
929
|
+ $subscribed = ('Y' == strtoupper($link->link_visible)); |
|
930
|
+ $link_url = esc_html($link->link_url); |
|
931
|
+ $link_name = esc_html($link->link_name); |
|
932
|
+ $link_description = esc_html($link->link_description); |
|
933
|
+ $link_rss = esc_html($link->link_rss); |
|
934
|
+ |
|
935
|
+ if (!$subscribed) : |
|
1211
|
936
|
?> |
|
1212
|
937
|
<fieldset> |
|
1213
|
|
- <legend><?php echo esc_html( $link->link_name ); ?></legend> |
|
938
|
+ <legend><?php echo $link_name; ?></legend> |
|
1214
|
939
|
<table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
|
1215
|
|
- <tr><th scope="row" width="20%"><?php esc_html_e( 'Feed URI:' ) ?></th> |
|
1216
|
|
- <td width="80%"><a href="<?php echo esc_url( $link->link_rss ); ?>"><?php echo esc_html( $link->link_rss ); ?></a></td></tr> |
|
1217
|
|
- <tr><th scope="row" width="20%"><?php esc_html_e( 'Short description:' ) ?></th> |
|
1218
|
|
- <td width="80%"><?php echo esc_html($link->link_description); ?></span></td></tr> |
|
1219
|
|
- <tr><th width="20%" scope="row"><?php esc_html_e( 'Homepage:' ) ?></th> |
|
1220
|
|
- <td width="80%"><a href="<?php echo esc_url($link->link_url); ?>"><?php echo esc_html($link->link_url); ?></a></td></tr> |
|
1221
|
|
- <tr style="vertical-align:top"><th width="20%" scope="row"><?php esc_html_e( 'Subscription' ); ?> <?php esc_html_e( 'Options' ); ?>:</th> |
|
940
|
+ <tr><th scope="row" width="20%"><?php _e('Feed URI:') ?></th> |
|
941
|
+ <td width="80%"><a href="<?php echo $link_rss; ?>"><?php echo $link_rss; ?></a></td></tr> |
|
942
|
+ <tr><th scope="row" width="20%"><?php _e('Short description:') ?></th> |
|
943
|
+ <td width="80%"><?php echo $link_description; ?></span></td></tr> |
|
944
|
+ <tr><th width="20%" scope="row"><?php _e('Homepage:') ?></th> |
|
945
|
+ <td width="80%"><a href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td></tr> |
|
946
|
+ <tr style="vertical-align:top"><th width="20%" scope="row">Subscription <?php _e('Options') ?>:</th> |
|
1222
|
947
|
<td width="80%"><ul style="margin:0; padding: 0; list-style: none"> |
|
1223
|
|
- <li><input type="radio" id="unhide-<?php echo esc_attr($link->link_id); ?>" |
|
1224
|
|
- name="link_action[<?php echo esc_attr($link->link_id); ?>]" value="unhide" checked="checked" /> |
|
1225
|
|
- <label for="unhide-<?php echo esc_attr($link->link_id); ?>"><?php esc_html_e( 'Turn back on the subscription |
|
1226
|
|
- for this syndication source.' ); ?></label></li> |
|
1227
|
|
- <li><input type="radio" id="nothing-<?php echo esc_attr($link->link_id); ?>" |
|
1228
|
|
- name="link_action[<?php echo esc_attr($link->link_id); ?>]" value="nothing" /> |
|
1229
|
|
- <label for="nothing-<?php echo esc_attr($link->link_id); ?>"><?php esc_html_e( 'Leave this feed as it is. |
|
1230
|
|
- I changed my mind.' ); ?></label></li> |
|
948
|
+ <li><input type="radio" id="unhide-<?php echo $link->link_id; ?>" |
|
949
|
+ name="link_action[<?php echo $link->link_id; ?>]" value="unhide" checked="checked" /> |
|
950
|
+ <label for="unhide-<?php echo $link->link_id; ?>">Turn back on the subscription |
|
951
|
+ for this syndication source.</label></li> |
|
952
|
+ <li><input type="radio" id="nothing-<?php echo $link->link_id; ?>" |
|
953
|
+ name="link_action[<?php echo $link->link_id; ?>]" value="nothing" /> |
|
954
|
+ <label for="nothing-<?php echo $link->link_id; ?>">Leave this feed as it is. |
|
955
|
+ I changed my mind.</label></li> |
|
1231
|
956
|
</ul> |
|
1232
|
957
|
</table> |
|
1233
|
958
|
</fieldset> |
|
1234
|
959
|
<?php |
|
@@ -1234,11 +959,11 @@ |
|
1234
|
959
|
<?php |
|
1235
|
960
|
endif; |
|
1236
|
961
|
endforeach; |
|
1237
|
962
|
?> |
|
1238
|
|
- |
|
963
|
+ |
|
1239
|
964
|
<div class="submit"> |
|
1240
|
|
- <input class="button-primary delete" type="submit" name="submit" value="<?php esc_html_e( 'Re-subscribe to selected feeds »' ) ?>" /> |
|
965
|
+ <input class="button-primary delete" type="submit" name="submit" value="<?php _e('Re-subscribe to selected feeds »') ?>" /> |
|
1241
|
966
|
</div> |
|
1242
|
967
|
</div> |
|
1243
|
968
|
<?php |
|
1244
|
969
|
return false; // Don't continue on to Syndicated Sites listing |
|
@@ -1244,103 +969,14 @@ |
|
1244
|
969
|
return false; // Don't continue on to Syndicated Sites listing |
|
1245
|
970
|
endif; |
|
1246
|
971
|
} /* FeedWordPressSyndicationPage::multiundelete_page() */ |
|
1247
|
972
|
|
|
1248
|
|
- public function switchfeed_page () { |
|
1249
|
|
- global $wpdb; |
|
1250
|
973
|
|
|
1251
|
|
- // If this is a POST, validate source and user credentials |
|
1252
|
|
- FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_switchfeed', /*capability=*/ 'manage_links'); |
|
1253
|
974
|
|
|
1254
|
|
- $changed = false; |
|
1255
|
|
- if ( is_null( FeedWordPress::post( 'Cancel' ) ) ): |
|
1256
|
|
- $save_link_id = FeedWordPress::post( 'save_link_id' ); |
|
1257
|
|
- |
|
1258
|
|
- if ( $save_link_id == '*' ) : |
|
1259
|
|
- $changed = true; |
|
1260
|
|
- |
|
1261
|
|
- $feed_title = FeedWordPress::post( 'feed_title' ); |
|
1262
|
|
- $feed_link = FeedWordPress::post( 'feed_link' ); |
|
1263
|
|
- $feed = FeedWordPress::post( 'feed' ); |
|
1264
|
|
- |
|
1265
|
|
- $link_id = FeedWordPress::syndicate_link( $feed_title, $feed_link, $feed ); |
|
1266
|
|
- if ($link_id): |
|
1267
|
|
- $existingLink = new SyndicatedLink($link_id); |
|
1268
|
|
- $adminPageHref = $this->admin_page_href( 'feeds-page.php', array( "link_id" => $link_id ) ); |
|
1269
|
|
- ?> |
|
1270
|
|
-<div class="updated"><p><a href="<?php print esc_url($feed_link); ?>"><?php print esc_html($feed_title); ?></a> |
|
1271
|
|
-<?php esc_html_e( 'has been added as a contributing site, using the feed at' ); ?> |
|
1272
|
|
-<<a href="<?php print esc_url( $feed ); ?>"><?php print esc_html( $feed ); ?></a>>. |
|
1273
|
|
-| <a href="<?php print esc_url( $adminPageHref ); ?>"><?php esc_html_e( 'Configure settings' ); ?></a>.</p></div> |
|
1274
|
|
- <?php |
|
1275
|
|
- else: |
|
1276
|
|
- ?> |
|
1277
|
|
-<div class="updated"><p><?php esc_html_e( 'There was a problem adding the feed.' ); ?> [SQL: <?php echo esc_html($wpdb->last_error); ?>]</p></div> |
|
1278
|
|
- <?php |
|
1279
|
|
- endif; |
|
1280
|
|
- elseif ( ! is_null( $save_link_id ) ): |
|
1281
|
|
- $feed = FeedWordPress::post( 'feed' ); |
|
1282
|
|
- $existingLink = new SyndicatedLink( $save_link_id ); |
|
1283
|
|
- |
|
1284
|
|
- $changed = $existingLink->set_uri($feed); |
|
1285
|
|
- |
|
1286
|
|
- if ($changed): |
|
1287
|
|
- $home = $existingLink->homepage(/*from feed=*/ false); |
|
1288
|
|
- $name = $existingLink->name(/*from feed=*/ false); |
|
1289
|
|
- ?> |
|
1290
|
|
-<div class="updated"><p><?php esc_html_e( 'Feed for ' ); ?><a href="<?php echo esc_html($home); ?>"><?php echo esc_html($name); ?></a> |
|
1291
|
|
-<?php esc_html_e( 'updated to ' ); ?><<a href="<?php echo esc_html( $feed ); ?>"><?php echo esc_html( $feed ); ?></a>>.</p></div> |
|
1292
|
|
- <?php |
|
1293
|
|
- endif; |
|
1294
|
|
- endif; |
|
1295
|
|
- endif; |
|
1296
|
|
- |
|
1297
|
|
- if (isset($existingLink)) : |
|
1298
|
|
- $auth = FeedWordPress::post('link_rss_auth_method'); |
|
1299
|
|
- if ( !is_null($auth) and (strlen($auth) > 0) and ($auth != '-')) : |
|
1300
|
|
- $existingLink->update_setting('http auth method', $auth); |
|
1301
|
|
- $existingLink->update_setting('http username', |
|
1302
|
|
- FeedWordPress::post('link_rss_username') |
|
1303
|
|
- ); |
|
1304
|
|
- $existingLink->update_setting('http password', |
|
1305
|
|
- FeedWordPress::post('link_rss_password') |
|
1306
|
|
- ); |
|
1307
|
|
- else : |
|
1308
|
|
- $existingLink->update_setting('http auth method', NULL); |
|
1309
|
|
- $existingLink->update_setting('http username', NULL); |
|
1310
|
|
- $existingLink->update_setting('http password', NULL); |
|
1311
|
|
- endif; |
|
1312
|
|
- do_action('feedwordpress_admin_switchfeed', FeedWordPress::post( 'feed' ), $existingLink); |
|
1313
|
|
- $existingLink->save_settings(/*reload=*/ true); |
|
1314
|
|
- endif; |
|
1315
|
|
- |
|
1316
|
|
- if ( ! $changed) : |
|
1317
|
|
- ?> |
|
1318
|
|
- <div class="updated"><p><?php esc_html_e( 'Nothing was changed.' ); ?></p></div> |
|
1319
|
|
- <?php |
|
1320
|
|
- endif; |
|
1321
|
|
- return true; // Continue. |
|
1322
|
|
- } |
|
1323
|
|
- |
|
1324
|
|
- function feedfinder_page () { |
|
1325
|
|
- global $post_source; |
|
1326
|
|
- |
|
1327
|
|
- if ( FeedWordPress::post( 'opml_lookup' ) or isset( $_FILES['opml_upload'] ) ) : |
|
1328
|
|
- $this->accept_multiadd(); |
|
1329
|
|
- return true; |
|
1330
|
|
- else : |
|
1331
|
|
- $post_source = 'feedwordpress_feeds'; |
|
1332
|
|
- |
|
1333
|
|
- // With action=feedfinder, this goes directly to the feedfinder page |
|
1334
|
|
- include_once(dirname(__FILE__) . '/feeds-page.php'); |
|
1335
|
|
- return false; |
|
1336
|
|
- endif; |
|
1337
|
|
- } /* function feedfinder_page () */ |
|
1338
|
|
- |
|
1339
|
975
|
} /* class FeedWordPressSyndicationPage */ |
|
1340
|
976
|
|
|
1341
|
977
|
function fwp_dashboard_update_if_requested ($object) { |
|
1342
|
|
- global $crash_dt; |
|
978
|
+ global $wpdb; |
|
1343
|
979
|
|
|
1344
|
980
|
$update_set = $object->updates_requested(); |
|
1345
|
981
|
|
|
1346
|
982
|
if (count($update_set) > 0) : |
|
@@ -1355,18 +991,16 @@ |
|
1355
|
991
|
echo "<div class=\"update-results\">\n"; |
|
1356
|
992
|
echo "<ul>\n"; |
|
1357
|
993
|
$tdelta = NULL; |
|
1358
|
994
|
foreach ($update_set as $uri) : |
|
1359
|
|
- if ( !is_null($crash_ts) and (time() > $crash_ts)) : |
|
1360
|
|
- echo "<li><p><strong>" . esc_html__( "Further updates postponed:" ) . "</strong> " |
|
1361
|
|
- . esc_html__( "update time limit of " ) . esc_html( $crash_dt ) . esc_html__( " second" |
|
1362
|
|
- . ( ( 1 == $crash_dt ) ? "" : "s" ) ) . esc_html__( " exceeded." ) . "</p></li>"; |
|
995
|
+ if (!is_null($crash_ts) and (time() > $crash_ts)) : |
|
996
|
+ echo "<li><p><strong>Further updates postponed:</strong> update time limit of ".$crash_dt." second".(($crash_dt==1)?"":"s")." exceeded.</p></li>"; |
|
1363
|
997
|
break; |
|
1364
|
998
|
endif; |
|
1365
|
999
|
|
|
1366
|
1000
|
if ($uri == '*') : $uri = NULL; endif; |
|
1367
|
1001
|
$delta = $feedwordpress->update($uri, $crash_ts); |
|
1368
|
|
- if ( !is_null($delta)) : |
|
1002
|
+ if (!is_null($delta)) : |
|
1369
|
1003
|
if (is_null($tdelta)) : |
|
1370
|
1004
|
$tdelta = $delta; |
|
1371
|
1005
|
else : |
|
1372
|
1006
|
$tdelta['new'] += $delta['new']; |
|
@@ -1374,16 +1008,18 @@ |
|
1374
|
1008
|
endif; |
|
1375
|
1009
|
else : |
|
1376
|
1010
|
$display_uri = esc_html(feedwordpress_display_url($uri)); |
|
1377
|
1011
|
$uri = esc_html($uri); |
|
1378
|
|
- echo '<li><p><strong>' . esc_html__( "Error:" ) . "</strong> ". esc_html__( 'There was a problem updating ' ) |
|
1379
|
|
- . '<code><a href="' . esc_url( $uri ) . '">' . esc_html( $display_uri ) . '</a></code></p></li>' . "\n"; |
|
1012
|
+ echo "<li><p><strong>Error:</strong> There was a problem updating <code><a href=\"$uri\">${display_uri}</a></code></p></li>\n"; |
|
1380
|
1013
|
endif; |
|
1381
|
1014
|
endforeach; |
|
1382
|
1015
|
echo "</ul>\n"; |
|
1383
|
1016
|
|
|
1384
|
|
- if ( !is_null($tdelta)) : |
|
1385
|
|
- echo '<p><strong>'; esc_html_e( 'Update complete.' ); echo '</strong>'; print esc_html( fwp_update_set_results_message($delta) ); print '</p>'; |
|
1017
|
+ if (!is_null($tdelta)) : |
|
1018
|
+ $mesg = array(); |
|
1019
|
+ if (isset($delta['new'])) : $mesg[] = ' '.$tdelta['new'].' new posts were syndicated'; endif; |
|
1020
|
+ if (isset($delta['updated'])) : $mesg[] = ' '.$tdelta['updated'].' existing posts were updated'; endif; |
|
1021
|
+ echo "<p>Update complete.".implode(' and', $mesg)."</p>"; |
|
1386
|
1022
|
echo "\n"; flush(); |
|
1387
|
1023
|
endif; |
|
1388
|
1024
|
echo "</div> <!-- class=\"updated\" -->\n"; |
|
1389
|
1025
|
endif; |
|
@@ -1392,18 +1028,17 @@ |
|
1392
|
1028
|
define('FEEDWORDPRESS_BLEG_MAYBE_LATER_OFFSET', (60 /*sec/min*/ * 60 /*min/hour*/ * 24 /*hour/day*/ * 31 /*days*/)); |
|
1393
|
1029
|
define('FEEDWORDPRESS_BLEG_ALREADY_PAID_OFFSET', (60 /*sec/min*/ * 60 /*min/hour*/ * 24 /*hour/day*/ * 183 /*days*/)); |
|
1394
|
1030
|
function fwp_syndication_manage_page_update_box ($object = NULL, $box = NULL) { |
|
1395
|
1031
|
$bleg_box_hidden = null; |
|
1396
|
|
- |
|
1397
|
|
- if ( FeedWordPress::post( 'maybe_later' ) ) : |
|
1398
|
|
- $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_MAYBE_LATER_OFFSET; |
|
1399
|
|
- elseif ( FeedWordPress::post( 'paid' ) ) : |
|
1400
|
|
- $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_ALREADY_PAID_OFFSET; |
|
1401
|
|
- elseif ( FeedWordPress::post( 'go_away' ) ) : |
|
1032
|
+ if (isset($_POST['maybe_later'])) : |
|
1033
|
+ $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_MAYBE_LATER_OFFSET; |
|
1034
|
+ elseif (isset($_REQUEST['paid']) and $_REQUEST['paid']) : |
|
1035
|
+ $bleg_box_hidden = time() + FEEDWORDPRESS_BLEG_ALREADY_PAID_OFFSET; |
|
1036
|
+ elseif (isset($_POST['go_away'])) : |
|
1402
|
1037
|
$bleg_box_hidden = 'permanent'; |
|
1403
|
1038
|
endif; |
|
1404
|
1039
|
|
|
1405
|
|
- if ( !is_null($bleg_box_hidden)) : |
|
1040
|
+ if (!is_null($bleg_box_hidden)) : |
|
1406
|
1041
|
update_option('feedwordpress_bleg_box_hidden', $bleg_box_hidden); |
|
1407
|
1042
|
else : |
|
1408
|
1043
|
$bleg_box_hidden = get_option('feedwordpress_bleg_box_hidden'); |
|
1409
|
1044
|
endif; |
|
@@ -1409,38 +1044,37 @@ |
|
1409
|
1044
|
endif; |
|
1410
|
1045
|
?> |
|
1411
|
1046
|
<?php |
|
1412
|
1047
|
$bleg_box_ready = (FEEDWORDPRESS_BLEG and ( |
|
1413
|
|
- ! $bleg_box_hidden |
|
1048
|
+ !$bleg_box_hidden |
|
1414
|
1049
|
or (is_numeric($bleg_box_hidden) and $bleg_box_hidden < time()) |
|
1415
|
1050
|
)); |
|
1416
|
|
- |
|
1417
|
|
- $bleg_box_ready = apply_filters( 'feedwordpress_bleg_box_ready', $bleg_box_ready ); |
|
1418
|
|
- if ( FeedWordPress::post( 'paid' ) || ( FeedWordPress::param( 'test' ) == 'thanks' ) ) : |
|
1419
|
|
- $object->bleg_thanks($object, $box); |
|
1420
|
|
- elseif ($bleg_box_ready || ( FeedWordPress::param( 'test' ) == 'bleg' ) ) : |
|
1051
|
+ |
|
1052
|
+ if (isset($_REQUEST['paid']) and $_REQUEST['paid']) : |
|
1053
|
+ $object->bleg_thanks($subject, $box); |
|
1054
|
+ elseif ($bleg_box_ready) : |
|
1421
|
1055
|
$object->bleg_box($object, $box); |
|
1422
|
1056
|
endif; |
|
1423
|
1057
|
?> |
|
1424
|
1058
|
|
|
1425
|
1059
|
<form |
|
1426
|
|
- action="<?php print esc_url( $object->form_action() ); ?>" |
|
1060
|
+ action="<?php print $object->form_action(); ?>" |
|
1427
|
1061
|
method="POST" |
|
1428
|
1062
|
class="update-form<?php if ($bleg_box_ready) : ?> with-donation<?php endif; ?>" |
|
1429
|
1063
|
> |
|
1430
|
1064
|
<div><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds'); ?></div> |
|
1431
|
|
- <p><?php esc_html_e( 'Check currently scheduled feeds for new and updated posts.' ); ?></p> |
|
1065
|
+ <p>Check currently scheduled feeds for new and updated posts.</p> |
|
1432
|
1066
|
|
|
1433
|
1067
|
<?php |
|
1434
|
1068
|
fwp_dashboard_update_if_requested($object); |
|
1435
|
1069
|
|
|
1436
|
|
- if ( !get_option('feedwordpress_automatic_updates')) : |
|
1070
|
+ if (!get_option('feedwordpress_automatic_updates')) : |
|
1437
|
1071
|
?> |
|
1438
|
|
- <p class="heads-up"><strong><?php esc_html_e( 'Note:' ); ?></strong> <?php esc_html_e( 'Automatic updates are currently turned |
|
1072
|
+ <p class="heads-up"><strong>Note:</strong> Automatic updates are currently turned |
|
1439
|
1073
|
<strong>off</strong>. New posts from your feeds will not be syndicated |
|
1440
|
1074
|
until you manually check for them here. You can turn on automatic |
|
1441
|
|
- updates under' ); ?> <a href="<?php print esc_url( $object->admin_page_href('feeds-page.php') ); ?>"><?php esc_html_e( 'Feed & Update Settings' ); ?></a>.</p> |
|
1442
|
|
- <?php |
|
1075
|
+ updates under <a href="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/feeds-page.php">Feed & Update Settings<a></a>.</p> |
|
1076
|
+ <?php |
|
1443
|
1077
|
endif; |
|
1444
|
1078
|
?> |
|
1445
|
1079
|
|
|
1446
|
1080
|
<div class="submit"><?php if ($object->show_inactive()) : ?> |
|
@@ -1449,10 +1083,91 @@ |
|
1449
|
1083
|
<?php endforeach; ?> |
|
1450
|
1084
|
<?php else : ?> |
|
1451
|
1085
|
<input type="hidden" name="update_uri" value="*" /> |
|
1452
|
1086
|
<?php endif; ?> |
|
1453
|
|
- <input class="button-primary" type="submit" name="update" value="<?php esc_html_e( FWP_CHECK_FOR_UPDATES ); ?>" /></div> |
|
1454
|
|
- |
|
1087
|
+ <input class="button-primary" type="submit" name="update" value="<?php _e(FWP_CHECK_FOR_UPDATES); ?>" /></div> |
|
1088
|
+ |
|
1455
|
1089
|
<br style="clear: both" /> |
|
1456
|
1090
|
</form> |
|
1457
|
1091
|
<?php |
|
1458
|
1092
|
} /* function fwp_syndication_manage_page_update_box () */ |
|
1093
|
+ |
|
1094
|
+function fwp_feedfinder_page () { |
|
1095
|
+ global $post_source, $fwp_post, $syndicationPage; |
|
1096
|
+ |
|
1097
|
+ if (isset($fwp_post['opml_lookup']) or isset($_FILES['opml_upload'])) : |
|
1098
|
+ $syndicationPage->accept_multiadd(); |
|
1099
|
+ return true; |
|
1100
|
+ else : |
|
1101
|
+ $post_source = 'feedwordpress_feeds'; |
|
1102
|
+ |
|
1103
|
+ // With action=feedfinder, this goes directly to the feedfinder page |
|
1104
|
+ include_once(dirname(__FILE__) . '/feeds-page.php'); |
|
1105
|
+ return false; |
|
1106
|
+ endif; |
|
1107
|
+} /* function fwp_feedfinder_page () */ |
|
1108
|
+ |
|
1109
|
+function fwp_switchfeed_page () { |
|
1110
|
+ global $wpdb, $wp_db_version; |
|
1111
|
+ global $fwp_post; |
|
1112
|
+ |
|
1113
|
+ // If this is a POST, validate source and user credentials |
|
1114
|
+ FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_switchfeed', /*capability=*/ 'manage_links'); |
|
1115
|
+ |
|
1116
|
+ $changed = false; |
|
1117
|
+ if (!isset($fwp_post['Cancel'])): |
|
1118
|
+ if (isset($fwp_post['save_link_id']) and ($fwp_post['save_link_id']=='*')) : |
|
1119
|
+ $changed = true; |
|
1120
|
+ $link_id = FeedWordPress::syndicate_link($fwp_post['feed_title'], $fwp_post['feed_link'], $fwp_post['feed']); |
|
1121
|
+ if ($link_id): |
|
1122
|
+ $existingLink = new SyndicatedLink($link_id); |
|
1123
|
+ |
|
1124
|
+ ?> |
|
1125
|
+<div class="updated"><p><a href="<?php print $fwp_post['feed_link']; ?>"><?php print esc_html($fwp_post['feed_title']); ?></a> |
|
1126
|
+has been added as a contributing site, using the feed at |
|
1127
|
+<<a href="<?php print $fwp_post['feed']; ?>"><?php print esc_html($fwp_post['feed']); ?></a>>. |
|
1128
|
+| <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php print $link_id; ?>">Configure settings</a>.</p></div> |
|
1129
|
+<?php else: ?> |
|
1130
|
+<div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo esc_html(mysql_error()); ?>]</p></div> |
|
1131
|
+<?php endif; |
|
1132
|
+ elseif (isset($fwp_post['save_link_id'])): |
|
1133
|
+ $existingLink = new SyndicatedLink($fwp_post['save_link_id']); |
|
1134
|
+ $changed = $existingLink->set_uri($fwp_post['feed']); |
|
1135
|
+ |
|
1136
|
+ if ($changed): |
|
1137
|
+ $home = $existingLink->homepage(/*from feed=*/ false); |
|
1138
|
+ $name = $existingLink->name(/*from feed=*/ false); |
|
1139
|
+ ?> |
|
1140
|
+<div class="updated"><p>Feed for <a href="<?php echo esc_html($home); ?>"><?php echo esc_html($name); ?></a> |
|
1141
|
+updated to <<a href="<?php echo esc_html($fwp_post['feed']); ?>"><?php echo esc_html($fwp_post['feed']); ?></a>>.</p></div> |
|
1142
|
+ <?php |
|
1143
|
+ endif; |
|
1144
|
+ endif; |
|
1145
|
+ endif; |
|
1146
|
+ |
|
1147
|
+ if (isset($existingLink)) : |
|
1148
|
+ $auth = FeedWordPress::post('link_rss_auth_method'); |
|
1149
|
+ if (!is_null($auth) and (strlen($auth) > 0) and ($auth != '-')) : |
|
1150
|
+ $existingLink->update_setting('http auth method', $auth); |
|
1151
|
+ $existingLink->update_setting('http username', |
|
1152
|
+ FeedWordPress::post('link_rss_username') |
|
1153
|
+ ); |
|
1154
|
+ $existingLink->update_setting('http password', |
|
1155
|
+ FeedWordPress::post('link_rss_password') |
|
1156
|
+ ); |
|
1157
|
+ else : |
|
1158
|
+ $existingLink->update_setting('http auth method', NULL); |
|
1159
|
+ $existingLink->update_setting('http username', NULL); |
|
1160
|
+ $existingLink->update_setting('http password', NULL); |
|
1161
|
+ endif; |
|
1162
|
+ do_action('feedwordpress_admin_switchfeed', $fwp_post['feed'], $existingLink); |
|
1163
|
+ $existingLink->save_settings(/*reload=*/ true); |
|
1164
|
+ endif; |
|
1165
|
+ |
|
1166
|
+ if (!$changed) : |
|
1167
|
+ ?> |
|
1168
|
+<div class="updated"><p>Nothing was changed.</p></div> |
|
1169
|
+ <?php |
|
1170
|
+ endif; |
|
1171
|
+ return true; // Continue |
|
1172
|
+} |
|
1173
|
+ |