add some docs and rearrange things

This commit is contained in:
John Bintz 2009-10-23 07:17:20 -04:00
parent 787114e73d
commit 89339c7d3b

View File

@ -577,21 +577,10 @@ class WhatDidTheySayAdmin {
/** Handle data updates **/ /** Handle data updates **/
/** /**
* Handle an update to options. * Filter input for harmful things.
* @param array $info The part of the $_POST array for What Did They Say?!? * @param string|array $node Either a string or an array of strings to process.
* @return string|array Either a processed string or an array of processed strings.
*/ */
function handle_update($info) {
if (isset($info['module'])) {
$method_name = "handle_update_" . str_replace("-", "_", $info['module']);
if (method_exists($this, $method_name)) {
$info = $this->_clean_child($info);
$result = $this->{$method_name}($info);
if (!empty($result)) { $this->notices[] = $result; }
}
}
}
function _clean_child($node) { function _clean_child($node) {
if (is_array($node)) { if (is_array($node)) {
$new_nodes = array(); $new_nodes = array();
@ -605,11 +594,27 @@ class WhatDidTheySayAdmin {
$node = (string)$node; $node = (string)$node;
foreach (array('script', 'style', 'link') as $tag) { $node = preg_replace("#<${tag}.*/${tag}>#", '', $node); } foreach (array('script', 'style', 'link') as $tag) { $node = preg_replace("#<${tag}.*/${tag}>#", '', $node); }
if (!$options['allow_html']) { $node = strip_tags($node); } if (!$options['allow_html']) { $node = strip_tags($node); }
return $node; return $node;
} }
} }
/**
* Handle an update to options.
* @param array $info The part of the $_POST array for What Did They Say?!?
*/
function handle_update($info) {
if (isset($info['module'])) {
$method_name = "handle_update_" . str_replace("-", "_", $info['module']);
if (method_exists($this, $method_name)) {
$info = $this->_clean_child($info);
$result = $this->{$method_name}($info);
if (!empty($result)) { $this->notices[] = $result; }
}
}
}
/** /**
* Handle updates to queued transcripts. * Handle updates to queued transcripts.
* @param array $info The part of the $_POST array for What Did They Say?!? * @param array $info The part of the $_POST array for What Did They Say?!?