本文整理汇总了PHP中XoopsLogger类的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLogger类的具体用法?PHP XoopsLogger怎么用?PHP XoopsLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XoopsLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ucfirst
/**
* Get a reference to the only instance of database class and connects to DB
*
* if the class has not been instantiated yet, this will also take
* care of that
*
* @static
* @staticvar object The only instance of database class
* @return object Reference to the only instance of database class
*/
function &getDatabaseConnection()
{
static $instance;
if (!isset($instance)) {
$file = XOOPS_ROOT_PATH . '/class/database/' . XOOPS_DB_TYPE . 'database.php';
require_once $file;
/* patch from */
if (defined('XOOPS_DB_ALTERNATIVE') && class_exists(XOOPS_DB_ALTERNATIVE)) {
$class = XOOPS_DB_ALTERNATIVE;
} else {
/* patch to */
if (!defined('XOOPS_DB_PROXY')) {
$class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe';
} else {
$class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseProxy';
}
}
$instance =& new $class();
$instance->setLogger(XoopsLogger::instance());
$instance->setPrefix(XOOPS_DB_PREFIX);
if (!$instance->connect()) {
trigger_error("notrace:Unable to connect to database", E_USER_ERROR);
}
}
return $instance;
}
示例2: test___class
public function test___class()
{
$instance = XoopsLogger::getInstance();
$this->assertInstanceOf($this->myclass, $instance);
$value = $instance->tutu('tutu');
$this->assertSame(null, $value);
}
示例3: ucfirst
/**
* Get a reference to the only instance of database class and connects to DB
*
* if the class has not been instantiated yet, this will also take
* care of that
*
* @static
* @staticvar object The only instance of database class
* @return object Reference to the only instance of database class
*/
static function &getDatabaseConnection()
{
static $instance;
if (!isset($instance)) {
if (file_exists($file = XOOPS_ROOT_PATH . '/class/database/' . XOOPS_DB_TYPE . 'database.php')) {
require_once $file;
if (!defined('XOOPS_DB_PROXY')) {
$class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe';
} else {
$class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseProxy';
}
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
$instance = new $class();
$instance->setLogger(XoopsLogger::getInstance());
$instance->setPrefix(XOOPS_DB_PREFIX);
if (!$instance->connect()) {
trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
}
} else {
trigger_error('notrace:Failed to load database of type: ' . XOOPS_DB_TYPE . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
}
}
return $instance;
}
示例4: _setupLogger
function _setupLogger()
{
require_once XOOPS_ROOT_PATH . '/class/logger.php';
$this->mLogger =& XoopsLogger::instance();
$this->mLogger->startTime();
$GLOBALS['xoopsLogger'] =& $this->mLogger;
}
示例5: get_modules_ajax
function get_modules_ajax()
{
XoopsLogger::getInstance()->activated = false;
XoopsLogger::getInstance()->renderingEnabled = false;
$db = Database::getInstance();
$sql = "SELECT COUNT(*) FROM " . $db->prefix("modules");
$page = rmc_server_var($_POST, 'page', 1);
$limit = RMFunctions::configs('mods_number');
list($num) = $db->fetchRow($db->query($sql));
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url('javascript:;" onclick="get_mods_page({PAGE_NUM})');
$sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight LIMIT {$start},{$limit}";
$result = $db->query($sql);
$installed_mods = array();
while ($row = $db->fetchArray($result)) {
$mod = new XoopsModule();
$mod->assignVars($row);
$installed_mods[] = $mod;
}
include RMTemplate::get()->get_template('rmc_mods_installed.php', 'module', 'rmcommon');
die;
}
示例6: footer
public function footer()
{
global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoTheme, $rmc_config, $xoopsModule;
$xoopsLogger =& XoopsLogger::getInstance();
$xoopsLogger->stopTime('Module display');
if (!headers_sent()) {
header('Content-Type:text/html; charset=' . _CHARSET);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: private, no-cache');
header("Cache-Control: post-check=0, pre-check=0", false);
header('Pragma: no-cache');
}
//@internal: using global $xoTheme dereferences the variable in old versions, this does not
//if (!isset($xoTheme)) $xoTheme =& $GLOBALS['xoTheme'];
if (!isset($xoTheme)) {
$xoTheme =& $GLOBALS['xoTheme'];
}
if (isset($xoopsOption['template_main']) && $xoopsOption['template_main'] != $xoTheme->contentTemplate) {
trigger_error("xoopsOption[template_main] should be defined before call xoops_cp_header function", E_USER_WARNING);
if (false === strpos($xoopsOption['template_main'], ':')) {
$xoTheme->contentTemplate = 'db:' . $xoopsOption['template_main'];
} else {
$xoTheme->contentTemplate = $xoopsOption['template_main'];
}
}
$metas = $xoTheme->metas['script'];
$xoTheme->metas['script'] = array();
foreach ($metas as $id => $meta) {
if (strpos($id, 'jquery/jquery.js') === FALSE && strpos($id, 'jquery/plugins/jquery.ui.js') === FALSE) {
$xoTheme->metas['script'][$id] = $meta;
}
}
// Check if current theme have a replacement for template
if (preg_match("/^db:(.*)/i", $xoTheme->contentTemplate, $match)) {
$file = RMCPATH . '/themes/' . $rmc_config['theme'] . '/modules/' . $xoopsModule->dirname() . '/' . $match[1];
if (is_file($file)) {
$xoTheme->contentTemplate = $file;
}
}
$xoTheme->render();
$xoopsLogger->stopTime();
// RMCommon Templates
RMTemplate::get()->footer();
die;
}
示例7: footer
function footer()
{
global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoTheme;
$xoopsLogger =& XoopsLogger::getInstance();
$xoopsLogger->stopTime('Module display');
if (!headers_sent()) {
header('Content-Type:text/html; charset=' . _CHARSET);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: private, no-cache');
header('Pragma: no-cache');
}
//@internal: using global $xoTheme dereferences the variable in old versions, this does not
if (!isset($xoTheme)) {
$xoTheme =& $GLOBALS['xoTheme'];
}
$xoTheme->render();
$xoopsLogger->stopTime();
ob_end_flush();
}
示例8: smarty_block_freeBlkTpl
/**
* @package smarty xoopsplugin
*
* @author Hu Zhenghui <huzhengh@gmail.com>
*
* how to use
* The following code inserted in the template
*
* @param module string module dirname
* @param file string block funciton file
* @param show_func string show block function
* @param options= string show block function's option
* @param cachetime int cachetime Unit for seconds
* @param user mix Generate cache solution
<{freeBlkTpl id=1}>
<link rel="stylesheet" href="<{$xoops_url}>/modules/tag/templates/style.css" />
<div class="tag-cloud" style="line-height: 150%; padding: 5px;">
<{foreach item=tag from=$block.tags}>
<span class="tag-level-<{$tag.level}>" style="font-size: <{$tag.font}>%; display: inline; padding-right: 5px;">
<a href="<{$xoops_url}>/modules/<{$block.tag_dirname}>/view.tag.php<{$smarty.const.URL_DELIMITER}><{$tag.id}>/" title="<{$tag.term}>"><{$tag.term}></a>
</span>
<{/foreach}>
</div>
<{/freeBlkTpl}>
*/
function smarty_block_freeBlkTpl($params, $content, &$smarty, &$repeat)
{
static $old_block;
if (empty($content)) {
$old_block = $smarty->get_template_vars('block');
if (!isset($params['id'])) {
return;
}
$block_id = intval($params['id']);
static $block_objs;
$blockObj = $GLOBALS['xoopsTpl']->_tpl_vars['ezblocks'][$block_id];
// ezsky hack
if (empty($blockObj)) {
return false;
}
$xoopsLogger =& XoopsLogger::instance();
$template =& $GLOBALS['xoopsTpl'];
xoops_load("cache");
$cache_key = 'xoBlkTpl_' . md5(var_export($params, true));
$bcachetime = intval($blockObj->getVar('bcachetime'));
if (!$bcachetime || !($bresult = XoopsCache::read($cache_key))) {
$xoopsLogger->addBlock($blockObj->getVar('name'));
if (!($bresult = $blockObj->buildBlock())) {
return;
}
if (isset($bcachetime)) {
XoopsCache::write($cache_key, $bresult, $bcachetime);
}
} else {
$xoopsLogger->addBlock($blockObj->getVar('name'), true, $bcachetime);
}
$old_block = $smarty->get_template_vars('block');
$smarty->assign('block', $bresult);
} else {
echo $content;
$smarty->assign('block', $old_block);
}
}
示例9: smarty_function_freeBlock
/**
* XOOPS Block management
*
* @copyright The XOOPS project http://www.xoops.org/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @package smarty xoopsplugin
* @since 2.3.3 ezsky hack
* @author ezsky <ezskyyoung@gmail.com>
* @version $Id: function.block.php $
* @package smarty xoops plugin
* Examples:
* <{freeBlock id=1}> displays just the block content
*/
function smarty_function_freeBlock($params, &$smarty)
{
if (!isset($params['id'])) {
return;
}
$block_id = intval($params['id']);
static $block_objs;
$blockObjs = $smarty->get_template_vars('ezblocks');
// ezsky hack
$blockObj = $blockObjs[$block_id];
if (empty($blockObj)) {
return false;
}
$xoopsLogger =& XoopsLogger::instance();
$template =& $GLOBALS['xoopsTpl'];
$bcachetime = intval($blockObj->getVar('bcachetime'));
if (empty($bcachetime)) {
$template->caching = 0;
} else {
$template->caching = 2;
$template->cache_lifetime = $bcachetime;
}
$template->setCompileId($blockObj->getVar('dirname', 'n'));
$tplName = ($tplName = $blockObj->getVar('template')) ? "db:{$tplName}" : "db:system_block_dummy.html";
$cacheid = 'blk_' . $block_id;
if (!$bcachetime || !$template->is_cached($tplName, $cacheid)) {
$xoopsLogger->addBlock($blockObj->getVar('name'));
if (!($bresult = $blockObj->buildBlock())) {
return;
}
$template->assign('block', $bresult);
$template->display($tplName, $cacheid);
} else {
$xoopsLogger->addBlock($blockObj->getVar('name'), true, $bcachetime);
$template->display($tplName, $cacheid);
}
$template->setCompileId($blockObj->getVar('dirname', 'n'));
}
示例10: instance
/**
* Deprecated, use getInstance() instead
*/
public function instance()
{
return XoopsLogger::getInstance();
}
示例11: footer
public function footer()
{
global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoTheme;
$xoopsLogger = XoopsLogger::getInstance();
$xoopsLogger->stopTime('Module display');
if (!headers_sent()) {
header('Content-Type:text/html; charset=' . _CHARSET);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: private, no-cache');
header('Pragma: no-cache');
}
//@internal: using global $xoTheme dereferences the variable in old versions, this does not
if (!isset($xoTheme)) {
$xoTheme = $GLOBALS['xoTheme'];
}
if (isset($GLOBALS['xoopsOption']['template_main']) && $GLOBALS['xoopsOption']['template_main'] != $xoTheme->contentTemplate) {
trigger_error('xoopsOption[template_main] should be defined before call xoops_cp_header function', E_USER_WARNING);
if (false === strpos($GLOBALS['xoopsOption']['template_main'], ':')) {
$xoTheme->contentTemplate = 'db:' . $GLOBALS['xoopsOption']['template_main'];
} else {
$xoTheme->contentTemplate = $GLOBALS['xoopsOption']['template_main'];
}
}
$xoTheme->render();
$xoopsLogger->stopTime();
ob_end_flush();
}
示例12: buildBlock
/**
* xos_logos_PageBuilder::buildBlock()
*
* @param mixed $xobject
* @param mixed $template
* @return
*/
function buildBlock($xobject, &$template)
{
// The lame type workaround will change
// bid is added temporarily as workaround for specific block manipulation
$block = array('id' => $xobject->getVar('bid'), 'module' => $xobject->getVar('dirname'), 'title' => $xobject->getVar('title'), 'weight' => $xobject->getVar('weight'), 'lastmod' => $xobject->getVar('last_modified'));
$bcachetime = intval($xobject->getVar('bcachetime'));
if (empty($bcachetime)) {
$template->caching = 0;
} else {
$template->caching = 2;
$template->cache_lifetime = $bcachetime;
}
$template->setCompileId($xobject->getVar('dirname', 'n'));
$tplName = ($tplName = $xobject->getVar('template')) ? "db:{$tplName}" : 'db:system_block_dummy.html';
$cacheid = $this->generateCacheId('blk_' . $xobject->getVar('bid'));
$xoopsLogger =& XoopsLogger::getInstance();
if (!$bcachetime || !$template->is_cached($tplName, $cacheid)) {
//Get theme metas
if ($this->theme && $bcachetime) {
foreach ($this->theme->metas as $type => $value) {
$old[$type] = $this->theme->metas[$type];
}
}
//build block
$xoopsLogger->addBlock($xobject->getVar('name'));
if ($bresult = $xobject->buildBlock()) {
$template->assign('block', $bresult);
$block['content'] = $template->fetch($tplName, $cacheid);
} else {
$block = false;
}
//check if theme added new metas
if ($this->theme && $bcachetime) {
$metas = array();
foreach ($this->theme->metas as $type => $value) {
$dif = array_diff_assoc($this->theme->metas[$type], $old[$type]);
if (count($dif)) {
$metas[$type] = $dif;
}
}
if (count($metas)) {
xoops_load('xoopscache');
$cache =& XoopsCache::getInstance();
$cache->write($cacheid, $metas);
}
}
} else {
$xoopsLogger->addBlock($xobject->getVar('name'), true, $bcachetime);
$block['content'] = $template->fetch($tplName, $cacheid);
}
//add block cached metas
if ($this->theme && $bcachetime) {
xoops_load('xoopscache');
$cache =& XoopsCache::getInstance();
if ($metas = $cache->read($cacheid)) {
foreach ($metas as $type => $value) {
$this->theme->metas[$type] = array_merge($this->theme->metas[$type], $metas[$type]);
}
}
}
$template->setCompileId();
return $block;
}
示例13: make_cblock
function make_cblock()
{
global $xoopsUser, $xoopsOption;
$xoopsblock = new XoopsBlock();
$cc_block = $cl_block = $cr_block = "";
$arr = array();
if ($xoopsOption['theme_use_smarty'] == 0) {
if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
include_once XOOPS_ROOT_PATH . '/class/template.php';
$xoopsTpl = new XoopsTpl();
} else {
$xoopsTpl =& $GLOBALS['xoopsTpl'];
}
if (is_object($xoopsUser)) {
$block_arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr = $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
}
$block_count = count($block_arr);
$xoopsLogger =& XoopsLogger::instance();
for ($i = 0; $i < $block_count; $i++) {
$bcachetime = intval($block_arr[$i]->getVar('bcachetime'));
if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
$xoopsTpl->xoops_setCacheTime($bcachetime);
}
$btpl = $block_arr[$i]->getVar('template');
if ($btpl != '') {
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl)) {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
$bresult =& $block_arr[$i]->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('block', $bresult);
$bcontent =& $xoopsTpl->fetch('db:' . $btpl);
$xoopsTpl->clear_assign('block');
} else {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
$bcontent =& $xoopsTpl->fetch('db:' . $btpl);
}
} else {
$bid = $block_arr[$i]->getVar('bid');
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
$bresult =& $block_arr[$i]->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
$bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
$xoopsTpl->clear_assign('block');
} else {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
$bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
}
}
$title = $block_arr[$i]->getVar('title');
switch ($block_arr[$i]->getVar('side')) {
case XOOPS_CENTERBLOCK_CENTER:
if ($title != "") {
$cc_block .= '<tr valign="top"><td colspan="2"><strong>' . $title . '</strong><hr />' . $bcontent . '<br /><br /></td></tr>' . "\n";
} else {
$cc_block .= '<tr><td colspan="2">' . $bcontent . '<br /><br /></td></tr>' . "\n";
}
break;
case XOOPS_CENTERBLOCK_LEFT:
if ($title != "") {
$cl_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
} else {
$cl_block .= '<p>' . $bcontent . '</p>' . "\n";
}
break;
case XOOPS_CENTERBLOCK_RIGHT:
if ($title != "") {
$cr_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
} else {
$cr_block .= '<p>' . $bcontent . '</p>' . "\n";
}
break;
default:
break;
}
unset($bcontent, $title);
}
echo '<table width="100%">' . $cc_block . '<tr valign="top"><td width="50%">' . $cl_block . '</td><td width="50%">' . $cr_block . '</td></tr></table>' . "\n";
}
}
示例14: error
<?php
// $Id: upload.php 825 2011-12-09 00:06:11Z i.bitcero $
// --------------------------------------------------------------
// Red México Common Utilities
// A framework for Red México Modules
// Author: Eduardo Cortés <i.bitcero@gmail.com>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
include '../../../mainfile.php';
XoopsLogger::getInstance()->activated = false;
XoopsLogger::getInstance()->renderingEnabled = false;
function error($message)
{
$data['error'] = 1;
$data['message'] = $message;
echo json_encode($data);
die;
}
/**
* Handle uploaded image files only.
*/
$security = TextCleaner::getInstance()->decrypt(rmc_server_var($_POST, 'rmsecurity', 0), true);
$category = rmc_server_var($_POST, 'category', 0);
$data = $security;
//base64_decode($security);
$data = explode("|", $data);
// [0] = referer, [1] = session_id(), [2] = user, [3] = token
$xoopsUser = new XoopsUser($data[0]);
if (!isset($data[1]) || $data[1] != RMCURL . '/images.php') {
示例15: saveBulkImages
/**
* @desc Almacena la información del grupo de imágenes
**/
function saveBulkImages()
{
global $util, $mc, $xoopsUser;
XoopsLogger::getInstance()->activated = false;
XoopsLogger::getInstance()->renderingEnabled = false;
set_time_limit(0);
foreach ($_POST as $k => $v) {
${$k} = $v;
}
$ruta = "page={$page}&search={$search}&owner={$uid}&sort={$sort}&mode={$mode}";
if ($xoopsUser->uid() == $uid) {
$xu = $xoopsUser;
} else {
$xu = new XoopsUser($uid);
}
//Verificamos si el usuario se encuentra registrado
$user = new GSUser($xu->uname());
if ($user->isNew()) {
//Insertamos información del usuario
$user->setUid($uid);
$user->setUname($xu->uname());
$user->setQuota($mc['quota'] * 1024 * 1024);
$user->setDate(time());
if (!$user->save()) {
send_error(__('User owner could not be created!', 'galleries') . "<br />" . $user->errors());
die;
} else {
mkdir($mc['storedir'] . "/" . $user->uname());
mkdir($mc['storedir'] . "/" . $user->uname() . "/ths");
mkdir($mc['storedir'] . "/" . $user->uname() . "/formats");
}
} else {
@mkdir($mc['storedir'] . "/" . $user->uname());
@mkdir($mc['storedir'] . "/" . $user->uname() . "/ths");
@mkdir($mc['storedir'] . "/" . $user->uname() . "/formats");
}
// Insertamos las etiquetas
$tgs = explode(",", $tags);
/**
* @desc Almacena los ids de las etiquetas que se asignarán a la imágen
*/
$ret = array();
foreach ($tgs as $k) {
$k = trim($k);
if ($k == '') {
continue;
}
// Comprobamos que la palabra tenga la longitud permitida
if (strlen($k) < $mc['min_tag'] || strlen($k) > $mc['max_tag']) {
continue;
}
// Creamos la etiqueta
$tag = new GSTag($k);
if (!$tag->isNew()) {
// Si ya existe nos saltamos
$ret[] = $tag->id();
continue;
}
$tag->setTag($k);
if ($tag->save()) {
$ret[] = $tag->id();
}
}
$errors = '';
$k = 1;
include_once RMCPATH . '/class/uploader.php';
$updir = $mc['storedir'] . "/" . $xu->uname();
$upths = $mc['storedir'] . "/" . $xu->uname() . "/ths";
// Cargamos la imágen
if (!file_exists($updir)) {
mkdir($updir, 511);
}
if (!file_exists($upths)) {
mkdir($upths, 511);
}
$uploader = new RMFileUploader($updir, $mc['size_image'] * 1024, array('gif', 'jpg', 'jpeg', 'png'));
$err = array();
if (!$uploader->fetchMedia('Filedata')) {
send_error($uploader->getErrors());
}
if (!$uploader->upload()) {
send_error($uploader->getErrors());
}
// Insertamos el archivo en la base de datos
$img = new GSImage();
$img->setTitle($uploader->savedFileName);
$img->setOwner($uid);
$img->setPublic(2);
$img->setCreated(time());
$img->setImage($uploader->getSavedFileName());
if (!$image->save()) {
unlink($uploader->savedDestination);
send_error(__('File could not be inserted to database!', 'galleries'));
}
$ret['message'] = '1';
$ret['id'] = $image->id();
echo json_encode($ret);
//.........这里部分代码省略.........