example.php
来自「ProjectPier 源码 很好的项目管理程序」· PHP 代码 · 共 76 行
PHP
76 行
<?php/* An example of how to write a plugin for Swift. You should read Plugin_API in docs fully before writing your own plugins */class Swift_Plugin_Example implements Swift_IPlugin{ // ** Required ** - Identifies this plugin public $pluginName = "Example"; protected $SwiftInstance; //Optional - run when the user instantiates the plguin public function __construct() { // } // ** Required ** - Swift loads passes itself here public function loadBaseObject(&$object) { $this->SwiftInstance =& $object; echo "SwiftInstance loaded into plugin...<br />"; } public function onLoad() { echo "Plugin loaded fully...<br />"; } public function onError() { echo "An error has occured. See this error log:<br />"; print_r($this->SwiftInstance->errors); } public function onBeforeSend() { echo "A message is about to be sent...<br />"; $commands = $this->SwiftInstance->currentMail; echo "Here's the message data...<br />". $commands[3]; $commands[3] = preg_replace('/\d+/', '{NUMBER}', $commands[3]); $this->SwiftInstance->currentMail = $commands; echo "But here's what Swift is about to send now...<br />". $commands[3]; } public function onSend() { echo "A message was sent...<br />"; } public function onClose() { echo "Swift has closed the connection...<br />"; } public function onFail() { echo "Swift has failed, nothing else will execute, let's override it!<br />"; $this->SwiftInstance->failed = false; }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?