分享一下joyqi同学的一个脚本,用于短域名不能访问

作者:sluke 发布时间:October 30, 2009 分类:闲言碎语

常常会遇到短域名不能访问的情况,joyqi同学写了一个脚本,解决这个问题。

<?php
 
//copyleft by joyqi.com
 
$url = isset($_GET['url']) ? $_GET['url'] : exit();
$parts = parse_url($url);
 
if ('http' == $parts['scheme']) {
 
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, true);
 
        if (preg_match("/location:[ ]+[^\r\n]+/is", curl_exec($ch), $out)) {
                header($out[0]);
        }
        curl_close($ch);
}

使用:
1、保存成一个php文件,比如jump.php
2、上传到目录,比如http://sample.test.com/jump.php
3、访问http://sample.test.com/jump.php?url=http://sample.ly/fffff

给typecho写个插件就是这么简单

作者:sluke 发布时间:October 25, 2009 分类:闲言碎语

给typecho写一个插件并不是一件高深的事情,首先,需要了解typecho php使用的编码规范,请参考
http://typecho.org/phpcoding
论坛的bin同学也给出一个了简明的说明:
http://forum.typecho.org/viewtopic.php?f=6&t=160

以后就是给typecho写一个方便部署统计代码的插件,使用说明:
1、把下面的代码保存成AnalyticsHelper.php(注意大小写)
2、上传到/usr/plugins/
3、后台启用AnalyticsHelper插件
4、配置插件,输入统计的js代码
5、在模版的合适位置加入<?php AnalyticsHelper::output(); ?>

<?php
/**
 * AnalyticsHelper
 * 
 * @package AnalyticsHelper 
 * @author sluke
 * @version 0.9 beta
 * @link http://typecho.org
 */
class AnalyticsHelper implements Typecho_Plugin_Interface
{
    /**
     * 激活插件方法,如果激活失败,直接抛出异常
     * 
     * @access public
     * @return void
     * @throws Typecho_Plugin_Exception
     */
    public static function activate(){}
 
    /**
     * 禁用插件方法,如果禁用失败,直接抛出异常
     * 
     * @static
     * @access public
     * @return void
     * @throws Typecho_Plugin_Exception
     */
    public static function deactivate(){}
 
    /**
     * 获取插件配置面板
     * 
     * @access public
     * @param Typecho_Widget_Helper_Form $form 配置面板
     * @return void
     */
    public static function config(Typecho_Widget_Helper_Form $form)
    {
        /** 配置各种统计代码 */
        $name = new Typecho_Widget_Helper_Form_Element_Text('code', NULL, 'Analytics code', _t('写入统计代码'));
        $form->addInput($name);
    }
 
    /**
     * 个人用户的配置面板
     * 
     * @access public
     * @param Typecho_Widget_Helper_Form $form
     * @return void
     */
    public static function personalConfig(Typecho_Widget_Helper_Form $form){}
 
    /**
     * 插件实现方法
     * 
     * @access public
     * @return void
     */
    public static function output()
    {
        echo '<div style="display:none">' . Typecho_Widget::widget('Widget_Options')->plugin('AnalyticsHelper')->code . '</div>'; 
    }
}

如果觉得php高亮挺好看,可以去70同学那里下载代码高亮插件
http://www.joyqi.com/typecho/move-to-mediatemple.html

SciTE LaTeX IDE

作者:sluke 发布时间:June 17, 2009 分类:闲言碎语

SciTE LaTeX IDE是一个基于SciTE的latex编辑环境,对于懒于配置scite的用户(或是惧怕英文版软件的)来说,是不错的选择。

SciTE LaTeX IDE

我还是极其羡慕mac用户可以用coda和textmate这样的编辑器。

最后推荐一下70同学的项目SciTePHPSuit,用来加强scite对PHP的支持。
http://www.joyqi.com/SciTePHPSuit/

懒惰的同学们可以直接下载70修改这个scite-ru项目,以下是介绍,日志里有下载地址。
http://www.joyqi.com/funny-stuff/action.html

Typecho 0.5版发布

作者:sluke 发布时间:March 13, 2009 分类:闲言碎语

下载地址:

http://code.google.com/p/typecho/downloads/detail?name=0.5(9.3.13)-release.tar.gz

在typecho0.5版本中,我们加入了一个十分有利于SEO的特性,那就是灵活的自定义链接功能。

在我们开启rewrite功能之后,在以往的版本中, 只能使用以下四种风格:

 默认风格 /archives/{cid}/
 wordpress风格 /archives/{slug}.html
 按日期归档 /archives/{year}/{month}/{day}/{slug}.html
 按分类归档 /{category}/{slug}.html

现在,我们提供了自定义组合的功能,可用参数如下:

可用参数:{cid} 日志ID、{slug} 日志缩略名、{category} 分类、{year} 年、{month} 月、{day} 日

实际上,参数还在不断丰富中,用户可以自由组合出自己想要的永久链接形式。例如:

/{category}/{year} /{month}/{day} /{slug}.html

除了链接,独立页面后缀也是可以设置的,目前提供的是三种:

 .html .htm .php

启用这个功能后,选择html,日志的地址就可以类似:

http://www.typecho.net/example.html

Redaxscript 0.1.0

作者:sluke 发布时间:March 3, 2009 分类:闲言碎语

Redaxscript,一个轻量级的PHP程序,其实,它是基于snews1.6开发的小东西,搭建一个小网站,用这个程序足矣。

官方网站:
http://redaxscript.com/

下载:

http://redaxscript.com/files/redaxscript_0.1.0.zip 

Features

- Installation-routine for non-developers
- xHTML 1.0 strict output
- Block independent and fully customizable CSS layout
- Manage categories, articles, pages, extras and comments
- Includes archive, sitemap, contact, breadcrumbs and search
- Content-statistics and overview
- RSS generator to create own and RSS reader to load external feeds
- Switchable dual-language out of the box (English, German)
- Extensive options under settings

以上特性我就懒得翻译了,有志青年翻译个语言包玩玩吧

  1. 1
  2. 2
  3. 3
Clicky Web Analytics