jbbcode integrated
This commit is contained in:
parent
56281b0f34
commit
5548f66fd9
20 changed files with 29 additions and 54 deletions
3
app/jbbcode/CodeDefinition.php → app/jbbcode/codedefinition.class.php
Normal file → Executable file
3
app/jbbcode/CodeDefinition.php → app/jbbcode/codedefinition.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This class represents a BBCode Definition. You may construct instances of this class directly,
|
||||
* usually through the CodeDefinitionBuilder class, to create text replacement bbcodes, or you
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
require_once "CodeDefinition.php";
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Implements the builder pattern for the CodeDefinition class. A builder
|
5
app/jbbcode/CodeDefinitionSet.php → app/jbbcode/codedefinitionset.class.php
Normal file → Executable file
5
app/jbbcode/CodeDefinitionSet.php → app/jbbcode/codedefinitionset.class.php
Normal file → Executable file
|
@ -1,10 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
require_once 'CodeDefinition.php';
|
||||
|
||||
use JBBCode\CodeDefinition;
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* An interface for sets of code definitons.
|
7
app/jbbcode/DefaultCodeDefinitionSet.php → app/jbbcode/defaultcodedefinitionset.class.php
Normal file → Executable file
7
app/jbbcode/DefaultCodeDefinitionSet.php → app/jbbcode/defaultcodedefinitionset.class.php
Normal file → Executable file
|
@ -1,12 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
require_once 'CodeDefinition.php';
|
||||
require_once 'CodeDefinitionBuilder.php';
|
||||
require_once 'CodeDefinitionSet.php';
|
||||
require_once 'validators/CssColorValidator.php';
|
||||
require_once 'validators/UrlValidator.php';
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Provides a default set of common bbcode definitions.
|
3
app/jbbcode/DocumentElement.php → app/jbbcode/documentelement.class.php
Normal file → Executable file
3
app/jbbcode/DocumentElement.php → app/jbbcode/documentelement.class.php
Normal file → Executable file
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
require_once 'ElementNode.php';
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* A DocumentElement object represents the root of a document tree. All
|
3
app/jbbcode/ElementNode.php → app/jbbcode/elementnode.class.php
Normal file → Executable file
3
app/jbbcode/ElementNode.php → app/jbbcode/elementnode.class.php
Normal file → Executable file
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
require_once 'Node.php';
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* An element within the tree. Consists of a tag name which defines the type of the
|
3
app/jbbcode/InputValidator.php → app/jbbcode/inputvalidator.class.php
Normal file → Executable file
3
app/jbbcode/InputValidator.php → app/jbbcode/inputvalidator.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Defines an interface for validation filters for bbcode options and
|
||||
* parameters.
|
3
app/jbbcode/Node.php → app/jbbcode/node.class.php
Normal file → Executable file
3
app/jbbcode/Node.php → app/jbbcode/node.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* A node within the document tree.
|
||||
*
|
3
app/jbbcode/NodeVisitor.php → app/jbbcode/nodevisitor.class.php
Normal file → Executable file
3
app/jbbcode/NodeVisitor.php → app/jbbcode/nodevisitor.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Defines an interface for a visitor to traverse the node graph.
|
||||
*
|
16
app/jbbcode/Parser.php → app/jbbcode/parser.class.php
Normal file → Executable file
16
app/jbbcode/Parser.php → app/jbbcode/parser.class.php
Normal file → Executable file
|
@ -1,21 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
require_once 'ElementNode.php';
|
||||
require_once 'TextNode.php';
|
||||
require_once 'DefaultCodeDefinitionSet.php';
|
||||
require_once 'DocumentElement.php';
|
||||
require_once 'CodeDefinition.php';
|
||||
require_once 'CodeDefinitionBuilder.php';
|
||||
require_once 'CodeDefinitionSet.php';
|
||||
require_once 'NodeVisitor.php';
|
||||
require_once 'ParserException.php';
|
||||
require_once 'Tokenizer.php';
|
||||
require_once 'visitors/NestLimitVisitor.php';
|
||||
require_once 'InputValidator.php';
|
||||
|
||||
use JBBCode\CodeDefinition;
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* BBCodeParser is the main parser class that constructs and stores the parse tree. Through this class
|
4
app/jbbcode/ParserException.php → app/jbbcode/parserexception.class.php
Normal file → Executable file
4
app/jbbcode/ParserException.php → app/jbbcode/parserexception.class.php
Normal file → Executable file
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
use Exception;
|
||||
|
||||
class ParserException extends Exception{
|
3
app/jbbcode/TextNode.php → app/jbbcode/textnode.class.php
Normal file → Executable file
3
app/jbbcode/TextNode.php → app/jbbcode/textnode.class.php
Normal file → Executable file
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
require_once 'Node.php';
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Represents a piece of text data. TextNodes never have children.
|
3
app/jbbcode/Tokenizer.php → app/jbbcode/tokenizer.class.php
Normal file → Executable file
3
app/jbbcode/Tokenizer.php → app/jbbcode/tokenizer.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This Tokenizer is used while constructing the parse tree. The tokenizer
|
||||
* handles splitting the input into brackets and miscellaneous text. The
|
3
app/jbbcode/validators/CssColorValidator.php → app/jbbcode/validators/csscolorvalidator.class.php
Normal file → Executable file
3
app/jbbcode/validators/CssColorValidator.php → app/jbbcode/validators/csscolorvalidator.class.php
Normal file → Executable file
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode\validators;
|
||||
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'InputValidator.php';
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* An InputValidator for CSS color values. This is a very rudimentary
|
3
app/jbbcode/validators/UrlValidator.php → app/jbbcode/validators/urlvalidator.class.php
Normal file → Executable file
3
app/jbbcode/validators/UrlValidator.php → app/jbbcode/validators/urlvalidator.class.php
Normal file → Executable file
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode\validators;
|
||||
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'InputValidator.php';
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* An InputValidator for urls. This can be used to make [url] bbcodes secure.
|
3
app/jbbcode/visitors/HTMLSafeVisitor.php → app/jbbcode/visitors/htmlsafevisitor.class.php
Normal file → Executable file
3
app/jbbcode/visitors/HTMLSafeVisitor.php → app/jbbcode/visitors/htmlsafevisitor.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode\visitors;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This visitor escapes html content of all strings and attributes
|
||||
*
|
|
@ -1,12 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode\visitors;
|
||||
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'CodeDefinition.php';
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'DocumentElement.php';
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'ElementNode.php';
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'NodeVisitor.php';
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TextNode.php';
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This visitor is used by the jBBCode core to enforce nest limits after
|
3
app/jbbcode/visitors/SmileyVisitor.php → app/jbbcode/visitors/smileyvisitor.class.php
Normal file → Executable file
3
app/jbbcode/visitors/SmileyVisitor.php → app/jbbcode/visitors/smileyvisitor.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode\visitors;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This visitor is an example of how to implement smiley parsing on the JBBCode
|
||||
* parse graph. It converts :) into image tags pointing to /smiley.png.
|
3
app/jbbcode/visitors/TagCountingVisitor.php → app/jbbcode/visitors/tagcountingvisitor.class.php
Normal file → Executable file
3
app/jbbcode/visitors/TagCountingVisitor.php → app/jbbcode/visitors/tagcountingvisitor.class.php
Normal file → Executable file
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode\visitors;
|
||||
|
||||
defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This visitor traverses parse graph, counting the number of times each
|
||||
* tag name occurs.
|
|
@ -10,8 +10,6 @@ class Post
|
|||
}
|
||||
|
||||
private static function parse_content($c){
|
||||
require_once APP_PATH."jbbcode/Parser.php";
|
||||
|
||||
$parser = new JBBCode\Parser();
|
||||
$parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue