本文整理汇总了PHP中_log函数的典型用法代码示例。如果您正苦于以下问题:PHP _log函数的具体用法?PHP _log怎么用?PHP _log使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exception
function exception($e)
{
$v = new View('exception');
$v->e = $e;
_log($e->getMessage() . ' ' . $e->getFile());
die($v);
}
示例2: perform
/**
* Performs the import task.
*/
public function perform()
{
// Set current user for this long running job.
// Zend_Registry::get('bootstrap')->bootstrap('Acl');
$memoryLimit = (int) get_option('oai_pmh_static_repository_memory_limit');
if ($memoryLimit) {
ini_set('memory_limit', $memoryLimit);
}
$folder = $this->_getFolder();
if (empty($folder)) {
throw new UnexpectedValueException(__('Unable to process folder #%d, it does not exist.', $this->_folderId));
}
// Resent jobs can remain queued after all the items themselves have
// been deleted. Skip if that's the case.
if ($folder->status == OaiPmhStaticRepository::STATUS_DELETED) {
_log('[OaiPmhStaticRepository] ' . __('The folder for uri "%s" (# %d) was deleted prior to running this job.', $folder->uri, $folder->id), Zend_Log::NOTICE);
return;
}
try {
$folder->process($this->_processType);
} catch (Exception $e) {
$message = $e->getMessage();
$folder->setStatus(OaiPmhStaticRepository::STATUS_ERROR);
$folder->addMessage($message, OaiPmhStaticRepository::MESSAGE_CODE_ERROR);
_log('[OaiPmhStaticRepository] ' . __('Error when processing folder "%s" (#%d): %s', $folder->uri, $folder->id, $message), Zend_Log::ERR);
}
}
示例3: connect
/**
* 连接数据库方法
* @access public
*/
public function connect($config = '', $linkNum = 0)
{
if (!isset($this->linkID[$linkNum])) {
if (empty($config)) {
$config = $this->config;
}
try {
if (empty($config['dsn'])) {
$config['dsn'] = $this->parseDsn($config);
}
if (version_compare(PHP_VERSION, '5.3.6', '<=')) {
//禁用模拟预处理语句
$this->options[PDO::ATTR_EMULATE_PREPARES] = false;
}
if (C('CONNECT_POOL') === true) {
_log($options, 'connect', 'Think\\Db\\Lite', 'INFO');
$this->linkID[$linkNum] = new \pdo_connect_pool(array('master' => array('data_source' => $config['dsn'], 'username' => $config['username'], 'pwd' => $config['password'])));
} else {
$this->linkID[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $this->options);
}
} catch (\PDOException $e) {
E($e->getMessage());
}
}
return $this->linkID[$linkNum];
}
示例4: import
public function import()
{
if (!$this->record) {
$this->record = new ExhibitPageBlock();
}
$this->record->page_id = $this->responseData['page_id'];
$this->record->layout = $this->responseData['layout'];
$this->record->text = $this->responseData['text'];
$this->record->order = $this->responseData['order'];
$this->record->options = json_encode($this->responseData['options']);
try {
$this->record->save(true);
$this->addOmekaApiImportRecordIdMap();
} catch (Exception $e) {
_log($e);
}
$attachmentAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $this->endpointUri, 'ExhibitBlockAttachment');
$attachmentAdapter->setResourceProperties(array('file' => 'File', 'item' => 'Item'));
foreach ($this->responseData['attachments'] as $order => $attachmentData) {
$attachmentData['order'] = $order;
$attachmentData['block_id'] = $this->record->id;
$attachmentAdapter->resetResponseData($attachmentData);
$attachmentAdapter->import();
}
}
示例5: openvox_hook_sendsms
function openvox_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "openvox_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
if ($plugin_config['openvox']['gateway_host'] && $plugin_config['openvox']['gateway_port'] && $sms_to && $sms_msg) {
$query_string = "username=" . $plugin_config['openvox']['username'] . "&password=" . $plugin_config['openvox']['password'] . "&phonenumber=" . urlencode($sms_to) . "&message=" . urlencode($sms_msg) . "&report=JSON&smslog_id=" . $smslog_id;
$url = 'http://' . $plugin_config['openvox']['gateway_host'] . ":" . $plugin_config['openvox']['gateway_port'] . '/sendsms?' . $query_string;
_log("url:[" . $url . "]", 3, "openvox outgoing");
$resp = json_decode(file_get_contents($url), true);
$data = $resp['report'][0][0][0];
$data['message'] = $resp['message'];
_log('response result:' . $data['result'] . ' port:' . $data['port'] . ' to:' . $data['phonenumber'] . ' time:' . $data['time'], 3, 'openvox_hook_sendsms');
if ($data['result'] == 'success') {
$p_status = 1;
dlr($smslog_id, $uid, $p_status);
} else {
$p_status = 2;
dlr($smslog_id, $uid, $p_status);
}
}
return TRUE;
}
示例6: createTiles
/**
* Passed a file name, it will initilize the zoomify and cut the tiles.
*
* @param filename of image
*/
public function createTiles($filename)
{
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Zoomify' . DIRECTORY_SEPARATOR . 'Zoomify.php';
// Tiles are built in-place, in a subdir of the original image folder.
// TODO Add a destination path to use local server path and to avoid move.
$originalDir = FILES_DIR . DIRECTORY_SEPARATOR . 'original' . DIRECTORY_SEPARATOR;
list($root, $ext) = $this->getRootAndExtension($filename);
$sourcePath = $originalDir . $root . OpenLayersZoom_Creator::ZOOM_FOLDER_EXTENSION;
$zoomify = new Zoomify($originalDir);
$zoomify->zoomifyObject($filename, $originalDir);
// Move the tiles into their storage directory.
if (file_exists($sourcePath)) {
// Check if destination folder exists, else create it.
$destinationPath = $this->getZDataDir($filename);
if (!is_dir(dirname($destinationPath))) {
$result = mkdir(dirname($destinationPath), 0755, true);
if (!$result) {
$message = __('Impossible to create destination directory: "%s" for file "%s".', $destinationPath, basename($filename));
_log($message, Zend_Log::WARN);
throw new Omeka_Storage_Exception($message);
}
}
$result = rename($sourcePath, $destinationPath);
}
}
示例7: import
public function import()
{
$localElementSet = $this->db->getTable('OmekaApiImportRecordIdMap')->localRecord('ElementSet', $this->responseData['element_set']['id'], $this->endpointUri);
//look for a local record, first by whether it's been imported, which is done in construct,
//then by the element set name
if (!$this->record) {
$this->record = $this->db->getTable('Element')->findByElementSetNameAndElementName($localElementSet->name, $this->responseData['name']);
}
if (!$this->record) {
$this->record = new Element();
}
//set new value if element set exists and override is set, or if it is brand new
if ($this->record->exists() && get_option('omeka_api_import_override_element_set_data') || !$this->record->exists()) {
$this->record->description = $this->responseData['description'];
$this->record->name = $this->responseData['name'];
$this->record->element_set_id = $localElementSet->id;
$this->record->order = $this->responseData['order'];
$this->record->comment = $this->responseData['comment'];
}
try {
$this->record->save(true);
$this->addOmekaApiImportRecordIdMap();
} catch (Exception $e) {
_log($e);
}
}
示例8: _exit
function _exit()
{
_log(L_INFO, "Shutting down...");
$icarus = Icarus::getInstance();
if ($icarus->isRunning()) $icarus->end();
exit;
}
示例9: addRow
function addRow()
{
global $db;
_log(__FILE__ . " - line " . __LINE__ . ": Adding row not supported: " . print_r($_REQUEST, TRUE));
exit(0);
// flag jQueryGrid that this failed
}
示例10: receiveResponseXML
/**
* Function get response from QB
*
* @return string
* @param object $param
* @access public
* @version 2013-03-15
*/
public function receiveResponseXML($param = '')
{
$response = simplexml_load_string($param->response);
$iteratorID = trim($response->QBXMLMsgsRs->CustomerQueryRs->attributes()->iteratorID);
// set new iteratorID
requestId($iteratorID);
if ($param->ticket == QB_TICKET && isset($response->QBXMLMsgsRs->CustomerQueryRs->CustomerRet)) {
$rows = $response->QBXMLMsgsRs->CustomerQueryRs;
settype($rows, 'array');
// if list contain only one item row
if (isset($rows['CustomerRet']->ListID)) {
$rows = array($rows['CustomerRet']);
} else {
$rows = $rows['CustomerRet'];
}
$data = array();
foreach ($rows as $i => $r) {
settype($r, 'array');
$data[] = array('qb_id' => trim($r['ListID']), 'qb_es' => trim($r['EditSequence']), 'is_active' => trim($r['IsActive']), 'phone' => trim($r['Phone']), 'notes' => trim($r['Notes']), 'fax' => trim($r['Fax']), 'company_name' => trim($r['Name']), 'b_email' => trim($r['Email']), 'b_email_other' => trim($r['Cc']), 'b_phone' => trim($r['AltPhone']), 'b_salutation' => trim($r['Salutation']), 'b_fname' => trim($r['FirstName']), 'b_lname' => trim($r['LastName']), 'b_address' => trim($r['BillAddress']->Addr1), 'b_address2' => trim($r['BillAddress']->Addr2), 'b_address3' => trim($r['BillAddress']->Addr3), 'b_city' => trim($r['BillAddress']->City), 'b_state' => trim($r['BillAddress']->State), 'b_country' => trim($r['BillAddress']->Country), 'b_zip' => trim($r['BillAddress']->PostalCode));
}
// echo data into log file
_log(print_r($data, 1));
$this->response->receiveResponseXMLResult = '30';
} else {
$this->response->receiveResponseXMLResult = '100';
}
return $this->response;
}
示例11: authenticate
/**
* Performs an authentication attempt.
*
* @return Zend_Auth_Result The result of the authentication.
*/
public function authenticate()
{
// Use the parent method to authenticate the user.
$result = parent::authenticate();
// Check if user actually authenticated.
if ($result->isValid()) {
if (get_option('central_auth_email')) {
// If user matching is by email, create email address.
$lookup = $this->getUsername() . '@' . get_option('central_auth_email_domain');
// Lookup the user by their email address in the user table.
$user = get_db()->getTable('User')->findByEmail($lookup);
} else {
// Otherwise use the username.
$lookup = $this->getUsername();
// Lookup the user by their username in the user table.
$user = get_db()->getTable('User')->findBySql('username = ?', array($lookup), true);
}
// If the user was found and active, return success.
if ($user && $user->active) {
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $user->id);
}
// Return that the user does not have an active account.
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $lookup, array(__('User matching "%s" not found.', $lookup)));
}
// Otherwise, log messages to error log.
$messages = $result->getMessages();
_log('CentralAuth_LdapAdapter: ' . implode("\n", $messages), Zend_Log::ERR);
// Return the parent's result with error message meant for user.
return new Zend_Auth_Result($result->getCode(), $result->getIdentity(), array($messages[0]));
}
示例12: import
public function import()
{
if (!$this->record) {
$this->record = new $this->recordType();
}
$this->setFromResponseData();
// Rewrite required_element_ids and required_multielement_ids to
// make sure they use the local ids.
$requiredElementIds = json_decode($this->record->required_element_ids, true);
$localRequiredElementIds = array();
foreach ($requiredElementIds as $id) {
// data for getLocalResourceId is an array
$data = array('id' => $id);
$localRequiredElementIds[] = $this->getLocalResourceId($data, 'Element');
}
$this->record->required_element_ids = json_encode($localRequiredElementIds);
$requiredMultiElementIds = json_decode($this->record->require_multielement_ids, true);
$localRequiredMultiElementIds = array();
foreach ($requiredMultiElementIds as $id) {
// data for getLocalResourceId is an array
$data = array('id' => $id);
$localRequiredMultiElementIds[] = $this->getLocalResourceId($data, 'UserProfilesMultiElement');
}
$this->record->required_multielement_ids = json_encode($localRequiredMultiElementIds);
try {
$this->record->save(true);
$this->addOmekaApiImportRecordIdMap();
} catch (Exception $e) {
_log($e);
}
return $this->record;
}
示例13: init
/**
* Build the form.
*/
public function init()
{
parent::init();
$this->setMethod('post');
$this->setAttrib('id', 'datastream-form');
// Server.
$this->addElement('select', 'server', array('label' => __('Server'), 'description' => __('Select a Fedora server.'), 'multiOptions' => $this->getServersForSelect()));
// PID.
$this->addElement('text', 'pid', array('label' => __('PID'), 'description' => __('Enter the PID of the Fedora resource.'), 'size' => 40));
// Datastream.
$this->addElement('multiselect', 'dsids', array('label' => __('Datastreams'), 'description' => __('Choose one or more datastreams.'), 'attribs' => array('size' => 20), 'multiOptions' => array()));
// Import.
$this->addElement('checkbox', 'import', array('label' => 'Import now?', 'description' => 'Import Fedora data when the Item is saved.'));
// Query datastreams uri.
$this->addElement('hidden', 'datastreams-uri', array('value' => url('fedora-connector/datastreams')));
/************************************************************
*REVISIONS
* Ver Date Author Description
* -------- ---------- -------------- ----------------------
* 1.0 09/02/2015 mrs175 1. added try catch blocks
************************************************************/
// Saved dsid.
try {
$this->addElement('hidden', 'saved-dsids');
} catch (Exception $e) {
_log($e->getMessage());
}
try {
$this->addDisplayGroup(array('server', 'pid', 'dsids', 'import', 'datastreams-uri', 'saved-dsids'), 'fedora');
} catch (Exception $e) {
_log($e->getMessage());
}
}
示例14: s_ajax_page_save_log
function s_ajax_page_save_log()
{
if (LOG_DEBUG_INFO) {
$debuglog_str = dflush_str();
_log("[[ Ajax info ]]\n\n{$debuglog_str}\n\n");
}
}
示例15: import
/**
* Import the Dublin Core Metadata stored in the descProperties datastream
*
* @param Omeka_Record $object The Fedora object record.
* @param string $dsid The datastream ID to import.
*/
public function import($object, $dsid)
{
//Gets the url to the item's datastream content (ex: /fedora/objects/abc:defg890/datastreams/descMetadata/content)
$url = $object->getMetadataUrl($dsid);
$descMetadataContent = file_get_contents($url);
//these are the only metadata types in the datastream
$CPHMetadataTypes = explode(' ', 'Title Creator Subject Description Publisher Contributor Type Format Identifier Language Relation Rights');
$elements = $this->db->getTable('Element')->findBySet('Dublin Core');
$itemID = $object->getItem()->id;
//save datastream element texts
foreach ($elements as $element) {
//current element is one of the types in the datastream
if (in_array($element->name, $CPHMetadataTypes, true)) {
$elementName = strtolower($element->name) . '> "';
$start = strpos($descMetadataContent, $elementName);
$end = strpos($descMetadataContent, '" .', $start);
$elementNameLength = strlen($elementName);
$elementText = substr($descMetadataContent, $start + $elementNameLength, $end - $start - $elementNameLength);
$checkIfEmpty = trim($elementText);
//only save the element if it has content
if (!empty($checkIfEmpty)) {
try {
$this->saveElementText($itemID, $element->id, $elementText);
} catch (Exception $e) {
_log($e->getMessage());
}
}
}
}
}