". __("Here is a summary of some solutions that might help you", "alo-easymail") .":
\n"; $html .= "» ". sprintf( __("increase the cron timeout in %s to 20 seconds or more", "alo-easymail"), "".includes_url()."cron.php" ) .":
"; $html .= ''.__("FROM", "alo-easymail").":\t".'wp_remote_post( $cron_url, array(\'timeout\' => 0.01, \'blocking\' => false, \'sslverify\' => apply_filters(\'https_local_ssl_verify\', true)) );';
$html .= ''.__("TO", "alo-easymail").":\t".'wp_remote_post( $cron_url, array(\'timeout\' => 20, \'blocking\' => false, \'sslverify\' => apply_filters(\'https_local_ssl_verify\', true)) );';
$html .= "» ". sprintf( __("add this code in %s", "alo-easymail"), "".get_option('siteurl')."/wp-config.php" ) .":
"; $html .= "define('WP_MEMORY_LIMIT', '96M');\n@ini_set( 'upload_max_size', '100M' );\n@ini_set( 'post_max_size', '105M');\n@ini_set( 'max_execution_time', '600' );\n";
$html .= "» ". sprintf( __("add this code in %s", "alo-easymail"), "".get_option('siteurl')."/.htaccess" ) ." (". __("if this file does not exist, create it", "alo-easymail") . "):
"; $html .= "php_value memory_limit 96M\nphp_value upload_max_filesize 100M\nphp_value post_max_size 105M\nphp_value max_execution_time 600\nphp_value max_input_time 600\n";
$html .= "". __("If you have problems in sending you can try alterative cron", "alo-easymail") .": ". sprintf( __("add this code in %s", "alo-easymail"), "".get_option('siteurl')."/wp-config.php" ) .":
\n"; $html .= "define('ALTERNATE_WP_CRON', true);\n";
$html .= "". __("For more info, visit the FAQ of the site.", "alo-easymail") . ' »' ."
\n"; $html .= "
' . __( 'No recipients selected yet', "alo-easymail").'';
if ( alo_em_user_can_edit_newsletter( $post->ID ) ) echo '';
} else {
//echo "". print_r ( $recipients, true ) . ""; echo "". __( 'Total recipients', "alo-easymail") .": "; if ( alo_em_get_newsletter_status( $post->ID ) ) { // if already created list of recipients, count form db, otherwise from meta echo alo_em_count_newsletter_recipients( $post->ID ); } else { echo alo_em_count_recipients_from_meta ( $post->ID ); } echo "
';
echo "";
echo '
';
echo "";
}
if ( alo_em_user_can_edit_newsletter( $newsletter ) ) echo " ". $goto_report;
break;
case "pending":
echo "".__("Pending Review"). "
';
}
break;
case "draft":
echo "".__("Draft"). "
';
echo "";
}
if ( alo_em_user_can_edit_newsletter( $newsletter ) ) echo " ". $goto_report;
break;
case false:
default:
$rec_url = wp_nonce_url( ALO_EM_PLUGIN_URL . '/alo-easymail_recipients-list.php?', 'alo-easymail_recipients-list');
if ( alo_em_user_can_edit_newsletter( $newsletter ) ) echo "";
echo "| \n"; $html .= " | \n"; $html .= " \n"; $html .= " | \n"; $html .= "
|---|
ID ) == 0 ) ? "class=\"easymail-txtwarning\"" : "" ) ." >"; echo "" .__("Selected recipients", "alo-easymail") .": ". alo_em_count_recipients_from_meta( $post->ID ) ."
"; if ( alo_em_get_newsletter_status ( $post->ID ) == "sent" ) { echo "". __("This newsletter was already sent", "alo-easymail") .".
"; echo "". __("The creation of the recipients list has already started", "alo-easymail") .".
"; echo ""; echo "
"; echo "";
echo '
';
echo " " . stripslashes ( alo_em___( $newsletter[0]->post_title ) ) ."
";
echo __("Progress", "alo-easymail") .": " . alo_em_newsletter_recipients_percentuage_already_sent( $newsletter[0]->ID ) . " %
" ;
echo "".__("Added on", "alo-easymail") . " ". date_i18n( __( 'j M Y @ G:i' ), strtotime( $newsletter[0]->post_date ) ) . " - ";
echo __("Scheduled by", "alo-easymail") . " ". get_user_meta($newsletter[0]->post_author, 'nickname',true). "";
echo "
". __("There are no newsletters in queue", "alo-easymail") . ".
"; } echo "". sprintf( __("There are %d subscribers: %d activated, %d not activated", "alo-easymail"), $total, $active, $noactive ) . ".
"; } else { echo "". __("No subscribers", "alo-easymail") . ".
"; } echo "'; echo '
'; $mailinglists = alo_em_get_mailinglists( 'public' ); if ( $mailinglists ) { $lists_msg = ( alo_em_translate_option ( alo_em_get_language (), 'alo_em_custom_lists_msg',false) !="") ? alo_em_translate_option ( alo_em_get_language (), 'alo_em_custom_lists_msg',false) : __("You can also sign up for specific lists", "alo-easymail"); echo "". $lists_msg .":
\n"; foreach ( $mailinglists as $list => $val ) { echo "\n"; } } echo ' '; } add_action('register_form','alo_em_show_registration_optin'); /** * Save the optin/optout on Registration Form */ function alo_em_save_registration_optin ( $user_id, $password="", $meta=array() ) { $user = get_userdata($user_id); if (!empty($user->first_name) && !empty($user->last_name)) { $name = $user->first_name.' '.$user->last_name; } else { $name = $user->display_name; } if ( isset ($_POST['alo_em_opt']) && $_POST['alo_em_opt'] == "yes" ) { $lang = ( isset($_POST['alo_em_lang']) && in_array ( $_POST['alo_em_lang'], alo_em_get_all_languages( false )) ) ? $_POST['alo_em_lang'] : "" ; alo_em_add_subscriber( $user->user_email, $name , 1, $lang ); // if subscribing, save also lists $mailinglists = alo_em_get_mailinglists( 'public' ); if ($mailinglists) { $subscriber_id = alo_em_is_subscriber( $user->user_email ); foreach ( $mailinglists as $mailinglist => $val) { if ( isset ($_POST['alo_em_register_lists']) && is_array ($_POST['alo_em_register_lists']) && in_array ( $mailinglist, $_POST['alo_em_register_lists'] ) ) { alo_em_add_subscriber_to_list ( $subscriber_id, $mailinglist ); // add to list } } } } } add_action( 'user_register', 'alo_em_save_registration_optin' ); /** * Edit the e-mail message */ function alo_em_handle_email ( $args ) { // $args['to'], $args['subject'], $args['message'], $args['headers'], $args['attachments'] // Check based on $args['subject']; more attrs in $args['message'] global $_config; /* * 1) Activation e-mail */ if ( strpos ( "#_EASYMAIL_ACTIVATION_#", $args['subject'] ) !== false) { // Get the parameters stored as a query in $args['message'] $defaults = array( 'lang' => '', 'email' => '', 'name' => '', 'unikey' => '' ); //$defaults = array( 'email' => '' ); $customs = wp_parse_args( $args['message'], $defaults ); extract( $customs, EXTR_SKIP ); //$subscriber = alo_em_get_subscriber( $email ); // Subject if ( $subject_text = alo_em_translate_option ( $lang, 'alo_em_txtpre_activationmail_subj', true ) ) { $subject = $subject_text; } else { $subject = alo_em___( __("Confirm your subscription to %BLOGNAME% Newsletter", "alo-easymail" ) ); } $blogname = html_entity_decode ( wp_kses_decode_entities ( get_option('blogname') ) ); $subject = str_replace ( "%BLOGNAME%", $blogname, $subject ); $args['subject'] = $subject; // Content if ( $content_txt = alo_em_translate_option ( $lang, 'alo_em_txtpre_activationmail_mail', true ) ) { $content = $content_txt; } else { $content = __("Hi %NAME%\nto complete your subscription to %BLOGNAME% newsletter you need to click on the following link (or paste it in the address bar of your browser):\n", "alo-easymail"); $content .= "%ACTIVATIONLINK%\n\n"; $content .= __("If you did not ask for this subscription ignore this message.", "alo-easymail"). "\n"; $content .= __("Thank you", "alo-easymail")."\n". $blogname ."\n"; } /* $div_email = explode("@", $email); $arr_params = array ('ac' => 'activate', 'em1' => $div_email[0], 'em2' => $div_email[1], 'uk' => $unikey ); $sub_link = add_query_arg( $arr_params, get_page_link (get_option('alo_em_subsc_page')) ); $sub_link = alo_em_translate_url ( $sub_link, $lang ); */ //$div_email = explode("@", $email); $sub_vars = $email ."|" /*$div_email[0] . "|" . $div_email[1] . "|" */ . $unikey . "|" . $lang; //$sub_vars = $subscriber->ID . "|" . $subscriber->unikey; $sub_vars = urlencode( base64_encode( $sub_vars ) ); $sub_link = add_query_arg( 'emact', $sub_vars, trailingslashit( get_home_url() ) ); $sub_link = alo_em_translate_url ( $sub_link, $lang /*$subscriber->lang */ ); $content = str_replace ( "%BLOGNAME%", $blogname, $content ); $content = str_replace ( "%NAME%", /* $subscriber->name */ $name, $content ); $content = str_replace ( "%ACTIVATIONLINK%", $sub_link, $content ); $args['message'] = $content; } return $args; } add_filter('wp_mail', 'alo_em_handle_email'); /** * Add Newsletter menu in Admin bar (from WP 3.1) */ function alo_em_add_menu_admin_bar() { global $wp_admin_bar; if ( !$wp_admin_bar ) return; if ( !is_admin_bar_showing() ) return; if ( current_user_can('edit_posts') ) { $wp_admin_bar->add_menu( array( 'id' => 'alo_easymail', 'title' =>__( 'Newsletters', "alo-easymail" ), 'href' => admin_url('edit.php')."?post_type=newsletter" ) ); $wp_admin_bar->add_menu( array( 'id' => 'alo_easymail_main', 'parent' => 'alo_easymail', 'title' => __( 'Newsletters', "alo-easymail" ), 'href' => admin_url('edit.php')."?post_type=newsletter" ) ); $wp_admin_bar->add_menu( array( 'parent' => 'alo_easymail_main', 'title' => __( 'Send newsletter', "alo-easymail" ), 'href' => admin_url('post-new.php')."?post_type=newsletter" ) ); $wp_admin_bar->add_menu( array( 'parent' => 'alo_easymail_main', 'title' => __( 'Show all', "alo-easymail" ), 'href' => admin_url('edit.php')."?post_type=newsletter" ) ); } if ( current_user_can('manage_easymail_subscribers') ) { $wp_admin_bar->add_menu( array( 'parent' => 'alo_easymail', 'title' => __( 'Subscribers', "alo-easymail" ), 'href' => admin_url('edit.php')."?post_type=newsletter&page=alo-easymail/alo-easymail_subscribers.php" ) ); } if ( current_user_can('manage_easymail_options') ) { $wp_admin_bar->add_menu( array( 'parent' => 'alo_easymail', 'title' => __( 'Options', "alo-easymail" ), 'href' => admin_url('edit.php')."?post_type=newsletter&page=alo-easymail/alo-easymail_options.php" ) ); } } add_action( 'admin_bar_menu', 'alo_em_add_menu_admin_bar' , 70); /** * Send a newsletter to a test email */ function alo_em_send_mailtest () { $result = "no"; check_ajax_referer( "alo-easymail_recipients-list" ); $newsletter = ( isset( $_POST['newsletter'] ) && is_numeric( $_POST['newsletter'] ) ) ? (int) $_POST['newsletter'] : false; $email = ( isset( $_POST['email'] ) && is_email( $_POST['email'] ) ) ? $_POST['email'] : false; if ( $email && $newsletter ) { $recipient = (object) array ( 'newsletter' => $newsletter, 'email' => $email ); if ( alo_em_send_newsletter_to ( $recipient, true ) ) $result = "yes"; } usleep( 500000 ); die ( $result ); } add_action('wp_ajax_easymail_send_mailtest', 'alo_em_send_mailtest'); /** * Alert in admin panel */ function alo_em_admin_notice() { global $pagenow; $page = ( isset( $_GET['page'] ) ) ? $_GET['page'] : false; if ( $pagenow == "edit.php" && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'newsletter' && $page != 'alo-easymail/alo-easymail_subscribers.php' ) { /* if ( get_option('alo_em_timeout_alert') != "hide" ) { echo '
'. __("To enable the plugin work better you should increase the wp_cron and php timeouts", "alo-easymail") .". ";
echo __("For more info you can use the Help button or visit the FAQ of the site", "alo-easymail");
echo ' »
'. __("Debug mode is activated", "alo-easymail") .": ";
if ( get_option('ALO_em_debug_newsletters') == "to_author" ) _e("all messages will be sent to the newsletter author", "alo-easymail");
if ( get_option('ALO_em_debug_newsletters') == "to_file" ) _e("all messages will be recorded into a log file", "alo-easymail");
echo ".