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


PHP Core::log方法代码示例

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


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

示例1: handle

	public function handle(Bot $bot) {		
		if (substr(Module::removeWhisper($bot->message['text']), 0, 5) == '!php ') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'php.eval')) return $bot->denied();
			Core::log()->php = $bot->message['usernameraw'].' used '.Module::removeWhisper($bot->message['text']);
			eval(substr(Module::removeWhisper($bot->message['text']), 5));
		}
	}
开发者ID:0xLeon,项目名称:Chatbot,代码行数:7,代码来源:ModulePHP.class.php

示例2: loadEnabled

 public function loadEnabled()
 {
     $enPlugins = $this->_listPluginsFiles('enabled');
     foreach ($enPlugins as $plugin) {
         $plugin = realpath($plugin);
         $info = $this->_getPluginInformation($plugin);
         $path = $this->_path . DS . 'enabled';
         $filename = str_replace($path, "", $plugin);
         if ($info) {
             $sysname = $info['plugin_sysname'];
             if (!array_key_exists($sysname, $this->loadedPlugins)) {
                 if (!empty($info['textdomain'])) {
                     $relpath = 'enabled' . DS . trim(str_replace($path, '', dirname($plugin)), DS);
                     if (!empty($info['domainpath'])) {
                         $relpath .= DS . trim($info['domainpath'], '\\/');
                     }
                     if (!load_plugin_textdomain($info['textdomain'], $relpath)) {
                         Core::log('Failed to get localization data for plugin \'' . $filename . '\'.', YG_NOTICE);
                     }
                 }
                 if (require_once $plugin) {
                     $this->loadedPlugins[$sysname] = $plugin;
                 } else {
                     $this->log("Unable to require plugin file " . $filename, YG_NOTICE);
                 }
             } else {
                 $dpfilename = str_replace($path, "", $this->loadedPlugins[$sysname]);
                 $this->log("Duplicated plugin sysname '" . $sysname . "' at file " . $filename . ", previously declared at " . $dpfilename . ". Ignoring this one.", YG_NOTICE);
             }
         } else {
             $this->log("Unable to load plugin file " . $filename . ". Failed to parse the meta-data.", YG_NOTICE);
         }
     }
 }
开发者ID:vinerz,项目名称:yogo,代码行数:34,代码来源:pluginmanager.class.php

示例3: __construct

	private function __construct() {
		self::init();
		self::$log = new Log();
		self::log()->info = 'Starting, PID is '.getmypid();
		if (VERBOSE > 5) {
			self::log()->info = '         (__) ';
			self::log()->info = '         (oo) ';
			self::log()->info = '   /------\/ ';
			self::log()->info = '  / |    ||   ';
			self::log()->info = ' *  /\---/\ ';
			self::log()->info = '    ~~   ~~   ';
			self::log()->info = '...."Have you mooed today?"...';
		}
		self::$config = new Config();
		self::$permission = new Permission();
		self::$language = new Language(LANGUAGE);
		if (VERBOSE > 0) self::log()->info = 'Loaded Config';
		self::$bot = new Bot();
		
		$modules = self::config()->config['modules'];
		// load default modules
		if (VERBOSE > 0) self::log()->info = 'Loading Modules';
		foreach ($modules as $module) {
			self::loadModule($module);
		}
		self::bot()->work();
	}
开发者ID:0xLeon,项目名称:Chatbot,代码行数:27,代码来源:Core.class.php

示例4: load_query_template

function load_query_template($type, $templates = array())
{
    $located = get_query_template($type, $templates);
    if (!empty($located)) {
        load_template($located);
    } else {
        Core::log('Unable to locate template part \'' . $type . '\'.');
    }
}
开发者ID:vinerz,项目名称:yogo,代码行数:9,代码来源:templateloaders.php

示例5: get_footer

function get_footer()
{
    $template = get_query_template('footer');
    if (!empty($template)) {
        load_template($template, true);
    } else {
        Core::log('Footer file missing for theme', YG_WARNING);
    }
}
开发者ID:vinerz,项目名称:yogo,代码行数:9,代码来源:templatemanager.php

