当前位置: 首页>>代码示例>>PHP>>正文


PHP loader::is_windows方法代码示例

本文整理汇总了PHP中loader::is_windows方法的典型用法代码示例。如果您正苦于以下问题:PHP loader::is_windows方法的具体用法?PHP loader::is_windows怎么用?PHP loader::is_windows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在loader的用法示例。


在下文中一共展示了loader::is_windows方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mw_create_thread

function mw_create_thread($acc)
{
    $script = __FILE__;
    $pathToPhp = PHP_OS == 'FreeBSD' ? "/usr/local/bin/php" : "/usr/bin/php";
    $pathToPhp = loader::is_windows() ? 'Q:\\xampp\\xampplite\\php\\php.exe ' : $pathToPhp;
    // start
    $log_file = loader::fix_path(dirname(__FILE__)) . 'logs/%s.log';
    return new Threader("{$pathToPhp} -f {$script}", $acc->id, 'uid' . $acc->id, sprintf($log_file, $acc->id));
}
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:9,代码来源:demon.php

示例2: __construct

 /**
  * Under construct
  */
 function __construct()
 {
     $this->clear();
     if (loader::is_windows()) {
         // where is it?
         $this->ffmpeg_exe = 'c:\\bin\\flvencoder\\ffmpeg.exe';
         $this->flvtool_exe = 'c:\\bin\\flvencoder\\flvtool2.exe u';
     }
     if (PHP_OS == 'FreeBSD') {
         $this->ffmpeg_exe = str_replace('/bin', '/local/bin', $this->ffmpeg_exe);
         $this->flvtool_exe = str_replace('/bin', '/local/bin', $this->flvtool_exe);
         $this->qt_faststart_exe = str_replace('/bin', '/local/bin', $this->qt_faststart_exe);
     }
     if (!$this->valid_encoder()) {
         core::dprint('[video_conv] Invalid encoder', core::E_ERROR);
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:20,代码来源:video_conv.php

示例3: get_static_node_path

 /**
  * Called in non-debug mode!
  * Check for errors
  *     
  * @param mixed $node
  * @return string
  */
 function get_static_node_path($node)
 {
     // @todo on error, $node empty too!
     $domain = '';
     if (!$node) {
         // this is / index
         $url = '/';
         $domain = $this->get_current_site()->get_domain();
     } else {
         // node
         $url = $node->get_url();
         $domain = $node->get_site()->get_domain();
     }
     core::dprint(array('[!] Generate static %s', $url));
     $urls = explode('/', $url);
     foreach ($urls as &$u) {
         if (loader::is_windows()) {
             $u = iconv('UTF-8', 'WINDOWS-1251', $u);
             // @fixme windows?
         }
     }
     $url = join('/', $urls);
     if (substr($url, -1, 1) == '/') {
         $url .= 'index.html';
     }
     $url = loader::get_public() . 'static/' . $domain . '/' . substr($url, 1);
     return $url;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:35,代码来源:module.php

示例4: __construct

 /**
  * constructor
  * $params goes to ->cfg('options.$')
  * @throws exception
  */
 public function __construct($params = array())
 {
     self::time_check('core-boot');
     // bogus: fix loop with get_instance
     if (!self::$_instance) {
         self::$_instance = $this;
     }
     $initilize_after_load = $params === true;
     if (empty($params) && !is_array($params)) {
         $params = array();
     }
     $cfg_file = @$params['config-file'] ?: 'engine';
     $cfg_file = loader::get_docs() . $cfg_file . '.cfg';
     if (fs::file_exists($cfg_file)) {
         // echo('[error] Configuration file not found');
         $this->init_config(parse_ini_file($cfg_file, true));
     }
     // override core-config
     if (!empty($params['config'])) {
         $this->config = array_merge($this->config, $params['config']);
     }
     // multiconfig config/domain.engine.cfg
     $host = @$_SERVER['HTTP_HOST'];
     $host = strpos($host, 'www.') === 0 ? substr($host, 4) : $host;
     if ($this->cfg('multidomain_config', false) && $host) {
         $host = str_replace(':', '.', $host);
         // localhost:8002
         $host_config = loader::get_docs() . $host . '.engine.cfg';
         if (fs::file_exists($host_config)) {
             $this->init_config(parse_ini_file($host_config, true), abs_config::INIT_APPEND);
         }
     }
     setlocale(LC_ALL, $locale = $this->cfg('locale', 'ru_RU.UTF8'));
     if (loader::is_windows()) {
         list($lang, $codeset) = explode('.', $locale);
         $lang = substr($lang, 0, 2);
         putenv('LANG=' . $lang . '.' . $codeset);
         putenv('LANGUAGE=' . $lang . '.' . $codeset);
         //bind_textdomain_codeset('mydomain', $codeset);
     }
     if (fs::file_exists($libs_file = loader::get_docs() . 'libs.cfg')) {
         self::$system_libs = parse_ini_file($libs_file, true);
     }
     self::$libs = new core_libs();
     $duagent = $this->cfg('debugger_agent', 'iamdebugger');
     // compare only lside of agent, because firephp or something add its stuff to end
     if (isset($_SERVER['HTTP_USER_AGENT']) && substr($_SERVER['HTTP_USER_AGENT'], 0, strlen($duagent)) === $duagent || !empty($params['debug'])) {
         self::set_debug(!empty($params['debug']) ? $params['debug'] : $this->cfg('debug', self::E_INFO));
         if (!self::is_debug()) {
             self::register_lib('console', new SatCMS\Modules\Core\Console\FakeConsole());
         } else {
             if (array_key_exists('console', self::$system_libs)) {
                 // load external console
                 self::lib('console');
             } else {
                 // bind console (modules/core/console)
                 self::register_lib('console', new Debug_HackerConsole_Main(!$this->cfg('no_console') && !loader::in_shell() && !loader::in_ajax() || loader::in_ajax() && $this->cfg('debug_ajax', false)));
             }
         }
     } else {
         if (!loader::in_shell()) {
             self::$_debug_level = false;
             //@todo fix blank page on errors without debug enabled
             ini_set('display_errors', 'off');
         } else {
             // enable debug messages in shell
             self::set_debug($this->cfg('shell_debug_level', self::E_INFO));
         }
     }
     if (self::is_debug() && (!loader::in_ajax() || $this->cfg('debug_ajax', false)) && !loader::_option(loader::OPTION_TESTING) && class_exists('\\Whoops\\Run')) {
         $whoops = new \Whoops\Run();
         $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
         $whoops->register();
         $this->set_cfg_var('with_debugger', true);
     }
     // build module
     parent::__construct(loader::get_public(loader::DIR_MODULES) . __CLASS__ . '/', array('options' => $params));
     if ($initilize_after_load) {
         $this->init();
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:86,代码来源:core.php

示例5: error_reporting

/**
 * Test bootstrap
 */
error_reporting(E_ALL);
ini_set('display_errors', 'on');
test_assertions::$start_time = microtime(1);
// this prevent init10 on modules!
register_shutdown_function('test_done');
require dirname(__FILE__) . "/../loader.php";
$BOOT_OPTIONS = array(loader::OPTION_TESTING => true, loader::OPTION_CORE_PARAMS => array('config' => array('database' => 'test')));
loader::bootstrap($BOOT_OPTIONS);
if (!loader::in_shell()) {
    die('Tests available only from console' . PHP_EOL);
}
// fix unicode
if (loader::is_windows() && loader::in_shell()) {
    system('chcp 65001 > NUL');
}
/**
 * Tests api:
 *
 * test_head(title)
 * test_print(var, var, ...)
 *
 * test_assert($assert, $title)
 * test_except(closure, $title)
 *
 * test_done - called on shutdown
 */
/**
 * Print test head
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:31,代码来源:loader.php

示例6: while

// --------
// client
if (!empty($argv)) {
    $id = $argv[0];
    while (1) {
        printf("[THREAD][%d]\n", $id);
        sleep(1 + rand(1, 5));
    }
    return;
}
// --------
// server
require_once "modules/moswar/lib/threader.php";
$script = __FILE__;
$pathToPhp = PHP_OS == 'FreeBSD' ? "/usr/local/bin/php" : "/usr/bin/php";
$pathToPhp = loader::is_windows() ? 'Q:\\xampp\\xampplite\\php\\php.exe ' : $pathToPhp;
// start
$threads = array();
/**
 * First argument: external script or command (required).
 * Second argument: arguments that your external script or command will receive (optional).
 * Third argument: name of thread (optional).
 */
/** @var mw_accounts_collection */
$accs = core::module('moswar')->get_accounts_handle()->load();
$log_file = loader::fix_path(dirname(__FILE__)) . 'logs/%s.log';
$accs = array(1, 2);
foreach ($accs as $acc) {
    $threads[] = new Threader("{$pathToPhp} -f {$script}", $acc, 'uid' . $acc, sprintf($log_file, $acc));
}
//$threads[] = new Threader("$pathToPhp -f $script", 2, 'uid2');
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:31,代码来源:demon.php


注:本文中的loader::is_windows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。