Currently viewing the tag: "social media"
function ddet_str_replace_once($needle , $replace , $haystack){ // Looks for the first occurence of $needle in $haystack // and replaces it with $replace. $pos = strpos($haystack, $needle); if ($pos === false) { // Nothing found return $haystack; } return substr_replace($haystack, $replace, $pos, strlen($needle)); } function ddet_process($content) { $offset = 0; $stag = '[DDET '; $etag = '[/DDET]'; while (stripos($content, $stag, $offset)) { // string to replace $s = stripos($content, $stag, $offset); $e = stripos($content, $etag, $s) + strlen($etag); // inside data $ds = stripos($content, ']', $s) + 1; $de = $e - strlen($etag); // style tag $ss = $s + strlen($stag); $se = $ds - 1; $sstring = substr($content, $s, $e - $s); $sdesc = substr($content, $ss, $se - $ss); $sdata = substr($content, $ds, $de - $ds); mt_srand((double)microtime()*1000000); $rnum = mt_rand(); $new_string = '' . "\n"; $new_string .= '
'; $new_string .= ''; $sdata = preg_replace('`^
`sim', '', $sdata); $content = ddet_str_replace_once($sstring, $new_string . $sdata . '
', $content); $offset = $s + 1; } return $content; } function ddet_javascript() { echo ' '; } add_action('wp_head', 'ddet_javascript'); add_filter('the_content', 'ddet_process'); ?>
  • RSS
  • Facebook
  • LinkedIn
  • Twitter