├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets ├── css │ └── mediaembed.css ├── js │ └── mediaembed.js ├── logo.png └── screenshot.png ├── blueprints.yaml ├── classes ├── Autoloader.php ├── MediaEmbed.php ├── OEmbed │ ├── OEmbed.php │ ├── OEmbedInterface.php │ ├── OEmbedLink.php │ ├── OEmbedPhoto.php │ ├── OEmbedRich.php │ └── OEmbedVideo.php ├── ProviderInterface.php ├── Service.php ├── ServiceProvider.php └── Services │ ├── Github.php │ ├── Slides.php │ └── Twitter.php ├── docs ├── CONTRIBUTING.md └── INSTALL.md ├── hebe.json ├── mediaembed.php ├── mediaembed.yaml ├── templates └── partials │ └── mediaembed.html.twig └── vendor └── Requests ├── .coveralls.yml ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin └── create_pear_package.php ├── composer.json ├── docs ├── README.md ├── authentication-custom.md ├── authentication.md ├── goals.md ├── hooks.md ├── proxy.md ├── usage-advanced.md ├── usage.md └── why-requests.md ├── examples ├── basic-auth.php ├── get.php ├── multiple.php ├── post.php ├── proxy.php ├── session.php └── timeout.php ├── library ├── Requests.php └── Requests │ ├── Auth.php │ ├── Auth │ └── Basic.php │ ├── Cookie.php │ ├── Cookie │ └── Jar.php │ ├── Exception.php │ ├── Exception │ ├── HTTP.php │ └── HTTP │ │ ├── 400.php │ │ ├── 401.php │ │ ├── 402.php │ │ ├── 403.php │ │ ├── 404.php │ │ ├── 405.php │ │ ├── 406.php │ │ ├── 407.php │ │ ├── 408.php │ │ ├── 409.php │ │ ├── 410.php │ │ ├── 411.php │ │ ├── 412.php │ │ ├── 413.php │ │ ├── 414.php │ │ ├── 415.php │ │ ├── 416.php │ │ ├── 417.php │ │ ├── 418.php │ │ ├── 428.php │ │ ├── 429.php │ │ ├── 431.php │ │ ├── 500.php │ │ ├── 501.php │ │ ├── 502.php │ │ ├── 503.php │ │ ├── 504.php │ │ ├── 505.php │ │ ├── 511.php │ │ └── Unknown.php │ ├── Hooker.php │ ├── Hooks.php │ ├── IDNAEncoder.php │ ├── IPv6.php │ ├── IRI.php │ ├── Proxy.php │ ├── Proxy │ └── HTTP.php │ ├── Response.php │ ├── Response │ └── Headers.php │ ├── SSL.php │ ├── Session.php │ ├── Transport.php │ ├── Transport │ ├── cURL.php │ ├── cacert.pem │ └── fsockopen.php │ └── Utility │ ├── CaseInsensitiveDictionary.php │ └── FilteredIterator.php ├── package.xml.tpl └── tests ├── Auth └── Basic.php ├── ChunkedEncoding.php ├── Cookies.php ├── Encoding.php ├── IDNAEncoder.php ├── IRI.php ├── Requests.php ├── Response └── Headers.php ├── SSL.php ├── Session.php ├── Transport ├── Base.php ├── cURL.php └── fsockopen.php ├── bootstrap.php └── phpunit.xml.dist /.gitignore: -------------------------------------------------------------------------------- 1 | assets/logo.svg 2 | *.xcf 3 | .idea 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v1.3.0 2 | ## 02/05/2017 3 | 4 | 1. [](#new) 5 | * Added support image or link for not embed media (Thanks to [@magikcypres](https://github.com/magikcypress)) 6 | * Added support for **Twitter.com** (Thanks to [@magikcypres](https://github.com/magikcypress)) 7 | 2. [](#bugfix) 8 | * Fixed support for **Github** (Thanks to [@magikcypres](https://github.com/magikcypress)) 9 | * Fixed partial bug [#9](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/9) (Mediaembed converts images into images) 10 | * Fixed [#15](https://github.com/Sommerregen/grav-plugin-mediaembed/pull/15) (Fixed `media.responsive`) 11 | * Fixed [#25](https://github.com/Sommerregen/grav-plugin-mediaembed/pull/25) (Fix Admin Panel issues [#13](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/13), [#17](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/17), and [#24](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/24)) 12 | 13 | # v1.2.0 14 | ## 08/08/2015 15 | 16 | 1. [](#new) 17 | * Added admin configurations **(requires Grav 0.9.34+)** 18 | 2. [](#improved) 19 | * Updated `README.md` 20 | 21 | # v1.1.0 22 | ## 05/17/2015 23 | 24 | 1. [](#new) 25 | * Added support for **Slides.com SlideDesk** as requested in issue [#4](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/4) 26 | 2. [](#improved) 27 | * Assets checks (in rare cases it was possible that MediaEmbed throws an error) 28 | 29 | # v1.0.2 30 | ## 05/10/2015 31 | 32 | 1. [](#new) 33 | * Added plugin roadmap 34 | * Added support for modular pages 35 | 2. [](#improved) 36 | * Prevent potential division by zero error [#2](https://github.com/Sommerregen/grav-plugin-mediaembed/pull/2) 37 | 3. [](#bugfix) 38 | * Fixed link generation in case no MediaEmbed service is found 39 | 40 | # v1.0.1 41 | ## 04/28/2015 42 | 43 | 3. [](#bugfix) 44 | * Fixed issue [#1](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/1) with broken MediaEmbed functionality (i.e. removed test code) 45 | 46 | # v1.0.0 47 | ## 04/26/2015 48 | 49 | 1. [](#new) 50 | * ChangeLog started... 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [![Grav MediaEmbed Plugin](assets/logo.png)][project] 2 | 3 | [![Release](https://img.shields.io/github/release/sommerregen/grav-plugin-mediaembed.svg)][project] [![Issues](https://img.shields.io/github/issues/sommerregen/grav-plugin-mediaembed.svg)][issues] [![Dual license](https://img.shields.io/badge/dual%20license-MIT%2FGPL-blue.svg)](LICENSE "License") [![Flattr](https://api.flattr.com/button/flattr-badge-large.png)][flattr] [![PayPal](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)][paypal] 4 | 5 | > This plugin embeds several media sites (e.g. YouTube, Vimeo, Soundcloud) by only providing the URL to the medium. 6 | 7 | ##### Table of Contents: 8 | 9 | * [About](#about) 10 | * [Installation and Updates](#installation-and-updates) 11 | * [Usage](#usage) 12 | * [Contributing](#contributing) 13 | * [License](#license) 14 | 15 | ## Project Information: 16 | 17 | **This plugin is outdated. It does not work with Grav v1.x.x+ and cannot be administrated via Admin plugin without any problems. If you like this project, any help, pull request, or ideas are much appreciated.** 18 | 19 | **Status:** Seeking co-maintainer(s), Maintenance fixes only 20 | 21 | ## About 22 | 23 | Grav MediaEmbed plugin is the official successor of [Grav VideoEmbed plugin](https://github.com/sommerregen/grav-plugin-videoembed/), allows to embed several media sites by only providing the URL to the medium and supports lazy loading techniques for videos and other media. Currently it supports 24 | 25 | - YouTube 26 | - Vimeo 27 | - DailyMotion 28 | - SoundCloud 29 | - Spotify 30 | - Flickr 31 | - Imgur 32 | - Instagram 33 | - GitHub 34 | - Twitter 35 | 36 | but more services are coming soon! In principle it supports any service, which provides the [oEmbed format](http://www.oembed.com/). Media are embedded using the Markdown syntax for images (`![Alt](URL "Title")`), e.g. the below screenshot was created with the following code: 37 | 38 | ``` 39 | ![](https://www.flickr.com/photos/chris_gin/6585842063) 40 | ``` 41 | 42 | ![Screenshot MediaEmbed Plugin](assets/screenshot.png "MediaEmbed Preview") 43 | 44 | ### The Roadmap 45 | 46 | Grav MediaEmbed plugin is neat and a powerful tool to embed other media types. However at the moment only a few services are supported. Further the configuration for the services may differ under certain circumstances; some may be more configurable than others. In future releases I intend to implement: 47 | 48 | - [ ] a unified interface for accessing [OEmbed](http://oembed.com "An overview about OEmbed services") services 49 | - [ ] a cache mechanism for requests, data and images 50 | - [ ] support more than 200+ OEmbed services 51 | - [ ] and a more powerful API 52 | 53 | If you have any ideas to extend the list, then please don't hesitate to open an issue and spread your idea with the community! 54 | 55 | So far I'm happy that Grav MediaEmbed plugin becomes one of the most popular a d used plugins in a few days. Thank you! I try to give my best to provide you a fast, easy to use and extensible plugin. I have already spent a lot of time and will spend a lot of time even more. The plan is to extend Grav MediaEmbed plugin even more to embed arbitrary websites and embed media as cards (e.g. Wordpress, Twitter, Facebook, GitHub). This will however mean a many hour work and thus I plan to support such features in a paid version of Grav MediaEmbed plugin called "MediaEmbed Pro", which will coming soon. From then on, Grav MediaEmbed plugin will come in two flavors: a free version supporting all OEmbed services and a paid version with better embedding support of media and enabling the use of embed media cards. 56 | 57 | ## Installation and Updates 58 | 59 | Installing or updating the `MediaEmbed` plugin can be done in one of two ways. Using the GPM (Grav Package Manager) installation update method (i.e. `bin/gpm install mediaembed`) or manual install by downloading [this plugin](https://github.com/sommerregen/grav-plugin-mediaembed) and extracting all plugin files to 60 | 61 | user/plugins/mediaembed 62 | 63 | For more informations, please check the [Installation and update guide](docs/INSTALL.md). 64 | 65 | ## Usage 66 | 67 | The `MediaEmbed` plugin comes with some sensible default configuration, that are pretty self explanatory: 68 | 69 | ### Config Defaults 70 | 71 | ```yaml 72 | # Global plugin configurations 73 | 74 | enabled: true # Set to false to disable this plugin completely 75 | built_in_css: true # Use built-in CSS of the plugin 76 | built_in_js: true # Use built-in JS of the plugin 77 | 78 | # Default options for MediaEmbed configuration. 79 | 80 | # -- Media -- 81 | media: 82 | width: 640 # Default media width 83 | height: 390 # Default media height including controls 84 | adjust: true # Adjust media or keep default dimensions? 85 | 86 | preview: true # Show or hide media preview 87 | responsive: false # Allow media to be responsive 88 | protocol: "http://" # Default protocol for remote media resources 89 | 90 | services: 91 | : 92 | enabled: true # Set to false to disable this service completely 93 | type: # Type of the media service 94 | 95 | # URL of media service used for embedding 96 | url: "www.domain.com/embed/{:id}" 97 | 98 | # Canonical URL of media service (used in endpoint calls) 99 | canonical: "http://www.domain.com/{:id}" 100 | 101 | # Endpoint to grab media informations 102 | endpoint: "http://www.domain.com/oembed?url={:canonical}&format=json" 103 | 104 | # Regex filters ("~REGEX~i") to grab media id 105 | schemes: 106 | - "domain.com/*" 107 | 108 | # Custom service-related media option overrides 109 | params: 110 | : 111 | ``` 112 | 113 | If you need to change any value, then the best process is to copy the [mediaembed.yaml](mediaembed.yaml) file into your `users/config/plugins/` folder (create it if it doesn't exist), and then modify there. This will override the default settings. 114 | 115 | ## Contributing 116 | 117 | You can contribute at any time! Before opening any issue, please search for existing issues and review the [guidelines for contributing](docs/CONTRIBUTING.md). 118 | 119 | After that please note: 120 | 121 | * If you find a bug, would like to make a feature request or suggest an improvement, [please open a new issue][issues]. If you have any interesting ideas for additions to the syntax please do suggest them as well! 122 | * Feature requests are more likely to get attention if you include a clearly described use case. 123 | * If you wish to submit a pull request, please make again sure that your request match the [guidelines for contributing](docs/CONTRIBUTING.md) and that you keep track of adding unit tests for any new or changed functionality. 124 | 125 | ### Support and donations 126 | 127 | If you like my project, feel free to support me via [![Flattr](https://api.flattr.com/button/flattr-badge-large.png)][flattr] or by sending me some bitcoins to [**1HQdy5aBzNKNvqspiLvcmzigCq7doGfLM4**][bitcoin]. 128 | 129 | Thanks! 130 | 131 | ## License 132 | 133 | Copyright (c) 2015-2017 [Benjamin Regler][github]. See also the list of [contributors] who participated in this project. 134 | 135 | [Dual-licensed](LICENSE) for use under the terms of the [MIT][mit-license] or [GPLv3][gpl-license] licenses. 136 | 137 | ![GNU license - Some rights reserved][gnu] 138 | 139 | [github]: https://github.com/sommerregen/ "GitHub account from Benjamin Regler" 140 | [gpl-license]: http://opensource.org/licenses/GPL-3.0 "GPLv3 license" 141 | [mit-license]: http://www.opensource.org/licenses/mit-license.php "MIT license" 142 | 143 | [flattr]: https://flattr.com/submit/auto?user_id=Sommerregen&url=https://github.com/sommerregen/grav-plugin-mediaembed "Flatter my GitHub project" 144 | [paypal]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SYFNP82USG3RN "Donate for my GitHub project using PayPal" 145 | [bitcoin]: bitcoin:1HQdy5aBzNKNvqspiLvcmzigCq7doGfLM4?label=GitHub%20project "Donate for my GitHub project using BitCoin" 146 | [gnu]: https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/License_icon-gpl-88x31.svg/88px-License_icon-gpl-88x31.svg.png "GNU license - Some rights reserved" 147 | 148 | [project]: https://github.com/sommerregen/grav-plugin-mediaembed 149 | [issues]: https://github.com/sommerregen/grav-plugin-mediaembed/issues "GitHub Issues for Grav MediaEmbed Plugin" 150 | [contributors]: https://github.com/sommerregen/grav-plugin-mediaembed/graphs/contributors "List of contributors of the project" 151 | -------------------------------------------------------------------------------- /assets/js/mediaembed.js: -------------------------------------------------------------------------------- 1 | function lazyload(anchor) { 2 | setTimeout(function () { 3 | // Strip comment tags around innerHTML 4 | anchor.innerHTML = anchor.innerHTML.replace('', ''); 5 | }, 1000); 6 | 7 | // Remove