diff --git a/libraries/src/HTML/Helpers/JGrid.php b/libraries/src/HTML/Helpers/JGrid.php index a68a32a41fb56..a8660bd6df927 100644 --- a/libraries/src/HTML/Helpers/JGrid.php +++ b/libraries/src/HTML/Helpers/JGrid.php @@ -90,41 +90,42 @@ public static function action($i, $task, $prefix = '', $active_title = '', $inac $html[] = $tip ? ' aria-labelledby="' . $ariaid . '"' : ''; $html[] = '>'; - if (strpos($active_class, 'fa-') !== false) + switch ($active_class) { - $active_class = 'fas ' . $active_class; - } - elseif (strpos($active_class, 'icon-') !== false) - { - $active_class = $active_class; - } - elseif ($active_class === 'publish') - { - $active_class = 'fas fa-check'; - } - elseif ($active_class === 'unpublish') - { - $active_class = 'fas fa-times'; - } - elseif ($active_class === 'archive') - { - $active_class = 'fas fa-folder'; - } - elseif ($active_class === 'checkedout') - { - $active_class = 'fas fa-lock'; - } - elseif ($active_class === 'unfeatured') - { - $active_class = 'fas fa-star'; - } - elseif ($active_class === 'featured') - { - $active_class = 'fas fa-star featured'; - } - else - { - $active_class = 'icon-' . $active_class; + case (strpos($active_class, 'fa-') !== false): + $active_class = 'fas ' . $active_class; + break; + + case (strpos($active_class, 'icon-') !== false): + break; + + case 'publish': + $active_class = 'fas fa-check'; + break; + + case 'unpublish': + $active_class = 'fas fa-times'; + break; + + case 'archive': + $active_class = 'fas fa-folder'; + break; + + case 'checkedout': + $active_class = 'fas fa-lock'; + break; + + case 'unfeatured': + $active_class = 'fas fa-star'; + break; + + case 'featured': + $active_class = 'fas fa-star featured'; + break; + + default: + $active_class = 'icon-' . $active_class; + break; } $html[] = ''; @@ -137,52 +138,47 @@ public static function action($i, $task, $prefix = '', $active_title = '', $inac $html[] = $tip ? ' aria-labelledby="' . $ariaid . '"' : ''; $html[] = '>'; - if ($active_class === 'protected') - { - $html[] = ''; - } - else + switch ($inactive_class) { - if (strpos($inactive_class, 'fa-') !== false) - { + case (strpos($inactive_class, 'fa-') !== false): $inactive_class = 'fas ' . $inactive_class; - } - elseif (strpos($inactive_class, 'icon-') !== false) - { - $inactive_class = $inactive_class; - } - elseif ($inactive_class === 'publish') - { + break; + + case (strpos($inactive_class, 'icon-') !== false): + break; + + case 'publish': $inactive_class = 'fas fa-check'; - } - elseif ($inactive_class === 'unpublish') - { + break; + + case 'unpublish': $inactive_class = 'fas fa-times'; - } - elseif ($inactive_class === 'archive') - { + break; + + case 'archive': $inactive_class = 'fas fa-folder'; - } - elseif ($inactive_class === 'checkedout') - { + break; + + case 'checkedout': + case 'protected': $inactive_class = 'fas fa-lock'; - } - elseif ($inactive_class === 'unfeatured') - { + break; + + case 'unfeatured': $inactive_class = 'fas fa-star'; - } - elseif ($inactive_class === 'featured') - { + break; + + case 'featured': $inactive_class = 'fas fa-star featured'; - } - else - { - $inactive_class = 'icon-' . $inactive_class; - } + break; - $html[] = ''; + default: + $inactive_class = 'icon-' . $inactive_class; + break; } + $html[] = ''; + $html[] = ''; $html[] = $tip ? '' : ''; }