X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=plugins%2FMailForm.php;h=79164ac7b3fd3fb0489f1be91810ba641394f7f2;hb=b2a5ef8b316890cf1926313c7a95331df19cf947;hp=8125ebbfd653579c0baa0d053642e982c9c359b8;hpb=6855525e48fad5de270500a5445c4f4ff85d8bda;p=diogenes.git diff --git a/plugins/MailForm.php b/plugins/MailForm.php index 8125ebb..79164ac 100644 --- a/plugins/MailForm.php +++ b/plugins/MailForm.php @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -require_once 'Plugin/Filter.php'; +require_once 'Plugin/Skel/Filter.php'; require_once 'diogenes/diogenes.hermes.inc.php'; /** The MailForm plugin allows you to insert a form to send @@ -27,7 +27,7 @@ require_once 'diogenes/diogenes.hermes.inc.php'; * To make use of this plugin, insert {MailForm}in your page * where the mail form should appear. */ -class MailForm extends Diogenes_Plugin_Filter +class MailForm extends Diogenes_Plugin_Skel_Filter { /** Plugin name */ var $name = "MailForm"; @@ -35,8 +35,16 @@ class MailForm extends Diogenes_Plugin_Filter /** Plugin description */ var $description = "This plugin allows you to insert a form to send an e-mail to a fixed recipient. To make use of this plugin, insert {MailForm} in your page where the mail form should appear."; - /** Plugin parameters */ - var $params = array('email' => '', 'title' => '', 'subject_tag' => '[web form] '); + + /** Constructor. + */ + function MailForm() + { + $this->declareParam('email', ''); + $this->declareParam('title', ''); + $this->declareParam('subject_tag', '[web form]'); + } + /** Show an instance of the MailForm plugin. */ @@ -44,9 +52,9 @@ class MailForm extends Diogenes_Plugin_Filter { global $page; - // get params - $to_email = $this->params['email']; - $form_title = $this->params['title']; + // get parameters + $to_email = $this->getParamValue('email'); + $form_title = $this->getParamValue('title'); if (!isvalid_email($to_email)) { return '

You must specify a valid e-mail in the "email" parameter to make use of the MailForm plugin.

'; @@ -80,7 +88,7 @@ class MailForm extends Diogenes_Plugin_Filter $mymail = new HermesMailer(); $mymail->setFrom($from); - $mymail->setSubject($this->params['subject_tag'].$subject); + $mymail->setSubject($this->getParamValue('subject_tag').$subject); $mymail->addTo($to_email); $mymail->setTxtBody($message); $mymail->send();