Important - Excel

Document Sample
Important - Excel Powered By Docstoc
					                                                    Important

ocProducts/ocPortal standards
Fill in this checklist for your projects before you put them up for peer review (✓).
This list is intended to be gone through quickly, as a final check to make sure nothing was forgotten. Ideally you should try and lear
As long as these are met as specified, we are happy; if you apply many of these without thinking then feel free to make your own re

If you are writing code that will be included in future ocPortal versions (often code for client sites is, if it's a nice clean reusable featu
For client work we can afford to meet a subset of standards, as we control the environment much more, and a limited set of program
                “ocPortal development +” means it's needed for ocPortal code (i.e. code for redistribution to end users), and advisab
                If something is “ocPortal development only” you can still do it always, if you wish (and it's better to) but just don't worr

Obscure areas where we have standards are on further sheets, only use them if needed.

ocPortal development mode runs automatically if you are working out of a subversion repository.
The Code Quality Checker (described in the Code Book, and it's readme.txt file) has various options, including pedantic mode. Wh

Rows in red cannot be checked via our suite of checking tools.



Tick/cross     Standard

ocProducts code style
               Use 'hard tabs' (true tabs) for indentation
               Duplicate our use of braces, i.e. { and } symbols
               Separate code chunks with blank lines
               underline_between_words_for_names
               UPPER_CASE should be used for globals and constants
               Start private functions with an underscore symbol (_)


General guidelines
               Think of ocPortal as a whole, keep it consistent

Backend programming, general
               Use ocPortal API's wherever appropriate
               Support PHP 4.1 and higher
               Use the 'type' parameter for your modules
               Code as if PHP was 'strict typed'.
               Do not use $_GET or $_POST directly
               Don't use $_SERVER or $_ENV directly
               Remember to apply sorting wherever appropriate
               Remember to apply Pagination wherever appropriate
               Use the 'temporal' API, not PHP date/time functions
               Write appropriate hooks for new content types
               Consider performance
               Never start a file '<?'
               Never include '<?' within your PHP source
               Don't put '?>' at the end of any PHP file - leave it out
               Make choice of GET or POST carefully
               Communicate upload limits
               Use our MVC model as described in the Code Book
               Don't assume PHP extensions or PEAR are installed


                                                      Page 1
                                             Important
           Use only white-listed functions
           Do not require cookies to be available on visitor machines
           If you use cookies, use the ocPortal cookie API
           Template GUIDs must be unique
           Put standard index.html and .htaccess files in new directories
           All files must be associated with an addon
           Manage any interdependencies between addons
           Don't define too many functions in a single file
           Use unique function and class names
           Don't put loose code (code outside functions) in any PHP file
           Don't add more than a few lines of code to an 'entry script'
           Pass in extra useful template parameters
           Don't rely on “Security through obscurity”
           Be careful with: header(), eval(), preg_replace()
           Always respect/handle character-sets properly
           Functions should have proper API documentation
           Everything should be configurable from within ocPortal
           Remember that a site can have multiple themes/languages
           Support multi-site-networks (i.e. site db!=forum db)
           Don't write code that'll output PHP 'notice' errors
           Handle errors in failure-prone function calls (e.g. fopen)

Installation code
           Installation code must respect the multi-language system
           Upgrades must be handled correctly
           Reinstalls must be handled correctly

Documentation and testing
           Design tests first
           Provide documentation for new features
           Track new features

Good programming practices in general
           Use software engineering best practices
           DRY (Don't Repeat Yourself)
           Only ever copy&paste if you need to, and use care
           Know what you are doing in all your code
           Write well structured code
           Write well modularised code
           Use meaningful function/class/variable/file/identifier names
           Comment your code, but not too much
           Use constants instead of “magic numbers”
           Keep your code tidy
           Keep track of things you intend to fix later

File access
           Use the 'fix_permissions' function after making a new file
           Run the 'sync_file' function after making any file changes
           Don't read cached CSS files, use the proper APIs
           Be clever about text line-endings
           Use the text/binary file distinctions properly

URLs and file paths


                                               Page 2
                                              Important
            Use the 'build_url' function and PAGE_LINK symbol
            Don't assume where a module is located when you link
            Use build_url's $skip_keep parameter for e-mailed Comcode
            Don't append to URLs in templates
            Don't link to screens using non-canonical URLs
            Fix broken user input
            Don't assume where an entry-point is located when you link
            Use the '*_custom' filing system properly
            Use the 'get_custom_base_url', 'get_custom_file_base', 'get_base_url' and 'get_file_base' distinctions properly
            Avoid relative paths

Databases
            Avoid writing SQL
            When you need to write SQL, write it securely
            Use db_escape_string not mysql_escape_string/addslashes
            Avoid complex SQL
            Don't use 'LIMIT' manually, use the API
            Don't use ` symbols in your SQL
            In queries use "<>" rather than "!="
            Be type-strict
            Use db_string_equal_to
            Keep your queries as simple as possible
            Do not assume the first record in a table is '1'
            Apply ocPortal field naming standards
            Use upper case SQL keywords (e.g. 'WHERE' not 'where')
            Use sensible database indices
            Use table prefixes
            Use the correct forum API
            Use the most appropriate ocPortal database field types

Designing/naming templates
            Nest your templates
            Templates should be named in upper case
            Use filename prefixes to group templates
            Any screen template should be suffixed '_SCREEN'
            Prefix templates used by blocks with 'BLOCK_'
            Prefix mail templates (Comcode) with 'MAIL_'
            Prefix other templates that are Comcode with '_FCOMCODE'
            Prefix templates that are Javascript with 'JAVASCRIPT_'
            Prefix templates that lay out plain text with 'PLAIN_'
            Store CSS in the 'css' or 'css_custom' directory of a theme

Interfaces – programming
            Use existing conventions and features
            Write AED (add/edit/delete) modules
            Inline edit links
            Use standard approaches after an action is performed
            Give admin modules a do-next manager for the 'misc' screen
            Minimise number of interfaces, mark-up jump links consistently
            Define breadcrumbs in the standard way
            Populate the help panel



                                                Page 3
                                              Important
           Take into account that content may not all be filled in
           Use '_SCREEN' templates

Re-use templates where possible. The following are some key reusable templates:
           Where appropriate, VIEW_SPACE
           Where appropriate, INDEX_SCREEN/INDEX_SCREEN_ENTRY / INDEX_SCREEN_ENTRY_DUMMY
           Where appropriate, INDEX_SCREEN_FANCY_SCREEN / INDEX_SCREEN_FANCY_ENTRY / INDEX_SCREEN_F
           Where appropriate, INDEX_SCREEN_FANCIER_SCREEN / INDEX_SCREEN_FANCIER_ENTRY / INDEX_SCREE
           Where appropriate, TABLE_TABLE / TABLE_TABLE_HEADER_ROW / TABLE_TABLE_HEADER_ROW_CELL / T
           Where appropriate, TABLE_TABLE_ACTION_DELETE_CATEGORY / TABLE_TABLE_ACTION_DELETE_ENTRY
           Where appropriate, CONFIRM_SCREEN/FORM_CONFIRM_SCREEN
           Where appropriate, YESNO_SCREEN
           Where appropriate, NEXT_BROWSER_*
           Where appropriate, SCREEN_BUTTON/SCREEN_ITEM_BUTTON
           Where appropriate, results_browser function
           Where appropriate, results_table function

Showing errors. Use inform/error messaging APIs/conventions correctly. There are 6 top-level kinds o
           Where appropriate, a recoverable error
           Where appropriate, Fatal/Warn/Info attached message
           Where appropriate, Fatal/Warn/Info exit/screen
           Where appropriate, include the 'WARNING_TABLE' template
           Where appropriate, inline errors
           Where appropriate, access-denied screens

Input forms
           Use FORM_SCREEN for forms
           Use the form field API to generate input fields
           Use the standard method to split up large forms
           Use the standard method for showing groups of alternative fields

Spelling/grammar/lexicon (examples of what not to do are in bold italics)
           No ocPortal-specific terms on the main website
           Use our standard terminology
           Don't spell things rong
           Do not use American spellings such as color or center or license
           Do Not Capitalise words just for the Effect
           Wrong to miss out words
           Be careful where you put your apostophe's
           Check readability from an outsider's perspective
           Most lang strings support XHTML, some do not – be aware
           When needed, add comments to the lang files to define context
           Where appropriate use attractive HTML entities, not just ASCII
           Minimise adding new language strings
           Use terminology with consistency
           Don't use the name 'ocPortal', use the phrase 'the software'
           Don't pollute global.ini
           Use <tt> within language strings as appropriate
           End form field descriptions with a full stop
           Use British English standard for mixing full stops and brackets


                                                Page 4
                                                 Important
             Say “tick (check)” rather than just “tick” or just “check”

Language for submit buttons
             For an add button, use the title text ('Add xxx')
             For an edit button, use the language string 'SAVE' ('Save')
             For a delete button use the language string 'DELETE' ('Delete')
             For an intermediary button, use the language string 'PROCEED' ('Proceed')
             For sorting, use the language string 'SORT' ('Sort')
             Use 'CHANGE' and 'PER_PAGE' where appropriate

Choice of standard boxes – use standard boxes as described where applicable, or no boxes at all
             Use the 'curved' boxes just for the squareish front page blocks
             Use the 'panel' boxes just on panels
             Use the 'classic' standard box for primary/block content
             Use the 'med' standard box for a reasonably emphasised box on a screen
             Use the 'light' standard box for other non-key, non-block, content

Javascript
             Don't assume Javascript is available
             Use official DOM (so no 'document.all', or 'window.images')
             Use DOM style (so no 'document.write', or 'innerHTML')
             Assume XHTML parsing (so no '<script...><!--...--></script>')
             Don't use any deprecated methods (so no 'window.escape')
             Cross-browser support (so no 'window.addFavorite')
             Fix any strict warnings (ideally – not very important)
             Putting significant Javascript in dedicated files is best

Markup/Tempcode
             Meet WCAG (Web Content Accessibility Guidelines)
             Make templates beautiful
             No deprecated tags or attributes
             Write to XHTML-strict
             Use the Tempcode escaping syntax correctly
             Don't make assumptions about word order by saying things like {!GO} {!HERE}
             Don't use native language directly in templates or PHP code
             Use the 'alt' and 'title' attributes correctly on images
             Avoid the 'style' attribute (“inline styles”)
             Use ASCII characters only – HTML entities for the rest
             Only forcibly open up links in new windows in certain conditions
             Use {!LINK_NEW_WINDOW}

CSS (Cascading Style Sheets)
             Never code directly into the templates_cached/EN directory
             Use meaningful naming for CSS classes
             Don't use the 'clear' property
             Use relative font sizes
             Avoid setting heights
             If you mix percentages and pixels, nest tags to fix it
             Perform browser testing
             Extra CSS files should only define specific stylings
             Put your CSS neatly into the most appropriate CSS file



                                                   Page 5
                                           Important
         Keep CSS minimal and simple
         Don't leave cruft lying around
         Don't break the Theme Wizard
         Never allow default border colours
         Support rtl languages

Images
         Do not refer to theme images directly by URL
         Make educated choices for your image types
         Compress PNG images and strip gamma

Tables
         Use the 'solidborder' CSS class on most tables
         Set the table 'summary' attribute using standard language strings
         Only use layout tables where necessary
         If you must use a layout table, give it a blank summary
         Set table column widths using the 'col' tag, not CSS
         Use the 'th' tag properly




                                              Page 6
                                                                             Important



m up for peer review (✓).
al check to make sure nothing was forgotten. Ideally you should try and learn to apply all these standards naturally, so this checklist will be a quick final fo
 you apply many of these without thinking then feel free to make your own reduced copy of this checklist.

Portal versions (often code for client sites is, if it's a nice clean reusable feature), you must meet the full standards.
 ards, as we control the environment much more, and a limited set of programmers will need to work with the code. We agree on the standards used on a
 ded for ocPortal code (i.e. code for redistribution to end users), and advisable to do in general (it's best to try and learn to do it by habit if it's something th
nly” you can still do it always, if you wish (and it's better to) but just don't worry about it as much.

r sheets, only use them if needed.

re working out of a subversion repository.
k, and it's readme.txt file) has various options, including pedantic mode. When we refer to pedantic mode here we might actually mean one of the other no




                        Reason for standard                                  Requirements for applicability



                        Consistent code across all projects                  All ocProducts development
                        Consistent code across all projects                  All ocProducts development
                        Easier for other programmers to understand           ocPortal development +
                        Consistent code across all projects                  All ocProducts development
                        Easier for other programmers to understand           All ocProducts development
                        Easier for other programmers to understand           ocPortal development only



                        Keeps everything strong, as a consistent whole ocPortal development only



                        Secure, stable, designed to meet all standards       All ocProducts development
                        Portability                                    ocPortal development only
                        Allows SEO URLs to work automatically          All ocProducts development
                        Allows easier bug finding and code portability All ocProducts development
                        Implements security filtering                  ocPortal development only
                        IIS and Apache disagree on what goes where ocPortal development only
                        So live sites are tidy                         All ocProducts development
                        So live sites are tidy                         All ocProducts development
                        Internationalisation/consistency               All ocProducts development
                        Feature consistency                            ocPortal development +
                        Performance on real live sites                 All ocProducts development
                        Portability: PHP short_tags option may be off  All ocProducts development
                        Portability: PHP short_tags option may be on   All ocProducts development
                        Reduces chance of cookie problems              ocPortal development +
                                                                       All ocProducts
                        So bookmarking works and web accelerators don't break things development
                        User friendliness                              ocPortal development only
                        Cleaner code, easier to change and maintain    ocPortal development +
                        Portability                                    ocPortal development +


                                                                              Page 7
                                                 Important
Portability, PHP disabled_functions option         ocPortal development only
Compatibility with user computers                  ocPortal development only
Portability                                        All ocProducts development
Allows people to theme sites without PHP code ocPortal development only
Extra security, stops probing/tunnelling           ocPortal development only
Allows installation/uninstallation/integrity-scans ocPortal development only
So addons may be uninstalled freely                ocPortal development only
Portability: PHP memory_limit setting              ocPortal development +
You may need to load up both at some point         All ocProducts development
Security – stops hackers “jumping in”              All ocProducts development
So ocPortal code-overriding can work on it         All ocProducts development
To give webmasters more themeing power             ocPortal development only
Security                                           All ocProducts development
Security                                           All ocProducts development
Internationalisation/stability                     All ocProducts development
                                                    it allows the Code Quality
Easier for other programmers to understand, andocPortal development + Checker to check more
User friendliness for webmasters                   ocPortal development only
Stability                                          ocPortal development only
Stability                                          ocPortal development only
Stability                                          All ocProducts development
Stability                                          ocPortal development only


Internationalisation                             ocPortal development only
Stability                                        ocPortal development only
Stability                                        ocPortal development only



If we re-factor code, we know what to re-test    All ocProducts development
So people know how to use the features           ocPortal development only
So we can communicate changes with users         ocPortal development only


Various (esp. maintainability)                   ocPortal development +
Various (esp. maintainability)                   All ocProducts development
Increases programmer morale                      All ocProducts development
Avoids unforeseen problems                       All ocProducts development
Easier to unit test, easier code re-use          All ocProducts development
Performance, Easier to modify, Can be split up   ocPortal development +
Easier for other programmers to understand       ocPortal development +
Easier for other programmers to understand       ocPortal development +
Easier for other programmers to understand       ocPortal development +
Increases programmer morale                      All ocProducts development
Stops things being forgotten                     All ocProducts development



Makes the file deletable via FTP                 ocPortal development only
Allows a site to run on a server farm            ocPortal development only
Stability                                        All ocProducts development
Portability                                      ocPortal development only
Internationalisation / portability               ocPortal development only




                                                  Page 8
                                               Important
Portability / SEO URLs                         All ocProducts development
Webmasters may move modules around             ocPortal development only
Needed for accurate URLs                       All ocProducts development
SEO schemes involve different url structures     All ocProducts development
SEO (canonical URLs, avoid duplicate content) ocPortal development only
Users often miss out 'http://'                   All ocProducts development
                                                 o
Webmasters may move entry-point scripts around cPortal development only
So the override system can work correctly        ocPortal development only
                                                 ocPortal development only
So shared installs work (multiple sites, one ocPortal install)
Code may run from different relative paths       All ocProducts development



Removes security and compatibility errors      All ocProducts development
Security                                       All ocProducts development
Cross database compatibility                   All ocProducts development
Cross database compatibility                   ocPortal development only
Cross database compatibility (MS Access)       ocPortal development only
They are MySQL-specific                        ocPortal development only
Cross database compatibility                   ocPortal development only
Cross database compatibility                   All ocProducts development
Compatibility with Oracle                      ocPortal development only
Cross database compatibility                   ocPortal development only
Cross database compatibility                   ocPortal development only
Consistent code across all projects            All ocProducts development
Consistent code across all projects            ocPortal development only
Performance on real live sites                 All ocProducts development
Portability                                    All ocProducts development
ocPortal's forum compatibility support         ocPortal development only
So higher-level meta functions can work        All ocProducts development



Easier for a web designer to work with         ocPortal development +
Portability: case sensitive file systems       All ocProducts development
Easy to relate templates to features           All ocProducts development
Easy to relate templates to features           All ocProducts development
Easy to relate templates to features           All ocProducts development
Easy to relate templates to features           All ocProducts development
Easy to relate templates to features           All ocProducts development
Easy to relate templates to features           All ocProducts development
Easy to relate templates to features           All ocProducts development
Proper CSS/XHTML separation                    All ocProducts development



Consistent UI, user-friendly                   All ocProducts development
Consistent UI, user-friendly                   ocPortal development +
Consistent UI, user-friendly                   ocPortal development +
Consistent UI, user-friendly                   ocPortal development +
Consistent UI, user-friendly                   ocPortal development only
Consistent UI, user-friendly                   ocPortal development +
Consistent UI, user-friendly                   All ocProducts development
Consistent UI, user-friendly                   ocPortal development +



                                                 Page 9
                                                      Important
                  Tidy UI                             All ocProducts development
                  Consistent UI, user-friendly        All ocProducts development

owing are some key reusable templates:
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       ocPortal development only
                  Consistent UI                       All ocProducts development
                  Consistent UI                       All ocProducts development

ng APIs/conventions correctly. There are 6 top-level kinds of messaging output:
                  Consistent UI, user-friendly        ocPortal development +
                  Consistent UI, user-friendly        ocPortal development +
                  Consistent UI, user-friendly        ocPortal development +
                  Consistent UI, user-friendly        ocPortal development +
                  Consistent UI, user-friendly        ocPortal development +
                  Consistent UI, user-friendly        ocPortal development +



                  Consistent UI, user-friendly        All ocProducts development
                  Consistent UI, user-friendly        All ocProducts development
                  Consistent UI, user-friendly        All ocProducts development
                  Consistent UI, user-friendly        All ocProducts development

at not to do are in bold italics)
                  Consistent UI                       All ocProducts development
                  Consistent UI                       All ocProducts development
                  User friendliness                   All ocProducts development
                  Consistent UI                       ocPortal development only
                  User friendliness                   All ocProducts development
                  User friendliness                   All ocProducts development
                  User friendliness                   All ocProducts development
                  User friendliness                   All ocProducts development
                  Stability                           ocPortal development only
                  Internationalisation                ocPortal development only
                  User friendliness                   All ocProducts development
                  Internationalisation                ocPortal development only
                  User friendliness                   All ocProducts development
                  De-branding                         ocPortal development only
                  Performance on real live sites      All ocProducts development
                  User friendliness                   All ocProducts development
                  Consistent UI                       All ocProducts development
                  Consistent UI                       ocPortal development only


                                                       Page 10
                                                                Important
                 Internationalisation                           ocPortal development only



                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only

boxes as described where applicable, or no boxes at all
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only
                 Consistent UI                                  ocPortal development only



                 Accessibility                                  ocPortal development +
                 Standards compliancy                           ocPortal development only
                 Future proofing                                ocPortal development only
                 Future proofing                                ocPortal development only
                 Standards compliancy                           ocPortal development only
                 Compatibility                                  All ocProducts development
                 Standards compliancy / Future proofing         ocPortal development only
                 Performance                                    ocPortal development +



                 Accessibility                                  ocPortal development +
                 Easier for other programmers to understand     All ocProducts development
                 Accessibility                                  ocPortal development +
                 Accessibility                                  ocPortal development only
                 Security                                       All ocProducts development
                 Internationalisation                           ocPortal development only
                 Internationalisation                           ocPortal development only
                 Accessibility                                  ocPortal development +
                 Easier for a web designer to work with         ocPortal development only
                 Internationalisation                           ocPortal development only
                 Accessibility                                  ocPortal development only
                 Accessibility                                  ocPortal development +



                                                                  All ocProducts development
                 Your work will be lost as soon as the cache regenerates
                 Easier for a web designer to work with           ocPortal development only
                 Needed for the way our default theme is built    ocPortal development +
                 Accessibility                                    All ocProducts development
                 Accessibility                                    All ocProducts development
                 Stability                                        All ocProducts development
                 Compatibility                                    All ocProducts development
                 Stability                                        All ocProducts development
                                                                  ocPortal
                 Easier for a web designer to work with, and performance development +



                                                                 Page 11
                                               Important
                                                 ocPortal development
Easier for a web designer to work with, and performance, and stability +
                                                 ocPortal
Easier for a web designer to work with, and performance development +
The Theme Wizard needs to keep working           ocPortal development only
The Theme Wizard needs to keep working           ocPortal development only
Internationalisation                             ocPortal development only



The webmaster may change image mappings        All ocProducts development
Performance                                    All ocProducts development
Performance and browser compatibility          All ocProducts development


Consistent UI                                  ocPortal development +
Accessibility                                  ocPortal development +
Accessibility                                  All ocProducts development
Accessibility                                  ocPortal development +
Cleaner code, easier to change and maintain    ocPortal development +
Accessibility                                  ocPortal development +




                                                Page 12
                                                                             Important




ply all these standards naturally, so this checklist will be a quick final formality when you're finished coding.
copy of this checklist.

ou must meet the full standards.
 will need to work with the code. We agree on the standards used on a per-project basis.
o in general (it's best to try and learn to do it by habit if it's something that doesn't make things slower to do).




refer to pedantic mode here we might actually mean one of the other non-default options: check to see what's available.




                        How to check compliance                          Further information



                                                                        This hard tab      can usually put the cursor to should of configured to insert a real
                        Code Quality Checker. To tell if an editor is doing ameans, if you press the tab key your editor the left bethe "tab" and press the righ
                        Code Quality Checker                            Braces should start and end on their own lines. Also don't skip braces when a block o
                        Manually                                         A chunk of code is usually a few lines long and does a common purpose. Usually the
                        Code Quality Checker                             underline_between_words_for_names in PHP variables, PHP function names, PHP a
                        Code Quality Checker
                        Manually                                         Functions in shared code modules that are considered 'private' should be prefixed wi



                        Manually                                         For example, Chris found that XMLHttpRequest on Internet Explorer had a caching b



                        Manually                                         If is very easy to make mistakes when writing new code. Our functions have been tun
                        Code Quality Checker                      It's ocPortal's minimum requirements, so it must be supported.
                        Manually                                  All modules should be coded to use 'type' as the internal specifier of what 'screen' to
                                                                  This
                        Code Quality Checker/ocProducts PHP version is hard for many PHP programmers to grasp so is explained in a separate sectio
                        Code Quality Checker, pedantic mode       Instead use one of the set of get/post_param_* functions.
                        Code Quality Checker, pedantic mode       Use our 'ocp_srv' function with the same environment parameter names you'd otherw
                        Manually                                  Remember to sort things. Sometimes this needs doing in PHP code, and sometimes
                        Manually                                  Don't forget to paginate your browse screens using ocPortal's results_browser or bac
                        Manually                                  Don't forget about users potentially being in different timezones. Rarely if ever use PH
                        Manually                                  When adding new content types remember to write all appropriate hooks for them (e.
                        Manually                                  Don't do silly things that affect performance like running queries inside a loop/recursio
                        Code Quality Checker
                        Code Quality Checker                      This string is used within XML so is fairly common to type in; if you need it append tw
                        Code Quality Checker                      It's not needed, and if whitespace ends up on the end of the file (e.g. when a user edi
                        Manually                                  HTTP GET requests should not change database state in any major way (it can caus
                        Manually                                  Show the appropriate maximum-upload size on all screens that support file uploads, u
                        Manually, Code Quality Checker will help  ocPortal enforces a strict separation between content, presentation and code. This is
                        Code Quality Checker                      Never assume that any extensions are installed unless they are listed in ocPortal's m


                                                                              Page 13
                                                   Important
Code Quality Checker                         In fact, don't assume any rarely-used function is available unless it is listed in the sou
Manually                                     Cookies must not be required for functionality to work, unless said functionality is not
Code Quality Checker, pedantic mode          If you do use cookies, use the ocPortal cookie functions to read/set/delete them, as th
Code Quality Checker, special function       Don't copy and paste GUIDs in template calls. If you copy and paste a line with a GU
Code Quality Checker, special function       Almost all directories should contain an empty 'index.html' (to stop directory browsing
Code Quality Checker, special function       Every file intended to be distributed with ocPortal must be registered in one addon. T
Manually                                     Dependencies may be properly handled via hooks, dependency setting in the addon_
                                             Instead
ocPortal development mode sets a low memory_limit put the script into code files that are loaded only when needed.
Code Quality Checker                         No two classes or functions may have the same name, regardless of where they are
Code Quality Checker                         The only loose code allowed is our standard boot code in the entry point files.
                                             Instead
ocPortal development mode / Code Quality Checker of directly placing code in the entry-point file, put it in a sources file and requi
Manually                                     Pass in any additional unused parameters to the template where they might be usefu
Manually                                     Always assume that people will try and hack the website, and that they have the full s
                                             If will help
Manually, Code Quality Checker pedantic modeyou're putting variables into the header function make sure they do not contain \r or
Manually                                     Don't assume the character set is Unicode, or Western European for input data or for
                                             Use
Code Quality Checker, function signatures feature the 'phpdoc'-style syntax correctly, and never adlib on it's syntax (it gets parsed).
Manually                                     No FTP/file-manager should ever be necessary to operate, configure, or extend an in
Manually                                     Remember that a site can have multiple themes and languages - be careful that you
ocPortal development mode                    Remember that OCF may be run over an M.S.N. (i.e. different URL, not just from the
ocPortal makes all PHP errors generate stack dumps
Code Quality Checker, pedantic mode


Manually                                      Make sure the 'lang_code_to_default_content ' function is used where appropriate in installa
Manually                                      Make sure that modules upgrade properly between major versions of ocPortal, and p
                                              If a module is reinstalled, it reinstalling modules about existing Admin config option
When installing ocPortal try refreshing each step when it finishes – or testshould not give errorsfrom inside the tables, Zone (Setup



Manually                                        Before writing any code, design/document the tests you are going to run to make sure
Manually                                        After your code is written and tested make sure that the user documentation for ocPo
Manually                                        If you've added a non-trivial feature it will need to be added to the ocPortal website's


Manually                                   Use software engineering best practices, whilst also keeping things consistent with ho
Manually                                   Don't copy&paste big blocks of code (exceptions: see below), or the same snippet of
Manually                                   If you do copy&paste a chunk of code, e.g. if implementing a new importer and using
Manually                                   Understand all the code you write. Don't just copy some existing pattern into a new co
                                           Divide into functions
Code Quality Checker can check function length (pedantic mode) into appropriate units (sensible modules interacting over reason
Manually                                   Group things into separate files where appropriate. For example, an API acting for a c
Manually                                   Use sensible function/class/variable/file/identifier/token names that make full intuitive
                                           Write comments for non-obvious code. Don't comment obvious things ("this is a loop"
Code Quality Checker can check comment density (pedantic mode)
Manually                                   Don't use "magic numbers". For example, instead of using the numbers 1, 2, and 3 w
Manually                                   Just generally try and keep your code neat. Don't misspell in comments and variable
Manually                                   If you have to do some code that really should be cleaner, put a comment by it startin



ocProducts PHP version
ocProducts PHP version
ocPortal development mode                       Never reference files directly out of a cache (e.g. a CSS file out of the 'templates_cac
Manually                                        Multi-line textual input (from the web browser, or from the file-system) should go throu
                                                Use the text/binary
Manually                                        file distinctions




                                                    Page 14
                                         Important
ocPortal development mode             Do not hard-code URLs- use build_url() correctly. This function will convert to whatev
Manually                              Don't assume which zone a module is located in, except in the case of admin module
Manually                              If you are using a URL in an e-mail, make sure the $skip_keep parameter is set to tru
Manually                              Do not try and appending something to a URL inside a template, unless it is a URL to
Manually                              For example, the forumview module doesn't pass through a 'type' if it is 'misc'. Most o
Manually                              If you write functionality that accepts URLs into the system via a form interface then a
Manually                              Use the 'FIND_SCRIPT' symbol or 'find_script' function to find zone-based scripts. Pu
Manually                              Never put custom/user-files/logs in a non-custom directory, and never put code files in a
Manually                              Use a custom_* function if referencing custom/user-data, otherwise don't. Core ocPo
ocProducts PHP version                Don't assume any current directory (either URL or filesystem): use full paths (using 'g



Code Quality Checker, pedantic mode   Wherever possible just use our APIs, don't write SQL by hand. Use 'query_insert', 'qu
Code Quality Checker, pedantic mode   Never ever write SQL without thinking about security.
Manually                              Avoids assumption about how escaping is done (you might not know this but the myS
Manually                              You cannot use SQL syntax that is not widely supported such as 'UNION', sub-querie
ocPortal development mode             Make use of the from/max parameters to the query functions rather than hard-coding
Manually
Manually
MySQL-strict-mode                     For example, do not do "WHERE validated='1'" as "validated" is an integer field and t
Manually                              Do not build string equalities into WHERE clauses directly (e.g. "WHERE foo='bar'"),
Manually
Manually                              This is the case for mySQL but does not necessarily hold true. Use db_get_first_id() t
ocPortal development mode             Use the same coding standards for database field naming as for ocPortal (lower case
Manually                              If you must write your own SQL, write SQL keywords in upper case (e.g. SELECT, FR
Manually                              Create database indexes if you regularly query a table using non-key field(s).
Manually                              Do not assume any database table prefix (so don't assume 'ocp4_' is at the start of th
Manually                              Do not assume you are developing for OCF (unless you are coding OCF directly), or
Manually                              When you define database schemas via 'create_table' use the closest ocPortal field t



Manually                              Templates should nest, not be split up into start/end pairs. The only exception is HEA
Manually
Manually                              For example, the download addon's templates mostly start 'DOWNLOAD_'.
ocPortal development mode             A screen template is the main template that wraps a screens output. All screen templ
Manually                              Do this unless the template is also used by a module too
Manually
Manually                              Any template that is for Comcode must contain the filename substring 'MAIL_' or '_M
Manually                              Any template that is for Javascript must be prefixed 'JAVASCRIPT_'. Any template pr
Manually                              The only templates that are neither XHTML or Javascript or CSS or Comcode are 'MA
Manually                              Any template that is for CSS must be defined in the 'css'/'css_custom' directories, rat



Manually                              Generally try and replicate the interface conventions of existing modules, unless there
Manually                              Write content/data management modules as an ocPortal AED module (add/edit/delet
Manually                              For viewing content: if someone has permission to edit something, then for the templa
Manually                              CMS/Admin 'completion' screens should either be redirects to an appropriate location
Manually                              A CMS/Admin module's functions should generally be divided by a welcoming do-nex
Manually                              Don't duplicate interface elements in ocPortal, unless the duplicate is clearly marked
Manually                              Use breadcrumb_set_self/breadcrumb_set_parents as required to generate appropria
Manually                              Wherever appropriate Define helper-panel pictures, tutorial links, and inline help, for A



                                          Page 15
                                                     Important
Manually                                         Remember that if something may be blank (e.g. if it is possible for a field to not be fill
ocPortal development mode                        All screens should ultimately be wrapped with some kind of template suffixed '_SCRE



Manually                                         A part of a screen that is for viewing title/value data in a table
Manually                                         A screen having a shortish paragraphed sequence of things to choose
Manually                                         A screen having a shortish HTML list of things to choose
Manually                                         A screen having a shortish tabled/descripted list of things to choose
Manually                                         Templates for rendering a plain table of something
Manually                                         Buttons for performing actions on a tables rows
Manually                                         Show a preview and confirm it's okay
Manually                                         Confirm the action is as wanted
Manually                                         Very simple browsing through multiple screens. Usually you'll want to use results_bro
Manually                                         Show a standard shaped button on the screen
Manually                                         An interface for pagination.
Manually                                         An interface for pagination of a table.



Manually                                         Use these when an error occurs that is non-fatal (e.g. failure for an email to be sent a
Manually                                         Use the 'attach_message' function for this. Use the appropriate type of this for any kin
Manually                                         Use the whatever_screen or whatever_exit function. Use the appropriate type of mes
Manually                                         Places an on-screen warning about the action or content that a screen is providing
Manually                                         Use one of the standard CSS classes, such as 'nothing_here' or 'red_alert' or 'importa
Manually                                         Use the 'access_denied' function for this. It can be passed a language code, or a strin



Manually                                         Use a standard form template such as 'FORM_SCREEN' (most cases) or 'FORM' (if
Manually                                         Use our most appropriate standard input field types (e.g. form_input_integer), o
Manually                                         Split complex forms into groups by using the 'FORM_SCREEN_FIELD_SPACER' tem
Manually                                         Use the 'ALT_FIELD' language string and Javascript script technique (standardAlt



Manually                                       ocPortal 'brands' or unique terminology ('Zone', 'Comcode', …) should not be seen on
Manually                                       Use correct terminology like 'Codename', 'Option', 'Title', 'Description'
Use the .ini files with Microsoft Word's checking tools
Code Quality Checker, special function
Manually                                       Capitalisation is for proper nouns (e.g. Charlie or Microsoft, but not box) for new sentences, o
Manually + use the .ini files with Microsoft Word's checking toolsis" is missing from the start of the sentence)
                                               (in this example, "It
                                               Apostrophes tools
Manually + use the .ini files with Microsoft Word's checking are not used for plurals
Manually                                       Triple check everything you write to make sure it is completely clear, as concise as re
Code Quality Checker, special function         You may assume language strings can contain XHTML. There are only a few excepti
Manually                                       For an example of how to do this, see global.ini.
Manually                                       Use HTML entities where possible, in particular 'ndash', 'mdash', 'hellip', 'ldquo', 'rdqu
Manually                                       Try to reuse strings as much as possible. Don't add new strings unless it is an improv
Code Quality Checker, special function         Apply consistency to your terminology. Sometimes multi-word proper nouns are given
Code Quality Checker, special function
Manually                                       If phrases are not general to the rest of ocPortal, then put them in a language file that
Manually                                       (for something typed, or code)
ocPortal development mode
Code Quality Checker, special function         Full stops and brackets mix so that the full stop follows the closing of the bracket. For


                                                      Page 16
                                                 Important
Code Quality Checker, special function        The word 'tick' in British English is 'check' in American English (referring to the square



Manually
Manually                                      Only use the language string 'EDIT' ('Edit') when you are distinguishing it against the
Manually                                      (usually these are actually ticks for an edit screen, but sometimes we do have them).
Manually
Manually
Manually                                      For changing the number of items shown, use the language string 'CHANGE' ('Chang



Manually
Manually
Manually                                      (although usually primary content would not be in any box). Also use to show search
Manually                                      (unless 'classic' is more appropriate)
Manually



Manually                                      Javascript must not be required for functionality, unless there are alternative/degrade
Code Quality Checker                          document.all, form.foo, etc, are all non-standard (even though they're common-place
                                          We
Code Quality Checker / ocProducts PHP version supply getInnerHTML and setInnerHTML functions for cases where innerHTML w
                                          See
Code Quality Checker / ocProducts PHP version how ocPortal script tags are written out, and do it in the same way. The ocPortal
Code Quality Checker                          Instead of window.escape, use window.encodeURIComponent.
Code Quality Checker                          window.addFavorite only works on IE. Other browsers have their own extensions. On
Use strict warnings on Firefox                If you are using Firefox, turn on Javascript strict warnings in the “about:config” setting
Manually                                       ################



Code Quality Checker                         ################
Manually                                     ################
Code Quality Checker                        Don't use deprecated XHTML attributes or tags (e.g. the 'align' attribute, the 'b' tag). U
                                            (even though
Firefox HTML validator extension / Code Quality Checker ocPortal uses an XHTML-transitional doctype). We follow all the rules o
ocProducts PHP version                       ################
Manually
Manually                                    Colons and so forth may be used in templates in a visual way (even though strictly it
Manually                                     ################
Code Quality Checker                        Don't use the XHTML style attribute except where you need to pass in styles continge
Code Quality Checker                        Only use any extended-ASCII characters in templates, as you cannot assume what c
                                            Don'tforcibly open
Manually                                    up links in new
Code Quality Checker                        When links are sent to new windows, remember to use {!LINK_NEW_WINDOW} in th



Manually
Manually                                      Name CSS classes according to what they are for and not what they do (e.g. big_an
Manually                                       ################
                                              Users should be
Code Quality Checker                          able to change font
                                              If you set heights
Manually                                      then if people
Manually                                       ################
Manually                                      Test on IE6 (anything older is ancient), latest Firefox, latest Opera, latest Safari or Go
Manually                                      CSS defined outside global.css and nocache.css must not have wide-sweeping
Manually                                      Don't put all your code into global.css. If you have lots of styles relating to a new f



                                                  Page 17
                                            Important
Manually                                 The key to writing good CSS is understanding. Understand your way through how bro
Code Quality Checker, special function   Don't leave old unused styles in the CSS files.
Code Quality Checker, special function    ################
Manually                                  ################
Manually                                 Ideally (but this is asking a bit much), test your styles with an rtl language pack. Usua



Manually                                 Bundled images should be referred to via the theme image system, not by direct URL
Manually                                 Use PNG images in most cases, GIF when animation is needed, or JPEG if there is z
Manually                                 Pass PNG images through a compression program such as PNGGauntlet or PNGTh


Manually                                 'solidborder' is formalised for other kinds of 'Map table' or 'Columned table', or just ab
Manually                                 Any Map or Columned table must have the appropriate summary attribute indicating t
Manually                                  ################
Manually                                 Any layout table we use (one not defined as 'Map' or 'Columned') should have a blan
Manually                                  ################
Manually                                 Use th properly to define headers. If you have a case where there are top-level and s




                                             Page 18
                                                                          Important




o see what's available.




 tab key your editor should be configured to insert a real tab, not spaces. OcProducts have their editors set to display tab characters as '3 spaces' but this
 on their own lines. Also don't skip braces when a block of code that would normally have branches (if, while, foreach, etc) spans multiple lines. It is possib
 few lines long and does a common purpose. Usually the chunk will start with a short comment, and end with a single blank line or a closing brace. Make y
or_names in PHP variables, PHP function names, PHP arrays, database tables and database fields.


odules that are considered 'private' should be prefixed with an underscore. Remember our code must run on PHP4 if it is going into ocPortal, which is why



at XMLHttpRequest on Internet Explorer had a caching bug… so instead of just throwing in a solution to where it affected him, he considered the problem



 kes when writing new code. Our functions have been tuned over years. For example, our 'http_download_file' function works on any server and supports
 irements, so it must be supported.
d to use 'type' as the internal specifier of what 'screen' to show. The 'run' function should decide what function to call based on this parameter. The default
 rogrammers to grasp so is explained in a separate section in our Code Book.
   get/post_param_* functions.
  th the same environment parameter names you'd otherwise extract as indices from the arrays. E.g. ocp_srv('HTTP_HOST') instead of $_SERVER['HTTP
ometimes this needs doing in PHP code, and sometimes it needs doing in your queries (ORDER BY). If doing it in PHP code consider you usually will wan
   browse screens using ocPortal's results_browser or back/next system.
entially being in different timezones. Rarely if ever use PHP's inbuilt date/time functions - use ocPortal's temporal API.
 pes remember to write all appropriate hooks for them (e.g. search hooks).
 ct performance like running queries inside a loop/recursion.

 L so is fairly common to type in; if you need it append two strings together to form it so that it doesn't have to be literally written into the code.
 pace ends up on the end of the file (e.g. when a user edits their file in a buggy text editor), it can cause problems.
not change database state in any major way (it can cause problems with web spiders, problems with web accelerator systems, and XSS vulnerabilities). P
 um-upload size on all screens that support file uploads, unless the size is very unlikely to be reached by the user (e.g. just uploading an avatar). ocPortal
paration between content, presentation and code. This is referred to as the MVC (model, view, controller) design pattern. No HTML is allowed in the PHP
nsions are installed unless they are listed in ocPortal's minimum requirements. If you do use something else (necessarily so, and only for auxiliary behavio


                                                                           Page 19
                                                                                Important
 ely-used function is available unless it is listed in the sources/phpstub.php file (Code Quality Checker will check, no need to manually check). We ha
 d for functionality to work, unless said functionality is not needed to operate the system (i.e. alternatives exist).
 e ocPortal cookie functions to read/set/delete them, as these are written to respect the webmaster's defined cookie settings (cookie domain, cookie path)
  in template calls. If you copy and paste a line with a GUID ('_GUID'=>'blahblahblah',), remove it completely from your new line. Our automated s
  contain an empty 'index.html' (to stop directory browsing on web servers that have it enabled). Most directories should also contain the small '.htaccess' fi
 ributed with ocPortal must be registered in one addon. To do this list it in the obvious position within one of the sources/hooks/systems/addon_reg
erly handled via hooks, dependency setting in the addon_registry hook (i.e. say addons only work if some other addon is also there), or via code that uses
 de files that are loaded only when needed.
 may have the same name, regardless of where they are defined or used. It should be possible for the whole set of ocPortal PHP files to be simultaneously
  is our standard boot code in the entry point files.
 de in the entry-point file, put it in a sources file and require it in then call it as a function.
ed parameters to the template where they might be useful; raw timestamps, IDs, etc.
will try and hack the website, and that they have the full source code, so don't rely on them not guessing URL parameters etc. For example, if you impleme
o the header function make sure they do not contain \r or \n symbols. If you're using eval be EXTREMELY careful to validated input; there's rarely a reaso
 set is Unicode, or Western European for input data or for output data. Use appropriate conversions when interfacing with things that come-from/go-to a po
x correctly, and never adlib on it's syntax (it gets parsed). Make sure the data types specified are accurate. Where NULL is allowed for a value make sure
  ever be necessary to operate, configure, or extend an installed ocPortal website.
ave multiple themes and languages - be careful that you do not cache things with implicit assumptions that should not have been made (e.g. instead of ca
e run over an M.S.N. (i.e. different URL, not just from the 'forum' zone) and also from a separate database - don't make false assumptions about database




_default_content ' function is used where appropriate in installation code. This function puts in language strings to the database such that they get stored automatically for
 rade properly between major versions of ocPortal, and preferably between all versions. Do not assume a module will never be upgraded- if your module h
 hould not give errors about existing tables, config options, or permissions. For this to work, the uninstall function must fully uninstall what the install functio



ign/document the tests you are going to run to make sure your written code works. Think of how it might break under situations you might have otherwise
d tested make sure that the user documentation for ocPortal is updated (edit a tut_* file in site/pages/comcode_custom/EN).
feature it will need to be added to the ocPortal website's feature-list eventually, and also announced. The project manager (usually Chris) will handle this,


  st practices, whilst also keeping things consistent with how ocPortal is coded.
  of code (exceptions: see below), or the same snippet of code time-and-time-again. If you spot a reusable chunk of code, consider making both usages wo
 k of code, e.g. if implementing a new importer and using a pre-existing one as a base - then make sure you at least adjust your copied code to make sens
  write. Don't just copy some existing pattern into a new context.
propriate units (sensible modules interacting over reasonable interfaces). Where possible create functions and classes that are isolated from specific scree
 les where appropriate. For example, an API acting for a certain addon would be in a number of code files named after that addon. CSS for an addon woul
variable/file/identifier/token names that make full intuitive sense in whatever context they are used in; this is particularly important for global functions (you
 ious code. Don't comment obvious things ("this is a loop", "this runs if $foo equals $bar"). Write comments that explain your algorithms, and comments th
 For example, instead of using the numbers 1, 2, and 3 with special meanings throughout your code, define constants and reference those instead.
  our code neat. Don't misspell in comments and variable names. Tidy code encourages a mindset of zero tolerance for messiness in other areas, and incr
  that really should be cleaner, put a comment by it starting "HACKHACK". If you haven't finished something put a comment starting "TODO", so it is easy




 out of a cache (e.g. a CSS file out of the 'templates_cached' directory) - use the correct API functions.
the web browser, or from the file-system) should go through the 'unixify_line_format' function, to make sure line-terminations are converted to the right for




                                                                                 Page 20
                                                                                Important
e build_url() correctly. This function will convert to whatever URL scheme is in place, as well as propagate 'keep_' fields. Never use relative URLs.
 module is located in, except in the case of admin modules. Use the 'get_module_zone' function or '_SEARCH' token to break down such assumptions.
 e-mail, make sure the $skip_keep parameter is set to true, as 'keep_' parameters should not go out in e-mails.
 mething to a URL inside a template, unless it is a URL to a helper script (rather than a screen) or if you have explicitly disabled SEO for the URL. Pass in
  module doesn't pass through a 'type' if it is 'misc'. Most other modules do. Any 'misc' screen doesn't use an ID if the ID would be db_get_first_id().
  accepts URLs into the system via a form interface then add extra code to make sure the URLs start 'http://' (users will often miss it out). It should add that
mbol or 'find_script' function to find zone-based scripts. Put non zone-based scripts in 'data' (or 'data_custom' if for an unofficial addon).
  ogs in a non-custom directory, and never put code files in a custom directory if they are going to be distributed with ocPortal. Generally don't put files in places where
eferencing custom/user-data, otherwise don't. Core ocPortal files that can't be changed from inside ocPortal are not custom, other files are. i.e. non-custom
 rectory (either URL or filesystem): use full paths (using 'get_file_base' or 'get_custom_file_base' to start off the full path).



our APIs, don't write SQL by hand. Use 'query_insert', 'query_update' and 'query_delete'. The only real cases where you need to write SQL by hand comp
 t thinking about security.
w escaping is done (you might not know this but the mySQL escaping method is non-standard and the Microsoft one is actually 'correct'!)
 that is not widely supported such as 'UNION', sub-queries or database functions such as the mySQL substring functions
arameters to the query functions rather than hard-coding an SQL 'LIMIT' clause (this is required for MS Access compatibility)


 ERE validated='1'" as "validated" is an integer field and thus must be referred to as such. Most database are type-strict, mySQL is an exception so it's a b
 into WHERE clauses directly (e.g. "WHERE foo='bar'"), use the 'db_string_equal_to' function (e.g. "WHERE '.db_string_equa_to('foo','bar')").

but does not necessarily hold true. Use db_get_first_id() to find the number to use.
 rds for database field naming as for ocPortal (lower case, with underscores to separate words).
QL, write SQL keywords in upper case (e.g. SELECT, FROM, UPDATE, WHERE, LIKE, AND, OR). This makes it easier to scan over them.
 ou regularly query a table using non-key field(s).
e table prefix (so don't assume 'ocp4_' is at the start of the table names - use 'db_get_table_prefix' to find out what to use)
eloping for OCF (unless you are coding OCF directly), or other forum driver. In other words, use the forum driver API properly and do not assume anything
 chemas via 'create_table' use the closest ocPortal field type you can. For example, make use of 'AUTO_LINK' and 'TIME' and 'USER' rather than always



be split up into start/end pairs. The only exception is HEADER and FOOTER, but there is a technical reason for this exception.


addon's templates mostly start 'DOWNLOAD_'.
 n template that wraps a screens output. All screen templates include a {TITLE}.
 s also used by a module too


 code must contain the filename substring 'MAIL_' or '_MAIL' or '_FCOMCODE' or be called 'NEWSLETTER_DEFAULT '. Any template named like this
 script must be prefixed 'JAVASCRIPT_'. Any template prefixed 'JAVASCRIPT_' must be in Javascript format, except for 'JAVASCRIPT_NEED' and 'JAVA
 neither XHTML or Javascript or CSS or Comcode are 'MAIL_SUBJECT' or a template starting with 'PLAIN_'. All templates starting 'PLAIN_' must be so.
  must be defined in the 'css'/'css_custom' directories, rather than the 'templates'/'templates_custom' directories.



he interface conventions of existing modules, unless there is a strong argument that you are dealing with a special case. For example, don't design new wa
ment modules as an ocPortal AED module (add/edit/delete).
one has permission to edit something, then for the template that shows the content, pass in a parameter called EDIT_URL, containing the URL to edit the
 eens should either be redirects to an appropriate location (e.g. the 'view' screen for what was just added/edited), do-next managers, or very rarely, messa
ctions should generally be divided by a welcoming do-next manager (i.e. a set of icons). Exceptions include: when adding only involves specifying a single
ments in ocPortal, unless the duplicate is clearly marked as some kind of shortcut/dupe/jump. For example, if there is a shortcut link between two modules
 eadcrumb_set_parents as required to generate appropriate breadcrumb chains. Try to do it at the start of screen code, so it'll be set if an error happens d
e helper-panel pictures, tutorial links, and inline help, for Admin Zone and CMS Zone modules, using the global variables 'HELPER_PANEL_PIC', 'HELPE



                                                                                 Page 21
                                                                              Important
 may be blank (e.g. if it is possible for a field to not be filled in, or for there to be no entries in a list) you need to accommodate for that possibility. Sometim
 be wrapped with some kind of template suffixed '_SCREEN' that includes a '{TITLE}'. This might be a standard screen template that already exists, such



 viewing title/value data in a table
 aragraphed sequence of things to choose
HTML list of things to choose
abled/descripted list of things to choose
ain table of something




 h multiple screens. Usually you'll want to use results_browser instead.




curs that is non-fatal (e.g. failure for an email to be sent always causes a recoverable error in ocPortal). You do it via adding to the global DEFERRED_ER
 nction for this. Use the appropriate type of this for any kind of response based messaging, unless you feel compelled to give a full screen message
 whatever_exit function. Use the appropriate type of message for when you feel compelled to do a full screen message, or if the message is truly terminal
g about the action or content that a screen is providing
S classes, such as 'nothing_here' or 'red_alert' or 'important_notification' to mark the error using standard ocPortal styles.
ction for this. It can be passed a language code, or a string. For ocPortal development, it should be a language code, so that the logs may be internationa



 e such as 'FORM_SCREEN' (most cases) or 'FORM' (if the form is just part of a complex screen). These templates provide automatic client-side field val
andard input field types (e.g. form_input_integer), or creating a new type if you have a special case
ups by using the 'FORM_SCREEN_FIELD_SPACER' template to separate them. Hide groups of advanced functionality that is not often needed (often thi
 ge string and Javascript script technique (standardAlternateFields) to mark alternative fields (i.e. the case where users may enter something in a field, or s



erminology ('Zone', 'Comcode', …) should not be seen on the main website
'Codename', 'Option', 'Title', 'Description'


ns (e.g. Charlie or Microsoft, but not box) for new sentences, or sometimes for sentence-like standalone phrases
ng from the start of the sentence)

write to make sure it is completely clear, as concise as reasonably possible, and cannot be misinterpreted.
strings can contain XHTML. There are only a few exceptions where this is not true. Theoretically the burden usually lies on code removing XHTML formatt

 ssible, in particular 'ndash', 'mdash', 'hellip', 'ldquo', 'rdquo', 'lsquo' and 'lrquo'. These make the output that much nicer, and grammatically more correct (d
  as possible. Don't add new strings unless it is an improvement, as they need to be translated into potentially dozens of languages. To facilitate this, phras
rminology. Sometimes multi-word proper nouns are given hyphens (e.g. "multi-word"), sometimes concatenation is used (e.g. "multiword"), sometimes abb

 the rest of ocPortal, then put them in a language file that can be individually included by a module


so that the full stop follows the closing of the bracket. For example: example (example).


                                                                               Page 22
                                                                           Important
lish is 'check' in American English (referring to the square „tickbox‟/‟checkbox‟ on HTML forms). Due to this disparity, write both like "tick (check)".




 'EDIT' ('Edit') when you are distinguishing it against the language string 'DELETE' ('Delete')
cks for an edit screen, but sometimes we do have them). If it's more of a removal than a deletion, the language string 'REMOVE' ('Remove)


items shown, use the language string 'CHANGE' ('Change'), or use the language string 'PER_PAGE' ('Per page') if you are doing it as a sentence




ntent would not be in any box). Also use to show search results and blocks.




red for functionality, unless there are alternative/degraded interfaces (however, you can assume that if Javascript is supported then AJAX is also supporte
are all non-standard (even though they're common-place) – use getElementById etc
nd setInnerHTML functions for cases where innerHTML would be useful, but our versions do proper XML DOM parsing. TRUE XHTML requires DOM pars
 are written out, and do it in the same way. The ocPortal style works with XHTML and HTML renderers. The doctype of a page does not define the render
 se window.encodeURIComponent.
rks on IE. Other browsers have their own extensions. Only use these extensions if you provide graceful degradation (i.e. fallbacks).
 on Javascript strict warnings in the “about:config” settings, and ideally make sure you don't produce any warnings (check the error console to see if you a




L attributes or tags (e.g. the 'align' attribute, the 'b' tag). Use a combination of CSS and semantic tags instead (e.g. 'text-align' and the 'strong' tag). This is
an XHTML-transitional doctype). We follow all the rules of strict (including not using deprecated attributes) except for two things - we use the 'target' attribu


used in templates in a visual way (even though strictly it is an English'ism).

 ttribute except where you need to pass in styles contingent on template parameters
CII characters in templates, as you cannot assume what character set will be in use.

windows, remember to use {!LINK_NEW_WINDOW} in the link title attribute.




 g to what they are for and not what they do (e.g. big_and_red_page_icon is a terrible name, but warning_icon is a good one).




s ancient), latest Firefox, latest Opera, latest Safari or Google Chrome (the assumption is that all but IE users regularly upgrade browsers).
l.css and nocache.css must not have wide-sweeping effects (it must be modular and target specific elements that would not normally exist on arbitrary
lobal.css. If you have lots of styles relating to a new feature, give a neat comment formatted exactly the same as other formats in the file.



                                                                            Page 23
                                                                          Important
 is understanding. Understand your way through how browsers render CSS, and the quirks of particular browsers. Never ever write CSS by adding or hac



it much), test your styles with an rtl language pack. Usually you make them work by substituting "left" with "{!en_left}" and "right" with "{!en_right}" in your C



eferred to via the theme image system, not by direct URL
ses, GIF when animation is needed, or JPEG if there is zero chance of the image needing any transparency and it compresses better as JPEG.
 compression program such as PNGGauntlet or PNGThing, and strip gamma settings in the process (needed for colour compatibility on some browsers).


other kinds of 'Map table' or 'Columned table', or just about any other kind of table.
must have the appropriate summary attribute indicating this. ({!MAP_TABLE}, {!COLUMNED_TABLE})

e not defined as 'Map' or 'Columned') should have a blank summary, and should have an HTML or Tempcode comment that indicates why you had to use

aders. If you have a case where there are top-level and secondary-level headers, put the top-level header in thead and also make use of tbody.




                                                                           Page 24
                                                                          Important




 s set to display tab characters as '3 spaces' but this is optional.
, while, foreach, etc) spans multiple lines. It is possible to do it in some circumstances but it's never good even if you do indent properly. It makes the read
nd with a single blank line or a closing brace. Make your blank lines mean something (i.e. the end of a code chunk), don't just add them to space things ou



run on PHP4 if it is going into ocPortal, which is why we do not use the 'private' keyword.



to where it affected him, he considered the problem architecturally, making sure all AJAX-facing PHP scripts have a common approach to solving the prob



oad_file' function works on any server and supports lots of options.

unction to call based on this parameter. The default entry point for a module must either not exist, or be named 'misc'. Do not hardcode defaults other tha


cp_srv('HTTP_HOST') instead of $_SERVER['HTTP_HOST']
If doing it in PHP code consider you usually will want to do a 'natural' sort. Typically you should order data records by date, not by ID. You should never as




have to be literally written into the code.

web accelerator systems, and XSS vulnerabilities). POST requests should not be used for screens that might be reasonably bookmarked (e.g. search resu
 by the user (e.g. just uploading an avatar). ocPortal has a standard mechanism to do this, which can be automated within AED modules. For code examp
ler) design pattern. No HTML is allowed in the PHP code except for very select exceptions, such as <option> (for efficiency) and hardcoded emergency er
 g else (necessarily so, and only for auxiliary behaviour) you must cleanly handle the situation where it is not present using either code branching or helpfu


                                                                           Page 25
                                                                         Important
ecker will check, no need to manually check). We have avoided many functions where web hosts often block using the PHP 'disable_functions' option.

 efined cookie settings (cookie domain, cookie path).
 e it completely from your new line. Our automated scripts can put one back in later. The reason: these are used to allow different uses of shared template
 irectories should also contain the small '.htaccess' file (copy it from another deep directory) that we use to block direct file access.
 ne of the sources/hooks/systems/addon_registry files.
 me other addon is also there), or via code that uses the 'addon_installed' function to guard off the dependency. For example, if you used the galleries add

 whole set of ocPortal PHP files to be simultaneously loaded.



ng URL parameters etc. For example, if you implement some kind of permission scheme for a feature, don't just limit how the link to the feature is shown,
ELY careful to validated input; there's rarely a reason to use it anyway. If you're using preg_replace make sure to use preg_quote and to manually escape
hen interfacing with things that come-from/go-to a potentially alien character set.
 rate. Where NULL is allowed for a value make sure that is specified (via “?” before the data type) and it's meaning explained. Do not copy and paste com

 that should not have been made (e.g. instead of cacheing something in English, you should cache stuff per-language).
 ase - don't make false assumptions about databases, tables (e.g. using SITE_DB instead of FORUM_DB and hence wrongly assuming the forum and sit




 to the database such that they get stored automatically for all translations available on the installation.
 e a module will never be upgraded- if your module has undergone database structure revisions then you must make sure there is upgrade code to apply t
 all function must fully uninstall what the install function creates.



 ht break under situations you might have otherwise forgotten about (e.g. what if a guest user is running your module) and add in tests to test that it doesn
 omcode_custom/EN).
The project manager (usually Chris) will handle this, but make sure he knows about the feature if he/she didn't originally put it on ClockingIT himself/herse




able chunk of code, consider making both usages work via a new shared function. Sometimes if you see the same PATTERN of code time-and-time-again
 e you at least adjust your copied code to make sense. Don't leave comments in there that refer to the old context (e.g. refer to the wrong importer in the p

  ons and classes that are isolated from specific screens, as these can then have unit tests written for them.
 iles named after that addon. CSS for an addon would be in a file named after that addon.
  his is particularly important for global functions (you should have an idea what specifically the function is for without having to look it up).
ments that explain your algorithms, and comments that give a high-level overview of what chunks of code do. Very roughly one of two comments per 7 line
 efine constants and reference those instead.
 ero tolerance for messiness in other areas, and increases general team morale such as to keep a high level of standards. See Broken Windows Theory.
ething put a comment starting "TODO", so it is easy for someone to later pick up if you forgot to finish it.




  sure line-terminations are converted to the right format that the server operating-system needs.




                                                                          Page 26
                                                                         Important
gate 'keep_' fields. Never use relative URLs.
 EARCH' token to break down such assumptions.


u have explicitly disabled SEO for the URL. Pass in all the URLs you need to the template so you don't need to deploy hacks.
se an ID if the ID would be db_get_first_id().
 ttp://' (users will often miss it out). It should add that on the front if the URL does not already contain '://'.
ustom' if for an unofficial addon).
ed with ocPortal. Generally don't put files in places where they don't belong.
Portal are not custom, other files are. i.e. non-custom files are those that would be shared between sites.




 l cases where you need to write SQL by hand completely is if you need to do 'OR' queries, or do wildcard searches.

e Microsoft one is actually 'correct'!)

S Access compatibility)


ase are type-strict, mySQL is an exception so it's a big mistake to get things wrong here.
WHERE '.db_string_equa_to('foo','bar')").



 his makes it easier to scan over them.


 rum driver API properly and do not assume anything about the forum and member software beyond that.
TO_LINK' and 'TIME' and 'USER' rather than always using 'INTEGER'. Use 'URLPATH' for URLs. This will help ocPortal understand it's own database bet



 eason for this exception.




ETTER_DEFAULT '. Any template named like this must be in Comcode format, except for 'MAIL_SUBJECT'.
  format, except for 'JAVASCRIPT_NEED' and 'JAVASCRIPT_NEED_INLINE'.
LAIN_'. All templates starting 'PLAIN_' must be so.




 ith a special case. For example, don't design new ways of previewing things, use the standard previewing mechanism. Another example, use the 'result

 er called EDIT_URL, containing the URL to edit the content. If the user doesn‟t have edit permission, then pass in EDIT_URL empty. Use the standard ST
ed/edited), do-next managers, or very rarely, message screens. Follow the conventions other modules use. If you do do a redirect, use the proper API (the
clude: when adding only involves specifying a single field (in which case you can put add and edit on the same screen), and also when adding is for powe
mple, if there is a shortcut link between two modules (a duplication in navigation), use the standard ocPortal convention for informing the user they are jum
 t of screen code, so it'll be set if an error happens during screen generation.
he global variables 'HELPER_PANEL_PIC', 'HELPER_PANEL_TUTORIAL' and 'HELPER_PANEL_TEXT' (see existing code for examples of how to use



                                                                          Page 27
                                                                                Important
u need to accommodate for that possibility. Sometimes no changes are required, but often if there are headings or boxes used to contain it then you'll wan
a standard screen template that already exists, such as 'INDEX_SCREEN' or it might be custom one such as 'DOWNLOAD_SCREEN'.




). You do it via adding to the global DEFERRED_ERRORS array (see existing code for examples).
 feel compelled to give a full screen message
 screen message, or if the message is truly terminal (in the 'fatal' case here)



anguage code, so that the logs may be internationalised.



ese templates provide automatic client-side field validation; server-side field validation is provided automatically also, via the standard field retrieval functi

 nced functionality that is not often needed (often this functionality can fit nearly into a single 'Advanced' group).
. the case where users may enter something in a field, or something in a different field, but never in both fields). Look at examples in existing code to see how it works.




urden usually lies on code removing XHTML formatting that is there and can't be used, rather than the other-way-around. Practically, there are some case

 that much nicer, and grammatically more correct (doing " - " instead of " &ndash; " is technically wrong, as a hyphen is not a dash).
entially dozens of languages. To facilitate this, phrases should be made as general as reasonable… i.e. avoid using context where possible (e.g. use "Ad
catenation is used (e.g. "multiword"), sometimes abbreviation is used by just using the first letters placed together as capitals (e.g. "MW"), and sometimes




                                                                                 Page 28
                                                                           Important
o this disparity, write both like "tick (check)".




anguage string 'REMOVE' ('Remove)


('Per page') if you are doing it as a sentence




f Javascript is supported then AJAX is also supported). Some people turn it off, or some people with disabilities cannot use it. This is actually part of WCA


ML DOM parsing. TRUE XHTML requires DOM parsing, and can't manipulate XHTML as a byte stream.
s. The doctype of a page does not define the renderer, only the validation grammar; so whilst the HTML style script tags may appear to work in XHTML, in


ul degradation (i.e. fallbacks).
ny warnings (check the error console to see if you are producing them).




 instead (e.g. 'text-align' and the 'strong' tag). This is part of WCAG, but needed re-iterating.
utes) except for two things - we use the 'target' attribute and we use the 'iframe' tag.




warning_icon is a good one).




E users regularly upgrade browsers).
ic elements that would not normally exist on arbitrary screens).
ly the same as other formats in the file.



                                                                            Page 29
                                                                          Important
ar browsers. Never ever write CSS by adding or hacking with properties until it works.



with "{!en_left}" and "right" with "{!en_right}" in your CSS, to make things mirror-image.




arency and it compresses better as JPEG.
(needed for colour compatibility on some browsers).




mpcode comment that indicates why you had to use that layout table.

ader in thead and also make use of tbody.




                                                                           Page 30
                                                                          Important




ood even if you do indent properly. It makes the reader think the code is badly indented (thus they'll misread it), or buggy.
 code chunk), don't just add them to space things out randomly.




scripts have a common approach to solving the problem.




be named 'misc'. Do not hardcode defaults other than 'misc' as it will interfere with the pagelink permission security and the short-URL support.



data records by date, not by ID. You should never assume that data comes out of the database in the same order as it goes in.




t might be reasonably bookmarked (e.g. search result screens, or result filtering screens). ocPortal has specific features in it's API to allow you to choose
be automated within AED modules. For code examples search the code for 'get_upload_limit_config_url'.
option> (for efficiency) and hardcoded emergency error pages.
 is not present using either code branching or helpful error messages.


                                                                           Page 31
                                                                            Important
n block using the PHP 'disable_functions' option.


 e are used to allow different uses of shared templates to be differentiated via Tempcode. The GUID is a unique identifier for a specific template call.
se to block direct file access.

 endency. For example, if you used the galleries addon in some feature in the downloads addon, you would make sure the downloads addon did not break




, don't just limit how the link to the feature is shown, also limit the interface and actualiser functions for the feature.
ake sure to use preg_quote and to manually escape the regular expression encapsulation character (usually # or /).

 it's meaning explained. Do not copy and paste comments from elsewhere without changing it to be fully correct for where you've added it.


_DB and hence wrongly assuming the forum and site always share a database) and file-storage/URLs (e.g. using 'get_base_url' instead of 'get_forum_ba




 ou must make sure there is upgrade code to apply these revisions. See how existing code does it for examples.




ng your module) and add in tests to test that it doesn't break. Use your judgement.

he didn't originally put it on ClockingIT himself/herself.




ee the same PATTERN of code time-and-time-again it makes sense to abstract that too.
old context (e.g. refer to the wrong importer in the pasted code, or the wrong '@package' at the top of the file).



n is for without having to look it up).
 de do. Very roughly one of two comments per 7 lines, but don't feel bound to match that.

h level of standards. See Broken Windows Theory.




                                                                             Page 32
                                                                        Important




 't need to deploy hacks.




s will help ocPortal understand it's own database better (which it does need to do in some situations such as broken URL scanning). If a field needs to sup




wing mechanism. Another example, use the 'results_browser' function instead of implementing new previous/next navigation code. There are almost always A

 then pass in EDIT_URL empty. Use the standard STAFF_ACTIONS include method for displaying any actions within the template (see the 'DOWNLOAD
s use. If you do do a redirect, use the proper API (the 'redirect_screen' function) so that the 'success' messages show up on the destination screen for the
 he same screen), and also when adding is for power-users only (in which case the add form would be hidden behind a button). Follow the conventions oth
 Portal convention for informing the user they are jumping between modules (for an example, see how the link from the 'Manage themes' screen to the 'Zo

TEXT' (see existing code for examples of how to use these).



                                                                         Page 33
                                                                         Important
 headings or boxes used to contain it then you'll want to wrap around the 'IF_NON_EMPTY' directive so as to avoid empty headings/boxes. For example t
 uch as 'DOWNLOAD_SCREEN'.




omatically also, via the standard field retrieval functions (e.g. post_param).


 Look at examples in existing code to see how it works.




e other-way-around. Practically, there are some cases where XHTML entities are allowed but not XHTML tags (e.g. if a language string is used for a 'title' a

g, as a hyphen is not a dash).
.e. avoid using context where possible (e.g. use "Added entry {1}" rather than "Added download {1}"). Don't do this if it creates a usability problem though.
 ed together as capitals (e.g. "MW"), and sometimes each word is given in capitals (e.g. "Multi Word"). All this inconsistency is ingrained in English, but for




                                                                          Page 34
                                                                              Important




disabilities cannot use it. This is actually part of WCAG, but it is worth reiterating for clarity.



ML style script tags may appear to work in XHTML, in TRUE XHTML they would not.




                                                                               Page 35
Important




Page 36
                                                                      Important




sion security and the short-URL support.



same order as it goes in.




s specific features in it's API to allow you to choose whether forms use GET or POST requests- choose carefully.




                                                                       Page 37
                                                                         Important



 a unique identifier for a specific template call.


would make sure the downloads addon did not break if the galleries addon was uninstalled (instead you'd write code to turn off the feature if the dependen




lly correct for where you've added it.


s (e.g. using 'get_base_url' instead of 'get_forum_base_url'). Use the correct APIs for referencing OCF data and files. As a general rule, any table starting




                                                                          Page 38
                                                                               Important




uch as broken URL scanning). If a field needs to support Comcode, define it as 'SHORT_TRANS' or 'LONG_TRANS' (never run comcode_to_tempcode o




previous/next navigation code. There are almost always API functions or templates for you to use, so it's actually easier to use conventions than re-implementing from scr

 y actions within the template (see the 'DOWNLOAD_SCREEN' template for an example).
messages show up on the destination screen for the redirect.
 hidden behind a button). Follow the conventions other modules use.
 the link from the 'Manage themes' screen to the 'Zones' screen works).




                                                                                Page 39
                                                                           Important
so as to avoid empty headings/boxes. For example to stop an empty paragraph element producing an accessibility problem when 'SOMETHING' is blank,




ML tags (e.g. if a language string is used for a 'title' attribute), and you will just need to use your judgement and test if you change an existing language str


Don't do this if it creates a usability problem though.
 All this inconsistency is ingrained in English, but for any single term, reference it in a uniform way. We do not usually use the antiquated form of abbrevia




                                                                            Page 40
Important




Page 41
Important




Page 42
Important




Page 43
                                                                          Important




 u'd write code to turn off the feature if the dependency was not met).




F data and files. As a general rule, any table starting 'f_' is an OCF table and therefore should be accessed through FORUM_DB. If you are running develo




                                                                          Page 44
                                                                Important




LONG_TRANS' (never run comcode_to_tempcode on-the-fly).




 easier to use conventions than re-implementing from scratch.




                                                                Page 45
                                                                        Important
 accessibility problem when 'SOMETHING' is blank, guard it with 'IF_NON_EMPTY' as follows: {+START,IF_NON_EMPTY,{SOMETHING}}<p>{SOMETH




ment and test if you change an existing language string to include XHTML tags. The flip-side to XHTML being allowed is that you must encode things like



e do not usually use the antiquated form of abbreviations using dots (e.g. "M.W.").




                                                                         Page 46
Important




Page 47
Important




Page 48
Important




Page 49
                                                                    Important




ssed through FORUM_DB. If you are running development mode you will get an error ('Using OCF queries on the wrong driver') if you use the wrong data




                                                                     Page 50
Important




Page 51
                                                                      Important
RT,IF_NON_EMPTY,{SOMETHING}}<p>{SOMETHING*}</p>{+END}




L being allowed is that you must encode things like the ampersand symbol as entities.




                                                                       Page 52
Important




Page 53
Important




Page 54
Important




Page 55
                                                                    Important




eries on the wrong driver') if you use the wrong database object.




                                                                    Page 56
                                         XHTML extraction
Tick/cross   Standard                               Reason for standard

If you are writing regular expressions to extract data from XHTML, you should anticipate:
             there may be extra whitespace (there may be extra spaces inside tag definitions)
             whitespace may come in other forms than the " " symbol (there may be tabs)
             HTML used instead of XHTML. (there may be "<br>" instead of "<br />")
             that tags may be written in upper-case
             attribute quotes can be given as single-quotes as we well double quotestag contents may span multiple lines
             there may be whitespace around tag-contents
             tag contents may not be properly entity-encoded
             quoted data may contain quotes of the other-type (there may be <a title="He's saying hello">)

You may assume:
N/A          A tag opener/closer stays on one line
N/A          Attribute values are quoted
N/A          The text is in either well-formed SGML (HTML) or well-formed XML (XHTML)




                                               Page 57
                                                                XHTML extraction
                       Requirements for applicability How to check compliance   Further information

a from XHTML, you should anticipate:
spaces inside tag definitions)
mbol (there may be tabs)


e well double quotestag contents may span multiple lines


here may be <a title="He's saying hello">)




ell-formed XML (XHTML)




                                                                      Page 58
                                     Creating blocks
Tick/cross   Standard                       Reason for standard

Creating blocks
             List block parameters          User friendliness for webmasters




                                        Page 59
                                           Creating blocks
Requirements for applicability How to check compliance      Further information



ocPortal development only                                  function
                             Code Quality Checker, special Define all block parameters in the block code itself (in the info functio




                                                Page 60
                                                                           Creating blocks



arameters in the block code itself (in the info function for the block) then document all block parameters via inserting the language strings in language files for the a




                                                                               Page 61
                                                                             Creating blocks



a inserting the language strings in language files for the addon the block is a part of (see how it's done for existing blocks for examples)




                                                                                  Page 62
                                      Comcode parser
Tick/cross   Standard                    Reason for standard

Comcode parser/renderer code
             No context-sensitivity      Stability




                                         Page 63
                                            Comcode parser
Requirements for applicability   How to check compliance     Further information



ocPortal development only        Manually                    When programming the Comcode system, never allow Com




                                               Page 64
                                                                Comcode parser



programming the Comcode system, never allow Comcode to become context-sensitive (e.g. behaving differently when run from different URL paths).




                                                                    Page 65
                                                    Comcode parser



g differently when run from different URL paths).




                                                       Page 66
                                            Core classes
Tick/cross   Standard

Modifying core classes
             Object orientated principles




                                              Page 67
                                  Core classes
Reason for standard       Requirements for applicability



Architectural integrity   All ocProducts development




                                    Page 68
                               Core classes
How to check compliance   Further information



                          Use object-orientated principles properly where ocPortal does already. For example, foru




                                 Page 69
                                                                    Core classes



s properly where ocPortal does already. For example, forum drivers all have a database object as a property, rather than referencing the global FORUM_




                                                                      Page 70
                                                                   Core classes



roperty, rather than referencing the global FORUM_DB object. This is because they provide a core service and cannot make assumptions about the envir




                                                                     Page 71
                                                                    Core classes



rvice and cannot make assumptions about the environment (e.g. it must be possible to have multiple simultaneous forum drivers running).




                                                                      Page 72
                                       Core classes



simultaneous forum drivers running).




                                         Page 73
                                         Attachments
Tick/cross   Standard

Attachments
             Remember posted Comcode might be invalid




                                            Page 74
                              Attachments
Reason for standard   Requirements for applicability



Stability             All ocProducts development




                                Page 75
                               Attachments
How to check compliance   Further information



Manually                  If you are supporting ocPortal attachments in a field, run the check_comcode function on




                                 Page 76
                                                                    Attachments



attachments in a field, run the check_comcode function on the Comcode that references the attachments before the main row for the content is added to




                                                                      Page 77
                                                                     Attachments



ents before the main row for the content is added to the database. This ensures the Comcode is valid, so you can proceed to add the content row (using th




                                                                        Page 78
                                                                    Attachments



so you can proceed to add the content row (using the integer '0' temporarily as the field value for where the Comcode will be placed). The attachment Co




                                                                       Page 79
                                                                      Attachments



re the Comcode will be placed). The attachment Comcode can then be fully parsed (given the ID of the content row, so it can store it's security properly) a




                                                                        Page 80
                                                                       Attachments



he content row, so it can store it's security properly) and then the content row updated with the new language string ID for that parsed Comcode.




                                                                         Page 81
                                           Attachments



guage string ID for that parsed Comcode.




                                             Page 82

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:1394
posted:3/18/2010
language:English
pages:82