本文整理汇总了PHP中pts_strings::last_in_string方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_strings::last_in_string方法的具体用法?PHP pts_strings::last_in_string怎么用?PHP pts_strings::last_in_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_strings
的用法示例。
在下文中一共展示了pts_strings::last_in_string方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read_nvidia_extension
public static function read_nvidia_extension($attribute)
{
// Read NVIDIA's NV Extension
$nv_info = false;
if (pts_client::executable_in_path('nvidia-settings')) {
$info = shell_exec('nvidia-settings --query ' . $attribute . ' 2> /dev/null');
if (($pos = strpos($info, pts_strings::last_in_string($attribute, '/'))) > 0 && strpos($info, 'ERROR:') === false) {
$nv_info = substr($info, strpos($info, '):') + 3);
$nv_info = trim(substr($nv_info, 0, strpos($nv_info, "\n")));
if (substr($nv_info, -1) == '.') {
$nv_info = substr($nv_info, 0, -1);
}
}
}
return $nv_info;
}
示例2: sw_display_server
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);
}
示例3: __startup
public static function __startup()
{
$halt_screensaver = pts_module::read_variable('HALT_SCREENSAVER');
if (!empty($halt_screensaver) && !pts_strings::string_bool($halt_screensaver) || phodevi::read_property('system', 'display-server') == null) {
return pts_module::MODULE_UNLOAD;
}
if (phodevi::is_macosx()) {
// Right now there doesn't appear to be a better way to disable OS X screensaver automatically...
return pts_module::MODULE_UNLOAD;
}
// GNOME Screensaver?
if (($gt = pts_client::executable_in_path('gconftool')) != false || ($gt = pts_client::executable_in_path('gconftool-2')) != false) {
self::$gnome_gconftool = $gt;
}
if (self::$gnome_gconftool != false) {
$is_gnome_screensaver_enabled = trim(shell_exec(self::$gnome_gconftool . ' -g /apps/gnome-screensaver/idle_activation_enabled 2>&1'));
if ($is_gnome_screensaver_enabled == 'true') {
// Stop the GNOME Screensaver
shell_exec(self::$gnome_gconftool . ' --type bool --set /apps/gnome-screensaver/idle_activation_enabled false 2>&1');
self::$gnome2_screensaver_halted = true;
}
$sleep_display_ac = trim(shell_exec(self::$gnome_gconftool . ' -g /apps/gnome-power-manager/timeout/sleep_display_ac 2>&1'));
if ($sleep_display_ac != 0) {
// Don't sleep the display when on AC power
shell_exec(self::$gnome_gconftool . ' --type int --set /apps/gnome-power-manager/timeout/sleep_display_ac 0 2>&1');
self::$sleep_display_ac = $sleep_display_ac;
}
}
if (pts_client::executable_in_path('qdbus')) {
// KDE Screensaver?
$is_kde_screensaver_enabled = trim(shell_exec('qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.GetActive 2>&1'));
if ($is_kde_screensaver_enabled == 'true') {
// Stop the KDE Screensaver
shell_exec('qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity 2>&1');
self::$kde_screensaver_halted = true;
}
}
if (self::$gnome2_screensaver_halted == false && pts_client::executable_in_path('gsettings')) {
// GNOME 3.x Screensaver?
$is_gnome3_screensaver_enabled = trim(shell_exec('gsettings get org.gnome.desktop.session idle-delay 2>&1'));
if (stripos($is_gnome3_screensaver_enabled, 'no such key') === false && pts_strings::last_in_string($is_gnome3_screensaver_enabled) > 0) {
// Stop the GNOME 3.x Screensaver
shell_exec('gsettings set org.gnome.desktop.session idle-delay 0 2>&1');
self::$gnome3_screensaver_halted = pts_strings::last_in_string($is_gnome3_screensaver_enabled);
}
// GNOME 3.x Lock-Screen
$is_gnome3_lockscreen_enabled = trim(shell_exec('gsettings get org.gnome.desktop.lockdown disable-lock-screen 2>&1'));
if (stripos($is_gnome3_lockscreen_enabled, 'no such key') === false && pts_strings::last_in_string($is_gnome3_lockscreen_enabled) == 'false') {
// Stop the GNOME 3.x Lock Screen
shell_exec('gsettings set org.gnome.desktop.lockdown disable-lock-screen true 2>&1');
self::$gnome3_lockscreen_disabled = true;
}
// This GNOME3 GSettings method is deprecated on distributions like GNOME 3.8 with Fedora 19
$is_gnome3_screensaver_enabled_old = trim(shell_exec('gsettings get org.gnome.desktop.screensaver idle-activation-enabled 2>&1'));
if ($is_gnome3_screensaver_enabled_old == 'true') {
// Stop the GNOME 3.x Screensaver
shell_exec('gsettings set org.gnome.desktop.screensaver idle-activation-enabled false 2>&1');
self::$gnome3_screensaver_halted_old = true;
}
// GNOME 3.x Sleep Dispaly?
$is_gnome3_sleep = trim(shell_exec('gsettings get org.gnome.settings-daemon.plugins.power sleep-display-ac 2>&1'));
if ($is_gnome3_sleep > 0) {
// Stop the GNOME 3.x Display Sleep
shell_exec('gsettings set org.gnome.settings-daemon.plugins.power sleep-display-ac 0 2>&1');
self::$sleep_display_ac = $is_gnome3_sleep;
}
}
if (pts_client::executable_in_path('xfconf-query')) {
$is_xfce_screensaver_enabled = stripos(shell_exec('xfconf-query -c xfce4-session -p /startup/screensaver/enabled 2>&1'), 'false') !== false;
if ($is_xfce_screensaver_enabled) {
shell_exec('xfconf-query -c xfce4-session -n -t bool -p /startup/screensaver/enabled -s false 2>&1');
self::$xfce_screensaver_halted = true;
}
}
if (getenv('DISPLAY') != false && (self::$xset = pts_client::executable_in_path('xset'))) {
shell_exec('xset s off 2>&1');
} else {
if (getenv('DISPLAY') == false && pts_client::executable_in_path('setterm')) {
shell_exec('setterm -powersave off -blank 0 2>&1');
}
}
if (self::$gnome2_screensaver_halted || self::$gnome3_screensaver_halted || self::$gnome3_screensaver_halted_old || self::$kde_screensaver_halted || self::$xfce_screensaver_halted) {
self::$screensaver_halted = true;
}
if (($xdg = pts_client::executable_in_path('xdg-screensaver')) == false) {
self::$xdg_screensaver_available = $xdg;
}
if ($xscreensaver = pts_client::executable_in_path('xscreensaver-command')) {
shell_exec($xscreensaver . ' -exit 2>&1');
}
}