Update Gravatar Configuration.md documentation

This commit is contained in:
Gordon Anderson 2013-05-01 18:02:11 +12:00 committed by Will Rossiter
parent 53fac06d78
commit a9307d8175

View File

@ -2,7 +2,8 @@
## Overview ## Overview
The module provides a number of built in configuration settings below are the default settings The module provides a number of built in configuration settings below are the
default settings
// mysite/_config.php // mysite/_config.php
@ -23,8 +24,8 @@ The module provides a number of built in configuration settings below are the de
'gravatar_size' => 80 'gravatar_size' => 80
); );
If you want to customize any of the configuration options after you have added the extension (or If you want to customize any of the configuration options after you have added
on the built-in SiteTree commenting) use `set_config_value` the extension (or on the built-in SiteTree commenting) use `set_config_value`
// mysite/_config.php - Sets require_login to true for all pages // mysite/_config.php - Sets require_login to true for all pages
Commenting::set_config_value('SiteTree', 'require_login', true); Commenting::set_config_value('SiteTree', 'require_login', true);
@ -34,22 +35,22 @@ on the built-in SiteTree commenting) use `set_config_value`
## HTML Comments ## HTML Comments
Comments can be configured to contain a restricted set of HTML tags Comments can be configured to contain a restricted set of HTML tags through the
through the `html_allowed` and `html_allowed_elements` settings. `html_allowed` and `html_allowed_elements` settings. Raw HTML is hardly user
Raw HTML is hardly user friendly, but combined with a rich-text editor friendly, but combined with a rich-text editor of your own choosing it can
of your own choosing it can allow rich comment formatting. allow rich comment formatting.
In order to use this feature, you need to install the In order to use this feature, you need to install the
[HTMLPurifier](http://htmlpurifier.org/) library. [HTMLPurifier](http://htmlpurifier.org/) library. The easiest way to do this is
The easiest way to do this is through [Composer](http://getcomposer.org). through [Composer](http://getcomposer.org).
{ {
"require": {"ezyang/htmlpurifier": "4.*"} "require": {"ezyang/htmlpurifier": "4.*"}
} }
**Important**: Rendering user-provided HTML on your website always risks **Important**: Rendering user-provided HTML on your website always risks
exposing your users to cross-site scripting (XSS) attacks, if the HTML exposing your users to cross-site scripting (XSS) attacks, if the HTML isn't
isn't properly sanitized. Don't allow tags like `<script>` or arbitrary attributes. properly sanitized. Don't allow tags like `<script>` or arbitrary attributes.
## Gravatars ## Gravatars
@ -57,6 +58,41 @@ Gravatars can be turned on by adding this to your mysite/_config.php file
Commenting::set_config_value('SiteTree', 'use_gravatar', true); Commenting::set_config_value('SiteTree', 'use_gravatar', true);
The default size is 80 pixels, as per the gravatar site if the 's' parameter is omitted. To change this add the following (again to mysite/_config.php): The default size is 80 pixels, as per the gravatar site if the 's' parameter is
omitted. To change this add the following (again to mysite/_config.php):
Commenting::set_config_value('SiteTree', 'gravatar_size', 40); Commenting::set_config_value('SiteTree', 'gravatar_size', 40);
If the email address used to comment does not have a gravatar, it is possible
to configure the default image shown. Valid values can be found at
http://gravatar.com/site/implement/images/, and at the time of writing are the
following:
* 404: do not load any image if none is associated with the email hash, instead
return an HTTP 404 (File Not Found) response.
* mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person
(does not vary by email hash).
* identicon: a geometric pattern based on an email hash
* monsterid: a generated 'monster' with different colors, faces, etc
* wavatar: generated faces with differing features and backgrounds
* retro: awesome generated, 8-bit arcade-style pixelated faces
* blank: a transparent PNG image (border added to HTML below for demonstration
purposes)
To change the default image style, add the following to mysite/_config.php
Commenting::set_config_value('SiteTree', 'gravatar_default', 'retro');
The rating of the image can be changed by adding a line similar to this to
mysite/_config.php
Commenting::set_config_value('SiteTree', 'gravatar_rating', 'r');
Vald values for rating are as follows:
* g: suitable for display on all websites with any audience type.
* pg: may contain rude gestures, provocatively dressed individuals, the lesser
swear words, or mild violence.
* r: may contain such things as harsh profanity, intense violence, nudity, or
hard drug use.
* x: may contain hardcore sexual imagery or extremely disturbing violence.