コード例 #1
0
 public function _ShowPost()
 {
     global $page;
     $page->label = SimpleBlogCommon::Underscores($this->post['title']);
     $class = $id = '';
     if (common::LoggedIn()) {
         SimpleBlog::EditLinks($this->post_id, $class, $id);
     }
     echo '<div class="blog_post single_blog_item ' . $class . '" ' . $id . '>';
     //heading
     $header = '<h2 id="blog_post_' . $this->post_id . '">';
     if (SimpleBlogCommon::AStrGet('drafts', $this->post_id)) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Draft');
         $header .= '</span> ';
     } elseif ($this->post['time'] > time()) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Pending');
         $header .= '</span> ';
     }
     $header .= SimpleBlogCommon::PostLink($this->post_id, $page->label);
     $header .= '</h2>';
     SimpleBlogCommon::BlogHead($header, $this->post_id, $this->post);
     //content
     echo '<div class="twysiwygr">';
     echo $this->post['content'];
     echo '</div>';
     echo '</div>';
     echo '<br/>';
     echo '<div class="clear"></div>';
     $this->Categories();
     $this->PostLinks();
     $this->Comments();
 }
コード例 #2
0
ファイル: SimpleBlog.php プロジェクト: Typesetter/Simple-Blog
 /**
  * Display the html for a single blog post
  *
  */
 public function ShowPostContent($post_index)
 {
     if (!common::LoggedIn() && SimpleBlogCommon::AStrGet('drafts', $post_index)) {
         return false;
     }
     $post = SimpleBlogCommon::GetPostContent($post_index);
     $class = $id = '';
     if (common::LoggedIn()) {
         SimpleBlog::EditLinks($post_index, $class, $id);
     }
     echo '<div class="blog_post post_list_item' . $class . '" ' . $id . '>';
     $header = '<h2 id="blog_post_' . $post_index . '">';
     if (SimpleBlogCommon::AStrGet('drafts', $post_index)) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Draft');
         $header .= '</span> ';
     } elseif ($post['time'] > time()) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Pending');
         $header .= '</span> ';
     }
     $label = SimpleBlogCommon::Underscores($post['title']);
     $header .= SimpleBlogCommon::PostLink($post_index, $label);
     $header .= '</h2>';
     SimpleBlogCommon::BlogHead($header, $post_index, $post);
     echo '<div class="twysiwygr">';
     if (!empty(SimpleBlogCommon::$data['post_abbrev']) && SimpleBlogCommon::$data['abbrev_image']) {
         $this->GetImageFromPost($post['content']);
     }
     echo $this->AbbrevContent($post['content'], $post_index, SimpleBlogCommon::$data['post_abbrev']);
     echo '</div>';
     echo '</div>';
     if (SimpleBlogCommon::$data['abbrev_cat'] && isset($post['categories']) && count($post['categories'])) {
         $temp = array();
         foreach ($post['categories'] as $catindex) {
             $title = SimpleBlogCommon::AStrGet('categories', $catindex);
             if (!$title) {
                 continue;
             }
             if (SimpleBlogCommon::AStrGet('categories_hidden', $catindex)) {
                 continue;
             }
             $temp[] = SimpleBlogCommon::CategoryLink($catindex, $title, $title);
         }
         if (count($temp)) {
             echo '<div class="category_container">';
             echo gpOutput::GetAddonText('Categories') . ' ';
             echo implode(', ', $temp);
             echo '</div>';
         }
     }
     echo '<div class="clear"></div>';
 }
コード例 #3
0
 /**
  * Regenerate the static content used to display the gadget
  *
  */
 static function GenGadget()
 {
     global $langmessage;
     $posts = array();
     $show_posts = SimpleBlogCommon::WhichPosts(0, SimpleBlogCommon::$data['gadget_entries']);
     ob_start();
     $label = gpOutput::SelectText('Blog');
     if (!empty($label)) {
         echo '<h3>';
         echo common::Link('Special_Blog', $label);
         echo '</h3>';
     }
     foreach ($show_posts as $post_index) {
         $post = SimpleBlogCommon::GetPostContent($post_index);
         if (!$post) {
             continue;
         }
         $header = '<b class="simple_blog_title">';
         $label = SimpleBlogCommon::Underscores($post['title']);
         $header .= SimpleBlogCommon::PostLink($post_index, $label);
         $header .= '</b>';
         SimpleBlogCommon::BlogHead($header, $post_index, $post, true);
         $content = strip_tags($post['content']);
         if (SimpleBlogCommon::$data['gadget_abbrev'] > 6 && mb_strlen($content) > SimpleBlogCommon::$data['gadget_abbrev']) {
             $cut = SimpleBlogCommon::$data['gadget_abbrev'];
             $pos = mb_strpos($content, ' ', $cut - 5);
             if ($pos > 0 && $cut + 20 > $pos) {
                 $cut = $pos;
             }
             $content = mb_substr($content, 0, $cut) . ' ... ';
             $label = gpOutput::SelectText('Read More');
             $content .= SimpleBlogCommon::PostLink($post_index, $label);
         }
         echo '<p class="simple_blog_abbrev">';
         echo $content;
         echo '</p>';
     }
     if (SimpleBlogCommon::$data['post_count'] > 3) {
         $label = gpOutput::SelectText('More Blog Entries');
         echo common::Link('Special_Blog', $label);
     }
     $gadget = ob_get_clean();
     $gadgetFile = SimpleBlogCommon::$data_dir . '/gadget.php';
     gpFiles::Save($gadgetFile, $gadget);
 }