コード例 #1
0
ファイル: index.php プロジェクト: dangerdan/Dropplets2
 $post_author_twitter = str_replace(array("\n", '- '), '', $fcontents[2]);
 // Get the published date.
 $published_iso_date = str_replace('-', '', $fcontents[3]);
 // Generate the published date.
 $published_date = strftime($date_format, strtotime($published_iso_date));
 // Get the post category.
 $post_category = str_replace(array("\n", '-'), '', $fcontents[4]);
 // Get the post status.
 $post_status = str_replace(array("\n", '- '), '', $fcontents[5]);
 // Get the post category link.
 $post_category_link = $blog_url . 'category/' . urlencode(trim(strtolower($post_category)));
 // Get the post link.
 $post_link = $blog_url . str_replace(array($settings->get('file_ext'), $settings->posts_dir), '', $filename);
 // Get the post image url.
 $postHelper = new PostHelper();
 $post_image = $postHelper->get_post_image_url($filename) ?: $postHelper->get_twitter_profile_img($post_author_twitter);
 // Get the post content
 $file_array = array_slice(file($filename), 7);
 $post_content = \Michelf\Markdown::defaultTransform(trim(implode("", $file_array)));
 // free memory
 unset($file_array);
 // Get the site title.
 $page_title = trim(str_replace('# ', '', $fcontents[0]));
 // Generate the page description and author meta.
 $get_page_meta[] = '<meta name="description" content="' . $post_intro . '">';
 $get_page_meta[] = '<meta name="author" content="' . $post_author . '">';
 // Generate the Twitter card.
 $get_page_meta[] = '<meta name="twitter:card" content="summary">';
 $get_page_meta[] = '<meta name="twitter:site" content="' . $blog_twitter . '">';
 $get_page_meta[] = '<meta name="twitter:title" content="' . $page_title . '">';
 $get_page_meta[] = '<meta name="twitter:description" content="' . $post_intro . '">';