Skip to content

Commit

Permalink
Merge pull request #165 from froschdesign/hotfix/docs/call-outs
Browse files Browse the repository at this point in the history
Convert blockquotes to admonitions/call-outs
  • Loading branch information
gsteel authored Sep 4, 2024
2 parents 1185dc8 + df10bb2 commit 5fcab87
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 83 deletions.
25 changes: 7 additions & 18 deletions docs/book/v3/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
laminas-filter also comes with a set of classes for filtering file contents, and
performing file operations such as renaming.

> ## $_FILES
>
> All file filter `filter()` implementations support either a file path string
> *or* a `$_FILES` array as the supplied argument. When a `$_FILES` array is
> passed in, the `tmp_name` is used for the file path.
NOTE: **`$_FILES`**
All file filter `filter()` implementations support either a file path string *or* a `$_FILES` array as the supplied argument.
When a `$_FILES` array is passed in, the `tmp_name` is used for the file path.

## Lowercase

Expand Down Expand Up @@ -201,7 +199,7 @@ The following set of options are supported:
to the filter; used to create a new uploaded file representation of the
renamed file. (Since 2.9.0)

> ### Using the upload Name is unsafe
> WARNING: **Using the upload Name is unsafe**
>
> Be **very** careful when using the `use_upload_name` option. For instance,
> extremely bad things could happen if you were to allow uploaded `.php` files
Expand Down Expand Up @@ -296,20 +294,11 @@ foreach ($request->getUploadedFiles() as $uploadedFile) {
}
```

> ### PSR-7 Support
>
> PSR-7/PSR-17 support has only been available since 2.9.0, and requires a valid
> [psr/http-factory-implementation](https://packagist.org/providers/psr/http-factory-implementation)
> in your application, as it relies on the stream and uploaded file factories in
> order to produce the final `UploadedFileInterface` artifact representing the
> filtered file.
> NOTE: **PSR-7 Support**
>
> PSR-17 itself requires PHP 7, so your application will need to be running on
> PHP 7 in order to use this feature.
> PSR-7/PSR-17 support requires a valid [psr/http-factory-implementation](https://packagist.org/providers/psr/http-factory-implementation) in your application, as it relies on the stream and uploaded file factories in order to produce the final `UploadedFileInterface` artifact representing the filtered file.
>
> [laminas/laminas-diactoros 2.0](https://docs.laminas.dev/laminas-diactoros/)
> provides a PSR-17 implementation, but requires PHP 7.1. If you are still on
> PHP 7.0, either upgrade, or find a compatible psr/http-factory-implementation.
> [laminas/laminas-diactoros](https://docs.laminas.dev/laminas-diactoros/) provides a PSR-17 implementation.
## Uppercase

Expand Down
15 changes: 5 additions & 10 deletions docs/book/v3/inflector.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,11 @@ class Foo

As mentioned in the introduction, there are two types of rules: static and filter-based.

> ### Order is important
>
> It is important to note that regardless of the method in which you add rules
> to the inflector, either one-by-one, or all-at-once; the order is very
> important. More specific names, or names that might contain other rule names,
> must be added before least specific names. For example, assuming the two rule
> names `moduleDir` and `module`, the `moduleDir` rule should appear before
> module since `module` is contained within `moduleDir`. If `module` were added
> before `moduleDir`, `module` will match part of `moduleDir` and process it
> leaving `Dir` inside of the target uninflected.
NOTE: **Order is important**
It is important to note that regardless of the method in which you add rules to the inflector, either one-by-one, or all-at-once; the order is very important.
More specific names, or names that might contain other rule names, must be added before least specific names.
For example, assuming the two rule names `moduleDir` and `module`, the `moduleDir` rule should appear before module since `module` is contained within `moduleDir`.
If `module` were added before `moduleDir`, `module` will match part of `moduleDir` and process it leaving `Dir` inside of the target uninflected.

### Static Rules

Expand Down
88 changes: 33 additions & 55 deletions docs/book/v3/standard-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ echo $filter->filter('This is (my) content: 123');
// Returns 'This is my content 123'
```

> ### Supported Languages
>
> `Alnum` works on almost all languages, except: Chinese, Japanese and Korean.
> Within these languages, the english alphabet is used instead of the characters
> from these languages. The language itself is detected using the `Locale`
> class.
NOTE: **Supported Languages**
`Alnum` works on almost all languages, except: Chinese, Japanese and Korean.
Within these languages, the english alphabet is used instead of the characters from these languages.
The language itself is detected using the `Locale` class.

## Alpha

Expand Down Expand Up @@ -115,12 +113,10 @@ echo $filter->filter('This is (my) content: 123');
// Returns 'This is my content '
```

> ### Supported Languages
>
> `Alpha` works on almost all languages, except: Chinese, Japanese and Korean.
> Within these languages, the english alphabet is used instead of the characters
> from these languages. The language itself is detected using the `Locale`
> class.
NOTE: **Supported Languages**
`Alpha` works on almost all languages, except: Chinese, Japanese and Korean.
Within these languages, the english alphabet is used instead of the characters from these languages.
The language itself is detected using the `Locale` class.

## BaseName

Expand Down Expand Up @@ -425,9 +421,8 @@ $filter = new Laminas\Filter\Compress([
]);
```

