Code: Select all
switch($event) {
case 'somehook':
$foocfg = $this->get_config('foo');
$barcfg = $this->get_config('bar');
$foo = doWork($foocfg, $barcfg);
...
...
break;
...
...
function doWork($foocfg, $barcfg) {
....
....
return($thingy);
}
Code: Select all
switch($event) {
case 'somehook':
$foo = doWork();
...
...
break;
...
...
function doWork() {
global serendipity;
$foocfg = $this->get_config('foo');
$barcfg = $this->get_config('bar');
....
....
return($thingy);
}
or this (which is almost like #1)
Code: Select all
switch($event) {
case 'somehook':
$foo = doWork($this->get_config('foo'), $this->get_config('bar'));
...
...
break;
...
...
function doWork($foocfg,$barcfg) {
global serendipity;
....
....
return($thingy);
}