public static function sw_display_server()
 {
     $display_servers = array();
     if (phodevi::is_windows()) {
         // TODO: determine what to do for Windows support
     } else {
         if (pts_client::is_process_running('weston')) {
             $info = 'Wayland Weston';
             $vinfo = trim(shell_exec('weston --version 2>&1'));
             if (pts_strings::last_in_string($vinfo) && pts_strings::is_version(pts_strings::last_in_string($vinfo))) {
                 $info .= ' ' . pts_strings::last_in_string($vinfo);
             }
             array_push($display_servers, $info);
         }
         if (pts_client::is_process_running('unity-system-compositor')) {
             $unity_system_comp = trim(str_replace('unity-system-compositor', null, shell_exec('unity-system-compositor --version 2>&1')));
             if (pts_strings::is_version($unity_system_comp)) {
                 array_push($display_servers, 'Unity-System-Compositor ' . $unity_system_comp);
             }
         }
         if (($x_bin = is_executable('/usr/libexec/Xorg.bin') ? '/usr/libexec/Xorg.bin' : false) || ($x_bin = pts_client::executable_in_path('Xorg')) || ($x_bin = pts_client::executable_in_path('X'))) {
             // Find graphics subsystem version
             $info = shell_exec($x_bin . ' ' . (phodevi::is_solaris() ? ':0' : '') . ' -version 2>&1');
             $pos = ($p = strrpos($info, 'Release Date')) !== false ? $p : strrpos($info, 'Build Date');
             $info = trim(substr($info, 0, $pos));
             if ($pos === false || getenv('DISPLAY') == false) {
                 $info = null;
             } else {
                 if (($pos = strrpos($info, '(')) === false) {
                     $info = trim(substr($info, strrpos($info, ' ')));
                 } else {
                     $info = trim(substr($info, strrpos($info, 'Server') + 6));
                 }
             }
             if ($info != null) {
                 array_push($display_servers, 'X Server ' . $info);
             }
         }
         if (pts_client::is_process_running('surfaceflinger')) {
             array_push($display_servers, 'SurfaceFlinger');
         }
         if (pts_client::is_process_running('gnome-shell-wayland')) {
             array_push($display_servers, 'GNOME Shell Wayland');
         }
     }
     return implode(' + ', $display_servers);
 }
 public static function process_running_string($process_arr)
 {
     // Format a nice string that shows processes running
     $p = array();
     $p_string = null;
     $process_arr = pts_arrays::to_array($process_arr);
     foreach ($process_arr as $p_name => $p_processes) {
         foreach ($p_processes as $process) {
             if (pts_client::is_process_running($process)) {
                 $p[] = $p_name;
             }
         }
     }
     $p = array_keys(array_flip($p));
     if (($p_count = count($p)) > 0) {
         for ($i = 0; $i < $p_count; $i++) {
             $p_string .= $p[$i];
             if ($i != $p_count - 1 && $p_count > 2) {
                 $p_string .= ',';
             }
             $p_string .= ' ';
             if ($i == $p_count - 2) {
                 $p_string .= 'and ';
             }
         }
         $p_string .= $p_count == 1 ? 'was' : 'were';
         $p_string .= ' running on this system';
     }
     return $p_string;
 }