]>
jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - Classes/class-plugin-git.php
2 define('DEFAULT_PLUGINS_DIR', 'https://api.dalek.services/plugins.list');
9 function __construct($url = DEFAULT_PLUGINS_DIR
)
14 $curl = curl_init($url);
17 curl_setopt($curl, CURLOPT_RETURNTRANSFER
, true); // Return the response instead of printing it
18 curl_setopt($curl, CURLOPT_HTTPHEADER
, ['Content-Type: application/json']); // Set the content type to JSON
19 curl_setopt($curl, CURLOPT_USERAGENT
, "UnrealIRCd Admin Panel");
20 // Execute the request
21 $response = curl_exec($curl);
24 if ($response === false)
25 $this->err
= curl_error($curl);
27 $this->data
= json_decode($response, false);
29 public function ifInstalledLabel($name)
31 if (Plugins
::plugin_exists($name))
34 <div
class="badge rounded-pill badge-success">Installed ✅
</div
>
38 public function do_list()
44 foreach($this->data
as $p)
50 <!-- Widget
for plugins
-->
51 <div
class="card text-dark bg-light ml-4 mb-3 w-25">
52 <div
class="card-header">
53 <div
class="font-weight-bold">
54 <div
><img
class="mr-3" src
="<?php echo $p->icon?>" height
="50" width
="55">
55 <?php
echo $p->title
; $this->ifInstalledLabel($p->name
); ?></div
>
58 <div
class="card-body">
59 <h5
class="card-title"><?php
echo $p->title
?></h5
>
60 <p
class="card-text"><?php
echo $p->description
?> </p
>
62 <div
class="card-footer">
63 Author
: <a href
="<?php echo "mailto
:".$p->contact ?? "#" ?>">
64 <i
><?php
echo $p->author
?></i
></a
>
65 <div
class="text-right">
66 <div
class="btn btn-secondary">More Info
</div
>
67 <div
class="btn btn-primary">Install
</div
>
73 if ($counter >= 3) // only do three per row. WARNING: untested due to not having more than 2 plugins atm...
77 <div
class="row"><?php