<channel> <title>' . $strings['rss_title'] . '</title> <link>' . $strings['rss_url'] . '</link> <description>' . $strings['rss_description'] . '</description> <language>ru</language> <lastBuildDate>' . date("r", $lastBuildDate) . '</lastBuildDate> <image> ' . ($logo ? '<url>' . $host . $logo . '</url>' : '') . ' <title>' . $strings['rss_description'] . '</title> <link>' . $host . '</link> </image> '; $sql = "SELECT id, date, name, description, text, CONCAT('archive/news/?id=', id) AS link FROM " . $table . " WHERE visible>0 AND root_id='" . $root_id . "' ORDER BY date DESC"; $result = mysql_query($sql); while ($row = @mysql_fetch_assoc($result)) { $link = replace_symbols($host . $row['link']); $output .= '<item>'; $output .= '<title>' . replace_symbols(strip_tags($row['name'])) . '</title>'; $output .= '<link>' . $link . '</link>'; $output .= '<description>' . replace_symbols(strip_tags($row['description'])) . '</description>'; $output .= '<pubDate>' . date("r", strtotime($row['date'])) . '</pubDate>'; $output .= "<yandex:full-text>" . replace_symbols(strip_tags($row['text'])) . "</yandex:full-text>"; $output .= '</item>'; } $output .= '</channel></rss>'; echo $output; function replace_symbols($value) { $value = str_replace('"', '"', $value); return str_replace(array('&', "\r\n", "<", ">", "'", "\""), array('&', "", "<", ">", "'", """), $value); }
/** * Make a url friendly - a dash-separated string * * @param string $input url to format * @return string|false * * Note: These functions seem to overlap each other a bit... */ function make_url_friendly($input) { $output = replace_symbols($input); $output = mb_substr($output, 0, 240); $output = mb_strtolower($output, "UTF-8"); $output = trim($output); //From Wordpress and http://www.bernzilla.com/item.php?id=1007 $output = sanitize_title_with_dashes($output); $output = urldecode($output); if ($output) { return $output; } else { return false; } }