jbbcode integrated

This commit is contained in:
Miroslav Šedivý 2019-12-23 18:53:18 +01:00
parent 56281b0f34
commit 5548f66fd9
20 changed files with 29 additions and 54 deletions

View 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

View file

@ -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

View 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.

View 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.

View 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

View 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

View 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
View file

@ -1,7 +1,8 @@
<?php
namespace JBBCode;
defined('PROJECT_PATH') OR exit('No direct script access allowed');
/**
* A node within the document tree.
*

View 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
View 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

View file

@ -1,6 +1,8 @@
<?php
namespace JBBCode;
defined('PROJECT_PATH') OR exit('No direct script access allowed');
use Exception;
class ParserException extends Exception{

View 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.

View 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

View 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

View 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.

View 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
*

View file

@ -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

View 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.

View 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.

View file

@ -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());