From d928de94e5b85e6850b1bb48522fc1f8a0b6f108 Mon Sep 17 00:00:00 2001 From: "physikerwelt (Moritz Schubotz)" Date: Tue, 10 Jun 2014 13:14:56 +0200 Subject: [PATCH] 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 --- MathRenderer.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MathRenderer.php b/MathRenderer.php index 55940a2..dd64ad4 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -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 *