<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class PluginUpdateController
{
/**
* @Route("/updates/better-wordpress-plugin/plugin-update.json", name="plugin_update_json")
*/
public function getPluginUpdateJson(Request $request): JsonResponse
{
$response = [
'name' => 'Better Wordpress Plugin',
'version' => '2.3.1',
'download_url' => 'https://my.freelinelab.pl/wp-plugins/better-wordpress-plugin/better-wordpress.zip',
'requires' => '6.0',
'tested' => '6.6.2',
'requires_php' => '8.0',
'last_updated' => date('Y-m-d H:i:s'),
'sections' => [
'description' => 'Kompleksowe ulepszenie WordPressa: zaawansowane ustawienia, optymalizacja wydajności, integracja z Google, tryb konserwacji i wiele więcej.',
'installation' => "<ol><li>Wgraj pliki wtyczki do katalogu `/wp-content/plugins/better-wordpress-plugin/`</li><li>Aktywuj wtyczkę w panelu 'Wtyczki' w WordPressie\n</li><li>Przejdź do ustawień wtyczki, aby skonfigurować jej opcje</li></ol>",
'changelog' => file_get_contents('https://my.freelinelab.pl/wp-plugins/better-wordpress-plugin/changelog.txt')
],
'icons' => [
'1x' => 'https://my.freelinelab.pl/wp-plugins/better-wordpress-plugin/icon-128x128.gif',
'2x' => 'https://my.freelinelab.pl/wp-plugins/better-wordpress-plugin/icon-256x256.gif'
],
'banners' => [
],
'compatibility' => [
'6.6' => ['6.6', '6.6.1', '6.6.2'],
'6.5' => ['6.5', '6.5.1', '6.5.2'],
'6.4' => ['6.4', '6.4.1', '6.4.2']
]
];
return new JsonResponse($response);
}
}