Hey folks i been working on a bbcode thingie in javascript and i am trying to send the post to a new class for sanitizing and converting the bb tags but i can't seem to get the class to return anything.
this is demo.php well a snippet of it, i have checked that $_POST['post'] does have a value so no issues there.
and this is the new class in development hopefully how php5 likes it.
this is demo.php well a snippet of it, i have checked that $_POST['post'] does have a value so no issues there.
PHP:
echo '<a href="demo.php">Back</a><br />';
require_once('textarea.class.php');
// Set up a new class
$test = new validate_textarea();
// Send post to validate class
$test->post = $_POST['post'];
// Return any errors
$test->error_return();
// Return the valid output bbcode
$test->return_bbcode();
// Return the valid output html
$test->return_formatedhtml();
and this is the new class in development hopefully how php5 likes it.
PHP:
<?php
/************************************************************************************
Kittenbunny CMS
Filename: textarea.class.php
Class: Validate Textarea
************************************************************************************/
class validate_textarea
{
// Variables
private $post;
// Function to remove html tags //
private function sanitize_htmltags()
{
$value = $this->post;
// Removing the leading space that is annoying. //
$value = preg_replace('/ /i', '', $value);
// Sets the allowed taggs //
$value = preg_replace('/<\/?(?:\b(?!)[^>]+?)>/i', '', $value);
// Does the htmlspecialchars bit //
$value = htmlspecialchars($value, ENT_QUOTES, "UTF-8");
return $value;
}
// Function to convert the bbtages to html. //
private function bbtags()
{
}
// Function to return errors. //
public function error_return()
{
return $this->sanitize_htmltags();
}
// Function to return the post with bbcode. html tags removed. //
public function return_bbcode()
{
return $this->sanitize_htmltags();
}
// Function to return the post in html format for display. //
public function return_formatedhtml()
{
return $this->sanitize_htmltags();
}
}
?>