Skip to content

Commit 8cbce04

Browse files
committed
Initial commit
0 parents  commit 8cbce04

14 files changed

+716
-0
lines changed

.editorconfig

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# For more information about the properties used in this file,
2+
# please see the EditorConfig documentation:
3+
# http://editorconfig.org
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = space
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[{*.yml,*.json}]
14+
indent_size = 2
15+
16+
[{*.ss}]
17+
indent_style = tab

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Thumbs.db
2+
web.config
3+
.log
4+
.buildpath
5+
.project
6+
.settings
7+
.idea
8+
.DS_Store
9+
._.DS_Store
10+
.codekit
11+
.sublime-*
12+
.sass-cache
13+
prepros.cfg
14+
node_modules

.scrutinizer.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
inherit: true
2+
3+
checks:
4+
php:
5+
verify_property_names: true
6+
verify_argument_usable_as_reference: true
7+
verify_access_scope_valid: true
8+
useless_calls: true
9+
use_statement_alias_conflict: true
10+
variable_existence: true
11+
unused_variables: true
12+
unused_properties: true
13+
unused_parameters: true
14+
unused_methods: true
15+
unreachable_code: true
16+
too_many_arguments: true
17+
sql_injection_vulnerabilities: true
18+
simplify_boolean_return: true
19+
side_effects_or_types: true
20+
security_vulnerabilities: true
21+
return_doc_comments: true
22+
return_doc_comment_if_not_inferrable: true
23+
require_scope_for_properties: true
24+
require_scope_for_methods: true
25+
require_php_tag_first: true
26+
psr2_switch_declaration: true
27+
psr2_class_declaration: true
28+
property_assignments: true
29+
prefer_while_loop_over_for_loop: true
30+
precedence_mistakes: true
31+
precedence_in_conditions: true
32+
phpunit_assertions: true
33+
php5_style_constructor: true
34+
parse_doc_comments: true
35+
parameter_non_unique: true
36+
parameter_doc_comments: true
37+
param_doc_comment_if_not_inferrable: true
38+
optional_parameters_at_the_end: true
39+
one_class_per_file: true
40+
no_unnecessary_if: true
41+
no_trailing_whitespace: true
42+
no_property_on_interface: true
43+
no_non_implemented_abstract_methods: true
44+
no_error_suppression: true
45+
no_duplicate_arguments: true
46+
no_commented_out_code: true
47+
newline_at_end_of_file: true
48+
missing_arguments: true
49+
method_calls_on_non_object: true
50+
instanceof_class_exists: true
51+
foreach_traversable: true
52+
fix_line_ending: true
53+
fix_doc_comments: true
54+
duplication: true
55+
deprecated_code_usage: true
56+
deadlock_detection_in_loops: true
57+
code_rating: true
58+
closure_use_not_conflicting: true
59+
catch_class_exists: true
60+
blank_line_after_namespace_declaration: false
61+
avoid_multiple_statements_on_same_line: true
62+
avoid_duplicate_types: true
63+
avoid_conflicting_incrementers: true
64+
avoid_closing_tag: true
65+
assignment_of_null_return: true
66+
argument_type_checks: true
67+
68+
filter:
69+
paths: [src/*, tests/*]

LICENSE.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2017, gorriecoe
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Silverstripe embed
2+
Adds embed and video a dataobject and dataextension.
3+
4+
## Installation
5+
Composer is the recommended way of installing SilverStripe modules.
6+
```
7+
composer require gorriecoe/silverstripe-embed
8+
```
9+
10+
## Requirements
11+
12+
- silverstripe/framework ^4.0
13+
14+
## Maintainers
15+
16+
- [Gorrie Coe](https://github.com/gorriecoe)
17+
18+
## Usage
19+
Dataobjects
20+
```php
21+
use gorriecoe\Embed\Models\Embed;
22+
23+
class ClassName extends DataObject
24+
{
25+
private static $has_one = [
26+
'Embed' => Embed::class,
27+
'Video' => Video::class
28+
];
29+
30+
public function getCMSFields()
31+
{
32+
...
33+
$fields->addFieldsToTab(
34+
'Main',
35+
[
36+
HasOneButtonField::create(
37+
'Embed',
38+
'Embed',
39+
$this
40+
),
41+
HasOneButtonField::create(
42+
'Video',
43+
'Video',
44+
$this
45+
)
46+
]
47+
);
48+
...
49+
}
50+
}
51+
52+
```
53+
DataExtension
54+
```php
55+
use gorriecoe\Embed\Extensions\Embeddable;
56+
57+
class ClassName extends DataObject
58+
{
59+
private static $extensions = [
60+
Embeddable::class,
61+
];
62+
63+
/**
64+
* List the allowed included embed types. If null all are allowed.
65+
* @var array
66+
*/
67+
private static $allowed_embed_types = [
68+
'video',
69+
'photo'
70+
];
71+
72+
/**
73+
* Defines tab to insert the embed fields into.
74+
* @var string
75+
*/
76+
private static $embed_tab = 'Main';
77+
}
78+
79+
```

_config/config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
Name: embedconfig
3+
---

composer.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "gorriecoe/silverstripe-embed",
3+
"description": "",
4+
"type": "silverstripe-vendormodule",
5+
"license": "BSD-3-Clause",
6+
"authors": [
7+
{
8+
"name": "Gorrie Coe",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"keywords": [
13+
"silverstripe",
14+
"cms",
15+
"embed"
16+
],
17+
"homepage": "http://github.com/gorriecoe/silverstripe-embed",
18+
"require": {
19+
"silverstripe/framework": "^4",
20+
"unclecheese/display-logic": "^2"
21+
},
22+
"extra": {
23+
"installer-name": "embed"
24+
}
25+
}

contributing.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Contributing
2+
- Maintenance on this module is a shared effort of those who use it
3+
- To contribute improvements to the code, ensure you raise a pull request and discuss with the module maintainers
4+
- Please follow the SilverStripe [code contribution guidelines](https://docs.silverstripe.org/en/contributing/code/) and [Module Standard](https://docs.silverstripe.org/en/developer_guides/extending/modules/#module-standard)
5+
- Supply documentation that followS the [GitHub Flavored Markdown](https://help.github.com/articles/markdown-basics/) conventions
6+
- 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/)
7+
## Contributor license agreement
8+
By supplying code to this module in patches, tickets and pull requests, you agree to assign copyright
9+
of that code to gorriecoe, on the condition that these code changes are released under the
10+
same BSD license as the original module. We ask for this so that the ownership in the license is clear
11+
and unambiguous. By releasing this code under a permissive license such as BSD, this copyright assignment
12+
won't prevent you from using the code in any way you see fit.

lang/_manifest_exclude

Whitespace-only changes.

lang/en.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
en:
2+
gorriecoe\Embed\Models\Embed:
3+
PLURALNAME: Embed
4+
PLURALS:
5+
one: 'An Embed'
6+
other: '{count} Embed'
7+
SINGULARNAME: Embed
8+
gorriecoe\Embed\Models\Video:
9+
PLURALNAME: Video
10+
PLURALS:
11+
one: 'A Video'
12+
other: '{count} Video'
13+
SINGULARNAME: Video

0 commit comments

Comments
 (0)