/**
  * Get name of downloaded MODX directory (e.g., modx-3.4.0-pl).
  *
  * @param $tempDir string - temporary download directory
  * @return string - Name of directory
  */
 public static function getModxDir($tempDir)
 {
     $handle = opendir($tempDir);
     if ($handle !== false) {
         while (false !== ($name = readdir($handle))) {
             if ($name != "." && $name != "..") {
                 $dir = $name;
             }
         }
         closedir($handle);
     } else {
         MODXInstaller::quit('Unable to read directory contents or directory is empty: ' . dirname(__FILE__) . '/temp');
     }
     if (empty($dir)) {
         MODXInstaller::quit('Unknown error reading /temp directory');
     }
     return $dir;
 }
 public static function quit($msg)
 {
     $begin = '<div style="margin:auto;margin-top:100px;width:40%;height:80px;padding:30px;color:red;border:3px solid darkgray;text-align:center;background-color:rgba(160, 233, 174, 0.42);border-radius:15px;box-shadow: 10px 10px 5px #888888;"><p style="font-size: 14pt;">';
     $end = '</p><p style="margin-bottom:120px;"><a href="' . MODX_MANAGER_URL . '">Back to Manager</a></p></div>';
     MODXInstaller::quit($begin . $msg . $end);
 }