HEX
Server: LiteSpeed
System: Linux srv271.doctorhoster.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64
User: lcipakco (2751)
PHP: 8.3.32
Disabled: show_source, system, shell_exec, passthru, exec, popen, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, escapeshellcmd, apache_child_terminate, virtual, mb_send_mail, mail, eval, phpinfo
Upload Files
File: /mnt/home/lcipakco/public_html/wp-content/plugins/convis-toolkit/convis-toolkit.php
<?php
/**
 * Plugin Name: Convis Toolkit
 * Description: A Helper plugin for all convis Wordpress Themes
 * Plugin URI: #
 * Author: Webtend
 * AAuthor URI: http://webtend.net/
 * Version: 1.0.3
 * Text Domain: convis-toolkit
 * License: GPL2 or later
 * License URI: http://www.gnu.org/licences/gpl-2.0.html
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * The Main Plugin class
 */
final class Convis_Toolkit {

	/**
	 * Addon Version
	 *
	 * @since 1.0.0
	 * @var string The Plugin version.
	 */
	const version = '1.0.3';

	/**
	 * Minimum PHP Version
	 *
	 * @since 1.0.0
	 * @var string Minimum PHP version required to run the Plugin.
	 */
	const MINIMUM_PHP_VERSION = '7.0';

	/**
	 * Class Constructor
	 */
	private function __construct() {
		$this->define_constants();

		add_action( 'plugin_loaded', [ $this, 'init_plugin' ] );
	}

	/**
	 * Initializes a singleton instance
	 *
	 * @return \Convis_Toolkit
	 */
	public static function init() {
		static $instance = false;

		if ( ! $instance ) {
			$instance = new self();
		}

		return $instance;
	}

	/**
	 * Define the required plugin constants
	 *
	 * @return void
	 */
	public function define_constants() {
		define( 'CT_VERSION', self::version );
		define( 'CT_FILE', __FILE__ );
		define( 'CT_PATH', plugin_dir_path( CT_FILE ) );
		define( 'CT_URL', plugin_dir_url( CT_FILE ) );
		define( 'CT_ASSETS', untrailingslashit( CT_URL . 'assets' ) );
		define( 'CT_INCLUDES', untrailingslashit( CT_PATH . 'includes' ) );
		define( 'CT_WP_WIDGETS', untrailingslashit( CT_PATH . 'includes/wp-widgets' ) );
		define( 'CT_THEME_ASSETS', untrailingslashit( get_template_directory_uri() ) . '/assets' );
	}

	/**
	 * Load Textdomain
	 *
	 * Load plugin localization files.
	 *
	 * Fired by `init` action hook.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 */
	public function i18n() {
		load_plugin_textdomain( 'convis-toolkit', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
	}

	/**
	 * Initialize the plugin
	 *
	 * @return void
	 */
	public function init_plugin() {
		if ( $this->is_compatible() ) {
			$this->include_files();
		}
	}

	/**
	 * Get current theme slug
	 *
	 * @access public
	 * @static
	 */
	public static function get_theme_slug() {
		return str_replace( '-child', '', wp_get_theme()->get( 'TextDomain' ) );
	}

	/**
	 * Check Compatible
	 *
	 * @access public
	 * @static
	 *
	 * @return boolean
	 */
	public static function theme_is_compatible() {
		$plugin_name = trim( dirname( plugin_basename( __FILE__ ) ) );
		$theme_name  = self::get_theme_slug();

		return false !== stripos( $plugin_name, $theme_name );
	}

	/**
	 * Compatibility Checks
	 *
	 * Checks whether the site meets the addon requirement.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function is_compatible() {
		// Check for required PHP version
		if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
			add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );

			return false;
		}

		// Check For 'convis-toolkit' Theme install or active
		if ( ! self::theme_is_compatible() ) {
			add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_theme' ] );

			return false;
		}

		return true;
	}

	public function is_active_elementor() {
		if ( ! did_action( 'elementor/loaded' ) ) {
			return false;
		}

		return true;
	}

	/**
	 * Include required plugin files
	 *
	 * @return void
	 */
	public function include_files() {
		include_once CT_INCLUDES . '/library/codestar-framework/codestar-framework.php';
		include_once CT_INCLUDES . '/helper/functions.php';

		include_once CT_INCLUDES . '/helper/admin-bar-menu.php';
		include_once CT_INCLUDES . '/helper/theme-options.php';
		include_once CT_INCLUDES . '/helper/metaboxes.php';
		include_once CT_INCLUDES . '/helper/maintenance.php';

		if ( $this->is_active_elementor() ) {
			include_once CT_INCLUDES . '/elementor/init.php';
			include_once CT_INCLUDES . '/template-builder/template-builder.php';
		}

		include_once CT_WP_WIDGETS . '/recent-post.php';
		include_once CT_WP_WIDGETS . '/call-to-action.php';

		include_once CT_INCLUDES . '/post-type/portfolio/class-portfolio.php';

		include_once CT_INCLUDES . '/demo-config/demo-config.php';
	}

	/**
	 * Admin notice
	 *
	 * Warning when the site doesn't have a minimum required PHP version.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function admin_notice_minimum_php_version() {

		if ( isset( $_GET[ 'activate' ] ) ) {
			unset( $_GET[ 'activate' ] );
		}

		$message = sprintf(
		/* translators: 1: Plugin name 2: PHP 3: Required PHP version */
			esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'convis-toolkit' ),
			'<strong>' . esc_html__( 'Convis Toolkit', 'convis-toolkit' ) . '</strong>',
			'<strong>' . esc_html__( 'PHP', 'convis-toolkit' ) . '</strong>',
			self::MINIMUM_PHP_VERSION
		);

		printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );

	}

	/**
	 * Admin notice
	 *
	 * Warning when the site doesn't have Convis theme installed or activated.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function admin_notice_missing_main_theme() {

		if ( isset( $_GET[ 'activate' ] ) ) {
			unset( $_GET[ 'activate' ] );
		}

		$message = sprintf(
			esc_html__( '"%1$s" plugin requires Convis theme to be installed and activated', 'convis-toolkit' ),
			'<strong>' . esc_html__( 'Convis Toolkit', 'convis-toolkit' ) . '</strong>'
		);

		printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
	}
}

/**
 * Initializes the main plugin
 *
 * @return void
 */
function convis_toolkit_loading() {
	return Convis_Toolkit::init();
}

// kick-off the plugin
convis_toolkit_loading();