本文整理汇总了PHP中loader::fix_path方法的典型用法代码示例。如果您正苦于以下问题:PHP loader::fix_path方法的具体用法?PHP loader::fix_path怎么用?PHP loader::fix_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类loader
的用法示例。
在下文中一共展示了loader::fix_path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例2: register
/**
* Register module
* @throws modules_exception
* @return core_module
*/
public function register($module, $params = null)
{
$module_class = isset($params['class']) ? $params['class'] : $module;
$module_class = (isset($params['prefix']) ? $params['prefix'] : loader::CLASS_PREFIX) . $module_class;
$module_path_orig = loader::DIR_MODULES . $module . '/';
$module_path = loader::get_public();
$module_path .= isset($params['path']) ? $params['path'] : loader::DIR_MODULES . $module;
$module_path .= '/';
$module_file = $module_path;
$module_file .= (isset($params['file']) ? $params['file'] : 'module') . loader::DOT_PHP;
core::dprint(array('module::register %s, %s', $module, $module_class), core::E_DEBUG0);
if (!fs::file_exists($module_file)) {
core::dprint_r(array($module_class, $module_file));
throw new module_exception('Failed to register module ' . $module . '. File does not exists');
}
require_once $module_file;
if (!class_exists($module_class, 0)) {
throw new module_exception('Cant load module ' . $module . ', wrong config?');
}
// autotag module, if alternative class used
if (!isset($params['tag']) && !empty($params['class'])) {
$params['tag'] = $module;
}
$module_path = loader::fix_path(loader::get_public() . (!empty($params['chroot']) ? $module_path : $module_path_orig));
$this->set($module, new $module_class($module_path, $params));
$newb = $this->get($module);
$newb->init_config($this->_get_module_config($module), abs_config::INIT_APPEND);
return $newb;
}
示例3: array
// --------
// 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');
/**
* We check if any of the 'active' states of our threads are true;
* then we display its output using 'listen'.
*/
while (1) {
$active = false;
foreach ($threads as $tid => $t) {
if ($t->active) {
$buffer = $t->listen();
if ($buffer) {
示例4: get_template_root
function get_template_root($template = null)
{
if (!isset($template)) {
return $this->template_root;
}
return loader::fix_path(loader::get_public() . core::get_instance()->get_cfg_var('site_url') . loader::DIR_TEMPLATES . $template . '/');
}