From 766537035ea2f04c5aa3c59c15edc15f4ecd050f Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 9 Jul 2011 15:28:33 +0200 Subject: [ticket/10258] Change the DOCTYPE to HTML5 PHPBB3-10258 --- phpBB/docs/coding-guidelines.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 8365e3c301..64707010ab 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1,10 +1,8 @@ - - + + - - - - + + -- cgit v1.2.1 From 854c14f9f6ae78318e159e27724178579ff48dcc Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 10 Jul 2011 23:04:14 +0200 Subject: [ticket/10258] Remove X-UA-Compatible and imagetoolbar meta tags These meta tags are IE specific and do not validate as HTML5. PHPBB3-10258 --- phpBB/docs/coding-guidelines.html | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 64707010ab..b27a0f46c4 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2,8 +2,6 @@ - - -- cgit v1.2.1 From 70a904335f63a7b7d16164aadd48f33cad9ab4f0 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 10 Jul 2011 23:13:25 +0200 Subject: [ticket/10258] Remove resource-type and distribution meta tags They break HTML5 validation. PHPBB3-10258 --- phpBB/docs/coding-guidelines.html | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index b27a0f46c4..59513cb81f 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2,8 +2,6 @@ - - -- cgit v1.2.1 From f5947439b21353d9cda357fa41292cc95f390eab Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 11 Jul 2011 00:27:10 +0200 Subject: [ticket/10258] Remove copyright meta tag from docs It fails HTML5 validation and we already have a 'copyright and disclaimer' section in all of those documents. We can always represent the copyright more semantically later (such as the HTML5 tag). PHPBB3-10258 --- phpBB/docs/coding-guidelines.html | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 59513cb81f..aa937d5bfb 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2,7 +2,6 @@ - phpBB3 • Coding Guidelines -- cgit v1.2.1 From af1c8747ce5de2b0b056be851e08f7578b2c3807 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 11 Jul 2011 00:39:19 +0200 Subject: [ticket/10258] Adjust some deprecated tags for HTML5 in coding-guidelines PHPBB3-10258 --- phpBB/docs/coding-guidelines.html | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index aa937d5bfb..dcbbc011a0 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1763,7 +1763,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

With phpBB3, the output encoding for the forum in now UTF-8, a Universal Character Encoding by the Unicode Consortium that is by design a superset to US-ASCII and ISO-8859-1. By using one character set which simultaenously supports all scripts which previously would have required different encodings (eg: ISO-8859-1 to ISO-8859-15 (Latin, Greek, Cyrillic, Thai, Hebrew, Arabic); GB2312 (Simplified Chinese); Big5 (Traditional Chinese), EUC-JP (Japanese), EUC-KR (Korean), VISCII (Vietnamese); et cetera), this removes the need to convert between encodings and improves the accessibility of multilingual forums.

-

The impact is that the language files for phpBB must now also be encoded as UTF-8, with a caveat that the files must not contain a BOM for compatibility reasons with non-Unicode aware versions of PHP. For those with forums using the Latin character set (ie: most European languages), this change is transparent since UTF-8 is superset to US-ASCII and ISO-8859-1.

+

The impact is that the language files for phpBB must now also be encoded as UTF-8, with a caveat that the files must not contain a BOM for compatibility reasons with non-Unicode aware versions of PHP. For those with forums using the Latin character set (ie: most European languages), this change is transparent since UTF-8 is superset to US-ASCII and ISO-8859-1.

Language Tag:

@@ -1773,8 +1773,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

Most language tags consist of a two- or three-letter language subtag (from ISO 639-1/ISO 639-2). Sometimes, this is followed by a two-letter or three-digit region subtag (from ISO 3166-1 alpha-2 or UN M.49). Some examples are:

- - +
Language tag examples
+ @@ -1825,8 +1825,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

Next is the ISO 15924 language script code and when one should or shouldn't use it. For example, whilst en-Latn is syntaxically correct for describing English written with Latin script, real world English writing is more-or-less exclusively in the Latin script. For such languages like English that are written in a single script, the IANA Language Subtag Registry has a "Suppress-Script" field meaning the script code should be ommitted unless a specific language tag requires a specific script code. Some languages are written in more than one script and in such cases, the script code is encouraged since an end-user may be able to read their language in one script, but not the other. Some examples are:

-
Examples of various possible language tags as described by RFC 4646 and RFC 4647
Language tag
- +
Language subtag + script subtag examples
+ @@ -1892,8 +1892,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

Examples of English using marco-geographical regions:

-
Examples of using a language subtag in combination with a script subtag
Language tag
- +
Coding for English using macro-geographical regions
+ @@ -1918,8 +1918,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

Examples of Spanish using marco-geographical regions:

-
Coding for English using macro-geographical regions (examples for English of ISO 3166-1 alpha-2 vs. UN M.49 code)
ISO 639-1/ISO 639-2 + ISO 3166-1 alpha-2
- +
Coding for Spanish macro-geographical regions
+ @@ -1947,7 +1947,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

Example of where the ISO 3166-1 alpha-2 is ambiguous and why UN M.49 might be preferred:

-
Coding for Spanish macro-geographical regions (examples for Spanish of ISO 3166-1 alpha-2 vs. UN M.49 code)
ISO 639-1/ISO 639-2 + ISO 3166-1 alpha-2
+
@@ -2003,7 +2003,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

RFC 4646 anticipates features which shall be available in (currently draft) ISO 639-3 which aims to provide as complete enumeration of languages as possible, including living, extinct, ancient and constructed languages, whether majour, minor or unwritten. A new feature of ISO 639-3 compared to the previous two revisions is the concept of macrolanguages where Arabic and Chinese are two such examples. In such cases, their respective codes of ar and zh is very vague as to which dialect/topolect is used or perhaps some terse classical variant which may be difficult for all but very educated users. For such macrolanguages, it is recommended that the sub-language tag is used as a suffix to the macrolanguage tag, eg:

-
Coding for ambiguous ISO 3166-1 alpha-2 regions
+
@@ -2047,7 +2047,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

