「HTML template for PHP」をPHP7.0以降に対応させる

naohiro19
記事: 256
登録日時: 14年前
住所: 愛知県

「HTML template for PHP」をPHP7.0以降に対応させる

投稿記事 by naohiro19 » 9年前

HTML template for PHP
PHP7.0以降では PHP4形式のコンストラクタが非推奨となっているため

htmltemplateクラスとStandardParserクラスのコンストラクタを __constract に変える必要があります。

変更前のソースコード

CODE:

/*
*   StandardParser
*   parser defined with above tags.
*   behave as previous htmltemplate
*/
class StandardParser extends TemplateParser{
	function StandardParser(){
		$this->add(new tag_val())->add(new tag_rval())->add(new tag_def())->add(new tag_each());
	}
}

/*
*  htmltemplate
*  the APIs defined after the manner of htmltemplate for PHP4
*  tmp file generation has not been implemented yet.(2003-07-08)
*/

class htmltemplate{
	private $parser;
	static private $instance;
	
	private function htmltemplate(){
		$this->parser=new StandardParser();
	}

変更後のソースコード

CODE:

/*
*   StandardParser
*   parser defined with above tags.
*   behave as previous htmltemplate
*/
class StandardParser extends TemplateParser{
	function __constract(){
		$this->add(new tag_val())->add(new tag_rval())->add(new tag_def())->add(new tag_each());
	}
}

/*
*  htmltemplate
*  the APIs defined after the manner of htmltemplate for PHP4
*  tmp file generation has not been implemented yet.(2003-07-08)
*/

class htmltemplate{
	private $parser;
	static private $instance;

	private function __constract(){
		$this->parser=new StandardParser();
	}
あとは一切変更していません。

コメントはまだありません。