示例6: register

 public static function register($handle, $src, $deps = array(), $group)
 {
     if (!is_string($src) || !is_string($handle)) {
         return false;
     }
     if (!isset(self::$_scripts[$handle])) {
         self::$_scripts[$handle] = array($src, $deps, $group);
     } else {
         Core::log('Attempt to override a script identifier \'' . $handle . '\'.', YG_NOTICE);
     }
 }
开发者ID:vinerz,项目名称:yogo,代码行数:11,代码来源:scriptloader.php

示例7: register

 public static function register($handle, $src, $deps = array(), $media = 'all', $extra = array())
 {
     if (!is_string($src) || !is_string($handle)) {
         return false;
     }
     if (!isset(self::$_styles[$handle])) {
         self::$_styles[$handle] = array($src, $deps, $media, $extra);
     } else {
         Core::log('Attempt to override a style identifier \'' . $handle . '\'.', YG_NOTICE);
     }
 }
开发者ID:vinerz,项目名称:yogo,代码行数:11,代码来源:styleloader.php

示例8: delete

 /**
  * Delete layout
  */
 public function delete()
 {
     //! check input
     if (empty($this->id)) {
         throw new \Exception(L('No layout id'));
     }
     if (empty(Core::$user->id) || !Core::$user->has("siteadm")) {
         throw new \Exception(L('No user id'));
     }
     Core::log('A', sprintf("Layout %s deleted by %s", $this->id, Core::$user->name), "cmsaudit");
     DS::exec("DELETE FROM " . static::$_table . " WHERE id=?", [$this->id]);
     DS::exec("DELETE FROM " . Page::$_table . "_list WHERE page_id IN (SELECT id FROM pages WHERE template=?)", [$this->id]);
     DS::exec("DELETE FROM " . Page::$_table . " WHERE template=?", [$this->id]);
 }
开发者ID:bztsrc,项目名称:phppe3,代码行数:17,代码来源:views.php

示例9: handle

	public function handle(Bot $bot) {
		if (substr($bot->message['text'], 0, 7) != 'apt-get') return;
		$text = explode(' ', substr($bot->message['text'], 8), 2);

		switch ($text[0]) {
			case 'moo':
				$bot->queue('...."Have you mooed today?"...');
			break;
			case 'install':
				if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
				if (stripos($text[1], '--reinstall') !== -1) {
					$text[1] = str_replace('--reinstall', '', $text[1]);
					Core::log()->info = $bot->message['usernameraw'].' reloaded a module';
					$result = Core::reloadModule(trim($text[1]));
				}
				else {
					Core::log()->info = $bot->message['usernameraw'].' loaded a module';
					$result = Core::loadModule(trim($text[1]));
				}
				
				if (!is_int($result)) {
					$bot->success();
				}
				else {
					$name = 'module_error_'.$result;
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->$name);
				}
			break;
			case 'remove':
			case 'purge':
				$text[1] = str_replace('--purge', '', $text[1]);
				if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
				Core::log()->info = $bot->message['usernameraw'].' unloaded a module';
				$result = Core::unloadModule(trim($text[1]));
				if (!is_int($result)) {
					$bot->success();
				}
				else {
					$name = 'module_error_'.$result;
					$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->$name);
				}
			break;
			case 'upgrade':
				if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
				$modules = Core::getModules();
				foreach ($modules as $module => $tmp) Core::reloadModule($module);
			break;
		}
	}
开发者ID:0xLeon,项目名称:Chatbot,代码行数:49,代码来源:ModuleApt.class.php

