Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/collections/pub/eadlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{
?>
<a href='?p=collections/ead&amp;id=<?php echo($objCollection['ID']); ?>&amp;templateset=ead&amp;disabletheme=1&amp;output=<?php echo(encode(formatFileName($objCollection['SortTitle']),ENCODE_HTML)); ?>'><?php echo(encode(trim($objCollection['Title']),ENCODE_HTML)); ?></a><br/>
<?
<?php
}
}
else
Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/archon.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2682,8 +2682,8 @@ public function initialize()
continue;
}

//$result = call_user_func(array($MixinClass, initialize));
eval("\$result = {$MixinClass}::initialize();");
$closure = $this->__getMixinClosure($MixinClass, 'initialize');

}
}

Expand Down
37 changes: 20 additions & 17 deletions packages/core/lib/archonobject.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,14 @@ public function callOverridden()
$args = func_get_args();
$MixinClass = prev($methodInfo->Classes);

$arrStrArgs = array();

for($i = 0; $i < count($args); $i++)
{
$arrStrArgs[] = "\$args[{$i}]";
}

// Simulate mixing after.
if($_ARCHON->Mixins[get_class($this)]->Methods[$method]->Parameters[$MixinClass]->MixOrder == MIX_AFTER)
{
$prevresult = call_user_func_array(array($this, 'callOverridden'), $args);
}

eval("\$result = {$MixinClass}::{$method}(" . implode(',', $arrStrArgs) . ");");
$closure = $this->__getMixinClosure($MixinClass, $method);
$result = call_user_func_array($closure->bindTo($this), $args);

// Simulate mixing before.
if($_ARCHON->Mixins[get_class($this)]->Methods[$method]->Parameters[$MixinClass]->MixOrder == MIX_BEFORE)
Expand Down Expand Up @@ -235,21 +229,14 @@ public function __call($method, $args)
$_ARCHON->Callstack[] = $stackmember;
$MixinClass = end(end($_ARCHON->Callstack)->Classes);

$arrStrArgs = array();

for($i = 0; $i < count($args); $i++)
{
$arrStrArgs[] = "\$args[{$i}]";
}

// Simulate mixing after.
if($_ARCHON->Mixins[get_class($this)]->Methods[$method]->Parameters[$MixinClass]->MixOrder == MIX_AFTER)
{
$prevresult = call_user_func_array(array($this, 'callOverridden'), $args);
}

eval("\$result = {$MixinClass}::{$method}(" . implode(',', $arrStrArgs) . ");");
//$result = call_user_func_array(array(($MixinClass) $this, $method), $args);
$closure = $this->__getMixinClosure($MixinClass, $method);
$result = call_user_func_array($closure->bindTo($this), $args);

// Simulate mixing before.
if($_ARCHON->Mixins[get_class($this)]->Methods[$method]->Parameters[$MixinClass]->MixOrder == MIX_BEFORE)
Expand Down Expand Up @@ -308,5 +295,21 @@ public function __toString()
return get_class($this);
}
}


private function __getMixinClosure($MixinClass, $mixinMethod) {
$method = new ReflectionMethod($MixinClass, $mixinMethod);
$start = $method->getStartLine() - 1;
$length = $method->getEndLine() - $start;

$source = file($method->getFileName());
$method_body = implode("", array_slice($source, $start, $length));
$method_body = preg_replace("/$mixinMethod/", "", $method_body, 1);
$method_body = preg_replace("/public/", "", $method_body, 1);
eval('$closure = '.$method_body.';');

return $closure;
}

}
?>
2 changes: 1 addition & 1 deletion packages/core/lib/querylog.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public function logQuery(&$DB, $Scope, $Message, $IsManip = NULL)
{
$this->QueryCount++;

if($OutputQueries)
if($this->OutputQueries)
{
echo("\n\n$Message\n\n");
}
Expand Down