From 37eea9fa41a556e2a5e0242c6d2e91e46f32c38a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 Mar 2014 09:10:01 +0100 Subject: [PATCH 01/14] [ticket/12286] Use UTF8 (c) in style.cfg samples PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 6cd2627f43..16f0515e85 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1181,7 +1181,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&
 # General Information about this style
 name = prosilver_duplicate
-copyright = © phpBB Group, 2007
+copyright = © phpBB Group, 2007
 version = 3.1.0
 
 # Defining a different template bitfield
@@ -1670,7 +1670,7 @@ div
 		
 # General Information about this style
 name = Custom Style
-copyright = © phpBB Group, 2007
+copyright = © phpBB Group, 2007
 version = 3.1.0
 
 # Defining a different template bitfield

From ac5a808ff3f686748c2adf19498b35a4781cc38b Mon Sep 17 00:00:00 2001
From: Joas Schilling 
Date: Tue, 18 Mar 2014 09:17:45 +0100
Subject: [PATCH 02/14] [ticket/12286] Styles have a phpbb_version and a
 style_version in 3.1

PHPBB3-12286
---
 phpBB/docs/coding-guidelines.html | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index 16f0515e85..f2891e9b95 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -1182,7 +1182,8 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&
 # General Information about this style
 name = prosilver_duplicate
 copyright = © phpBB Group, 2007
-version = 3.1.0
+style_version = 3.1.0
+phpbb_version = 3.1.0
 
 # Defining a different template bitfield
 # template_bitfield = lNg=
@@ -1671,7 +1672,8 @@ div
 # General Information about this style
 name = Custom Style
 copyright = © phpBB Group, 2007
-version = 3.1.0
+style_version = 3.1.0-b1
+phpbb_version = 3.1.0-b1
 
 # Defining a different template bitfield
 # template_bitfield = lNg=

From 45857fe5c965ea79c734f8f831210ae74558c1f1 Mon Sep 17 00:00:00 2001
From: Joas Schilling 
Date: Tue, 18 Mar 2014 09:18:41 +0100
Subject: [PATCH 03/14] [ticket/12286] style.php and imagesets dont exist
 anymore

