function nxs_doFormatMsg($format, $message, $addURLParams = '')
 {
     global $nxs_urlLen;
     $msg = nxs_doSpin($format);
     // prr($msg); prr($message);// Make "message default"
     $msgDef = array('title' => '', 'announce' => '', 'text' => '', 'url' => '', 'surl' => '', 'urlDescr' => '', 'urlTitle' => '', 'imageURL' => array(), 'videoCode' => '', 'videoURL' => '', 'siteName' => '', 'tags' => '', 'cats' => '', 'authorName' => '', 'orID' => '');
     $message = array_merge($msgDef, $message);
     if (preg_match('/%URL%/', $msg)) {
         $url = $message['url'];
         if ($addURLParams != '') {
             $url .= (strpos($url, '?') !== false ? '&' : '?') . $addURLParams;
         }
         $nxs_urlLen = nxs_strLen($url);
         $msg = str_ireplace("%URL%", $url, $msg);
     }
     if (preg_match('/%SURL%/', $msg)) {
         if (isset($message['surl']) && $message['surl'] != '') {
             $url = $message['surl'];
         } else {
             $url = $message['url'];
             if ($addURLParams != '') {
                 $url .= (strpos($url, '?') !== false ? '&' : '?') . $addURLParams;
             }
             $url = nxs_mkShortURL($url);
         }
         $nxs_urlLen = nxs_strLen($url);
         $msg = str_ireplace("%SURL%", $url, $msg);
     }
     if (preg_match('/%IMG%/', $msg)) {
         if (isset($message['imgURL']) && is_array($message['imgURL'])) {
             $imgURL = trim($message['imgURL']['large']);
             if ($imgURL == '') {
                 $imgURL = trim($message['imgURL']['medium']);
             }
             if ($imgURL == '') {
                 $imgURL = trim($message['imgURL']['original']);
             }
             if ($imgURL == '') {
                 $imgURL = trim($message['imgURL']['thumb']);
             }
         } elseif (!empty($message['imgURL'])) {
             $imgURL = $message['imgURL'];
         } else {
             $imgURL = '';
         }
         $msg = str_ireplace("%IMG%", $imgURL, $msg);
     }
     if (preg_match('/%IMGLARGE%/', $msg)) {
         $msg = str_ireplace("%IMG%", trim($message['imgURL']['large'], $msg));
     }
     if (preg_match('/%IMGMEDIUM%/', $msg)) {
         $msg = str_ireplace("%IMGMEDIUM%", trim($message['imgURL']['medium'], $msg));
     }
     if (preg_match('/%IMGTHUMB%/', $msg)) {
         $msg = str_ireplace("%IMGTHUMB%", trim($message['imgURL']['thumb'], $msg));
     }
     if (preg_match('/%IMGORIGINAL%/', $msg)) {
         $msg = str_ireplace("%IMGORIGINAL%", trim($message['imgURL']['original'], $msg));
     }
     if (preg_match('/%ORID%/', $msg)) {
         $msg = str_ireplace("%ORID%", $message['orID'], $msg);
     }
     if (preg_match('/%TITLE%/', $msg)) {
         $msg = str_ireplace("%TITLE%", $message['title'], $msg);
     }
     if (preg_match('/%STITLE%/', $msg)) {
         $title = substr($message['title'], 0, 115);
         $msg = str_ireplace("%STITLE%", $title, $msg);
     }
     if (preg_match('/%AUTHORNAME%/', $msg)) {
         $msg = str_ireplace("%AUTHORNAME%", $message['authorName'], $msg);
     }
     if (preg_match('/%SITENAME%/', $msg)) {
         $msg = str_ireplace("%SITENAME%", $message['siteName'], $msg);
     }
     if (preg_match('/%ANNOUNCE%/', $msg)) {
         $sText = trim($message['announce']) != '' ? $message['announce'] : nsTrnc($message['description'], 300, " ", "...");
         $msg = str_ireplace("%ANNOUNCE%", $sText, $msg);
     }
     if (preg_match('/%EXCERPT%/', $msg)) {
         $sText = trim($message['announce']) != '' ? $message['announce'] : nsTrnc($message['description'], 300, " ", "...");
         $msg = str_ireplace("%EXCERPT%", $sText, $msg);
     }
     if (preg_match('/%RAWEXCERPT%/', $msg)) {
         $sText = trim($message['announce']) != '' ? $message['announce'] : nsTrnc($message['description'], 300, " ", "...");
         $msg = str_ireplace("%RAWEXCERPT%", $sText, $msg);
     }
     if (preg_match('/%TEXT%/', $msg)) {
         $msg = str_ireplace("%TEXT%", $message['description'], $msg);
     }
     if (preg_match('/%FULLTEXT%/', $msg)) {
         $msg = str_ireplace("%FULLTEXT%", $message['description'], $msg);
     }
     if (preg_match('/%RAWTEXT%/', $msg)) {
         $msg = str_ireplace("%RAWTEXT%", $message['description'], $msg);
     }
     if (preg_match('/%TAGS%/', $msg)) {
         $tags = nxs_doProcessTags($message['tags']);
         $msg = str_ireplace("%TAGS%", $tags['tags'], $msg);
     }
     if (preg_match('/%HTAGS%/', $msg)) {
         $tags = nxs_doProcessTags($message['tags']);
         $msg = str_ireplace("%HTAGS%", $tags['htags'], $msg);
     }
     if (preg_match('/%CATS%/', $msg)) {
         $tags = nxs_doProcessTags($message['cats']);
         $msg = str_ireplace("%CATS%", $tags['cats'], $msg);
     }
     if (preg_match('/%HCATS%/', $msg)) {
         $tags = nxs_doProcessTags($message['hcats']);
         $msg = str_ireplace("%HCATS%", $tags['hcats'], $msg);
     }
     if (preg_match('/%+CF-[a-zA-Z0-9-_]+%/', $msg)) {
         $msgA = explode('%CF', $msg);
         $mout = '';
         foreach ($msgA as $mms) {
             if (substr($mms, 0, 1) == '-' && stripos($mms, '%') !== false) {
                 $mGr = CutFromTo($mms, '-', '%');
                 $cfItem = $message[$mGr];
                 $mms = str_ireplace("-" . $mGr . "%", $cfItem, $mms);
             }
             $mout .= $mms;
         }
         $msg = $mout;
     }
     return trim($msg);
 }
 function nsFormatMessage($msg, $postID, $addURLParams = '', $lng = '')
 {
     global $ShownAds, $plgn_NS_SNAutoPoster, $nxs_urlLen;
     $post = get_post($postID);
     $options = $plgn_NS_SNAutoPoster->nxs_options;
     if (!empty($options['brokenCntFilters'])) {
         $msg = str_replace('%FULLTITLE%', '%TITLE%', $msg);
         $msg = str_replace('%PANNOUNCE%', '%ANNOUNCE%', $msg);
         $msg = str_replace('%PANNOUNCER%', '%ANNOUNCER%', $msg);
         $msg = str_replace('%EXCERPT%', '%RAWEXCERPT%', $msg);
         $msg = str_replace('%FULLTEXT%', '%RAWTEXT%', $msg);
     }
     if (!empty($options['nxsHTSpace'])) {
         $htS = $options['nxsHTSpace'];
     } else {
         $htS = '';
     }
     if (!empty($options['nxsHTSepar'])) {
         $htSep = $options['nxsHTSepar'];
     } else {
         $htSep = ', ';
     }
     $htSep = str_replace('_', ' ', $htSep);
     $htSep = str_replace('c', ',', $htSep);
     // if ($addURLParams=='' && $options['addURLParams']!='') $addURLParams = $options['addURLParams'];
     $msg = str_replace('%TEXT%', '%EXCERPT%', $msg);
     $msg = str_replace('%RAWEXTEXT%', '%RAWEXCERPT%', $msg);
     $msg = stripcslashes($msg);
     if (isset($ShownAds)) {
         $ShownAdsL = $ShownAds;
     }
     // $msg = htmlspecialchars(stripcslashes($msg));
     $msg = nxs_doSpin($msg);
     if (preg_match('/%URL%/', $msg)) {
         $url = get_permalink($postID);
         if ($addURLParams != '') {
             $url .= (strpos($url, '?') !== false ? '&' : '?') . $addURLParams;
         }
         $nxs_urlLen = nxs_strLen($url);
         $msg = str_ireplace("%URL%", $url, $msg);
     }
     if (preg_match('/%MYURL%/', $msg)) {
         $url = get_post_meta($postID, 'snap_MYURL', true);
         if ($addURLParams != '') {
             $url .= (strpos($url, '?') !== false ? '&' : '?') . $addURLParams;
         }
         $nxs_urlLen = nxs_strLen($url);
         $msg = str_ireplace("%MYURL%", $url, $msg);
     }
     // prr($msg);
     if (preg_match('/%SURL%/', $msg)) {
         $url = get_permalink($postID);
         if ($addURLParams != '') {
             $url .= (strpos($url, '?') !== false ? '&' : '?') . $addURLParams;
         }
         $url = nxs_mkShortURL($url, $postID);
         $nxs_urlLen = nxs_strLen($url);
         $msg = str_ireplace("%SURL%", $url, $msg);
     }
     if (preg_match('/%ORID%/', $msg)) {
         $msg = str_ireplace("%ORID%", $postID, $msg);
     }
     if (preg_match('/%IMG%/', $msg)) {
         $imgURL = nxs_getPostImage($postID);
         $msg = str_ireplace("%IMG%", $imgURL, $msg);
     }
     if (preg_match('/%TITLE%/', $msg)) {
         $title = nxs_doQTrans($post->post_title, $lng);
         $msg = str_ireplace("%TITLE%", $title, $msg);
     }
     if (preg_match('/%FULLTITLE%/', $msg)) {
         $title = apply_filters('the_title', nxs_doQTrans($post->post_title, $lng));
         $msg = str_ireplace("%FULLTITLE%", $title, $msg);
     }
     if (preg_match('/%STITLE%/', $msg)) {
         $title = nxs_doQTrans($post->post_title, $lng);
         $title = substr($title, 0, 115);
         $msg = str_ireplace("%STITLE%", $title, $msg);
     }
     if (preg_match('/%AUTHORNAME%/', $msg)) {
         $aun = $post->post_author;
         $aun = get_the_author_meta('display_name', $aun);
         $msg = str_ireplace("%AUTHORNAME%", $aun, $msg);
     }
     if (preg_match('/%AUTHORTWNAME%/', $msg)) {
         $aun = $post->post_author;
         $aun = get_the_author_meta('twitter', $aun);
         $msg = str_ireplace("%AUTHORTWNAME%", $aun, $msg);
     }
     if (preg_match('/%ANNOUNCE%/', $msg)) {
         $postContent = nxs_doQTrans($post->post_content, $lng);
         $postContent = strip_tags(strip_shortcodes(str_ireplace('<!--more-->', '#####!--more--!#####', str_ireplace("&lt;!--more--&gt;", '<!--more-->', $postContent))));
         if (stripos($postContent, '#####!--more--!#####') !== false) {
             $postContentEx = explode('#####!--more--!#####', $postContent);
             $postContent = $postContentEx[0];
         } else {
             $postContent = nsTrnc($postContent, $options['anounTagLimit'], ' ', '');
         }
         $msg = str_ireplace("%ANNOUNCE%", $postContent, $msg);
     }
     if (preg_match('/%PANNOUNCE%/', $msg)) {
         $postContent = apply_filters('the_content', nxs_doQTrans($post->post_content, $lng));
         $postContent = strip_tags(strip_shortcodes(str_ireplace('<!--more-->', '#####!--more--!#####', str_ireplace("&lt;!--more--&gt;", '<!--more-->', $postContent))));
         if (stripos($postContent, '#####!--more--!#####') !== false) {
             $postContentEx = explode('#####!--more--!#####', $postContent);
             $postContent = $postContentEx[0];
         } else {
             $postContent = nsTrnc($postContent, $options['anounTagLimit'], ' ', '');
         }
         $msg = str_ireplace("%PANNOUNCE%", $postContent, $msg);
     }
     if (preg_match('/%ANNOUNCER%/', $msg)) {
         $postContent = nxs_doQTrans($post->post_content, $lng);
         $postContent = strip_tags(strip_shortcodes(str_ireplace('<!--more-->', '#####!--more--!#####', str_ireplace("&lt;!--more--&gt;", '<!--more-->', $postContent))));
         if (stripos($postContent, '#####!--more--!#####') !== false) {
             $postContentEx = explode('#####!--more--!#####', $postContent);
             $postContent = $postContentEx[1];
         } else {
             $postContent = str_replace(nsTrnc($postContent, $options['anounTagLimit'], ' ', ''), '', $postContent);
         }
         $msg = str_ireplace("%ANNOUNCER%", $postContent, $msg);
     }
     if (preg_match('/%PANNOUNCER%/', $msg)) {
         $postContent = apply_filters('the_content', nxs_doQTrans($post->post_content, $lng));
         $postContent = strip_tags(strip_shortcodes(str_ireplace('<!--more-->', '#####!--more--!#####', str_ireplace("&lt;!--more--&gt;", '<!--more-->', $postContent))));
         if (stripos($postContent, '#####!--more--!#####') !== false) {
             $postContentEx = explode('#####!--more--!#####', $postContent);
             $postContent = $postContentEx[1];
         } else {
             $postContent = str_replace(nsTrnc($postContent, $options['anounTagLimit'], ' ', ''), '', $postContent);
         }
         $msg = str_ireplace("%PANNOUNCER%", $postContent, $msg);
     }
     if (preg_match('/%EXCERPT%/', $msg)) {
         if ($post->post_excerpt != "") {
             $excerpt = strip_tags(strip_shortcodes(apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng))));
         } else {
             $excerpt = nsTrnc(strip_tags(strip_shortcodes(apply_filters('the_content', nxs_doQTrans($post->post_content, $lng)))), 300, " ", "...");
         }
         $msg = str_ireplace("%EXCERPT%", $excerpt, $msg);
     }
     if (preg_match('/%RAWEXCERPT%/', $msg)) {
         if ($post->post_excerpt != "") {
             $excerpt = strip_tags(strip_shortcodes(nxs_doQTrans($post->post_excerpt, $lng)));
         } else {
             $excerpt = nsTrnc(strip_tags(strip_shortcodes(nxs_doQTrans($post->post_content, $lng))), 300, " ", "...");
         }
         $msg = str_ireplace("%RAWEXCERPT%", $excerpt, $msg);
     }
     if (preg_match('/%RAWEXCERPTHTML%/', $msg)) {
         if ($post->post_excerpt != "") {
             $excerpt = strip_shortcodes(nxs_doQTrans($post->post_excerpt, $lng));
         } else {
             $excerpt = nsTrnc(strip_tags(strip_shortcodes(nxs_doQTrans($post->post_content, $lng))), 300, " ", "...");
         }
         $msg = str_ireplace("%RAWEXCERPTHTML%", $excerpt, $msg);
     }
     if (preg_match('/%TAGS%/', $msg)) {
         $t = wp_get_object_terms($postID, 'product_tag');
         if (empty($t) || is_wp_error($pt) || !is_array($t)) {
             $t = wp_get_post_tags($postID);
         }
         $tggs = array();
         foreach ($t as $tagA) {
             $tggs[] = $tagA->name;
         }
         $tags = implode(', ', $tggs);
         $msg = str_ireplace("%TAGS%", $tags, $msg);
     }
     if (preg_match('/%CATS%/', $msg)) {
         $t = wp_get_post_categories($postID);
         $cats = array();
         foreach ($t as $c) {
             $cat = get_category($c);
             $cats[] = str_ireplace('&', '&amp;', $cat->name);
         }
         $ctts = implode(', ', $cats);
         $msg = str_ireplace("%CATS%", $ctts, $msg);
     }
     if (preg_match('/%HCATS%/', $msg)) {
         $t = wp_get_post_categories($postID);
         $cats = array();
         foreach ($t as $c) {
             $cat = get_category($c);
             $cats[] = "#" . trim(str_replace(' ', $htS, str_replace('  ', ' ', trim(str_ireplace('&', '', str_ireplace('&amp;', '', $cat->name))))));
         }
         $ctts = implode($htSep, $cats);
         $msg = str_ireplace("%HCATS%", $ctts, $msg);
     }
     if (preg_match('/%HTAGS%/', $msg)) {
         $t = wp_get_object_terms($postID, 'product_tag');
         if (empty($t) || is_wp_error($pt) || !is_array($t)) {
             $t = wp_get_post_tags($postID);
         }
         $tggs = array();
         foreach ($t as $tagA) {
             $tggs[] = "#" . trim(str_replace(' ', $htS, preg_replace('/[^a-zA-Z0-9\\p{L}\\p{N}\\s]/u', '', trim(nxs_ucwords(str_ireplace('&', '', str_ireplace('&amp;', '', $tagA->name)))))));
         }
         $tags = implode($htSep, $tggs);
         $msg = str_ireplace("%HTAGS%", $tags, $msg);
     }
     if (preg_match('/%+CF-[a-zA-Z0-9-_]+%/', $msg)) {
         $msgA = explode('%CF', $msg);
         $mout = '';
         foreach ($msgA as $mms) {
             if (substr($mms, 0, 1) == '-' && stripos($mms, '%') !== false) {
                 $mGr = CutFromTo($mms, '-', '%');
                 $cfItem = get_post_meta($postID, $mGr, true);
                 $mms = str_ireplace("-" . $mGr . "%", $cfItem, $mms);
             }
             $mout .= $mms;
         }
         $msg = $mout;
     }
     $mm = array();
     if (preg_match_all('/%H?CT-[a-zA-Z0-9_]+%/', $msg, $mm)) {
         $msgA = explode('%CT', str_ireplace("%HCT", "%CT", $msg));
         $mout = '';
         $i = 0;
         foreach ($msgA as $mms) {
             if (substr($mms, 0, 1) == '-' && stripos($mms, '%') !== false) {
                 $h = strpos($mm[0][$i], '%HCT-') !== false;
                 $i++;
                 $mGr = CutFromTo($mms, '-', '%');
                 $cfItem = wp_get_post_terms($postID, $mGr, array("fields" => "names"));
                 if (is_nxs_error($cfItem)) {
                     nxs_addToLogN('E', 'Error', 'MSG', '-=ERROR=- ' . $mGr . '|' . print_r($cfItem, true), '');
                     $mms = str_ireplace("-" . $mGr . "%", '', $mms);
                 } else {
                     $tggs = array();
                     foreach ($cfItem as $frmTag) {
                         if ($h) {
                             $frmTag = trim(str_replace(' ', $htS, preg_replace('/[^a-zA-Z0-9\\p{L}\\p{N}\\s]/u', '', trim(nxs_ucwords(str_ireplace('&', '', str_ireplace('&amp;', '', $frmTag)))))));
                         }
                         $tggs[] = ($h ? '#' : '') . $frmTag;
                     }
                     $cfItem = implode(' ', $tggs);
                     $mms = str_ireplace("-" . $mGr . "%", $cfItem, $mms);
                 }
             }
             $mout .= $mms;
         }
         $msg = $mout;
     }
     if (preg_match('/%FULLTEXT%/', $msg)) {
         $postContent = apply_filters('the_content', nxs_doQTrans($post->post_content, $lng));
         $msg = str_ireplace("%FULLTEXT%", $postContent, $msg);
     }
     if (preg_match('/%RAWTEXT%/', $msg)) {
         $postContent = nxs_doQTrans($post->post_content, $lng);
         $msg = str_ireplace("%RAWTEXT%", $postContent, $msg);
     }
     if (preg_match('/%SITENAME%/', $msg)) {
         $siteTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
         $msg = str_ireplace("%SITENAME%", $siteTitle, $msg);
     }
     if (isset($ShownAds)) {
         $ShownAds = $ShownAdsL;
     }
     // FIX for the quick-adsense plugin
     return trim($msg);
 }
