1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 05:07:55 +02:00

PSR-2 reformatting PHPDoc corrections

With minor corrections.

Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk>
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Marcus Bointon
2013-07-16 13:56:14 +02:00
committed by Edward Z. Yang
parent 19eee14899
commit fac747bdbd
433 changed files with 13302 additions and 6690 deletions

View File

@@ -126,7 +126,8 @@ function phorum_htmlpurifier_format($data)
/**
* Generates a signature based on a message array
*/
function phorum_htmlpurifier_generate_sig($row) {
function phorum_htmlpurifier_generate_sig($row)
{
$phorum_sig = '';
if(isset($row["user"]["signature"])
&& isset($row['meta']['show_signature']) && $row['meta']['show_signature']==1){
@@ -141,7 +142,8 @@ function phorum_htmlpurifier_generate_sig($row) {
/**
* Generates an edit message based on a message array
*/
function phorum_htmlpurifier_generate_editmessage($row) {
function phorum_htmlpurifier_generate_editmessage($row)
{
$PHORUM = $GLOBALS['PHORUM'];
$editmessage = '';
if(isset($row['meta']['edit_count']) && $row['meta']['edit_count'] > 0) {
@@ -160,7 +162,8 @@ function phorum_htmlpurifier_generate_editmessage($row) {
* Removes the signature and edit message from a message
* @param $row Message passed by reference
*/
function phorum_htmlpurifier_remove_sig_and_editmessage(&$row) {
function phorum_htmlpurifier_remove_sig_and_editmessage(&$row)
{
$signature = phorum_htmlpurifier_generate_sig($row);
$editmessage = phorum_htmlpurifier_generate_editmessage($row);
$replacements = array();
@@ -178,7 +181,8 @@ function phorum_htmlpurifier_remove_sig_and_editmessage(&$row) {
* @note This function could generate the actual cache entries, but
* since there's data missing that must be deferred to the first read
*/
function phorum_htmlpurifier_posting($message) {
function phorum_htmlpurifier_posting($message)
{
$PHORUM = $GLOBALS["PHORUM"];
unset($message['meta']['body_cache']); // invalidate the cache
$message['meta']['body_cache_serial'] = $PHORUM['mod_htmlpurifier']['body_cache_serial'];
@@ -188,7 +192,8 @@ function phorum_htmlpurifier_posting($message) {
/**
* Overload quoting mechanism to prevent default, mail-style quote from happening
*/
function phorum_htmlpurifier_quote($array) {
function phorum_htmlpurifier_quote($array)
{
$PHORUM = $GLOBALS["PHORUM"];
$purifier =& HTMLPurifier::getInstance();
$text = $purifier->purify($array[1]);
@@ -200,8 +205,8 @@ function phorum_htmlpurifier_quote($array) {
* Ensure that our format hook is processed last. Also, loads the library.
* @credits <http://secretsauce.phorum.org/snippets/make_bbcode_last_formatter.php.txt>
*/
function phorum_htmlpurifier_common() {
function phorum_htmlpurifier_common()
{
require_once(dirname(__FILE__).'/htmlpurifier/HTMLPurifier.auto.php');
require(dirname(__FILE__).'/init-config.php');
@@ -232,7 +237,8 @@ function phorum_htmlpurifier_common() {
* Pre-emptively performs purification if it looks like a WYSIWYG editor
* is being used
*/
function phorum_htmlpurifier_before_editor($message) {
function phorum_htmlpurifier_before_editor($message)
{
if (!empty($GLOBALS['PHORUM']['mod_htmlpurifier']['wysiwyg'])) {
if (!empty($message['body'])) {
$body = $message['body'];
@@ -248,7 +254,8 @@ function phorum_htmlpurifier_before_editor($message) {
return $message;
}
function phorum_htmlpurifier_editor_after_subject() {
function phorum_htmlpurifier_editor_after_subject()
{
// don't show this message if it's a WYSIWYG editor, since it will
// then be handled automatically
if (!empty($GLOBALS['PHORUM']['mod_htmlpurifier']['wysiwyg'])) {

View File

@@ -5,7 +5,8 @@
* or a module configuration value
* @return Instance of HTMLPurifier_Config
*/
function phorum_htmlpurifier_get_config($default = false) {
function phorum_htmlpurifier_get_config($default = false)
{
global $PHORUM;
$config_exists = phorum_htmlpurifier_config_file_exists();
if ($default || $config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) {
@@ -21,7 +22,8 @@ function phorum_htmlpurifier_get_config($default = false) {
return $config;
}
function phorum_htmlpurifier_config_file_exists() {
function phorum_htmlpurifier_config_file_exists()
{
return file_exists(dirname(__FILE__) . '/config.php');
}

View File

@@ -23,7 +23,8 @@ require_once(dirname(__FILE__) . "/../bbcode/bbcode.php");
* 'format' hook style function that will be called to convert
* legacy markup into HTML.
*/
function phorum_htmlpurifier_migrate($data) {
function phorum_htmlpurifier_migrate($data)
{
return phorum_mod_bbcode_format($data); // bbcode's 'format' hook
}

View File

@@ -1,6 +1,7 @@
<?php
function phorum_htmlpurifier_show_form() {
function phorum_htmlpurifier_show_form()
{
if (phorum_htmlpurifier_config_file_exists()) {
phorum_htmlpurifier_show_config_info();
return;
@@ -61,7 +62,8 @@ function phorum_htmlpurifier_show_form() {
$frm->show();
}
function phorum_htmlpurifier_show_config_info() {
function phorum_htmlpurifier_show_config_info()
{
global $PHORUM;
// update mod_htmlpurifier for housekeeping

View File

@@ -1,7 +1,7 @@
<?php
function phorum_htmlpurifier_show_migrate_sigs_form() {
function phorum_htmlpurifier_show_migrate_sigs_form()
{
$frm = new PhorumInputForm ('', "post", "Migrate");
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "htmlpurifier");

View File

@@ -1,6 +1,7 @@
<?php
function phorum_htmlpurifier_migrate_sigs_check() {
function phorum_htmlpurifier_migrate_sigs_check()
{
global $PHORUM;
$offset = 0;
if (!empty($_POST['migrate-sigs'])) {
@@ -17,7 +18,8 @@ function phorum_htmlpurifier_migrate_sigs_check() {
return $offset;
}
function phorum_htmlpurifier_migrate_sigs($offset) {
function phorum_htmlpurifier_migrate_sigs($offset)
{
global $PHORUM;
if(!$offset) return; // bail out quick if $offset == 0

View File

@@ -1,6 +1,7 @@
<?php
function phorum_htmlpurifier_save_settings() {
function phorum_htmlpurifier_save_settings()
{
global $PHORUM;
if (phorum_htmlpurifier_config_file_exists()) {
echo "Cannot update settings, <code>mods/htmlpurifier/config.php</code> already exists. To change
@@ -19,7 +20,8 @@ function phorum_htmlpurifier_save_settings() {
}
}
function phorum_htmlpurifier_commit_settings() {
function phorum_htmlpurifier_commit_settings()
{
global $PHORUM;
return phorum_db_update_settings(array("mod_htmlpurifier"=>$PHORUM["mod_htmlpurifier"]));
}