| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 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/yespkg.com/wp-content/plugins/elementor-pro/core/data/endpoints/ |
Upload File : |
<?php
namespace ElementorPro\Core\Data\Endpoints;
use Elementor\Utils;
use ElementorPro\Core\Utils as Pro_Utils;
use ElementorPro\Plugin;
use ElementorPro\Core\Data\Interfaces\Endpoint;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
abstract class Refresh_Base extends Base implements Endpoint {
protected $is_edit_mode;
abstract public function get_name() : string;
abstract public function get_route() : string;
protected function permission_callback( $request, $widget_name = '' ): bool {
$data = $request->get_params();
if ( $this->is_edit_mode( $data['post_id'] ) ) {
return true;
}
$post = get_post( $data['post_id'] );
if ( ! $post || 'publish' !== $post->post_status ) {
return false;
}
$document = Plugin::elementor()->documents->get( $data['post_id'] );
if ( ! $document ) {
return false;
}
$element_data = $document->get_elements_data();
$widget = Utils::find_element_recursive( $element_data, $data['widget_id'] );
if ( empty( $widget ) ) {
return false;
}
if ( 'widget' !== $widget['elType'] || $widget_name !== $widget['widgetType'] ) {
return false;
}
return true;
}
protected function is_widget_model_valid( $widget_model ) {
return is_array( $widget_model )
&& isset( $widget_model['id'] )
&& is_string( $widget_model['id'] )
&& isset( $widget_model['settings'] )
&& is_array( $widget_model['settings'] );
}
/**
* The widget ID can only be 7 characters long, and contain only letters and numbers.
*
* @param $data
* @return bool
*/
protected function is_widget_id_valid( $widget_id ) {
return preg_match( '/^[a-zA-Z0-9]+$/', $widget_id )
&& strlen( $widget_id ) === 7;
}
protected function create_widget_instance_from_db( $post_id, $widget_id ) {
return Pro_Utils::create_widget_instance_from_db( $post_id, $widget_id );
}
protected function is_edit_mode( $post_id ) {
if ( isset( $this->is_edit_mode ) ) {
return $this->is_edit_mode;
}
$document = Plugin::elementor()->documents->get( $post_id );
$this->is_edit_mode = ! empty( $document ) && $document->is_editable_by_current_user();
return $this->is_edit_mode;
}
}