PluginProbe
FeedWordPress / 2009.0618
FeedWordPress v2009.0618
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
← All changes | admin-ui.php +152 -32 2008.11012009.0618 View file →
@@ -1,29 +1,11 @@
1 1 <?php
2 2 function fwp_linkedit_single_submit ($status = NULL) {
3 - global $wp_db_version;
4 - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
3 + if (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) :
5 4 ?>
6 5 <div class="submitbox" id="submitlink">
7 6 <div id="previewview"></div>
8 -<div class="inside">
9 -<?php if (!is_null($status)) : ?>
10 - <p><strong>Publication</strong></p>
11 - <p>When a new post is syndicated from this feed...</p>
12 - <select name="feed_post_status">
13 - <option value="site-default" <?php echo $status['post']['site-default']; ?>> Use
14 - Syndication Options setting</option>
15 - <option value="publish" <?php echo $status['post']['publish']; ?>>Publish it immediately</option>
16 -
17 - <?php if (SyndicatedPost::use_api('post_status_pending')) : ?>
18 - <option value="pending" <?php echo $status['post']['pending']; ?>>Hold it Pending Review</option>
19 - <?php endif; ?>
20 -
21 - <option value="draft" <?php echo $status['post']['draft']; ?>>Save it as a draft</option>
22 - <option value="private" <?php echo $status['post']['private']; ?>>Keep it private</option>
23 - </select>
24 -<?php endif; ?>
25 -</div>
7 +<div class="inside"></div>
26 8
27 9 <p class="submit">
28 10 <input type="submit" name="submit" value="<?php _e('Save') ?>" />
29 11 </p>
@@ -32,10 +14,9 @@
32 14 endif;
33 15 }
34 16
35 17 function fwp_linkedit_periodic_submit ($caption = NULL) {
36 - global $wp_db_version;
37 - if (!(isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25)) :
18 + if (!fwp_test_wp_version(FWP_SCHEMA_25)) :
38 19 if (is_null($caption)) : $caption = __('Save Changes &raquo;'); endif;
39 20 ?>
40 21 <p class="submit">
41 22 <input type="submit" name="submit" value="<?php print $caption; ?>" />
@@ -43,8 +24,38 @@
43 24 <?php
44 25 endif;
45 26 }
46 27
28 +function fwp_linkedit_single_submit_closer ($caption = NULL) {
29 + if (fwp_test_wp_version(FWP_SCHEMA_27)) :
30 + if (is_null($caption)) : $caption = __('Save Changes'); endif;
31 +?>
32 +<p class="submit">
33 +<input class="button-primary" type="submit" name="submit" value="<?php print $caption; ?>" />
34 +</p>
35 +<?php
36 + endif;
37 +}
38 +
39 +function fwp_authors_single_submit ($link = NULL) {
40 + global $wp_db_version;
41 +
42 + if (fwp_test_wp_version(FWP_SCHEMA_25)) :
43 +?>
44 +<div class="submitbox" id="submitlink">
45 +<div id="previewview">
46 +</div>
47 +<div class="inside">
48 +</div>
49 +
50 +<p class="submit">
51 +<input type="submit" name="save" value="<?php _e('Save') ?>" />
52 +</p>
53 +</div>
54 +<?php
55 + endif;
56 +}
57 +
47 58 function fwp_option_box_opener ($legend, $id, $class = "stuffbox") {
48 59 global $wp_db_version;
49 60 if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) :
50 61 ?>
@@ -89,9 +100,9 @@
89 100
90 101 function fwp_category_box ($checked, $object, $tags = array()) {
91 102 global $wp_db_version;
92 103
93 - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : // WordPress 2.5.x
104 + if (fwp_test_wp_version(FWP_SCHEMA_25)) : // WordPress 2.5.x
94 105 ?>
95 106 <div id="category-adder" class="wp-hidden-children">
96 107 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
97 108 <p id="category-add" class="wp-hidden-child">
@@ -103,20 +114,22 @@
103 114 </p>
104 115 </div>
105 116
106 117 <ul id="category-tabs">
107 - <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a>
118 + <?php /* ui-tabs-selected in WP 2.7 CSS = tabs in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?>
119 + <li class="ui-tabs-selected tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a>
108 120 <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p>
109 121 </li>
110 122 </ul>
111 123
112 -<div id="categories-all" class="ui-tabs-panel">
124 +<?php /* ui-tabs-panel in WP 2.7 CSS = tabs-panel in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?>
125 +<div id="categories-all" class="ui-tabs-panel tabs-panel">
113 126 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
114 127 <?php fwp_category_checklist(NULL, false, $checked) ?>
115 128 </ul>
116 129 </div>
117 130 <?php
118 - elseif (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.x
131 + elseif (fwp_test_wp_version(FWP_SCHEMA_20)) : // WordPress 2.x
119 132 ?>
120 133 <div id="moremeta">
121 134 <div id="grabit" class="dbx-group">
122 135 <fieldset id="categorydiv" class="dbx-box">
@@ -123,9 +136,10 @@
123 136 <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
124 137 <div class="dbx-content">
125 138 <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
126 139 <p id="jaxcat"></p>
127 - <ul id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></ul></div>
140 + <div id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></div>
141 + </div>
128 142 </fieldset>
129 143 </div>
130 144 </div>
131 145 <?php
@@ -130,12 +144,12 @@
130 144 </div>
131 145 <?php
132 146 else : // WordPress 1.5
133 147 ?>
134 - <fieldset id="categorydiv" style="width: 20%; margin-right: 2em">
148 + <fieldset style="width: 60%;">
135 149 <legend><?php _e('Categories') ?></legend>
136 150 <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p>
137 - <div style="height: 20em"><?php fwp_category_checklist(NULL, false, $checked); ?></div>
151 + <div style="height: 10em; overflow: scroll;"><?php fwp_category_checklist(NULL, false, $checked); ?></div>
138 152 </fieldset>
139 153 <?php
140 154 endif;
141 155 }
@@ -141,21 +155,127 @@
141 155 }
142 156
143 157 function update_feeds_mention ($feed) {
144 158 echo "<li>Updating <cite>".$feed['link/name']."</cite> from &lt;<a href=\""
145 - .$feed['link/uri']."\">".$feed['link/uri']."</a>&gt; ...</li>\n";
159 + .$feed['link/uri']."\">".$feed['link/uri']."</a>&gt; ...";
146 160 flush();
147 161 }
162 +function update_feeds_finish ($feed, $added, $dt) {
163 + echo " completed in $dt second".(($dt==1)?'':'s')."</li>\n";
164 +}
148 165
149 166 function fwp_author_list () {
150 167 global $wpdb;
151 168 $ret = array();
152 - $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY display_name");
169 +
170 + // display_name introduced in WP 2.0
171 + if (fwp_test_wp_version(FWP_SCHEMA_20)) :
172 + $name_column = 'display_name';
173 + else :
174 + $name_column = 'user_nickname';
175 + endif;
176 +
177 + $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY {$name_column}");
153 178 if (is_array($users)) :
154 179 foreach ($users as $user) :
155 180 $id = (int) $user->ID;
156 - $ret[$id] = $user->display_name;
181 + $ret[$id] = $user->{$name_column};
182 + if (strlen(trim($ret[$id])) == 0) :
183 + $ret[$id] = $user->user_login;
184 + endif;
157 185 endforeach;
158 186 endif;
159 187 return $ret;
160 188 }
189 +
190 +class FeedWordPressSettingsUI {
191 + function instead_of_posts_box ($link_id = null) {
192 + fwp_option_box_opener('Syndicated Posts, Comments & Pings', 'syndicatedpostsdiv', 'postbox');
193 + if (!is_null($link_id)) :
194 + $from_this_feed = 'from this feed';
195 + $by_default = '';
196 + $id_param = "&amp;link_id=".$link_id;
197 + else :
198 + $from_this_feed = 'from syndicated feeds';
199 + $by_default = " by default";
200 + $id_param = "";
201 + endif;
202 +?>
203 +<p>Use the <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/posts-page.php<?php print $id_param; ?>"><?php _e('Posts'); ?></a>
204 +settings page to set up how new posts <?php print $from_this_feed; ?> will be published<?php $by_default; ?>, whether they will accept
205 +comments and pings, any custom fields that should be set on each post, etc.</p>
206 +<?php
207 + fwp_option_box_closer();
208 + } /* FeedWordPressSettingsUI::instead_of_posts_box () */
209 +
210 + function instead_of_authors_box ($link_id = null) {
211 + if (!is_null($link_id)) :
212 + $from_this_feed = 'from this feed';
213 + $by_default = '';
214 + $id_param = "&amp;link_id=".$link_id;
215 + else :
216 + $from_this_feed = 'from syndicated feeds';
217 + $by_default = " by default";
218 + $id_param = "";
219 + endif;
220 +
221 + fwp_option_box_opener('Syndicated Authors', 'authordiv', 'postbox')
222 +?>
223 +<p>Use the <a
224 +href="admin.php?page=<?php print $GLOBALS['fwp_path']
225 +?>/authors-page.php<?php print $id_param; ?>"><?php _e('Authors');
226 +?></a> settings page to set up how new posts
227 +<?php print $from_this_feed; ?> will be assigned to
228 +authors.</p>
229 +<?php
230 + fwp_option_box_closer();
231 + } /* FeedWordPressSettingsUI::instead_of_authors_box () */
232 +
233 + function instead_of_categories_box ($link_id = null) {
234 + if (!is_null($link_id)) :
235 + $from_this_feed = 'from this feed';
236 + $by_default = '';
237 + $id_param = "&amp;link_id=".$link_id;
238 + else :
239 + $from_this_feed = 'from syndicated feeds';
240 + $by_default = " by default";
241 + $id_param = "";
242 + endif;
243 +
244 + fwp_option_box_opener(__('Categories & Tags'), 'categorydiv', 'postbox');
245 +?>
246 +<p>Use the <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/categories-page.php<?php print $id_param; ?>"><?php _e('Categories & Tags'); ?></a>
247 +settings page to set up how new posts <?php print $from_this_feed; ?> are assigned categories or tags<?php print $by_default; ?>.</p>
248 +<?php
249 + fwp_option_box_closer();
250 + } /* FeedWordPressSettingsUI::instead_of_categories_box () */
251 +
252 +} /* class FeedWordPressSettingsUI */
253 +
254 +function fwp_insert_new_user ($newuser_name) {
255 + global $wpdb;
256 +
257 + $ret = null;
258 + if (strlen($newuser_name) > 0) :
259 + $userdata = array();
260 + $userdata['ID'] = NULL;
261 +
262 + $userdata['user_login'] = sanitize_user($newuser_name);
263 + $userdata['user_login'] = apply_filters('pre_user_login', $userdata['user_login']);
264 +
265 + $userdata['user_nicename'] = sanitize_title($newuser_name);
266 + $userdata['user_nicename'] = apply_filters('pre_user_nicename', $userdata['user_nicename']);
267 +
268 + $userdata['display_name'] = $wpdb->escape($newuser_name);
269 +
270 + $newuser_id = wp_insert_user($userdata);
271 + if (is_numeric($newuser_id)) :
272 + $ret = $newuser_id;
273 + else :
274 + // TODO: Add some error detection and reporting
275 + endif;
276 + else :
277 + // TODO: Add some error reporting
278 + endif;
279 + return $ret;
280 +} /* fwp_insert_new_user () */
161 281