PluginProbe
FeedWordPress / 2008.1105
FeedWordPress v2008.1105
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
feedwordpress / compatability.php

compatability.php in FeedWordPress 2008.1105, at compatability.php

148 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 ################################################################################
3 ## LEGACY API: Replicate or mock up functions for legacy support purposes ######
4 ################################################################################
5
6 // version testing
7 function fwp_test_wp_version ($floor, $ceiling = NULL) {
8 global $wp_db_version;
9
10 $ver = (isset($wp_db_version) ? $wp_db_version : 0);
11 $good = ($ver >= $floor);
12 if (!is_null($ceiling)) :
13 $good = ($good and ($ver < $ceiling));
14 endif;
15 return $good;
16 } /* function fwp_test_wp_version () */
17
18 if (!function_exists('get_option')) {
19 function get_option ($option) {
20 return get_settings($option);
21 }
22 }
23 if (!function_exists('current_user_can')) {
24 $fwp_capability['manage_options'] = 6;
25 $fwp_capability['manage_links'] = 5;
26 function current_user_can ($task) {
27 global $user_level;
28
29 $can = false;
30
31 // This is **not** a full replacement for current_user_can. It
32 // is only for checking the capabilities we care about via the
33 // WordPress 1.5 user levels.
34 switch ($task) :
35 case 'manage_options':
36 $can = ($user_level >= 6);
37 break;
38 case 'manage_links':
39 $can = ($user_level >= 5);
40 break;
41 endswitch;
42 return $can;
43 }
44 } else {
45 $fwp_capability['manage_options'] = 'manage_options';
46 $fwp_capability['manage_links'] = 'manage_links';
47 }
48 if (!function_exists('sanitize_user')) {
49 function sanitize_user ($text, $strict) {
50 return $text; // Don't munge it if it wasn't munged going in...
51 }
52 }
53 if (!function_exists('wp_insert_user')) {
54 function wp_insert_user ($userdata) {
55 global $wpdb;
56
57 #-- Help WordPress 1.5.x quack like a duck
58 $login = $userdata['user_login'];
59 $author = $userdata['display_name'];
60 $nice_author = $userdata['user_nicename'];
61 $email = $userdata['user_email'];
62 $url = $userdata['user_url'];
63
64 $wpdb->query (
65 "INSERT INTO $wpdb->users
66 SET
67 ID='0',
68 user_login='$login',
69 user_firstname='$author',
70 user_nickname='$author',
71 user_nicename='$nice_author',
72 user_description='$author',
73 user_email='$email',
74 user_url='$url'");
75 $id = $wpdb->insert_id;
76
77 return $id;
78 }
79 }
80
81 function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) {
82 if (function_exists('wp_category_checklist')) :
83 wp_category_checklist($post_id, $descendents_and_self, $selected_cats);
84 else :
85 global $checked_categories;
86
87 // selected_cats is an array of integer cat_IDs / term_ids for
88 // the categories that should be checked
89 $cats = array();
90 if ($post_id) : $cats = wp_get_post_categories($post_id);
91 else : $cats = $selected_cats;
92 endif;
93
94 $checked_categories = $cats;
95 dropdown_categories();
96 endif;
97 }
98
99 ################################################################################
100 ## UPGRADE INTERFACE: Have users upgrade DB from older versions of FWP #########
101 ################################################################################
102
103 function fwp_upgrade_page () {
104 if (isset($GLOBALS['fwp_post']['action']) and $GLOBALS['fwp_post']['action']=='Upgrade') :
105 $ver = get_option('feedwordpress_version');
106 if (get_option('feedwordpress_version') != FEEDWORDPRESS_VERSION) :
107 echo "<div class=\"wrap\">\n";
108 echo "<h2>Upgrading FeedWordPress...</h2>";
109
110 $feedwordpress =& new FeedWordPress;
111 $feedwordpress->upgrade_database($ver);
112 echo "<p><strong>Done!</strong> Upgraded database to version ".FEEDWORDPRESS_VERSION.".</p>\n";
113 echo "<form action=\"\" method=\"get\">\n";
114 echo "<div class=\"submit\"><input type=\"hidden\" name=\"page\" value=\"syndication.php\" />";
115 echo "<input type=\"submit\" value=\"Continue &raquo;\" /></form></div>\n";
116 echo "</div>\n";
117 return;
118 else :
119 echo "<div class=\"updated\"><p>Already at version ".FEEDWORDPRESS_VERSION."!</p></div>";
120 endif;
121 endif;
122 ?>
123 <div class="wrap">
124 <h2>Upgrade FeedWordPress</h2>
125
126 <p>It appears that you have installed FeedWordPress
127 <?php echo FEEDWORDPRESS_VERSION; ?> as an upgrade to an existing installation of
128 FeedWordPress. That's no problem, but you will need to take a minute out first
129 to upgrade your database: some necessary changes in how the software keeps
130 track of posts and feeds will cause problems such as duplicate posts and broken
131 templates if we were to continue without the upgrade.</p>
132
133 <p>Note that most of FeedWordPress's functionality is temporarily disabled
134 until we have successfully completed the upgrade. Everything should begin
135 working as normal again once the upgrade is complete. There's extraordinarily
136 little chance of any damage as the result of the upgrade, but if you're paranoid
137 like me you may want to back up your database before you proceed.</p>
138
139 <p>This may take several minutes for a large installation.</p>
140
141 <form action="" method="post">
142 <div class="submit"><input type="submit" name="action" value="Upgrade" /></div>
143 </form>
144 </div>
145 <?php
146 } // function fwp_upgrade_page ()
147
148