├── .editorconfig
├── .env.example
├── .gitignore
├── .php-censor.yml
├── .whitesource
├── Changelog.md
├── LICENSE
├── README.md
├── composer.json
├── phpunit.xml
├── src
├── Caouecs
│ └── Sirtrevorjs
│ │ ├── Behavior
│ │ └── SirTrevorJsable.php
│ │ ├── Contracts
│ │ ├── Convertible.php
│ │ └── Parsable.php
│ │ ├── Converter
│ │ ├── BaseConverter.php
│ │ ├── EmbedConverter.php
│ │ ├── ImageConverter.php
│ │ ├── ModelisationConverter.php
│ │ ├── PresentationConverter.php
│ │ ├── SocialConverter.php
│ │ ├── SoundConverter.php
│ │ ├── TextConverter.php
│ │ └── VideoConverter.php
│ │ ├── Exception
│ │ └── NoProviderRemoteId.php
│ │ ├── Parser
│ │ └── LaravelParser.php
│ │ ├── SirTrevorJs.php
│ │ ├── SirTrevorJsConverter.php
│ │ └── SirtrevorjsServiceProvider.php
├── config
│ └── sir-trevor-js.php
└── views
│ ├── amp
│ ├── embed
│ │ └── iframe.blade.php
│ ├── embedly
│ │ └── card.blade.php
│ ├── image
│ │ ├── gettyimages.blade.php
│ │ ├── image.blade.php
│ │ └── pin.blade.php
│ ├── modelisation
│ │ └── sketchfab.blade.php
│ ├── presentation
│ │ ├── issuu.blade.php
│ │ └── slideshare.blade.php
│ ├── social
│ │ ├── facebook.blade.php
│ │ └── tweet.blade.php
│ ├── sound
│ │ └── soundcloud
│ │ │ ├── full.blade.php
│ │ │ └── small.blade.php
│ └── video
│ │ ├── aol.blade.php
│ │ ├── cplus.blade.php
│ │ ├── dailymailuk.blade.php
│ │ ├── dailymotion.blade.php
│ │ ├── francetv.blade.php
│ │ ├── globalnews.blade.php
│ │ ├── livestream.blade.php
│ │ ├── metacafe.blade.php
│ │ ├── metatube.blade.php
│ │ ├── mlb.blade.php
│ │ ├── nbcbayarea.blade.php
│ │ ├── nhl.blade.php
│ │ ├── ooyala.blade.php
│ │ ├── redtube.blade.php
│ │ ├── ustream.blade.php
│ │ ├── ustreamrecord.blade.php
│ │ ├── veoh.blade.php
│ │ ├── vevo.blade.php
│ │ ├── vimeo.blade.php
│ │ ├── vine.blade.php
│ │ ├── wat.blade.php
│ │ ├── yahoo.blade.php
│ │ ├── youtube.blade.php
│ │ └── zoomin.blade.php
│ ├── fb
│ ├── embed
│ │ └── iframe.blade.php
│ ├── embedly
│ │ └── card.blade.php
│ ├── image
│ │ ├── gettyimages.blade.php
│ │ ├── image.blade.php
│ │ └── pin.blade.php
│ ├── modelisation
│ │ └── sketchfab.blade.php
│ ├── presentation
│ │ ├── issuu.blade.php
│ │ └── slideshare.blade.php
│ ├── social
│ │ ├── facebook.blade.php
│ │ └── tweet.blade.php
│ ├── sound
│ │ ├── soundcloud
│ │ │ ├── full.blade.php
│ │ │ └── small.blade.php
│ │ └── spotify.blade.php
│ ├── text
│ │ ├── blockquote.blade.php
│ │ ├── heading.blade.php
│ │ └── text.blade.php
│ └── video
│ │ ├── aol.blade.php
│ │ ├── base.blade.php
│ │ ├── cplus.blade.php
│ │ ├── dailymailuk.blade.php
│ │ ├── dailymotion.blade.php
│ │ ├── francetv.blade.php
│ │ ├── globalnews.blade.php
│ │ ├── livestream.blade.php
│ │ ├── metacafe.blade.php
│ │ ├── metatube.blade.php
│ │ ├── mlb.blade.php
│ │ ├── nbcbayarea.blade.php
│ │ ├── nhl.blade.php
│ │ ├── ooyala.blade.php
│ │ ├── redtube.blade.php
│ │ ├── ustream.blade.php
│ │ ├── ustreamrecord.blade.php
│ │ ├── veoh.blade.php
│ │ ├── vevo.blade.php
│ │ ├── vimeo.blade.php
│ │ ├── vine.blade.php
│ │ ├── wat.blade.php
│ │ ├── yahoo.blade.php
│ │ ├── youtube.blade.php
│ │ └── zoomin.blade.php
│ ├── html
│ ├── embed
│ │ └── iframe.blade.php
│ ├── embedly
│ │ └── card.blade.php
│ ├── image
│ │ ├── gettyimages.blade.php
│ │ ├── image.blade.php
│ │ └── pin.blade.php
│ ├── modelisation
│ │ └── sketchfab.blade.php
│ ├── presentation
│ │ ├── issuu.blade.php
│ │ └── slideshare.blade.php
│ ├── social
│ │ ├── facebook.blade.php
│ │ └── tweet.blade.php
│ ├── sound
│ │ ├── soundcloud
│ │ │ ├── full.blade.php
│ │ │ └── small.blade.php
│ │ └── spotify.blade.php
│ ├── text
│ │ ├── blockquote.blade.php
│ │ ├── heading.blade.php
│ │ └── text.blade.php
│ └── video
│ │ ├── aol.blade.php
│ │ ├── base.blade.php
│ │ ├── cplus.blade.php
│ │ ├── dailymailuk.blade.php
│ │ ├── dailymotion.blade.php
│ │ ├── francetv.blade.php
│ │ ├── globalnews.blade.php
│ │ ├── livestream.blade.php
│ │ ├── metacafe.blade.php
│ │ ├── metatube.blade.php
│ │ ├── mlb.blade.php
│ │ ├── nbcbayarea.blade.php
│ │ ├── nhl.blade.php
│ │ ├── ooyala.blade.php
│ │ ├── redtube.blade.php
│ │ ├── ustream.blade.php
│ │ ├── ustreamrecord.blade.php
│ │ ├── veoh.blade.php
│ │ ├── vevo.blade.php
│ │ ├── vimeo.blade.php
│ │ ├── vine.blade.php
│ │ ├── wat.blade.php
│ │ ├── yahoo.blade.php
│ │ ├── youtube.blade.php
│ │ └── zoomin.blade.php
│ └── js.blade.php
└── test
└── Caouecs
└── Tests
└── Sirtrevorjs
└── .gitkeep
/.editorconfig:
--------------------------------------------------------------------------------
1 | # This file is for unifying the coding style for different editors and IDEs
2 | # editorconfig.org
3 |
4 | root = true
5 |
6 | [*]
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 | indent_style = space
12 | indent_size = 4
13 |
14 | [**.coffee]
15 | indent_size = 2
16 |
17 | [**.html]
18 | indent_size = 2
19 |
20 | [**.json]
21 | indent_size = 2
22 |
23 | [**.less]
24 | indent_size = 2
25 |
26 | [**.js]
27 | indent_size = 2
28 |
29 | [**.css]
30 | indent_size = 2
31 |
32 | [**.blade.php]
33 | indent_size = 2
34 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | APP_NAME=Laravel
2 | APP_ENV=local
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_URL=http://localhost
6 |
7 | LOG_CHANNEL=stack
8 |
9 | DB_CONNECTION=mysql
10 | DB_HOST=127.0.0.1
11 | DB_PORT=3306
12 | DB_DATABASE=laravel
13 | DB_USERNAME=root
14 | DB_PASSWORD=
15 |
16 | BROADCAST_DRIVER=log
17 | CACHE_DRIVER=file
18 | QUEUE_CONNECTION=sync
19 | SESSION_DRIVER=file
20 | SESSION_LIFETIME=120
21 |
22 | REDIS_HOST=127.0.0.1
23 | REDIS_PASSWORD=null
24 | REDIS_PORT=6379
25 |
26 | MAIL_MAILER=smtp
27 | MAIL_HOST=smtp.mailtrap.io
28 | MAIL_PORT=2525
29 | MAIL_USERNAME=null
30 | MAIL_PASSWORD=null
31 | MAIL_ENCRYPTION=null
32 | MAIL_FROM_ADDRESS=null
33 | MAIL_FROM_NAME="${APP_NAME}"
34 |
35 | AWS_ACCESS_KEY_ID=
36 | AWS_SECRET_ACCESS_KEY=
37 | AWS_DEFAULT_REGION=us-east-1
38 | AWS_BUCKET=
39 |
40 | PUSHER_APP_ID=
41 | PUSHER_APP_KEY=
42 | PUSHER_APP_SECRET=
43 | PUSHER_APP_CLUSTER=mt1
44 |
45 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
46 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
47 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor
2 | composer.lock
3 | .AppleDouble
4 | .phpintel
5 |
--------------------------------------------------------------------------------
/.php-censor.yml:
--------------------------------------------------------------------------------
1 | build_settings:
2 | ignore:
3 | - "vendor"
4 | - "tests"
5 | - ".AppleDouble"
6 |
7 | test:
8 | php_code_sniffer:
9 | standard: "PSR2"
10 | directory: "src/Caouecs"
11 |
12 | php_cpd:
13 | directory: "src/Caouecs"
14 |
15 | php_docblock_checker:
16 | allowed_warnings: 10
17 | skip_classes: true
18 | directory: "src/Caouecs"
19 |
20 | php_loc:
21 | directory: "src/Caouecs"
22 |
23 | php_mess_detector:
24 | rules:
25 | - "codesize"
26 | - "unusedcode"
27 | - "design"
28 | allow_failures: true
29 | directory: "src/Caouecs"
30 |
31 | php_parallel_lint:
32 | directory: "src/Caouecs"
33 |
--------------------------------------------------------------------------------
/.whitesource:
--------------------------------------------------------------------------------
1 | {
2 | "checkRunSettings": {
3 | "vulnerableCheckRunConclusionLevel": "failure"
4 | },
5 | "issueSettings": {
6 | "minSeverityLevel": "LOW"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Changelog.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | * v4.3.2
4 | * feature: specific url for image after upload
5 |
6 | * v4.3.1
7 | * fix: tweets with "
8 |
9 | * v4.3.0
10 | * feature: add transformerText function in Parsable
11 |
12 | * v4.2.0
13 | * rollback on tweetic
14 |
15 | * v4.1.3
16 | * feature: you can define a method defineConfig to define other configuration file for the upload. Useful if you have multi configuration in your website
17 | * fix: prefix for images
18 |
19 | * v4.1.2
20 | * fix: View:exists
21 |
22 | * v4.1.1
23 | * feature: rollback on tweets with text. For smiley, you need an SQL encoding for binaries
24 |
25 | * v4.1.0
26 | * feature: twitter by tweetic
27 |
28 | * v4.0.2
29 | * documentation
30 |
31 | * v4.0.1
32 | * fix: upload image and possibility to call a afterUpload method
33 |
34 | * v4.0.0
35 | * for PHP 8
36 | * for Laravel 9
37 | * feature: loading lazy for iframe
38 | * feature: #31 from abad93/patch-2
39 | * feature: #32 from abad93/patch-1
40 | * feature: parser by Laravel Str markdown
41 | * feature: atymic/twitter
42 | * fix: call to twitter facade
43 | * fix: blockquote with multi lines
44 |
45 | * v3.0.6
46 | * fix: use Parsedown Extra Parser
47 |
48 | * v3.0.5
49 | * feature: http to https
50 |
51 | * v3.0.4
52 | * remove: code sponsor
53 |
54 | * v3.0.3
55 | * feature: blockquote - html5
56 | * feature: add alt for images
57 |
58 | * v3.0.2
59 | * optim: trait controller - tweet
60 | * feature: operator
61 |
62 | * v3.0.1
63 | * feature: Package Auto-Discovery for Laravel 5.5
64 |
65 | * v3.0.0
66 | * feature: php7
67 |
68 | * v2.5.9
69 | * feature: https everywhere
70 |
71 | * v2.5.8
72 | * fix: type of variable for PHP7
73 |
74 | * v2.5.7
75 | * fix: converter - fb
76 |
77 | * v2.5.6
78 | * feature: social - tweet template
79 |
80 | * v2.5.5
81 | * feature: tweet and truncated
82 |
83 | * v2.5.4
84 | * feature: amp - update for Facebook and Vine
85 | * fix: image
86 |
87 | * v2.5.3
88 | * fix: empty on array
89 |
90 | * v2.5.2
91 | * feature: image - add width and height
92 |
93 | * v2.5.1
94 | * fix: service provider - use for ParsedownExtraParser
95 |
96 | * v2.5.0
97 | * bind the converters
98 |
99 | * v2.4.8
100 | * fix: fb - social - Facebook view
101 | * fix: twitter view
102 |
103 | * v2.4.7
104 | * fix: composer
105 | * fix: base converter
106 |
107 | * v2.4.6
108 | * preparation for tests
109 |
110 | * v2.4.5
111 | * fix: amp - gettyimage
112 | * fix: #29 laravel collective html package
113 |
114 | * v2.4.4
115 | * fix: tweet - html - include js
116 |
117 | * v2.4.3
118 | * fix: tweet - fb - not op-social
119 |
120 | * v2.4.2
121 | * getJsExternal method
122 |
123 | * v2.4.1
124 | * fix gettyimages for amp
125 | * new config variable for gettyimages placeholder
126 |
127 | * v2.4.0
128 | * js and amp
129 |
130 | * v2.3.6
131 | * fix: fb views - Facebook and Twitter
132 |
133 | * v2.3.5
134 | * feature: views - https by default
135 |
136 | * v2.3.4
137 | * custom blocks in config file
138 |
139 | * v2.3.3
140 | * custom blocks
141 |
142 | * v2.3
143 | * Facebook Articles with views
144 |
145 | * v2.2
146 | * Html views in *html* directory
147 | * Amp views in *amp* directory
148 | * possibility to define multi views in same application
149 |
150 | * v2.1.4
151 | * fix tweet render with @
152 |
153 | * v2.1.3
154 | * fix find() and unlimited
155 |
156 | * v2.1.1
157 | * fix for title
158 |
159 | * v2.1
160 | * trait for controller
161 |
162 | * v2.0
163 | * version for Laravel 5
164 |
165 | * v1.4.0
166 | * class Converter
167 | * views for render
168 |
169 | * v1.3.0
170 | * no public directory needed
171 |
172 | * v1.2.4
173 | * cleaning
174 |
175 | * v1.2.3
176 | * fix for blockquoteToHtml
177 |
178 | * v1.2.2
179 | * add nbc bay area videos
180 |
181 | * v1.2.1
182 | * New composer
183 |
184 | * v1.2.0
185 | * Parsedown Extra for Markdown text
186 |
187 | * v1.1.10
188 | * add ooyala videos
189 |
190 | * v1.1.9
191 | * add livestream videos
192 |
193 | * v1.1.8
194 | * add nhl videos
195 |
196 | * v1.1.7
197 | * add soundcloud players
198 | * possibility to choose type of player in config file
199 |
200 | * v1.1.6
201 | * add global news videos
202 |
203 | * v1.1.5
204 | * add zoomin.tv
205 |
206 | * v1.1.4
207 | * add converter for issuu
208 |
209 | * v1.1.3
210 | * add converter for france tv video
211 | * add converter for sketchlab
212 |
213 | * v1.1.2
214 | * add converter for video with caption
215 | * add converter for pin from pinterest
216 | * add converter for canal plus video
217 |
218 | * v1.1.1
219 | * add converter for embedly card
220 | * update SirTrevorJsConverter class with no duplicate call of js
221 | * add quoteToHtml() for quote blocks ( see [#3](https://github.com/caouecs/Laravel4-SirTrevorJS/issues/3) )
222 |
223 | * v1.1.0
224 | * update SirTrevorJsConverter::imageToHtml() with html element, figure
225 | * update SirTrevorJsConverter::imageToHtml() for image with caption
226 |
227 | * v1.0.7
228 | * add converter for ustream recorded video
229 |
230 | * v1.0.6
231 | * add converter for aol video
232 | * add converter for metatube video
233 | * add converter for wat.tv video
234 | * add converter for daily mail uk video
235 | * add converter for Spotify track
236 |
237 | * v1.0.5
238 | * add converter for metacafe video
239 | * add converter for yahoo video
240 | * add converter for ustream video
241 | * add converter for veoh video
242 | * add converter for vevo video
243 |
244 | * v1.0.4
245 | * add converter for getty image
246 | * add converter for slideshare
247 | * add converter for facebook post
248 |
249 | * v1.0.3
250 | * fix on tweets
251 |
252 | * v1.0.2
253 | * fix on upload image
254 |
255 | * v1.0.0
256 | * update of readme.md
257 | * new management of stylesheet and script files
258 | * v0.3.2 of Sir Trevor JS
259 | * fix for SirTrevorJS::scripts()
260 |
261 | * v0.1.0
262 | * add possibility to change language
263 | * v0.3.1 of Sir Trevor Js
264 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Fred Delrieu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Laravel-SirTrevorJS
2 |
3 | [](https://sonarcloud.io/dashboard?id=caouecs_Laravel-SirTrevorJS)
4 |
5 | Integrate the tool [Sir Trevor JS](http://madebymany.github.io/sir-trevor-js/) in a [Laravel 5/6/7/8/9](http://laravel.com) project.
6 |
7 | ## Installation
8 |
9 | This package is available through `Packagist` and `Composer`.
10 |
11 | > **For PHP 8** version, use the [branch master](https://github.com/caouecs/Laravel-SirTrevorJS/tree/master) : `"caouecs/sirtrevorjs": "~4.1.0"`
12 |
13 | > **For PHP 7** version, use the [branch v3.0](https://github.com/caouecs/Laravel-SirTrevorJS/tree/v3.0) : `"caouecs/sirtrevorjs": "~3.0.0"`
14 |
15 | > **For Laravel >= 5.2** version *parser*, use the [branch v2.5](https://github.com/caouecs/Laravel-SirTrevorJS/tree/2.5) : `"caouecs/sirtrevorjs": "~2.5.0"`
16 |
17 | > **For Laravel >= 5.1** version *js & amp*, use the [branch v2.4](https://github.com/caouecs/Laravel-SirTrevorJS/tree/v2.4) : `"caouecs/sirtrevorjs": "~2.4.0"`
18 |
19 | > **For Laravel >= 5.1** version *fb articles*, use the [branch v2.3](https://github.com/caouecs/Laravel-SirTrevorJS/tree/v2.3) : `"caouecs/sirtrevorjs": "~2.3.0"`
20 |
21 | > **For Laravel >= 5.1** version *view & amp*, use the [branch v2.2](https://github.com/caouecs/Laravel-SirTrevorJS/tree/v2.2) : `"caouecs/sirtrevorjs": "~2.2.0"`
22 |
23 | > **For Laravel >= 5.1** version *base*, use the [branch v2.1](https://github.com/caouecs/Laravel-SirTrevorJS/tree/v2.1) : `"caouecs/sirtrevorjs": "~2.1.0"`
24 |
25 | > **For Laravel 5.0**, use the [branch v2](https://github.com/caouecs/Laravel-SirTrevorJS/tree/v2) : `"caouecs/sirtrevorjs": "~2.0.0"`
26 |
27 | > **For Laravel 4**, use the [branch laravel4](https://github.com/caouecs/Laravel-SirTrevorJS/tree/laravel4) : `"caouecs/sirtrevorjs": "~1.4"`
28 |
29 | Please read *README.md* in the choosen branch.
30 |
31 | ### Service Provider
32 |
33 | If you want to use routing, controllers, views, binding directly in your project, in your `app/config/app.php`, add `"Caouecs\Sirtrevorjs\SirtrevorjsServiceProvider"` to your list of providers.
34 |
35 | ### Twitter
36 |
37 | To get tweets, this project uses [thujohn/twitter](https://github.com/thujohn/twitter). Please visit the page of the project to know how to install and configure.
38 |
39 | ## Configuration file
40 |
41 | Next, you must migrate config :
42 |
43 | php artisan vendor:publish caouecs/sirtrevorjs
44 |
45 | After installation, the config file is located at *app/config/packages/caouecs/sirtrevorjs/sir-trevor-js.php*.
46 |
47 | You can define :
48 |
49 | * the path for image upload
50 | * the route for upload image
51 | * the route for tweet
52 | * the path of Sir Trevor files
53 | * the list of block types
54 | * custom blocks
55 | * the language
56 | * the paths for Eventable.js and Underscore.js
57 | * the view
58 | * configuration for blocks
59 | * soundcloud
60 | * gettyimages
61 | * etc...
62 |
63 | ## SirTrevorJs class
64 |
65 | ### Assets
66 |
67 | For stylesheets :
68 |
69 | ```php
70 | SirTrevorJs::stylesheets()
71 | ```
72 |
73 | For scripts, in your Blade files :
74 |
75 | ```php
76 | SirTrevorJs::scripts()
77 | ```
78 |
79 | ### Fix for image block
80 |
81 | Function to fix a problem with image block when you add a new image :
82 |
83 | ```php
84 | string SirTrevorJs::transformText(string $text);
85 | ```
86 |
87 | ### Find first image
88 |
89 | Get first image in text with `findImage` method :
90 |
91 | ```php
92 | string SirTrevorJS::findImage(string $text);
93 | ```
94 |
95 | In return, you have url of image or empty string.
96 |
97 | ### Find elements by blocktypes
98 |
99 | Get all elements in text, in specified blocktype with `find` method :
100 |
101 | ```php
102 | mixed SirTrevorJS::find(string $text, string $blocktype [, string $output = "json"])
103 | ```
104 |
105 | In return, you can have :
106 |
107 | * array, if you choose "array" for $output
108 | * json, if you choose "json" for $output
109 | * false, if the script doesn't find an occurence of blocktype
110 |
111 | ## Controller
112 |
113 | ### SirTrevorJsable
114 |
115 | This trait proposes two things :
116 |
117 | * upload image where you want
118 | * get tweets
119 |
120 | ### Upload image
121 |
122 | This project proposes a system for upload image, nothing to configure, just the `directory_upload` value in config file.
123 |
124 | ```php
125 | "directory_upload" => "img/uploads"
126 | ```
127 |
128 | ### Tweet
129 |
130 | This project proposes a system to get tweets. I use [thujohn/twitter](https://github.com/thujohn/twitter) project.
131 |
132 | ## SirTrevorJsConverter class
133 |
134 | This class need a parser, a configuration and a view by default.
135 |
136 | You can use the binding of this class :
137 |
138 | ```php
139 | app('caouecs.sirtrevorjs.converter')
140 | ```
141 |
142 | ### Html
143 |
144 | Convert text from Sir Trevor Js to html :
145 |
146 | ```php
147 | string app('caouecs.sirtrevorjs.converter')->toHtml($text)
148 | ```
149 |
150 | These methods return a string with html and js codes.
151 |
152 | ### Amp
153 |
154 | Convert text from Sir Trevor Js to [Amp](https://www.ampproject.org):
155 |
156 | ```php
157 | string app('caouecs.sirtrevorjs.converter')->toAmp($text);
158 | ```
159 |
160 | All modules have an amp's version, if it exists an equivalence.
161 |
162 | This method returns an array ( *text* and *js*).
163 |
164 | ### Facebook Instant Articles
165 |
166 | Convert text from Sir Trevor Js to [Facebook Instant Articles](https://developers.facebook.com/docs/instant-articles/reference):
167 |
168 | ```php
169 | string app('caouecs.sirtrevorjs.converter')->toFb($text);
170 | ```
171 |
172 | All modules have an FBArticles's version, if it exists an equivalence.
173 |
174 | This method returns a string with html and js codes.
175 |
176 | ### Adding custom blocks
177 |
178 | You can choose to add custom blocks in config file or add them by extending SirTrevorJsConverter class.
179 |
180 | #### config
181 |
182 | ```php
183 | 'customBlocks' => [
184 | 'image_extended' => '\App\SirTrevorConverters\ImageExtendedConverter',
185 | ],
186 | ```
187 |
188 | #### SirTrevorConverter
189 |
190 | ```php
191 | '{Your namespace}\\Editor\\Converter\\GalleryConverterEditor',
205 | 'readmore' => '{Your namespace}\\Editor\\Converter\\ReadMoreConverterEditor',
206 | ];
207 | }
208 | ```
209 |
210 | And you need to call this class in your service provider, in register :
211 |
212 | $this->app->bind('editor.converter', function ($app) {
213 | return new App\SirTrevorConverters\SirTrevorJsConverterEditor(
214 | new LaravelParser(),
215 | config('sir-trevor-js'),
216 | 'html'
217 | );
218 | });
219 |
220 | ### Modules
221 |
222 | For the moment, the code can convert :
223 |
224 | * blockquote / quote
225 | * embedly card
226 | * [facebook post](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/facebook.js)
227 | * [getty images](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/gettyimage.js)
228 | * heading
229 | * [iframe](https://raw.githubusercontent.com/madebymany/sir-trevor-blocks/6b2ba248b49c13eb38f84c1267c5779a18cd4201/src/iframe.js)
230 | * image
231 | * basic version
232 | * [version with caption](https://github.com/neyre/sir-trevor-wp/blob/master/custom-blocks/ImageCaption.js)
233 | * [issuu](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/issuu.js)
234 | * [pinterest](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/pinterest.js)
235 | * [sketchfab](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/sketchfab.js)
236 | * [slideshare](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/slideshare.js)
237 | * [soundcloud](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/soundcloud.js)
238 | * [spotify](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/spotify.js)
239 | * text with Markdown
240 | * tweet
241 | * unordered list
242 | * [video](https://github.com/caouecs/SirTrevorJS-blocks/blob/master/blocks/video.js)
243 | * aol
244 | * canal plus
245 | * daily mail uk
246 | * dailymotion
247 | * france tv
248 | * global news
249 | * livestream
250 | * metacafe
251 | * metatube
252 | * mlb
253 | * nbc bay area
254 | * nhl
255 | * ooyala
256 | * redtube
257 | * ustream (live and recorded)
258 | * veoh
259 | * vevo
260 | * vimeo
261 | * vine
262 | * wat
263 | * yahoo
264 | * youtube
265 | * zoomin.tv
266 | * video with caption
267 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "caouecs/sirtrevorjs",
3 | "description": "Sir Trevor JS in Laravel project",
4 | "keywords": ["laravel", "sir trevor js", "sir-trevor-js", "lpm"],
5 | "license": "MIT",
6 | "authors": [
7 | {
8 | "name": "caouecs",
9 | "email": "caouecs@caouecs.net"
10 | }
11 | ],
12 | "require": {
13 | "php": "^8.0",
14 | "illuminate/support": "~9.0|~10.0",
15 | "laravelcollective/html": "~6.0"
16 | },
17 | "require-dev": {
18 | "phpunit/phpunit": "^9.0"
19 | },
20 | "autoload": {
21 | "psr-0": {
22 | "Caouecs\\Sirtrevorjs\\": "src/"
23 | }
24 | },
25 | "autoload-dev": {
26 | "classmap": [
27 | "test"
28 | ]
29 | },
30 | "extra": {
31 | "laravel": {
32 | "providers": [
33 | "Caouecs\\Sirtrevorjs\\SirtrevorjsServiceProvider"
34 | ]
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 | ./test/
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Behavior/SirTrevorJsable.php:
--------------------------------------------------------------------------------
1 | hasFile('attachment')) {
30 | // config
31 | $config = method_exists($this, 'defineConfig') ? $this->defineConfig() : config('sir-trevor-js');
32 |
33 | // file
34 | $file = $request->file('attachment');
35 |
36 | // Problem on some configurations
37 | $file = $file['file'] ?? $file;
38 |
39 | // filename
40 | $fileNameCheck = str_replace(['.jpeg', '.JPG'], '.jpg', $file->getClientOriginalName());
41 | $fileNameCheck = str_replace('.GIF', '.gif', $fileNameCheck);
42 | $fileNameCheck = str_replace('.PNG', '.png', $fileNameCheck);
43 | $fileNameCheck = str_replace('.WEBP', '.webp', $fileNameCheck);
44 | $fileNameCheck = str_replace([' ', '(', ')'], '-', $fileNameCheck);
45 | $filename = $fileNameCheck;
46 |
47 | // prefix if file exists
48 | $prefix = 0;
49 |
50 | // verif if file exists
51 | while (file_exists(public_path($config['directory_upload']).'/'.$fileNameCheck)) {
52 | ++$prefix;
53 |
54 | if ($prefix < 10) {
55 | $prefix = '0'.$prefix;
56 | }
57 |
58 | $fileNameCheck = $prefix.'_'.$filename;
59 | }
60 |
61 | $filename = $fileNameCheck;
62 |
63 | // url return for image if you want to update it.
64 | $urlReturn = '';
65 |
66 | if (method_exists($this, 'afterUpload')) {
67 | $urlReturn = $this->afterUpload($file, $filename);
68 | }
69 |
70 | if ($file->move(public_path($config['directory_upload']), $filename)) {
71 | $return = [
72 | 'file' => [
73 | 'url' => $urlReturn ?: $config['directory_upload'].'/'.$filename,
74 | ],
75 | ];
76 |
77 | echo json_encode($return);
78 | }
79 | }
80 | }
81 |
82 | /**
83 | * Tweet.
84 | */
85 | public function tweet(Request $request): void
86 | {
87 | // url of tweet.
88 | $tweetUrl = $request->input('tweet_id');
89 |
90 | if (! empty($tweetUrl)) {
91 | $tweetUrl = explode('?', $tweetUrl);
92 | $tweetUrl = $tweetUrl[0];
93 |
94 | $url = 'https://publish.twitter.com/oembed?url='.urlencode($tweetUrl).'&format=json';
95 |
96 | $result = file_get_contents($url);
97 | $decodedData = json_decode($result);
98 |
99 | // Tweet ID.
100 | $arrTweetID = explode('status/', $tweetUrl);
101 | $arrTweetID = explode('?', $arrTweetID[1]);
102 | $tweetID = $arrTweetID[0] ?? '';
103 |
104 | // Text.
105 | $text = strip_tags($decodedData->html ?? '');
106 | $arrText = explode('(@', $text);
107 | $text = str_replace($decodedData->author_name, '', $arrText[0]);
108 |
109 | // ScreenName.
110 | $arrScreenName = explode(')', $arrText[1] ?? '');
111 | $screenName = $arrScreenName[0] ?? '';
112 | // Date.
113 | $date = trim(str_replace("\n", '', $arrScreenName[1] ?? ''));
114 |
115 | echo json_encode([
116 | 'id_str' => $tweetID,
117 | 'text' => $text,
118 | 'created_at' => $date,
119 | 'status_url' => $tweetUrl,
120 | 'user' => [
121 | 'name' => $decodedData->author_name,
122 | 'screen_name' => $screenName,
123 | ],
124 | ]);
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Contracts/Convertible.php:
--------------------------------------------------------------------------------
1 | config = $config;
88 | $this->data = $data['data'] ?? '';
89 | $this->output = $output;
90 | $this->parser = $parser;
91 | $this->type = $data['type'] ?? '';
92 | }
93 |
94 | /**
95 | * Render.
96 | */
97 | public function render(): string
98 | {
99 | if (in_array($this->type, $this->types)) {
100 | $method = $this->type.'ToHtml';
101 |
102 | return $this->$method();
103 | }
104 |
105 | return '';
106 | }
107 |
108 | /**
109 | * Set view.
110 | */
111 | public function setView(string $view = ''): void
112 | {
113 | $this->view = $view;
114 | }
115 |
116 | /**
117 | * Personalized views.
118 | *
119 | * @param string $viewName Name of the base view
120 | * @param array $params Params
121 | * @param string $type Block type
122 | */
123 | public function view(string $viewName, array $params = [], string $type = ''): string
124 | {
125 | if (empty($type)) {
126 | $type = $this->type;
127 | }
128 |
129 | $jsExternal = $this->getJsExternal();
130 | if (! empty($jsExternal[$this->output][$type])) {
131 | $this->codejs[$type] = $jsExternal[$this->output][$type];
132 | }
133 |
134 | if (! empty($this->view) && View::exists($this->view.'.'.$viewName)) {
135 | return view($this->view.'.'.$viewName, $params)->render();
136 | }
137 |
138 | if (isset($this->config['view']) && View::exists($this->config['view'].'.'.$viewName)) {
139 | return view($this->config['view'].'.'.$viewName, $params)->render();
140 | }
141 |
142 | return view('sirtrevorjs::html.'.$viewName, $params)->render();
143 | }
144 |
145 | /**
146 | * Returns code js.
147 | */
148 | public function getCodeJs(): array
149 | {
150 | return $this->codejs;
151 | }
152 |
153 | /**
154 | * Returns external js code.
155 | */
156 | public function getJsExternal(): array
157 | {
158 | return [];
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/EmbedConverter.php:
--------------------------------------------------------------------------------
1 | [
37 | 'embedly' => '',
39 | ],
40 | 'amp' => [
41 | 'iframe' => '',
43 | ],
44 | ];
45 | }
46 |
47 | /**
48 | * Render of iframe.
49 | */
50 | public function iframeToHtml(): string
51 | {
52 | return $this->view('embed.iframe', [
53 | 'src' => $this->data['src'],
54 | 'width' => $this->data['width'],
55 | 'height' => $this->data['height'],
56 | 'title' => $this->data['title'] ?? '',
57 | ]);
58 | }
59 |
60 | /**
61 | * Render of embedly.
62 | */
63 | public function embedlyToHtml(): string
64 | {
65 | if (filter_var($this->data['url'], FILTER_VALIDATE_URL)) {
66 | return $this->view('embedly.'.$this->type, [
67 | 'url' => $this->data['url'],
68 | 'options' => $this->config['embedly'] ?? '',
69 | ]);
70 | }
71 |
72 | return '';
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/ImageConverter.php:
--------------------------------------------------------------------------------
1 | [
40 | 'pinterest' => '',
42 | ],
43 | 'amp' => [
44 | 'gettyimages' => '',
46 | ],
47 | ];
48 | }
49 |
50 | /**
51 | * Converts the image to html.
52 | */
53 | public function imageToHtml(): string
54 | {
55 | if (empty($this->data['file']['url'])) {
56 | return '';
57 | }
58 |
59 | $text = $this->data['text'] ?? '';
60 |
61 | if (! empty($text)) {
62 | $text = $this->parser->toHtml($text);
63 | }
64 |
65 | $url = $this->data['file']['url'] ?? '';
66 |
67 | try {
68 | $size = getimagesize($url);
69 | } catch (Exception) {
70 | }
71 |
72 | if (empty($size) || ! is_array($size)) {
73 | $size = [
74 | $this->config['image.width'] ?? 520,
75 | $this->config['image.height'] ?? 200,
76 | ];
77 | }
78 |
79 | return $this->view('image.image', [
80 | 'url' => $url,
81 | 'text' => $text,
82 | 'width' => $size[0],
83 | 'height' => $size[1],
84 | 'title' => $this->data['title'] ?? '',
85 | ]);
86 | }
87 |
88 | /**
89 | * Converts GettyImage to html.
90 | */
91 | public function gettyimagesToHtml(): string
92 | {
93 | return $this->view('image.gettyimages', [
94 | 'remote_id' => $this->data['remote_id'],
95 | 'width' => $this->config['gettyimages.width'] ?? 594,
96 | 'height' => $this->config['gettyimages.height'] ?? 465,
97 | 'placeholder' => $this->config['gettyimages.placeholder'] ?? '/',
98 | ]);
99 | }
100 |
101 | /**
102 | * Converts Pinterest to html.
103 | */
104 | public function pinterestToHtml(): string
105 | {
106 | /*
107 | * Pin
108 | */
109 | if ($this->data['provider'] === 'pin') {
110 | return $this->view('image.pin', [
111 | 'remote_id' => $this->data['remote_id'],
112 | ]);
113 | }
114 |
115 | return '';
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/ModelisationConverter.php:
--------------------------------------------------------------------------------
1 | view('modelisation.sketchfab', [
43 | 'remote_id' => $this->data['remote_id'],
44 | 'title' => $this->data['title'] ?? 'Sketchfab',
45 | ]);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/PresentationConverter.php:
--------------------------------------------------------------------------------
1 | [
37 | 'Issuu' => '',
38 | ],
39 | ];
40 | }
41 |
42 | /**
43 | * Slideshare.
44 | */
45 | public function slideshareToHtml(): string
46 | {
47 | return $this->view('presentation.slideshare', [
48 | 'remote_id' => $this->data['remote_id'],
49 | 'title' => $this->data['title'] ?? 'Slideshare',
50 | ]);
51 | }
52 |
53 | /**
54 | * Issuu.
55 | */
56 | public function issuuToHtml(): string
57 | {
58 | return $this->view('presentation.issuu', [
59 | 'remote_id' => $this->data['remote_id'],
60 | ]);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/SocialConverter.php:
--------------------------------------------------------------------------------
1 | [
37 | 'facebook' => '',
41 | 'tweet' => '',
42 | ],
43 | 'amp' => [
44 | 'facebook' => '',
46 | 'tweet' => '',
48 | ],
49 | ];
50 |
51 | return $js;
52 | }
53 |
54 | /**
55 | * Tweet.
56 | */
57 | public function tweetToHtml(): string
58 | {
59 | return $this->view('social.tweet', [
60 | 'data' => $this->data,
61 | ]);
62 | }
63 |
64 | /**
65 | * Facebook.
66 | */
67 | public function facebookToHtml(): string
68 | {
69 | return $this->view('social.facebook', [
70 | 'data' => $this->data,
71 | ]);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/SoundConverter.php:
--------------------------------------------------------------------------------
1 | config['soundcloud'] ?? '';
44 |
45 | if ($theme !== 'full') {
46 | $theme = 'small';
47 | }
48 |
49 | return $this->view('sound.soundcloud.'.$theme, [
50 | 'remote' => $this->data['remote_id'],
51 | ]);
52 | }
53 |
54 | /**
55 | * Spotify block.
56 | */
57 | public function spotifyToHtml(): string
58 | {
59 | return $this->view('sound.spotify', [
60 | 'remote' => $this->data['remote_id'],
61 | 'options' => $this->config['spotify'],
62 | 'title' => $this->data['title'] ?? 'Spotify',
63 | ]);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/TextConverter.php:
--------------------------------------------------------------------------------
1 | view('text.text', [
48 | 'text' => $this->parser->toHtml($this->data['text']),
49 | ]);
50 | }
51 |
52 | /**
53 | * Convert text to markdown.
54 | */
55 | public function markdownToHtml(): string
56 | {
57 | return $this->textToHtml();
58 | }
59 |
60 | /**
61 | * Convert heading.
62 | */
63 | public function headingToHtml(): string
64 | {
65 | return $this->view('text.heading', [
66 | 'text' => $this->parser->toHtml($this->data['text']),
67 | ]);
68 | }
69 |
70 | /**
71 | * Converts block quotes to html.
72 | */
73 | public function blockquoteToHtml(): string
74 | {
75 | // remove the indent thats added by Sir Trevor
76 | $text = str_replace("\n>", "\n", $this->data['text']);
77 | $text = ltrim($text, '>');
78 |
79 | return $this->view('text.blockquote', [
80 | 'cite' => $this->data['cite'] ?? '',
81 | 'text' => $this->parser->toHtml($text),
82 | ]);
83 | }
84 |
85 | /**
86 | * Converts quote to html.
87 | */
88 | public function quoteToHtml(): string
89 | {
90 | return $this->blockquoteToHtml();
91 | }
92 |
93 | /**
94 | * Converts list to html.
95 | */
96 | public function listToHtml(): string
97 | {
98 | return $this->textToHtml();
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Converter/VideoConverter.php:
--------------------------------------------------------------------------------
1 | caption = $data['data']['caption'] ?? '';
113 | $this->config = $config;
114 | $this->output = $output;
115 | $this->parser = $parser;
116 | $this->provider = $data['data']['source'];
117 | $this->remoteId = $data['data']['remote_id'];
118 | $this->type = 'video';
119 | $this->title = $data['data']['title'] ?? '';
120 | }
121 |
122 | /**
123 | * Return array js external.
124 | */
125 | public function getJsExternal(): array
126 | {
127 | return [
128 | 'html' => [
129 | 'vine' => '',
131 | ],
132 | 'amp' => [
133 | 'dailymotion' => '',
135 | 'vimeo' => '',
137 | 'vine' => '',
139 | 'youtube' => '',
141 | ],
142 | ];
143 | }
144 |
145 | /**
146 | * Render of video tag.
147 | */
148 | public function videoToHtml(): string
149 | {
150 | return ! in_array($this->provider, $this->providers) ? ''
151 | : $this->view(
152 | 'video.'.$this->provider,
153 | [
154 | 'remote' => $this->remoteId,
155 | 'caption' => $this->parser->toHtml($this->caption),
156 | 'title' => $this->title ?: $this->provider,
157 | ],
158 | $this->provider
159 | );
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/Exception/NoProviderRemoteId.php:
--------------------------------------------------------------------------------
1 | markdown());
27 | }
28 |
29 | /**
30 | * Transformer.
31 | */
32 | public function transformer(string $text = ''): string
33 | {
34 | return $text;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/SirTrevorJs.php:
--------------------------------------------------------------------------------
1 | 'image',
95 | 'data' => json_decode(implode($data['data']), true),
96 | ];
97 | } elseif ($data['type'] === 'tweet') {
98 | $data['data']['text'] = str_replace('"', '', $data['data']['text']);
99 |
100 | $return[] = $data;
101 | } else {
102 | $return[] = $data;
103 | }
104 | }
105 |
106 | return json_encode(['data' => $return], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
107 | }
108 |
109 | return '';
110 | }
111 |
112 | /**
113 | * Stylesheet files
114 | * see config file.
115 | */
116 | public static function stylesheets(): string
117 | {
118 | // params in config file
119 | $config = config('sir-trevor-js');
120 |
121 | /*
122 | * Files of Sir Trevor JS
123 | */
124 | $return = HTML::style($config['path'].'sir-trevor-icons.css')
125 | .HTML::style($config['path'].'sir-trevor.css');
126 |
127 | /*
128 | * Others files if you need it
129 | */
130 | if (isset($config['stylesheet']) && is_array($config['stylesheet'])) {
131 | foreach ($config['stylesheet'] as $arr) {
132 | if (file_exists(public_path($arr))) {
133 | $return .= HTML::style($arr);
134 | }
135 | }
136 | }
137 |
138 | return $return;
139 | }
140 |
141 | /**
142 | * Javascript files.
143 | *
144 | * @param array $params
145 | *
146 | * Params :
147 | * - class
148 | * - blocktypes
149 | * - language
150 | * - uploadUrl
151 | * - tweetUrl
152 | */
153 | public static function scripts(array $params = []): string
154 | {
155 | // params
156 | $config = self::config($params);
157 | $return = '';
158 |
159 | /*
160 | * Other files
161 | */
162 | if (isset($config['script']) && is_array($config['script'])) {
163 | foreach ($config['script'] as $arr) {
164 | if (file_exists(public_path($arr))) {
165 | $return .= HTML::script($arr);
166 | }
167 | }
168 | }
169 |
170 | /*
171 | * File of Sir Trevor JS
172 | */
173 | $return .= HTML::script($config['path'].'sir-trevor.min.js');
174 |
175 | /*
176 | * Language
177 | */
178 | if ($config['language'] !== 'en') {
179 | $return .= HTML::script($config['path'].'locales/'.$config['language'].'.js');
180 | }
181 |
182 | return $return.view('sirtrevorjs::js', ['config' => $config]);
183 | }
184 |
185 | /**
186 | * Configuration of Sir Trevor JS.
187 | *
188 | * 1 - $params
189 | * 2 - config file
190 | * 3 - default
191 | */
192 | public static function config(array $params = []): array
193 | {
194 | // params in config file
195 | $config = config('sir-trevor-js');
196 |
197 | /*
198 | * Block types
199 | */
200 | $blocktypes = self::$blocktypes;
201 |
202 | // params
203 | if (isset($params['blocktypes']) && ! empty($params['blocktypes']) && is_array($params['blocktypes'])) {
204 | $blocktypes = $params['blocktypes'];
205 | // config
206 | } elseif (isset($config['blocktypes']) && ! empty($config['blocktypes']) && is_array($config['blocktypes'])) {
207 | $blocktypes = $config['blocktypes'];
208 | }
209 |
210 | return [
211 | 'blocktypes' => '\''.implode('\', \'', $blocktypes).'\'',
212 | 'class' => self::defineParam('class', $params),
213 | 'language' => self::defineParam('language', $params, $config),
214 | 'path' => $config['path'],
215 | 'script' => $config['script'],
216 | 'tweetUrl' => self::defineParam('tweetUrl', $params, $config),
217 | 'uploadUrl' => self::defineParam('uploadUrl', $params, $config),
218 | 'version' => $config['version'],
219 | ];
220 | }
221 |
222 | /**
223 | * Convert json from Sir Trevor JS to html.
224 | */
225 | public static function render(string $text): string
226 | {
227 | return app('caouecs.sirtrevorjs.converter')->toHtml($text);
228 | }
229 |
230 | /**
231 | * Find first image in text from Sir Trevor JS.
232 | */
233 | public static function findImage(string $text): string
234 | {
235 | $array = json_decode($text, true);
236 |
237 | if (! empty($array['data'])) {
238 | foreach ($array['data'] as $arr) {
239 | if ($arr['type'] === 'image' && isset($arr['data']['file']['url'])) {
240 | return $arr['data']['file']['url'];
241 | }
242 | }
243 | }
244 |
245 | return '';
246 | }
247 |
248 | /**
249 | * Find occurences of a type of block in a text.
250 | *
251 | * @return array|string|bool Returns list of blocks in an array or a json, if exists. Else, returns false
252 | */
253 | public static function find(string $text, string $blocktype, string $output = 'json', int $occurence = 0)
254 | {
255 | $array = json_decode($text, true);
256 |
257 | if (! isset($array['data'])) {
258 | return false;
259 | }
260 |
261 | $return = [];
262 | $_nbr = 1;
263 |
264 | foreach ($array['data'] as $arr) {
265 | if ($arr['type'] === $blocktype) {
266 | $return[] = $arr['data'];
267 |
268 | if ($_nbr === $occurence) {
269 | break;
270 | }
271 |
272 | ++$_nbr;
273 | }
274 | }
275 |
276 | return empty($return) || $output === 'array' ? $return
277 | : json_encode($return, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
278 | }
279 |
280 | /**
281 | * Find first occurence of a type of block in a text.
282 | *
283 | * @return array|bool|string Returns list of blocks in an array if exists. Else, returns false
284 | */
285 | public static function first(string $text, string $blocktype, string $output = 'json')
286 | {
287 | return self::find($text, $blocktype, $output, 1);
288 | }
289 |
290 | /**
291 | * Define param.
292 | */
293 | private static function defineParam(string $type, array $params, array $config = []): string
294 | {
295 | // params
296 | if (! empty($params[$type])) {
297 | return $params[$type];
298 | }
299 |
300 | // config and default
301 | return ! empty($config[$type]) ? $config[$type] : self::$$type;
302 | }
303 | }
304 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/SirTrevorJsConverter.php:
--------------------------------------------------------------------------------
1 |
20 | */
21 | class SirTrevorJsConverter
22 | {
23 | /**
24 | * Configuration.
25 | *
26 | * @var array
27 | */
28 | protected $config = [];
29 |
30 | /**
31 | * Parser.
32 | *
33 | * @var Parsable
34 | */
35 | protected $parser;
36 |
37 | /**
38 | * View.
39 | *
40 | * @var string
41 | */
42 | protected $view;
43 |
44 | /**
45 | * Output format.
46 | *
47 | * @var string
48 | */
49 | protected $output = 'html';
50 |
51 | /**
52 | * Code js.
53 | *
54 | * @var string
55 | */
56 | protected $codeJs;
57 |
58 | /**
59 | * Valid blocks with converter.
60 | *
61 | * @var array
62 | */
63 | protected $blocks = [
64 | 'blockquote' => 'Text',
65 | 'embedly' => 'Embed',
66 | 'facebook' => 'Social',
67 | 'gettyimages' => 'Image',
68 | 'heading' => 'Text',
69 | 'iframe' => 'Embed',
70 | 'image' => 'Image',
71 | 'issuu' => 'Presentation',
72 | 'list' => 'Text',
73 | 'markdown' => 'Text',
74 | 'pinterest' => 'Image',
75 | 'quote' => 'Text',
76 | 'sketchfab' => 'Modelisation',
77 | 'slideshare' => 'Presentation',
78 | 'soundcloud' => 'Sound',
79 | 'spotify' => 'Sound',
80 | 'text' => 'Text',
81 | 'tweet' => 'Social',
82 | 'video' => 'Video',
83 | ];
84 |
85 | /**
86 | * Custom blocks.
87 | *
88 | * @var array
89 | */
90 | protected $customBlocks = [];
91 |
92 | /**
93 | * Construct.
94 | */
95 | public function __construct(Parsable $parser, array $config, string $view = '')
96 | {
97 | $this->config = $config;
98 | $this->parser = $parser;
99 | $this->view = $view;
100 | }
101 |
102 | /**
103 | * Set view.
104 | */
105 | public function setView(string $view): void
106 | {
107 | $this->view = $view;
108 | }
109 |
110 | /**
111 | * Converts the outputted json from Sir Trevor to Html.
112 | */
113 | public function toHtml(string $json): string
114 | {
115 | if (empty($this->view)) {
116 | $this->view = 'sirtrevorjs::html';
117 | }
118 |
119 | $this->output = 'html';
120 |
121 | return $this->convert($json);
122 | }
123 |
124 | /**
125 | * Converts the outputted json from Sir Trevor to Amp.
126 | */
127 | public function toAmp(string $json): string
128 | {
129 | if (empty($this->view)) {
130 | $this->view = 'sirtrevorjs::amp';
131 | }
132 |
133 | $this->output = 'amp';
134 |
135 | return $this->convert($json, false);
136 | }
137 |
138 | /**
139 | * Converts the outputted json from Sir Trevor to Facebook Articles.
140 | */
141 | public function toFb(string $json): string
142 | {
143 | if (empty($this->view)) {
144 | $this->view = 'sirtrevorjs::fb';
145 | }
146 |
147 | $this->output = 'fb';
148 |
149 | return $this->convert($json);
150 | }
151 |
152 | /**
153 | * Convert the outputted json from Sir Trevor.
154 | */
155 | public function convert(string $json, bool $externalJs = true): string
156 | {
157 | // convert the json to an associative array
158 | $input = json_decode($json, true);
159 | $text = '';
160 | $codejs = [];
161 |
162 | if (empty($this->view)) {
163 | $this->view = 'sirtrevorjs::html';
164 | }
165 |
166 | if (is_array($input)) {
167 | // blocks
168 | $listBlocks = $this->getBlocks();
169 |
170 | // loop trough the data blocks
171 | foreach ($input['data'] as $block) {
172 | // no data, problem
173 | if (! isset($block['data']) || ! array_key_exists($block['type'], $listBlocks)) {
174 | break;
175 | }
176 |
177 | $class = $listBlocks[$block['type']];
178 | $converter = new $class($this->parser, $this->config, $block, $this->output);
179 | $converter->setView($this->view);
180 | $text .= $converter->render();
181 | $codejsClass = $converter->getCodeJs();
182 |
183 | if (is_array($codejsClass)) {
184 | $codejs = array_merge($codejs, $codejsClass);
185 | }
186 | }
187 |
188 | // code js
189 | if ($externalJs && is_array($codejs)) {
190 | $text .= implode($codejs);
191 | }
192 |
193 | $this->codeJs = implode($codejs);
194 | }
195 |
196 | return $text;
197 | }
198 |
199 | /**
200 | * Returns code js.
201 | */
202 | public function getCodeJs(): string
203 | {
204 | return $this->codeJs;
205 | }
206 |
207 | /**
208 | * Return base blocks and custom blocks with good classes.
209 | */
210 | protected function getBlocks(): array
211 | {
212 | $blocks = [];
213 |
214 | foreach ($this->blocks as $key => $value) {
215 | $blocks[$key] = 'Caouecs\\Sirtrevorjs\\Converter\\'.$value.'Converter';
216 | }
217 |
218 | if (! empty($this->customBlocks)) {
219 | $blocks = array_merge($blocks, $this->customBlocks);
220 | }
221 |
222 | if (isset($this->config['customBlocks']) && ! empty($this->config['customBlocks'])) {
223 | $blocks = array_merge($blocks, $this->config['customBlocks']);
224 | }
225 |
226 | return $blocks;
227 | }
228 | }
229 |
--------------------------------------------------------------------------------
/src/Caouecs/Sirtrevorjs/SirtrevorjsServiceProvider.php:
--------------------------------------------------------------------------------
1 | loadViewsFrom(__DIR__.'/../../views', 'sirtrevorjs');
34 |
35 | $this->publishes([
36 | __DIR__.'/../../config/sir-trevor-js.php' => config_path('sir-trevor-js.php'),
37 | ]);
38 | }
39 |
40 | /**
41 | * Register the service provider.
42 | */
43 | public function register(): void
44 | {
45 | $this->app->bind('caouecs.sirtrevorjs.converter', function () {
46 | return new SirTrevorJsConverter(
47 | new LaravelParser(),
48 | config('sir-trevor-js'),
49 | 'html'
50 | );
51 | });
52 | }
53 |
54 | /**
55 | * Get the services provided by the provider.
56 | */
57 | public function provides(): array
58 | {
59 | return [];
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/config/sir-trevor-js.php:
--------------------------------------------------------------------------------
1 | 'img/uploads',
6 |
7 | // upload url for image
8 | // by default: /sirtrevorjs/upload (the controller of this package)
9 | 'uploadUrl' => null,
10 |
11 | // url for tweet
12 | // by default: /sirtrevorjs/tweet (the controller of this package)
13 | 'tweetUrl' => null,
14 |
15 | // block types for Sir Trevor JS
16 | // by default: ['Text', 'List', 'Quote', 'Image', 'Video', 'Tweet', 'Heading']
17 | 'blocktypes' => [],
18 |
19 | // add custom block for Sir Trevor JS,
20 | //example ['image_extended' => '\App\SirTrevorConverters\ImageExtendedConverter',]
21 | 'customBlocks' => [],
22 |
23 | // language
24 | // the file of translation must be in `locales` directory of your path
25 | 'language' => 'en',
26 |
27 | // path of Sir Trevor JS files from public_path()
28 | 'path' => '/asset/sirtrevorjs/',
29 |
30 | // others stylesheet files path from public_path()
31 | // not files of Sir Trevor JS
32 | 'stylesheet' => [],
33 |
34 | // others javascript files path from public_path()
35 | // not files of Sir Trevor JS
36 | //
37 | // because Sir Trevor JS needs Underscore.js and Eventable.js
38 | 'script' => [
39 | '/asset/underscore-min.1.4.4.js',
40 | '/asset/eventable.js',
41 | ],
42 |
43 | // type of soundcloud
44 | // small or full
45 | 'songcloud' => 'small',
46 |
47 | // Getty Images
48 | 'gettyimages' => [
49 | 'width' => 594,
50 | 'height' => 465,
51 | 'placeholder' => '', // Placeholder image for iframe
52 | ],
53 |
54 | // Images
55 | 'image' => [
56 | 'width' => 520,
57 | 'height' => 200,
58 | ],
59 |
60 | // Embedly
61 | 'embedly' => [
62 | 'card' => [
63 | 'dark' => false,
64 | 'analytics' => false,
65 | ],
66 | ],
67 |
68 | // Spotify
69 | 'spotify' => [
70 | 'width' => 300,
71 | 'height' => 380,
72 | ],
73 |
74 | // View
75 | //'view' => 'sirtrevorjs'
76 |
77 | // Version of Sir Trevor JS
78 | //
79 | // in version '0.3', we include language with SirTrevor.LANGUAGE
80 | // but newer version, we use SirTrevor.config.language
81 | //
82 | // just first two numbers for version
83 | 'version' => '0.4',
84 | ];
85 |
--------------------------------------------------------------------------------
/src/views/amp/embed/iframe.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/embed/iframe.blade.php
--------------------------------------------------------------------------------
/src/views/amp/embedly/card.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/embedly/card.blade.php
--------------------------------------------------------------------------------
/src/views/amp/image/gettyimages.blade.php:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/views/amp/image/image.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/views/amp/image/pin.blade.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/src/views/amp/modelisation/sketchfab.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/modelisation/sketchfab.blade.php
--------------------------------------------------------------------------------
/src/views/amp/presentation/issuu.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/presentation/issuu.blade.php
--------------------------------------------------------------------------------
/src/views/amp/presentation/slideshare.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/presentation/slideshare.blade.php
--------------------------------------------------------------------------------
/src/views/amp/social/facebook.blade.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/src/views/amp/social/tweet.blade.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/src/views/amp/sound/soundcloud/full.blade.php:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/src/views/amp/sound/soundcloud/small.blade.php:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/src/views/amp/video/aol.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/aol.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/cplus.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/cplus.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/dailymailuk.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/dailymailuk.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/dailymotion.blade.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/src/views/amp/video/francetv.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/francetv.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/globalnews.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/globalnews.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/livestream.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/livestream.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/metacafe.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/metacafe.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/metatube.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/metatube.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/mlb.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/mlb.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/nbcbayarea.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/nbcbayarea.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/nhl.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/nhl.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/ooyala.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/ooyala.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/redtube.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/redtube.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/ustream.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/ustream.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/ustreamrecord.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/ustreamrecord.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/veoh.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/veoh.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/vevo.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/vevo.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/vimeo.blade.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/src/views/amp/video/vine.blade.php:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/src/views/amp/video/wat.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/wat.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/yahoo.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/yahoo.blade.php
--------------------------------------------------------------------------------
/src/views/amp/video/youtube.blade.php:
--------------------------------------------------------------------------------
1 |
5 |
6 |
--------------------------------------------------------------------------------
/src/views/amp/video/zoomin.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/amp/video/zoomin.blade.php
--------------------------------------------------------------------------------
/src/views/fb/embed/iframe.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/views/fb/embedly/card.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/embedly/card.blade.php
--------------------------------------------------------------------------------
/src/views/fb/image/gettyimages.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/image/gettyimages.blade.php
--------------------------------------------------------------------------------
/src/views/fb/image/image.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @if (! empty($text))
5 | {!! $text !!}
6 | @endif
7 |
8 |
--------------------------------------------------------------------------------
/src/views/fb/image/pin.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/image/pin.blade.php
--------------------------------------------------------------------------------
/src/views/fb/modelisation/sketchfab.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/modelisation/sketchfab.blade.php
--------------------------------------------------------------------------------
/src/views/fb/presentation/issuu.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/presentation/issuu.blade.php
--------------------------------------------------------------------------------
/src/views/fb/presentation/slideshare.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/presentation/slideshare.blade.php
--------------------------------------------------------------------------------
/src/views/fb/social/facebook.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/src/views/fb/social/tweet.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/src/views/fb/sound/soundcloud/full.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/sound/soundcloud/full.blade.php
--------------------------------------------------------------------------------
/src/views/fb/sound/soundcloud/small.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/sound/soundcloud/small.blade.php
--------------------------------------------------------------------------------
/src/views/fb/sound/spotify.blade.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/src/views/fb/sound/spotify.blade.php
--------------------------------------------------------------------------------
/src/views/fb/text/blockquote.blade.php:
--------------------------------------------------------------------------------
1 |
2 | @if (! empty($cite))
3 | {!! $cite !!}
4 | @endif
5 |
6 | {!! $text !!}
7 |
8 |
--------------------------------------------------------------------------------
/src/views/fb/text/heading.blade.php:
--------------------------------------------------------------------------------
1 | {!! strip_tags($text) !!}
2 |
--------------------------------------------------------------------------------
/src/views/fb/text/text.blade.php:
--------------------------------------------------------------------------------
1 | {!! $text !!}
2 |
--------------------------------------------------------------------------------
/src/views/fb/video/aol.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/base.blade.php:
--------------------------------------------------------------------------------
1 |
2 | @yield('video')
3 |
4 | @if (! empty($caption))
5 | {!! $caption !!}
6 | @endif
7 |
8 |
--------------------------------------------------------------------------------
/src/views/fb/video/cplus.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/dailymailuk.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/dailymotion.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/francetv.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/globalnews.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/livestream.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/metacafe.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/metatube.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/mlb.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
7 |
8 |
9 | @stop
10 |
--------------------------------------------------------------------------------
/src/views/fb/video/nbcbayarea.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/nhl.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/ooyala.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/redtube.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/ustreamrecord.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/veoh.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
10 | @stop
11 |
--------------------------------------------------------------------------------
/src/views/fb/video/vevo.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/vimeo.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/fb/video/vine.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/wat.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/yahoo.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/youtube.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/fb/video/zoomin.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
7 | @stop
8 |
--------------------------------------------------------------------------------
/src/views/html/embed/iframe.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/views/html/embedly/card.blade.php:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/views/html/image/gettyimages.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/src/views/html/image/image.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @if (! empty($text))
5 | {!! $text !!}
6 | @endif
7 |
8 |
--------------------------------------------------------------------------------
/src/views/html/image/pin.blade.php:
--------------------------------------------------------------------------------
1 |
2 | Pin on Pinterest
3 |
4 |
--------------------------------------------------------------------------------
/src/views/html/modelisation/sketchfab.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/src/views/html/presentation/issuu.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/views/html/presentation/slideshare.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/src/views/html/social/facebook.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
--------------------------------------------------------------------------------
/src/views/html/social/tweet.blade.php:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/src/views/html/sound/soundcloud/full.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/views/html/sound/soundcloud/small.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/views/html/sound/spotify.blade.php:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/views/html/text/blockquote.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | {!! $text !!}
4 |
5 | @if ($cite != '')
6 | {!! $cite !!}
7 | @endif
8 |
--------------------------------------------------------------------------------
/src/views/html/text/heading.blade.php:
--------------------------------------------------------------------------------
1 | {!! strip_tags($text) !!}
2 |
--------------------------------------------------------------------------------
/src/views/html/text/text.blade.php:
--------------------------------------------------------------------------------
1 | {!! $text !!}
2 |
--------------------------------------------------------------------------------
/src/views/html/video/aol.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/html/video/base.blade.php:
--------------------------------------------------------------------------------
1 |
2 | @yield('video')
3 |
4 | @if (! empty($caption))
5 | {!! $caption !!}
6 | @endif
7 |
8 |
--------------------------------------------------------------------------------
/src/views/html/video/cplus.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/dailymailuk.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/dailymotion.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/html/video/francetv.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/globalnews.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/html/video/livestream.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/html/video/metacafe.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/metatube.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/mlb.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
7 |
8 |
9 | @stop
10 |
--------------------------------------------------------------------------------
/src/views/html/video/nbcbayarea.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/nhl.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/html/video/ooyala.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/html/video/redtube.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/ustream.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/ustreamrecord.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/veoh.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
10 | @stop
11 |
--------------------------------------------------------------------------------
/src/views/html/video/vevo.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/vimeo.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/vine.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/wat.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
5 | @stop
6 |
--------------------------------------------------------------------------------
/src/views/html/video/yahoo.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/youtube.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
6 | @stop
7 |
--------------------------------------------------------------------------------
/src/views/html/video/zoomin.blade.php:
--------------------------------------------------------------------------------
1 | @extends('sirtrevorjs::html.video.base')
2 |
3 | @section('video')
4 |
7 | @stop
8 |
--------------------------------------------------------------------------------
/src/views/js.blade.php:
--------------------------------------------------------------------------------
1 |
22 |
--------------------------------------------------------------------------------
/test/Caouecs/Tests/Sirtrevorjs/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caouecs/Laravel-SirTrevorJS/3c8780f5cde14ec2402a640ed2a9f2b5b565f9b9/test/Caouecs/Tests/Sirtrevorjs/.gitkeep
--------------------------------------------------------------------------------