本文整理汇总了PHP中System::log方法的典型用法代码示例。如果您正苦于以下问题:PHP System::log方法的具体用法?PHP System::log怎么用?PHP System::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executePostActionsHook
public function executePostActionsHook($strAction, \DataContainer $dc)
{
if ($strAction !== static::$uploadAction) {
return false;
}
// Check whether the field is allowed for regular users
if (!isset($GLOBALS['TL_DCA'][$dc->table]['fields'][\Input::post('field')]) || $GLOBALS['TL_DCA'][$dc->table]['fields'][\Input::post('field')]['exclude'] && !\BackendUser::getInstance()->hasAccess($dc->table . '::' . \Input::post('field'), 'alexf')) {
\System::log('Field "' . \Input::post('field') . '" is not an allowed selector field (possible SQL injection attempt)', __METHOD__, TL_ERROR);
$objResponse = new ResponseError();
$objResponse->setMessage('Bad Request');
$objResponse->output();
}
$this->name = \Input::post('field');
$this->id = \Input::post('field');
$this->field = \Input::post('field');
if ($dc->activeRecord === null) {
$dc->activeRecord = General::getModelInstance($dc->table, $dc->id);
}
// add dca attributes
$this->addAttributes(\Widget::getAttributesFromDca($GLOBALS['TL_DCA'][$dc->table]['fields'][$this->name], $this->name));
$objResponse = $this->upload();
/** @var Response */
if ($objResponse instanceof Response) {
$objResponse->output();
}
}
示例2: getLonLat
/**
* Find the longitute and latitude from a location string
* @param type $strAddress
* @param type $strCountry
* @example http://wiki.openstreetmap.org/wiki/Nominatim#Examples
*/
public static function getLonLat($strAddress, $strCountry = null)
{
$strQuery = 'https://nominatim.openstreetmap.org/search?' . 'q=' . rawurlencode($strAddress) . '&format=json' . '&accept-language=' . $GLOBALS['TL_LANGUAGE'] . '&limit=1';
if ($strCountry) {
$strQuery .= '&countrycodes=' . $strCountry;
}
$objRequest = new \Request();
$objRequest->send($strQuery);
// Return on error
if ($objRequest->hasError()) {
\System::log("Failed Request '{$strQuery}' with error '{$objRequest->error}'", __METHOD__, TL_ERROR);
return false;
}
$arrResponse = json_decode($objRequest->response);
// Return on empty response
if (!count($arrResponse)) {
\System::log("Empty Request for address '{$strAddress}': '{$strQuery}'", __METHOD__, TL_ERROR);
return false;
}
// Display copyright and licence in backend
if (TL_MODE == 'BE') {
\Message::addInfo($arrResponse[0]->licence);
}
return array('licence' => $arrResponse[0]->licence, 'address' => $arrResponse[0]->display_name, 'latitude' => $arrResponse[0]->lat, 'longitude' => $arrResponse[0]->lon);
}
示例3: check
/**
* Check permissions for that entry
* @return void
*/
public static function check()
{
$session = \Session::getInstance()->getData();
if (\Input::get('act') == 'delete' && in_array(\Input::get('id'), static::getUndeletableIds())) {
\System::log('Product type ID ' . \Input::get('id') . ' is used in an order and can\'t be deleted', __METHOD__, TL_ERROR);
\Controller::redirect('contao/main.php?act=error');
} elseif (\Input::get('act') == 'deleteAll' && is_array($session['CURRENT']['IDS'])) {
$arrDeletable = array_diff($session['CURRENT']['IDS'], static::getUndeletableIds());
if (count($arrDeletable) != count($session['CURRENT']['IDS'])) {
$session['CURRENT']['IDS'] = array_values($arrDeletable);
\Session::getInstance()->setData($session);
\Message::addInfo($GLOBALS['TL_LANG']['MSC']['undeletableRecords']);
}
}
// Disable variants if no such attributes are available
\Controller::loadDataContainer('tl_iso_product');
$blnVariants = false;
foreach ($GLOBALS['TL_DCA']['tl_iso_product']['fields'] as $strName => $arrConfig) {
$objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$strName];
if (null !== $objAttribute && $objAttribute->isVariantOption()) {
$blnVariants = true;
break;
}
}
if (!$blnVariants) {
\System::loadLanguageFile('explain');
unset($GLOBALS['TL_DCA']['tl_iso_producttype']['subpalettes']['variants']);
$GLOBALS['TL_DCA']['tl_iso_producttype']['fields']['variants']['input_field_callback'] = function ($dc) {
// Make sure variants are disabled in this product type (see #1114)
\Database::getInstance()->prepare("UPDATE " . $dc->table . " SET variants='' WHERE id=?")->execute($dc->id);
return '<br><p class="tl_info">' . $GLOBALS['TL_LANG']['XPL']['noVariantAttributes'] . '</p>';
};
}
}
示例4: getLonLat
/**
* Find the longitute and latitude from a location string
* @param string $strAddress Optimal format: street (+number), postal, city [country]
* @param string
* @return array|bool return an array with logitute, latitude and address or false if error or empty results
* @example https://developers.google.com/maps/documentation/geocoding/?hl=de
*/
public static function getLonLat($strAddress, $strCountry = null)
{
// Google Geocoding API v3
$strUrl = 'https://maps.googleapis.com/maps/api/geocode/json';
$arrParams = array('address' => $strAddress, 'language' => $GLOBALS['TL_LANGUAGE']);
if (\Config::get('anystores_apiKey')) {
$arrParams['key'] = \Config::get('anystores_apiKey');
}
$strQuery = $strUrl . '?' . http_build_query($arrParams, '', '&');
if ($strCountry) {
$strQuery .= '&components=country:' . strtoupper($strCountry);
}
$objRequest = new \Request();
$objRequest->send($strQuery);
if (!$objRequest->hasError()) {
$objResponse = json_decode($objRequest->response);
// check the possible return status
switch ($objResponse->status) {
case 'OK':
return array('address' => $objResponse->results[0]->formatted_address, 'longitude' => $objResponse->results[0]->geometry->location->lng, 'latitude' => $objResponse->results[0]->geometry->location->lat);
case 'ZERO_RESULTS':
case 'OVER_QUERY_LIMIT':
case 'REQUEST_DENIED':
case 'INVALID_REQUEST':
default:
\System::log("Google Maps API return error '{$objResponse->status}' for '{$strAddress}': {$objResponse->error_message}", __METHOD__, TL_ERROR);
return false;
}
}
\System::log("Failed Request '{$strQuery}' with error '{$objRequest->error}'", __METHOD__, TL_ERROR);
return false;
}
示例5: processPostsale
/**
* Process Transaction URL notification
*
* @param IsotopeProductCollection|Order $objOrder
*/
public function processPostsale(IsotopeProductCollection $objOrder)
{
if (\Input::post('aid') != $this->payone_aid || \Input::post('portalid') != $this->payone_portalid || \Input::post('mode') == 'test' && !$this->debug || \Input::post('mode') == 'live' && $this->debug) {
\System::log('PayOne configuration mismatch', __METHOD__, TL_ERROR);
die('TSOK');
}
// Ignore all except these actions
if (\Input::post('txaction') != 'appointed' && \Input::post('txaction') != 'capture' && \Input::post('txaction') != 'paid') {
die('TSOK');
}
if (\Input::post('currency') != $objOrder->currency || $objOrder->getTotal() != \Input::post('price')) {
\System::log('PayOne order data mismatch for Order ID "' . \Input::post('reference') . '"', __METHOD__, TL_ERROR);
die('TSOK');
}
if (!$objOrder->checkout()) {
\System::log('Postsale checkout for Order ID "' . \Input::post('reference') . '" failed', __METHOD__, TL_ERROR);
die('TSOK');
}
if (\Input::post('txaction') == 'paid' && \Input::post('balance') == 0) {
$objOrder->date_paid = time();
}
$objOrder->updateOrderStatus($this->new_order_status);
$objOrder->save();
// PayOne must get TSOK as return value, otherwise the request will be sent again
die('TSOK');
}
示例6: run
/**
* Run the controller
*/
public function run()
{
// Check if shop has been installed
$blnInstalled = \Database::getInstance()->tableExists(\Isotope\Model\Config::getTable());
$strStep = '';
foreach (scan(TL_ROOT . '/system/modules/isotope/library/Isotope/Upgrade') as $strFile) {
$strVersion = pathinfo($strFile, PATHINFO_FILENAME);
if (preg_match('/To[0-9]{10}/', $strVersion)) {
$strClass = 'Isotope\\Upgrade\\' . $strVersion;
$strStep = 'Version ' . \Haste\Util\Format::repositoryVersion(substr($strVersion, 2));
try {
$objUpgrade = new $strClass();
$objUpgrade->run($blnInstalled);
} catch (\Exception $e) {
$this->handleException($strStep, $e);
}
}
}
if ($blnInstalled) {
try {
$this->verifySystemIntegrity();
$this->purgeCaches();
} catch (\Exception $e) {
$this->handleException('Finalization', $e);
}
}
if ($strStep != '') {
\System::log('Upgraded Isotope eCommerce to ' . $strStep, TL_INFO, __METHOD__);
}
}
示例7: send
/**
* Create file
*
* @param Message
* @param array
* @param string
* @return bool
*/
public function send(Message $objMessage, array $arrTokens, $strLanguage = '')
{
if ($strLanguage == '') {
$strLanguage = $GLOBALS['TL_LANGUAGE'];
}
if (($objLanguage = Language::findByMessageAndLanguageOrFallback($objMessage, $strLanguage)) === null) {
\System::log(sprintf('Could not find matching language or fallback for message ID "%s" and language "%s".', $objMessage->id, $strLanguage), __METHOD__, TL_ERROR);
return false;
}
$strFileName = \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($objLanguage->file_name, $arrTokens, String::NO_TAGS | String::NO_BREAKS);
// Escape quotes and line breaks for CSV files
if ($this->objModel->file_type == 'csv') {
array_walk($arrTokens, function (&$varValue) {
$varValue = str_replace(array('"', "\r\n", "\r"), array('""', "\n", "\n"), $varValue);
});
}
// Preserve all tags here as this is pretty useful in XML :-)
$strContent = \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($objLanguage->file_content, $arrTokens);
try {
return $this->save($strFileName, $strContent, (string) $objLanguage->file_storage_mode);
} catch (\Exception $e) {
\System::log('Notification Center gateway error: ' . $e->getMessage(), __METHOD__, TL_ERROR);
return false;
}
}
示例8: processPostsale
/**
* Perform server to server data check
*
* @param IsotopeProductCollection|Order $objOrder
*/
public function processPostsale(IsotopeProductCollection $objOrder)
{
// Verify payment status
if (\Input::post('vads_result') != '00') {
\System::log('Payment for order ID "' . $objOrder->id . '" failed.', __METHOD__, TL_ERROR);
return;
}
// Validate HMAC sign
if (\Input::post('signature') != $this->calculateSignature($_POST, $this->vads_certificate)) {
\System::log('Invalid signature for Order ID ' . $objOrder->id, __METHOD__, TL_ERROR);
return;
}
// For maximum security, also validate individual parameters
if (!$this->validateInboundParameters($objOrder)) {
\System::log('Parameter mismatch for Order ID ' . $objOrder->id, __METHOD__, TL_ERROR);
return;
}
if (!$objOrder->checkout()) {
\System::log('Postsale checkout for Order ID "' . $objOrder->id . '" failed', __METHOD__, TL_ERROR);
return;
}
$objOrder->date_paid = time();
$objOrder->updateOrderStatus($this->new_order_status);
$objOrder->save();
}
示例9: processPostSale
/**
* Process Transaction URL notification
* @param IsotopeProductCollection
*/
public function processPostSale(IsotopeProductCollection $objOrder)
{
if (\Input::post('tr_error') != 'none') {
\System::log('Transferuj.pl response error: ' . \Input::post('tr_error'), __METHOD__, TL_ERROR);
die('TRUE');
}
if (\Input::post('transferujpl_id') == $this->transferujpl_id && \Input::post('tr_status') == 'TRUE') {
$strHash = md5($this->transferujpl_id . \Input::post('tr_id') . number_format(round($objOrder->getTotal(), 2), 2, '.', '') . $objOrder->id . $this->transferujpl_code);
if (\Input::post('md5sum') == $strHash) {
// Checkout failed
if (!$objOrder->checkout()) {
\System::log('Transferuj.pl checkout for order ID "' . $objOrder->id . '" failed', __METHOD__, TL_ERROR);
die('TRUE');
}
$arrPayment = deserialize($objOrder->payment_data, true);
$arrPayment['POSTSALE'][] = $_POST;
$objOrder->payment_data = $arrPayment;
$objOrder->date_paid = time();
$objOrder->updateOrderStatus($this->new_order_status);
$objOrder->save();
\System::log('Transferuj.pl data accepted for order ID "' . $objOrder->id . '"', __METHOD__, TL_GENERAL);
}
}
die('TRUE');
}
示例10: checkPermission
/**
* Check permissions to edit table.
*/
public function checkPermission()
{
if (!\BackendUser::getInstance()->isAdmin) {
\System::log('Not enough permissions to access leads export ID "' . \Input::get('id') . '"', __METHOD__, TL_ERROR);
\Controller::redirect('contao/main.php?act=error');
}
}
示例11: processPostSale
/**
* Process Instant Payment Notifications (IPN)
* @param IsotopeProductCollection
*/
public function processPostSale(IsotopeProductCollection $objOrder)
{
if (\Input::post('instId') != $this->worldpay_instId) {
\System::log('Installation ID does not match', __METHOD__, TL_ERROR);
$this->postsaleError();
}
// Validate payment data
if ($objOrder->currency != \Input::post('currency') || $objOrder->getTotal() != \Input::post('amount') || $this->worldpay_callbackPW != \Input::post('callbackPW') || !$this->debug && \Input::post('testMode') == '100') {
\System::log('Data manipulation in payment from "' . \Input::post('email') . '" !', __METHOD__, TL_ERROR);
$this->postsaleError();
}
// Order status cancelled and order not yet completed, do nothing
if (\Input::post('transStatus') != 'Y' && $objOrder->status == 0) {
$this->postsaleError();
}
if (\Input::post('transStatus') == 'Y') {
if (!$objOrder->checkout()) {
\System::log('Checkout for Order ID "' . $objOrder->id . '" failed', __METHOD__, TL_ERROR);
$this->postsaleError();
}
$objOrder->date_paid = time();
$objOrder->updateOrderStatus($this->new_order_status);
}
// Store request data in order for future references
$arrPayment = deserialize($objOrder->payment_data, true);
$arrPayment['POSTSALE'][] = $_POST;
$objOrder->payment_data = $arrPayment;
$objOrder->save();
$this->postsaleSuccess($objOrder);
}
示例12: processPayment
/**
* Show message while we are waiting for server-to-server order confirmation
* @param IsotopeProductCollection The order being places
* @param Module The checkout module instance
* @return boolean
*/
public function processPayment(IsotopeProductCollection $objOrder, \Module $objModule)
{
if ($objOrder->order_status > 0) {
unset($_SESSION['POSTSALE_TIMEOUT']);
return true;
}
if (!isset($_SESSION['POSTSALE_TIMEOUT'])) {
$_SESSION['POSTSALE_TIMEOUT'] = 12;
} else {
$_SESSION['POSTSALE_TIMEOUT'] = $_SESSION['POSTSALE_TIMEOUT'] - 1;
}
if ($_SESSION['POSTSALE_TIMEOUT'] > 0) {
// Reload page every 5 seconds
$GLOBALS['TL_HEAD'][] = '<meta http-equiv="refresh" content="5,' . \Environment::get('base') . \Environment::get('request') . '">';
// Do not index or cache the page
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
$objTemplate = new \Isotope\Template('mod_message');
$objTemplate->type = 'processing';
$objTemplate->message = $GLOBALS['TL_LANG']['MSC']['payment_processing'];
return $objTemplate->parse();
}
unset($_SESSION['POSTSALE_TIMEOUT']);
\System::log('Payment could not be processed.', __METHOD__, TL_ERROR);
return false;
}
示例13: getFieldOptions
public static function getFieldOptions($arrData, $objDc = null)
{
$arrOptions = array();
if (is_array($arrData['options'])) {
$arrOptions = $arrData['options'];
}
if ($objDc !== null && empty($arrOptions) && (is_array($arrData['options_callback']) || is_callable($arrData['options_callback']))) {
$arrCallback = array();
if (is_array($arrData['options_callback'])) {
$strClass = $arrData['options_callback'][0];
$strMethod = $arrData['options_callback'][1];
$objInstance = \Controller::importStatic($strClass);
try {
$arrCallback = @$objInstance->{$strMethod}($objDc);
} catch (\Exception $e) {
\System::log("{$strClass}::{$strMethod} raised an Exception: {$e->getMessage}()", __METHOD__, TL_ERROR);
}
} elseif (is_callable($arrData['options_callback'])) {
try {
$arrCallback = @$arrData['options_callback']($objDc);
} catch (\Exception $e) {
$strCallback = serialize($arrData['options_callback']);
\System::log("{$strCallback} raised an Exception: {$e->getMessage}()", __METHOD__, TL_ERROR);
}
}
if (is_array($arrCallback)) {
$arrOptions = $arrCallback;
}
}
return $arrOptions;
}
示例14: getLonLat
/**
* Find the longitute and latitude from a location string
* @param string $strAddress Optimal format: street (+number), postal, city [country]
* @param string
* @return array|bool return an array with logitute, latitude and address or false if error or empty results
* @example https://developers.google.com/maps/documentation/geocoding/?hl=de
*/
public static function getLonLat($strAddress, $strCountry = null)
{
// Google Geocoding API v3
$strQuery = 'https://maps.googleapis.com/maps/api/geocode/json?' . 'address=' . rawurlencode($strAddress) . '&sensor=false' . '&language=' . $GLOBALS['TL_LANGUAGE'];
if ($strCountry) {
$strQuery .= '&components=country:' . $strCountry;
}
$objRequest = new \Request();
$objRequest->send($strQuery);
if (!$objRequest->hasError()) {
$objResponse = json_decode($objRequest->response);
// check the possible return status
switch ($objResponse->status) {
case 'OK':
return array('address' => $objResponse->results[0]->formatted_address, 'longitude' => $objResponse->results[0]->geometry->location->lng, 'latitude' => $objResponse->results[0]->geometry->location->lat);
case 'ZERO_RESULTS':
case 'OVER_QUERY_LIMIT':
case 'REQUEST_DENIED':
case 'INVALID_REQUEST':
default:
\System::log("Google Maps API return error '{$objResponse->status}' for '{$strAddress}'", __METHOD__, TL_ERROR);
return false;
}
}
\System::log("Failed Request '{$strQuery}' with error '{$objRequest->error}'", __METHOD__, TL_ERROR);
return false;
}
示例15: purgeFoundationCache
/**
* Purge the foundation CSS and SCSS cache
*/
public static function purgeFoundationCache()
{
// Purge the folder
$objFolder = new \Folder('assets/foundation');
$objFolder->purge();
// Add a log entry
\System::log('Purged the Foundation cache', __METHOD__, TL_CRON);
}