Posts tagged with habari

TweetSuite Plugin for Habari (pre-alpha)

前幾天看到了 TweetBacks 這個新 idea ,實用性可能很低,但相當有趣,因此今天趁著有空寫了給 Habari 用的版本。目前完成度還不高,不過 TweetBacks 的功能都有了。

為了讓此 Plugin 得以運作,我修改了 Habari Core ,請參閱安裝前須知。目前 Habari 暫時還沒有自訂 Comment 內容型態的功能, Post 則有,這個功能未來計畫會加入,因此現在只能用這種克難作法。

Things to Do Before Installation

請先修改 comment.php, comments.php 兩個檔案,方能使用此 Plugin 。

To use this plugin, please modify your comment.php and comments.php as below.

  1. comment.php

    const COMMENT = 0;
    const PINGBACK = 1;
    const TRACKBACK = 2;
    const TWEETBACK = 3; // Add this line
    
    public static function list_comment_types( $refresh = false )
    {
        if ( ( ! $refresh ) && ( ! empty( self::$comment_type_list ) ) ) {
            return self::$comment_type_list;
        }
        self::$comment_type_list = array(
            self::COMMENT => 'comment',
            self::PINGBACK => 'pingback',
            self::TRACKBACK => 'trackback',
            self::TWEETBACK => 'tweetback', // Add this line
        );
        return self::$comment_type_list;
    }
    
  2. comments.php

    private function sort_comments()
    {
        $type_sort = array(
            Comment::COMMENT => 'comments',
            Comment::PINGBACK => 'pingbacks',
            Comment::TRACKBACK => 'trackbacks',
            Comment::TWEETBACK => 'tweetbacks',  // Add this line
        );
    ...
    
    public function __get( $name )
    {
        switch ( $name ) {
            case 'count':
                return count( $this );
            case 'approved':
            case 'unapproved':
            case 'moderated':
            case 'comments':
            case 'pingbacks':
            case 'trackbacks':
            case 'tweetbacks':  // Add this line
                return new Comments( $this->only( $name ) );
        }
    }
    

Get it!

目前只能透過 SVN 取得。

You can get TweetSuite via SVN.

Known Issues

  1. 有時(或者該說是經常?)資料庫會儲存到重複的 Tweetbacks ,但這種情況是一次就出現很多重複的 Tweetbacks。
  2. 有些短網址是大小寫有別的,而 Twitter Search 不區分大小寫,於是可能會抓到一些無關的 Tweetbacks 。(尤其是 bit.ly 的短網址超容易發生這種事)

Notes

此 Plugin 的運作流程依序為:

  1. 使用者讀取單篇文章(Post)
  2. 讀取完畢時, TweetSuite 才開始執行,這有兩層考量:在讀取文章前執行可能導致讀取變得非常慢、讀取文章前還沒有 Post 物件能用 XD 但這種作法的缺點就是最新的 TweetBacks 會在第二次載入時才出現。
  3. TweetSuite 首先會讀取這篇文章的短網址資訊,如果資訊不存在,便會到各個短網址服務產生這篇文章的短網址,然後儲存到資料庫。如果是有缺漏,便只會重新嘗試產生遺漏的短網址。(寫這個的時候我發現 tr.im 這個服務,程式寫得不太好…… 因為它不會檢查資料庫中是否已經存在重複的網址,每次都將給你一個新產生的網址)
  4. 得到這些短網址後, TweetSuite 會將它們串接起來丟到 Twitter Search 作聯集搜尋,最後將得到的搜尋結果存入 comments 資料表。其實在執行 Twitter Search 之前, TweetSuite 會先取得這篇文章最近一次的 TweetBacks 的 ID ,然後就能加入 Twitter Search 的參數中,讓 Twitter Search 只回傳較新的 Tweets ,因此資料庫中的 TweetBacks 不會重複。
  5. TweetSuite 會紀錄這一次執行的時間,接下來一個小時內同樣的文章將不會重複執行。

Breezy Archives Plugin for Habari

簡介

Breezy Archives 是一個模仿 Live Archives 的彙整 Plugin 。當瀏覽器關閉 JavaScript 功能時,它會變成 Clean Archives ,而不會留下一個空白的頁面。

安裝

  1. 解壓縮檔案。
  2. 將 breezyarchives 資料夾放到 /user/plugins 資料夾中,然後到 Habari 管理介面中啟用它。
  3. 將下面這行貼到你的 Theme 中。

    <?php if ( Plugins::is_loaded('BreezyArchives') ) $theme->breezyarchives(); ?>
    

設定 / 自訂

啟用後,請按下 Configure 來設定此 Plugin ,有這些項目可以設定:

  • Chronology – 依月份彙整的設定
    • Title for Chronology Archives – 月份彙整的標題。
    • Month Format – 設定月份的格式,共有四個選項可選擇。
      • Full name – 全稱 (January – December)
      • Abbreviation – 縮寫 (Jan – Dec)
      • Number with leading zero – 前方補零的數字 (01 – 12)
      • Number without leading zero – 前方不補零的數字 (1 – 12)
    • Show Monthly Posts Count – 顯示每個月份的文章數量。
  • Taxonomy – 依標籤彙整的設定
    • Title for Taxonomy Archives – 標籤彙整的標題。
    • Show Tagged Posts Count – 顯示每個標籤的文章數量。
    • Excluded Tags – 此為選填欄位。在此輸入你不要顯示於標籤彙整的 tag slugs
  • Pagination – 分頁設定
    • № of Posts per Page – 每頁顯示幾篇文章。
    • Next Page Link Text – 下一頁的連結文字。
    • Previous Page Link Text – 上一頁的連結文字。
  • General – 一般設定
    • Show Newest First – 將新的文章放在前面。
    • Show № of Comments – 顯示每篇文章的迴響數量。

如果你要修改 CSS 呈現的結果,可以將 breezyarchives.css 複製到你的 Theme 資料夾中並修改這個檔案。

下載

更新紀錄

  • 0.1 (2008-08-27) – 初次釋出。

Introduction

Breezy Archives is an archives plugin which mimics ‘Live Archives’ on WordPress. When JavaScript is not available, it will graceful degrade to a ‘Clean Archives’.

Installation

  1. Extract the file.
  2. Put the folder ‘breezyarchives’ to /user/plugins and activate it.
  3. Copy and paste the following line to your theme.

    <?php if ( Plugins::is_loaded('BreezyArchives') ) $theme->breezyarchives(); ?>
    

Configuration & Customization

After activated it, click Configure button to setup the plugin. Most of following options are required and have to be set properly.

  • Chronology – Configurations about Monthly Archives
    • Title for Chronology Archives
    • Month Format – There are 4 options: ‘Full name’, ‘Abbreviation’, ‘Number with leading zero’, ‘Number without leading zero’
    • Show Monthly Posts Count – Check this to show the number of posts of each month.
  • Taxonomy – Configurations about Tag Archives
    • Title for Taxonomy Archives
    • Show Tagged Posts Count – Check this to show the number of posts of each tag.
    • Excluded Tags – This field is optional. Put tag slugs here which you want it to be excluded from tag archives.
  • Pagination – Configurations about Pagination
    • № of Posts per Page
    • Next Page Link Text
    • Previous Page Link Text
  • General – General Configurations
    • Show Newest First – Check this to show latest posts first.
    • Show № of Comments – Check this to show the number of comments of each post.

You can copy ‘breezyarchives.css’ to your theme directory and modify the CSS style.

Download

Changelog

  • 0.1 (2008-08-27) – Initial release.

Pageless Plugin for Habari

警告

使用此 Plugin 必須有 HTML 、 PHP 基礎知識。

簡介

此 Plugin 取代了分頁,使用者只要將頁面向下捲動,新的內容便會自動載入。

安裝

  1. 解壓縮檔案。
  2. 將 pageless 資料夾放到 /user/plugins 資料夾中,然後到 Habari 管理介面中啟用它。
  3. 將 pageless 資料夾中的 pageless.php 複製到你使用中的 Theme 資料夾,並根據你所使用的 Theme 來修改。(通常只要參考 multiple.php ,刪除 foreach 以外的部份即可。)

設定

啟用後,請按下 Configure 來設定此 Plugin ,你必須設定這些項目:

  • How many posts to load each time? – 你一次想載入幾篇文章?
  • Class name of posts – 每篇文章共同的 CSS class
  • ID of page selector – 頁碼選擇器的 ID

設定範例

正確的 HTML 架構如下:

<div id="entry-post_1" class="hentry">
    <!-- Post 1 -->
</div>
<div id="entry-post_2" class="hentry">
    <!-- Post 2 -->
</div>
<div id="entry-post_3" class="hentry">
    <!-- Post 3 -->
</div>
<div id="page-selector">
    <!-- Page: 1, 2, 3, ... -->
</div>
  1. 每篇文章各有一個 ID ,格式為 entry-post_slug
  2. 每篇文章都有一個共同的 CSS class ,範例中為 hentry
  3. 頁碼選擇器有一個 ID ,範例中為 page-selector

如果你的 HTML 架構不符合以上條件,請修改你的 Theme 。

下載

更新紀錄

  • 0.1 (2008-07-31) – 初次釋出。

Caution

You must have basic HTML and PHP knowledge to use this plugin.

Introduction

This plugin give your blog the ability of Infinite scrolling, instead of breaking content into ‘pages.’

Installation

  1. Extract the file.
  2. Put the folder ‘pageless’ to /user/plugins and activate it.
  3. Copy ‘pageless.php’ from ‘pageless’ folder the activated theme folder and modify it base on the theme (Mostly you can simply copy ‘mutiple.php’ in the activated theme folder and remove all lines before or after the foreach block).

Configuration

After activated it, click Configure button to setup the plugin. All of following options are required and have to be set properly.

  • How many posts to load each time?
  • Class name of posts
  • ID of page selector

Example

There is an example of correct HTML structure.

<div id="entry-post_1" class="hentry">
    <!-- Post 1 -->
</div>
<div id="entry-post_2" class="hentry">
    <!-- Post 2 -->
</div>
<div id="entry-post_3" class="hentry">
    <!-- Post 3 -->
</div>
<div id="page-selector">
    <!-- Page: 1, 2, 3, ... -->
</div>
  1. Each post’s container must have an ID named ‘entry-post_slug’. If you are sure you won’t write any post which slug is begin with ‘entry-’ or ‘page-‘, then you can simply named it ‘post_slug’.
  2. Every post must have an identical CSS class, e.g. ‘hentry’, and this CSS class must not appear elsewhere. You have to put this in Class name of posts.
  3. The page selector’s container must have an ID, e.g. ‘page-selector’. You have to put this in ID of page selector.

If your HTML structure does not conform these rules, you have to modify the theme.

Download

Changelog

  • 0.1 (2008-07-31) – Initial release.

FlickrFeed Plugin for Habari

簡介

此 Plugin 讓你在 blog 上顯示你的 Flickr 最新照片。我覺得 unserialize() 應該會比解析 XML 快得多,所以我寫了這個 plugin.

安裝

  1. 解壓縮檔案。
  2. 將 flickrfeed 資料夾放到 /user/plugins 資料夾中,然後到 Habari 管理介面中啟用它。
  3. 將下面這行貼到你的 Theme 中。

    <?php if ( Plugins::is_loaded('FlickrFeed') ) $theme->flickrfeed(); ?>
    

設定 / 自訂

啟用後,請按下 Configure 來設定此 Plugin ,有這些項目可以設定:

  • Photostream type
  • Flickr ID – 你的 Flickr ID ,你可以使用 idGettr 取得。
  • № of photos – 設定要顯示幾張照片。
  • Photo size – 設定照片大小。
  • Tags – 限制只顯示某些標籤的照片,以逗號分隔,不可空白。(可不填)
  • Cache expiry – 設定暫存檔保存多久,單位是秒。

如果你要修改 HTML 呈現的結果,可以將 flickrfeed.php 複製到你的 Theme 資料夾中並修改這個檔案。

下載

更新紀錄

  • 0.2 (2008-07-26) – 初次釋出。

Introduction

This plugin show your latest photos on your blog. I write this plugin because I think unserialize() should be much faster than parsing XML.

Installation

  1. Extract the file.
  2. Put the folder ‘flickrfeed’ to /user/plugins and activate it.
  3. Copy and paste the following line to your theme.

    <?php if ( Plugins::is_loaded('FlickrFeed') ) $theme->flickrfeed(); ?>
    

Configuration & Customization

After activated it, click Configure button to setup the plugin.

  • Photostream type
  • Flickr ID – Place your Flickr ID here, you can get your Flickr ID from idGettr.
  • № of photos – Number of photos to be shown.
  • Photo size
  • Tags – A comma delimited list of tags to filter the photos by.
  • Cache expiry – Number of second after the call that the cache will expire.

You can copy ‘flickrfeed.php’ to your theme directory and modify the HTML output.

Download

Changelog

  • 0.2 (2008-07-26) – Initial release.

Jaiku Plugin for Habari

簡介

此 Plugin 讓你在 blog 上顯示你的 Jaiku 最新動態。

安裝

  1. 解壓縮檔案。
  2. 將 jaiku 資料夾放到 /user/plugins 資料夾中,然後到 Habari 管理介面中啟用它。
  3. 將下面這行貼到你的 Theme 中。

    <?php if ( Plugins::is_loaded('Jaiku') ) $theme->jaiku(); ?>
    

設定 / 自訂

啟用後,請按下 Configure 來設定此 Plugin ,有這些項目需要輸入:

  • Jaiku username – 你在 Jaiku 的使用者名稱/帳號。
  • Presences to show – 設定要顯示幾個 presences 。
  • Cache expiry in seconds – 設定暫存檔保存多久,單位是秒。

如果你要修改 HTML 呈現的結果,可以將 jaiku.php 複製到你的 Theme 資料夾中並修改這個檔案。

下載

更新紀錄

  • 0.3.1 (2008-07-25) – 處理要求逾時及非預期的回應(通常發生於 Jaiku 伺服器錯誤時)。
  • 0.3 (2008-06-10) – 可設定要顯示幾個 presences 。
  • 0.2.1 (2008-06-09) – 檢驗使用者輸入的資料是否正確。
  • 0.2 (2008-06-04) – 更新為新的 FormUI 的寫法。
  • 0.1.1 (2008-06-04) – 移除一些不必要的程式碼。
  • 0.1 (2008-05-29) – 初次釋出。

Introduction

This plugin show your latest presences on your blog.

Installation

  1. Extract the file.
  2. Put the folder ‘jaiku’ to /user/plugins and activate it.
  3. Copy and paste the following line to your theme.

    <?php if ( Plugins::is_loaded('Jaiku') ) $theme->jaiku(); ?>
    

Configuration & Customization

After activated it, click Configure button to setup the plugin.

  • Jaiku username – Place your Jaiku username here.
  • Presences to show – Number of presences to show.
  • Cache expiry in seconds – Number of second after the call that the cache will expire.

You can copy ‘jaiku.php’ to your theme directory and modify the HTML output.

Download

Changelog

  • 0.3.1 (2008-07-25) – Better handling request timeout or unexpected response.
  • 0.3 (2008-06-10) – Now you can show multiple presences.
  • 0.2.1 (2008-06-09) – Validate user inputs.
  • 0.2 (2008-06-04) – Updated to work with the new FormUI.
  • 0.1.1 (2008-06-04) – Remove some unnecessary functions.
  • 0.1 (2008-05-29) – Initial release.

“Binadamu”

Binadamu (by BCSEEATI)

Download


使用說明

  1. 主選單的圖示可以在 CSS 中修改,沒有圖示的話,就會像 Live Demo 中的第三項那樣。
  2. 支援 Aside ,效果如 Live Demo 的第一篇。使用方法是給文章加上 “Edge” 這個 tag ,如果不要 “Edge” ,想改成 “Aside” 或其他 tag 的話,可以在 CSS 中修改。
  3. 支援 Plugin 列表
  4. 經測試可正常顯示的瀏覽器
    • Firefox 3 以上版本
    • Safari 3 以上版本
    • Opera 9 以上版本
    • Internet Explorer 6 以上版本

版本紀錄

  • 1.1 (2008-08-11)
    1. 更多的外掛支援:DeliciousFeed, FlickrFeed, Jaiku, Pageless, RN Related Posts, RN Related Tags
    2. Twitter 改用我改過的版本(未釋出)。
    3. 留言表單大幅修改。
    4. 單篇文章使用不同的側邊欄。
    5. 許多 CSS 方面的修改。
    6. 新增 Screenshot 。
  • 0.9 (2008-05-16) – 初次釋出。

“De Morgan”

Lvx ex Cælis

Download


Preface

De Morgan 是本 blog 自二月起使用的新 theme ,並不是我厭倦了前一個 theme ,而是因為當時發生了一個讓我很沮喪的事件

De Morgan 這個標題來自數學家 Augustus De Morgan ,但是老實說它跟棣莫根定理一點關係也沒有,設計靈感主要是來自 De Morgen 這份比利時報紙,我一開始把這份報紙的名稱記成 De Morgan ,所以將錯就錯,便把 theme 也命名為 De Morgan 了 XD

Introduction

De Morgan 的最大特色是首頁與內頁的頁首不同,而且單篇文章頁面的 <h1> 是該篇文章的標題,而不是網站名稱,這樣語意比較適切,也對 SEO 比較好。

嗯… 除此之外好像沒有其他重點 orz