Loading...
 

DevTips


These tips are here to help new contributors getting a feel for the environment. Some people are inclined to follow these as “Rules” or “Guidelines”; they are suggestions rather than strict requirements. Consider each point below as information about what is in Tiki. As a contributing coder, you should respect that environment. You may wish to read everything below in detail.

If you only read one line :

  • 3 Rules : 1/ Respect Environment 2/ Commit Early, Commit Often 3/ Make it Optional

Commits

File names conventions and generalities

  • All file names are lowercase
    • Only exceptions are 3rd party libs like Zend framework and other libs requiring “PSR-0 standard for PHP class naming allowing for autoload”
  • For a PHP file name, the pattern is: tiki-xxx_yyy.php:
    If possible, tiki-mainobject_action.php
    Some exceptions are noticeable in files that are included in others (it seems that they don’t follow the tiki-xxx_yyy.php convention)
  • A lib file name follows the pattern lib/object/objectlib.php
  • Give features descriptive names (and use the same keyword in templates, css, libs for easy finding), as there is no feature duplication (we don’t have several forums systems in Tiki, we have one and we all collaborate on it)
  • Avoid names like feature_new, feature_newer, feature_newest...

Files content integrity

  • Never change indentation on code you don’t change. It could provoke diff and merge inconsistencies.
  • Prefer to use only tabs for indentation for a new file.
  • Be careful with your text editor. Make sure that it uses LF Unix line endings and not CRLF Windows line endings. Only exception perhaps are Smarty templates in templates/mail/ used for sending mails which should use CRLF because some Windows servers seem to have a problem with sending mails then (see this thread). If in doubt, use the end of line character from the file that you changed.
  • Use only UTF-8 encoding for language files. Hence, use a UTF-8-enabled text editor for those files.

Strings integrity

SVN operations

  • Only commit to one branch, stable branch or Trunk, depending the current Where to commit

Commit messages

Take in mind that your commit message should be clear and describe all operations that this commit is for. Feel free to give the tracker ticket that this commit is closing (if it is the case).

Your commit message has to start with one of the following tags to distinguish changes:

[NEW] for additions of new features
[ENH] is an enhancement; not really new but makes things work better (e.g. look and feel, performance...)
[MOD] is a change in how things work, which may disrupt user habits, for example, changing the default value of an option
[FIX] for bug fixes of any sort
[SEC] for security fix operations (implies [FIX])
[UPD] for updates of third party/vendor libraries
[UX] for user experience improvements; makes Tiki easier to use and understand (more details in https://dev.tiki.org/UX )
[DB] for changes in the database
[REM] for feature removals
[KIL] for removals of unused or obsolete files (has been used in the sense of [REM] prior to Tiki 6)
[REF] for refactoring; changes the structure of the code (to make it cleaner or clearer), without changing its actual behavior.
[REL] for the release process
[MRG] for branch merges, generally performed by the merge scripts
[DOC] for improvements in the tips or contextual documentation provided to the user/admin
[TRA] for translation


The canonical list of tags is in changelog.txt.

If you are doing a Backport to an earlier branch of a commit in trunk, see also this page: Merge a commit from trunk

Database conventions

  • All table names begin with tiki_ except users_ for historical reasons
  • Table name has to be less than 26 characters, all lowercase, using chars and underscores
  • Primary keys in tables usually use the following convention : objectId with a capital ‘I’. It’s a rare case where a capital is used in any name
  • When you modify the schema (create / modify tables), you need to care for both future installs and existing installs (upgrades). For future installs, you need to modify db/tiki.sql and use convertscripts not anymore starting in Tiki5. See Database Schema Upgrade for more information
  • Respect abstraction scheme and naming conventions for queries as detailed on DbAbstractionDev
  • Do not use reserved words for column name (for instance do not use: user, status, order, show for column name)
  • Key/index are also limited to 1000 bytes (so 250 chars? - to be checked)

PHP coding habits

  • Coding standards: please use Zend Framework Coding Standard for your code.
    • Exceptions WE USE TABS
      • Indentation using tabs rather than spaces
    • The Zend coding standard was adopted after Tiki had accumulated a significant PHP code base which did not follow this standard. Tiki’s current PHP code is still far from adhering to this standard everywhere, in particular when it comes to function names, which were previously written completely lowercase, with underscores between words. For example, as of 2017-01-22, we have clean_logs() , which should be named “cleanLogs” according to our standards. Some old sets of functions called dynamically even require to be named fully lowercase. For example, the FOO plugin requires a function named “wikiplugin_foo” as of 2017-01-22.
  • Use brackets in your control structures: “if {[...]} else {[...]}” (even if there is only one instruction)
  • All the strings are written to be easily translated using the tra() function. E.g. tra(‘some string’)
  • Do not end a php file with ?>


PHP Security Guidelines

All commits will be reviewed for security issues. It’s a good idea to familiarize yourself with the expectations of tiki commits outlined on the Secure Coding Practice Guidelines page.

Files should start with...

1st line of Smarty templates (.tpl)
{* $Id$ *}

Start of PHP files (.php)
<?php
// (c) Copyright 2002-2011 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

$Id$

To expand the $Id$
svn propset svn:keywords Id filename.php

To commit
svn commit filename.php

Smarty coding suggestions

  • Comments in Smarty code can be useful. The Smarty comment delimiter is {* *}.
  • All strings are enclosed by {tr}{/tr} blocks for translation.

Design principles


The error message there is no attribute “role” can be ignored right now, as this is an early adoption of wai-aria.

  • CSS stylesheets are widely used to separate design from content, as opposed to the traditional way of including all style rules and content in a single file.

Introduction to Tiki Code

Introduction to Tiki Code Layout

Best Practices


Icons

  • See icons if you want to use icons in the templates

Think of ReleaseProcess

  • Mention your meaningful changes on ))ReleaseProcessxxx(( page on tw.o. It will be used to build the changelog file.
  • Indicating changes in both places is not a problem, but if only one is done, it has to be online on tw.o

About license

  • Code needs to have LGPL, PHP or BSD-like licences if bundled in tikiwiki (not GPL). Please see LibLicense


External GPL code, like Wollabot, is an exception.

Setting up a debugger/development environment

The following links may be a useful reference:
Xdebug etc


Discussion/Participation

[-]

How about using a style-fixing program on commit, to help enforce some of these rules? — mdavey



see also, on tw.o, in progress of migration here :

Code Maps and Howtos


Because Tiki is a large system, it can sometimes be hard to find your way around the code, or how to accomplish a specific task like “adding a new icon”. The Code Maps and Howtos page contains links to:

  • Code “maps” that can help you orient yourself and navigate a particular part of the code (ex: the multilingual functionalities of Tiki).
  • Code “howtos” that can help you figure out how to carry out a specific programming task, for example, “adding a new icon” to the UI.


All coders are encouraged to write such maps to help others. If you are a newbie to a particular part of the code or particular kind of task and find that they are not covered, you might want to create a map or how to keep track of your findings and document what you find so others will benefit from it in the future.

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting 7.x
Administration
Ajax 2.x
Articles & Submissions
Backlinks
Banner
Batch 6.x
BigBlueButton audio/video/chat/screensharing (5.x)
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution 2.x
Cookie
Copyright
Credits 6.x
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs 8.x
DogFood
Draw 7.x
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Group
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping 3.x
Mobile Tiki and Voice Tiki
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Payment 5.x
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Score
Search engine optimization (SEO)
Search
Security
Semantic links 3.x
Share
Shopping Cart 5.x
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags 2.x
Task
Tell a Friend, alert + Social Bookmarking
Terms and Conditions
Theme
TikiTests 2.x
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
WebHelp
Webmail and Groupmail
WebServices 3.x
Wiki 3D
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives 4.x
WYSIWTSN 4.x
WYSIWYCA
WYSIWYG 2.x
XMLRPC




Useful Tools