PHPBB3-12286
---
 phpBB/docs/coding-guidelines.html | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index f2891e9b95..9d3e69decc 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -216,7 +216,7 @@ class ...
 		
  • ucp
    ucp.php, /includes/ucp
    User Control Panel
  • utf
    /includes/utf
    UTF8-related functions/classes
  • search
    /includes/search, search.php
    Search System
  • -
  • styles
    /styles, style.php
    phpBB Styles/Templates/Themes/Imagesets
  • +
  • styles
    /styles
    phpBB Styles/Templates/Themes
  • 1.iv. Special Constants

    @@ -260,8 +260,6 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c
  • {T_THEME_PATH} - styles/xxx/theme
  • {T_TEMPLATE_PATH} - styles/xxx/template
  • {T_SUPER_TEMPLATE_PATH} - styles/xxx/template
  • -
  • {T_IMAGESET_PATH} - styles/xxx/imageset
  • -
  • {T_IMAGESET_LANG_PATH} - styles/xxx/imageset/yy
  • {T_IMAGES_PATH} - images/
  • {T_SMILIES_PATH} - $config['smilies_path']/
  • {T_AVATAR_PATH} - $config['avatar_path']/
  • @@ -269,7 +267,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c
  • {T_ICONS_PATH} - $config['icons_path']/
  • {T_RANKS_PATH} - $config['ranks_path']/
  • {T_UPLOAD_PATH} - $config['upload_path']/
  • -
  • {T_STYLESHEET_LINK} - styles/xxx/theme/stylesheet.css (or link to style.php if css is parsed dynamically)
  • +
  • {T_STYLESHEET_LINK} - styles/xxx/theme/stylesheet.css
  • New template variable {BOARD_URL} for the board url + script path.
  • From 30eccacb1dc0203a15638596967255e33ec05801 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 Mar 2014 09:21:30 +0100 Subject: [PATCH 04/14] [ticket/12286] Add "Since" to template event docs PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 9d3e69decc..ded13d1c28 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1707,6 +1707,7 @@ parent = prosilver * Location: styles/<style_name>/template/filename.html * Purpose: A brief description of what this event should be used for. This may span multiple lines. +* Since: Version since when the event was added
  • An event found in multiple template files:
    event_name
    @@ -1715,6 +1716,7 @@ This may span multiple lines.
         + first/file/path.html
         + second/file/path.html
     * Purpose: Same as above.
    +* Since: 3.1.0-b1
     
  • An event that is found multiple times in a file should have the number of instances in parenthesis next to the filename.
    event_name
    @@ -1723,6 +1725,7 @@ This may span multiple lines.
         + first/file/path.html (2)
         + second/file/path.html
     * Purpose: Same as above.
    +* Since: 3.1.0-b1
     
  • An actual example event documentation:
    forumlist_body_last_post_title_prepend
    @@ -1730,7 +1733,9 @@ This may span multiple lines.
     * Locations:
         + styles/prosilver/template/forumlist_body.html
         + styles/subsilver2/template/forumlist_body.html
    -* Purpose: Add content before the post title of the latest post in a forum on the forum list.

    +* Purpose: Add content before the post title of the latest post in a forum on the forum list. +* Since: 3.1.0-a1 +

  • From d275a7cf637cfd4a909985f3a9cfd6aa3591d9c1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 Mar 2014 09:26:59 +0100 Subject: [PATCH 05/14] [ticket/12286] Function names should be prefixed with phpbb_ PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index ded13d1c28..ceac388269 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -322,7 +322,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 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.

    +

    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 be prefixed with "phpbb_" and preferably have a verb in them somewhere. Good function names are phpbb_print_login_status(), phpbb_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.

    @@ -358,7 +358,7 @@ phpbb_dir_subdir_class_name - includes/dir/subdir/class_name.php

    Summary:

    -

    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().

    +

    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; phpbb_print_login_status_for_a_given_user() goes too far, for example -- that function would be better named phpbb_print_user_login_status(), or just phpbb_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”).

    From c68f7671d29fb824ef3c05a6b592fabb7ae1cdb8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 Mar 2014 09:36:02 +0100 Subject: [PATCH 06/14] [ticket/12286] Use $request->variable() instead of request_var() PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index ceac388269..27f639f855 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -106,8 +106,8 @@

    Tabs in front of lines are no problem, but having them within the text can be a problem if you do not set it to the amount of spaces every one of us uses. Here is a short example of how it should look like:

    -{TAB}$mode{TAB}{TAB}= request_var('mode', '');
    -{TAB}$search_id{TAB}= request_var('search_id', '');
    +{TAB}$mode{TAB}{TAB}= $request->variable('mode', '');
    +{TAB}$search_id{TAB}= $request->variable('search_id', '');
     	

    If entered with tabs (replace the {TAB}) both equal signs need to be on the same column.

    @@ -1025,8 +1025,8 @@ 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.

    -

    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:

    +

    Make use of the \phpbb\request\request class for everything.

    +

    The $request->variable() method 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 variable() method explicitly. Examples:

    // Old method, do not use it

    @@ -1036,23 +1036,23 @@ $submit = (isset($HTTP_POST_VARS['submit'])) ? true : false;
     
     	

    // Use request var and define a default variable (use the correct type)

    -$start = request_var('start', 0);
    -$submit = (isset($_POST['submit'])) ? true : false;
    +$start = $request->variable('start', 0);
    +$submit = $request->is_set_post('submit');
     	
    -

    // $start is an int, the following use of request_var therefore is not allowed

    +

    // $start is an int, the following use of $request->variable() therefore is not allowed

    -$start = request_var('start', '0');
    +$start = $request->variable('start', '0');
     	

    // Getting an array, keys are integers, value defaults to 0

    -$mark_array = request_var('mark', array(0));
    +$mark_array = $request->variable('mark', array(0));
     	

    // Getting an array, keys are strings, value defaults to 0

    -$action_ary = request_var('action', array('' => 0));
    +$action_ary = $request->variable('action', array('' => 0));
     	

    Login checks/redirection:

    @@ -1765,16 +1765,16 @@ This may span multiple lines.

    phpBB only uses the ASCII and the UTF-8 character encodings. Still all Strings are UTF-8 encoded because ASCII is a subset of UTF-8. The only exceptions to this rule are code sections which deal with external systems which use other encodings and character sets. Such external data should be converted to UTF-8 using the utf8_recode() function supplied with phpBB. It supports a variety of other character sets and encodings, a full list can be found below.

    -

    With request_var() you can either allow all UCS characters in user input or restrict user input to ASCII characters. This feature is controlled by the function's third parameter called $multibyte. You should allow multibyte characters in posts, PMs, topic titles, forum names, etc. but it's not necessary for internal uses like a $mode variable which should only hold a predefined list of ASCII strings anyway.

    +

    With $request->variable() you can either allow all UCS characters in user input or restrict user input to ASCII characters. This feature is controlled by the method's third parameter called $multibyte. You should allow multibyte characters in posts, PMs, topic titles, forum names, etc. but it's not necessary for internal uses like a $mode variable which should only hold a predefined list of ASCII strings anyway.

     // an input string containing a multibyte character
     $_REQUEST['multibyte_string'] = 'Käse';
     
     // print request variable as a UTF-8 string allowing multibyte characters
    -echo request_var('multibyte_string', '', true);
    +echo $request->variable('multibyte_string', '', true);
     // print request variable as ASCII string
    -echo request_var('multibyte_string', '');
    +echo $request->variable('multibyte_string', '');
     

    This code snippet will generate the following output:

    @@ -1792,9 +1792,9 @@ K??se $_REQUEST['multibyte_string'] = 'Käse'; // normalize multibyte strings -echo utf8_normalize_nfc(request_var('multibyte_string', '', true)); +echo utf8_normalize_nfc($request->variable('multibyte_string', '', true)); // ASCII strings do not need to be normalized -echo request_var('multibyte_string', ''); +echo $request->variable('multibyte_string', '');

    Case Folding

    From 218e04a1e46e7657e607dafae3e1ae651afe2998 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 Mar 2014 09:36:40 +0100 Subject: [PATCH 07/14] [ticket/12286] Remove section about utf8_normalize_nfc() The request class takes care of this PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 27f639f855..45bdb5d422 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1784,19 +1784,6 @@ Käse K??se -

    Unicode Normalization

    - -

    If you retrieve user input with multibyte characters you should additionally normalize the string using utf8_normalize_nfc() before you work with it. This is necessary to make sure that equal characters can only occur in one particular binary representation. For example the character Å can be represented either as U+00C5 (LATIN CAPITAL LETTER A WITH RING ABOVE) or as U+212B (ANGSTROM SIGN). phpBB uses Normalization Form Canonical Composition (NFC) for all text. So the correct version of the above example would look like this:

    - -
    -$_REQUEST['multibyte_string'] = 'Käse';
    -
    -// normalize multibyte strings
    -echo utf8_normalize_nfc($request->variable('multibyte_string', '', true));
    -// ASCII strings do not need to be normalized
    -echo $request->variable('multibyte_string', '');
    -
    -

    Case Folding

    Case insensitive comparison of strings is no longer possible with strtolower or strtoupper as some characters have multiple lower case or multiple upper case forms depending on their position in a word. The utf8_strtolower and the utf8_strtoupper functions suffer from the same problem so they can only be used to display upper/lower case versions of a string but they cannot be used for case insensitive comparisons either. So instead you should use case folding which gives you a case insensitive version of the string which can be used for case insensitive comparisons. An NFC normalized string can be case folded using utf8_case_fold_nfc().

    From 244d783865a881d68c906e32352476ab69e1cf4e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 Mar 2014 09:54:14 +0100 Subject: [PATCH 08/14] [ticket/12286] Classes must use the name space PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 37 ++++++++++++------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 45bdb5d422..d220bfa740 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -190,19 +190,12 @@ class ...
    • phpBB3
      Core files and all files not assigned to a separate package
    • -
    • acm
      /includes/cache
      Cache System
    • +
    • acm
      /phpbb/cache
      Cache System
    • acp
      /adm, /includes/acp, /includes/functions_admin.php
      Administration Control Panel
    • -
    • dbal
      /includes/db
      Database Abstraction Layer.
      Base class is dbal +
    • dbal
      /phpbb/db, /includes/db
      Database Abstraction Layer.
        -
      • /includes/db/dbal.php
        Base DBAL class, defining the overall framework
      • -
      • /includes/db/firebird.php
        Firebird/Interbase Database Abstraction Layer
      • -
      • /includes/db/msssql.php
        MSSQL Database Abstraction Layer
      • -
      • /includes/db/mssql_odbc.php
        MSSQL ODBC Database Abstraction Layer for MSSQL
      • -
      • /includes/db/mysql.php
        MySQL Database Abstraction Layer for MySQL 3.x/4.0.x/4.1.x/5.x
      • -
      • /includes/db/mysqli.php
        MySQLi Database Abstraction Layer
      • -
      • /includes/db/oracle.php
        Oracle Database Abstraction Layer
      • -
      • /includes/db/postgres.php
        PostgreSQL Database Abstraction Layer
      • -
      • /includes/db/sqlite.php
        Sqlite Database Abstraction Layer
      • +
      • /phpbb/db/driver/
        Database Abstraction Layer classes
      • +
      • /phpbb/db/migration/
        Migrations are used for updating the database from one release to another
    • diff
      /includes/diff
      Diff Engine
    • @@ -210,12 +203,12 @@ class ...
    • images
      /images
      All global images not connected to styles
    • install
      /install
      Installation System
    • language
      /language
      All language files
    • -
    • login
      /includes/auth
      Login Authentication Plugins
    • +
    • login
      /phpbb/auth
      Login Authentication Plugins
    • VC
      /includes/captcha
      CAPTCHA
    • mcp
      mcp.php, /includes/mcp, report.php
      Moderator Control Panel
    • ucp
      ucp.php, /includes/ucp
      User Control Panel
    • utf
      /includes/utf
      UTF8-related functions/classes
    • -
    • search
      /includes/search, search.php
      Search System
    • +
    • search
      /phpbb/search, search.php
      Search System
    • styles
      /styles
      phpBB Styles/Templates/Themes
    @@ -249,7 +242,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/user.php - phpbb_user::img()
    • +
    • /phpbb/user.php - \phpbb\user::img()
    • /includes/functions_content.php - smiley_text()
    @@ -332,28 +325,26 @@ for ($i = 0; $i < $outer_size; $i++)

    Apart from following the rules for function names, all classes should meet the following conditions:

    • Every class must be defined in a separate file.
    • -
    • The classes have to be located in a subdirectory of includes/.
    • -
    • Classnames to be prefixed with phpbb_ to avoid name clashes, the filename should not contain the prefix.
    • -
    • Class names have to reflect the location of the file they are defined in. The longest list of prefixes, separated by underscores, which is a valid path must be the directory in which the file is located. So the directory names must not contain any underscores, but the filename may. If the filename would be empty the last directory name is used for the filename as well.
    • +
    • The classes have to be located in a subdirectory of phpbb/.
    • +
    • Classnames must be namespaced with \phpbb\ to avoid name clashes.
    • +
    • Class names/namespaces have to reflect the location of the file they are defined in. The namespace must be the directory in which the file is located. So the directory names must not contain any underscores, but the filename may.
    • Directories should typically be a singular noun (e.g. dir in the example below, not dirs.

    So given the following example directory structure you would result in the below listed lookups

    -includes/
    +phpbb/
       class_name.php
       dir/
         class_name.php
    -    dir.php
           subdir/
             class_name.php
     	
    -phpbb_class_name            - includes/class_name.php
    -phpbb_dir_class_name        - includes/dir/class_name.php
    -phpbb_dir                   - includes/dir/dir.php
    -phpbb_dir_subdir_class_name - includes/dir/subdir/class_name.php
    +\phpbb\class_name            - phpbb/class_name.php
    +\phpbb\dir\class_name        - phpbb/dir/class_name.php
    +\phpbb\dir\subdir\class_name - phpbb/dir/subdir/class_name.php
     	
    From 6750e19214d3770280c729a4f85c96fd972d92c5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 Mar 2014 10:14:11 +0100 Subject: [PATCH 09/14] [ticket/12286] Add section about plurals to the coding guidelines PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index d220bfa740..f9d1dbbc47 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2363,6 +2363,58 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ... +

    Using plurals:

    + +

    + The english language is very simple when it comes to plurals.
    + You have 0 elephants, 1 elephant, or 2+ elephants. So basically you have 2 different forms: one singular and one plural.
    + But for some other languages this is quite more difficult. Let's take the Bosnian language as another example:
    + You have [1/21/31] slon, [2/3/4] slona, [0/5/6] slonova and [7/8/9/11] ... and some more difficult rules. +

    + +

    Therefor we introduced a plural system that deals with this kind of problems.

    + +

    The php Code will basically look like this:

    + +
    +	...
    +	$user->lang('NUMBER_OF_ELEFANTS', $number_of_elefants);
    +	...
    +	
    + +

    And the English translation would be:

    + +
    +	...
    +	'NUMBER_OF_ELEFANTS'	=> array(
    +		0	=> 'You have no elephant', // Optional special case for 0
    +		1	=> 'You have 1 elephant', // Singular
    +		2	=> 'You have %d elephant', // Plural
    +	),
    +	...
    +	
    + +

    While the Bosnian translation can have more cases:

    + +
    +	...
    +	'NUMBER_OF_ELEFANTS'	=> array(
    +		0	=> 'You have no slonova', // Optional special case for 0
    +		1	=> 'You have %d slon', // Used for 1, 21, 31, ..
    +		2	=> 'You have %d slona', // Used for 5, 6,
    +		3	=> ...
    +	),
    +	...
    +	
    + +

    NOTE: It is okay to use plurals for an unknown number compared to a single item, when the number is not known and displayed:

    +
    +	...
    +	'MODERATOR'	=> 'Moderator',  // Your board has 1 moderator
    +	'MODERATORS'	=> 'Moderators', // Your board has multiple moderators
    +	...
    +	
    +

    6.iii. Writing Style

    Miscellaneous tips & hints:

    From d7c2c9d47216297820512f5541cec4ae912ca603 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 21 Mar 2014 17:04:58 +0100 Subject: [PATCH 10/14] [ticket/12286] Add note that goto should not be used PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index f9d1dbbc47..6c0f07a5a9 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1151,6 +1151,14 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;

    The e modifier in preg_replace can be replaced by preg_replace_callback and objects to encapsulate state that is needed in the callback code.

    +

    Other functions, operators, statements and keywords:

    + +

    The following PHP statements should also not be used in phpBB:

    + +
      +
    • goto
    • +
    + From f88e9d1c04f2eaef5eb433f6a0b68abd5dd77d39 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Mar 2014 17:14:09 +0100 Subject: [PATCH 11/14] [ticket/12286] Fix nesting of ul inside li element PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 6c0f07a5a9..cd8163500c 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1688,13 +1688,15 @@ parent = prosilver
    • An event name must be all lowercase, with each word separated by an underscore.
    • An event name must briefly describe the location and purpose of the event.
    • -
    • An event name must end with one of the following suffixes:
    • -
        -
      • _prepend - This event adds an item to the beginning of a block of related items, or adds to the beginning of individual items in a block.
      • -
      • _append - This event adds an item to the end of a block of related items, or adds to the end of individual items in a block.
      • -
      • _before - This event adds content directly before the specified block
      • -
      • _after - This event adds content directly after the specified block
      • -
      +
    • + An event name must end with one of the following suffixes: +
        +
      • _prepend - This event adds an item to the beginning of a block of related items, or adds to the beginning of individual items in a block.
      • +
      • _append - This event adds an item to the end of a block of related items, or adds to the end of individual items in a block.
      • +
      • _before - This event adds content directly before the specified block
      • +
      • _after - This event adds content directly after the specified block
      • +
      +

    Template event documentation

    From 99dccc2df8958e2e346f9b754b2c262935bfa6a3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Mar 2014 17:16:56 +0100 Subject: [PATCH 12/14] [ticket/12286] Correctly capitalize PHP PHPBB3-12286 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index cd8163500c..ad5c5dc107 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2384,7 +2384,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

    Therefor we introduced a plural system that deals with this kind of problems.

    -

    The php Code will basically look like this:

    +

    The PHP code will basically look like this:

     	...
    
    From c985b018a7c8bd356416bb19d0e201c185030ed4 Mon Sep 17 00:00:00 2001
    From: Joas Schilling 
    Date: Fri, 28 Mar 2014 17:19:03 +0100
    Subject: [PATCH 13/14] [ticket/12286] Fix spelling of elephant(s) in the
     sample
    
    PHPBB3-12286
    ---
     phpBB/docs/coding-guidelines.html | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
    index ad5c5dc107..d5fde0fbc9 100644
    --- a/phpBB/docs/coding-guidelines.html
    +++ b/phpBB/docs/coding-guidelines.html
    @@ -2388,7 +2388,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
     
     	
     	...
    -	$user->lang('NUMBER_OF_ELEFANTS', $number_of_elefants);
    +	$user->lang('NUMBER_OF_ELEPHANTS', $number_of_elephants);
     	...
     	
    @@ -2396,10 +2396,10 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
     	...
    -	'NUMBER_OF_ELEFANTS'	=> array(
    -		0	=> 'You have no elephant', // Optional special case for 0
    +	'NUMBER_OF_ELEPHANTS'	=> array(
    +		0	=> 'You have no elephants', // Optional special case for 0
     		1	=> 'You have 1 elephant', // Singular
    -		2	=> 'You have %d elephant', // Plural
    +		2	=> 'You have %d elephants', // Plural
     	),
     	...
     	
    @@ -2408,7 +2408,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
     	...
    -	'NUMBER_OF_ELEFANTS'	=> array(
    +	'NUMBER_OF_ELEPHANTS'	=> array(
     		0	=> 'You have no slonova', // Optional special case for 0
     		1	=> 'You have %d slon', // Used for 1, 21, 31, ..
     		2	=> 'You have %d slona', // Used for 5, 6,
    
    From d2572888f90412d6c86d52e5bd10f4df93b4081f Mon Sep 17 00:00:00 2001
    From: Joas Schilling 
    Date: Fri, 28 Mar 2014 17:24:59 +0100
    Subject: [PATCH 14/14] [ticket/12286] Reword section about plurals
    
    PHPBB3-12286
    ---
     phpBB/docs/coding-guidelines.html | 10 ++++++----
     1 file changed, 6 insertions(+), 4 deletions(-)
    
    diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
    index d5fde0fbc9..cedf03ba9b 100644
    --- a/phpBB/docs/coding-guidelines.html
    +++ b/phpBB/docs/coding-guidelines.html
    @@ -79,6 +79,8 @@
     	
    1. Standardisation
    2. Other considerations
    3. +
    4. Working with placeholders
    5. +
    6. Using plurals
    7. Writing Style
    @@ -2341,7 +2343,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

    Within some cases, there may be mixed scripts of a left-to-right and right-to-left direction, so using LRE & RLE with PDF may be more appropriate. Lastly, in very rare instances where directionality must be forced, then use LRO & RLO with PDF.

    For further information on authoring techniques of bi-directional text, please see the W3C tutorial on authoring techniques for XHTML pages with bi-directional text.

    -

    Working with placeholders:

    +

    6.iii. Working with placeholders

    As phpBB is translated into languages with different ordering rules to that of English, it is possible to show specific values in any order deemed appropriate. Take for example the extremely simple "Page X of Y", whilst in English this could just be coded as:

    @@ -2373,7 +2375,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ...
    -

    Using plurals:

    +

    6.iv. Using plurals

    The english language is very simple when it comes to plurals.
    @@ -2382,7 +2384,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) You have [1/21/31] slon, [2/3/4] slona, [0/5/6] slonova and [7/8/9/11] ... and some more difficult rules.

    -

    Therefor we introduced a plural system that deals with this kind of problems.

    +

    The plural system takes care of this and can be used as follows:

    The PHP code will basically look like this:

    @@ -2425,7 +2427,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ...
    -

    6.iii. Writing Style

    +

    6.v. Writing Style

    Miscellaneous tips & hints: