Add alternative constructor

Adds a new constructor that allows
to create a new instance of the MathRenderer
based on an inputhash.

This method is required for the Specialpage
and the MathSearch extension.

Change-Id: I618b0fa7dcfdf8a7c740991c19ae0d70e71f19ba
This commit is contained in:
physikerwelt (Moritz Schubotz) 2014-06-10 13:14:56 +02:00
parent 27aee07cb0
commit d928de94e5
1 changed files with 13 additions and 0 deletions

View File

@ -95,6 +95,19 @@ abstract class MathRenderer {
}
}
/**
*
* @param type $md5
* @return MathRenderer the MathRenderer generated from md5
*/
public static function newFromMd5( $md5 ) {
$class = get_called_class();
$instance = new $class;
$instance->setMd5( $md5 );
$instance->readFromDatabase();
return $instance;
}
/**
* Static factory method for getting a renderer based on mode
*