This commit is contained in:
smiley
2024-06-22 21:11:18 +02:00
parent 08886c3551
commit 22869ae8e2
4 changed files with 39 additions and 7 deletions
+1
View File
@@ -7,6 +7,7 @@
],
"social": [
{ "iconClass": "fab fa-github", "url": "https://github.com/chillerlan/php-qrcode"},
{ "iconClass": "fas fa-envelope-open-text", "url": "https://github.com/chillerlan/php-qrcode/discussions"},
]
}
%}
+3 -1
View File
@@ -80,7 +80,9 @@ Render the output:
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> XML, rendered as SVG
printf('<img alt="%s" src="%s" />', $alt, $out);
header('Content-type: application/xml');
echo $out;
```
The associated [XML schema](https://www.w3.org/XML/Schema) can be found over at GitHub: [`qrcode.schema.xsd`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/qrcode.schema.xsd)
+3 -3
View File
@@ -1,9 +1,9 @@
.. php-qrcode documentation master file, created by sphinx-quickstart on Sun Jul 9 21:45:56 2023.
markdown-rst converter: https://pandoc.org/try/
=================
PHP-QRCode Manual
=================
============================
chillerlan PHP-QRCode Manual
============================
User manual for `chillerlan/php-qrcode <https://github.com/chillerlan/php-qrcode/>`__ [|version|]. Updated on |today|.
+32 -3
View File
@@ -35,7 +35,8 @@ foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $re
array_shift($lines);
array_pop($lines);
$see = [];
$see = [];
$link = [];
foreach($lines as $line){
@@ -50,7 +51,14 @@ foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $re
// collect links for "see also"
if(str_starts_with($line, '@see')){
$see[] = $line;
$see[] = substr($line, 5); // cut off the "@see "
continue;
}
// collect links for "links"
if(str_starts_with($line, '@link')){
$link[] = substr($line, 6); // cut off the "@link "
continue;
}
@@ -63,7 +71,6 @@ foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $re
$content[] = "\n**See also:**\n";
foreach($see as $line){
$line = substr($line, 5); // cut off the "@see "
// normal links
if(str_starts_with($line, 'http')){
@@ -88,6 +95,28 @@ foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $re
}
// add "Links" section
if(!empty($link)){
$content[] = "\n**Links:**\n";
foreach($link as $line){
// skip non-url
if(!str_starts_with($line, 'http')){
continue;
}
$url = explode(' ', $line, 2);
$content[] = match(count($url)){
1 => sprintf('- [%s](%s)', explode('://', $url[0])[1], $url[0]),
2 => sprintf('- [%s](%s)', trim($url[1]), $url[0]),
};
}
}
$content[] = "\n";
}