本文整理汇总了PHP中Std::Out方法的典型用法代码示例。如果您正苦于以下问题:PHP Std::Out方法的具体用法?PHP Std::Out怎么用?PHP Std::Out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Std
的用法示例。
在下文中一共展示了Std::Out方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute(WhatsApp\Message $Message, array $Params = array())
{
try {
if ($Message->Time >= $this->WhatsBot->GetStartTime()) {
if ($this->IsEnabled() === self::ENABLED) {
if (is_readable($this->XPath)) {
$LangSection = "{$this->Key}_{$this->AliasOf}";
$this->WhatsApp->SetLangSection($LangSection);
$this->Lua->LinkObject(new Lang($LangSection), true, true, true);
$this->Lua->AssignVariables($Params);
$this->Lua->LinkObject($Message, true, false, false);
$Return = $this->Lua->Include($this->XPath);
if ($Return === false) {
return INTERNAL_ERROR;
}
if ($Return === null) {
return self::EXECUTED;
}
return $Return;
}
Std::Out("[Warning] [Modules] (Lua) Can't execute {$this->Key}::{$this->Name} ({$this->AliasOf}). {$this->PathExtension} file is not readable");
return self::NOT_READABLE;
}
return self::NOT_ENABLED;
}
return self::EXECUTED;
} catch (Exception $Exception) {
Std::Out("[Warning] [Modules] (Lua) Can't execute {$this->Key}::{$this->Name} ({$this->AliasOf}). " . get_class($Exception) . 'thrown (' . $Exception->GetMessage() . ')');
return INTERNAL_ERROR;
}
}
示例2: Execute
public function Execute(WhatsApp\Message $Message, array $Params = array())
{
if ($Message->Time >= $this->WhatsBot->GetStartTime()) {
if ($this->IsEnabled() === self::ENABLED) {
if (is_readable($this->XPath)) {
$LangSection = "{$this->Key}_{$this->AliasOf}";
$this->WhatsApp->SetLangSection($LangSection);
$Lang = new Lang($LangSection);
$ModuleManager = $this->ModuleManager;
$WhatsBot = $this->WhatsBot;
$WhatsApp = $this->WhatsApp;
extract($Params);
$Return = (include $this->XPath);
if ($Return !== 1) {
return $Return;
}
return self::EXECUTED;
}
Std::Out("[Warning] [Modules] Can't execute {$this->Key}::{$this->Name} ({$this->AliasOf}). {$this->PathExtension} file is not readable");
return self::NOT_READABLE;
}
return self::NOT_ENABLED;
}
return self::EXECUTED;
}
示例3: LoadModules
public function LoadModules()
{
Std::Out();
Std::Out('[Info] [Modules] Loading');
Std::Out('[Info] [Modules] Available languages: ' . implode(', ', $this->GetAvailableLanguages(false)));
$Modules = Config::Get('Modules');
if (is_array($Modules)) {
$Loaded = array();
$Keys = array_keys($Modules);
foreach ($Keys as $Key) {
foreach ($Modules[$Key] as $Module) {
if (is_string($Module)) {
$Module = array($Module, $Module);
}
if (is_array($Module) && !empty($Module[0]) && !empty($Module[1])) {
$Name = strtolower($Module[0]);
$Loaded[$Key][$Name] = $this->LoadModule($Key, $Name, $Module[1]);
} else {
Std::Out('[Warning] [Modules] Config must be Key::Name or Key::[Name, AliasOf]');
Std::Out("{$Key}::", false);
Std::Out(var_export($Module, true));
}
}
}
Std::Out('[Info] [Modules] Ready!');
// ($N loaded modules)
return $Loaded;
}
Std::Out('[Warning] [Modules] Config file is not an array');
return false;
}
示例4: ModuleExists
public function ModuleExists($Key, $Name, $ShowWarn = true)
{
$Name = strtolower($Name);
if (!empty($this->Modules[$Key][$Name])) {
return Module::LOADED;
}
if ($ShowWarn) {
Std::Out("[Warning] [Modules] Module {$Key}::{$Name} doesn't exists");
}
return Module::NOT_LOADED;
}
示例5: RegisterCallback
public function RegisterCallback($Name, $Callback)
{
if (is_callable($Callback)) {
if (is_object(parent::RegisterCallback($Name, $Callback))) {
return true;
} else {
Std::Out("[Warning] [Lua] Can't register {$Name} callback");
}
} else {
Std::Out("[Warning] [Lua] Can't register {$Name} callback. It is not callable");
}
return false;
}
示例6: Get
public function Get($Key)
{
if (!empty($this->Data[$Key])) {
$Args = func_get_args();
if (count($Args) > 1) {
$Args[0] = $this->Data[$Key];
return call_user_func_array('sprintf', $Args);
}
return $this->Data[$Key];
}
Std::Out("[Warning] [Lang] Key {$this->Section}::{$Key} doesn't exists");
return false;
}
示例7: Get
public static function Get($Filename, $ShowWarning = true, $Throw = false)
{
self::Init();
if (isset(self::$Config[$Filename])) {
return self::$Config[$Filename];
}
if ($ShowWarning) {
Std::Out('[Warning] [Config] No such file ' . self::$FileManager->GetDirectory() . "/{$Filename}.json");
}
if ($Throw) {
throw new Exception('No such file ' . self::$FileManager->GetDirectory() . "/{$Filename}.json");
}
return false;
}
示例8: Get
public static function Get($Filename, $Throw = false, $FixArray = false)
{
if (isset(self::$Config[$Filename])) {
if ($FixArray) {
return LuaFixArrayRecursive(self::$Config[$Filename]);
} else {
return self::$Config[$Filename];
}
}
Std::Out("[Warning] [Config] config/{$Filename}.json does not exists or is not decodeable. Try to Config::Load()");
if ($Throw) {
throw new Exception("No such file config/{$Filename}.json");
}
return false;
}
示例9: GetModule
public function GetModule($Key, $Name, $ShowWarn = true)
{
$Name = strtolower($Name);
if ($this->ModuleExists($Key, $Name, $ShowWarn) === Module::LOADED) {
if ($this->Modules[$Key][$Name]->IsLoaded()) {
return $this->Modules[$Key][$Name];
} else {
return Module::LOAD_ERROR;
}
}
if ($ShowWarn) {
Std::Out("[Warning] [Modules] Trying to get not loaded module. {$Key}::{$Name}");
}
return Module::NOT_LOADED;
}
示例10: Get
public function Get($Key)
{
if (isset($this->Data[$Key])) {
$Args = func_get_args();
if (func_num_args() > 1) {
$Args[0] = $this->Data[$Key];
return call_user_func_array('sprintf', $Args);
// sprintf($Key, ...$Args)
}
return $this->Data[$Key];
} else {
Std::Out("[Warning] [Lang] Key {$this->Section}::{$Key} doesn't exist");
}
return false;
}
示例11: Encode
public static function Encode($Filename, $Data, $Options = JSON_PRETTY_PRINT)
{
$Data = json_encode($Data, $Options);
if ($Data !== false) {
$ToWrite = strlen($Data);
$Writed = file_put_contents($Filename, $Data);
if ($Writed === $ToWrite) {
return true;
} else {
Std::Out("[Warning] [Json] {$Filename} : {$Writed} bytes writed of {$ToWrite}");
}
} else {
Std::Out("[Warning] [Json] Can't encode {$Filename}");
}
return false;
}
示例12: LoadLib
function LoadLib($Lib)
{
$Path = "class/Lib/_{$Lib}.php";
if (basename(dirname(realpath($Path))) === 'Lib') {
if (is_readable($Path)) {
// Lint
require_once $Path;
return true;
} else {
Std::Out("[Warning] [Libs] Can't load {$Lib}. It is not readable");
}
} else {
Std::Out("[Warning] [Libs] Can't load {$Lib}. It is not in Lib/ folder");
}
return false;
}
示例13: Run
public final function Run()
{
sleep(5);
$this->LoadTaskManager();
$this->Execute();
Std::Out();
Std::Out("[Info] [Threads] {$this->Name} stopped ({$this->Stop})");
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
// When a thread gets stopped, windows says "PHP-CLI has stopped working *trollface*"
while (true) {
// So ...
sleep(1);
}
}
// We will wait ... ... ...
}
示例14: Execute
protected function Execute()
{
try {
$Lua = new LuaWithPHP();
$Lua->AssignUserConstants();
$Lua->LinkObject($this, false, false, false);
$Lua->AssignVariables(array('Name' => $this->Name, 'Path' => $this->Path, 'JPath' => $this->JPath, 'XPath' => $this->XPath, 'PathExtension' => $this->PathExtension, 'Data' => $this->Data, 'Loaded' => $this->Loaded));
$Lua->LinkObjects(array($this->ThreadManager, $this->ModuleManager, $this->EventManager, $this->WhatsApp, $this->WhatsBot));
$Lua->LinkObject(new Lang("Thread_{$this->Name}"), true, true, true);
while (!$this->Stop && is_readable($this->XPath)) {
if ($Lua->Include($this->XPath) === false) {
$this->Stop('Lua fatal error');
}
}
} catch (Exception $Exception) {
Std::Out("[Warning] [Threads] (Lua) Can't execute {$this->Name}. " . get_class($Exception) . 'thrown (' . $Exception->GetMessage() . ')');
}
}
示例15: Encode
public static function Encode($Filename, $Data, $Options = JSON_PRETTY_PRINT)
{
$EncodedData = json_encode($Data, $Options);
if ($EncodedData !== false) {
$ToWrite = strlen($EncodedData);
$Written = file_put_contents($Filename, $EncodedData);
if ($Written === $ToWrite) {
return true;
} else {
Std::Out("[Warning] [Json] {$Filename} : {$Written} bytes written of {$ToWrite}");
}
} else {
$LogFileName = 'json_warning_' . time();
Data::Set($LogFileName, sprintf("Can't encode %s: %s", $Filename, var_export($Data, true)));
Std::Out("[Warning] [Json] Can't encode {$Filename} (see data/{$LogFileName})");
}
return false;
}