Changeset 16683

Show
Ignore:
Timestamp:
06/23/08 17:35:22 (4 months ago)
Author:
rambo
Message:

forward port r16681 & r16682

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.helper.replicator/exporter.php

    r15779 r16683  
    542542    } 
    543543 
     544    function filter_callback(&$serializations, &$pluginargs) 
     545    { 
     546        foreach($pluginargs as $k => $intanceargs) 
     547        { 
     548            unset($intanceargs); 
     549            $this->_filter_callback_real(&$serializations, &$pluginargs[$k]); 
     550        } 
     551    } 
     552 
     553    function _filter_callback_real(&$serializations, &$pluginargs) 
     554    { 
     555        /* 
     556        debug_push_class(__CLASS__, __FUNCTION__); 
     557        debug_print_r("Called with \$pluginargs", $pluginargs); 
     558        debug_pop(); 
     559        */ 
     560        if (   !isset($pluginargs['callback']) 
     561            && empty($pluginargs['callback'])) 
     562        { 
     563            debug_push_class(__CLASS__, __FUNCTION__); 
     564            debug_add("Plugin subscription #{$this->subscription->id} ({$this->subscription->title}) callback plugin callback not defined", MIDCOM_LOG_WARN); 
     565            debug_print_r("\$pluginargs", $pluginargs); 
     566            debug_pop(); 
     567            return false; 
     568        } 
     569        if (   !isset($pluginargs['component']) 
     570            && empty($pluginargs['component'])) 
     571        { 
     572            debug_push_class(__CLASS__, __FUNCTION__); 
     573            debug_add("Plugin subscription #{$this->subscription->id} ({$this->subscription->title}) callback plugin component not defined", MIDCOM_LOG_WARN); 
     574            debug_print_r("\$pluginargs", $pluginargs); 
     575            debug_pop(); 
     576            return false; 
     577        } 
     578        if (!$_MIDCOM->componentloader->load_graceful($pluginargs['component'])) 
     579        { 
     580            debug_push_class(__CLASS__, __FUNCTION__); 
     581            debug_add("Plugin subscription #{$this->subscription->id} ({$this->subscription->title}) callback plugin could not load component {$pluginargs['component']}", MIDCOM_LOG_WARN); 
     582            debug_pop(); 
     583            return false; 
     584        } 
     585        if (!is_callable($pluginargs['callback'])) 
     586        { 
     587            debug_push_class(__CLASS__, __FUNCTION__); 
     588            debug_add("Plugin subscription #{$this->subscription->id} ({$this->subscription->title}) callback plugin callback is not callable", MIDCOM_LOG_WARN); 
     589            debug_print_r("\$pluginargs['callback']", $pluginargs['callback']); 
     590            debug_pop(); 
     591            return false; 
     592        } 
     593        if (!isset($pluginargs['callback_extra_arguments'])) 
     594        { 
     595            $pluginargs['callback_extra_arguments'] = array(); 
     596        } 
     597        debug_pop(); 
     598        return call_user_func_array($pluginargs['callback'], array(&$serializations, &$pluginargs['callback_extra_arguments'])); 
     599    } 
     600 
    544601    /** 
    545602     * This runs the given array of serializations through filters defined for