예제 #1
0
        /**
         * Install method is called once install this plugin.
         * create tables, default option ...
         */
        static function install()
        {
            // default option when activate
            $home_settings = array('activate_email' => 'no');
            update_option(self::home_option_name, $home_settings);
            // set sign up parameters
            $signup_settings = array('is_confirm_email' => 'yes', 'is_double_optin' => 'no', 'template_id' => '-1', 'redirect_url' => '', 'redirect_url_click' => '', 'is_redirect_url_click' => 'no', 'sender_id' => '-1');
            update_option(self::form_signup_option_name, $signup_settings);
            // set alert message parameters
            $signup_settings = array('alert_success_message' => __('Thank you, you have successfully registered !', 'sib_lang'), 'alert_error_message' => __('Something wrong occured', 'sib_lang'), 'alert_exist_subscriber' => __('You have already registered', 'sib_lang'), 'alert_invalid_email' => __('Your email address is invalid', 'sib_lang'));
            update_option(self::form_confirmation_option_name, $signup_settings);
            // set sign up form html
            $sib_form_html = <<<EOD
<p class="sib-email-area">
    <label class="sib-email-area">Email Address</label>
    <input type="email" class="sib-email-area" name="email" required="required">
</p>
<p class="sib-NAME-area">
    <label class="sib-NAME-area">Name</label>
    <input type="text" class="sib-NAME-area" name="NAME" >
</p>
<p>
    <input type="submit" class="sib-default-btn" value="Subscribe">
</p>
EOD;
            update_option('sib_use_new_version', '1');
            $form_settings = array('sib_form_html' => stripcslashes($sib_form_html), 'available_attributes' => array('NAME'));
            update_option(self::form_subscription_option_name, $form_settings);
            $account_settings = array('account_email' => '', 'account_user_name' => '', 'account_data' => array());
            update_option(self::account_option_name, $account_settings);
            SIB_Model_Contact::create_table();
        }
 /**
  * Install method is called once install this plugin.
  * create tables, default option ...
  */
 static function activate()
 {
     SIB_Model_Contact::create_table();
     // Get the country code data
     SIB_Model_Country::create_table();
     $file = fopen(plugin_dir_path(__FILE__) . "/model/country_code.csv", "r");
     $country_code = array();
     while (!feof($file)) {
         $code = fgetcsv($file);
         $country_code[$code[0]] = $code[1];
     }
     fclose($file);
     SIB_Model_Country::Initialize($country_code);
     // redirect option
     update_option('ws_do_activation_redirect', true);
 }