1 Here are the coding guidelines for PhpWiki.
3 !!! Code Indentation Style
5 We follow, for the most part, the PEAR coding standards:
7 <http://www.php.net/manual/en/pear.standards.php>
9 There's code snippets for configuring Emacs and Vim as well as several
10 other text editors at the above URL.
14 For editing files in Emacs, set indent-tabs-mode to nil. Some people
15 argue that it's better to use tabs and let people set their tab width,
16 but I think we're better off using just spaces because aligned
17 comments in the right region will not align correctly. For a detailed
18 argument see <http://www.jwz.org/doc/tabs-vs-spaces.html>. Also use a
19 tab-width of eight, so that just in case tabs do creep into the source
20 code, they have a standard width.
22 Use php-mode as well. This is freely available on the net
23 <http://sourceforge.net/projects/php-mode/>. Put something like this
26 (autoload 'php-mode "php-mode" "PHP editing mode" t)
27 (add-to-list 'auto-mode-alist '("\\.php\\d?$" . php-mode))
28 (add-hook 'php-mode-hook
31 ;; This syntax table mod makes the second line in:
38 (modify-syntax-entry ?$ "'" php-mode-syntax-table)
39 (set (make-local-variable 'tab-width) 8)
40 (set (make-local-variable 'c-basic-offset) 4)
41 (set (make-local-variable 'c-hanging-comment-ender-p) 'nil)
42 (set (make-local-variable 'indent-tabs-mode) 'nil)))
45 !!! I18N: Using gettext()
47 String literals which end up making it into the HTML output should be
48 wrapped with a call to ''gettext()''. This allows translations to be
49 substituted when PhpWiki is run in non-english environments.
51 Since xgettext (part of the "GNU gettext utilities") is used to find
52 strings for translation, It is important that the argument of
53 ''gettext()'' be a constant string literal, in double quotes (").
55 Remember that xgettext only knows about c/c++ line-continuation
56 strings, it does not know about php's dot operator.
58 You can now use _("foo") as an alias for gettext("foo").
60 OKAY: gettext("This is a message.");
62 OKAY: sprintf(_("Hello %s"), $name);
63 OKAY: sprintf(_("Hello %s"), $name);
65 BAD: _('This will be ignored by xgettext.');
66 BAD: _("Howdy" . ", wazoo");
67 BAD: _("Hello $name");
68 BAD: define("MES", "howdy"); gettext(MES);
71 If you want Emacs po mode to automatically kick-in when you edit a po
72 file, add the following to your .emacs file:
75 (cons '("\\.po[tx]?\\'\\|\\.po\\." . po-mode) auto-mode-alist))
76 (autoload 'po-mode "po-mode")
78 !!! Mac OS X: Project Builder
80 See INSTALL.MacOSX for instructions on using Project Builder with
81 PhpWiki and SourceForge.