diff --git a/PIE.htc b/PIE.htc
new file mode 100644
index 0000000..6a40cef
--- /dev/null
+++ b/PIE.htc
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/grid-archives.css b/grid-archives.css
new file mode 100644
index 0000000..f07495c
--- /dev/null
+++ b/grid-archives.css
@@ -0,0 +1,83 @@
+#grid_archives {
+}
+
+.grid_archives_column {
+ display: inline;
+ float: left;
+ margin: 0 15px;
+ overflow: hidden;
+ width: 900px;
+}
+
+#grid_archives ul{
+ padding: 0;
+ margin: 0;
+}
+
+#grid_archives ul li.ga_year_month {
+ font-size: 34px;
+ padding: 20px 0;
+ clear: left;
+}
+
+#grid_archives ul li.ga_year_month .ga_monthly_summary {
+ color: #555;
+ font-family: georgia,verdana;
+ font-size: 22px;
+ font-style: italic;
+ margin-left: 10px;
+ vertical-align: super;
+}
+
+#grid_archives ul li.ga_post {
+ /* background-color: #0D0D0D; */
+ float: left;
+ list-style-type: none;
+ margin: 0 15px 15px 0;
+ /* padding: 7px 5px 7px 10px; */
+ /* width: 150px; */
+ /* height: 150px; */
+ /* -moz-border-radius: 15px; */
+ /* border-radius: 15px; */
+ /* opacity: 0.8; */
+}
+
+#grid_archives ul li div.ga_post_main {
+ background-color: #0D0D0D;
+ /* background: -moz-linear-gradient(center top, #3D3D3D, #0D0D0D); */
+ /* background: -webkit-gradient(linear, center top, center bottom, from(#3D3D3D), to(#0D0D0D)); */
+ /* -pie-background: linear-gradient(center top, #3D3D3D, #0D0D0D); */
+ /* margin: 0 15px 0 0; */
+ padding: 7px 5px 7px 10px;
+ width: 150px;
+ height: 150px;
+ opacity: 0.8;
+ overflow: hidden;
+ -moz-border-radius: 15px;
+ -webkit-border-radius: 15px;
+ border-radius: 15px;
+ -moz-box-shadow: 5px 5px 10px #444;
+ -webkit-box-shadow: 5px 5px 10px #444;
+ box-shadow: 5px 5px 10px #444;
+ /* behavior: url(/wp-content/plugins/grid-archives/border-radius.htc); */
+ behavior: url(/wp-content/plugins/grid-archives/PIE.htc);
+}
+
+#grid_archives ul li.ga_post a {
+ line-height: 125%;
+}
+
+#grid_archives ul li.ga_post p {
+ color: #666;
+ /* font-size: 8pt; */
+ font-size: 10.5px;
+ font-style: italic;
+ line-height: 135%;
+ padding: 8px 0 5px;
+}
+
+#grid_archives ul li.ga_post p.ga_post_date {
+ font-family: 'Myriad Pro',Corbel,'Helvetica Neue',Helvetica,'Lucida Grande',Verdana,sans-serif;
+ font-style: normal;
+ text-align: right;
+}
diff --git a/grid-archives.php b/grid-archives.php
new file mode 100644
index 0000000..3114134
--- /dev/null
+++ b/grid-archives.php
@@ -0,0 +1,159 @@
+Samson Wu
+Description: Grid Archives will offer a grid style archives page for WordPress.
+
+**************************************************************************
+
+Copyright (C) 2008 Samson Wu
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+
+**************************************************************************
+ */
+
+define('GRID_ARCHIVES_VERSION', '0.5.0');
+
+/**
+ * Guess the wp-content and plugin urls/paths
+ */
+// Pre-2.6 compatibility
+if ( ! defined( 'WP_CONTENT_URL' ) )
+ define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
+if ( ! defined( 'WP_CONTENT_DIR' ) )
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
+if ( ! defined( 'WP_PLUGIN_URL' ) )
+ define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
+if ( ! defined( 'WP_PLUGIN_DIR' ) )
+ define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
+
+
+define('GRID_ARCHIVES_POSTS_TRANSIENT_KEY', 'grid_archives_posts');
+
+
+if (!class_exists("GridArchives")) {
+ class GridArchives {
+ function GridArchives() {
+ $this->plugin_url = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__));
+
+ add_action('wp_print_styles', array(&$this, 'load_styles'));
+ add_shortcode('grid_archives', array(&$this, 'display_archives'));
+
+ // invalidate cache
+ add_action('save_post', array(&$this, 'delete_cache'));
+ add_action('edit_post', array(&$this, 'delete_cache'));
+ add_action('delete_post', array(&$this, 'delete_cache'));
+ }
+
+ // Grab all posts and filter them into an array
+ private function get_posts() {
+ // If we have a non-expire cached copy of the filtered posts array, use that instead
+ if($posts = get_transient(GRID_ARCHIVES_POSTS_TRANSIENT_KEY)) {
+ return $posts;
+ }
+
+ // Get a simple array of all posts
+ $rawposts = get_posts('numberposts=-1');
+
+ // Trim some memory
+ foreach ( $rawposts as $key => $rawpost )
+ $rawposts[$key]->post_content = $this->get_excerpt($rawposts[$key]->post_content);
+
+ // Loop through each post and sort it into a structured array
+ foreach( $rawposts as $key => $post ) {
+ $posts[ mysql2date('Y.m', $post->post_date) ][] = $post;
+
+ $rawposts[$key] = null;
+ }
+ $rawposts = null; // More memory cleanup
+
+ // Store the results into the WordPress transient, expires in 1 day (24 hours)
+ set_transient(GRID_ARCHIVES_POSTS_TRANSIENT_KEY, $posts, 60*60*24);
+ return $posts;
+ }
+
+ private function compose_html($posts, $monthly_summaries) {
+ $html = '
';
+ return $html;
+ }
+
+ private function get_excerpt($text, $length = 90) {
+ if (!$length || mb_strlen($text, 'utf8') <= $length)
+ return $text;
+
+ $text = strip_tags($text);
+ $text = preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', $text);
+
+ $text = mb_substr($text, 0, $length, 'utf8') . " ...";
+ return $text;
+ }
+
+ private function parse_summaries($str){
+ $summaries = array();
+ foreach (explode("\n", $str) as $line) {
+ list($yearmonth, $summary) = array_map('trim', explode("#", $line, 2));
+ if (!empty($yearmonth))
+ $summaries[$yearmonth] = stripslashes($summary);
+ }
+ return $summaries;
+ }
+
+ function display_archives($atts){
+ $posts = $this->get_posts();
+ // TODO make this an option
+ $summaries_str = "2010.09#Kindle, Kindle ...\n2010.08#Avatar, 3D, IMAX\n2010.07#世界杯……\n";
+ $monthly_summaries = $this->parse_summaries($summaries_str);
+ return $this->compose_html($posts, $monthly_summaries);
+ }
+
+ function load_styles(){
+ $css_url = $this->plugin_url . '/grid-archives.css';
+ wp_register_style('grid_archives', $css_url, array(), GRID_ARCHIVES_VERSION, 'screen');
+ wp_enqueue_style('grid_archives');
+ }
+
+ function delete_cache() {
+ delete_transient(GRID_ARCHIVES_POSTS_TRANSIENT_KEY);
+ }
+ }
+}
+
+if (class_exists("GridArchives")) {
+ $grid_archives = new GridArchives();
+}
+
+?>
diff --git a/readme.mkd b/readme.mkd
new file mode 100644
index 0000000..e69de29