pLoger
登陆 | 全局摘要 | 注册Blog | 我的相册 | 关于我们 | RSS 1.0

『小技巧』一个form如何提交到两个页面

vidar | 29 4月, 2004 11:28

Write a function

 
<script language="JavaScript">
<!--
function posttwopage()
{
self.location.href="a.aspx?XXX";
self.location.href="b.aspx?XXX";
}
//-->
</script>
<input type="button" name="Submit" value="Submit" onClick="posttwopage()">


Hello world in Patterns

vidar | 29 4月, 2004 11:24

/********************************************************************
Model-View-Controller implementation according to POSA
(Pattern-Oriented Software Architecture
  http://www.hillside.net/patterns/books/Siemens/book.html)
********************************************************************/

class HelloWorldController {
    private $model;
    function __construct($model) {
        $this->model = $model;
    }

    function handleEvent($args) {
        $this->model->setStrategy($args[2]);
        $this->model->addText($args[1]);
    }
}


class HelloWorldModel {
    private $text;
    private $observers = array();
    private $strategy;
   
    function attach($observer) {
        $this->observers[] = $observer;
    }

    function getData() {
        $facade = new HelloWorldFacade($this->strategy);
        return $facade->getHelloWorld().$this->text." ";
    }

    function addText($text='') {
        $this->text = $text;
        $this->notify();
    }

    function setStrategy($strategy) {
        $this->strategy = $strategy;
    }
   
    function notify() {
        foreach ($this->observers as $observer) {
            $observer->update();
        }
    }
}

class HelloWorldView {
    private $model;

    function initialize($model) {
        $this->model = $model;
        $model->attach($this);
        return $this->makeController();
    }

    function makeController() {
        return new HelloWorldController($this->model);
    }

    function update() {
        $this->display();
    }

    function display() {
        echo $this->model->getData();
    }
}


/*********************************************************************
"Business logic"
********************************************************************/

class HelloWorld {
   function execute() {
       return "Hello world";
   }
}

class HelloWorldDecorator {
   private $helloworld;
   function __construct($helloworld) {
       $this->helloworld = $helloworld;
   }

   function execute() {
       return $this->helloworld->execute();
   }
}

abstract class HelloWorldEmphasisStrategy {
    abstract function emphasize($string);
}

class HelloWorldBangEmphasisStrategy extends HelloWorldEmphasisStrategy {
    function emphasize($string) {
       return $string."!";
    }
}

class HelloWorldRepetitionEmphasisStrategy extends HelloWorldEmphasisStrategy {
    function emphasize($string) {
       return $string." and ".$string." again";
    }
}

class HelloWorldEmphasizer extends HelloWorldDecorator {
   private $strategy;
   function HelloWorldEmphasizer($helloworld,$strategy) {
       $this->strategy = $strategy;
       parent::__construct($helloworld);
   }

   function execute() {
       $string = parent::execute();
       return $this->strategy->emphasize($string);
   }
}

class HelloWorldStrategyFactory {
    static function make($type) {
        if ($type == 'repetition') return self::makeRepetitionStrategy();
        return self::makeBangStrategy();
    }

    static function makeBangStrategy() {
        return new HelloWorldBangEmphasisStrategy;
    }
    static function makeRepetitionStrategy() {
        return new HelloWorldRepetitionEmphasisStrategy;
    }
}

class HelloWorldFormatter extends HelloWorldDecorator {
   function execute() {
       $string = parent::execute();
       return $string." ";
   }
}

class HelloWorldFacade {
    private $strategy;
    function __construct($strategyType) {
        $this->strategy = HelloWorldStrategyFactory::make($strategyType);
    }

    function getHelloWorld() {
        $formatter = new HelloWorldFormatter(
                new HelloWorldEmphasizer(
                    new HelloWorld,$this->strategy));
        return $formatter->execute();
    }
}

$model = new HelloWorldModel;
$view = new HelloWorldView;
$controller = $view->initialize($model);
$controller->handleEvent($_SERVER['argv']);

?>


我做的pLog汉化版下载

vidar | 29 4月, 2004 08:15

从昨晚12:00多开始花了6个小时的汉化,pLog还算是比较符合多用户使用的Blog程序(Php+MySQL)^..^

要提醒一点,汉化得不完全,只汉化最有必要的部分(毕竟只有6个多小时),反正一般操作是看不到英文了。


真正多用户的Blog,比如:
http://www.xeam.com/blog/index.php?blogId=1
http://www.xeam.com/blog/index.php?blogId=3

全局摘要:
http://www.xeam.com/blog/summary.php

后台演示:
http://www.xeam.com/blog/admin.php
用户名:111
密码:111


下载:http://www.isbyte.com/plog-0.3.1.rar
喜欢玩blog的朋友拿去玩吧,有时间的朋友汉化得好一些再提供下载给大家用吧,我要去休息了,呼呼~


PHP安全配置

vidar | 28 4月, 2004 22:35


创建时间:2001-11-12 更新时间:2003-08-06
文章属性:原创
文章来源:http://www.xfocus.net
文章提交:san (san_at_xfocus.org)

整理:san
版本:0.02

创建时间:2001/11/12
更新时间:2003/07/21
 阅读全文...

Copyright © the pLog team
汉化:Xeam team's vidar