You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
2.0 KiB
PHTML
54 lines
2.0 KiB
PHTML
7 months ago
|
<?php
|
||
|
/**
|
||
|
* Plugin Name: Monito Web
|
||
|
* Plugin URI:
|
||
|
* Description: This plugin send telegram version plugins
|
||
|
* Version: 1.0.0
|
||
|
* Author: Isaac Lovera
|
||
|
* Author URI: https://instagram.com/wuasimodo
|
||
|
* License: GPL2
|
||
|
*/
|
||
|
// https://pruebas.com/wp-json/9cf9b3a5b7f90451a1b15510ec5d589b/v1/plugin-updates
|
||
|
// https://pruebas.com/wp-json/9cf9b3a5b7f90451a1b15510ec5d589b/v1/theme-updates
|
||
|
|
||
|
include_once(ABSPATH .'/wp-load.php');
|
||
|
include_once(ABSPATH .'/wp-admin/includes/plugin.php');
|
||
|
include_once(ABSPATH .'/wp-admin/includes/update.php');
|
||
|
include_once(ABSPATH .'/wp-admin/includes/theme.php');
|
||
|
|
||
|
|
||
|
// Añade esta función en tu plugin
|
||
|
function register_9cf9b3a5b7f90451a1b15510ec5d589b_routes() {
|
||
|
register_rest_route('9cf9b3a5b7f90451a1b15510ec5d589b/v1', '/plugin-updates', array(
|
||
|
'methods' => 'GET',
|
||
|
'callback' => 'get_plugin_updates_info_9cf9b3a5b7f90451a1b15510ec5d589b',
|
||
|
'permission_callback' => function() {
|
||
|
return current_user_can('manage_options'); // Solo usuarios con permisos de administración pueden acceder
|
||
|
}
|
||
|
));
|
||
|
|
||
|
register_rest_route('9cf9b3a5b7f90451a1b15510ec5d589b/v1', '/theme-updates', array(
|
||
|
'methods' => 'GET',
|
||
|
'callback' => 'get_theme_updates_info_cf9b3a5b7f90451a1b15510ec5d589b',
|
||
|
'permission_callback' => function() {
|
||
|
return current_user_can('manage_options'); // Solo usuarios con permisos de administración pueden acceder
|
||
|
}
|
||
|
));
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
// Asegúrate de que esta acción sea llamada
|
||
|
add_action('rest_api_init', 'register_9cf9b3a5b7f90451a1b15510ec5d589b_routes');
|
||
|
|
||
|
// Función para obtener actualizaciones de plugins
|
||
|
function get_plugin_updates_info_9cf9b3a5b7f90451a1b15510ec5d589b() {
|
||
|
$plugins = get_plugin_updates();
|
||
|
return new WP_REST_Response($plugins, 200);
|
||
|
}
|
||
|
|
||
|
// Función para obtener actualizaciones de temas
|
||
|
function get_theme_updates_info_cf9b3a5b7f90451a1b15510ec5d589b() {
|
||
|
$updates = get_theme_updates();
|
||
|
return new WP_REST_Response($updates, 200);
|
||
|
}
|