| @@ -14,15 +14,8 @@ | ||
| 14 | 14 | endif; |
| 15 | 15 | return $good; |
| 16 | 16 | } /* function fwp_test_wp_version () */ |
| 17 | 17 | |
| 18 | -if (!function_exists('stripslashes_deep')) { | |
| 19 | - function stripslashes_deep($value) { | |
| 20 | - $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); | |
| 21 | - return $value; | |
| 22 | - } | |
| 23 | -} | |
| 24 | - | |
| 25 | 18 | if (!function_exists('get_option')) { |
| 26 | 19 | function get_option ($option) { |
| 27 | 20 | return get_settings($option); |
| 28 | 21 | } |
| @@ -52,9 +45,9 @@ | ||
| 52 | 45 | $fwp_capability['manage_options'] = 'manage_options'; |
| 53 | 46 | $fwp_capability['manage_links'] = 'manage_links'; |
| 54 | 47 | } |
| 55 | 48 | if (!function_exists('sanitize_user')) { |
| 56 | - function sanitize_user ($text, $strict = false) { | |
| 49 | + function sanitize_user ($text, $strict) { | |
| 57 | 50 | return $text; // Don't munge it if it wasn't munged going in... |
| 58 | 51 | } |
| 59 | 52 | } |
| 60 | 53 | if (!function_exists('wp_insert_user')) { |
| @@ -88,37 +81,20 @@ | ||
| 88 | 81 | function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) { |
| 89 | 82 | if (function_exists('wp_category_checklist')) : |
| 90 | 83 | wp_category_checklist($post_id, $descendents_and_self, $selected_cats); |
| 91 | 84 | else : |
| 85 | + global $checked_categories; | |
| 86 | + | |
| 92 | 87 | // selected_cats is an array of integer cat_IDs / term_ids for |
| 93 | 88 | // the categories that should be checked |
| 94 | - global $post_ID; | |
| 95 | - | |
| 96 | - $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; | |
| 97 | 93 | |
| 98 | - // Undo damage from usort() in WP 2.0 | |
| 99 | - $dogs = array(); | |
| 100 | - foreach ($cats as $cat) : | |
| 101 | - $dogs[$cat['cat_ID']] = $cat; | |
| 102 | - endforeach; | |
| 103 | - foreach ($selected_cats as $cat_id) : | |
| 104 | - $dogs[$cat_id]['checked'] = true; | |
| 105 | - endforeach; | |
| 106 | - write_nested_categories($dogs); | |
| 94 | + $checked_categories = $cats; | |
| 95 | + dropdown_categories(); | |
| 107 | 96 | endif; |
| 108 | -} | |
| 109 | - | |
| 110 | -function fwp_time_elapsed ($ts) { | |
| 111 | - if (function_exists('human_time_diff')) : | |
| 112 | - if ($ts >= time()) : | |
| 113 | - $ret = __(human_time_diff($ts)." from now"); | |
| 114 | - else : | |
| 115 | - $ret = __(human_time_diff($ts)." ago"); | |
| 116 | - endif; | |
| 117 | - else : | |
| 118 | - $ret = strftime('%x %X', $ts); | |
| 119 | - endif; | |
| 120 | - return $ret; | |
| 121 | 97 | } |
| 122 | 98 | |
| 123 | 99 | ################################################################################ |
| 124 | 100 | ## UPGRADE INTERFACE: Have users upgrade DB from older versions of FWP ######### |