Commit f868e570 authored by Doris Tam's avatar Doris Tam
Browse files

Bug 1926388: Update regex (Sheets) in Google Apps block

Change-Id: I5241863a7a2ef96d6b7d17758e002dbaa76774f1
parent 85e3b0ec
......@@ -244,6 +244,15 @@ class PluginBlocktypeGoogleApps extends MaharaCoreBlocktype {
'url' => $httpstr . '://docs.google.com/$1document/d/$2/pub?embedded=true',
'type' => 'iframe',
),
// https://docs.google.com/spreadsheets/d/e/ (updated on July 2021)
// $1 - domain, e.g. /a/domainname/
// $2 - url extras
// $3 - id, key, etc. of the document
array(
'match' => '#.*docs.google.com\/([a-zA-Z0-9\_\-\.]*)spreadsheets([a-zA-Z0-9\/]*)\/d\/e\/([a-zA-Z0-9\_\-\/]+).*#',
'url' => $httpstr . '://docs.google.com/$1spreadsheets$2/d/e/$3',
'type' => 'iframe',
),
// docs.google.com/spreadsheets - Google document (updated on Mar 2015)
// $1 - domain, e.g. /a/domainname/
// $2 - id, key, etc. of the spreadsheet
......@@ -373,8 +382,8 @@ class PluginBlocktypeGoogleApps extends MaharaCoreBlocktype {
),
);
$url = htmlspecialchars_decode($url); // convert & back to &, etc.
foreach ($embedsources as $source) {
$url = htmlspecialchars_decode($url); // convert & back to &, etc.
if (preg_match($source['match'], $url)) {
if (is_string($source['url'])) {
$apps_url = preg_replace($source['match'], $source['url'], $url);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment