示例#1
0
<?php

require '/usr/local/lib/Hoa/Core/Core.php';
from('Hoa')->import('Console.Processus')->import('Console.Window');
$windowSize = Hoa\Console\Window::getSize();
$screenSize = array('x' => 0, 'y' => 0);
if (null !== ($osascript = Hoa\Console\Processus::locate('osascript'))) {
    $handle = Hoa\Console\Processus::execute($osascript . ' -e \'tell application "Finder" to get bounds of window of desktop\'', false);
    list(, , $screenSize['x'], $screenSize['y']) = preg_split('#\\s*,\\s*#', $handle);
} elseif (null !== ($xwininfo = Hoa\Console\Processus::locate('xwininfo'))) {
    preg_match('#\\-geometry (\\d+)x(\\d+)#m', Hoa\Console\Processus::execute($xwininfo . ' -root'), $matches);
    list(, $screenSize['x'], $screenSize['y']) = $matches;
}
Hoa\Console\Window::setSize(89, 26);
Hoa\Console\Window::moveTo(212, 174);
示例#2
0
文件: index.php 项目: Grummfy/Central
                    break;
            }
            $uri .= implode('/', $tails);
        }
    }
    $http->sendStatus($http::STATUS_MOVED_PERMANENTLY);
    $http->sendHeader('Location', $uri);
    return;
})->get('s', '/State/(?<library>[\\w ]+)', function ($library, $_request) {
    $Library = ucfirst(strtolower($library));
    $http = new Hoa\Http\Response\Response();
    if (false === file_exists('hoa://Library/' . $Library)) {
        $http->sendStatus($http::STATUS_NOT_FOUND);
        return;
    }
    $status = Hoa\Console\Processus::execute('hoa devtools:state ' . $library);
    if (empty($status)) {
        $http->sendStatus($http::STATUS_INTERNAL_SERVER_ERROR);
        return;
    }
    if (isset($_request['format'])) {
        if ('raw' !== $_request['format']) {
            $http->sendStatus($http::STATUS_NOT_ACCEPTABLE);
            return;
        }
        $http->sendHeader('Content-Type', 'text/plain');
        echo $status;
        return;
    }
    $http->sendHeader('Content-Type', 'image/svg+xml');
    echo file_get_contents(__DIR__ . DS . 'Badges' . DS . 'Image' . DS . ucfirst($status) . '.svg');