<?php
/*
  Copyright (c) 2016, WPPlugins.
  Plugin Name: Hide My Wordpress PRO
  Plugin URI:
  Author: WPPlugins
  Description: You can choose to hide all the URLs from hackers and spammers.
  Version: 2.3.035
  Author URI: http://wpplugins.tips
 */

define('HMWP_VERSION', '2.3.035');
/* Call config files */
require(dirname(__FILE__) . '/debug/index.php');
require(dirname(__FILE__) . '/config/config.php');

if (defined('WP_INSTALLING') && WP_INSTALLING)
    return;

/* important to check the PHP version */
if (PHP_VERSION_ID >= 5100) {
    /* inport main classes */
    require_once(_HMWP_CLASSES_DIR_ . 'ObjController.php');
    HMWP_Classes_ObjController::getClass('HMWP_Classes_FrontController');

    if (HMWP_Classes_Tools::getOption('hmwp_bruteforce')) {
        HMWP_Classes_ObjController::getClass('HMWP_Controllers_Brute');
    }

    add_action('upgrader_process_complete', array(HMWP_Classes_ObjController::getClass('HMWP_Classes_Tools'), 'checkWpUpdates'), 1);

    if (is_admin() || is_network_admin()) {
        register_activation_hook(__FILE__, array(HMWP_Classes_ObjController::getClass('HMWP_Classes_Tools'), 'hmwp_activate'));
        register_deactivation_hook(__FILE__, array(HMWP_Classes_ObjController::getClass('HMWP_Classes_Tools'), 'hmwp_deactivate'));
        //verify if there are updated and all plugins and themes are in the right list
        add_action('activated_plugin', array(HMWP_Classes_ObjController::getClass('HMWP_Classes_Tools'), 'checkWpUpdates'));
        add_action('after_switch_theme',  array(HMWP_Classes_ObjController::getClass('HMWP_Classes_Tools'), 'checkWpUpdates'));

        //Request the plugin update when a new version is released
        require _HMWP_ROOT_DIR_ . '/update.php';
        PucFactory::buildUpdateChecker(
            _HMWP_SUPPORT_SITE_ . '/updates.json',
            __FILE__
        );
    }
} else {
    /* Main class call */
    add_action('admin_notices', 'hmwp_showError');
}
/**
 * Called in Notice Hook
 */
function hmwp_showError() {
    echo '<div class="update-nag"><span style="color:red; font-weight:bold;">' . __('For Hide My Wordpress PRO to work, the PHP version has to be equal or greater then 5.1', _HMWP_PLUGIN_NAME_) . '</span></div>';
}
