本文整理汇总了PHP中X_Env::isWindows方法的典型用法代码示例。如果您正苦于以下问题:PHP X_Env::isWindows方法的具体用法?PHP X_Env::isWindows怎么用?PHP X_Env::isWindows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X_Env
的用法示例。
在下文中一共展示了X_Env::isWindows方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lazyInit
/**
* Execute vlcwrapper initialization on the first request
*/
private function lazyInit()
{
if ($this->_initialized === false) {
$options = $this->options;
$adapterConf = $options->get('adapter', new Zend_Config(array()));
$adapter = $adapterConf->get('name', "X_Vlc_Adapter_" . (X_Env::isWindows() ? 'Windows' : 'Linux'));
X_Debug::i("Adapter: {$adapter}");
$this->adapter = new $adapter($options);
$commanderConf = $options->get('commander', new Zend_Config(array()));
$commander = $commanderConf->get('name', '');
$commanderPath = $commanderConf->get('path', '');
if ($commanderPath != '' && file_exists($commanderPath)) {
X_Debug::i("Including commanderPath: {$commanderPath}");
include_once $commanderPath;
}
if (class_exists($commander, true) && array_key_exists('X_Vlc_Commander', class_parents($commander))) {
X_Debug::i("Commander: {$commander}");
$commander = new $commander($options);
$this->adapter->setCommander($commander);
} else {
X_Debug::w("Commander: no selection");
}
$this->_conf_vlcArgs = $options->get('args', "{%source%} --play-and-exit --sout=\"#{%profile%}:{%output%}\" --sout-keep {%subtitles%} {%audio%} {%filters%}");
$this->_conf_vlcPath = $options->get('path', "vlc");
$this->_initialized = true;
}
}
示例2: startEngine
public function startEngine(X_Threads_Thread $thread)
{
// assume all parameters are ready
$thread->log("Spawning RTMPDump (rtmpdump-weebtv | vlc)...");
$source = $this->getParam('source');
// set the path
if (X_Env::isWindows()) {
X_RtmpDumpWeebTv::getInstance()->setPath(APPLICATION_PATH . '/../bin/rtmpdump-weebtv-win/rtmpdump-weebtv.exe');
} else {
X_RtmpDumpWeebTv::getInstance()->setPath(APPLICATION_PATH . '/../bin/rtmpdump-weebtv-linux/rtmpdump-weebtv');
}
$weebPlugin = X_VlcShares_Plugins::broker()->getPlugins('weebtv');
if ($weebPlugin instanceof X_VlcShares_Plugins_WeebTv && X_VlcShares_Plugins::helpers()->streamer()->isRegistered('vlc')) {
// try to get reference to vlc-streamer
/* @var $vlcStreamer X_Streamer_Engine_Vlc */
$vlcStreamer = X_VlcShares_Plugins::helpers()->streamer()->get('vlc');
// get the channel id
$source = substr($source, strlen('rtmpdump-weebtv://'));
// make the plugin to parse params from server and build a rtmpdump-weebtv uri
$source = $weebPlugin->getLinkParams($source);
// always live
$command = (string) X_RtmpDumpWeebTv::getInstance()->parseUri($source);
$vlcStreamer->getVlcWrapper()->setPipe($command);
$vlcStreamer->setSource('-');
$vlcStreamer->setParam('profile', "#std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:{$weebPlugin->getStreamingPort()}/stream}");
// redirect std error to null
// and force quite
//X_Env::execute("$command -q 2> /dev/null", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
//X_Env::execute($command, X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
$vlcStreamer->getVlcWrapper()->spawn();
$thread->log("RTMPDump execution finished");
} else {
$thread->log("RTMPDump-weebtv cannot be started without weebtv plugin and vlc streamer");
}
}
示例3: forceKill
public function forceKill()
{
if (!X_Env::isWindows()) {
X_Env::execute("kill -9 `ps aux | grep {$this->path} | grep -v grep | awk '{print \$2}'`", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
} else {
X_Env::execute("taskkill /IM SopCast.exe /F", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
}
}
示例4: _checkEntry
/**
*
* @param DirectoryIterator $entry
*/
private function _checkEntry($entry)
{
if (X_Env::isWindows()) {
return !$this->_isHiddenOnWindows($entry);
} else {
// in linux, hidden files start with .
if (substr(pathinfo($entry, PATHINFO_BASENAME), 0, 1) == '.') {
return false;
}
}
return true;
}
示例5: preSpawnVlc
/**
* This hook can be used check vlc status just before
* spawn is called
*
* @param X_Vlc $vlc vlc wrapper object
* @param string $provider id of the plugin that should handle request
* @param string $location to stream
* @param Zend_Controller_Action $controller the controller who handle the request
*/
public function preSpawnVlc(X_Vlc $vlc, $provider, $location, Zend_Controller_Action $controller)
{
// TODO port to newer api when ready
// when newer X_Vlc's api will be ready
// i will need change this to
// $source = $vlc->getSource();
// and double quote removal will be automatic
$source = $vlc->getArg('source');
$provider = X_VlcShares_Plugins::broker()->getPlugins($provider);
//if ( X_Env::isWindows() && !X_Env::startWith($source, 'http://') && !X_Env::startWith($source, 'https://') ) {
if (X_Env::isWindows() && is_a($provider, 'X_VlcShares_Plugins_FileSystem')) {
// with newer api this will be useless
$source = realpath(trim($source, '"'));
// when newer X_Vlc's api will be ready
// i will need change this to
// $vlc->setSource($source);
// and double quotation will be automatic
$vlc->registerArg('source', "\"{$source}\"");
}
}
示例6: autosearchAction
public function autosearchAction()
{
$autosearch_LINUX = array('/usr/bin/vlc', '/bin/vlc', '/usr/local/bin/vlc');
$autosearch_WINDOWS = array('C:\\Programmi\\VideoLan\\Vlc\\vlc.exe', 'C:\\Programmi\\Vlc\\vlc.exe', 'C:\\Programmi\\VideoLan\\vlc.exe', 'C:\\Program files\\VideoLan\\Vlc\\vlc.exe', 'C:\\Program files\\Vlc\\vlc.exe', 'C:\\Program files\\VideoLan\\vlc.exe', 'C:\\Program files (x86)\\VideoLan\\Vlc\\vlc.exe', 'C:\\Program files (x86)\\Vlc\\vlc.exe', 'C:\\Program files (x86)\\VideoLan\\vlc.exe');
$searchPath = X_Env::isWindows() ? $autosearch_WINDOWS : $autosearch_LINUX;
$found = false;
foreach ($searchPath as $path) {
if (file_exists($path)) {
$found = $path;
break;
}
}
if ($found !== false) {
$found = array('path' => $found, 'isError' => false);
} else {
$found = array('path' => '', 'isError' => true);
}
/*
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
*/
$this->_helper->json($found);
}
示例7: _invoke
private function _invoke()
{
$source = $this->_location;
$osTweak = X_Env::isWindows() ? '2>&1' : '2>&1';
$ffmpeg = "\"{$this->options->path}\"";
$str = X_Env::execute("{$ffmpeg} -i \"{$source}\" {$osTweak}", X_Env::EXECUTE_OUT_ARRAY, X_Env::EXECUTE_PS_WAIT);
return $str;
}
示例8: getDefaultVlcArg
public function getDefaultVlcArg()
{
$host = $this->options->get('commander', new Zend_Config(array()))->get('nc_host', '127.0.0.1');
$port = $this->options->get('commander', new Zend_Config(array()))->get('nc_port', '4212');
if (X_Env::isWindows()) {
return '-I oldrc --rc-host="' . $host . ':' . $port . '"';
} else {
return '-I rc --rc-host="' . $host . ':' . $port . '" --rc-fake-tty';
}
}
示例9: _ffmpegCheck
private function _ffmpegCheck($path)
{
if (file_exists($path)) {
if (X_Env::isWindows()) {
// windows check
if (is_file($path)) {
$filename = pathinfo($path, PATHINFO_BASENAME);
if (strtolower($filename) == 'ffmpeg.exe') {
return true;
}
}
} else {
if (is_file($path)) {
$filename = pathinfo($path, PATHINFO_BASENAME);
if (strtolower($filename) == 'ffmpeg') {
return true;
}
}
}
}
return false;
}
示例10: forceKill
public function forceKill()
{
if (!X_Env::isWindows()) {
X_Env::execute("killall rtmpgw-own3d", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
} else {
X_Env::execute("taskkill /IM rtmpgw-own3d.exe /F", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
}
}
示例11: foreach
// ============================================ //
// check if db needs manipulation
foreach ($dbInits as $dbInit => $enabled) {
if ($enabled) {
$schemaSql = file_get_contents($dbInit);
// use the connection directly to load sql in batches
$dbAdapter->getConnection()->exec($schemaSql);
}
}
foreach ($neededDirectories as $dir) {
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
}
foreach ($neededLinks as $linkFrom => $linkTo) {
if (X_Env::isWindows()) {
// symlink doesn't work:
// i need to copy the file everytime
// and the old file will be overwritten
copy($linkFrom, $linkTo);
} else {
symlink($linkFrom, $linkTo);
}
}
// let's add models classes
foreach ($includeFiles as $file) {
@(include_once $file);
}
// let's add views path in view
foreach ($viewScriptsPath as $viewScriptPath) {
$view->addScriptPath($viewScriptPath);