| Server IP : 89.108.64.180 / Your IP : 216.73.216.60 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/omapart.ru/wp-content/plugins/optinmonster/OMAPI/Promos/ |
Upload File : |
<?php
/**
* TrustPulse class.
*
* @since 1.9.0
*
* @package OMAPI
* @author Justin Sternberg
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* TrustPulse class.
*
* @since 1.9.0
*/
class OMAPI_Promos_TrustPulse extends OMAPI_Promos_Base {
/**
* The promo id.
*
* @var string
*/
protected $promo = 'trustpulse';
/**
* The plugin id.
*
* @var string
*/
protected $plugin_id = 'trustpulse-api/trustpulse.php';
/**
* Whether the TrustPulse plugin has been setup.
*
* @since 1.9.0
*
* @var bool
*/
public $trustpulse_setup;
/**
* Primary class constructor.
*
* @since 1.9.0
*/
public function __construct() {
if ( ! defined( 'TRUSTPULSE_APP_URL' ) ) {
define( 'TRUSTPULSE_APP_URL', 'https://app.trustpulse.com/' );
}
if ( ! defined( 'TRUSTPULSE_URL' ) ) {
define( 'TRUSTPULSE_URL', 'https://trustpulse.com/' );
}
parent::__construct();
}
/**
* Sets our object instance and base class instance.
*
* @since 1.9.0
*/
public function set() {
parent::set();
$account_id = get_option( 'trustpulse_script_id', null );
$this->trustpulse_setup = ! empty( $account_id );
}
/**
* Loads the OptinMonster admin menu.
*
* @since 1.9.0
*/
protected function register_page() {
return add_submenu_page(
// If trustpulse is active/setup, don't show the TP sub-menu item under OM.
! empty( $this->plugin['active'] ) && $this->trustpulse_setup
? $this->base->menu->parent_slug() . '-no-menu'
: $this->base->menu->parent_slug(), // Parent slug
esc_html__( 'TrustPulse', 'optin-monster-api' ), // Page title
esc_html__( 'Social Proof Widget', 'optin-monster-api' ),
$this->base->access_capability( 'optin-monster-trustpulse' ), // Cap
'optin-monster-trustpulse', // Slug
array( $this, 'display_page' ) // Callback
);
}
/**
* Redirects to the trustpulse admin page.
*
* @since 1.9.0
*/
public function redirect_plugin() {
$url = esc_url_raw( admin_url( 'admin.php?page=trustpulse' ) );
wp_safe_redirect( $url );
exit;
}
/**
* Outputs the OptinMonster settings page.
*
* @since 1.9.0
*/
public function display_page() {
$plugin_search_url = is_multisite()
? network_admin_url( 'plugin-install.php?tab=search&type=term&s=trustpulse' )
: admin_url( 'plugin-install.php?tab=search&type=term&s=trustpulse' );
$this->base->output_view(
'trustpulse-settings-page.php',
array(
'plugin' => $this->plugin,
'plugin_search_url' => $plugin_search_url,
'button_activate' => __( 'Activate the TrustPulse Plugin', 'optin-monster-api' ),
'button_install' => __( 'Install & Activate the TrustPulse Plugin', 'optin-monster-api' ),
)
);
}
/**
* Loads assets for the settings page.
*
* @since 1.9.0
*/
public function assets() {
parent::assets();
wp_enqueue_style( 'om-tp-admin-css', $this->base->url . 'assets/dist/css/trustpulse.min.css', false, $this->base->asset_version() );
add_action( 'in_admin_header', array( $this, 'render_banner' ) );
}
/**
* Renders TP banner in the page header
*
* @return void
*/
public function render_banner() {
$this->base->output_view( 'trustpulse-banner.php' );
}
}