| Server IP : 172.67.133.75 / Your IP : 162.159.115.10 Web Server : nginx/1.26.1 System : Linux HE9229 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/jl3_ph_com/wp-content/plugins/elementor/modules/favorites/ |
Upload File : |
<?php
namespace Elementor\Modules\Favorites;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use Elementor\Data\V2\Base\Controller as Controller_Base;
use Elementor\Plugin;
class Controller extends Controller_Base {
public function get_name() {
return 'favorites';
}
public function create_item( $request ) {
$module = $this->get_module();
$type = $request->get_param( 'id' );
$favorite = $request->get_param( 'favorite' );
$module->update( $type, $favorite, $module::ACTION_MERGE );
return $module->get( $type );
}
public function delete_item( $request ) {
$module = $this->get_module();
$type = $request->get_param( 'id' );
$favorite = $request->get_param( 'favorite' );
$module->update( $type, $favorite, $module::ACTION_DELETE );
return $module->get( $type );
}
public function create_item_permissions_check( $request ) {
return current_user_can( 'edit_posts' );
}
public function delete_item_permissions_check( $request ) {
return $this->create_item_permissions_check( $request );
}
/**
* Get the favorites module instance.
*
* @return Module
*/
protected function get_module() {
return Plugin::instance()->modules_manager->get_modules( 'favorites' );
}
public function register_endpoints() {
$this->index_endpoint->register_item_route( \WP_REST_Server::CREATABLE, [
'id_arg_type_regex' => '[\w]+',
'id' => [
'description' => 'Type of favorites.',
'type' => 'string',
'required' => true,
],
'favorite' => [
'description' => 'The favorite slug to create.',
'type' => 'string',
'required' => true,
],
] );
$this->index_endpoint->register_item_route( \WP_REST_Server::DELETABLE, [
'id_arg_type_regex' => '[\w]+',
'id' => [
'description' => 'Type of favorites.',
'type' => 'string',
'required' => true,
],
'favorite' => [
'description' => 'The favorite slug to delete.',
'type' => 'string',
'required' => true,
],
] );
}
}