本文整理汇总了PHP中t3lib_div::devLog方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::devLog方法的具体用法?PHP t3lib_div::devLog怎么用?PHP t3lib_div::devLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::devLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* The main method of the PlugIn
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return string The content that is displayed on the website
*/
public function main($content, $conf)
{
$this->init($conf);
// Turn cache on.
$this->setCache(TRUE);
// Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) {
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_statistics->main(' . $content . ', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
return $content;
}
// Get description.
$content .= $this->pi_RTEcssText($this->conf['description']);
// Check for selected collections.
if ($this->conf['collections']) {
// Include only selected collections.
$resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_relations', 'tx_dlf_collections', 'AND tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']) . ') AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_documents') . tx_dlf_helper::whereClause('tx_dlf_collections'), 'tx_dlf_documents.uid', '', '');
$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_relations', 'tx_dlf_collections', 'AND tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0' . tx_dlf_helper::whereClause('tx_dlf_documents') . ') AND tx_dlf_collections.uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']) . ') AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_documents') . tx_dlf_helper::whereClause('tx_dlf_collections'), 'tx_dlf_documents.uid', '', '');
} else {
// Include all collections.
$resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_documents.partof=0' . tx_dlf_helper::whereClause('tx_dlf_documents'), '', '', '');
$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0' . tx_dlf_helper::whereClause('tx_dlf_documents') . ')' . tx_dlf_helper::whereClause('tx_dlf_documents'), '', '', '');
}
$countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles);
$countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes);
// Set replacements.
$replace = array('key' => array('###TITLES###', '###VOLUMES###'), 'value' => array($countTitles . ($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)), $countVolumes . ($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE))));
// Apply replacements.
$content = str_replace($replace['key'], $replace['value'], $content);
return $this->pi_wrapInBaseClass($content);
}
示例2: writeLogEntries
/**
* Writes exception to different logs
*
* @param Exception $exception The exception
* @param string the context where the exception was thrown, WEB or CLI
* @return void
* @see t3lib_div::sysLog(), t3lib_div::devLog()
*/
protected function writeLogEntries(Exception $exception, $context)
{
$filePathAndName = $exception->getFile();
$exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
$logTitle = 'Core: Exception handler (' . $context . ')';
$logMessage = 'Uncaught TYPO3 Exception: ' . $exceptionCodeNumber . $exception->getMessage() . ' | ' . get_class($exception) . ' thrown in file ' . $filePathAndName . ' in line ' . $exception->getLine();
$backtrace = $exception->getTrace();
// write error message to the configured syslogs
t3lib_div::sysLog($logMessage, $logTitle, 4);
// When database credentials are wrong, the exception is probably
// caused by this. Therefor we cannot do any database operation,
// otherwise this will lead into recurring exceptions.
try {
// In case an error occurs before a database connection exists, try
// to connect to the DB to be able to write the devlog/sys_log entry
if (isset($GLOBALS['TYPO3_DB']) && is_object($GLOBALS['TYPO3_DB']) && empty($GLOBALS['TYPO3_DB']->link)) {
$GLOBALS['TYPO3_DB']->connectDB();
}
// write error message to devlog
// see: $TYPO3_CONF_VARS['SYS']['enable_exceptionDLOG']
if (TYPO3_EXCEPTION_DLOG) {
t3lib_div::devLog($logMessage, $logTitle, 3, array('TYPO3_MODE' => TYPO3_MODE, 'backtrace' => $backtrace));
}
// write error message to sys_log table
$this->writeLog($logTitle . ': ' . $logMessage);
} catch (Exception $exception) {
// Nothing happens here. It seems the database credentials are wrong
}
}
示例3: main
/**
* The main method of the PlugIn
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return string The content that is displayed on the website
*/
public function main($content, $conf)
{
$this->init($conf);
// Turn cache on.
$this->setCache(TRUE);
// Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) {
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_collection->main(' . $content . ', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
return $content;
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###');
}
// Get hook objects.
$this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
if (!empty($this->piVars['collection'])) {
$this->showSingleCollection(intval($this->piVars['collection']));
} else {
$content .= $this->showCollectionList();
}
return $this->pi_wrapInBaseClass($content);
}
示例4: getTypeHintFromReflectionParameter
/**
* Workaround for missing support of typeHints in parameters
* the typeHint is parsed from a the casted string representation of the
* reflectionParameter
* The string has the format 'Parameter #index [ <required/optional> typeHint $parameterName ]'
* where index is the sort number and typeHint is optional
* The parts in the brackets are splitted and counted
*
* @param $reflectionParameter
* @return string typeHint
*/
protected function getTypeHintFromReflectionParameter($reflectionParameter)
{
$paramAsString = (string) $reflectionParameter;
$paramRegex = '/^Parameter\\s\\#[0-9]\\s\\[\\s<(required|optional)>\\s*.*\\$.*]$/';
//t3lib_div::devLog('ReflectionParameter in method '.$this->getName().' : '.$paramAsString,'extension_builder',2);
if (!preg_match($paramRegex, $paramAsString)) {
// since the approach to cast the reflection parameter as a string is not part of the official PHP API
// this might not work anymore in future versions
t3lib_div::devLog('ReflectionParameter in method ' . $this->getName() . ' casted as string has not the expected format: ' . $paramAsString, 'extension_builder', 2);
return '';
}
$typeHintRegex = '/>\\s*([a-zA-Z0-9_&\\s]*)\\s*\\$/';
$matches = array();
if (preg_match($typeHintRegex, $paramAsString, $matches)) {
if (!empty($matches[1])) {
$typeHint = $matches[1];
if ($reflectionParameter->isPassedByReference()) {
// remove the & from typeHint
$typeHint = str_replace('&', '', $typeHint);
}
$typeHint = trim($typeHint);
return $typeHint;
}
}
return '';
}
示例5: hook_indexContent
/**
* Handles the indexing of the page content during post processing of
* a generated page.
*
* @param tslib_fe Typoscript frontend
*/
public function hook_indexContent(tslib_fe $page)
{
$this->page = $page;
// determine if the current page should be indexed
if ($this->indexingEnabled()) {
try {
// do some checks first
if ($page->page['no_search']) {
throw new Exception('Index page? No, The "No Search" flag has been set in the page properties!', 1234523946);
}
if ($page->no_cache) {
throw new Exception('Index page? No, page was set to "no_cache" and so cannot be indexed.', 1234524030);
}
if ($page->sys_language_uid != $page->sys_language_content) {
throw new Exception('Index page? No, ->sys_language_uid was different from sys_language_content which indicates that the page contains fall-back content and that would be falsely indexed as localized content.', 1234524095);
}
if ($GLOBALS['TSFE']->beUserLogin && !$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['index.']['enableIndexingWhileBeUserLoggedIn']) {
throw new Exception('Index page? No, Detected a BE user being logged in.', 1246444055);
}
// everything ready, let's do it
$indexer = t3lib_div::makeInstance('tx_solr_Typo3PageIndexer', $page);
$indexer->setPageAccessRootline($this->getAccessRootline());
$indexer->indexPage();
} catch (Exception $e) {
# $this->log($e->getMessage() . ' Error code: ' . $e->getCode(), 3);
if ($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['logging.']['exceptions']) {
t3lib_div::devLog('Exception while trying to index a page', 'tx_solr', 3, array($e->__toString()));
}
}
}
}
示例6: processRequest
/**
* Starts the execution of a frontend helper.
*
* @param Tx_Solr_IndexQueue_PageIndexerRequest $request Page indexer request
* @param Tx_Solr_IndexQueue_PageIndexerResponse $response Page indexer response
*/
public function processRequest(Tx_Solr_IndexQueue_PageIndexerRequest $request, Tx_Solr_IndexQueue_PageIndexerResponse $response)
{
$this->request = $request;
$this->response = $response;
if ($request->getParameter('loggingEnabled')) {
t3lib_div::devLog('Page indexer request received', 'solr', 0, array('request' => (array) $request));
}
}
示例7: doMigrateDataAction
/**
* action doMigrateData
*
* @return void
*/
public function doMigrateDataAction()
{
t3lib_div::devLog('doMigrateDataAction', " universal_content_lists", -1, array());
#$this->migrateEmails();
t3lib_div::devLog("doMigrateDataAction Data Migration complete", " universal_content_lists", -1);
$this->flashMessageContainer->add('Data Migration complete');
# $this->redirect('migrateData');
}
示例8: extractContentMarkedForIndexing
/**
* Extracts the markup wrapped with TYPO3SEARCH_begin and TYPO3SEARCH_end
* markers.
*
* @param string HTML markup with TYPO3SEARCH markers for content that should be indexed
* @return string HTML markup found between TYPO3SEARCH markers
*/
protected function extractContentMarkedForIndexing($html)
{
preg_match_all('/<!--\\s*?TYPO3SEARCH_begin\\s*?-->.*?<!--\\s*?TYPO3SEARCH_end\\s*?-->/mis', $html, $indexableContents);
$indexableContent = implode($indexableContents[0], '');
if (empty($indexableContent) && $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['logging.']['indexing.']['missingTypo3SearchMarkers']) {
t3lib_div::devLog('No TYPO3SEARCH markers found.', 'solr', 2);
}
return $indexableContent;
}
示例9: process
/**
* Logs the given values.
*
* @return void
*/
public function process()
{
$message = 'Form on page ' . $GLOBALS['TSFE']->id . ' was submitted!';
$severity = 1;
if (intval($this->settings['markAsSpam']) === 1) {
$message = 'Caught possible spamming on page ' . $GLOBALS['TSFE']->id . '!';
$severity = 2;
}
t3lib_div::devLog($message, 'formhandler', $severity, $this->gp);
}
示例10: setActive
/**
* Make the given contexts active (available in this container)
*
* @param array $arContexts Array of context objects
*
* @return Tx_Contexts_Context_Container
*/
protected function setActive($arContexts)
{
$this->exchangeArray($arContexts);
$aliases = array();
foreach ($arContexts as $context) {
$aliases[] = $context->getAlias();
}
t3lib_div::devLog(count($this) . ' active contexts: ' . implode(', ', $aliases), 'tx_contexts', 0);
return $this;
}
示例11: getUrlFromPageID
/**
* Return URL from pageID.
* Will look through all registered services, and use the first one that finds the URL.
* It returns an array where each entry is an associative array with domain and pagepath.
* If the service that locates the URL is unable to determine from which domain this URL is found from, the
* domain key is not set.
*
* @param integer $uid
* @return array An array of all found URL for this page id.
*/
public function getUrlFromPageID($uid)
{
foreach ($this->URLFinders as $finder) {
if ($urls = $finder->getURLFromPageID($uid)) {
return $urls;
}
}
t3lib_div::devLog('Unable to determine pageURL for page with uid ' . $uid, 'moc_varnish', 2);
return array();
}
示例12: run
/**
* Authenticates the request, runs the frontend helpers defined by the
* request, and registers its own shutdown() method for execution at
* hook_eofe in tslib/class.tslib_fe.php.
*
* @return void
*/
public function run()
{
if (!$this->request->isAuthenticated()) {
t3lib_div::devLog('Invalid Index Queue Frontend Request detected!', 'solr', 3, array('page indexer request' => (array) $this->request, 'index queue header' => $_SERVER['HTTP_X_TX_SOLR_IQ']));
die('Invalid Index Queue Request!');
}
$this->dispatcher->dispatch($this->request, $this->response);
// register shutdown method here instead of in ext_localconf.php to
// allow frontend helpers to execute at hook_eofe in
// tslib/class.tslib_fe.php before shuting down
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_eofe'][__CLASS__] = '&Tx_Solr_IndexQueue_PageIndexerRequestHandler->shutdown';
}
示例13: render
/**
* Renders the size of a file using t3lib_div::formatSize
*
* @param string $file Path to the file
* @param string $format Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value)
* @param boolean $hideError Define if an error should be displayed if file not found
* @return string
* @throws Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
*/
public function render($file, $format = '', $hideError = FALSE)
{
if (!is_file($file)) {
$errorMessage = sprintf('Given file "%s" for %s is not valid', htmlspecialchars($file), get_class());
t3lib_div::devLog($errorMessage, 'news', t3lib_div::SYSLOG_SEVERITY_WARNING);
if (!$hideError) {
throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('Given file is not a valid file: ' . htmlspecialchars($file));
}
}
$fileSize = t3lib_div::formatSize(filesize($file), $format);
return $fileSize;
}
示例14: outputDebugLog
public function outputDebugLog()
{
foreach ($this->debugLog as $section => $logData) {
foreach ($logData as $messageData) {
$message = $section . ': ' . $messageData['message'];
$data = FALSE;
if (is_array($messageData['data'])) {
$data = $messageData['data'];
}
t3lib_div::devLog($message, 'formhandler', $severity, $data);
}
}
}
示例15: writeLogMessage
/**
* Writes log message.
* Destination log depends on the current system mode.
* For FE the function writes to the admin panel log. For BE messages are
* sent to the system log. If developer log is enabled, messages are also
* sent there.
*
* This function accepts variable number of arguments and can format
* parameters. The syntax is the same as for sprintf()
*
* @param string $message:
* to output
* @return void
* @see sprintf()
* @see t3lib::divLog()
* @see t3lib_div::sysLog()
* @see t3lib_timeTrack::setTSlogMessage()
*/
public static function writeLogMessage($message)
{
if (func_num_args() > 1) {
$params = func_get_args();
array_shift($params);
$message = vsprintf($message, $params);
}
if (TYPO3_MODE === 'BE') {
t3lib_div::sysLog($message, self::$extKey, 1);
}
if (TYPO3_DLOG) {
t3lib_div::devLog($message, self::$extKey, 1);
}
}