Changeset 42 for trunk/docs
- Timestamp:
- Dec 18, 2005 12:16:03 AM (18 years ago)
- Location:
- trunk/docs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/coding_standards.txt
r41 r42 7 7 ====================================================================== 8 8 9 We're following the PEAR coding standards, with minor modifications. 9 We're following the PEAR coding standards, with minor modifications. 10 10 11 11 This is essential reading: … … 20 20 21 21 Auth_SQL.inc.php One PHP Class to be included. The filename is the 22 type of class, underscore, name. Or if in subdirs, 22 type of class, underscore, name. Or if in subdirs, 23 23 this could be /Auth/SQL.inc.php while the class name 24 24 remains "Auth_SQL" … … 29 29 directly in the web root. 30 30 31 script.cli.php A command-line executable script, possibly executed 31 script.cli.php A command-line executable script, possibly executed 32 32 with CRON, usually outputs TEXT, not HTML. 33 33 … … 43 43 44 44 Use an indent of 4 spaces, with no tabs. Code and especially comments should 45 be wrapped <= 80 characters. Exceptions are made in the case where code 45 be wrapped <= 80 characters. Exceptions are made in the case where code 46 46 readability is significantly improved with longer lines. 47 47 … … 80 80 action1; 81 81 break; 82 82 83 83 case 2: 84 84 action2; 85 85 break; 86 86 87 87 default: 88 88 defaultaction; 89 89 break; 90 90 91 91 } 92 92 … … 137 137 ====================================================================== 138 138 139 When functions return boolean values, use 'return false;' or 'return true;' 139 When functions return boolean values, use 'return false;' or 'return true;' 140 140 as opposed to 'return 0;' or 'return 1;' or 'return(-1);'. 141 141 … … 149 149 150 150 $something = $blah . funky() . ".\".=" . $blab; 151 151 152 152 is better than: 153 153 154 154 $something = $blah.funky().".\".=".$blab; 155 155 … … 159 159 ====================================================================== 160 160 161 Use the single quote marks ' to enclose simple strings whenever possible. 162 Double quote marks " require extra parsing and thus slow things down, but 163 are necessary if entities there must be swapped-out such as variables or 161 Use the single quote marks ' to enclose simple strings whenever possible. 162 Double quote marks " require extra parsing and thus slow things down, but 163 are necessary if entities there must be swapped-out such as variables or 164 164 control characters. 165 165 … … 196 196 ====================================================================== 197 197 198 Function comments should follow the Javadoc standard, with detailed 198 Function comments should follow the Javadoc standard, with detailed 199 199 function comments and one-line pointers along the way: 200 200 http://java.sun.com/products/jdk/javadoc/writingdoccomments/index.html 201 201 202 202 <?php 203 203 /** … … 215 215 { 216 216 $qid = DB::query("SHOW COLUMNS FROM $db_table LIKE '$db_col'",false); 217 217 218 218 $row = mysql_fetch_row($qid); 219 219 if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $match)) { … … 283 283 ====================================================================== 284 284 285 All HTML should be valid XHTML 1.0 verfied with the 285 All HTML should be valid XHTML 1.0 verfied with the 286 286 W3C Markup Validation Service: http://validator.w3.org/ 287 287 … … 302 302 <td nowrap="nowrap">Example</td> 303 303 304 All tags must be properly closed. Tags without a closing part must follow the 304 All tags must be properly closed. Tags without a closing part must follow the 305 305 XHTML convention and end with a space and a slash: 306 306 -
trunk/docs/example_config.inc.php
r41 r42 12 12 // To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php'; 13 13 if (!preg_match('!^(/|[A-Z]:)!', __FILE__)) { 14 14 trigger_error('_config.inc.php include must be specified with an absolute file path (eg: "require_once dirname(__FILE__) . \'/_config.inc.php\';"', E_USER_ERROR); 15 15 } 16 16 … … 19 19 define('COMMON_BASE', realpath(dirname(__FILE__) . '/../')); 20 20 21 // The DocRoot for this application. SITE_BASE is ifferent from $_SERVER['DOCUMENT_ROOT'] because the 21 // The DocRoot for this application. SITE_BASE is ifferent from $_SERVER['DOCUMENT_ROOT'] because the 22 22 // latter does not change when using the apache Alias directive or URL Rewriting to define a site. 23 23 define('SITE_BASE', dirname(__FILE__)); -
trunk/docs/file_layout.txt
r41 r42 5 5 ====================================================================================== 6 6 7 codebase/ 8 bin/ 7 codebase/ 8 bin/ 9 9 (generic command-line scripts and applications) 10 10 file_importer.php … … 16 16 list_template.cli.php 17 17 module.cli.php 18 skel/ 18 skel/ 19 19 (templates for generating modules) 20 20 adm_form.ihtml … … 32 32 file_layout.txt 33 33 software_licence.txt 34 todo.txt 34 todo.txt 35 35 lib/ 36 36 App.inc.php (functions dealing with sessions, href/url/IP manipulation, directories.) … … 61 61 Upload.inc.php (class that manages uploading of files.) 62 62 Utilities.inc.php (functions for general utility: setting defaults, num/string functions, etc.) 63 services/ 63 services/ 64 64 (codebase scripts that are only useful when web accessible, i.e. to be used in a doc root) 65 65 admins.php … … 79 79 ====================================================================================== 80 80 81 global/ 81 global/ 82 82 (global level configuration and libraries for a group of sites/apps) 83 83 config.inc.php (system-wide configuration) 84 84 db_auth.inc.php (db-authentication for CLI scripts. chown'ed by user executing cron, NOT apache). 85 85 86 docs/ 86 docs/ 87 87 (documents specific to a group of sites/apps) 88 88 tei_db.mysql (db schema) 89 90 bin/ 89 90 bin/ 91 91 (global level command-line scripts) 92 93 admin/ 92 93 admin/ 94 94 (DocumentRoot for the admin application) 95 95 _config.inc.php … … 107 107 versions.php (manage db record versions) 108 108 109 html/ 109 html/ 110 110 (DocumentRoot of main site application) 111 111 _config.inc.php (configuration options and defaults specific to this site. included first in each script.) -
trunk/docs/revision_history.txt
r41 r42 10 10 - will still run if info missing: db creds, log dir, session info. 11 11 - can be located in /usr/local/lib/php if necessary, so accessible by all sites. 12 12 13 13 remove interdependencies: 14 14 - App() is the only dependency for other classes. It includes Utilities.inc.php silently. 15 15 - Update libs requiring external files, such as html templates and email templates, classes now self-contained. 16 16 17 17 Things with modified interfaces: 18 18 - App … … 41 41 - lang 42 42 - $dbh database handler 43 43 44 44 App object: 45 45 - object belongs to a realm, keeping messages and session data within specific site/app. 46 46 - uses the singleton pattern so only one instance of App exists for each app. 47 47 - app object can be accessed globally without reference to object name by calling methods statically, e.g. App:logMsg() 48 - seperate application and codebase parameters from site configuration variables. 48 - seperate application and codebase parameters from site configuration variables. 49 49 Use $app->getParam('var') or App::getParam('var') to get app params. 50 50 F or site configurations do whatever you want (I'm using $cfg['node']['features'] format for configurations) 51 51 52 52 App configuration parameters 53 53 - defaults part of the app class
Note: See TracChangeset
for help on using the changeset viewer.