| @@ -212,8 +212,32 @@ | ||
| 212 | 212 | die($message); |
| 213 | 213 | } /* wp_die() */ |
| 214 | 214 | } /* if */ |
| 215 | 215 | |
| 216 | +if (!function_exists('add_post_meta')) { | |
| 217 | + function add_post_meta ($postId, $key, $value, $unique) { | |
| 218 | + global $wpdb; | |
| 219 | + | |
| 220 | + $postId = (int) $postId; | |
| 221 | + $key = $wpdb->escape($key); | |
| 222 | + $value = $wpdb->escape($value); | |
| 223 | + | |
| 224 | + $result = $wpdb->query(" | |
| 225 | + INSERT INTO $wpdb->postmeta | |
| 226 | + SET | |
| 227 | + post_id='$postId', | |
| 228 | + meta_key='$key', | |
| 229 | + meta_value='$value' | |
| 230 | + "); | |
| 231 | + if (!$result) : | |
| 232 | + $err = mysql_error(); | |
| 233 | + if (FEEDWORDPRESS_DEBUG) : | |
| 234 | + echo "[DEBUG:".date('Y-m-d H:i:S')."][feedwordpress]: post metadata insertion FAILED for field '$key' := '$value': [$err]"; | |
| 235 | + endif; | |
| 236 | + endif; | |
| 237 | + } /* add_post_meta() */ | |
| 238 | +} /* if */ | |
| 239 | + | |
| 216 | 240 | function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) { |
| 217 | 241 | if (function_exists('wp_category_checklist')) : |
| 218 | 242 | wp_category_checklist($post_id, $descendents_and_self, $selected_cats); |
| 219 | 243 | else : |
| @@ -258,9 +282,9 @@ | ||
| 258 | 282 | if (get_option('feedwordpress_version') != FEEDWORDPRESS_VERSION) : |
| 259 | 283 | echo "<div class=\"wrap\">\n"; |
| 260 | 284 | echo "<h2>Upgrading FeedWordPress...</h2>"; |
| 261 | 285 | |
| 262 | - $feedwordpress =& new FeedWordPress; | |
| 286 | + $feedwordpress = new FeedWordPress; | |
| 263 | 287 | $feedwordpress->upgrade_database($ver); |
| 264 | 288 | echo "<p><strong>Done!</strong> Upgraded database to version ".FEEDWORDPRESS_VERSION.".</p>\n"; |
| 265 | 289 | echo "<form action=\"\" method=\"get\">\n"; |
| 266 | 290 | echo "<div class=\"submit\"><input type=\"hidden\" name=\"page\" value=\"syndication.php\" />"; |