For phpBB, the language tags are not used in their raw form and instead converted to all lower-case and have the hyphen - replaced with an underscore _ where appropriate, with some examples below:

-
Macrolanguage subtag + sub-language subtag examples
+
@@ -2101,7 +2101,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

For the English language description, the language name is always first and any additional attributes required to describe the subtags within the language code are then listed in order separated with commas and enclosed within parentheses, eg:

-
Language tag normalisation examples
+
@@ -2153,7 +2153,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

The various Unicode control characters for bi-directional text and their HTML enquivalents where appropriate are as follows:

-
English language description examples for iso.txt
+
@@ -2219,7 +2219,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

For iso.txt, the directionality of the text can be explicitly set using special Unicode characters via any of the three methods provided by left-to-right/right-to-left markers/embeds/overrides, as without them, the ordering of characters will be incorrect, eg:

-
Unicode bidirectional control characters & HTML elements/entities
+
-- cgit v1.2.1 From c945fc9355fca866bfb095a2e79c51408a709387 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 11 Jul 2011 09:55:18 +0200 Subject: [ticket/10155] Add jQuery, introduce global assets path Add the jQuery JavaScript library to all pages, giving modifications instant access and allowing for any future core JavaScript to take advantage of it. Also introduce a global /assets directory for assets that are shared between styles. PHPBB3-10155 --- phpBB/docs/coding-guidelines.html | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 8365e3c301..66b6e8d953 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -269,6 +269,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c

