function get_static_sub_post($static, $sub_static) { $posts = get_static_sub_pages($static); $tmp = array(); if (!empty($posts)) { foreach ($posts as $index => $v) { if (stripos($v, $sub_static . '.md') !== false) { $post = new stdClass(); // Replaced string $replaced = substr($v, 0, strrpos($v, '/')) . '/'; // The static page URL $url = str_replace($replaced, '', $v); $post->url = site_url() . $static . "/" . str_replace('.md', '', $url); $post->file = $v; // Get the contents and convert it to HTML $content = file_get_contents($v); // Extract the title and body $post->title = get_content_tag('t', $content, $sub_static); $post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); $post->views = get_views($post->file); $post->description = get_content_tag("d", $content, get_description($post->body)); $tmp[] = $post; } } } return $tmp; }
<?php if (isset($_SESSION[config("site.url")]['user'])) { $user = $_SESSION[config("site.url")]['user']; } $filename = 'content/' . $user . '/author.md'; if (file_exists($filename)) { $content = file_get_contents($filename); $oldtitle = get_content_tag('t', $content, 'user'); $oldcontent = remove_html_comments($content); } else { $oldtitle = $user; $oldcontent = 'Just another HTMLy user.'; } ?> <link rel="stylesheet" type="text/css" href="<?php echo site_url(); ?> system/admin/editor/css/editor.css"/> <script src="<?php echo site_url(); ?> system/resources/js/jquery.min.js"></script> <script src="<?php echo site_url(); ?> system/resources/js/jquery-ui.min.js"></script> <script type="text/javascript" src="<?php echo site_url(); ?> system/admin/editor/js/Markdown.Converter.js"></script>
<?php if (isset($_GET['id'])) { $id = $_GET['id']; $fileName = 'data/sub/' . $id . '.txt'; if (file_exists($fileName)) { $text = file_get_contents($fileName); $body = $md->defaultTransform(remove_html_comments($text)); } }
<?php $commonSub = $globalMd->defaultTransform(remove_html_comments(file_get_contents('data/sub/common.txt'))); if ($commonSub != '') { $commonSub = '<div style="padding-bottom:20px;">' . $commonSub . '</div>'; } $subPeculiar = ''; if ($globalPostId != -1 && file_exists('data/sub/' . $globalPostId . '.txt')) { $subPeculiar = $globalMd->defaultTransform(remove_html_comments(file_get_contents('data/sub/' . $globalPostId . '.txt'))); if ($subPeculiar != '') { $subPeculiar = '<div style="padding-bottom:20px;">' . $subPeculiar . '</div>'; } } if ($globalUseCommonView) { $globalViewParams = ['siteTitle' => $globalSiteTitle, 'staticPages' => $globalStaticPages, 'postId' => $globalPostId, 'commonSub' => $commonSub, 'subPeculiar' => $subPeculiar, 'cssFileName' => $globalCssFileName, 'validationErrorMessages' => $globalValidationErrorMessages, 'formAction' => $globalFormAction, 'formSendType' => $globalFormSendType, 'formMethod' => $globalFormMethod, 'message' => $globalMessage, 'messages' => $globalMessages, 'html' => $globalBody]; }
function get_frontpage() { $front = new stdClass(); $filename = 'content/data/frontpage/frontpage.md'; if (file_exists($filename)) { $content = file_get_contents($filename); $front->title = get_content_tag('t', $content, 'Welcome'); $front->url = site_url() . 'front'; // Get the contents and convert it to HTML $front->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); } else { $front->title = 'Welcome'; $front->url = site_url() . 'front'; $front->body = 'Welcome to our website.'; } return $front; }
<?php $body = ''; if (isset($_GET['id'])) { $id = $_GET['id']; $globalPostId = 'static' . $id; $markdown = 'data/static/' . $id . '.txt'; $fileName = $markdown; if (file_exists($fileName)) { $text = file_get_contents($fileName); $caption = getStaticTitle($id); $body = '<h2>' . $caption . '</h2>' . $globalMd->defaultTransform(remove_html_comments($text)); } else { $body = 'file not found'; } if (LOGIN_FLG && $body != 'file not found') { $body = '<button onclick="return staticEdit(' . $id . ');">編集</button> <button onclick="return subcontents(\'static' . $id . '\');">サブコンテンツ</button> <button onclick="return staticDel(' . $id . ');">削除</button>' . $body; } } else { $body = 'not found'; } $globalBody = $body;