wizard generated initial checkin

This commit is contained in:
Andreas Gohr
2015-07-26 12:16:39 +02:00
commit 4dc2247495
11 changed files with 253 additions and 0 deletions

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
# Config file for travis-ci.org
language: php
php:
- "5.5"
- "5.4"
- "5.3"
env:
- DOKUWIKI=master
- DOKUWIKI=stable
before_install: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh
install: sh travis.sh
script: cd _test && phpunit --stderr --group plugin_smtp

27
README Normal file
View File

@ -0,0 +1,27 @@
smtp Plugin for DokuWiki
Send mails via a configured SMTP server
All documentation for this plugin can be found at
https://www.dokuwiki.org/plugin:smtp
If you install this plugin manually, make sure it is installed in
lib/plugins/smtp/ - if the folder is called different it
will not work!
Please refer to http://www.dokuwiki.org/plugins for additional info
on how to install plugins in DokuWiki.
----
Copyright (C) Andreas Gohr <andi@splitbrain.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See the COPYING file in your DokuWiki folder for details

33
_test/general.test.php Normal file
View File

@ -0,0 +1,33 @@
<?php
/**
* General tests for the smtp plugin
*
* @group plugin_smtp
* @group plugins
*/
class general_plugin_smtp_test extends DokuWikiTest {
/**
* Simple test to make sure the plugin.info.txt is in correct format
*/
public function test_plugininfo() {
$file = __DIR__.'/../plugin.info.txt';
$this->assertFileExists($file);
$info = confToHash($file);
$this->assertArrayHasKey('base', $info);
$this->assertArrayHasKey('author', $info);
$this->assertArrayHasKey('email', $info);
$this->assertArrayHasKey('date', $info);
$this->assertArrayHasKey('name', $info);
$this->assertArrayHasKey('desc', $info);
$this->assertArrayHasKey('url', $info);
$this->assertEquals('smtp', $info['base']);
$this->assertRegExp('/^https?:\/\//', $info['url']);
$this->assertTrue(mail_isvalid($info['email']));
$this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
$this->assertTrue(false !== strtotime($info['date']));
}
}

40
action.php Normal file
View File

@ -0,0 +1,40 @@
<?php
/**
* DokuWiki Plugin smtp (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <andi@splitbrain.org>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
class action_plugin_smtp extends DokuWiki_Action_Plugin {
/**
* Registers a callback function for a given event
*
* @param Doku_Event_Handler $controller DokuWiki's event controller object
* @return void
*/
public function register(Doku_Event_Handler $controller) {
$controller->register_hook('MAIL_MESSAGE_SEND', 'FIXME', $this, 'handle_mail_message_send');
}
/**
* [Custom event handler which performs action]
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public function handle_mail_message_send(Doku_Event &$event, $param) {
}
}
// vim:ts=4:sw=4:et:

48
admin.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/**
* DokuWiki Plugin smtp (Admin Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <andi@splitbrain.org>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
class admin_plugin_smtp extends DokuWiki_Admin_Plugin {
/**
* @return int sort number in admin menu
*/
public function getMenuSort() {
return 500;
}
/**
* @return bool true if only access for superuser, false is for superusers and moderators
*/
public function forAdminOnly() {
return false;
}
/**
* Should carry out any processing required by the plugin.
*/
public function handle() {
}
/**
* Render HTML output, e.g. helpful text and a form
*/
public function html() {
ptln('<h1>'.$this->getLang('menu').'</h1>');
require_once __DIR__.'/Mailer/Mailer/SMTP.php';
$mailer = new Tx\Mailer\SMTP();
$mailer->setServer()
}
}
// vim:ts=4:sw=4:et:

8
conf/default.php Normal file
View File

@ -0,0 +1,8 @@
<?php
/**
* Default settings for the smtp plugin
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
//$conf['fixme'] = 'FIXME';

10
conf/metadata.php Normal file
View File

@ -0,0 +1,10 @@
<?php
/**
* Options for the smtp plugin
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
//$meta['fixme'] = array('string');

38
helper.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/**
* DokuWiki Plugin smtp (Helper Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <andi@splitbrain.org>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
class helper_plugin_smtp extends DokuWiki_Plugin {
/**
* Return info about supported methods in this Helper Plugin
*
* @return array of public methods
*/
public function getMethods() {
return array(
array(
'name' => 'getThreads',
'desc' => 'returns pages with discussion sections, sorted by recent comments',
'params' => array(
'namespace' => 'string',
'number (optional)' => 'integer'
),
'return' => array('pages' => 'array')
),
array(
// and more supported methods...
)
);
}
}
// vim:ts=4:sw=4:et:

16
lang/en/lang.php Normal file
View File

@ -0,0 +1,16 @@
<?php
/**
* English language file for smtp plugin
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
// menu entry for admin plugins
// $lang['menu'] = 'Your menu entry';
// custom language strings for the plugin
// $lang['fixme'] = 'FIXME';
//Setup VIM: ex: et ts=4 :

13
lang/en/settings.php Normal file
View File

@ -0,0 +1,13 @@
<?php
/**
* english language file for smtp plugin
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
// keys need to match the config setting name
// $lang['fixme'] = 'FIXME';
//Setup VIM: ex: et ts=4 :

7
plugin.info.txt Normal file
View File

@ -0,0 +1,7 @@
base smtp
author Andreas Gohr
email andi@splitbrain.org
date 2015-07-26
name smtp plugin
desc Send mails via a configured SMTP server
url https://www.dokuwiki.org/plugin:smtp