function wobi_save_post($post_ID) { $save_dir = getcwd(); chdir(WP_CONTENT_DIR . "/plugins/wobi-bittorrent"); if (!$_POST) { return; } /* $content = $_POST["post_content"]; $_POST["media"] = get_bloginfo("url")."/wp-content/upload/*[^']"; get_po*/ $custom_fields = get_post_custom($post_ID); $my_custom_field = $custom_fields['enclosure']; $added = array(); if (is_array($my_custom_field)) { foreach ($my_custom_field as $key => $value) { $tmp1 = explode("\n", $value); $file_url = trim($tmp1[0]); $file_type = trim($tmp1[2]); $tmp2 = explode("/wp-content/", $file_url); $file_path = WP_CONTENT_DIR . "/" . $tmp2[1]; $filename = basename($file_path); if (!isset($added[$filename])) { if (get_post_meta($post_ID, "torrent-{$filename}", true) == '') { if ($pf = wobi_publish_file($file_path, $file_url)) { $added[$filename] = $pf; add_post_meta($post_ID, "torrent-{$filename}", $pf, true); } } } } } chdir($save_dir); }
<html> <head> <title>Testing Wobi</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <!--link rel="stylesheet" href="./css/style.css" type="text/css" /--> </head> <body> <?php include_once 'wobi.php'; wobi_publish_file("/home/jeko/public_html/test.mp3", "http://localhost/jeko/test.mp3");