Пример #1
0
 public static function commentForm()
 {
     global $Candy;
     $post = getBlogPost($_GET['post']);
     $url = $Candy['options']->getOption('site_url');
     $html = '<div id="disqus_thread"></div>' . "\n";
     $html .= '<script type="text/javascript">' . "\n";
     $html .= "var disqus_shortname = '" . self::disqusAccount() . "';\n";
     if (!empty($post)) {
         $html .= "var disqus_identifier = '" . $post[0]->post_id . "';\n";
     }
     $html .= "var disqus_url = '{$url}" . $_GET['page'] . "/" . $_GET['category'] . "/" . $_GET['post'] . "';\n";
     $html .= "(function() {\n";
     $html .= "var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n";
     $html .= "dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';\n";
     $html .= "(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n";
     $html .= "})();\n";
     $html .= "</script>";
     echo $html;
 }
Пример #2
0
global $Candy;
$theme = $Candy['options']->getOption('theme');
$siteurl = $Candy['options']->getOption('site_url');
?>

<?php 
if (isset($_GET['post']) && $_GET['post'] != '') {
    ?>
	
	<?php 
    $pieces = explode('-', $_GET['post']);
    $refer = isset($_SERVER['HTTP_REFERER']) ? explode('?', $_SERVER['HTTP_REFERER']) : array('');
    if (count($pieces) == 2 && $pieces[0] == 'preview' && is_numeric($pieces[1]) && $refer[0] == $siteurl . 'cms-admin/dashboard.php') {
        $post = getBlogPostById($pieces[1]);
    } else {
        $post = getBlogPost($_GET['post']);
    }
    if (!empty($post)) {
        // Include the single.php template from theme if it's there!
        $themeSingle = THEME_PATH . $theme . '/blog/single.php';
        if (file_exists($themeSingle)) {
            include $themeSingle;
        } else {
            include 'templates/single.php';
        }
    } else {
        include THEME_PATH . $theme . '/404.php';
    }
    ?>

<?php 
Пример #3
0
   <meta charset="utf-8">
   <link href="style.css" rel="stylesheet" type="text/css" />
 </head>
 <body>
   <div id="header">
     <div id="sitename">
       <a href='/blog/home.php'>Web-Course first blog</a>
     </div>
     <h1>Blog</h1>
     <div class="slogan">Everyone needs a place for his thoughts...</div>
   </div>
   <div id="content">
     <?php 
$post_id = $_GET['post_id'];
if (isset($post_id)) {
    print getBlogPost($post_id);
} else {
    print 'No Such Post';
}
?>
  </div>
  <div id="footer">
    Copyright OMSU Web-Course 2015 
  </div>
 </body>
 </html>

<?php 
function getBlogPost($id)
{
    $posts = getPosts();