Skip to content

Instantly share code, notes, and snippets.

@scott1702
scott1702 / CustomEmbedShortcodeProvider.php
Created November 20, 2020 00:41
Manually convert youtube links to iframe to prevent calls from to youtube
<?php
namespace App\View;
use Psr\Log\LoggerInterface;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\View\Shortcodes\EmbedShortcodeProvider;
class CustomEmbedShortcodeProvider extends EmbedShortcodeProvider
@scott1702
scott1702 / CustomEmbedShortcodeProvider.php
Created January 21, 2020 03:14
Embedded content errors taking down pages
<?php
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\View\Shortcodes\EmbedShortcodeProvider;
class CustomEmbedShortcodeProvider extends EmbedShortcodeProvider
{
/**
* Override handle_shortcode to catch errors from embedded content (e.g. rate limited by Youtube).
@scott1702
scott1702 / CustomBasicAuthMiddleware.php
Last active May 20, 2020 05:35
Whitelist Swiftype by User Agent, based on implementation from https://github.com/silverstripe/cwp-core
<?php
namespace App\Security;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Security\BasicAuthMiddleware;
class CustomBasicAuthMiddleware extends BasicAuthMiddleware
{
/**