Skip to content

Commit deabdf7

Browse files
author
Francois Suter
committed
[FEATURE] Add test plugin (to generate dummy log entries)
1 parent 059dd81 commit deabdf7

File tree

6 files changed

+81
-1
lines changed

6 files changed

+81
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2017-01-07 Francois Suter <[email protected]>
2+
3+
* Added test plugin for generating log entries
4+
15
2016-11-16 Francois Suter <[email protected]>
26

37
* Added mapping for MarkJS, resolves #1
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
namespace Devlog\Devlog\Controller;
3+
4+
/*
5+
* This file is part of the TYPO3 CMS project.
6+
*
7+
* It is free software; you can redistribute it and/or modify it under
8+
* the terms of the GNU General Public License, either version 2
9+
* of the License, or any later version.
10+
*
11+
* For the full copyright and license information, please read the
12+
* LICENSE.txt file that was distributed with this source code.
13+
*
14+
* The TYPO3 project - inspiring people to share!
15+
*/
16+
17+
use TYPO3\CMS\Core\Utility\GeneralUtility;
18+
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
19+
20+
/**
21+
* Dummy plugin controller, which generates test devlog entries.
22+
*
23+
* @package Devlog\Devlog\Controller
24+
*/
25+
class TestPluginController extends ActionController
26+
{
27+
/**
28+
* Writes log entries and outputs confirmation sentence.
29+
*
30+
* @return void
31+
*/
32+
public function indexAction()
33+
{
34+
GeneralUtility::devLog('Empty data', 'devlog', 1);
35+
GeneralUtility::devLog('Logging object test', 'devlog', 0, $this);
36+
GeneralUtility::devLog('Logging test', 'devlog', -1, $this->settings);
37+
GeneralUtility::devLog('Logging test', 'devlog', 0, $this->settings);
38+
GeneralUtility::devLog('Logging test', 'devlog', 1, $this->settings);
39+
GeneralUtility::devLog('Logging test', 'devlog', 2, $this->settings);
40+
GeneralUtility::devLog('Logging test', 'devlog', 3, $this->settings);
41+
GeneralUtility::devLog('Escaping>=special "characters"', 'devlog', 1, 'Special characters: < > & " \'');
42+
$htmlObject = new \stdClass();
43+
$htmlObject->html = '<p>This is some HTML content, with <strong>wrong</strong> markups.</td></p>';
44+
GeneralUtility::devLog('Logging <strong>HTML</strong>', '<b>devlog</b>', 3, $htmlObject);
45+
}
46+
}

Resources/Private/Language/locallang.xlf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<trans-unit id="title" xml:space="preserve">
77
<source>Developer's Log</source>
88
</trans-unit>
9+
<trans-unit id="test_plugin" xml:space="preserve">
10+
<source>Developer's Log test plugin</source>
11+
</trans-unit>
912
<trans-unit id="search" xml:space="preserve">
1013
<source>Search</source>
1114
</trans-unit>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html data-namespace-typo3-fluid="true">
2+
3+
<p>This is the Developer's Log test plugin. Some output was written to the log. Check the database!</p>
4+
5+
</html>

ext_localconf.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
if (!defined ('TYPO3_MODE')) {
2+
if (!defined('TYPO3_MODE')) {
33
die ('Access denied.');
44
}
55

@@ -9,3 +9,17 @@
99
// Register log writers
1010
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['devlog']['writers']['db'] = \Devlog\Devlog\Writer\DatabaseWriter::class;
1111
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['devlog']['writers']['file'] = \Devlog\Devlog\Writer\FileWriter::class;
12+
13+
// Register test plugin
14+
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
15+
'Devlog.' . $_EXTKEY,
16+
'TestPlugin',
17+
array(
18+
'TestPlugin' => 'index',
19+
20+
),
21+
array(
22+
'TestPlugin' => 'index',
23+
24+
)
25+
);

ext_tables.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@
3333
)
3434
);
3535
}
36+
37+
// Register test plugin
38+
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
39+
$_EXTKEY,
40+
'TestPlugin',
41+
'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xlf:test_plugin',
42+
'EXT:' . $_EXTKEY . '/Resources/Public/Images/ModuleIcon.svg'
43+
);

0 commit comments

Comments
 (0)