Separation of CONSTANTS and runtime variables.

メッセージ

Please note: code on the SVN is proof-of-concept code and is likely to change a lot. Some of the functions that appear on the SVN will be replaced by more efficient functions if the proposal is accepted. If you wrote the non-OOP stuff in PukiWiki, your opinion is worthless.

I like the fact that there are constants which begin with PKWK_, but some of these aren't particularly useful when they are only being used at runtime, and don't necessarily need to define()'d. Constants need to be more about something that is reasonably never going to change during the runtime of pukiwiki on the person's server.

Things like theming functions and base settings should be defined so that they are distinct from the rest of the code. I have already made a very basic example of how intersections of settings-arrays can be used to return multiple or single configuration variables, and also am working on functions for addition of configuration values, including support for MySQL if the PukiWiki_conf class is extended.

For example:

if(PUKIWIKI_SOME_BOOLEAN_VALUE) { // Nope }
if(PukiWiki_conf::value("some_boolean_value")) { // Supports MySQL-based storage of conf values if extended }

PukiWiki_conf is an abstract factory class, which can be extended.

final class PukiWiki_flatfile_conf extends PukiWiki_conf extends PukiWiki_conf and deals with handling PHP-defined arrays and returning various configuration options from it. in this example, settings are stored in a sub-array block format, which means they are categorised.

At the moment, PukiWiki_flatfile_conf::value() does not retrieve keys regardless of category, but it can easily be accomplished.

Example:

	"puki-mainsite" => array(
		"Mainpage_Title" 	=> "PukiWiki",
		"Mainpage_Link"		=>	"http://pukiwiki.example.com/",
		"Administrator" 	=> "Your_Name",
		"page_defaults" => array( // Remove, needs to be stored.
			"default" 		=> 	"FrontPage", // Page aliases for translated defaults
			"whatsnew" 		=>	"RecentChanges",
			"whatsdeleted" 	=>	"RecentlyDeleted",
			"interwiki"		=>	"InterWikiName",
			"menubar"		=>  "MenuBar",
	)
	),

Much cleaner, more readable. Available in SVN repository on googlecode. I hate CVS and SVN, but SVN is the lesser of 2 demons. Git, monotone, mercurial... MUCH better.

For sourcecode: http://code.google.com/p/pukiwiki/source/browse/trunk/config/pukiwiki.conf.php

I know you love to hate me, so post your disapproval here.



トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-03-08 (月) 12:13:59
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 8.2.12. HTML convert time: 0.287 sec.

SourceForge