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