* Separation of CONSTANTS and runtime variables. [#e2baf0ee]

- ページ: [[BugTrack2]]
- 投稿者: [[ヨルダンC]]
- 優先順位: 重要
- 状態: 保留
- 優先順位: 普通
- 状態: 却下
- カテゴリー: その他
- 投稿日: 2008-07-15 (火) 18:40:36
- バージョン: 

** メッセージ [#h5cd1f2e]
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_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. 

	"puki-mainsite" => array(
		"Mainpage_Title" 	=> "PukiWiki",
		"Mainpage_Link"		=>	"http://pukiwiki.example.com/",
		"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:

I know you love to hate me, so post your disapproval here.
- [[BugTrack2/29]] --  &new{2010-06-06 (日) 14:12:29};


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 5.6.40-0+deb8u12. HTML convert time: 0.100 sec.