| 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/wpforms/src/Pro/Admin/Entries/ |
Upload File : |
<?php
namespace WPForms\Pro\Admin\Entries;
/**
* Class Handler.
*
* @since 1.8.3
*/
class Handler {
/**
* Init.
*
* @since 1.8.3
*/
public function init() {
// Check if the current page is the entries page.
if ( ! wpforms_is_admin_page( 'entries' ) ) {
return;
}
$this->maybe_redirect();
}
/**
* Maybe redirect to the entries list page.
*
* @since 1.8.3
*/
public function maybe_redirect() {
// Redirect to the entries page if the current page is not valid.
if ( ! $this->is_valid_entries_page() ) {
wp_safe_redirect( admin_url( 'admin.php?page=wpforms-entries' ) );
exit;
}
}
/**
* Check if the current entries page is valid.
*
* @since 1.8.3
*
* @return bool
*/
protected function is_valid_entries_page() { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh, Generic.Metrics.CyclomaticComplexity.MaxExceeded
$url_args = $this->get_entries_page_args();
// Check if the page is the entries list page.
if ( empty( $url_args ) || empty( $url_args['view'] ) ) {
return true;
}
$available_views = [
'list',
'edit',
'print',
'details',
'survey',
];
return in_array( sanitize_key( $url_args['view'] ), $available_views, true );
}
/**
* Get entries page arguments.
*
* @since 1.8.3
*
* @return array
*/
protected function get_entries_page_args() {
$current_url = wpforms_current_url();
$url_query = wp_parse_url( $current_url, PHP_URL_QUERY );
$url_args = wp_parse_args( $url_query );
// Remove the page argument. Empty page argument means that the current page is the entries list page.
unset( $url_args['page'] );
return $url_args;
}
}