示例10: handle

	public function handle(Bot $bot) {
		if (Module::removeWhisper($bot->message['text']) == '!shutdown') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.shutdown')) return $bot->denied();
			Core::log()->info = $bot->message['usernameraw'].' shutted the bot down';
			$bot->shutdown();
		}
		else if (Module::removeWhisper($bot->message['text']) == '!restart') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.shutdown')) return $bot->denied();
                        Core::log()->info = $bot->message['usernameraw'].' restarted the bot';
                        $bot->shutdown(SIGUSR1);
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 5) == '!say ') {
			if (!Core::compareLevel($bot->lookUpUserID(), 500)) return $bot->denied();
			$bot->queue(substr(Module::removeWhisper($bot->message['text']), 5));
		}
		else if (Module::removeWhisper($bot->message['text']) == '!loaded') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.load')) return $bot->denied();
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->op_loaded.': '.implode(', ', array_keys(Core::getModules())));
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 6) == '!join ') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.join')) return $bot->denied();
			$bot->getConnection()->join(substr(Module::removeWhisper($bot->message['text']), 6));
			$bot->success();
		}
		else if (Module::removeWhisper($bot->message['text']) == '!perms') {
			if (!Core::compareLevel($bot->lookUpUserID(), 500)) return $bot->denied();
			$perms = Core::permission()->getNodes();
			ksort($perms);
			$permString = array();
			foreach ($perms as $name => $level) {
				$permString[] = $name.': '.$level;
			}
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->op_perms.': '.implode(', ', $permString));
		}
		else if (Module::removeWhisper($bot->message['text']) == '!rooms') {
			if (!Core::compareLevel($bot->lookUpUserID(), 'op.join')) return $bot->denied();
			$rooms = $bot->getConnection()->getRooms();
			$roomString = array();
			foreach ($rooms as $id => $name) {
				$roomString[] = $name.': '.$id;
			}
			$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->op_rooms.': '.implode(', ', $roomString));
		}
	}
开发者ID:0xLeon,项目名称:Chatbot,代码行数:44,代码来源:ModuleOp.class.php

示例11: handle

	public function handle(Bot $bot) {
		if ($bot->message['id'] % 500 == 0) $this->config->write();
		if (substr($bot->message['text'], 0, 1) == '-') {
			if (isset($this->config->config[substr($bot->message['text'], 1)])) {
				$bot->queue($this->config->config[substr($bot->message['text'], 1)]);
			}
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 5) == '!dic ') {
			if (Core::compareLevel($bot->lookUpUserID(), 'dic.add')) {
				$data = explode(' ', substr(Module::removeWhisper($bot->message['text']), 5), 2);
				if (substr($data[1], 0, 1) == '!') return $bot->denied();
				$this->config->config[$data[0]] = $data[1];
				Core::log()->info = $bot->message['usernameraw'].' added '.$data[0].' to dictionary';
				$bot->success();
			}
			else {
				$bot->denied();
			}
		}
		else if (substr(Module::removeWhisper($bot->message['text']), 0, 8) == '!deldic ') {
			if (Core::compareLevel($bot->lookUpUserID(), 'dic.add')) {
				$data = substr(Module::removeWhisper($bot->message['text']), 8);
				unset($this->config->config[$data]);
				$bot->success();
			}
			else {
				$bot->denied();
			}
		}
		else if (Module::removeWhisper($bot->message['text']) == '!listdic') {
			if (Core::compareLevel($bot->lookUpUserID(), 'dic.list')) {
				$entries = array_keys($this->config->config);
				sort($entries);
				$bot->queue('/whisper "'.$bot->message['usernameraw'].'" '.Core::language()->dic_listdic.': '.implode(', ', $entries));
			}
			else {
				$bot->denied();
			}
		}
	}
开发者ID:0xLeon,项目名称:Chatbot,代码行数:40,代码来源:ModuleDictionary.class.php

示例12: error_handler

 /**
  * 返回错误信息方法
  * @author 景云山
  * @version 2008-9-15
  * @return void 无返回值
  */
 public static function error_handler($errno, $errstr, $errfile, $errline)
 {
     switch ($errno) {
         case E_USER_ERROR:
             $logs .= date("Y-m-d H:i:s") . "<b>My ERROR</b> [{$errno}] {$errstr}<br />\n";
             $logs .= "  Fatal error on line {$errline} in file {$errfile}";
             $logs .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
             $logs .= "Aborting...<br />\n";
             break;
         case E_USER_WARNING:
             $logs .= date("Y-m-d H:i:s") . "<b>My WARNING</b> [{$errno}] {$errstr}<br />\n";
             break;
         case E_USER_NOTICE:
             $logs .= date("Y-m-d H:i:s") . "<b>My NOTICE</b> [{$errno}] {$errstr}<br />\n";
             break;
     }
     if ($logs) {
         Core::log($logs, "error/logs");
     }
     /* Don't execute PHP internal error handler */
     return true;
 }
