ID; $md5 = md5($share['title']); $flattr_username = isset($options['flattr_username']) ? $options['flattr_username'] : ''; $flattr_tags = isset($options['flattr_tags']) ? $options['flattr_tags'] : ''; $flattr_cat = isset($options['flattr_cat']) ? $options['flattr_cat'] : 'text'; $flattr_lang = isset($options['flattr_lang']) ? $options['flattr_lang'] : 'en_GB'; $flattr_url = ""; $url = $share['url']; $tagsA = get_the_tags($post->ID); $tags = ""; if (!empty($tagsA)) { foreach ($tagsA as $tag) { if (strlen($tags)>0){ $tags .=","; } $tags .= $tag->name; } } if ($flattr_tags != '') { $tags .= ",".$flattr_tags; } $tags = trim($tags, ', '); $content = preg_replace(array('/\/i',"/\n/","/\r/", "/ +/"), " ", self::getExcerpt($post)); $content = strip_tags($content); if (strlen(trim($content)) == 0) { $content = "(no content provided...)"; } $title = strip_tags($share['title']); $hidden = "0"; $flattr_domain = 'flattr.com'; $location = "https://" . $flattr_domain . "/submit/auto?user_id=".urlencode($flattr_username). "&url=".urlencode($url). "&title=".urlencode($title). "&description=".urlencode($content). "&language=". urlencode($flattr_lang). "&tags=". urlencode($tags). "&hidden=". $hidden. "&category=". urlencode($flattr_cat); return $location; } public static function getExcerpt($post, $excerpt_max_length = 1024) { $excerpt = $post->post_excerpt; if (trim($excerpt) == "") { $excerpt = $post->post_content; } $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = str_replace(']]>', ']]>', $excerpt); // Hacks for various plugins $excerpt = preg_replace('/httpvh:\/\/[^ ]+/', '', $excerpt); // hack for smartyoutube plugin $excerpt = preg_replace('%httpv%', 'http', $excerpt); // hack for youtube lyte plugin // Try to shorten without breaking words if ( strlen($excerpt) > $excerpt_max_length ) { $pos = strpos($excerpt, ' ', $excerpt_max_length); if ($pos !== false) { $excerpt = substr($excerpt, 0, $pos); } } // If excerpt still too long if (strlen($excerpt) > $excerpt_max_length) { $excerpt = substr($excerpt, 0, $excerpt_max_length); } return $excerpt; } } ?>