本文整理汇总了PHP中JLog::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JLog::getInstance方法的具体用法?PHP JLog::getInstance怎么用?PHP JLog::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLog
的用法示例。
在下文中一共展示了JLog::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onUserLoginFailure
function onUserLoginFailure($response)
{
jimport('joomla.error.log');
$log = JLog::getInstance();
$errorlog = array();
switch ($response['status']) {
case JAUTHENTICATE_STATUS_CANCEL:
$errorlog['status'] = $response['type'] . " CANCELED: ";
$errorlog['comment'] = $response['error_message'];
$log->addEntry($errorlog);
break;
case JAUTHENTICATE_STATUS_FAILURE:
$errorlog['status'] = $response['type'] . " FAILURE: ";
if ($this->params->get('log_username', 0)) {
$errorlog['comment'] = $response['error_message'] . ' ("' . $response['username'] . '")';
} else {
$errorlog['comment'] = $response['error_message'];
}
$log->addEntry($errorlog);
break;
default:
$errorlog['status'] = $response['type'] . " UNKNOWN ERROR: ";
$errorlog['comment'] = $response['error_message'];
$log->addEntry($errorlog);
break;
}
}
示例2: onAuthenticate
/**
* Checks to see if the payerID matches a previous payerID in the virtuemart DB
* We only care about the Username for Joomla, but the password is really the payerID
* That is passed from Virtuemart. The payerID is then used to check the ID from
* Joomla with the ID in the Virtuemart user_info. We do this just to make sure it is
* The correct user trying to login and not someone else
*
* @access public
* @param string $username Username for authentication
* @param string $password Password for authentication
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate($credentials, $options, &$response)
{
$db =& JFactory::getDBO();
$query = 'SELECT * FROM `#__users` WHERE username=' . $db->Quote($credentials['username']);
$db->setQuery($query);
$result = $db->loadObject();
$options = array('format' => "{DATE}\t{TIME}\t{USER_ID}\t{COMMENT}");
$log =& JLog::getInstance();
if (!$result) {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'User does not exist';
$log->addEntry(array('comment' => 'User does not exist'));
} else {
$log->addEntry(array('comment' => 'Found User'));
$query = 'SELECT * FROM `#__vm_user_info` WHERE extra_field_3 =' . $db->Quote($credentials['password']) . ' AND user_id =' . $db->Quote($result->id) . ' ORDER by mdate DESC';
$db->setQuery($query);
$result2 = $db->loadObject();
//Check to see if we found a user with the User Id and Payer Id match
//If so login the user and if not do not login.
if (!$result2) {
$log->addEntry(array('comment' => 'No user found with Payer ID in Virtuemart'));
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'No user found with Payer ID in Virtuemart';
} else {
$log->addEntry(array('comment' => 'User Found Logging in...'));
$response->email = $result->email;
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
}
}
}
示例3: log
public function log()
{
$trace = "";
foreach ($this->trace as $v) {
$trace .= "===================================\n";
$trace .= "FILE:" . $v['file'] . "\n";
$trace .= "LINE:" . $v['line'] . "\n";
$trace .= "CLASS:" . $v['class'] . "\n";
$trace .= "FUNCTION:" . $v['function'] . "\n";
// $trace .="ARGS:" . var_export($v['args'], true) . "\n";
$trace .= "====================================\n";
}
$message = "*****************************************\n";
$message = "\nFILE : " . $this->getFile() . "\n";
$message .= "LINE : " . $this->getLine() . "\n";
$message .= "CODE : " . $this->getCode() . "\n";
$message .= "MESSAGE : " . $this->getMessage() . "\n";
if ($this->data) {
$message .= "EXTRA INFO : " . $this->data . "\n";
}
if ($trace) {
$message .= "TRACE : " . $trace . "\n";
}
$message = "*****************************************\n";
// get an instance of JLog for myerrors log file
$log = JLog::getInstance();
$entry = new JLogEntry($message, JLog::ALERT);
$log->add($entry);
}
示例4: log
public function log($message)
{
// get an instance of JLog for myerrors log file
$log = JLog::getInstance();
$entry = new JLogEntry($message, JLog::ALERT);
$log->add($entry);
}
示例5: getShortUrl
/**
* A method that make a long url to short url
*
* @param string $link
* @param array $params
* @return string
*/
public static function getShortUrl($link, $params){
JLoader::register("ItpShortUrlSocialButtons",JPATH_PLUGINS.DS."content".DS."itpsocialbuttons".DS."itpshorturlsocialbuttons.php");
$options = array(
"login" => $params->get("login"),
"apiKey" => $params->get("apiKey"),
"service" => $params->get("shortUrlService"),
);
$shortUrl = new ItpShortUrlSocialButtons($link,$options);
$shortLink = $shortUrl->getUrl();
if(!$shortLink) {
jimport( 'joomla.error.log' );
// get an instance of JLog for myerrors log file
$log = JLog::getInstance();
// create entry array
$entry = array(
'LEVEL' => '1',
'STATUS' => "ITPSocialButtons",
'COMMENT' => $shortUrl->getError()
);
// add entry to the log
$log->addEntry($entry);
} else {
$link = $shortLink;
}
return $link;
}
示例6: Storelog
function Storelog($name, $logdata)
{
jimport('joomla.error.log');
$options = array('format' => "{DATE}\t{TIME}\t{USER}\t{DESC}");
$path = dirname(__FILE__);
$my =& JFactory::getUser();
$logs =& JLog::getInstance($logdata['JT_CLIENT'] . '_' . $name . '.log', $options, $path);
$logs->addEntry(array('user' => $my->name . '(' . $my->id . ')', 'desc' => json_encode($logdata['raw_data'])));
}
示例7: writeEntry
function writeEntry($log_array = array(), $filename = 'joomlalms_error_log.txt', $format = 'Date: {DATE} {TIME} {COMMENT}')
{
jimport('joomla.error.log');
$log =& JLog::getInstance($filename, array('format' => $format));
$log_array[] = '###########################################################################';
$log_text = "\n" . implode("\n", $log_array) . "\n";
$status = $log->addEntry(array('COMMENT' => $log_text));
return $status;
}
示例8: hellodefault
function hellodefault()
{
//get text string based on languages
$ret = JText::_('hellodefault');
//log information
jimport('joomla.utilities.log');
$log =& JLog::getInstance();
$log->addEntry(array("level" => 0, "status" => 1, "comment" => "hellodefault :" . $ret));
//print string
echo $ret;
}
示例9: getData
public function getData()
{
if (!isset($this->data)) {
$query = "SELECT name, username, email, id FROM #__users";
$this->data = $this->_getList($query);
}
jimport('joomla.error.log');
$log = JLog::getInstance('first_user.php');
$entry = array('LEVEL' => 1, 'STATUS' => 'First username: ', 'COMMENT' => $this->data[0]->username);
$log->addEntry($entry);
return $this->data;
}
示例10: Storelog
function Storelog($name, $logdata)
{
jimport('joomla.error.log');
$options = array('format' => "{DATE}\t{TIME}\t{USER}\t{DESC}");
if (JVERSION >= '1.6.0') {
$path = JPATH_SITE . '/plugins/payment/' . $name . '/' . $name . '/';
} else {
$path = JPATH_SITE . '/plugins/payment/' . $name . '/';
}
$my = JFactory::getUser();
$logs = JLog::getInstance($logdata['JT_CLIENT'] . '_' . $name . '.log', $options, $path);
$logs->addEntry(array('user' => $my->name . '(' . $my->id . ')', 'desc' => json_encode($logdata['raw_data'])));
}
示例11: log
function log($msg)
{
global $linkr_debug;
if (empty($msg) || !$linkr_debug['debug']) {
return;
}
static $log;
if (is_null($log)) {
jimport('joomla.error.log');
$o = array('format' => '{DATE} {TIME} ({C-IP}), {COMMENT}');
$log =& JLog::getInstance('linkr.php', $o);
}
$log->addEntry(array('comment' => $msg));
}
示例12: getItemsByCategoria
/**
* Ritorna un array di righe.
*
* @param string $where
* @param string $orderby
* @return array Array di risultati
*/
public function getItemsByCategoria($where = 'pubblicato=1', $orderby = 'datapubblicazione DESC') {
try {
if (empty($this->_items)) {
$this->_items = $this->_getList($this->_build_query($where, $orderby), $this->getState('limitstart'), $this->getState('limit'));
if ($this->_dbg)
$this->_japp->enqueueMessage('Fetched rows :' . count($this->_items));
}
return $this->_items;
} catch (Exception $e) {
jimport('joomla.error.log');
$log = &JLog::getInstance('com_gglms.log.php');
$log->addEntry(array('comment' => $e->getMessage(), 'status' => $e->getCopde));
if ($this->_dbg)
$this->_japp->enqueueMessage($e->getMessage(), 'error');
$this->_content = array();
}
}
示例13: __construct
protected function __construct()
{
$this->_log =& JLog::getInstance('db.error.php');
$conf =& JFactory::getConfig();
$host = $conf->getValue('config.oracleHost');
$port = $conf->getValue('config.oraclePort');
$service = $conf->getValue('config.oracleServiceName');
$db_username = $conf->getValue('config.oracleUser');
$db_password = $conf->getValue('config.oraclePassword');
$tns = "\n\t\t\t(DESCRIPTION =\n\t\t\t\t(ADDRESS_LIST =\n\t\t\t\t\t(ADDRESS = (PROTOCOL = TCP)(HOST = {$host})(PORT = {$port}))\n\t\t\t\t)\n\t\t\t\t(CONNECT_DATA =\n\t\t\t\t\t(SERVICE_NAME = {$service})\n\t\t\t\t)\n\t\t\t)\n\t\t\t";
try {
$this->_pdo = new PDO("oci:dbname=" . $tns . ";charset=TR8MSWIN1254", $db_username, $db_password);
// hatalar� g�rmek i�in a�a��daki sat�r� uncomment yap
$this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
} catch (Exception $e) {
$this->log($e->getMessage());
print_r("Oracle'a bağlanılamadı: " . $e->getMessage());
exit;
}
}
示例14: onLoginFailure
function onLoginFailure($response)
{
jimport('joomla.error.log');
$log = JLog::getInstance();
$errorlog = array();
switch ($response['status']) {
case JAUTHENTICATE_STATUS_CANCEL:
$errorlog['status'] = $response['type'] . " CANCELED: ";
$errorlog['comment'] = $response['error_message'];
$log->addEntry($errorlog);
break;
case JAUTHENTICATE_STATUS_FAILURE:
$errorlog['status'] = $response['type'] . " FAILURE: ";
$errorlog['comment'] = $response['error_message'];
$log->addEntry($errorlog);
break;
default:
$errorlog['status'] = $response['type'] . " UNKNOWN ERROR: ";
$errorlog['comment'] = $response['error_message'];
$log->addEntry($errorlog);
break;
}
}
示例15: start_upload
function start_upload()
{
$mainframe =& JFactory::getApplication();
$file = JRequest::getVar('Filedata', '', 'files', 'array');
$folder = JPATH_ADMINISTRATOR . DS . 'components/com_joomailermailchimpintegration/templates/';
$format = JRequest::getVar('format', 'html', '', 'cmd');
$return = JRequest::getVar('return-url', null, 'post', 'base64');
$err = null;
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Make the filename safe
jimport('joomla.filesystem.file');
$file['name'] = JFile::makeSafe($file['name']);
if (isset($file['name'])) {
$filepath = JPath::clean($folder . DS . strtolower($file['name']));
if (!$this->canUpload($file, $err)) {
if ($format == 'json') {
jimport('joomla.error.log');
$log =& JLog::getInstance('upload.error.php');
$log->addEntry(array('comment' => 'Invalid: ' . $filepath . ': ' . $err));
header('HTTP/1.0 415 Unsupported Media Type');
jexit('Error. Unsupported Media Type!');
} else {
JError::raiseNotice(100, JText::_($err));
if ($return) {
$mainframe->redirect(base64_decode($return));
}
return;
}
}
if (JFile::exists($filepath)) {
if ($format == 'json') {
jimport('joomla.error.log');
$log =& JLog::getInstance('upload.error.php');
$log->addEntry(array('comment' => 'File already exists: ' . $filepath));
header('HTTP/1.0 409 Conflict');
jexit('Error. File already exists');
} else {
JError::raiseNotice(100, JText::_('Error. File already exists'));
if ($return) {
$mainframe->redirect(base64_decode($return));
}
return;
}
}
if (!JFile::upload($file['tmp_name'], $filepath)) {
if ($format == 'json') {
jimport('joomla.error.log');
$log =& JLog::getInstance('upload.error.php');
$log->addEntry(array('comment' => 'Cannot upload: ' . $filepath));
header('HTTP/1.0 400 Bad Request');
jexit('Error. Unable to upload file');
} else {
JError::raiseWarning(100, JText::_('Error. Unable to upload file'));
if ($return) {
$mainframe->redirect(base64_decode($return));
}
return;
}
} else {
if ($format == 'json') {
jimport('joomla.error.log');
$log =& JLog::getInstance();
$log->addEntry(array('comment' => $folder));
jexit(JText::_('JM_UPLOAD_COMPLETE'));
} else {
if ($this->unzip($folder, strtolower($file['name']))) {
$msg = JText::_('JM_UPLOAD_COMPLETE');
} else {
$msg = JText::_('Error. Unable to upload file');
}
}
}
} else {
$mainframe->redirect('index.php', 'Invalid Request', 'error');
}
$link = 'index.php?option=com_joomailermailchimpintegration&view=templates';
$this->setRedirect($link, $msg);
}