|
Revision 9131, 1.4 kB
(checked in by Carl.Vondrick, 5 years ago)
|
1.1: fixed @param phpdoc to fit specs in plugin (refs #2991)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
require_once 'PEAR/Frontend.php'; |
|---|
| 12 |
require_once 'PEAR/Frontend/CLI.php'; |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
class sfPearFrontendPlugin extends PEAR_Frontend_CLI |
|---|
| 23 |
{ |
|---|
| 24 |
protected |
|---|
| 25 |
$dispatcher = null; |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
* Sets the sfEventDispatcher object for this frontend. |
|---|
| 29 |
* |
|---|
| 30 |
* @param sfEventDispatcher $dispatcher The sfEventDispatcher instance |
|---|
| 31 |
*/ |
|---|
| 32 |
public function setEventDispatcher(sfEventDispatcher $dispatcher) |
|---|
| 33 |
{ |
|---|
| 34 |
$this->dispatcher = $dispatcher; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
public function _displayLine($text) |
|---|
| 38 |
{ |
|---|
| 39 |
$this->_display($text); |
|---|
| 40 |
} |
|---|
| 41 |
|
|---|
| 42 |
public function _display($text) |
|---|
| 43 |
{ |
|---|
| 44 |
$this->dispatcher->notify(new sfEvent($this, 'application.log', $this->splitLongLine($text))); |
|---|
| 45 |
} |
|---|
| 46 |
|
|---|
| 47 |
protected function splitLongLine($text) |
|---|
| 48 |
{ |
|---|
| 49 |
$lines = ''; |
|---|
| 50 |
foreach (explode("\n", $text) as $longline) |
|---|
| 51 |
{ |
|---|
| 52 |
foreach (explode("\n", wordwrap($longline, 62)) as $line) |
|---|
| 53 |
{ |
|---|
| 54 |
if ($line = trim($line)) |
|---|
| 55 |
{ |
|---|
| 56 |
$lines[] = $line; |
|---|
| 57 |
} |
|---|
| 58 |
} |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
return $lines; |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|