function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) { $message = str_replace(array('<br>', '<br />'), "\n", $message); $message = preg_replace('/(?:(?:\\r\\n|\\r|\\n)\\s*){2}/s', "\n", $message); $message = wpautop($message, true); $template = mymail_option('system_mail_template', 'notification.html'); return mymail_wp_mail($to, $subject, $message, $headers, $attachments, $template); }
/** * Return List of forms */ function cspv4_get_mymail_forms() { if (class_exists('mymail')) { $forms = array(); $mforms = mymail_option('forms'); foreach ($mforms as $k => $v) { $forms[$v['id']] = $v['name']; } } else { $forms = array('-1' => 'No Forms Found'); } return $forms; }
public function __construct() { if (!function_exists('geoip_open')) { include MYMAIL_DIR . "/classes/libs/geoip.inc"; } $this->zipfile = MYMAIL_UPLOAD_DIR . '/GeoIPv6.dat.zip'; $this->dbfile = MYMAIL_UPLOAD_DIR . '/GeoIPv6.dat'; if (mymail_option('countries_db') && mymail_option('countries_db') != $this->dbfile) { $this->dbfile = mymail_option('countries_db'); $this->renew = false; } else { if (!file_exists($this->dbfile) || !get_option('mymail_countries')) { add_action('shutdown', array(&$this, 'renew')); } } if (file_exists($this->dbfile)) { $this->gi = geoip_open($this->dbfile, GEOIP_STANDARD); if (!get_option('mymail_countries')) { update_option('mymail_countries', filemtime($this->dbfile)); } } }
private function resend_confirmations() { if (!mymail_option('subscription_resend')) { return false; } $timeoffset = mymail_option('subscription_resend_time', 48) * HOUR_IN_SECONDS; $confirms = get_option('mymail_confirms', array()); global $mymail_subscriber; $baselink = get_permalink(mymail_option('homepage')); if (!$baselink) { $baselink = site_url(); } foreach ($confirms as $id => $data) { if (time() - $data['last'] < $timeoffset) { continue; } $template = isset($data['template']) ? $data['template'] : 'notification.html'; if ($data['try'] >= get_option('subscription_resend_count', 3)) { continue; } $email = $data['userdata']['email']; $mymail_subscriber->send_confirmation($baselink, $email, $data['userdata'], $data['lists'], array('try' => ++$data['try'], 'timestamp' => $data['timestamp'], 'last' => time()), false, $template); //pause if (mymail_option('send_delay')) { usleep(mymail_option('send_delay')); } } }
/** * 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'); } } }
]" tabindex="1" value="<?php if (isset($this->user_data[$field])) { echo $this->user_data[$field]; } ?> " class="regular-text input"> <?php } ?> </div> </div> <?php } } if (mymail_option('track_users') && isset($this->user_data['_meta'])) { foreach ($this->user_data['_meta'] as $key => $meta) { if ($key == 'ip') { continue; } ?> <input type="hidden" value="<?php echo $meta; ?> " name="mymail_data[_meta][<?php echo $key; ?> ]"> <?php } }
private function get_last_tweet($username, $fallback = '') { if (false === ($tweet = get_transient('mymail_tweet_' . $username))) { $response = wp_remote_get('http://api.twitter.com/1/statuses/user_timeline/' . $username . '.json?exclude_replies=1&include_rts=1&count=1&include_entities=1'); if (is_wp_error($response)) { return $fallback; } $data = json_decode($response['body']); if (isset($data->errors)) { return $fallback; } if (isset($data->error)) { return $fallback; } $tweet = $data[0]; if (!isset($tweet->text)) { return $fallback; } if ($tweet->entities->hashtags) { foreach ($tweet->entities->hashtags as $hashtag) { $tweet->text = str_replace('#' . $hashtag->text, '#<a href="https://twitter.com/search/%23' . $hashtag->text . '">' . $hashtag->text . '</a>', $tweet->text); } } if ($tweet->entities->urls) { foreach ($tweet->entities->urls as $url) { $tweet->text = str_replace($url->url, '<a href="' . $url->url . '">' . $url->display_url . '</a>', $tweet->text); } } //$tweet->text = preg_replace('/(http|https|ftp|ftps)\:\/\/([a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*))?/','<a href="\0">\2</a>', $tweet->text); //$tweet->text = preg_replace('/(^|\s)#(\w+)/','\1#<a href="https://twitter.com/search/%23\2">\2</a>',$tweet->text); $tweet->text = preg_replace('/(^|\\s)@(\\w+)/', '\\1@<a href="https://twitter.com/\\2">\\2</a>', $tweet->text); set_transient('mymail_tweet_' . $username, $tweet, 60 * mymail_option('tweet_cache_time')); } return $tweet->text; }
public function widget($args, $instance) { global $post; if ($post && mymail_option('homepage') == $post->ID) { return false; } // outputs the content of the widget extract($args); $title = apply_filters('widget_title', $instance['title']); $text_before = apply_filters('widget_text_before', isset($instance['text_before']) ? $instance['text_before'] : false); $form = apply_filters('widget_form', $instance['form']); $text_after = apply_filters('widget_text_after', isset($instance['text_after']) ? $instance['text_after'] : false); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } require_once MYMAIL_DIR . '/classes/form.class.php'; global $mymail_form; if (!$mymail_form) { $mymail_form = new mymail_form(); } if ($text_before) { echo '<div class="mymail-widget-text mymail-widget-text-before">' . $text_before . '</div>'; } echo $mymail_form->form($form, 1, 'mymail-in-widget'); if ($text_after) { echo '<div class="mymail-widget-text mymail-widget-text-before">' . $text_after . '</div">'; } echo $after_widget; }
font-size:12px; border: 1px solid #ccc; border-collapse: collapse; } td{ padding: 3px; } </style> </head> <body> <div> <?php if (isset($_REQUEST[mymail_option('cron_secret')])) { $last = get_option('mymail_cron_lasthit'); update_option('mymail_cron_lasthit', array('ip' => $_SERVER['REMOTE_ADDR'], 'timestamp' => current_time('timestamp'), 'oldtimestamp' => isset($last['timestamp']) ? $last['timestamp'] : current_time('timestamp'))); if (mymail_option('cron_service') != 'cron') { die('wp_cron in use!'); } global $mymail; ?> <script> var finished = false; window.addEventListener('load', function () { console.log('window.load'); if(!finished) document.getElementById('info').innerHTML = '<h2>Your servers execution time has been execed!</h2><p>No worries, emails still get sent. But it\'s recommended to increase the "max_execution_time" for your server, add <code>define("WP_MEMORY_LIMIT", "256M");</code> to your wp-config.php file or decrease the <a href="<?php echo admin_url('/'); ?> options-general.php?page=newsletter-settings&settings-updated=true#delivery" target="_blank">number of mails sent</a> maximum in the settings!</p><p><a onclick="location.reload();" class="button" id="button">ok, now reload</a></p>'; }); </script>
location.hash = '#region='; } function regionClick(event){ var options = {}; var region = event.region ? event.region : event; if(region.match(/-/)) return false; options['region'] = region; <?php if (mymail_option('trackcities') && isset($this->campaign_data['cities'])) { ?> if(city_data_unknown[region]){ $('#mapinfo').show().html('+ '+city_data_unknown[region]+' <?php _e('unknown locations', 'mymail'); ?> ') }else{ $('#mapinfo').hide(); } d = citydata[region] ? citydata[region] : []; options['resolution'] = 'provinces'; options['displayMode'] = 'markers';
?> <p class="description"><?php echo sprintf(__('If you disable this tab you cannot access it anymore from the settings page. If you would like to bring it back delete the %1$s option from the %2$s table', 'mymail'), '"mymail_purchasecode_disabled"', '"' . $wpdb->options . '"'); ?> </p></label> </td> </tr> </table> </div> <?php } else { ?> <input type="hidden" name="mymail_options[purchasecode]" value="<?php echo esc_attr(mymail_option('purchasecode')); ?> "> <?php } ?> <?php foreach ($extra_sections as $id => $name) { ?> <div id="tab-<?php echo $id; ?> " class="tab"> <?php
$form['prefill'] = true; $options['forms'][] = $form; } mymail_notice('[1.3.3] New capability: "manage subscribers". Please check the <a href="options-general.php?page=newsletter-settings#capabilities">capabilities settings page</a>'); case '1.3.3': case '1.3.3.1': case '1.3.3.2': $options['subscription_resend_count'] = 2; $options['subscription_resend_time'] = 48; case '1.3.4': $options['sendmail_path'] = '/usr/sbin/sendmail'; case '1.3.4.1': case '1.3.4.2': case '1.3.4.3': $forms = $options['forms']; $customfields = mymail_option('custom_field', array()); $options['forms'] = array(); foreach ($forms as $form) { $order = array('email'); if (isset($options['firstname'])) { $order[] = 'firstname'; } if (isset($options['lastname'])) { $order[] = 'lastname'; } $required = array('email'); if (isset($options['require_firstname'])) { $required[] = 'firstname'; } if (isset($options['require_lastname'])) { $required[] = 'lastname';
/** * 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'); } } }
public function ajax_do_export() { $return['success'] = false; $this->ajax_nonce(json_encode($return)); if (!current_user_can('mymail_export_subscribers')) { $return['msg'] = 'no allowed'; echo json_encode($return); exit; } $filename = get_transient('mymail_export_filename'); if (!file_exists($filename) || !is_writeable($filename)) { $return['msg'] = 'error'; echo json_encode($return); exit; } parse_str($_POST['data'], $d); $offset = intval($_POST['offset']); $limit = intval($_POST['limit']); $raw_data = array(); $encoding = $d['encoding']; $outputformat = $d['outputformat']; $useheader = $offset === 0 && isset($d['header']); if ($useheader) { $row = array(); $customfields = mymail_option('custom_field', array()); foreach ($d['column'] as $col) { switch ($col) { case '_number': $val = '#'; break; case 'email': case 'firstname': case 'lastname': $val = mymail_text($col, $col); break; case '_listnames': $val = __('Lists', 'mymail'); break; case '_status': $val = __('Status', 'mymail'); break; case '_ip': $val = __('IP Address', 'mymail'); break; case '_signuptime': $val = __('Signup Date', 'mymail'); break; case '_signupip': $val = __('Signup IP', 'mymail'); break; case '_confirmtime': $val = __('Confirm Date', 'mymail'); break; case '_confirmip': $val = __('Confirm IP', 'mymail'); break; default: $val = isset($customfields[$col]) ? $customfields[$col]['name'] : ''; } $val = mb_convert_encoding($val, $encoding, 'UTF-8'); $row[] = str_replace(';', ',', $val); } $raw_data[] = $row; } $offset = $offset * $limit; global $wpdb; if (isset($d['nolists'])) { $sql = "SELECT ID, post_title a FROM {$wpdb->posts} a LEFT JOIN {$wpdb->users} u ON (a.post_author = u.ID) WHERE a.post_status IN ('" . implode("','", $d['status']) . "') AND a.post_type IN('subscriber') AND a.ID NOT IN (SELECT object_id FROM {$wpdb->term_relationships} tr LEFT JOIN {$wpdb->term_taxonomy} tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE taxonomy = 'newsletter_lists')"; $data = $wpdb->get_results($sql); } if (!empty($d['lists'])) { $sql = "SELECT ID, post_title, post_status FROM {$wpdb->posts} a LEFT JOIN {$wpdb->term_relationships} b ON ( a.ID = b.object_id ) LEFT JOIN {$wpdb->postmeta} c ON ( a.ID = c.post_id ) LEFT JOIN {$wpdb->term_taxonomy} d ON ( d.term_taxonomy_id = b.term_taxonomy_id ) LEFT JOIN {$wpdb->terms} e ON ( e.term_id = d.term_id ) WHERE a.post_type IN('subscriber') AND a.post_status IN ('" . implode("','", $d['status']) . "') AND e.term_id IN (" . implode(',', $d['lists']) . ") GROUP BY a.ID LIMIT {$offset}, {$limit};"; $data = $wpdb->get_results($sql); $counter = 1 + $offset; foreach ($data as $user) { $userdata = get_post_meta($user->ID, 'mymail-userdata', true); $row = array(); foreach ($d['column'] as $col) { switch ($col) { case '_number': $val = $counter; break; case 'email': $val = $user->post_title; break; case '_listnames': $terms = wp_get_post_terms($user->ID, 'newsletter_lists', array("fields" => "names")); $val = implode(', ', $terms); break; case '_status': $val = __($user->post_status, 'mymail'); break; case '_ip': $val = isset($userdata['_meta']['ip']) ? $userdata['_meta']['ip'] : ''; break; case '_signuptime': $val = isset($userdata['_meta']['signuptime']) ? $d['dateformat'] ? date($d['dateformat'], $userdata['_meta']['signuptime']) : $userdata['_meta']['signuptime'] : ''; break; case '_signupip': $val = isset($userdata['_meta']['signupip']) ? $userdata['_meta']['signupip'] : ''; break; case '_confirmtime': $val = isset($userdata['_meta']['confirmtime']) ? $d['dateformat'] ? date($d['dateformat'], $userdata['_meta']['confirmtime']) : $userdata['_meta']['confirmtime'] : ''; break; case '_confirmip': $val = isset($userdata['_meta']['confirmip']) ? $userdata['_meta']['confirmip'] : ''; break; default: $val = isset($userdata[$col]) ? apply_filters('mymail_export_custom_field', $userdata[$col], $col) : ''; } $val = mb_convert_encoding($val, $encoding, 'UTF-8'); $row[] = str_replace(';', ',', $val); } $raw_data[] = $row; $counter++; } $output = ''; if ($outputformat == 'html') { if ($useheader) { $firstrow = array_shift($raw_data); $output .= '<tr><th>' . implode('</th><th>', $firstrow) . "</th></tr>\n"; } foreach ($raw_data as $row) { $output .= '<tr><td>' . implode('</td><td>', $row) . "</td></tr>\n"; } } else { foreach ($raw_data as $row) { $output .= implode(';', $row) . "\n"; } } try { $bytes = file_put_contents($filename, $output, FILE_APPEND); $return['total'] = size_format(filesize($filename), 2); $return['success'] = true; if ($bytes === 0) { $return['finished'] = true; mymail_require_filesystem(); global $wp_filesystem; //finished $folder = MYMAIL_UPLOAD_DIR; $finalname = dirname($filename) . '/mymail_export_' . date('Y-m-d-H-i-s') . '.' . $outputformat; $return['success'] = copy($filename, $finalname); $wp_filesystem->delete($filename); $return['filename'] = admin_url('admin-ajax.php?action=mymail_download_export_file&file=' . basename($finalname) . '&format=' . $outputformat . '&_wpnonce=' . wp_create_nonce('mymail_nonce')); } } catch (Exception $e) { $return['success'] = false; $return['msg'] = $e->getMessage(); } } echo json_encode($return); exit; }
<?php $editable = !in_array($post->post_status, array('active', 'finished')); if ($editable) { ?> <span class="spinner" id="colorschema-ajax-loading"></span> <p><label><input name="mymail_data[embed_images]" id="mymail_data_embed_images" value="1" type="checkbox" <?php echo isset($this->post_data['embed_images']) ? $this->post_data['embed_images'] ? 'checked' : '' : (mymail_option('embed_images') ? 'checked' : ''); ?> <?php echo $editable ? 'disabled' : ''; ?> > <?php _e('Embed Images', 'mymail'); ?> </label></p> <label><?php _e('Colors', 'mymail'); ?> </label> <a class="savecolorschema"><?php _e('save this schema', 'mymail'); ?> </a> <ul class="colors"> <?php $html = $this->templateobj->get(true); $colors = array(); preg_match_all('/#[a-fA-F0-9]{6}/', $html, $hits); $original_colors = array_unique($hits[0]);
<?php $active = isset($this->post_data['active']) ? $this->post_data['active'] : false; $autoresponder_active = isset($this->post_data['active_autoresponder']) ? $this->post_data['active_autoresponder'] : false; $timestamp = isset($this->post_data['timestamp']) ? $this->post_data['timestamp'] : current_time('timestamp') + 60 * 30 * 0; $timestamp = !$active ? max(current_time('timestamp') + 60 * mymail_option('send_offset'), $timestamp) : $timestamp; $editable = !in_array($post->post_status, array('active', 'finished')); $autoresponder = $post->post_status == 'autoresponder'; $current_user = wp_get_current_user(); $totalcount = $this->get_totals_by_id($post_id); $totalcount += isset($this->campaign_data['unsubscribes']) ? $this->campaign_data['unsubscribes'] : 0; if ($editable) { if (current_user_can('mymail_edit_autoresponders')) { ?> <ul class="category-tabs"> <li class="<?php if (!$autoresponder) { echo 'tabs'; } ?> "><a href="#regular-campaign"><?php _e('Regular Campaign', 'mymail'); ?> </a></li> <li class="<?php if ($autoresponder) { echo 'tabs'; } ?> "><a href="#autoresponder"><?php _e('Auto Responder', 'mymail');
<li class="share header"> <a><?php _e('Share', 'mymail'); ?> </a> <div class="sharebox" <?php if ($is_forward) { echo ' style="display:block"'; } ?> > <div class="arrow"></div> <div class="sharebox-inner"> <ul class="sharebox-panel"> <?php if ($services = mymail_option('share_services')) { ?> <li class="sharebox-panel-option <?php if (!$is_forward) { echo ' active'; } ?> "> <h4><?php echo sprintf(__('Share this via %s', 'mymail'), '…'); ?> </h4> <div> <ul class="social-services"> <?php foreach ($services as $service) {
echo admin_url('admin-ajax.php?action=mymail_form_css&' . mymail_option('form_css_hash')); ?> ' type='text/css' media='all' /> <?php do_action('wp_mymail_head'); ?> </head> <body> <div id="formwrap"> <?php mymail_form(isset($_GET['id']) ? intval($_GET['id']) : 0, 1, true, 'embeded'); do_action('wp_mymail_footer'); if (mymail_option('ajax_form')) { ?> <script type="text/javascript" src="<?php echo get_site_url() . '/' . WPINC . '/js/jquery/jquery.js?ver=' . MYMAIL_VERSION; ?> "></script> <script type="text/javascript" src="<?php echo MYMAIL_URI . '/assets/js/form.js?ver=' . MYMAIL_VERSION; ?> "></script> <?php } ?> </div> </body>
onclick="alert('<?php _e('This file is no writeable! Please change the file permission', 'mymail'); ?> ');return false;"<?php } ?> ><?php _e('Edit HTML', 'mymail'); ?> </a></li> <?php } ?> </ul> <?php if ($slug != mymail_option('default_template') && current_user_can('mymail_delete_templates')) { ?> <div class="delete-theme"> <a onclick="return confirm(<?php echo "'" . esc_html(sprintf(__('You are about to delete this template "%s"', 'mymail'), $data['name'])) . "'"; ?> );" href="edit.php?post_type=newsletter&page=mymail_templates&action=delete&template=<?php echo $slug; ?> &_wpnonce=<?php echo wp_create_nonce('delete-' . $slug); ?> " class="submitdelete deletion">Delete</a> </div> <?php }
function mymail_get_new_unsubscribers() { if ($t = mymail_option('subscribers_count')) { return $t['unsub']; } return 0; }
public function send_notification($content, $headline = NULL, $replace = array(), $force = false, $file = 'notification.html') { if (is_null($headline)) { $headline = $this->subject; } $template = mymail_option('default_template'); if ($template) { require_once MYMAIL_DIR . '/classes/templates.class.php'; $template = new mymail_templates($template, $file); $this->content = $template->get(true, true); } else { $this->content = $headline . '<br>' . $content; } require_once MYMAIL_DIR . '/classes/placeholder.class.php'; $placeholder = new mymail_placeholder($this->content); $placeholder->add(array('subject' => $this->subject, 'preheader' => $headline, 'headline' => $headline, 'content' => $content)); $placeholder->add($replace); $this->content = $placeholder->get_content(); $placeholder->set_content($this->subject); $this->subject = $placeholder->get_content(); $this->prepare_content(); $this->add_tracking_image = false; $this->embed_images = mymail_option('embed_images'); $success = $this->send($force); $this->close(); return $success; }
static function print_script() { if (!self::$add_script) { return; } global $is_IE; if ($is_IE) { wp_print_scripts('jquery'); echo '<!--[if lte IE 9]>'; wp_print_scripts('mymail-form-placeholder'); echo '<![endif]-->'; } if (mymail_option('ajax_form')) { wp_print_scripts('mymail-form'); } }
public function ajax_bounce_test_check() { $return['success'] = false; $return['msg'] = ''; $passes = intval($_POST['passes']); $identifier = $_POST['identifier']; if (!mymail_option('bounce_active')) { $return['complete'] = true; echo json_encode($return); exit; } $server = mymail_option('bounce_server'); $user = mymail_option('bounce_user'); $pwd = mymail_option('bounce_pwd'); if (!$server || !$user || !$pwd) { $return['complete'] = true; echo json_encode($return); exit; } if (mymail_option('bounce_ssl')) { $server = 'ssl://' . $server; } require_once ABSPATH . WPINC . '/class-pop3.php'; $pop3 = new POP3(); if (!$pop3->connect($server, mymail_option('bounce_port', 110)) || !$pop3->user($user)) { $return['complete'] = true; $return['msg'] = __('Unable to connect to bounce server! Please check your settings.', 'mymail'); echo json_encode($return); exit; } $return['success'] = true; $count = $pop3->pass($pwd); $return['msg'] = __('checking for new messages', 'mymail') . str_repeat('.', $passes); if ($passes > 20) { $return['complete'] = true; $return['msg'] = __('Unable to get test message! Please check your settings.', 'mymail'); } if (false === $count || 0 === $count) { if (0 === $count) { $pop3->quit(); } echo json_encode($return); exit; } for ($i = 1; $i <= $count; $i++) { $message = $pop3->get($i); if (!$message) { continue; } $message = implode($message); if (strpos($message, $identifier)) { $pop3->delete($i); $pop3->quit(); $return['complete'] = true; $return['msg'] = __('Your bounce server is good!', 'mymail'); echo json_encode($return); exit; } else { $pop3->reset(); } } $pop3->quit(); echo json_encode($return); exit; }
public function autoresponder_condition_fields($fields) { if ($customfield = mymail_option('custom_field')) { foreach ($customfield as $field => $data) { $fields[$field] = $data['name']; } } return $fields; }
public function comment_post($comment_ID, $comment_approved) { if (isset($_POST['newsletter_signup']) && in_array($comment_approved . '', mymail_option('register_comment_form_status', array()))) { $comment = get_comment($comment_ID); if (!$this->get_by_mail($comment->comment_author_email)) { $lists = apply_filters('mymail_comment_post_lists', mymail_option('register_comment_form_lists', array()), $comment, $comment_approved); $user_data = apply_filters('mymail_comment_post_userdata', array('firstname' => $comment->comment_author), $comment, $comment_approved); mymail_subscribe($comment->comment_author_email, $user_data, $lists); } } }