Loading...
 

History: DevTips

Comparing version 78 with version 101

Lines: 2-14Lines: 2-14
 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. 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 : +!! If you only read one line
__(aka TL;DR)__
 * __((3 Rules))__ : 1/ __Respect Environment__ 2/ __Commit Early, Commit Often__ 3/ __Make it Optional__ * __((3 Rules))__ : 1/ __Respect Environment__ 2/ __Commit Early, Commit Often__ 3/ __Make it Optional__
-!!Commits

*((How to get commit access)


*((Commit Code
|How to commit))
+!! Commits

*((Git Workflow|How to commit))
 *((Where to commit)) *((Where to commit))
-!!File names conventions and generalities +!! File names conventions and generalities
 * All __file names are lowercase__ * 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" ** Only exceptions are 3rd party libs like Zend framework and other libs requiring "PSR-0 standard for PHP class naming allowing for autoload"
Lines: 20-50Lines: 20-49
 * Avoid names like feature_new, feature_newer, feature_newest... * 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__ [http://www-test.lib.umn.edu/webteam/docs/tutorials/unix-line-endings.html|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 problem with sending mails then (see [http://tikiwiki.org/tiki-view_forum_thread.php?forumId=6&comments_parentId=32076&thread_sort_mode=commentDate_asc|this thread|external]). If in doubt, use the end of line character from the file that you changed.
+!! 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__ [http://www-test.lib.umn.edu/webteam/docs/tutorials/unix-line-endings.html|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 [http://tiki.org/tiki-view_forum_thread.php?forumId=6&comments_parentId=32076&thread_sort_mode=commentDate_asc|this thread|external]). 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. * Use only __UTF-8__ encoding for language files. Hence, use a UTF-8-enabled text editor for those files.
-!!Strings integrity +!! Strings integrity
 * Follow the format convention: ((Strings Format Convention)) * Follow the format convention: ((Strings Format Convention))
 * Reuse the same terminology * Reuse the same terminology
 +* Descriptions (like preferences descriptions) should end with a "." In general, any sentence should end with the complete punctuation.
-!!SVN operations

* Only __commit to one branch__, stable branch or Trunk, depending the current ((Where to commit)


!!!Commit messages
+!! Git operations

* See ((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). 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:



{include page="Commit Tags"
start="INCLUDE-START" stop="INCLUDE-END


}

The canonical list of tags is in
changelog.txt.
+Your commit message may start with one or more of the tags listed at the top of [https://sourceforge.net/p/tikiwiki/code/HEAD/tree/trunk/changelog.txt|changelog.txt] to distinguish changes.
 If you are doing a ((Backport)) to an earlier branch of a commit in trunk, see also this page: ((Merge a commit from trunk)) 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 +

!! Database conventions
 * All table names begin with ~~#446688:tiki_ except users_~~ for historical reasons * All table names begin with ~~#446688:tiki_ except users_~~ for historical reasons
 * __Table name has to be less than 26 characters__, all lowercase, using chars and underscores * __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 * 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 +* 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''. See ((Database Schema Upgrade)) for more information
 * Respect abstraction scheme and naming conventions for queries as detailed on ((tw:DbAbstractionDev)) * Respect abstraction scheme and naming conventions for queries as detailed on ((tw:DbAbstractionDev))
 * __Do not use reserved words__ for column name (for instance __do not use: user, status, order, show for column name__) * __Do not use reserved words__ for column name (for instance __do not use: user, status, order, show for column name__)
Lines: 54-131Lines: 53-115
 !! PHP coding habits !! PHP coding habits
-* Coding standards: please use [https://framework.zend.com/manual/2.4/en/ref/coding.standard.html|Zend Framework Coding Standard]~tc~Could not find version for Zend Framework 3. Chealer 2017-01-05~/tc~ for your code.

** Exceptions __WE USE


*** Indentation using tabs rather than spaces
+!!! Tiki 23 and up
https://www.php-fig.org/psr/psr-12




!!!- Tiki 22.

and before
* Coding standards: please use [https://framework.zend.com/manual/2.4/en/ref/coding.standard.html|Zend Framework Coding Standard]~tc~Could not find the version for Zend Framework 3. Chealer 2017-01-05~/tc~

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. **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 {~np~[...]~/np~} else {~np~[...]~/np~}" (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 version issues

+* All the strings are written to be easily translated using the ''tr()'' function. E.g. -+tr('some string')+-
 +!! 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... !! Files should start with...
 {CODE(caption="1st line of Smarty templates (.tpl)", colors=smarty)} {CODE(caption="1st line of Smarty templates (.tpl)", colors=smarty)}
-{* $Id$ *} 
 {CODE} {CODE}
-{CODE(caption="Start of PHP files (.php)" wrap="1" colors="php")}

<?


// (c) Copyright 2002-2011 by authors of the Tiki Wiki/CMS/Groupware Project
+{CODE(caption="Start of PHP files (.php)" wrap="1" colors="php" theme="default")}<?php

// (c) Copyright by authors of the Tiki Wiki/CMS/Groupware Project
 //  //
 // All Rights Reserved. See copyright.txt for details and a complete list of authors. // 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. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
-// $Id$  
 {CODE} {CODE}
-!!! $Id$

{CODE
(caption="To expand the $Id$" colors="shell")


svn propset svn
:keywords Id filename

php
{CODE}
+!! Front-end
Tiki serves __HTML__ (version 5) documents. The [http://validator.w3.org|W3C Markup Validator] can help checking the validity of your design, but is experimental.
-{CODE(caption="To commit")}

svn commit filename.


{

}
!!

coding suggestions
*
Comments in Smarty code can be useful. The Smarty comment delimiter is ''{* *

''.

* All strings are enclosed by ''~np~{tr}{/tr}~/np~'' blocks for translation.
+Since Tiki versions prior to 9 used XHTML, several void elements are written with needless trailing slashes (for example, "<img />", instead of "~np~<img>~/np~") . For the following tags you can (or should ?) use the shorter notation:

* br, img, link, param, meta, input, area, base, br, col, command, and embed ( following [http://www.w3.org/TR/html-markup/syntax.html#void-elements|"void elements"] )
-!!Design principles

* For Tiki releases lesser than Tiki 9.x HTML code is __XHTML 1.0 Transitional__ compatible. Use the [http://validator.w3.org]
to check the validity of your design


* Since Tiki 9.x
and up, we switched to __HTML5__ DOCTYPE. For the following tags you can (or should ?) use the shorter

:
** br, img, link, param, meta, input, area, base, br, col, command, and embed
( following "void" elements on http://www.w3.org/TR/html-markup/syntax.

)
* In other words it means usage of the shorter <img> instead of <img />, etc. See discussion on ((Mass operations to do after the Semi-automatic merging period
)).
+CSS stylesheets are widely used to __separate design from content__ and to create ((Themes)).
-The error message __there is no attribute "role"__ can be ignored right now, as this is an early adoption of [http://dev.opera.com/articles/view/introduction-to-wai-aria/|wai-aria]. +!!! Smarty templates

* Strings displayed are enclosed by ''~np~{tr}{/tr}~/np~'' blocks for translation


* There are
no standards about Smarty template formatting (either from Tiki or Smarty). However, templates shipped by Smarty and Smarty documentation appear to use template indentation rather than output indentation (in other words, the indentation facilitates reading the template rather than reading the generated HTML), as can be seen in [https://www.smarty.net/docs/en/language.function.call.tpl|Smarty's "Calling a recursive menu example"

.
* Comments in Smarty code can be useful. The Smarty comment delimiter is ''{* *}''
.
-* 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
 ((Introduction to Tiki Code Layout)) ((Introduction to Tiki Code Layout))
-!!Best Practices

*((Bootstrap)


*((Templates Best Practices

)
*((Filtering Best

))
+!! Best Practices

* ((Bootstrap)


* ((Templates Best Practices

)
* ((Filtering Best Practices))
-!!Icons +!! Icons
 * See ((icons)) if you want to use icons in the templates * 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
+!! Think of ReleaseProcess

* Mention your meaningful changes on a TikiXY page (where XY is main Tiki version number, e.g. Tiki17) on https://doc.tiki.org. It is useful for users to know what is new or changed in the upcoming Tiki version (we do not output the commit messages to changelog.txt file anymore since Tiki 16.2).
-!!About license

* Code needs to have __LGPL__, PHP or BSD-like licences if bundled in tikiwiki (not GPL). Please see [http://tikiwiki.org/tiki-index.php?page=LibLicense|LibLicense]
+!! About license

* Code needs to have __LGPL__, MIT or BSD-like licenses if bundled in Tiki (not GPL). Please see ((tw:LibLicense))
- External GPL code, like [http://wollabot.sourceforge.net/|Wollabot], is an exception. +--External GPL code, like [http://wollabot.sourceforge.net/|Wollabot], is an exception.--
-!!Setting up a debugger/development environment
The following links may be useful reference:
+!! Setting up a debugger/development environment
The following links may be a useful reference:
 ((Xdebug etc)) ((Xdebug etc))
Lines: 135-147Lines: 119-129
 ---- ----
-see also, on tw.o, in progress of migration here : +See also, on t.o, in progress of migration here :
 * ((3 Rules)) * ((3 Rules))
-+ some basic principle about contribution in tikiwiki development community ++ some basic principles about contribution in Tiki development community
 * ((tw:GuidelinesDev)) * ((tw:GuidelinesDev))
 + old page before this one, still holds good information + old page before this one, still holds good information
 * ((tw:DbAbstractionDev)) * ((tw:DbAbstractionDev))
 + a little messy but very helpful page to know how to write your sql queries in libraries. + a little messy but very helpful page to know how to write your sql queries in libraries.
-* ((tw:CvsEtiquette)) 
-+ the current CVS common practices. 
 * ((tw:TikiDevelopment)) * ((tw:TikiDevelopment))
 + Useful links to development tools and material. + Useful links to development tools and material.
Lines: 152-164Lines: 134-145
 * ((Strings Format Convention)) * ((Strings Format Convention))
 + String format convention  + String format convention
-* ((Hello World|a tutorial for dev beginners)) +* ((Hello World|a tutorial for developer beginners))
 * ((Permission Revamp)) explains how the permissions work * ((Permission Revamp)) explains how the permissions work
-!!Code Maps and Howtos

+!! 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: 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 mulltilingual functionalities of Tiki). +* 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. * 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 encourage 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 howto to keep track of your findings and document what you find so others will benefit from it in the future. +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.

History

Advanced
Information Version
31 Mar 23 18:52 GMT-0000 Benoit Grégoire 101
01 Feb 23 22:18 GMT-0000 Benoit Grégoire Remove $Id, havent been used for a while... 100
09 Jul 21 18:56 GMT-0000 Marc Laporte 99
24 Feb 20 15:05 GMT-0000 Bernard Sfez / Tiki Specialist Adding info after clarification on the list 98
20 Sep 19 16:30 GMT-0000 drsassafras Mass search and replace 97
29 Jun 18 20:48 GMT-0000 Philippe Cloutier meh, remove that new exception for now. sorry 96
29 Jun 18 20:01 GMT-0000 Philippe Cloutier PHP coding habits - add exception "Function documentation is not required for private methods." 95
24 Jun 18 14:08 GMT-0000 lindon code Plugin modified by editor. 94
16 Nov 17 08:38 GMT-0000 luciash d' being 🧙 cleanup and updates 93
16 Nov 17 08:19 GMT-0000 luciash d' being 🧙 do not force users to download the changelog.txt 92
27 Sep 17 14:22 GMT-0000 Philippe Cloutier Front-end: role attribute no longer triggers an error 91
27 Sep 17 14:17 GMT-0000 Philippe Cloutier Front-end: fix 90
27 Sep 17 14:05 GMT-0000 Philippe Cloutier Front-end: fix. oops 89
27 Sep 17 14:03 GMT-0000 Philippe Cloutier merge Design principles and Smarty templates in new section Front-end 88
26 Sep 17 21:18 GMT-0000 Philippe Cloutier Design principles: simplify, update 87
18 Sep 17 13:21 GMT-0000 Philippe Cloutier PHP coding habits: defer to the Zend standard for end of file 86
18 Sep 17 12:55 GMT-0000 Philippe Cloutier remove "Use brackets in your control structures" (already specified by Zend) 85
18 Sep 17 10:09 GMT-0000 Jonny Bradley tr() not tra() as discussed on dev list 84
31 Aug 17 21:13 GMT-0000 Philippe Cloutier Smarty coding suggestions: rename to "Smarty templates", clarify and expand 83
03 Aug 17 21:06 GMT-0000 Philippe Cloutier remove tags list, deferring to changelog to reduce maintenance 82
26 Jul 17 13:20 GMT-0000 Philippe Cloutier fix tagging instructions 81
10 Jul 17 15:32 GMT-0000 drsassafras strikes again 80
28 May 17 05:59 GMT-0000 drsassafras Added security section 79
03 Feb 17 11:50 GMT-0000 luciash d' being 🧙 78
24 Jan 17 01:03 GMT-0000 lindon 77

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
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Diagram
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw -superseded by Diagram
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Gantt
Group
Groupmail
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Kanban
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
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
Task
Tell a Friend
Terms and Conditions
Theme
TikiTests
Federated Timesheets
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
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
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools