PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.0
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / models / FrmInstallPlugin.php

FrmInstallPlugin.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.0, at classes/models/FrmInstallPlugin.php

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * @since 4.04.04
8 */
9 class FrmInstallPlugin {
10
11 protected $plugin_file; // format: folder/filename.php
12 protected $plugin_slug;
13
14 public function __construct( $atts ) {
15 $this->plugin_file = $atts['plugin_file'];
16 list( $slug, $file ) = explode( '/', $this->plugin_file );
17 $this->plugin_slug = $slug;
18 }
19
20 public function get_activate_link() {
21 if ( $this->is_installed() && $this->is_active() ) {
22 return '';
23 }
24
25 if ( $this->is_installed() ) {
26 $url = $this->activate_url();
27 } else {
28 $url = $this->install_url();
29 }
30 return $url;
31 }
32
33 public function is_installed() {
34 return is_dir( WP_PLUGIN_DIR . '/' . $this->plugin_slug );
35 }
36
37 public function is_active() {
38 return is_plugin_active( $this->plugin_file );
39 }
40
41 protected function install_url() {
42 return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $this->plugin_slug ), 'install-plugin_' . $this->plugin_slug );
43 }
44
45 protected function activate_url() {
46 return wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $this->plugin_file ), 'activate-plugin_' . $this->plugin_file );
47 }
48 }
49