function __construct(TimberPost $post) { $this->post = $post; $object = Generator::create_object($post); $this->json = json_encode($object); $this->article_array = json_decode($this->json, true); }
/** * Show the article. */ public function view($category_slug, $post_slug) { $post = $this->get_postby_category_slug_post_slug($category_slug, $post_slug); if (!$post) { throw new Exception('Post not found'); } $object = Generator::create_object($post); header('Content-Type: application/json'); echo json_encode($object); }
function __construct(TimberPost $post) { $this->post = $post; $upload_dir = wp_upload_dir()['basedir']; $this->tmp_dir = "{$upload_dir}/apple-news-tmp"; $bundle_manifest = new BundleManifest($post); $this->article_json = $bundle_manifest->json(); $article_walker = new ArticleWalker($post); $this->asset_urls = array_merge($article_walker->get_array_of_asset_urls(), $this->get_common_bundle_array()); $object = Generator::create_object($post); $unmodified_json = json_encode($object); $this->article = json_decode($unmodified_json, true); }
/** * @Given /^I should have an Apple News formatted object of the post$/ */ public function iShouldHaveAnAppleNewsFormattedObjectOfThePost() { self::$appleNewsObject = Generator::create_object(self::$post); }
function __construct(TimberPost $post) { $object = Generator::create_object($post); $article_json = json_encode($object); $this->article_json = $this->update_asset_locations_to_bundle($article_json); }