Skip to content

Commit

Permalink
- Striptag issue
Browse files Browse the repository at this point in the history
- Docker support
  • Loading branch information
FernandoZueet committed Oct 29, 2020
1 parent 7c1c188 commit 7900c19
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
vendor/
.idea/
.vs/
.vscode/
.DS_Store
composer.lock
debug.log
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"log": true,
"name": "XDebug",
"type": "php",
"request": "launch",
"port": 9002,
"pathMappings": {
"/var/www/html": "${workspaceRoot}"
},
"ignore": [
"**/vendor/**/*.php"
],
"hostname": "localhost"
}
]
}
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Docker compose Up",
"type": "shell",
"command": "cd docker && docker-compose --env-file .env up -d"
}
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Output:

## Mode of use Laravel

Laravel 8 or superior
Laravel 5.8 or superior

```php
<?php
Expand Down Expand Up @@ -274,7 +274,7 @@ Output:

Strip HTML and PHP tags from a string.

`striptags(array|string $allowable_tags = "")`
`striptags(string $allowable_tags = "")`

```php
use FzPhpSanitize\Sanitize;
Expand Down
6 changes: 6 additions & 0 deletions docker/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#PHP
PHP_CONTAINER_NAME="php-sanitize"
PHP_PORT=80
XDEBUG_REMOTE_PORT=9000

NETWORK_NAME="php-sanitize"
1 change: 1 addition & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
22 changes: 22 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.5"
services:

php:
container_name: ${PHP_CONTAINER_NAME}
image: ${PHP_CONTAINER_NAME}
build:
context: ./php
volumes:
- "../.:/var/www/html"
ports:
- "${PHP_PORT}:80"
restart: always
environment:
XDEBUG_CONFIG: remote_port=${XDEBUG_REMOTE_PORT}
networks:
- backend

networks:
backend:
name: ${NETWORK_NAME}
driver: bridge
14 changes: 14 additions & 0 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:7.3-apache

RUN apt-get update & apt-get install -y

#composer
RUN apt-get update
RUN apt-get install -y git zip unzip zlib1g-dev libzip-dev
RUN apt-get -y autoremove & apt-get clean & rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN docker-php-ext-install zip pcntl bcmath
RUN cd /tmp && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer

#xdebug
RUN pecl install xdebug-2.9.4 && docker-php-ext-enable xdebug
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
8 changes: 8 additions & 0 deletions docker/php/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
xdebug.remote_host="host.docker.internal"

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.cli_color=1

xdebug.remote_handler=dbgp
xdebug.remote_mode=req
12 changes: 12 additions & 0 deletions docker/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

## up containers

```bash
docker-compose --env-file .env up -d
```

## down containers

```bash
docker-compose down
```
2 changes: 1 addition & 1 deletion src/Sanitize.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static function lcfirst(): Lcfirst
*
* @link http://php.net/manual/en/function.strip-tags.php
*
* @param array|string $allowable_tags
* @param string $allowable_tags
* @return Striptags
*/
public static function striptags($allowable_tags = ""): Striptags
Expand Down
4 changes: 2 additions & 2 deletions tests/Filters/StriptagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class StriptagsTest extends TestCase
public function values() : array
{
return [
["<a href='#'>Link</a> <h1>Hello world!</h1>", "<a>", "<a href='#'>Link</a> Hello world!"],
["<h1><b>Hello</b> world!</h1>", "<b>", "<b>Hello</b> world!"],
["<a href='#'>Link</a> <h1>Hello world!</h1>", "", "Link Hello world!"],
["<a href='#'>Link</a> <h1><b>Hello</b> world!</h1>", ['<a>','<b>'], "<a href='#'>Link</a> <b>Hello</b> world!"],
["<p>Link</p><b>Hello</b>world<h1>!</h1>", "<p><b>", "<p>Link</p><b>Hello</b>world!"],
[10, "", ""],
];
}
Expand Down

0 comments on commit 7900c19

Please sign in to comment.