post_content."\n".chr(13)."\n";
$response[] = apply_filters('the_content',$output.'@$%@$$%##$%#$%#$');
$actions[] = '_p[i].show = _d[i].show';
$actions[] = '_p[i].hide = _d[i].hide';
$links = AWP_EmbeddedPost::get_link_texts();
$vars = array();
$vars[show] =$links[show];
$vars[hide] = $links[hide];
AWP::make_response($response, $vars,$actions);
}
function list_pages($content){
return preg_replace_callback('!\<\!\-\-mychildren\-\-\>!ims', array('AWP_EmbeddedPost','embed_pages'), $content);
}
function embed_pages(){
global $id;
//wp_list_pages('sort_column=post_title&child_of='.$id.'&depth=1&title_li=');
$r = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'),
'child_of' => $id, 'exclude' => '', 'title_li' =>'', 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title');
// Query pages.
$pages = get_pages($r);
foreach($pages as $page){
if($page->post_status != 'draft' && $page->post_status !='future'){
$output .= "\n".'
'.apply_filters('the_title', $page->post_title).'
'."\n";
$output .= AWP_EmbeddedPost::embedded_post($page->ID);}
}
return $output;
}
function embedded_post_tag($content){
return preg_replace_callback('!\<\!\-\-embed=([0-9]*)\-\-\>!ims', array('AWP_EmbeddedPost','embedded_post'), $content);
}
function embedded_post($pid){
global $awpall,$awped_posts,$wpdb,$id,$awp_options;
if(!is_array($pid)){
$return = 1;
$pid = $pid;
}elseif(is_array($pid)){
$return = 1;
$pid = $pid[1];
}
if($id != $pid){
$good_post = $wpdb->get_row("SELECT ID, post_author, post_date FROM $wpdb->posts WHERE post_status = 'publish' && ID = '$pid'",ARRAY_A);
if(is_array($good_post)){
$pid = $good_post;
$links = AWP_EmbeddedPost::get_link_texts($pid);
$ops[doit] = "'id': '$pid[ID]', 'type': 'embed'" ;
$ops[_class] = "awppost_link";
$ops[id] = 'awpembed_link_'.$pid[ID];
$ops[anchor] = stripslashes($links[show]);
$ops[URL] = get_permalink($pid[ID]);
$ops = apply_filters('awp_link_array',$ops, 'post');
$add = ''.AWP::links($ops);
if($return){
return $add;
}else{
echo $add;
}
}
}
}
function get_link_texts ($pid=0){
global $aWP, $id;
if($aWP[options]['link_embed_show_text']){
$link_show_text=$aWP[options]['link_embed_show_text'];
}
if($aWP[options]['link_embed_hide_text']){
$link_hide_text=$aWP[options]['link_embed_hide_text'];
}
if(!$link_show_text){
$link_show_text=__('Click to continue reading','awp');
}
if(!$link_hide_text){
$link_hide_text=__('Click to hide post','awp');
}
$links = array();
$link_show_text= str_replace("'",'’',$link_show_text);
$link_hide_text= str_replace("'",'’',$link_hide_text);
$links[show] = AWP::process_text($link_show_text,$pid);
$links[hide] = AWP::process_text($link_hide_text,$pid);
return $links;
}
function admin(){
global $awpall, $aWP;
ob_start();
?>