PluginProbe
FeedWordPress / 2008.1101
FeedWordPress v2008.1101
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 | compatability.php +10 -72 2009.07072008.1101 View file →
@@ -14,43 +14,8 @@
14 14 endif;
15 15 return $good;
16 16 } /* function fwp_test_wp_version () */
17 17
18 -class FeedWordPressCompatibility {
19 - /*static*/ function validate_http_request ($action = -1, $capability = null) {
20 - // Only worry about this if we're using a method with significant side-effects
21 - if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') :
22 - // Limit post by user capabilities
23 - if (!is_null($capability) and !current_user_can($capability)) :
24 - wp_die(__('Cheatin’ uh?'));
25 - endif;
26 -
27 - // If check_admin_referer() checks a nonce.
28 - if (function_exists('wp_verify_nonce')) :
29 - check_admin_referer($action);
30 -
31 - // No nonces means no checking nonces.
32 - else :
33 - check_admin_referer();
34 - endif;
35 - endif;
36 - } /* FeedWordPressCompatibility::validate_http_request() */
37 -
38 - /*static*/ function stamp_nonce ($action = -1) {
39 - // stamp form with hidden fields for a nonce in WP 2.0.3 & later
40 - if (function_exists('wp_nonce_field')) :
41 - wp_nonce_field($action);
42 - endif;
43 - } /* FeedWordPressCompatibility::stamp_nonce() */
44 -} /* class FeedWordPressCompatibility */
45 -
46 -if (!function_exists('stripslashes_deep')) {
47 - function stripslashes_deep($value) {
48 - $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
49 - return $value;
50 - }
51 -}
52 -
53 18 if (!function_exists('get_option')) {
54 19 function get_option ($option) {
55 20 return get_settings($option);
56 21 }
@@ -72,11 +37,8 @@
72 37 break;
73 38 case 'manage_links':
74 39 $can = ($user_level >= 5);
75 40 break;
76 - case 'edit_files':
77 - $can = ($user_level >= 9);
78 - break;
79 41 endswitch;
80 42 return $can;
81 43 }
82 44 } else {
@@ -83,9 +45,9 @@
83 45 $fwp_capability['manage_options'] = 'manage_options';
84 46 $fwp_capability['manage_links'] = 'manage_links';
85 47 }
86 48 if (!function_exists('sanitize_user')) {
87 - function sanitize_user ($text, $strict = false) {
49 + function sanitize_user ($text, $strict) {
88 50 return $text; // Don't munge it if it wasn't munged going in...
89 51 }
90 52 }
91 53 if (!function_exists('wp_insert_user')) {
@@ -113,51 +75,28 @@
113 75 $id = $wpdb->insert_id;
114 76
115 77 return $id;
116 78 }
117 -} /* if (!function_exists('wp_insert_user')) */
79 +}
118 80
119 -if (!function_exists('wp_die')) {
120 - function wp_die ( $message, $title = '', $args = array() ) {
121 - die($message);
122 - } /* wp_die() */
123 -} /* if */
124 -
125 81 function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) {
126 82 if (function_exists('wp_category_checklist')) :
127 83 wp_category_checklist($post_id, $descendents_and_self, $selected_cats);
128 84 else :
85 + global $checked_categories;
86 +
129 87 // selected_cats is an array of integer cat_IDs / term_ids for
130 88 // the categories that should be checked
131 - global $post_ID;
132 -
133 - $cats = get_nested_categories();
89 + $cats = array();
90 + if ($post_id) : $cats = wp_get_post_categories($post_id);
91 + else : $cats = $selected_cats;
92 + endif;
134 93
135 - // Undo damage from usort() in WP 2.0
136 - $dogs = array();
137 - foreach ($cats as $cat) :
138 - $dogs[$cat['cat_ID']] = $cat;
139 - endforeach;
140 - foreach ($selected_cats as $cat_id) :
141 - $dogs[$cat_id]['checked'] = true;
142 - endforeach;
143 - write_nested_categories($dogs);
94 + $checked_categories = $cats;
95 + dropdown_categories();
144 96 endif;
145 97 }
146 98
147 -function fwp_time_elapsed ($ts) {
148 - if (function_exists('human_time_diff')) :
149 - if ($ts >= time()) :
150 - $ret = __(human_time_diff($ts)." from now");
151 - else :
152 - $ret = __(human_time_diff($ts)." ago");
153 - endif;
154 - else :
155 - $ret = strftime('%x %X', $ts);
156 - endif;
157 - return $ret;
158 -}
159 -
160 99 ################################################################################
161 100 ## UPGRADE INTERFACE: Have users upgrade DB from older versions of FWP #########
162 101 ################################################################################
163 102
@@ -199,9 +138,8 @@
199 138
200 139 <p>This may take several minutes for a large installation.</p>
201 140
202 141 <form action="" method="post">
203 -<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_upgrade'); ?>
204 142 <div class="submit"><input type="submit" name="action" value="Upgrade" /></div>
205 143 </form>
206 144 </div>
207 145 <?php