Example #3
0
 function nsFormatMessage($msg, $postID, $addURLParams = '')
 {
     global $ShownAds, $plgn_NS_SNAutoPoster, $nxs_urlLen;
     $post = get_post($postID);
     $options = $plgn_NS_SNAutoPoster->nxs_options;
     // if ($addURLParams=='' && $options['addURLParams']!='') $addURLParams = $options['addURLParams'];
     $msg = stripcslashes($msg);
     if (isset($ShownAds)) {
         $ShownAdsL = $ShownAds;
     }
     // $msg = htmlspecialchars(stripcslashes($msg));
     $msg = nxs_doSpin($msg);
     if (preg_match('%URL%', $msg)) {
         $url = get_permalink($postID);
         if ($addURLParams != '') {
             $url .= (strpos($url, '?') !== false ? '&' : '?') . $addURLParams;
         }
         $nxs_urlLen = nxs_strLen($url);
         $msg = str_ireplace("%URL%", $url, $msg);
     }
     if (preg_match('%SURL%', $msg)) {
         $url = get_permalink($postID);
         if ($addURLParams != '') {
             $url .= (strpos($url, '?') !== false ? '&' : '?') . $addURLParams;
         }
         $url = nxs_mkShortURL($url, $postID);
         $nxs_urlLen = nxs_strLen($url);
         $msg = str_ireplace("%SURL%", $url, $msg);
     }
     if (preg_match('%IMG%', $msg)) {
         $imgURL = nxs_getPostImage($postID);
         $msg = str_ireplace("%IMG%", $imgURL, $msg);
     }
     if (preg_match('%TITLE%', $msg)) {
         $title = nxs_doQTrans($post->post_title, $lng);
         $msg = str_ireplace("%TITLE%", $title, $msg);
     }
     if (preg_match('%STITLE%', $msg)) {
         $title = nxs_doQTrans($post->post_title, $lng);
         $title = substr($title, 0, 115);
         $msg = str_ireplace("%STITLE%", $title, $msg);
     }
     if (preg_match('%AUTHORNAME%', $msg)) {
         $aun = $post->post_author;
         $aun = get_the_author_meta('display_name', $aun);
         $msg = str_ireplace("%AUTHORNAME%", $aun, $msg);
     }
     if (preg_match('%ANNOUNCE%', $msg)) {
         $postContent = nxs_doQTrans($post->post_content, $lng);
         if (stripos($postContent, '<!--more-->') !== false) {
             $postContentEx = explode('<!--more-->', $postContent);
             $postContent = $postContentEx[0];
         } elseif (stripos($postContent, '&lt;!--more--&gt;') !== false) {
             $postContentEx = explode('&lt;!--more--&gt;', $postContent);
             $postContent = $postContentEx[0];
         } else {
             $postContent = nsTrnc($postContent, $options['anounTagLimit']);
         }
         $msg = str_ireplace("%ANNOUNCE%", $postContent, $msg);
     }
     if (preg_match('%TEXT%', $msg)) {
         if ($post->post_excerpt != "") {
             $excerpt = apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng));
         } else {
             $excerpt = apply_filters('the_content', nxs_doQTrans($post->post_content, $lng));
         }
         $excerpt = nsTrnc(strip_tags(strip_shortcodes($excerpt)), 300, " ", "...");
         $msg = str_ireplace("%TEXT%", $excerpt, $msg);
     }
     if (preg_match('%EXCERPT%', $msg)) {
         if ($post->post_excerpt != "") {
             $excerpt = apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng));
         } else {
             $excerpt = apply_filters('the_content', nxs_doQTrans($post->post_content, $lng));
         }
         $excerpt = nsTrnc(strip_tags(strip_shortcodes($excerpt)), 300, " ", "...");
         $msg = str_ireplace("%EXCERPT%", $excerpt, $msg);
     }
     if (preg_match('%RAWEXTEXT%', $msg)) {
         if ($post->post_excerpt != "") {
             $excerpt = nxs_doQTrans($post->post_excerpt, $lng);
         } else {
             $excerpt = nxs_doQTrans($post->post_content, $lng);
         }
         $excerpt = nsTrnc(strip_tags(strip_shortcodes($excerpt)), 300, " ", "...");
         $msg = str_ireplace("%RAWEXTEXT%", $excerpt, $msg);
     }
     if (preg_match('%RAWEXCERPT%', $msg)) {
         if ($post->post_excerpt != "") {
             $excerpt = nxs_doQTrans($post->post_excerpt, $lng);
         } else {
             $excerpt = nxs_doQTrans($post->post_content, $lng);
         }
         $excerpt = nsTrnc(strip_tags(strip_shortcodes($excerpt)), 300, " ", "...");
         $msg = str_ireplace("%RAWEXCERPT%", $excerpt, $msg);
     }
     if (preg_match('%TAGS%', $msg)) {
         $t = wp_get_object_terms($postID, 'product_tag');
         if (empty($t) || is_wp_error($pt) || !is_array($t)) {
             $t = wp_get_post_tags($postID);
         }
         $tggs = array();
         foreach ($t as $tagA) {
             $tggs[] = $tagA->name;
         }
         $tags = implode(', ', $tggs);
         $msg = str_ireplace("%TAGS%", $tags, $msg);
     }
     if (preg_match('%CATS%', $msg)) {
         $t = wp_get_post_categories($postID);
         $cats = array();
         foreach ($t as $c) {
             $cat = get_category($c);
             $cats[] = str_ireplace('&', '&amp;', $cat->name);
         }
         $ctts = implode(', ', $cats);
         $msg = str_ireplace("%CATS%", $ctts, $msg);
     }
     if (preg_match('%HCATS%', $msg)) {
         $t = wp_get_post_categories($postID);
         $cats = array();
         foreach ($t as $c) {
             $cat = get_category($c);
             $cats[] = "#" . trim(str_replace(' ', '', str_replace('  ', '', trim(str_ireplace('&', '', str_ireplace('&amp;', '', $cat->name))))));
         }
         $ctts = implode(', ', $cats);
         $msg = str_ireplace("%HCATS%", $ctts, $msg);
     }
     if (preg_match('%HTAGS%', $msg)) {
         $t = wp_get_object_terms($postID, 'product_tag');
         if (empty($t) || is_wp_error($pt) || !is_array($t)) {
             $t = wp_get_post_tags($postID);
         }
         $tggs = array();
         foreach ($t as $tagA) {
             $tggs[] = "#" . trim(str_replace(' ', '', preg_replace('/[^a-zA-Z0-9\\p{L}\\p{N}\\s]/u', '', trim(ucwords(str_ireplace('&', '', str_ireplace('&amp;', '', $tagA->name)))))));
         }
         $tags = implode(', ', $tggs);
         $msg = str_ireplace("%HTAGS%", $tags, $msg);
     }
     if (preg_match('%CF-[a-zA-Z0-9]%', $msg)) {
         $msgA = explode('%CF', $msg);
         $mout = '';
         foreach ($msgA as $mms) {
             if (substr($mms, 0, 1) == '-' && stripos($mms, '%') !== false) {
                 $mGr = CutFromTo($mms, '-', '%');
                 $cfItem = get_post_meta($postID, $mGr, true);
                 $mms = str_ireplace("-" . $mGr . "%", $cfItem, $mms);
             }
             $mout .= $mms;
         }
         $msg = $mout;
     }
     if (preg_match('%FULLTEXT%', $msg)) {
         $postContent = apply_filters('the_content', nxs_doQTrans($post->post_content, $lng));
         $msg = str_ireplace("%FULLTEXT%", $postContent, $msg);
     }
     if (preg_match('%RAWTEXT%', $msg)) {
         $postContent = nxs_doQTrans($post->post_content, $lng);
         $msg = str_ireplace("%RAWTEXT%", $postContent, $msg);
     }
     if (preg_match('%SITENAME%', $msg)) {
         $siteTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
         $msg = str_ireplace("%SITENAME%", $siteTitle, $msg);
     }
     if (isset($ShownAds)) {
         $ShownAds = $ShownAdsL;
     }
     // FIX for the quick-adsense plugin
     return trim($msg);
 }