X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fnewsletter_functions.php;h=b5159ca8eabb40ca1d03f84e4d3487a253a41b36;hb=b6c301dece2d7a3375321d4f3c0498ceaeb5a2a6;hp=16a28db280747a41ebc2f4f1f259137342e97143;hpb=3afdce4fe00b4af570122ce7b8158ced44aec7d3;p=mailer.git diff --git a/inc/libs/newsletter_functions.php b/inc/libs/newsletter_functions.php index 16a28db280..b5159ca8ea 100644 --- a/inc/libs/newsletter_functions.php +++ b/inc/libs/newsletter_functions.php @@ -1,10 +1,10 @@ ", $test)) { - $check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1)); - $check = str_replace('/', '', $check); - if (!in_array($check, $GLOBALS['html_tags'])) { - // Invalid tag found! - return ""; - } - $test = substr($test, strpos($test, ">") + 1); - } - // Return tested code - return $html; -} - -// -function NL_INSERT_URLS ($text) { +function insertNewsletterUrls ($text) { $test = $text; // First replace URLs... - while (ereg('http://', $test)) { + while (isInString('http://', $test)) { $check = substr($test, strpos($test, 'http://')); $check2 = $check; // See ext-html.php if you want to add more URL ends... foreach ($GLOBALS['url_ends'] as $end) { - if (ereg($end, $check)) $check = substr($check, 0, strpos($check, $end)); + if (isInString($end, $check)) $check = substr($check, 0, strpos($check, $end)); } // END - foreach // Now replace the URL against anchor container and pray... - $text = substr($text, 0, strpos($text, $check2)) . DEREFERER($check) . substr($text, strpos($text, $check2) + strlen($check)); + $text = substr($text, 0, strpos($text, $check2)) . generateDerefererUrl($check) . substr($text, strpos($text, $check2) + strlen($check)); // Finally remove the url from testing string (or we have a loop and maybe server overload!) $test = substr($test, strpos($test, $check) + strlen($check)); @@ -97,8 +68,8 @@ function NL_INSERT_URLS ($text) { // ... what will the email address be out the @... ;-) $PARTS = array(); - while (ereg("@", $test)) { - $pos = strpos($test, "@"); + while (isInString('@', $test)) { + $pos = strpos($test, '@'); $test2 = substr($test, 0, $pos); // First check backwards @@ -120,10 +91,10 @@ function NL_INSERT_URLS ($text) { } // And now go forward... - $idx = 0; + $idx = '0'; while ($idx < strlen($test)) { $check = substr($test, $idx, 1); - if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) { + if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != '@')) { // Char found so end here again break; } @@ -136,7 +107,7 @@ function NL_INSERT_URLS ($text) { } // Now replace the email against anchor with mailto and pray... - $PARTS[] = $check2.$check; + $PARTS[] = $check2 . $check; // Remove email from testing string (see above why...) $test = substr($test, strlen($check)); @@ -148,25 +119,25 @@ function NL_INSERT_URLS ($text) { $text .= $part; } - // Compile possible own HTML tags out... - return COMPILE_CODE($text); + // Pre-ompile possible own HTML tags out... + return preCompileCode($text); } -// -function SEND_NEWSLETTER ($to, $subject, $message, $mode) { +// Wrapper for sending newsletter and wrapping URLs / HTML mail +function sendNewsletter ($to, $subject, $message, $mode) { // Send mail away as HTML - if (REQUEST_POST('auto_urls') == 'Y') { + if (postRequestParameter('auto_urls') == 'Y') { // Automatically insert URLs into newsletter - if ((EXT_IS_ACTIVE('html_mail')) && ($mode == 'html')) { + if ((isExtensionActive('html_mail')) && ($mode == 'html')) { // Send HTML mail - sendEmail($to, $subject, HTML_INSERT_URLS($message), 'Y'); + sendEmail($to, $subject, insertUrlsIntoHtml($message), 'Y'); } else { // Send normal mail - sendEmail($to, $subject, NL_INSERT_URLS($message), 'N'); + sendEmail($to, $subject, insertNewsletterUrls($message), 'N'); } } else { // Regular send-out - if ((EXT_IS_ACTIVE('html_mail')) && ($mode == 'html')) { + if ((isExtensionActive('html_mail')) && ($mode == 'html')) { sendEmail($to, $subject, $message, 'Y'); } else { sendEmail($to, $subject, $message, 'N');