swisnl/avg-safe-iframes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

swisnl/avg-safe-iframes

Composer 安装命令:

composer require swisnl/avg-safe-iframes

包简介

Fix iframe elements in order to comply to AVG

README 文档

README

Run Status

This package will look for <iframe>-elements in a HTML-snippet, and "fix" it in order to play nicely with our cookiebar.

Install

composer require swisnl/avg-safe-iframes

What it does

  1. Replace the src-attribute with data-src (so the iframe won't load right away)
  2. Adds a class to the element (cookie-settings-*), so the cookiebar knows if it complies with the users preferences. The default class is for tracking-cookies.

How to use it

Via the class:

$avgSafeIframe = new \Swis\AvgSafeIframes\AvgSafeIframes();

$text = '<div><iframe class="foo-bar" src="http:///www.example.com"></iframe></div>';

return $avgSafeIframe->fix($text);

// <div><iframe class="foo-bar cookie-settings-tracking" data-src="http:///www.example.com"></iframe></div>

Via the helper (in a blade-template, for example):

{!! safeAvgIframes($text) !!}

In both scenario's, you could provide a second parameter to add a different class. Please use one of the AvgSafeIframes::MODE*_ constants:

  • MODE_TRACKING
  • MODE_STATS
  • MODE_STATS_AND_TRACKING

Todo

  • Add a (Laravel) middleware so you won't have to manually use the helper

统计信息

  • 总下载量: 2.07k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固