aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/functions.inc.php16
-rw-r--r--include/functions_plugins.inc.php30
2 files changed, 12 insertions, 34 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 61db92ab5..460c32cdf 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -735,15 +735,14 @@ function get_thumbnail_path($element_info)
*/
function get_thumbnail_url($element_info)
{
- $path = get_thumbnail_location($element_info);
- if ( !url_is_remote($path) )
+ $loc = $url = get_thumbnail_location($element_info);
+ if ( !url_is_remote($loc) )
{
- $path = embellish_url(get_root_url().$path);
+ $url = (get_root_url().$loc);
}
-
// plugins want another url ?
- $path = trigger_event('get_thumbnail_url', $path, $element_info);
- return $path;
+ $url = trigger_event('get_thumbnail_url', $url, $element_info, $loc);
+ return embellish_url($url);
}
/* returns the relative path of the thumnail with regards to to the root
@@ -766,10 +765,9 @@ function get_thumbnail_location($element_info)
{
$path = get_themeconf('mime_icon_dir')
.strtolower(get_extension($element_info['path'])).'.png';
+ // plugins want another location ?
+ $path = trigger_event( 'get_thumbnail_location', $path, $element_info);
}
-
- // plugins want another location ?
- $path = trigger_event( 'get_thumbnail_location', $path, $element_info);
return $path;
}
diff --git a/include/functions_plugins.inc.php b/include/functions_plugins.inc.php
index 171bd84f2..465a22017 100644
--- a/include/functions_plugins.inc.php
+++ b/include/functions_plugins.inc.php
@@ -119,26 +119,16 @@ function trigger_event($event, $data=null)
{
return $data;
}
- $args = array_slice(func_get_args(), 2);
+ $args = func_get_args();
foreach ($pwg_event_handlers[$event] as $priority => $handlers)
{
foreach($handlers as $handler)
{
- $all_args = array_merge( array($data), $args);
$function_name = $handler['function'];
$accepted_args = $handler['accepted_args'];
-
- if ( $accepted_args == 1 )
- $the_args = array($data);
- elseif ( $accepted_args > 1 )
- $the_args = array_slice($all_args, 0, $accepted_args);
- elseif ( $accepted_args == 0 )
- $the_args = NULL;
- else
- $the_args = $all_args;
-
- $data = call_user_func_array($function_name, $the_args);
+ $args[1] = $data;
+ $data = call_user_func_array($function_name, array_slice($args,1,$accepted_args) );
}
}
trigger_action('trigger',
@@ -159,26 +149,16 @@ function trigger_action($event, $data=null)
{
return;
}
- $args = array_slice(func_get_args(), 2);
+ $args = func_get_args();
foreach ($pwg_event_handlers[$event] as $priority => $handlers)
{
foreach($handlers as $handler)
{
- $all_args = array_merge( array($data), $args);
$function_name = $handler['function'];
$accepted_args = $handler['accepted_args'];
- if ( $accepted_args == 1 )
- $the_args = array($data);
- elseif ( $accepted_args > 1 )
- $the_args = array_slice($all_args, 0, $accepted_args);
- elseif ( $accepted_args == 0 )
- $the_args = NULL;
- else
- $the_args = $all_args;
-
- call_user_func_array($function_name, $the_args);
+ call_user_func_array($function_name, array_slice($args,1,$accepted_args) );
}
}
}