require_once __DIR__ . RDS . 'functions.php'; /** * Activation and deactivation. */ register_activation_hook(__FILE__, ['Wprsrv\\Plugin', 'activate']); register_deactivation_hook(__FILE__, ['Wprsrv\\Plugin', 'deactivate']); global $wprsrv; /** * Unforced singleton fetcher function for the plugin. * * @since 0.1.0 * @return \Wprsrv\Plugin */ function wprsrv() { global $wprsrv; if (!$wprsrv) { $wprsrv = new \Wprsrv\Plugin(true); } return $wprsrv; } /** * Init. */ wprsrv(); /** * Run updater. */ if (is_admin()) { new \Wprsrv\Updater(PLUGIN_DIR_ID, GITHUB_REPO_ID); }
/** * Setup template directories for email templates. Attempt theme directories * first in case devs want to override the email templates. Child themes should * override parent themes. * * @since 0.2.0 * @access protected * @return void */ protected function setupTemplateDirectories() { $pluginEmailTemplates = wprsrv()->pluginDirectory . '/includes/templates/email'; $templateDir = get_template_directory(); $themeDir = get_stylesheet_directory(); $templateEmailTemplates = $templateDir . '/wprsrv/email'; $themeEmailTemplates = $themeDir . '/wprsrv/email'; $this->templateDirectories = [$themeEmailTemplates, $templateEmailTemplates, $pluginEmailTemplates]; }