Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Modified Talk to take a variable number of arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchisari committed Mar 13, 2011
1 parent 9033880 commit c481c96
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
10 changes: 8 additions & 2 deletions system/component.php
Expand Up @@ -207,8 +207,14 @@ private function _LoadController ( $pController = null ) {
return ( true );
}

public function Talk ( $pComponent, $pRequest, $pData = null ) {
return ( $this->GetSys ( "Components" )->Talk ( $pComponent, $pRequest, $pData ) );
public function Talk ( $pComponent, $pRequest ) {

$args = func_get_args();
$Components = Wob::_('Components' );

$return = call_user_func_array ( array ( $Components, 'Talk' ), $args );

return ( $return );
}

}
11 changes: 9 additions & 2 deletions system/components.php
Expand Up @@ -316,7 +316,12 @@ public function Buffer ( $pComponent, $pController = null, $pView = null, $pTask
return ( $return );
}

public function Talk ( $pComponent, $pRequest, $pData = null ) {
public function Talk ( $pComponent, $pRequest ) {

$args = func_get_args();

unset ( $args[0] );
unset ( $args[1] );

$component = ucwords ( strtolower ( ltrim ( rtrim ( $pComponent ) ) ) );
$function = ltrim ( rtrim ( $pRequest ) );
Expand All @@ -330,7 +335,9 @@ public function Talk ( $pComponent, $pRequest, $pData = null ) {
if ( !$methods ) return ( false );

if ( in_array ( $function, $methods) ) {
return ( $this->$component->$function ( $pData ) );
$return = call_user_func_array ( array ( $this->$component, $function ), $args );

return ( $return );
}

return ( false );
Expand Down
9 changes: 6 additions & 3 deletions system/controller.php
Expand Up @@ -241,10 +241,13 @@ function EventTrigger ( string $pEvent, array $pData = null) {
* @param string $pEvent Which event to trigger
* @param array $pEvent Extra data to pass to event hook
*/
public function Talk ( $pComponent, $pRequest, $pData = null ) {

$return = $this->GetSys ( "Components" )->Talk ( $pComponent, $pRequest, $pData );
public function Talk ( $pComponent, $pRequest ) {

$args = func_get_args();
$Components = Wob::_('Components' );

$return = call_user_func_array ( array ( $Components, 'Talk' ), $args );

return ( $return );
}

Expand Down

0 comments on commit c481c96

Please sign in to comment.