diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..47ae637 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# For more information about the properties used in this file, +# please see the EditorConfig documentation: +# http://editorconfig.org + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[{*.yml,package.json}] +indent_size = 2 + +# The indent size used in the package.json file cannot be changed: +# https://github.com/npm/npm/pull/3180#issuecomment-16336516 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..475f5f2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +/tests export-ignore +/docs export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.travis.yml export-ignore +/.scrutinizer.yml export-ignore diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..61b0c9f --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,9 @@ +inherit: true + +checks: + php: + code_rating: true + duplication: true + +filter: + paths: [code/*, tests/*] diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1cddaab --- /dev/null +++ b/.travis.yml @@ -0,0 +1,36 @@ +# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details + +sudo: false + +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + +env: + - DB=MYSQL CORE_RELEASE=3.2 + +matrix: + include: + - php: 5.6 + env: DB=MYSQL CORE_RELEASE=3 + - php: 5.6 + env: DB=MYSQL CORE_RELEASE=3.1 + - php: 5.6 + env: DB=PGSQL CORE_RELEASE=3.2 + allow_failures: + - php: 7.0 + +before_script: + - composer self-update || true + - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support + - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss + - cd ~/builds/ss + - composer install + +script: + - vendor/bin/phpunit content-widget/tests diff --git a/LICENSE b/LICENSE deleted file mode 100644 index b9c8168..0000000 --- a/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Burnbright Web Solutions - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 65a992f..997b4e5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,37 @@ # SilverStripe Content Widget Display HTML content in a widget! + +## Installation + +```sh +$ composer require silverstripe/content-widget +``` + +## Usage + +Enable [widgets module](https://github.com/silverstripe/silverstripe-widgets), and add a content +widget to a page. + +## Licence + +``` +The MIT License (MIT) + +Copyright (c) 2013 Burnbright Web Solutions + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` diff --git a/code-of-conduct.md b/code-of-conduct.md new file mode 100644 index 0000000..53bf39c --- /dev/null +++ b/code-of-conduct.md @@ -0,0 +1 @@ +When having discussions about this module in issues or pull request please adhere to the [SilverStripe Community Code of Conduct](https://docs.silverstripe.org/en/contributing/code_of_conduct). diff --git a/code/ContentWidget.php b/code/ContentWidget.php index 7d0de41..0490fa1 100644 --- a/code/ContentWidget.php +++ b/code/ContentWidget.php @@ -5,38 +5,40 @@ * * @package silverstripe-content-widget */ -class ContentWidget extends Widget { - /** - * @var array - */ - public static $db = array( - "HTML" => "HTMLText" - ); +class ContentWidget extends Widget +{ + /** + * @var array + */ + public static $db = array( + "HTML" => "HTMLText" + ); - /** - * @var string - */ - private static $title = "HTML Content"; + /** + * @var string + */ + private static $title = "HTML Content"; - /** - * @var string - */ - private static $cmsTitle = "HTML Content"; + /** + * @var string + */ + private static $cmsTitle = "HTML Content"; - /** - * @var string - */ - private static $description = "Custom HTML content widget."; + /** + * @var string + */ + private static $description = "Custom HTML content widget."; - /** - * @return FieldList - */ - public function getCMSFields() { - $fields = parent::getCMSFields(); + /** + * @return FieldList + */ + public function getCMSFields() + { + $fields = parent::getCMSFields(); - $fields->push(TextField::create("Title")); - $fields->push(HtmlEditorField::create("HTML", "Content")); + $fields->push(TextField::create("Title")); + $fields->push(HtmlEditorField::create("HTML", "Content")); - return $fields; - } + return $fields; + } } diff --git a/composer.json b/composer.json index 26e95c9..1f207c8 100644 --- a/composer.json +++ b/composer.json @@ -23,5 +23,8 @@ "name": "Jeremy Shipman", "email": "jeremy@burnbright.net" } - ] + ], + "replace": { + "burnbright/silverstripe-widget-content": "self.version" + } } diff --git a/license.md b/license.md new file mode 100644 index 0000000..687a4b9 --- /dev/null +++ b/license.md @@ -0,0 +1,7 @@ +Copyright (c) 2015 Jeremy Shipman + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.