开发者ID:infi000,项目名称:geek,代码行数:28,代码来源:exception.class.php

示例13: set

 public static function set($keys, $value = false, $id = null)
 {
     if (is_array($keys) && $value !== false) {
         return false;
     }
     if (!is_array($keys)) {
         $data = array();
         $data[$keys] = $value;
     } else {
         $data = $keys;
     }
     if (count($data) == 0) {
         return false;
     }
     if (empty($id)) {
         $id = Session::get('uid');
     }
     $setData = '';
     $psvals = array();
     foreach ($data as $key => $val) {
         if (!empty($setData)) {
             $setData .= ', ';
         }
         $setData .= $key . ' = ?';
         $psvals[] = $val;
     }
     $psvals[] = $id;
     $query = DB::prepared('UPDATE users SET ' . $setData . ' WHERE id = ?', $psvals);
     if ($query) {
         foreach ($data as $key => $val) {
             self::$keys[$id][$key] = $val;
         }
         return true;
     } else {
         Core::log('Failed to get user information.', YG_NOTICE);
         return false;
     }
 }
开发者ID:vinerz,项目名称:yogo,代码行数:38,代码来源:user-main.php

示例14: setConf

 /**
  * Set configuration for an extension from $_POST
  *
  * @param Extension directory
  */
 function setConf($dir)
 {
     if (empty($dir) || empty($_POST)) {
         return "PHPPE-E: " . L("Bad arguments");
     }
     //! check rights
     if (!Core::$user->has("install")) {
         Core::log('A', "Suspicious behavior " . $url . " " . $this->getsiteurl(), "extensions");
         return "PHPPE-E: " . L("Access denied");
     }
     //! construct new configuration file
     $conf = "<" . "?p" . "hp\nreturn [\n";
     foreach ($_POST as $k => $v) {
         $conf .= "\t\"" . addslashes($k) . "\" => " . $this->formatvalue($v) . ",\n";
     }
     $conf .= "];\n";
     try {
         //! save new config.php
         $r = Tools::ssh("cat \\>" . escapeshellarg(Core::$user->data['remote']['path'] . "/vendor/" . $dir . "/config.php"), $conf);
     } catch (\Exception $e) {
         return "PHPPE-E: " . $e->getMessage();
     }
     //! check results
     if (self::isErr($r)) {
         Core::log('E', "Failed to set configuration for " . $dir . " " . $this->getSiteUrl() . ", " . str_replace("\n", " ", $r), "extensions");
         return "PHPPE-E: " . L("Failed set configuration!") . "\n\n" . str_replace("\n", " ", $r);
     } else {
         die(L("Configuration saved.") . "\n" . $r);
     }
 }
开发者ID:bztsrc,项目名称:phppe3,代码行数:35,代码来源:Extensions.php

示例15: cleanUp

 static function cleanUp($pages = null)
 {
     //! check input
     if (!empty(Core::lib("CMS")->revert)) {
         return;
     }
     if (empty(Core::$user->id) || !Core::$user->has("siteadm|pubadm")) {
         throw new \Exception(L('No user id'));
     }
     if (empty($pages)) {
         $pages = self::getPages();
     }
     //! write audit log
     Core::log('A', sprintf("Purge page history by %s", Core::$user->name), "cmsaudit");
     //! purge old records
     foreach ($pages as $p) {
         if ($p['versions'] > 1) {
             DS::exec("DELETE FROM " . static::$_table . " WHERE id=? AND (lang='' OR lang=?) AND created!=?", [$p['id'], $p['lang'], $p['created']]);
         }
     }
     //! make it published (without history that feature is off)
     DS::exec("UPDATE " . static::$_table . " SET publishid=? WHERE publishid=0", [Core::$user->id]);
 }
开发者ID:bztsrc,项目名称:phppe3,代码行数:23,代码来源:pages.php


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