Path locations for the following template variables are affected by this too:

    +
  • {T_ASSETS_PATH} - assets
  • {T_THEME_PATH} - styles/xxx/theme
  • {T_TEMPLATE_PATH} - styles/xxx/template
  • {T_SUPER_TEMPLATE_PATH} - styles/xxx/template
  • -- cgit v1.2.1 From 541a7db1016560d77590b9265c63c10cdd7e01a5 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 13 Jul 2011 09:51:09 +0200 Subject: [ticket/7090] Update documented minimum PHP version to 5.2.0 PHPBB3-7090 --- phpBB/docs/coding-guidelines.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 8365e3c301..12cbbc2caa 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2362,7 +2362,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
     	...
    -'FOO_BAR'	=>	'PHP version < 4.3.3.<br />
    +'FOO_BAR'	=>	'PHP version < 5.2.0.<br />
     	Visit "Downloads" at <a href="http://www.php.net/">www.php.net</a>.',
     	...
     	
    @@ -2371,7 +2371,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
     	...
    -'FOO_BAR'	=>	'PHP version &lt; 4.3.3.<br />
    +'FOO_BAR'	=>	'PHP version &lt; 5.2.0.<br />
     	Visit &quot;Downloads&quot; at <a href="http://www.php.net/">www.php.net</a>.',
     	...
     	
    @@ -2380,7 +2380,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
     	...
    -'FOO_BAR'	=>	'PHP version &lt; 4.3.3.<br />
    +'FOO_BAR'	=>	'PHP version &lt; 5.2.0.<br />
     	Visit “Downloads” at <a href="http://www.php.net/">www.php.net</a>.',
     	...
     	
    -- cgit v1.2.1 From b98fca54b0fd0e9aaca2f0f12ae9bcae14d014ec Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 17 Jul 2011 10:55:08 +0200 Subject: [ticket/10155] Briefly explain assets in coding-guidelines PHPBB3-10155 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 66b6e8d953..4a126f0144 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -269,7 +269,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c

    Path locations for the following template variables are affected by this too:

      -
    • {T_ASSETS_PATH} - assets
    • +
    • {T_ASSETS_PATH} - assets (non-style specific, static resources)
    • {T_THEME_PATH} - styles/xxx/theme
    • {T_TEMPLATE_PATH} - styles/xxx/template
    • {T_SUPER_TEMPLATE_PATH} - styles/xxx/template
    • -- cgit v1.2.1 From 75ef0fde825b89a6c2fa41a723b600552921e214 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 13 Oct 2011 17:43:59 +0200 Subject: [ticket/10246] Move coding guidelines VCS section to wiki The VCS section can now be found at: * http://wiki.phpbb.com/Git#Branches PHPBB3-10246 --- phpBB/docs/coding-guidelines.html | 52 +-------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index cd3c09f6fb..da7a3bf582 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -87,12 +87,6 @@
    • Writing Style
    • -
    • VCS Guidelines -
        -
      1. Repository structure
      2. -
      3. Commit Messages and Repository Rules
      4. -
      -
    • Copyright and disclaimer
    • @@ -2323,51 +2317,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
      -

      7. VCS Guidelines

      - -
      -
      - -
      - -

      The version control system for phpBB3 is git. The repository is available at http://github.com/phpbb/phpbb3.

      - -

      7.i. Repository Structure

      - -
        -
      • develop
        The latest unstable development version with new features etc.
      • -
      • develop-*
        Development branches of stable phpBB releases. Branched off of develop at the time of feature freeze. -
          -
        • phpBB3.0develop-olympus
          Development branch of the stable 3.0 line. Bug fixes are applied here.
        • -
        • phpBB3.1develop-ascraeus
          Development branch of the stable 3.1 line. Bug fixes are applied here.
        • -
        -
      • -
      • master
        A branch containing all stable phpBB3 release points
      • -
      • tags
        Released versions. Stable ones get merged into the master branch. -
          -
        • release-3.Y-BX
          Beta release X of the 3.Y line.
        • -
        • release-3.Y-RCX
          Release candidate X of the 3.Y line.
        • -
        • release-3.Y.Z-RCX
          Release candidate X of the stable 3.Y.Z release.
        • -
        • release-3.0.X
          Stable 3.0.X release.
        • -
        • release-2.0.X
          Old stable 2.0.X release.
        • -
        -
      • -
      - -

      7.ii. Commit Messages and Repository Rules

      - -

      Information on repository rules, such as commit messages can be found at http://wiki.phpbb.com/display/DEV/Git.

      - -
      - - - -
      -
      - -
      - -

      9. Copyright and disclaimer

      +

      8. Copyright and disclaimer

      -- cgit v1.2.1 From 8b99f04943673805a53fbea02d40faa98b0766d6 Mon Sep 17 00:00:00 2001 From: dellsystem Date: Thu, 27 Oct 2011 21:43:01 -0400 Subject: [ticket/10430] Fix typos/etc in coding guidelines Mainly minor changes to correct errors and improve readability. * "overcroud" --> "overcrowd" * "concentinations" --> "concatenations" * "SQL Statements", "SQL Formatting" - unnecessary capitalisation removed * "keep a very close eye to it" --> "keep a very close eye on it" * Fixed some fragmented sentences under the SQL Quotes section * Added capitalisation of "sql", "select", "select distinct" * "noticable" --> "noticeable" * "outputed" --> "outputted" * Added a missing "it" on the line about append_sid() * And some other grammatical/stylistic changes, not worth listing them all PHPBB3-10430 --- phpBB/docs/coding-guidelines.html | 42 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index da7a3bf582..7d51b26dca 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -462,12 +462,12 @@ do_stuff($str); $post_url = $phpbb_root_path . 'posting.' . $phpEx . '?mode=' . $mode . '&amp;start=' . $start;
      -

      // Double quotes are sometimes needed to not overcroud the line with concentinations

      +

      // Double quotes are sometimes needed to not overcrowd the line with concatenations.

       $post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start";
       	
      -

      In SQL Statements mixing single and double quotes is partly allowed (following the guidelines listed here about SQL Formatting), else it should be tryed to only use one method - mostly single quotes.

      +

      In SQL statements mixing single and double quotes is partly allowed (following the guidelines listed here about SQL formatting), else one should try to only use one method - mostly single quotes.

      Associative array keys:

      In PHP, it's legal to use a literal string as a key to an associative array without quoting that string. We don't want to do this -- the string should always be quoted to avoid confusion. Note that this is only when we're using a literal, not when we're using a variable, examples:

      @@ -496,7 +496,7 @@ $foo = $assoc_array[$var];

      Each complex function should be preceded by a comment that tells a programmer everything they need to know to use that function. The meaning of every parameter, the expected input, and the output are required as a minimal comment. The function's behaviour in error conditions (and what those error conditions are) should also be present - but mostly included within the comment about the output.

      Especially important to document are any assumptions the code makes, or preconditions for its proper operation. Any one of the developers should be able to look at any part of the application and figure out what's going on in a reasonable amount of time.

      Avoid using /* */ comment blocks for one-line comments, // should be used for one/two-liners.

      Magic numbers:

      -

      Don't use them. Use named constants for any literal value other than obvious special cases. Basically, it's ok to check if an array has 0 elements by using the literal 0. It's not ok to assign some special meaning to a number and then use it everywhere as a literal. This hurts readability AND maintainability. The constants true and false should be used in place of the literals 1 and 0 -- even though they have the same values (but not type!), it's more obvious what the actual logic is when you use the named constants. Typecast variables where it is needed, do not rely on the correct variable type (PHP is currently very loose on typecasting which can lead to security problems if a developer does not have a very close eye to it).

      +

      Don't use them. Use named constants for any literal value other than obvious special cases. Basically, it's ok to check if an array has 0 elements by using the literal 0. It's not ok to assign some special meaning to a number and then use it everywhere as a literal. This hurts readability AND maintainability. The constants true and false should be used in place of the literals 1 and 0 -- even though they have the same values (but not type!), it's more obvious what the actual logic is when you use the named constants. Typecast variables where it is needed, do not rely on the correct variable type (PHP is currently very loose on typecasting which can lead to security problems if a developer does not keep a very close eye on it).

      Shortcut operators:

      The only shortcut operators that cause readability problems are the shortcut increment $i++ and decrement $j-- operators. These operators should not be used as part of an expression. They can, however, be used on their own line. Using them in expressions is just not worth the headaches when debugging, examples:

      @@ -665,7 +665,7 @@ $sql = 'SELECT *

      SQL Quotes:

      -

      Double quotes where applicable (The variables in these examples are typecasted to integers before) ... examples:

      +

      Use double quotes where applicable. (The variables in these examples are typecasted to integers beforehand.) Examples:

      // These are wrong.

      @@ -826,7 +826,7 @@ SELECT FROM phpbb_forums WHERE forum_id <> 1
       
       	

      sql_build_query():

      -

      The $db->sql_build_query() function is responsible for building sql statements for select and select distinct queries if you need to JOIN on more than one table or retrieving data from more than one table while doing a JOIN. This needs to be used to make sure the resulting statement is working on all supported db's. Instead of explaining every possible combination, i will give a short example:

      +

      The $db->sql_build_query() function is responsible for building sql statements for SELECT and SELECT DISTINCT queries if you need to JOIN on more than one table or retrieve data from more than one table while doing a JOIN. This needs to be used to make sure the resulting statement is working on all supported db's. Instead of explaining every possible combination, I will give a short example:

       $sql_array = array(
      @@ -911,7 +911,7 @@ for ($i = 0, $size = sizeof($post_data); $i < $size; $i++)
       	

      Use of in_array():

      -

      Try to avoid using in_array() on huge arrays, and try to not place them into loops if the array to check consist of more than 20 entries. in_array() can be very time consuming and uses a lot of cpu processing time. For little checks it is not noticable, but if checked against a huge array within a loop those checks alone can be a bunch of seconds. If you need this functionality, try using isset() on the arrays keys instead, actually shifting the values into keys and vice versa. A call to isset($array[$var]) is a lot faster than in_array($var, array_keys($array)) for example.

      +

      Try to avoid using in_array() on huge arrays, and try to not place them into loops if the array to check consist of more than 20 entries. in_array() can be very time consuming and uses a lot of cpu processing time. For little checks it is not noticeable, but if checked against a huge array within a loop those checks alone can take several seconds. If you need this functionality, try using isset() on the arrays keys instead, actually shifting the values into keys and vice versa. A call to isset($array[$var]) is a lot faster than in_array($var, array_keys($array)) for example.

      2.v. General Guidelines

      @@ -924,7 +924,7 @@ for ($i = 0, $size = sizeof($post_data); $i < $size; $i++)

      No attempt should be made to remove any copyright information (either contained within the source or displayed interactively when the source is run/compiled), neither should the copyright information be altered in any way (it may be added to).

      Variables:

      -

      Make use of the request_var() function for anything except for submit or single checking params.

      +

      Make use of the request_var() function for anything except for submit or single checking params.

      The request_var function determines the type to set from the second parameter (which determines the default value too). If you need to get a scalar variable type, you need to tell this the request_var function explicitly. Examples:

      // Old method, do not use it

      @@ -991,7 +991,7 @@ $user->setup();

      The $user->setup() call can be used to pass on additional language definition and a custom style (used in viewforum).

      Errors and messages:

      -

      All messages/errors should be outputed by calling trigger_error() using the appropriate message type and language string. Example:

      +

      All messages/errors should be outputted by calling trigger_error() using the appropriate message type and language string. Example:

       trigger_error('NO_FORUM');
      @@ -1009,7 +1009,7 @@ trigger_error('NO_MODE', E_USER_ERROR);
       
       	

      All urls pointing to internal files need to be prepended by the $phpbb_root_path variable. Within the administration control panel all urls pointing to internal files need to be prepended by the $phpbb_admin_path variable. This makes sure the path is always correct and users being able to just rename the admin folder and the acp still working as intended (though some links will fail and the code need to be slightly adjusted).

      -

      The append_sid() function from 2.0.x is available too, though does not handle url alterations automatically. Please have a look at the code documentation if you want to get more details on how to use append_sid(). A sample call to append_sid() can look like this:

      +

      The append_sid() function from 2.0.x is available too, though it does not handle url alterations automatically. Please have a look at the code documentation if you want to get more details on how to use append_sid(). A sample call to append_sid() can look like this:

       append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id'])
      @@ -1017,7 +1017,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
       
       	

      General function usage:

      -

      Some of these functions are only chosen over others because of personal preference and having no other benefit than to be consistent over the code.

      +

      Some of these functions are only chosen over others because of personal preference and have no benefit other than maintaining consistency throughout the code.

      • @@ -1067,7 +1067,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp; required_imageset = prosilver

      3.2. General Styling Rules

      -

      Templates should be produced in a consistent manner. Where appropriate they should be based off an existing copy, e.g. index, viewforum or viewtopic (the combination of which implement a range of conditional and variable forms). Please also note that the intendation and coding guidelines also apply to templates where possible.

      +

      Templates should be produced in a consistent manner. Where appropriate they should be based off an existing copy, e.g. index, viewforum or viewtopic (the combination of which implement a range of conditional and variable forms). Please also note that the indentation and coding guidelines also apply to templates where possible.

      The outer table class forumline has gone and is replaced with tablebg.

      When writing <table> the order <table class="" cellspacing="" cellpadding="" border="" align=""> creates consistency and allows everyone to easily see which table produces which "look". The same applies to most other tags for which additional parameters can be set, consistency is the major aim here.

      @@ -1087,7 +1087,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;

      Row colours/classes are now defined by the template, use an IF S_ROW_COUNT switch, see viewtopic or viewforum for an example.

      -

      Remember block level ordering is important ... while not all pages validate as XHTML 1.0 Strict compliant it is something we're trying to work too.

      +

      Remember block level ordering is important ... while not all pages validate as XHTML 1.0 Strict compliant it is something we're trying to work on.

      Use a standard cellpadding of 2 and cellspacing of 0 on outer tables. Inner tables can vary from 0 to 3 or even 4 depending on the need.

      @@ -1136,12 +1136,12 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;

      4.i. General Templating

      File naming

      -

      Firstly templates now take the suffix ".html" rather than ".tpl". This was done simply to make the lifes of some people easier wrt syntax highlighting, etc.

      +

      Firstly templates now take the suffix ".html" rather than ".tpl". This was done simply to make the lives of some people easier wrt syntax highlighting, etc.

      Variables

      All template variables should be named appropriately (using underscores for spaces), language entries should be prefixed with L_, system data with S_, urls with U_, javascript urls with UA_, language to be put in javascript statements with LA_, all other variables should be presented 'as is'.

      -

      L_* template variables are automatically tried to be mapped to the corresponding language entry if the code does not set (and therefore overwrite) this variable specifically. For example {L_USERNAME} maps to $user->lang['USERNAME']. The LA_* template variables are handled within the same way, but properly escaped to be put in javascript code. This should reduce the need to assign loads of new lang vars in Modifications. +

      L_* template variables are automatically mapped to the corresponding language entry if the code does not set (and therefore overwrite) this variable specifically and if the language entry exists. For example {L_USERNAME} maps to $user->lang['USERNAME']. The LA_* template variables are handled within the same way, but properly escaped so they can be put in javascript code. This should reduce the need to assign loads of new language variables in MODifications.

      Blocks/Loops

      @@ -1424,9 +1424,9 @@ div <!-- END l_block1 -->
      -

      Here we open the loop l_block1 and doing some things if the value S_SELECTED within the current loop iteration is true, else we write the blocks link and title. Here, you see {l_block1.L_TITLE} referenced - you remember that L_* variables get automatically assigned the corresponding language entry? This is true, but not within loops. The L_TITLE variable within the loop l_block1 is assigned within the code itself.

      +

      Here we open the loop l_block1 and do some things if the value S_SELECTED within the current loop iteration is true, else we write the blocks link and title. Here, you see {l_block1.L_TITLE} referenced - you remember that L_* variables get automatically assigned the corresponding language entry? This is true, but not within loops. The L_TITLE variable within the loop l_block1 is assigned within the code itself.

      -

      Let's have a closer look to the markup:

      +

      Let's have a closer look at the markup:

       <!-- BEGIN l_block1 -->
      @@ -1520,7 +1520,7 @@ div
       </ul> <!-- written on third iteration -->
       
      -

      Just always remember that processing is taking place from up to down.

      +

      Just always remember that processing is taking place from top to bottom.

      Forms

      If a form is used for a non-trivial operation (i.e. more than a jumpbox), then it should include the {S_FORM_TOKEN} template variable.

      @@ -1536,11 +1536,9 @@ div

      4.ii. Template Inheritance

      -

      When basing a new template on an existing one, it is not necessary to provide all template files. By declaring the template to be "inheriting" in the template configuration file.

      +

      When basing a new style on an existing one, it is not necessary to provide all the template files. By declaring the base style name in the inherit_from field in the template configuration file, the style can be set to inherit template files from the base style. The limitation on this is that the base style has to be installed and complete, meaning that it is not itself inheriting.

      -

      The limitation on this is that the base style has to be installed and complete, meaning that it is not itself inheriting.

      - -

      The effect of doing so is that the template engine will use the files in the new template where they exist, but fall back to files in the base template otherwise. Declaring a style to be inheriting also causes it to use some of the configuration settings of the base style, notably database storage.

      +

      The effect of doing so is that the template engine will use the template files in the new style where they exist, but fall back to files in the base style otherwise. Declaring a style to inherit from another also causes it to use some of the configuration settings of the base style, notably database storage.

      We strongly encourage the use of inheritance for styles based on the bundled styles, as it will ease the update procedure.

      @@ -1667,7 +1665,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

      Encoding:

      -

      With phpBB3, the output encoding for the forum in now UTF-8, a Universal Character Encoding by the Unicode Consortium that is by design a superset to US-ASCII and ISO-8859-1. By using one character set which simultaenously supports all scripts which previously would have required different encodings (eg: ISO-8859-1 to ISO-8859-15 (Latin, Greek, Cyrillic, Thai, Hebrew, Arabic); GB2312 (Simplified Chinese); Big5 (Traditional Chinese), EUC-JP (Japanese), EUC-KR (Korean), VISCII (Vietnamese); et cetera), this removes the need to convert between encodings and improves the accessibility of multilingual forums.

      +

      With phpBB3, the output encoding for the forum in now UTF-8, a Universal Character Encoding by the Unicode Consortium that is by design a superset to US-ASCII and ISO-8859-1. By using one character set which simultaenously supports all scripts which previously would have required different encodings (eg: ISO-8859-1 to ISO-8859-15 (Latin, Greek, Cyrillic, Thai, Hebrew, Arabic); GB2312 (Simplified Chinese); Big5 (Traditional Chinese), EUC-JP (Japanese), EUC-KR (Korean), VISCII (Vietnamese); et cetera), we remove the need to convert between encodings and improves the accessibility of multilingual forums.

      The impact is that the language files for phpBB must now also be encoded as UTF-8, with a caveat that the files must not contain a BOM for compatibility reasons with non-Unicode aware versions of PHP. For those with forums using the Latin character set (ie: most European languages), this change is transparent since UTF-8 is superset to US-ASCII and ISO-8859-1.

      -- cgit v1.2.1 From b05c325dd2d27b839a6bdce20d4e59a6fbc0c960 Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 12 Dec 2011 20:23:20 +0000 Subject: [ticket/10524] Changed Olympus to Ascraeus in Coding Docs in 3 places PHPBB3-10524 --- phpBB/docs/coding-guidelines.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index f835068be9..cf40173154 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -3,7 +3,7 @@ - + phpBB3 • Coding Guidelines @@ -21,7 +21,7 @@

      Coding Guidelines

      -

      Olympus coding guidelines document

      +

      Ascraeus coding guidelines document

      Skip

      @@ -35,7 +35,7 @@ -

      These are the phpBB Coding Guidelines for Olympus, all attempts should be made to follow them as closely as possible.

      +

      These are the phpBB Coding Guidelines for Ascraeus, all attempts should be made to follow them as closely as possible.

      Coding Guidelines

      -- cgit v1.2.1 From 0fc37fb3972845f76848c1e64d5edfe4b8cd0972 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 1 Jan 2012 10:35:50 +0000 Subject: [ticket/9916] Changing coding guidelines license PHPBB3-9916 --- phpBB/docs/coding-guidelines.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 7d51b26dca..cd113a7226 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -129,9 +129,8 @@ /** * * @package {PACKAGENAME} -* @version $Id: $ * @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -2322,7 +2321,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
      -

      This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

      +

      This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

      -- cgit v1.2.1 From 68336ab137432ecf9322474a7853d5d16e660fb2 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Wed, 14 Mar 2012 23:25:07 +0200 Subject: [feature/merging-style-components] Updating coding guidelines Updating template inheritance section in coding guidelines PHPBB3-10632 --- phpBB/docs/coding-guidelines.html | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 55fbf6d4e8..e85be02d45 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -71,7 +71,7 @@
    • Templating
      1. General Templating
      2. -
      3. Template Inheritance
      4. +
      5. Styles Tree
    • Character Sets and Encodings
    • Translation (i18n/L10n) Guidelines @@ -1623,24 +1623,25 @@ div </form>
      -

      4.ii. Template Inheritance

      -

      When basing a new style on an existing one, it is not necessary to provide all the template files. By declaring the base style name in the inherit_from field in the template configuration file, the style can be set to inherit template files from the base style. The limitation on this is that the base style has to be installed and complete, meaning that it is not itself inheriting.

      +

      4.ii. Styles Tree

      +

      When basing a new style on an existing one, it is not necessary to provide all the template files. By declaring the base style name in the parent field in the style configuration file, the style can be set to reuse template files from the parent style.

      -

      The effect of doing so is that the template engine will use the template files in the new style where they exist, but fall back to files in the base style otherwise. Declaring a style to inherit from another also causes it to use some of the configuration settings of the base style, notably database storage.

      +

      The effect of doing so is that the template engine will use the template files in the new style where they exist, but fall back to files in the parent style otherwise.

      -

      We strongly encourage the use of inheritance for styles based on the bundled styles, as it will ease the update procedure.

      +

      We strongly encourage the use of parent styles for styles based on the bundled styles, as it will ease the update procedure.

      -        # General Information about this template
      -        name = inherits
      -        copyright = © phpBB Group, 2007
      -        version = 3.0.3
      +# General Information about this style
      +name = Custom Style
      +copyright = &copy; phpBB Group, 2007
      +version = 3.1.0
       
      -        # Defining a different template bitfield
      -        template_bitfield = lNg=
      +# Defining a different template bitfield
      +# template_bitfield = lNg=
       
      -        # Are we inheriting?
      -        inherit_from = prosilver
      +# Parent style
      +# Set value to empty or to this style's name if this style does not have a parent style
      +parent = prosilver
       		
      -- cgit v1.2.1 From 063f6893af754cc992e487d323f766889bebba01 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 8 Mar 2012 18:04:24 -0500 Subject: [task/php5.3] Looks like I missed a few places that needed PHP 5.2 changed to PHP 5.3.2 PHPBB3-10693 --- phpBB/docs/coding-guidelines.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 55fbf6d4e8..5581c10786 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2347,7 +2347,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'FOO_BAR'	=>	'PHP version < 5.2.0.<br />
      +'FOO_BAR'	=>	'PHP version < 5.3.2.<br />
       	Visit "Downloads" at <a href="http://www.php.net/">www.php.net</a>.',
       	...
       	
      @@ -2356,7 +2356,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'FOO_BAR'	=>	'PHP version &lt; 5.2.0.<br />
      +'FOO_BAR'	=>	'PHP version &lt; 5.3.2.<br />
       	Visit &quot;Downloads&quot; at <a href="http://www.php.net/">www.php.net</a>.',
       	...
       	
      @@ -2365,7 +2365,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'FOO_BAR'	=>	'PHP version &lt; 5.2.0.<br />
      +'FOO_BAR'	=>	'PHP version &lt; 5.3.2.<br />
       	Visit “Downloads” at <a href="http://www.php.net/">www.php.net</a>.',
       	...
       	
      -- cgit v1.2.1 From e13e4d92061df3a49cc5dbf7724f232ab927018a Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 31 Mar 2012 16:33:30 +0300 Subject: [feature/merging-style-components] Updating styles in coding guidelines Updating styles section in coding guidelines PHPBB3-10632 --- phpBB/docs/coding-guidelines.html | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index f8aaf77441..e6dfe579e9 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1144,15 +1144,19 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;

      3.i. Style Config Files

      -

      Style cfg files are simple name-value lists with the information necessary for installing a style. Similar cfg files exist for templates, themes and imagesets. These follow the same principle and will not be introduced individually. Styles can use installed components by using the required_theme/required_template/required_imageset entries. The important part of the style configuration file is assigning an unique name.

      +

      Style cfg files are simple name-value lists with the information necessary for installing a style. The important part of the style configuration file is assigning an unique name.

      -        # General Information about this style
      -        name = prosilver_duplicate
      -        copyright = © phpBB Group, 2007
      -        version = 3.0.3
      -        required_template = prosilver
      -        required_theme = prosilver
      -        required_imageset = prosilver
      +# General Information about this style
      +name = prosilver_duplicate
      +copyright = © phpBB Group, 2007
      +version = 3.1.0
      +
      +# Defining a different template bitfield
      +# template_bitfield = lNg=
      +
      +# Parent style
      +# Set value to empty or to this style's name if this style does not have a parent style
      +parent = prosilver
       	

      3.2. General Styling Rules

      Templates should be produced in a consistent manner. Where appropriate they should be based off an existing copy, e.g. index, viewforum or viewtopic (the combination of which implement a range of conditional and variable forms). Please also note that the indentation and coding guidelines also apply to templates where possible.

      @@ -1175,7 +1179,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;

      Row colours/classes are now defined by the template, use an IF S_ROW_COUNT switch, see viewtopic or viewforum for an example.

      -

      Remember block level ordering is important ... while not all pages validate as XHTML 1.0 Strict compliant it is something we're trying to work on.

      +

      Remember block level ordering is important.

      Use a standard cellpadding of 2 and cellspacing of 0 on outer tables. Inner tables can vary from 0 to 3 or even 4 depending on the need.

      @@ -1243,13 +1247,13 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;

      A bit later loops will be explained further. To not irritate you we will explain conditionals as well as other statements first.

      Including files

      -

      Something that existed in 2.0.x which no longer exists in 3.0.x is the ability to assign a template to a variable. This was used (for example) to output the jumpbox. Instead (perhaps better, perhaps not but certainly more flexible) we now have INCLUDE. This takes the simple form:

      +

      Something that existed in 2.0.x which no longer exists in 3.x is the ability to assign a template to a variable. This was used (for example) to output the jumpbox. Instead (perhaps better, perhaps not but certainly more flexible) we now have INCLUDE. This takes the simple form:

       <!-- INCLUDE filename -->
       
      -

      You will note in the 3.0 templates the major sources start with <!-- INCLUDE overall_header.html --> or <!-- INCLUDE simple_header.html -->, etc. In 2.0.x control of "which" header to use was defined entirely within the code. In 3.0.x the template designer can output what they like. Note that you can introduce new templates (i.e. other than those in the default set) using this system and include them as you wish ... perhaps useful for a common "menu" bar or some such. No need to modify loads of files as with 2.0.x.

      +

      You will note in the 3.x templates the major sources start with <!-- INCLUDE overall_header.html --> or <!-- INCLUDE simple_header.html -->, etc. In 2.0.x control of "which" header to use was defined entirely within the code. In 3.x the template designer can output what they like. Note that you can introduce new templates (i.e. other than those in the default set) using this system and include them as you wish ... perhaps useful for a common "menu" bar or some such. No need to modify loads of files as with 2.0.x.

      Added in 3.0.6 is the ability to include a file using a template variable to specify the file, this functionality only works for root variables (i.e. not block variables).

      @@ -1281,7 +1285,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
       

      it will be included and executed inline.

      A note, it is very much encouraged that template designers do not include PHP. The ability to include raw PHP was introduced primarily to allow end users to include banner code, etc. without modifying multiple files (as with 2.0.x). It was not intended for general use ... hence www.phpbb.com will not make available template sets which include PHP. And by default templates will have PHP disabled (the admin will need to specifically activate PHP for a template).

      Conditionals/Control structures

      -

      The most significant addition to 3.0.x are conditions or control structures, "if something then do this else do that". The system deployed is very similar to Smarty. This may confuse some people at first but it offers great potential and great flexibility with a little imagination. In their most simple form these constructs take the form:

      +

      The most significant addition to 3.x are conditions or control structures, "if something then do this else do that". The system deployed is very similar to Smarty. This may confuse some people at first but it offers great potential and great flexibility with a little imagination. In their most simple form these constructs take the form:

       <!-- IF expr -->
      @@ -1352,7 +1356,7 @@ div
       <!-- ENDIF -->
       
      -

      Each statement will be tested in turn and the relevant output generated when a match (if a match) is found. It is not necessary to always use ELSEIF, ELSE can be used alone to match "everything else".

      So what can you do with all this? Well take for example the colouration of rows in viewforum. In 2.0.x row colours were predefined within the source as either row color1, row color2 or row class1, row class2. In 3.0.x this is moved to the template, it may look a little daunting at first but remember control flows from top to bottom and it's not too difficult:

      +

      Each statement will be tested in turn and the relevant output generated when a match (if a match) is found. It is not necessary to always use ELSEIF, ELSE can be used alone to match "everything else".

      So what can you do with all this? Well take for example the colouration of rows in viewforum. In 2.0.x row colours were predefined within the source as either row color1, row color2 or row class1, row class2. In 3.x this is moved to the template, it may look a little daunting at first but remember control flows from top to bottom and it's not too difficult:

       <table>
      -- 
      cgit v1.2.1
      
      
      From 6deb7b3671c29ab7ce1db6e11b5c6be0950d265f Mon Sep 17 00:00:00 2001
      From: Igor Wiedler 
      Date: Sat, 31 Mar 2012 02:50:19 +0200
      Subject: [feature/class-prefix] Rename user and session to phpbb_*
      
      PHPBB-10609
      ---
       phpBB/docs/coding-guidelines.html | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      (limited to 'phpBB/docs/coding-guidelines.html')
      
      diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
      index e6dfe579e9..6d428916c7 100644
      --- a/phpBB/docs/coding-guidelines.html
      +++ b/phpBB/docs/coding-guidelines.html
      @@ -248,7 +248,7 @@ PHPBB_QA                   (Set board to QA-Mode, which means the updater also c
       

      If the PHPBB_USE_BOARD_URL_PATH constant is set to true, phpBB uses generate_board_url() (this will return the boards url with the script path included) on all instances where web-accessible images are loaded. The exact locations are:

        -
      • /includes/session.php - user::img()
      • +
      • /includes/user.php - phpbb_user::img()
      • /includes/functions_content.php - smiley_text()
      -- cgit v1.2.1 From 02cc32b901d29df4b67c0d09c02370cbaf61170d Mon Sep 17 00:00:00 2001 From: Senky Date: Mon, 16 Apr 2012 15:19:10 +0200 Subject: [ticket/10161] coding-guidelines.html updated PHPBB3-10161 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 6d428916c7..e60d20cd43 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -356,7 +356,7 @@ phpbb_dir_subdir_class_name - includes/dir/subdir/class_name.php

      The basic philosophy here is to not hurt code clarity for the sake of laziness. This has to be balanced by a little bit of common sense, though; print_login_status_for_a_given_user() goes too far, for example -- that function would be better named print_user_login_status(), or just print_login_status().

      Special Namings:

      -

      For all emoticons use the term smiley in singular and smilies in plural.

      +

      For all emoticons use the term smiley in singular and smilies in plural. For emails we use the term email (without dash between “e” and “m”)

      2.ii. Code Layout

      -- cgit v1.2.1 From 0858a8023be7b01e308959383bc1f955dbd4bf2d Mon Sep 17 00:00:00 2001 From: Senky Date: Mon, 16 Apr 2012 23:53:11 +0200 Subject: [ticket/10161] added fullstop to the end of sentence PHPBB3-10161 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index e60d20cd43..3f2c142ac6 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -356,7 +356,7 @@ phpbb_dir_subdir_class_name - includes/dir/subdir/class_name.php

      The basic philosophy here is to not hurt code clarity for the sake of laziness. This has to be balanced by a little bit of common sense, though; print_login_status_for_a_given_user() goes too far, for example -- that function would be better named print_user_login_status(), or just print_login_status().

      Special Namings:

      -

      For all emoticons use the term smiley in singular and smilies in plural. For emails we use the term email (without dash between “e” and “m”)

      +

      For all emoticons use the term smiley in singular and smilies in plural. For emails we use the term email (without dash between “e” and “m”).

      2.ii. Code Layout

      -- cgit v1.2.1 From 3978e2620ea3ad50f80bc273542ff9dc830743fd Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sun, 29 Apr 2012 19:07:48 +0100 Subject: [ticket/10855] Modified coding guidelines to reflect JS brace changes. Braces always go on the same line in JavaScript. PHPBB3-10855 --- phpBB/docs/coding-guidelines.html | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 3f2c142ac6..fbec59a6ff 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -397,7 +397,7 @@ for ($i = 0; $i < size; $i++)

      Where to put the braces:

      -

      This one is a bit of a holy war, but we're going to use a style that can be summed up in one sentence: Braces always go on their own line. The closing brace should also always be at the same column as the corresponding opening brace, examples:

      +

      In PHP code, braces always go on their own line. The closing brace should also always be at the same column as the corresponding opening brace, examples:

       if (condition)
      @@ -427,6 +427,30 @@ function do_stuff()
       	...
       }
       	
      + +

      In JavaScript code, braces always go on the same line:

      + +
      +if (condition) {
      +	while (condition2) {
      +		...
      +	}
      +} else {
      +	...
      +}
      +
      +for (var i = 0; i < size; i++) {
      +	...
      +}
      +
      +while (condition) {
      +	...
      +}
      +
      +function do_stuff() {
      +	...
      +}
      +	

      Use spaces between tokens:

      This is another simple, easy step that helps keep code readable without much effort. Whenever you write an assignment, expression, etc.. Always leave one space between the tokens. Basically, write code as if it was English. Put spaces between variable names and operators. Don't put spaces just after an opening bracket or before a closing bracket. Don't put spaces just before a comma or a semicolon. This is best shown with a few examples, examples:

      -- cgit v1.2.1 From ee2e2cb2c36d7abf7571d2593061eedfdf5edb8f Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Thu, 3 May 2012 22:30:22 +0100 Subject: [ticket/10855] Added array trailing commas info in js to guidelines. PHPBB3-10855 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index fbec59a6ff..be78ad0b3b 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -526,7 +526,7 @@ $post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start";

      In SQL statements mixing single and double quotes is partly allowed (following the guidelines listed here about SQL formatting), else one should try to only use one method - mostly single quotes.

      Commas after every array element:

      -

      If an array is defined with each element on its own line, you still have to modify the previous line to add a comma when appending a new element. PHP allows for trailing (useless) commas in array definitions. These should always be used so each element including the comma can be appended with a single line

      +

      If an array is defined with each element on its own line, you still have to modify the previous line to add a comma when appending a new element. PHP allows for trailing (useless) commas in array definitions. These should always be used so each element including the comma can be appended with a single line. In JavaScript, you should not use the trailing comma, as IE doesn't like it.

      // wrong

      -- 
      cgit v1.2.1
      
      
      From 06efa6c0beac3cb4fed0e7412c3b60f91f4181bb Mon Sep 17 00:00:00 2001
      From: Callum Macrae 
      Date: Thu, 3 May 2012 22:34:35 +0100
      Subject: [ticket/10855] Added JS camelCaps info to guidelines.
      
      PHPBB3-10855
      ---
       phpBB/docs/coding-guidelines.html | 10 ++++++++--
       1 file changed, 8 insertions(+), 2 deletions(-)
      
      (limited to 'phpBB/docs/coding-guidelines.html')
      
      diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
      index be78ad0b3b..237bc18d20 100644
      --- a/phpBB/docs/coding-guidelines.html
      +++ b/phpBB/docs/coding-guidelines.html
      @@ -295,11 +295,17 @@ PHPBB_QA                   (Set board to QA-Mode, which means the updater also c
       	

      We will not be using any form of hungarian notation in our naming conventions. Many of us believe that hungarian naming is one of the primary code obfuscation techniques currently in use.

      Variable Names:

      -

      Variable names should be in all lowercase, with words separated by an underscore, example:

      +

      In PHP, variable names should be in all lowercase, with words separated by an underscore, example:

      $current_user is right, but $currentuser and $currentUser are not.

      + +

      In JavaScript, variable names should use camel caps:

      + +
      +

      currentUser is right, but currentuser and current_user are not.

      +

      Names should be descriptive, but concise. We don't want huge sentences as our variable names, but typing an extra couple of characters is always better than wondering what exactly a certain variable is for.

      @@ -317,7 +323,7 @@ for ($i = 0; $i < $outer_size; $i++)

      Function Names:

      -

      Functions should also be named descriptively. We're not programming in C here, we don't want to write functions called things like "stristr()". Again, all lower-case names with words separated by a single underscore character. Function names should preferably have a verb in them somewhere. Good function names are print_login_status(), get_user_data(), etc.

      +

      Functions should also be named descriptively. We're not programming in C here, we don't want to write functions called things like "stristr()". Again, all lower-case names with words separated by a single underscore character in PHP, and camel caps in JavaScript. Function names should preferably have a verb in them somewhere. Good function names are print_login_status(), get_user_data(), etc. Constructor functions in JavaScript should begin with a capital letter.

      Function Arguments:

      Arguments are subject to the same guidelines as variable names. We don't want a bunch of functions like: do_stuff($a, $b, $c). In most cases, we'd like to be able to tell how to use a function by just looking at its declaration.

      -- cgit v1.2.1 From 22cc7c73fdb26420bdf5b7a509da9a22925e274a Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Tue, 22 May 2012 19:38:30 +0100 Subject: [ticket/10855] Fixed a couple issues in coding guidelines. PHPBB3-10855 --- phpBB/docs/coding-guidelines.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/docs/coding-guidelines.html') diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 237bc18d20..ae4655e094 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -301,7 +301,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c

      $current_user is right, but $currentuser and $currentUser are not.

      -

      In JavaScript, variable names should use camel caps:

      +

      In JavaScript, variable names should use camel case:

      currentUser is right, but currentuser and current_user are not.

      @@ -532,7 +532,7 @@ $post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start";

      In SQL statements mixing single and double quotes is partly allowed (following the guidelines listed here about SQL formatting), else one should try to only use one method - mostly single quotes.

      Commas after every array element:

      -

      If an array is defined with each element on its own line, you still have to modify the previous line to add a comma when appending a new element. PHP allows for trailing (useless) commas in array definitions. These should always be used so each element including the comma can be appended with a single line. In JavaScript, you should not use the trailing comma, as IE doesn't like it.

      +

      If an array is defined with each element on its own line, you still have to modify the previous line to add a comma when appending a new element. PHP allows for trailing (useless) commas in array definitions. These should always be used so each element including the comma can be appended with a single line. In JavaScript, do not use the trailing comma, as it causes browsers to throw errors.

      // wrong

      -- 
      cgit v1.2.1
      
      
Unicode bidirectional control characters iso.txt