aboutsummaryrefslogtreecommitdiff
path: root/plugin.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-04-26 16:48:01 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-04-26 16:48:01 +0200
commit29ff68168b45b26706842b32155eb3d8a4f86f1d (patch)
treeb7b2c03e1d7fd0c5202452cf757c11fc71a63cd6 /plugin.php
parent1e989e69def33e57955fae8fd06476f6d12a1d72 (diff)
downloadr7r-gravatar-29ff68168b45b26706842b32155eb3d8a4f86f1d.tar.gz
r7r-gravatar-29ff68168b45b26706842b32155eb3d8a4f86f1d.tar.bz2
r7r-gravatar-29ff68168b45b26706842b32155eb3d8a4f86f1d.zip
Some simple code formatting
- Expand tabs into spaces - Remove trailing whitespace - Get rid of closing `?>` tags
Diffstat (limited to 'plugin.php')
-rw-r--r--plugin.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/plugin.php b/plugin.php
index 5cd982b..f346265 100644
--- a/plugin.php
+++ b/plugin.php
@@ -2,39 +2,39 @@
class gravatar extends RatatoeskrPlugin
{
- public function ste_tag_gravatar($ste, $params, $sub)
- {
- if(!isset($params["comment"]))
- throw new \ste\RuntimeError("ste:gravatar needs the comment parameter.");
+ public function ste_tag_gravatar($ste, $params, $sub)
+ {
+ if(!isset($params["comment"]))
+ throw new \ste\RuntimeError("ste:gravatar needs the comment parameter.");
- $ste_comment = $ste->get_var_by_name($params["comment"]);
+ $ste_comment = $ste->get_var_by_name($params["comment"]);
- if(isset($ste_comment["__obj"]))
- $comment = $ste_comment["__obj"];
- else
- $comment = Comment::by_id($ste_comment["id"]);
+ if(isset($ste_comment["__obj"]))
+ $comment = $ste_comment["__obj"];
+ else
+ $comment = Comment::by_id($ste_comment["id"]);
- $mail_hash = md5(strtolower(trim($comment->author_mail)));
+ $mail_hash = md5(strtolower(trim($comment->author_mail)));
- $gravatar_args = array("default" => "identicon", "rating" => "g", "size" => "80");
- $query_fragments = array();
- foreach($gravatar_args as $key => &$value)
- {
- if(isset($params[$key]))
- $value = $params[$key];
- $value = htmlspecialchars(urlencode($value));
- $query_fragments[] = "$key=$value";
- }
+ $gravatar_args = array("default" => "identicon", "rating" => "g", "size" => "80");
+ $query_fragments = array();
+ foreach($gravatar_args as $key => &$value)
+ {
+ if(isset($params[$key]))
+ $value = $params[$key];
+ $value = htmlspecialchars(urlencode($value));
+ $query_fragments[] = "$key=$value";
+ }
- $styles = "width: {$gravatar_args["size"]}px; height: {$gravatar_args["size"]}px;" . (isset($params["style"]) ? " " . $params["style"] : "");
+ $styles = "width: {$gravatar_args["size"]}px; height: {$gravatar_args["size"]}px;" . (isset($params["style"]) ? " " . $params["style"] : "");
- $protocol = ((!empty($_SERVER["HTTPS"])) and ($_SERVER["HTTPS"] == "on")) ? "https" : "http";
+ $protocol = ((!empty($_SERVER["HTTPS"])) and ($_SERVER["HTTPS"] == "on")) ? "https" : "http";
- return "<img src=\"$protocol://www.gravatar.com/avatar/$mail_hash?" . implode("&", $query_fragments) . "\" style=\"" . htmlspecialchars($styles) . "\" alt=\"\" />";
- }
+ return "<img src=\"$protocol://www.gravatar.com/avatar/$mail_hash?" . implode("&", $query_fragments) . "\" style=\"" . htmlspecialchars($styles) . "\" alt=\"\" />";
+ }
- public function init()
- {
- $this->ste->register_tag("gravatar", array($this, "ste_tag_gravatar"));
- }
+ public function init()
+ {
+ $this->ste->register_tag("gravatar", array($this, "ste_tag_gravatar"));
+ }
}