Pastoid

The page you are looking at now is at this URL: http://pastoid.com/bz8

This paste was last updated on February 15, 2010 at 7:15 pm.

Pasted Coderaw

Index: plugins.php
===================================================================
--- plugins.php	(revision 4029)
+++ plugins.php	(working copy)
@@ -149,8 +149,11 @@
 		}
 
 		$return = array();
+		// $arg1 should always be the theme object, but we'll check 
+		$arg1 = reset($filter_args);
 		foreach ( self::$hooks['theme'][$hookname] as $priority ) {
 			foreach ( $priority as $filter ) {
+				$execute_ok = true;
 				// $filter is an array of object reference and method name
 				$callargs = $filter_args;
 				if(is_array($filter)) {
@@ -159,12 +162,25 @@
 					}
 					else {
 						$module = get_class($filter[0]);
+						if($filter[0] instanceof Theme && $module != get_class( $callargs[0] )) {
+							continue;
+						}
 					}
 				}
 				else {
 					$module = $filter;
+					/*
+					if the hook is in a theme descendant class and the class is not the 
+					theme instance calling the hook (passed in $arg1 by convention) then
+					don't execute this hook
+					*/
+					if($arg1 instanceof Theme && $arg1 != $filter[0]) {
+						$execute_ok = false;
+					} 
 				}
-				$return[$module] = call_user_func_array( $filter, $callargs );
+				if($execute_ok) {
+					$return[$module] = call_user_func_array( $filter, $callargs );
+				}
 			}
 		}
 		if(count($return) == 0 && substr($hookname, -6) != '_empty') {

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 2
Is this paste spam?
<Hide