0) ? $inapall['comment_threaded_depth'] : 1; $inap_link_count = array(); add_action('inap_comments','inap_comments'); function inap_comments(){ global $id, $post,$inapall; if ($post->comment_count > 0|| comments_open()){ if ( (is_single() && $inapall['show_comments_single'] == 1) || (is_page() && $inapall['show_comments_page'] == 1 )){ include('inap-comments.php'); }else{ echo "\n".''; } } } add_action('inap_addcomments','inap_addcomments'); function inap_addcomments(){ global $id, $post,$inapall,$user_ID; if($inapall['comment_template'] == 1){ return; } if ( comments_open() ) { if ( (is_single() && $inapall['show_addcomments_single'] == 1) || (is_page() && $inapall['show_addcomments_page'] == 1 )){ echo "\n".'
'; include('inap-add-comments.php'); echo '
'; }else{ echo "\n".''; } } } add_action('inap_addcomments_link','inap_addcomments_link'); function inap_addcomments_link($extra=''){ global $id,$inapall,$inap_link_count; global $is_page, $is_single; if(!$inap_link_count[$id] && $extra){ $inap_link_count[$id] = 10; }elseif(!$inap_link_count[$id]){ $inap_link_count[$id] = 1; } if($inapall['comment_template'] == 1){ return; } if($extra==''){ if ($inapall['addcomment_open'] != ''){ $addcomment_open = inap_get_text($inapall['addcomment_open']); } if ($inapall['addcomment_hide'] != ''){ $addcomment_hide = inap_get_text($inapall['addcomment_hide']); } }else{ if ($inapall['addcomment_reply_open'] != ''){ $addcomment_open = inap_get_text($inapall['addcomment_reply_open'],'comment'); } if ($inapall['addcomment_reply_hide'] != ''){ $addcomment_hide = inap_get_text($inapall['addcomment_reply_hide'],'comment'); } } if( !$addcomment_open ) $addcomment_open='Add Comments'; if( !$addcomment_hide ) $addcomment_hide='Hide Comments'; $show2 = $addcomment_open; $show = $addcomment_open; if ( ($is_single && $inapall['show_addcomments_single'] == 1) || ($is_page && $inapall['show_addcomments_page'] == 1 )){ $show2 = $addcomment_hide; } if ( comments_open() ) { echo "\n".''.$show.''; }else{ echo ';\'); return false;" rel="nofollow">'.$show2.''; } $inap_link_count[$id]++; }else{ if($inapall['closed_comments'] == ''){ _e('Comments are closed','inap'); }else{ echo inap_get_text($inapall['closed_comments']); } } } add_action('inap_comments_link','inap_comments_link'); function inap_comments_link($comment_open='Show Posts Comments', $comment_hide='Hide Post Comments'){ global $id,$post,$inapall; // basically we are going to do what we did in s_inap_post all over again. if ($inapall['comment_open'] != ''){ $comment_open = inap_get_text($inapall['comment_open']); } if ($inapall['comment_hide'] != ''){ $comment_hide = inap_get_text($inapall['comment_hide']); } if( !$comment_open ) $comment_open='Show Posts Comments'; $show = $comment_open; // this is the most cheating way to do it, but it makes it Soooo easy. if ( (is_single() && $inapall['show_comments_single'] == 1) || (is_page() && $inapall['show_comments_single'] == 1 )){ $show = $comment_hide; } if ($post->comment_count == 0 && comments_open() && $inapall['comment_template'] != 1){ echo "\n".''; if($inapall['no_comments'] == ''){ _e('No Comments','inap'); }else{ echo inap_get_text($inapall['no_comments']); } echo ' '; echo "\n".' '; }elseif($post->comment_count == 0&& !comments_open()){ if($inapall['no_comments'] == ''){ _e('No Comments','inap'); }else{ echo inap_get_text($inapall['no_comments']); } }else{ echo "\n".''.$show.''; } } add_action('live_preview', 'inap_live_preview'); function inap_live_preview($return=0){ global $inapall,$id; if($inapall['live_preview'] == 1){ if($inapall['live_preview_nocomment']){ $preview .= $inapall['live_preview_before']; $preview .= '
Go ahead and start typing.
'; $preview .= $inapall['live_preview_after']; }else{ $inapall['comment_all_tag'] = ($inapall['comment_all_tag'] != '') ? $inapall['comment_all_tag'] : 'div'; $inapall['comment_tag'] = ($inapall['comment_tag'] != '') ? $inapall['comment_tag'] : 'div'; $inapall['comment_title_tag'] = ($inapall['comment_title_tag'] != '') ? $inapall['comment_title_tag'] : 'span'; $inapall['comment_body_tag'] = ($inapall['comment_body_tag'] != '') ? $inapall['comment_body_tag'] : 'div'; $preview .= '<'.$inapall['comment_all_tag'].'>'; $preview .= '<'.$inapall['comment_tag'].'>'; $preview .= '<'.$inapall['comment_title_tag'].' class="commentbar ">'; $preview .= __('You will post the following soon ','inap'); // myavatars(); $preview .= ''; $preview .= '<'.$inapall['comment_body_tag'].' id="add_comment_live_preview_'.$id.'">Go ahead and start typing.'; $preview .= ''; $preview .= ''; } if($return == 1){ return $preview; }else{ echo $preview; } } } if($inapall['simple_comments'] == 1){ add_filter('comments_template','inap_comment_filter',1); } function inap_comment_filter($i){ global $id, $post,$inapall; return(ABSPATH . 'wp-content/plugins/inap/inap-comments.php'); } add_action('comment_post','inap_comment_parent'); function inap_comment_parent($id) { global $wpdb; $comment_parent = $_POST['comment_post_parent']; if(is_numeric($parent) && $comment_parent) { $result = $wpdb->query("UPDATE $wpdb->comments SET comment_parent = '$comment_parent' WHERE comment_ID = '$id'"); } } function inap_thread_comments( $comment_parent_id=0,$depth=0 ) { global $wp_query, $post, $wpdb, $id, $comment,$comments,$inapall; $parent = "AND comment_parent='$comment_parent_id'"; if($comment_parent_id && !is_numeric($comment_parent_id)){ $parent = $comment_parent_id = ''; } if(!$comment_parent_id){ $order = $inapall['comment_order']; } $comments[$comment_parent_id+1] = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' $parent ORDER BY comment_date $order"); if(count($comments[$comment_parent_id+1]) >0){ if($depth == $inapall['comment_threaded_depth']){$depth = -2;}elseif($depth < $inapall['comment_threaded_depth'] && $depth > -1 ){$depth++;}else{$depth = -1;} inap_comment_print($comment_parent_id+1,$depth); } } ?>