| Server IP : 199.250.200.62 / Your IP : 216.73.217.89 Web Server : Apache System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : jasonp18 ( 1000) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/jasonp18/public_html/wp-content/plugins/formidable/classes/models/ |
Upload File : |
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( 'You are not allowed to call this page directly.' );
}
/**
* @since 4.04.04
*/
class FrmInstallPlugin {
protected $plugin_file; // format: folder/filename.php
protected $plugin_slug;
public function __construct( $atts ) {
$this->plugin_file = $atts['plugin_file'];
list( $slug, $file ) = explode( '/', $this->plugin_file );
$this->plugin_slug = $slug;
}
public function get_activate_link() {
if ( $this->is_installed() && $this->is_active() ) {
return '';
}
if ( $this->is_installed() ) {
$url = $this->activate_url();
} else {
$url = $this->install_url();
}
return $url;
}
/**
* @return bool
*/
public function is_installed() {
return is_dir( WP_PLUGIN_DIR . '/' . $this->plugin_slug );
}
/**
* @return bool
*/
public function is_active() {
return is_plugin_active( $this->plugin_file );
}
/**
* @return string
*/
protected function install_url() {
return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $this->plugin_slug ), 'install-plugin_' . $this->plugin_slug );
}
/**
* @return string
*/
protected function activate_url() {
return wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $this->plugin_file ), 'activate-plugin_' . $this->plugin_file );
}
}