| Server IP : 170.10.162.208 / Your IP : 216.73.216.129 Web Server : LiteSpeed System : Linux altar19.supremepanel19.com 4.18.0-553.69.1.lve.el8.x86_64 #1 SMP Wed Aug 13 19:53:59 UTC 2025 x86_64 User : deltahospital ( 1806) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home1/deltahospital/www/wp-content/plugins/ml-slider/admin/routes/ |
Upload File : |
<?php
if (!defined('ABSPATH')) die('No direct access.');
/**
* Class to handle rest endpoints, specifically used by vue components
* If possible, write / copy new methods in appropriate classes.
*/
class MetaSlider_Api extends WP_REST_Controller {
/**
* Namespace and version for the API
*
* @var string
*/
protected $namespace = 'metaslider/v1';
/**
* Constructor
*/
public function __construct() {
$this->slideshows = new MetaSlider_Slideshows();
}
/**
* Register routes
*/
public function register_routes() {
register_rest_route($this->namespace, '/slideshows/all', array(
array(
'methods' => 'GET',
'callback' => array($this, 'get_all_slideshows')
)
));
register_rest_route($this->namespace, '/slideshow/{id}/update', array(
array(
'methods' => 'POST',
'callback' => array($this, 'update_slideshow')
)
));
}
/**
* Returns all slideshows
*
* @return array|WP_Error
*/
public function get_all_slideshows() {
$user = wp_get_current_user();
$capability = apply_filters('metaslider_capability', 'edit_others_posts');
if (!current_user_can($capability)) {
return new WP_Error('access_denied', __('You do not have access to this resource.'), array('status' => 401));
}
return $this->slideshows->all();
}
}