From 2a6c2d5386c8848a4ff4963580d0ee81617de741 Mon Sep 17 00:00:00 2001 From: FarbodZamani <53179227+ferishili@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:47:58 +0100 Subject: [PATCH] Fix: replace pure php 8 functions, fixes #359 (#360) --- block_opencast.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block_opencast.php b/block_opencast.php index 90f95a34..a1beb16c 100644 --- a/block_opencast.php +++ b/block_opencast.php @@ -214,7 +214,8 @@ public function get_content_for_output($output) { // We filter the controls to find the delete action link. $deleteactionfiltered = array_filter($bc->controls, function ($actionlink) { - return str_contains($actionlink->attributes['class'], 'editing_delete'); + // Using strpos in order to make the plugin PHP 7 backward compatible. + return strpos($actionlink->attributes['class'], 'editing_delete') !== false; }); // In case the delete action link could be found, we try to replace its properties. @@ -225,7 +226,8 @@ public function get_content_for_output($output) { // Delete all modal-related attributes. if (isset($deleteaction->attributes)) { foreach ($deleteaction->attributes as $k => $v) { - if (str_starts_with($k, 'data-modal')) { + // Using substr in order to make the plugin PHP 7 backward compatible. + if (substr($k, 0, 10) === 'data-modal') { unset($deleteaction->attributes[$k]); } }