/*
Plugin Name: Houzez CRM
Plugin URI: http://themeforest.net/user/favethemes
Description: Add insights for favethemes themes
Version: 1.3.2
Author: Favethemes
Author URI: http://themeforest.net/user/favethemes
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Houzez_CRM' ) ) :
final class Houzez_CRM {
public $version;
public $plugin_name;
protected static $_instance;
public function __construct() {
$this->plugin_name = 'houzez-crm';
$this->version = '1.0.0';
$this->define_constants();
$this->initialize_admin_menu();
$this->include_files();
$this->init_hooks();
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
do_action( 'houzez_crm_loaded' );
}
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
protected function define_constants() {
define( 'HOUZEZ_CRM_VERSION', $this->version );
define( 'HOUZEZ_CRM_PLUGIN_FILE', __FILE__ );
define( 'HOUZEZ_CRM_DIR', plugin_dir_path( __FILE__ ) );
define( 'HOUZEZ_CRM_URL', plugin_dir_url( __FILE__ ) );
define( 'HOUZEZ_CRM_BASENAME', plugin_basename( __FILE__ ) );
}
public function enqueue_scripts() {
if ( self::houzez_is_crm_page() ) {
wp_enqueue_script( 'houzez-crm-script', HOUZEZ_CRM_URL . 'js/script.js', array('jquery'), $this->version, true );
$locals = array(
'ajax_url' => admin_url('admin-ajax.php'),
'processing_text' => esc_html__('Processing, Please wait...', 'houzez-crm'),
'delete_confirmation' => esc_html__('Are you sure you want to delete?', 'houzez-crm'),
);
wp_localize_script( 'houzez-crm-script', 'Houzez_crm_vars', $locals );
}
}
public static function houzez_is_crm_page() {
return is_page_template('template/user_dashboard_crm.php');
}
public function include_files() {
$files = [
'includes/settings/settings-init.php',
'includes/class-activities.php',
'includes/class-notes.php',
'includes/class-leads.php',
'includes/class-enquiry.php',
'includes/class-collect-form-data.php',
'includes/class-deals.php',
'includes/class-viewed.php',
'includes/functions.php'
];
foreach ($files as $file) {
include_once( HOUZEZ_CRM_DIR . $file );
}
}
public function initialize_admin_menu() {}
public function init_hooks() {
add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); // **Fixed translation loading issue**
register_activation_hook( __FILE__, array( $this, 'plugin_activation' ) );
register_deactivation_hook( __FILE__, array( $this, 'plugin_deactivate' ) );
}
public function load_plugin_textdomain() {
load_plugin_textdomain( 'houzez-crm', false, dirname( HOUZEZ_CRM_BASENAME ) . '/languages' );
}
public function plugin_activation() {
global $wpdb;
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$charset_collate = $wpdb->get_charset_collate();
$tables = [
'houzez_crm_leads' => "(
lead_id bigint(25) unsigned NOT NULL AUTO_INCREMENT,
user_id bigint(25) unsigned NOT NULL DEFAULT '0',
first_name varchar(150),
last_name varchar(150),
email varchar(200) NOT NULL,
mobile varchar(200),
city varchar(100),
state varchar(100),
country varchar(255),
private_note text,
time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (lead_id)
) $charset_collate;",
'houzez_crm_enquiries' => "(
enquiry_id bigint(25) unsigned NOT NULL AUTO_INCREMENT,
user_id bigint(25) unsigned NOT NULL DEFAULT '0',
lead_id bigint(25) unsigned NOT NULL DEFAULT '0',
listing_id bigint(25) unsigned NOT NULL DEFAULT '0',
message text,
time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (enquiry_id)
) $charset_collate;"
];
foreach ($tables as $table_name => $sql) {
dbDelta( "CREATE TABLE {$wpdb->prefix}{$table_name} {$sql}" );
}
}
public function plugin_deactivate() {}
public function __wakeup() {
_doing_it_wrong( __FUNCTION__, __( 'Not good; huh?', 'houzez-crm' ), HOUZEZ_CRM_VERSION );
}
public function __clone() {
_doing_it_wrong( __FUNCTION__, __( 'Not good; huh?', 'houzez-crm' ), HOUZEZ_CRM_VERSION );
}
}
endif;
function HCRM_I() {
return Houzez_CRM::instance();
}
HCRM_I();
Warning: Cannot modify header information - headers already sent by (output started at /var/www/wp-content/plugins/houzez-crm/houzez-crm.php:1) in /var/www/wp-includes/pluggable.php on line 1450
Warning: Cannot modify header information - headers already sent by (output started at /var/www/wp-content/plugins/houzez-crm/houzez-crm.php:1) in /var/www/wp-includes/pluggable.php on line 1453