[MediaWiki-commits] [Gerrit] Remove even more unused variables - change (mediawiki...Math)

2013-04-24 Thread Physikerwelt (Code Review)
Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60642


Change subject: Remove even more unused variables
..

Remove even more unused variables

* $inputhash is also never used.
* Additional comments.
* allow creatation of math renderer without $tex code

Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5
---
M MathRenderer.php
1 file changed, 25 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math 
refs/changes/42/60642/1

diff --git a/MathRenderer.php b/MathRenderer.php
index 2077efc..a504ee3 100644
--- a/MathRenderer.php
+++ b/MathRenderer.php
@@ -9,7 +9,11 @@
  */
 
 /**
- * Abstract base class for math renderers using different technologies.
+ * Abstract base class with static methods for rendering the  tags using 
different technologies.
+ * This static methods create a new istance of the extending classes and 
render the math tags based on the
+ * mode setting of the user.
+ * Furthermore this class handles the caching of the rendered output and 
provides debug information,
+ * if run in mathdebug mode.
  *
  * @author Tomasz Wegrzanowski
  * @author Brion Vibber
@@ -17,11 +21,15 @@
  */
 abstract class MathRenderer {
/**
-*  The following variables should made private, as soon it can be 
verified that they are not being directly accessed by other extensions.
+*  The following variables should made private, as soon it can be 
verified
+*  that they are not being directly accessed by other extensions.
 */
var $mode = MW_MATH_PNG;
var $tex = '';
-   var $inputhash = '';
+   /**
+* is calculated by texvc.
+* @var string
+*/
var $hash = '';
var $html = '';
var $mathml = '';
@@ -35,7 +43,7 @@
 * @param string $tex LaTeX markup
 * @param array $params HTML attributes
 */
-   public function __construct( $tex, $params = array() ) {
+   public function __construct( $tex='', $params = array() ) {
$this->tex = $tex;
$this->params = $params;
}
@@ -77,17 +85,21 @@
default:
$renderer = new MathTexvc( $tex, $params );
}
+   wfDebugLog ( "Math", 'start rendering $' . $renderer->tex . '$' 
);
return $renderer;
}
 
/**
-* Returns TeX to HTML
+* Performs the rendering and returns the rendered element that needs 
to be embedded.
 *
 * @return string of rendered HTML
 */
-   abstract public function render();
+   abstract public function render();
+
 
/**
+* texvc error messages
+* TODO: update to MathML
 * Returns an internationalized HTML error string
 *
 * @param string $msg message key for specific error
@@ -147,7 +159,13 @@
}
 
/**
-* Writes rendering entry to database
+* Writes rendering entry to database.
+*
+* WARNING: Use writeCache() instead of this method to be sure that all
+* renderer specific (such as squid caching) are taken into account.
+* This function stores the values that are currently present in the 
class to the database even if they are empty.
+*
+* This function can be seen as protected function.
 */
public function writeToDatabase() {
# Now save it back to the DB:

-- 
To view, visit https://gerrit.wikimedia.org/r/60642
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove even more unused variables - change (mediawiki...Math)

2013-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Remove even more unused variables
..


Remove even more unused variables

* $inputhash is also never used.
* Additional comments.
* allow creation of math renderer without $tex code

Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5
---
M MathRenderer.php
1 file changed, 27 insertions(+), 8 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/MathRenderer.php b/MathRenderer.php
index feaf38e..78ba02b 100644
--- a/MathRenderer.php
+++ b/MathRenderer.php
@@ -9,7 +9,12 @@
  */
 
 /**
- * Abstract base class for math renderers using different technologies.
+ * Abstract base class with static methods for rendering the  tags using 
+ * different technologies. These static methods create a new instance of the 
+ * extending classes and render the math tags based on the mode setting of the 
user.
+ * Furthermore this class handles the caching of the rendered output and 
provides
+ *  debug information,
+ * if run in mathdebug mode.
  *
  * @author Tomasz Wegrzanowski
  * @author Brion Vibber
@@ -17,11 +22,15 @@
  */
 abstract class MathRenderer {
/**
-*  The following variables should made private, as soon it can be 
verified that they are not being directly accessed by other extensions.
+*  The following variables should made private, as soon it can be 
verified
+*  that they are not being directly accessed by other extensions.
 */
var $mode = MW_MATH_PNG;
var $tex = '';
-   var $inputhash = '';
+   /**
+* is calculated by texvc.
+* @var string
+*/
var $hash = '';
var $html = '';
var $mathml = '';
@@ -32,10 +41,10 @@
/**
 * Constructs a base MathRenderer
 *
-* @param string $tex LaTeX markup
-* @param array $params HTML attributes
+* @param string $tex (optional) LaTeX markup
+* @param array $params (optional) HTML attributes
 */
-   public function __construct( $tex, $params = array() ) {
+   public function __construct( $tex='', $params = array() ) {
$this->tex = $tex;
$this->params = $params;
}
@@ -77,17 +86,21 @@
default:
$renderer = new MathTexvc( $tex, $params );
}
+   wfDebugLog ( "Math", 'start rendering $' . $renderer->tex . '$' 
);
return $renderer;
}
 
/**
-* Returns TeX to HTML
+* Performs the rendering and returns the rendered element that needs 
to be embedded.
 *
 * @return string of rendered HTML
 */
abstract public function render();
 
+
/**
+* texvc error messages
+* TODO: update to MathML
 * Returns an internationalized HTML error string
 *
 * @param string $msg message key for specific error
@@ -147,7 +160,13 @@
}
 
/**
-* Writes rendering entry to database
+* Writes rendering entry to database.
+*
+* WARNING: Use writeCache() instead of this method to be sure that all
+* renderer specific (such as squid caching) are taken into account.
+* This function stores the values that are currently present in the 
class to the database even if they are empty.
+*
+* This function can be seen as protected function.
 */
public function writeToDatabase() {
# Now save it back to the DB:

-- 
To view, visit https://gerrit.wikimedia.org/r/60642
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt 
Gerrit-Reviewer: Cjucovschi 
Gerrit-Reviewer: Mattflaschen 
Gerrit-Reviewer: Physikerwelt 
Gerrit-Reviewer: Worden.lee 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits