| Server IP : 43.141.49.119 / Your IP : 113.219.202.173 Web Server : Apache System : Linux VM-8-5-opencloudos 6.6.34-9.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 19 19:35:45 CST 2024 x86_64 User : www ( 1000) PHP Version : 8.1.27 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 : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/www.ucppt.com/wp-content/plugins/easy-wp-smtp/src/Admin/ |
Upload File : |
<?php
namespace EasyWPSMTP\Admin;
use EasyWPSMTP\WP;
/**
* Class PageAbstract.
*
* @since 2.0.0
*/
abstract class PageAbstract implements PageInterface {
/**
* @var string Slug of a tab.
*/
protected $slug;
/**
* Tab priority.
*
* @since 2.0.0
*
* @var int
*/
protected $priority = 999;
/**
* Tab parent page.
*
* @since 2.0.0
*
* @var ParentPageAbstract
*/
protected $parent_page = null;
/**
* Constructor.
*
* @since 2.0.0
*
* @param ParentPageAbstract $parent_page Tab parent page.
*/
public function __construct( $parent_page = null ) {
$this->parent_page = $parent_page;
}
/**
* @inheritdoc
*/
public function get_link() {
$page = Area::SLUG;
if ( $this->parent_page !== null ) {
$page .= '-' . $this->parent_page->get_slug();
}
return add_query_arg(
'tab',
$this->slug,
WP::admin_url( 'admin.php?page=' . $page )
);
}
/**
* Title of a tab.
*
* @since 2.0.0
*
* @return string
*/
public function get_title() {
return $this->get_label();
}
/**
* Get tab slug.
*
* @since 2.0.0
*
* @return string
*/
public function get_slug() {
return $this->slug;
}
/**
* Get tab priority.
*
* @since 2.0.0
*
* @return int
*/
public function get_priority() {
return $this->priority;
}
/**
* Get parent page.
*
* @since 2.0.0
*
* @return ParentPageAbstract
*/
public function get_parent_page() {
return $this->parent_page;
}
/**
* Get parent page slug.
*
* @since 2.0.0
*
* @return string
*/
public function get_parent_slug() {
if ( is_null( $this->parent_page ) ) {
return '';
}
return $this->parent_page->get_slug();
}
/**
* Register tab related hooks.
*
* @since 2.0.0
*/
public function hooks() {}
/**
* Register tab related ajax hooks.
*
* @since 2.0.0
*/
public function ajax() {}
/**
* Process tab form submission ($_POST ).
*
* @since 2.0.0
*
* @param array $data $_POST data specific for the plugin.
*/
public function process_post( $data ) {}
/**
* Process tab & mailer specific Auth actions.
*
* @since 2.0.0
*/
public function process_auth() {}
/**
* Print the nonce field for a specific tab.
*
* @since 2.0.0
*/
public function wp_nonce_field() {
wp_nonce_field( Area::SLUG . '-' . $this->slug );
}
/**
* Make sure that a user was referred from plugin admin page.
* To avoid security problems.
*
* @since 2.0.0
*/
public function check_admin_referer() {
check_admin_referer( Area::SLUG . '-' . $this->slug );
}
/**
* Save button to be reused on other tabs.
*
* @since 2.0.0
*/
public function display_save_btn() {
?>
<button type="submit" class="easy-wp-smtp-btn easy-wp-smtp-btn--primary easy-wp-smtp-btn--lg">
<?php esc_html_e( 'Save Settings', 'easy-wp-smtp' ); ?>
</button>
<?php
$this->post_form_hidden_field();
}
/**
* Form hidden field for identifying plugin POST requests.
*
* @since 2.0.0
*/
public function post_form_hidden_field() {
echo '<input type="hidden" name="easy-wp-smtp-post" value="1">';
}
}