> ### Default compression Adapter
>
> When no compression adapter is given, then the **Gz** adapter will be used.
NOTE: **Default compression Adapter**
When no compression adapter is given, then the **Gz** adapter will be used.

Decompression is essentially the same usage; we simply use the `Decompress`
filter instead:
Expand Down Expand Up @@ -473,10 +468,8 @@ $compressed = $filter->filter('Uncompressed string');
In the above example, the uncompressed string is compressed, and is then written
into the given archive file.

> ### Existing Archives will be overwritten
>
> The content of any existing file will be overwritten when the given filename
> of the archive already exists.
WARNING: **Existing Archives will be overwritten**
The content of any existing file will be overwritten when the given filename of the archive already exists.

When you want to compress a file, then you must give the name of the file with its path:

Expand Down Expand Up @@ -506,12 +499,9 @@ $compressed = $filter->filter('C:\temp\somedir');
// Returns true on success and creates the archive file
```

> ### Do not compress large or base Directories
>
> You should never compress large or base directories like a complete partition.
> Compressing a complete partition is a very time consuming task which can lead
> to massive problems on your server when there is not enough space or your
> script takes too much time.
NOTE: **Do not compress large or base Directories**
You should never compress large or base directories like a complete partition.
Compressing a complete partition is a very time consuming task which can lead to massive problems on your server when there is not enough space or your script takes too much time.

### Decompressing an Archive

Expand Down Expand Up @@ -539,10 +529,8 @@ $decompressed = $filter->filter('filename.zip');
// into the given target directory
```

> ### Directories to extract to must exist
>
> When you want to decompress an archive into a directory, then the target
> directory must exist.
NOTE: **Directories to extract to must exist**
When you want to decompress an archive into a directory, then the target directory must exist.

### Bz2 Adapter

Expand Down Expand Up @@ -593,9 +581,8 @@ The Tar Adapter can compress and decompress:
- Files
- Directories

> ### Tar does not support Strings
>
> The Tar Adapter can not handle strings.
NOTE: **Tar does not support Strings**
The Tar Adapter can not handle strings.

This adapter makes use of PEAR's `Archive_Tar` component.

Expand All @@ -612,11 +599,9 @@ example, the related methods for `target` are `getTarget()` and `setTarget()`.
You can also use the `setOptions()` method which accepts an array of all
options.

> ### Directory Usage
>
> When compressing directories with Tar, the complete file path is used. This
> means that created Tar files will not only have the subdirectory, but the
> complete path for the compressed file.
NOTE: **Directory Usage**
When compressing directories with Tar, the complete file path is used.
This means that created Tar files will not only have the subdirectory, but the complete path for the compressed file.

### Zip Adapter

Expand All @@ -626,10 +611,8 @@ The Zip Adapter can compress and decompress:
- Files
- Directories

> ### Zip does not support String Decompression
>
> The Zip Adapter can not handle decompression to a string; decompression will
> always be written to a file.
NOTE: **Zip does not support String Decompression**
The Zip Adapter can not handle decompression to a string; decompression will always be written to a file.

This adapter makes use of PHP's `Zip` extension.

Expand Down Expand Up @@ -1274,9 +1257,8 @@ $filter = new Laminas\Filter\StringToLower([
]);
```

> ### Setting invalid Encodings
>
> Be aware that you will get an exception when you provide an encoding that is not supported by the `mbstring` extension.
NOTE: **Setting invalid Encodings**
Be aware that you will get an exception when you provide an encoding that is not supported by the `mbstring` extension.

## StringToUpper

Expand Down Expand Up @@ -1368,15 +1350,12 @@ characters have been removed.

This filter can strip XML and HTML tags from given content.

> ### Laminas\\Filter\\StripTags is potentially insecure
> WARNING: **This filter is potentially insecure**
>
> Be warned that `Laminas\\Filter\\StripTags` should only be used to strip *all*
> available tags. Using `Laminas\\Filter\\StripTags` to make your site secure by
> stripping *some* unwanted tags will lead to unsecure and dangerous code,
> including potential XSS vectors.
> Be warned that `Laminas\Filter\StripTags` should only be used to strip *all* available tags.
> Using `Laminas\Filter\StripTags` to make your site secure by stripping *some* unwanted tags will lead to unsecure and dangerous code, including potential XSS vectors.
>
> For a fully secure solution that allows selected filtering of HTML tags, use
> either Tidy or HtmlPurifier.
> For a fully secure solution that allows selected filtering of HTML tags, use either Tidy or HtmlPurifier.
### Supported Options

Expand Down Expand Up @@ -1424,10 +1403,9 @@ The above will return `A text with a <a href='link.com'>link</a>`;
it strips all tags but the link. By providing an array, you can specify multiple
tags at once.

> ### Warning
>
> Do not use this feature to secure content. This component does not replace the
> use of a properly configured html filter.
WARNING: **Warning**
Do not use this feature to secure content.
This component does not replace the use of a properly configured html filter.

### Allowing defined Attributes

Expand Down

0 comments on commit 5fcab87

Please sign in to comment.