posts)) $wpdb->posts = $tableposts;
function ap2p_magic($matches) {
global $wpdb;
preg_match_all('/([.\w]*)="(.*)"/U', $matches[1], $attributes);
foreach ((array)$attributes[1] as $key => $value) {
$data[$value] = $attributes[2][$key];
}
if (empty($data)) return '';
$post = get_post($data['postID']);
if (empty($post->post_title)) return '';
foreach ($data as $key => $item) {
if ($key != 'text' && $key != 'title' && $key != 'postID') {
$attrs .= ' '.$key.'="'.$item.'"';
}
}
$title = ($data['title']) ? $data['title'] : $post->post_title;
$text = ($data['text']) ? $data['text'] : $post->post_title;
return ''.$text.'';
}
function ap2p_link($text) {
return preg_replace_callback("/\[p2p ([^]]*)\]/i", "ap2p_magic", $text);
}
function ap2p_links() {
if (strpos($_SERVER['REQUEST_URI'], 'post.php') || strpos($_SERVER['REQUEST_URI'], 'post-new.php')) {
$posts = get_posts('numberposts=-1');
foreach ($posts as $p) {
$js .= '';
}
$js = str_replace("'", "\'", $js);
?>