Example #1
0
/*----------  Design Patterns: Decorator Pattern  ----------*/
print "<br/><br/>";
$bbcode_enabled = 0;
$emoticon_enabled = 1;
$post = new Post();
$comment = new Comment();
$post->filter("Test Title: A Test", "Lorem Ipsum Amet");
$comment->filter("Dolot avenus persina olatus");
if ($bbcode_enabled == false && $emoticon_enabled == false) {
    $postcontent = $post->getContent();
    $commentcontent = $comment->getContent();
} elseif ($bbcode_enabled == true && $emoticon_enabled == false) {
    $bb = new BBCodeParser($post);
    // Passing the Post() object to BBCodeParser()
    $postcontent = $bb->getContent();
    $bb = new BBCodeParser($comment);
    $commentcontent = $bb->getContent();
} elseif ($bbcode_enabled == false && $emoticon_enabled == true) {
    $em = new EmoticonParser($post);
    $postcontent = $em->getContent();
    $em = new EmoticonParser($comment);
    $commentcontent = $em->getContent();
}
/*----------  Design Patterns: Facade Pattern  ----------*/
$F = new Facade();
$F->findApartments("London, Greater London", "mapdiv");
/**

	Sumary:
	- Design Pattern are an essential part of OOP
*/