Skip to content

Commit

Permalink
Fix: replace pure php 8 functions, fixes #359 (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili authored Feb 28, 2024
1 parent 8c00eec commit 2a6c2d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions block_opencast.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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]);
}
}
Expand Down

0 comments on commit 2a6c2d5

Please sign in to comment.