mirror of
https://github.com/YGGverse/YGGwave.git
synced 2025-03-12 21:31:21 +00:00
switch to composer package, add jdenticon lib
This commit is contained in:
parent
33029f8894
commit
530a15857e
@ -39,6 +39,7 @@ git checkout -b my-pr-branch-name
|
|||||||
#### Thanks
|
#### Thanks
|
||||||
|
|
||||||
* CSS background: [ColorSpace](https://mycolor.space/gradient?ori=to+right+top&hex=%23041B41&hex2=%232AB8C6&sub=1)
|
* CSS background: [ColorSpace](https://mycolor.space/gradient?ori=to+right+top&hex=%23041B41&hex2=%232AB8C6&sub=1)
|
||||||
|
* Icons: [jdenticon](https://github.com/dmester/jdenticon-php)
|
||||||
|
|
||||||
#### Feedback
|
#### Feedback
|
||||||
|
|
||||||
|
14
composer.json
Normal file
14
composer.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "yggverse/yggwave",
|
||||||
|
"description": "YGGwave ~ The Radio Catalog",
|
||||||
|
"type": "project",
|
||||||
|
"license": "MIT",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Yggverse\\Yggwave\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"jdenticon/jdenticon": "^1.0"
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,9 @@
|
|||||||
ini_set('display_startup_errors', '1');
|
ini_set('display_startup_errors', '1');
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
// Load dependencies
|
||||||
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
|
|
||||||
class YGGwave {
|
class YGGwave {
|
||||||
|
|
||||||
public static function getSignals() {
|
public static function getSignals() {
|
||||||
@ -21,6 +24,23 @@
|
|||||||
|
|
||||||
if ($host = parse_url($data[2], PHP_URL_HOST)) {
|
if ($host = parse_url($data[2], PHP_URL_HOST)) {
|
||||||
|
|
||||||
|
$identicon = new \Jdenticon\Identicon();
|
||||||
|
|
||||||
|
$identicon->setValue(
|
||||||
|
$data[2]
|
||||||
|
);
|
||||||
|
|
||||||
|
$identicon->setSize(16);
|
||||||
|
|
||||||
|
$identicon->setStyle(
|
||||||
|
[
|
||||||
|
'backgroundColor' => 'rgba(255, 255, 255, 0)',
|
||||||
|
'padding' => 0
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$icon = $identicon->getImageDataUri('webp');
|
||||||
|
|
||||||
$hash = crc32($data[2]);
|
$hash = crc32($data[2]);
|
||||||
|
|
||||||
$hex = str_split(substr(dechex($hash), 0, 6), 2);
|
$hex = str_split(substr(dechex($hash), 0, 6), 2);
|
||||||
@ -36,9 +56,9 @@
|
|||||||
href="%s"
|
href="%s"
|
||||||
title="%s">%s</a>', htmlspecialchars($data[2]),
|
title="%s">%s</a>', htmlspecialchars($data[2]),
|
||||||
htmlentities($data[1]),
|
htmlentities($data[1]),
|
||||||
sprintf('<img src="/yggo/file.php?type=identicon&query=%s"
|
sprintf('<img src="%s"
|
||||||
alt="%s"
|
alt="%s"
|
||||||
style="%s" />', urlencode($host),
|
style="%s" />', $icon,
|
||||||
htmlentities($data[1]),
|
htmlentities($data[1]),
|
||||||
sprintf('background:rgba(%s,%s,%s,.3)', $r, $g, $b))));
|
sprintf('background:rgba(%s,%s,%s,.3)', $r, $g, $b))));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user