diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bd06500 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +/examples export-ignore +/vendor export-ignore +/docs export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.travis.yml export-ignore +/phpunit.xml export-ignore \ No newline at end of file diff --git a/README.md b/README.md index 7fc8370..d4ea330 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Logo](https://github.com/EFTEC/BladeOne/blob/gh-pages/images/bladelogo.png) +![Logo](https://raw.githubusercontent.com/EFTEC/BladeOne/gh-pages/images/bladelogo.png) # BladeOne Blade Template Engine BladeOne is a standalone version of Blade Template Engine that uses a single PHP file and can be ported and used in different projects. It allows you to use blade template outside laravel. @@ -43,47 +43,38 @@ This project uses a single file called BladeOne.php and a single class (called B Let’s say that we have the next code ```php - ``` It leads to a mess of a code. For example, let’s say that we oversee changing the visual layout of the page. In this case, we should change all the code and we could even break part of the programming. Instead, using a template system works in the next way: ```php - ``` We are separating the visual layer from the code layer. As a plus, we could assign a non-php-programmer in charge to edit the template, and he/she doesn’t need to touch or know our php code. ## Security Let’s say that we have the next exercise (it’s a dummy example) ```php - ``` It could be separates as two files: -```php - ``` ```php - ``` Even for this simple example, there is a risk of hacking. How? A user could sends malicious code by using the GET variable, such as html or even javascript. The second file should be written as follow: ```php - + ``` html_entities should be used in every single part of the visual layer (html) where the user could injects malicious code, and it’s a real tedious work. BladeOne does it automatically. ```php @@ -158,7 +149,6 @@ Alternatively, BladeOne allows to run arbitrary code from any class or method if ## Usage example.php: ```php -run("hello",array("variable1"=>"value1")); _Or using composer's autoload.php_ ```php -run("hello",array("variable1"=>"value1")); - template is the template to open. The dots are used for to separate folders. If the template is called "folder.example" then the engine tries to open the file "folder\example.blade.php" - array (optional). Indicates the values to use for the template. For example ['v1'=>10'], indicates the variable $v1 is equals to 10 -### setMode(mode) +### setMode It sets the mode of compilation. @@ -337,7 +325,7 @@ $blade->directiveRT('datetimert', function ($expression) { ### BLADEONE_MODE (global constant) (optional) -It defines the mode of compilation (via global constant) See [setMode(mode)](#setmodemode) for more information. +It defines the mode of compilation (via global constant) See [setMode(mode)](#setmode) for more information. ```php define("BLADEONE_MODE",BladeOne::MODE_AUTO); diff --git a/lib/Blade.php b/lib/Blade.php index 5902c52..d0f8b42 100644 --- a/lib/Blade.php +++ b/lib/Blade.php @@ -23,6 +23,7 @@ class Blade /** * Converts a static call into a dynamic call. + * Example Blade::run() * @param string $function * @param array $parameters * @return mixed