| 1 |
<?php |
| 2 |
/** |
| 3 |
* Sureforms flush rewrite rules. |
| 4 |
* |
| 5 |
* @package sureforms. |
| 6 |
* @since 0.0.1 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SRFM\Inc; |
| 10 |
|
| 11 |
use SRFM\Inc\Traits\Get_Instance; |
| 12 |
use SRFM\Inc\Global_Settings\Email_Summary; |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; // Exit if accessed directly. |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Activation Class. |
| 20 |
* |
| 21 |
* @since 0.0.1 |
| 22 |
*/ |
| 23 |
class Activator { |
| 24 |
use Get_Instance; |
| 25 |
|
| 26 |
/** |
| 27 |
* Activation handler function. |
| 28 |
* |
| 29 |
* @since 0.0.1 |
| 30 |
* @return void |
| 31 |
*/ |
| 32 |
public static function activate() { |
| 33 |
|
| 34 |
$email_summary_options = get_option( 'srfm_email_summary_settings_options' ); |
| 35 |
$enable_email_summary = is_array( $email_summary_options ) ? $email_summary_options['srfm_email_summary'] : ''; |
| 36 |
|
| 37 |
if ( $enable_email_summary ) { |
| 38 |
Email_Summary::schedule_weekly_entries_email(); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Reset rewrite rules to avoid go to permalinks page |
| 43 |
* through deleting the database options to force WP to do it |
| 44 |
* because of on activation not work well flush_rewrite_rules() |
| 45 |
*/ |
| 46 |
delete_option( 'rewrite_rules' ); |
| 47 |
|
| 48 |
update_option( '__srfm_do_redirect', true ); |
| 49 |
|
| 50 |
} |
| 51 |
} |
| 52 |
|