當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Std::Out方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:RhuanGonzaga,項目名稱:WhatsBot,代碼行數:31,代碼來源:LuaModule.php

示例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;
 }
開發者ID:hasanalom,項目名稱:WhatsBot,代碼行數:25,代碼來源:PHPModule.php

示例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;
 }
開發者ID:RhuanGonzaga,項目名稱:WhatsBot,代碼行數:31,代碼來源:ModuleManagerLoader.php

示例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;
 }
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:11,代碼來源:ModuleManagerExists.php

示例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;
 }
開發者ID:hasanalom,項目名稱:WhatsBot,代碼行數:13,代碼來源:LuaWithPHP.php

示例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;
 }
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:13,代碼來源:Lang.php

示例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;
 }
開發者ID:RhuanGonzaga,項目名稱:WhatsBot,代碼行數:14,代碼來源:Config.php

示例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;
 }
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:15,代碼來源:Config.php

示例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;
 }
開發者ID:hasanalom,項目名稱:WhatsBot,代碼行數:15,代碼來源:ModuleManagerGetter.php

示例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;
 }
開發者ID:RhuanGonzaga,項目名稱:WhatsBot,代碼行數:15,代碼來源:Lang.php

示例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;
 }
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:16,代碼來源:Json.php

示例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;
}
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:16,代碼來源:_Loader.php

示例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 ... ... ...
 }
開發者ID:hasanalom,項目名稱:WhatsBot,代碼行數:16,代碼來源:Thread.php

示例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() . ')');
     }
 }
開發者ID:hasanalom,項目名稱:WhatsBot,代碼行數:18,代碼來源:LuaThread.php

示例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;
 }
開發者ID:RhuanGonzaga,項目名稱:WhatsBot,代碼行數:18,代碼來源:Json.php


注:本文中的Std::Out方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。