diff --git a/docs/en/installation/composer.md b/docs/en/installation/composer.md index 7e078e0d3..d98603acd 100644 --- a/docs/en/installation/composer.md +++ b/docs/en/installation/composer.md @@ -203,7 +203,7 @@ This is how you do it: "repositories": [ { "type": "vcs", - "url": "git@github.com:sminnee/advancedworkflow.git" + "url": "git@github.com:sminnee/silverstripe-cms.git" } ], ... @@ -211,10 +211,15 @@ This is how you do it: * **Install the module as you would normally.** Use the regular composer function - there are no special flags to use a fork. Your fork will be used in place of the package version. - composer require silverstripe/advancedworkflow + composer require silverstripe/cms Composer will scan all of the repositories you list, collect meta-data about the packages within them, and use them in favour of the packages listed on packagist. To switch back to using the mainline version of the package, just remove your the `repositories` section from `composer.json` and run `composer update`. +Now add an "upstream" remote to the original repository location so you can rebase or merge your fork as required. + + cd advancedworkflow + git remote add -f upstream git://github.com/silverstripe/silverstripe-cms.git + For more information, read the ["Repositories" chapter of the Composer documentation](http://getcomposer.org/doc/05-repositories.md). ### Forks and branch names diff --git a/docs/en/misc/coding-conventions.md b/docs/en/misc/coding-conventions.md index 666e69473..7f70da430 100644 --- a/docs/en/misc/coding-conventions.md +++ b/docs/en/misc/coding-conventions.md @@ -17,10 +17,11 @@ Always use hard tabs rather then spaces for indentation, with one tab per nestin ### Maximum Line Length -The target line length is 100 characters, meaning developers should strive keep each line of their code -under 80 characters where possible and practical. +The target line length is 100 columns with tabs being treated as four columns, +meaning developers should strive keep each line of their code +under 80 columns where possible and practical. However, longer lines are acceptable in some circumstances. -The maximum length of any line of PHP code is 120 characters. +The maximum length of any line of PHP code is 120 columns. ### Line Termination @@ -40,8 +41,9 @@ Class and filenames are in `UpperCamelCase` format: :::php class MyClass {} -If a class name is comprised of more than one word, the first letter of each new word must be capitalized. -Successive capitalized letters are not allowed, e.g. a class `XMLImporter` is not allowed while `XmlImporter` is acceptable. +If a class name is comprised of more than one word, the first letter of each +new word must be capitalized. Successive capitalized letters are used in +acronyms, e.g. a class `XMLImporter` is used while `XmlImporter` is not. ### Methods @@ -89,6 +91,8 @@ All letters used in a constant name must be capitalized, while all words in a constant name must be separated by underscore characters. :::php + const INTEREST_RATE = 0.19; + define('INTEREST_RATE', 0.19); Constants must be defined as class members with the `const` modifier. @@ -128,6 +132,9 @@ PHP code must always be delimited by the full-form, standard PHP tags: Short tags are never allowed. For files containing only PHP code, the closing tag must always be omitted. It is not required by PHP, and omitting it prevents the accidental injection of trailing white space into the response. +Files must end with an empty new line. This prevents problems arising from the end-of-file marker appearing where other +white space is expected. + ### Strings #### String Literals @@ -275,13 +282,13 @@ apart from the last argument. #### if/else/elseif No control structure is allowed to have spaces directly -before or after the opening parathesis, as well as no space before the closing parenthesis. +before or after the opening parenthesis, as well as no space before the closing parenthesis. The opening brace and closing brace are written on the same line as the conditional statement. Any content within the braces must be indented using a tab. :::php - if ($a != 2) { + if($a != 2) { $a = 2; } @@ -292,7 +299,7 @@ The closing paren in the conditional will then be placed on a line with the open with one space separating the two, at an indentation level equivalent to the opening control statement. :::php - if (($a == $b) + if(($a == $b) && ($b == $c) || (Foo::CONST == $d) ) { @@ -305,9 +312,9 @@ the formatting conventions are similar to the `if` construct. The following examples demonstrate proper formatting for `if` statements with `else` and/or `elseif` constructs: :::php - if ($a != 2) { + if($a != 2) { $a = 2; - } elseif ($a == 3) { + } elseif($a == 3) { $a = 4; } else { $a = 7; diff --git a/docs/en/misc/contributing/code.md b/docs/en/misc/contributing/code.md index 677f1e5a4..0a57d17b7 100644 --- a/docs/en/misc/contributing/code.md +++ b/docs/en/misc/contributing/code.md @@ -16,32 +16,47 @@ We ask for this so that the ownership in the license is clear and unambiguous, a ## Step-by-step: From forking to sending the pull request -1. Follow the [Installation through Composer](../../installation/composer#contributing) instructions, -which explain how to fork the core modules and add the correct "upstream" remote. In short: +1. Install the project through composer. The process is described in detail in "[Installation through Composer](../../installation/composer#contributing)". composer create-project --keep-vcs --dev silverstripe/installer ./my/website/folder 3.0.x-dev -2. [Branch for new issue and develop on issue branch](code#branch-for-new-issue-and-develop-on-issue-branch) +2. Edit the `composer.json`. Remove the `@stable` markers from the core modules in there. + Add your fork URLs, in this example a fork of the `cms` module on the `sminnee` github account + (replace with your own fork URL). Run a `composer update` afterwards. + + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:sminnee/silverstripe-cms.git" + } + ] + +3. Add a new "upstream" remote so you can track the original repository for changes, and rebase/merge your fork as required. + + cd cms + git remote add -f upstream git://github.com/silverstripe/silverstripe-cms.git + +4. [Branch for new issue and develop on issue branch](code#branch-for-new-issue-and-develop-on-issue-branch) git branch ###-description git checkout ###-description -3. As time passes, the upstream repository accumulates new commits. Keep your working copy's master branch and issue branch up to date by periodically [rebasing your development branch on the latest upstream](code#rebase-your-development-branch-on-the-latest-upstream). +5. As time passes, the upstream repository accumulates new commits. Keep your working copy's master branch and issue branch up to date by periodically [rebasing your development branch on the latest upstream](code#rebase-your-development-branch-on-the-latest-upstream). # [make sure all your changes are committed as necessary in branch] git fetch upstream git rebase upstream/master -4. When development is complete, [squash all commit related to a single issue into a single commit](code#squash-all-commits-related-to-a-single-issue-into-a-single-commit). +6. When development is complete, [squash all commit related to a single issue into a single commit](code#squash-all-commits-related-to-a-single-issue-into-a-single-commit). git fetch upstream git rebase -i upstream/master -5. Push release candidate branch to GitHub +7. Push release candidate branch to GitHub git push origin ###-description -6. Issue pull request on GitHub. Visit your forked respoistory on GitHub.com and click the "Create Pull Request" button nex tot the new branch. +8. Issue pull request on GitHub. Visit your forked respoistory on GitHub.com and click the "Create Pull Request" button nex tot the new branch. The core team is then responsible for reviewing patches and deciding if they will make it into core. If there are any problems they will follow up with you, so please ensure they have a way to contact you! diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index a2bd3d172..803e1173e 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -33,7 +33,7 @@ class HtmlEditorField extends TextareaField { 'languages' => $configObj->getOption('language') ), true); preg_match('/src="([^"]*)"/', $tag, $matches); - Requirements::javascript($matches[1]); + Requirements::javascript(html_entity_decode($matches[1])); } else { Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');