public function renew($force = false) { if (!$force && time() - get_option('mymail_countries') < 86400 * $this->renewindays && get_option('mymail_countries') && !$this->renew) { return false; } global $wp_filesystem; mymail_require_filesystem(); @set_time_limit(120); $zip = wp_remote_get($this->zip, array('timeout' => 120, 'sslverify' => false)); if (is_wp_error($zip) || $zip['response']['code'] != 200) { if (file_exists($this->dbfile)) { @touch($this->dbfile); update_option('mymail_countries', filemtime($this->dbfile)); return $this->dbfile; } return $zip; } if (!is_dir(dirname($this->dbfile))) { wp_mkdir_p(dirname($this->dbfile)); } if (!$wp_filesystem->put_contents($this->zipfile, $zip['body'], FS_CHMOD_FILE)) { return new WP_Error('write_file', 'error saving file'); } if (!unzip_file($this->zipfile, dirname($this->dbfile))) { return new WP_Error('unzip_file', 'error unzipping file'); } else { if (!$wp_filesystem->delete($this->zipfile)) { return new WP_Error('delete_file', 'error deleting old file'); } } if (!file_exists($this->dbfile)) { mymail_update_option('trackcountries', false); return new WP_Error('file_missing', 'file is missing'); } update_option('mymail_countries', filemtime($this->dbfile)); $this->gi = geoip_open($this->dbfile, GEOIP_STANDARD); return $this->dbfile; }
/** * deactivate function. * * @access public * @return void */ public function deactivate() { d; if (defined('MYMAIL_VERSION') && function_exists('mymail_option') && version_compare(MYMAIL_POSTMAN_REQUIRED_VERSION, MYMAIL_VERSION, '<=')) { if (mymail_option('deliverymethod') == MYMAIL_POSTMAN_ID) { mymail_update_option('deliverymethod', 'simple'); /* Translators where %s is the name of the page */ mymail_notice(sprintf(__('MyMail: Change the delivery method in the %s!', Postman::TEXT_DOMAIN), sprintf('<a href="options-general.php?page=newsletter-settings&mymail_remove_notice=mymail_delivery_method#delivery">%s</a>', __('Settings', 'postman-smtp'))), '', false, 'delivery_method'); } } }
public function ajax_load_geo_data() { $return['success'] = false; $type = esc_attr($_POST['type']); if ($type == 'country') { require_once MYMAIL_DIR . '/classes/libs/Ip2Country.php'; $ip2Country = new Ip2Country(); $result = $ip2Country->renew(true); if (is_wp_error($result)) { $return['msg'] = __('Couldn\'t load Country DB', 'mymail'); } else { $return['success'] = true; $return['msg'] = __('Country DB successfully loaded!', 'mymail'); $return['path'] = $result; $return['buttontext'] = __('Update Country Database', 'mymail'); mymail_update_option('countries_db', $result); } } else { if ($type == 'city') { require_once MYMAIL_DIR . '/classes/libs/Ip2City.php'; $ip2City = new Ip2City(); $result = $ip2City->renew(true); if (is_wp_error($result)) { $return['msg'] = __('Couldn\'t load City DB', 'mymail'); } else { $return['success'] = true; $return['msg'] = __('City DB successfully loaded!', 'mymail'); $return['path'] = $result; $return['buttontext'] = __('Update City Database', 'mymail'); mymail_update_option('cities_db', $result); } } else { $return['msg'] = 'not allowed'; } } echo json_encode($return); exit; }
public function created_newsletter_lists($term_id, $tt_id) { $term = get_term($term_id, 'newsletter_lists'); $forms = mymail_option('forms'); foreach ($forms as $id => $form) { if (isset($form['addlists']) && $form['addlists']) { $forms[$id]['lists'][] = $term->slug; } } mymail_update_option('forms', $forms); mymail_clear_cache('form'); }
/** * deactivate function. * * @access public * @return void */ public function deactivate() { if (defined('MYMAIL_VERSION') && function_exists('mymail_option') && version_compare(MYMAIL_POSTMAN_REQUIRED_VERSION, MYMAIL_VERSION, '<=')) { if (mymail_option('deliverymethod') == MYMAIL_POSTMAN_ID) { mymail_update_option('deliverymethod', 'simple'); mymail_notice(sprintf(__('Change the delivery method on the %s!', 'MYMAIL_POSTMAN'), '<a href="options-general.php?page=newsletter-settings&mymail_remove_notice=mymail_delivery_method#delivery">Settings Page</a>'), '', false, 'delivery_method'); } } }
} ?> " href="edit.php?post_type=newsletter&page=mymail_templates&upload=1"><?php _e('Upload', 'mymail'); ?> </a> <?php } ?> </h2> <div id="mymail_templates"> <?php $slug = mymail_option('default_template', 'mymail'); if (!isset($templates[$slug])) { $slug = 'mymail'; mymail_update_option('default_template', 'mymail'); $notice[] = sprintf(__('Template %s is missing or broken. Reset to default', 'mymail'), '"' . $slug . '"'); //mymail tempalte is missing 0> redownload it if (!isset($templates[$slug])) { $t->renew_default_template(); $templates = $t->get_templates(); } } $template = $templates[$slug]; wp_nonce_field('mymail_nonce'); if ($notice) { foreach ($notice as $note) { ?> <div class="updated"><p><?php echo $note; ?>