HEX
Server: Apache
System: Linux cpanelx.inxs.ro 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: crowdandsafety (1041)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/cornerstone/includes/admin/CornerstoneViewDetailsFix.php
<?php

// Script to remove the "View Details" which conflicts with another Cornerstone plugin
add_action("admin_enqueue_scripts", function($hook) {

  // Not the plugins page
  if ($hook !== "plugins.php") {
    return;
  }

  // Main script
  $script = <<<JAVASCRIPT
// Change view details to redirect to Cornerstone Page
window.addEventListener("load", function() {

  // Plugin details modal link class
  const selected = document.querySelectorAll(".open-plugin-details-modal");

  // Loop all
  for(var i = 0; i < selected.length; ++i) {
    const el = selected[i];

    // not the cornerstone plugin
    if (el.href.indexOf("plugin=cornerstone&") === -1) {
      continue;
    }

    // On click overwrite page
    el.href = "https://theme.co/cornerstone";
    el.target = "_blank";
    el.rel = "noopener noreferrer";

    el.addEventListener("click", function(e) {
      e.preventDefault();
      window.open("https://theme.co/cornerstone", '_blank').focus();
      setTimeout(function() {
        document.getElementById('TB_closeWindowButton').click();
      }, 1000);
    });
  }

});

JAVASCRIPT;

  echo "<script>\n{$script}</script>";

});