/** * Plugin initialization function. * * @since 3.0.0 */ function __construct() { /** * Filter the options before they are loaded into constants. * * @since 2.9.0 * @since 3.0.0 Moved to the WP_Members class. * * @param array $this->settings An array of the WP-Members settings. */ $settings = apply_filters('wpmem_settings', get_option('wpmembers_settings')); // Validate that v3 settings are loaded. if (!isset($settings['version']) || $settings['version'] != WPMEM_VERSION) { /** * Load installation routine. */ require_once WPMEM_PATH . 'wp-members-install.php'; // Update settings. $settings = apply_filters('wpmem_settings', wpmem_upgrade_settings()); } // Assemble settings. foreach ($settings as $key => $val) { $this->{$key} = $val; } $this->load_user_pages(); // Set the stylesheet. $this->cssurl = isset($this->style) && $this->style == 'use_custom' ? $this->cssurl : $this->style; // Load forms. require_once WPMEM_PATH . 'inc/class-wp-members-forms.php'; $this->forms = new WP_Members_Forms(); // Load api. require_once WPMEM_PATH . 'inc/class-wp-members-api.php'; $this->api = new WP_Members_API(); }
/** * Installs or upgrades the plugin. * * @since 2.2.2 */ function wpmem_do_install() { /* * If you need to force an install, set $chk_force = true. * * Important notes: * * 1. This will override any settings you already have for any of the plugin settings. * 2. This will not effect any WP settings or registered users. */ $chk_force = false; if (!get_option('wpmembers_settings') || $chk_force == true) { wpmem_install_settings(); wpmem_install_fields(); wpmem_install_dialogs(); wpmem_append_email(); update_option('wpmembers_style', plugin_dir_url(__FILE__) . 'css/generic-no-float.css', '', 'yes'); } else { wpmem_upgrade_settings(); wpmem_upgrade_captcha(); wpmem_append_email(); } }