public static function importUrl($url) { $response = new stdClass(); $response->success = false; if ($post = Post::getPostFromUrl($url)) { $postResponse = new stdClass(); $postResponse->id = $post->ID; $postResponse->url = $url; $response->post = $postResponse; $response->success = true; } return $response; }
public function retry() { // Have to use a query string, as wordpress tries to // parse the URL if it's in a /retry/{id} param $catfish_url = $_GET['url']; $check = Post::getPostFromUrl($catfish_url); if ($check) { $permalink = get_permalink($check->id); header("Location: {$permalink}"); } else { echo "<h1>Failed to import</h1>"; echo "<p>Consider trashing</p>"; } }
/** * @Given /^the post "([^"]*)"$/ */ public function thePost($url) { self::$post = Post::getPostFromUrl($url); }
/** * @Given /^the category slug "([^"]*)"$/ */ public function theCategorySlug($categorySlug) { $category = Post::getCategory(self::$post); Assert::assertEquals($categorySlug, $category->slug); }