Admin panel is under presentation tab. Author: Aaron Dowden Version: 2.1a Author URI: http://anthologyoi.com/ */ // new ajax('$home/wp-content/plugins/inap/get_info.php', {postBody: 'id='+id+'&type='+type, update: $('post_'+type+'_'+id), onComplete: show_it(id,type)}); '', ,new ajax('$home/wp-content/plugins/inap/get_info.php', {postBody: 'type='+type+string+'&comment='+document.getElementById('comment').value+'&comment_post_ID='+id, update: $('submit_form_'+id), onComplete: nap(id, 550)}); add_action('wp_head', 'inap_header'); $use_options = get_option('inap_use_options'); $inapall = array(); if($use_options || strpos($_SERVER['PHP_SELF'], 'wp-admin')){ $inapall = get_option('inap'); } function inap_header(){ global $inapall;global $wp_version; $home = get_settings('siteurl'); if($wp_version == 2.1){ if($inapall['use_prototype'] == 1 || $inapall['use_scriptaculous'] == 1){$ajax = 'prototype';}else{$ajax='sack';} if($inapall['use_scriptaculous'] == 1){wp_print_scripts('scriptaculous-effects');} wp_register_script('inap-misc', '/wp-content/plugins/inap/inap-misc.js.php', false, '1'); wp_print_scripts(array($ajax, 'inap-misc')); }else{ if($inapall['use_prototype'] == 1 && $inapall['use_scriptaculous'] != 1){ $ajax = $inapall['prototype_library_url']; }elseif($inapall['use_scriptaculous'] == 1){ echo ''."\n"; echo ''."\n"; echo ''."\n"; }else{ $ajax = '/wp-includes/js/tw-sack.js'; } echo ''."\n"; if($ajax){ echo ''."\n"; } } } function inap_content($link_show_text = 'Continue Reading', $link_hide_text='Hide Post', $stripteaser = 0){ return inap_post($link_show_text, $link_hide_text,1,1,'content'); } function inap_excerpt($link_show_text = 'Continue Reading', $link_hide_text='Hide Post'){ return inap_post($link_show_text, $link_hide_text,3,0,'excerpt',55); } function inap_post_s($args=''){ $args= str_replace('’','\'',$args); $args= str_replace('“','"',$args); $args= str_replace('”','"',$args); parse_str($args,$r); if ($r['link_show_text'] == ''){ $r['link_show_text'] = 'Click to continue reading'; } if ($r['link_hide_text'] == ''){ $r['link_hide_text'] = 'Hide Post'; } if ($r['split_mode'] == ''){ $r['split_mode'] = '0'; } if ($r['show_html'] == ''){ $r['show_html']= '1'; } if ($r['default_behavior'] == ''){ $r['default_behavior'] = 'content'; } if ($r['word_limit'] == ''){ $r['word_limit'] = '121'; } if ($r['line_break'] == ''){ $r['line_break'] = '1'; } if ($r['background_color'] == ''){ $r['background_color'] = '#FFF'; } $r['link_show_text'] = stripslashes(htmlspecialchars($r['link_show_text'], ENT_QUOTES)); $r['link_hide_text'] = stripslashes(htmlspecialchars( $r['link_hide_text'], ENT_QUOTES)); return inap_post($r['link_show_text'], $r['link_hide_text'], $r['split_mode'], $r['show_html'], $r['default_behavior'],$r['word_limit'], $r['line_break'],$r['background_color']); } function inap_get_text($link_text){ // This nasty function is to allow you to use the_title etc inside the admin panel. global $id, $post; $link_text = stripslashes($link_text); preg_match_all('/([a-zA-Z]*_.*?\(.*?\))/',$link_text,$matches); foreach($matches[0] as $match){ $string[] = $match; eval('$replacement[] = '.$match.';'); } $link_text = str_replace($string, $replacement,$link_text ); //We do this otherwise it will double encode things. $link_text= str_replace('’','\'',$link_text); $link_text= str_replace('“','“',$link_text); $link_text= str_replace('”','”',$link_text); return htmlspecialchars($link_text,ENT_QUOTES); } add_action('inap_post','inap_post'); function inap_post($link_show_text='Click to continue reading', $link_hide_text='Hide Post', $split_mode=2, $show_html=1, $default_behavior='content', $word_limit=121, $line_break = 1, $background_color = '#FFF'){ global $use_options,$inapall; global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages; global $preview; global $pagenow; if(!$link_show_text){ $link_show_text='Click to continue reading'; } if($use_options == true){ while (list($key, $value) = each ($inapall)){ if(!empty($value)){ $$key = $value; } } reset($inapall); $link_show_text = inap_get_text($link_show_text); $link_hide_text = inap_get_text($link_hide_text); } if ( !empty($post->post_password) ) { // if there's a password if ( stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) { // and it doesn't match the cookie $output = get_the_password_form(); } } // decide on the content if ($post->post_excerpt != ''){ $output = $post->post_excerpt; }else{ $content = $pages[$page-1]; if($show_html == 0){ $content = strip_tags($content); } if($split_mode == 1){ $content = explode('', $content, 2); $output = $content[0]; }elseif($split_mode == 2){ if(strpos($content,'') !== false){ $content = explode('', $content, 2); $output = $content[0]; }else{ $content = force_balance_tags($content); $content = explode(chr(13), $content, $line_break+1); for($x=0; $x < $line_break; $x++){ $output .= $content[$x]; } $output = force_balance_tags($output); } }else{ $words = explode(' ', $content, $word_limit + 1); if (count($words) > $word_limit) { array_pop($words); array_push($words, '...'); $output = implode(' ', $words); $show_more=1; }else{ $content = force_balance_tags($content); $output=$content; } } } //lets make it look good if ( $preview ){ // preview fix for javascript bug with foreign languages $output =preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output); } if ($default_behavior == 'content'){ $output = apply_filters('the_content', $output.chr(13)); }else{ $output = apply_filters('the_excerpt', $output); } $output = str_replace(']]>', ']]>', $output); if($inapall['use_fade'] == 1){ //this is for IE support only. Everybody BOOOOOOO IE //It's not like they could make it easy for us... $style = "zoom:1; background-color:$background_color;"; } // Start the output. echo '
'.$output.'
'; //if there is more to show then we need an empty div and some links. if ( count($content) > 1 || $show_more == 1) { echo ''; //The following lines are to help make javascript and php play nice. Pick one. //$link_show_text= str_replace("'",'\'',$link_show_text); $link_show_text= str_replace("'",'’',$link_show_text); echo ''.stripslashes($link_show_text).''; } } add_action('inap_comments','inap_comments'); function inap_comments(){ global $id, $post; if ($post->comment_count > 0 || comments_open()){ echo ''; } } add_action('inap_addcomments','inap_addcomments'); function inap_addcomments(){ global $id, $post; if ( comments_open() ) { echo ''; } } add_action('inap_addcomments_link','inap_addcomments_link'); function inap_addcomments_link($addcomment_open= 'Add Comment', $addcomment_hide='Hide Comment Form',$num = ''){ global $id,$use_options,$inapall; if($use_options == true){ // basically we are going to dowhat we did in s_inap_post all over again. if ($inapall['addcomment_open'] != ''){ $addcomment_open = inap_get_text($inapall['addcomment_open']); } if ($inapall['addcomment_hide'] != ''){ $addcomment_hide = inap_get_text($inapall['addcomment_hide']); } } if ( comments_open() ) { echo ''.$addcomment_open.''; }else{ echo 'Comments are closed.'; } } 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,$use_options,$inapall; if($use_options == true){ // basically we are going to dowhat 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 ($post->comment_count == 0 && comments_open()){ echo ''; echo 'No Comments Yet'; echo ' '; echo ''; }elseif($post->comment_count == 0 && !comments_open()){ echo 'No Comments.'; }else{ echo ''.$comment_open.''; } } add_action('admin_menu', 'inap_menu'); function inap_menu() { // Add a submenu to the Dashboard: add_submenu_page('themes.php', 'INAP Managment', 'INAP Managment', 8, __file__, 'inap_manage'); } function inap_manage(){ global $wpdb, $inapall,$use_options; if ($_POST["action"] == "saveconfiguration") { update_option('inap_use_options',$_POST['inap_use_options']); inap_update_options($_REQUEST['inap']); update_option('inap',$inapall); $message .= 'Inap options updated.
'; //if we don't the panel will show old value...which may scare people. //$inap_all doesn't need to be updated because it has the new values added to it immediately $use_options = get_option('inap_use_options'); echo '

Updated
'.$message; echo '

'; } echo '
'; echo '
'; echo ''; if($inapall['comment_template'] == '1'){ $temp1 = 'checked="checked"'; }elseif($inapall['comment_template'] == '2'){ $temp2 = 'checked="checked"'; }else{ $temp = 'checked="checked"'; } if($inapall['default_behavior'] == 'content'){ $sel1 = 'checked="checked"'; }else{ $sel2 = 'checked="checked"'; } if($use_options == '1'){ $uop = 'checked="checked"';} if($inapall['show_html'] == 1){ $sh = 'checked="checked"'; } if($inapall['use_fade'] == 1){ $uf = 'checked="checked"'; } if($inapall['use_prototype'] == 1){ $up = 'checked="checked"'; } if($inapall['use_scriptaculous'] == 1){ $us = 'checked="checked"'; } if($inapall['use_scriptaculous_posts'] == 1){ $usp = 'checked="checked"'; } $inapall['link_show_text'] = stripslashes(htmlspecialchars($inapall['link_show_text'],ENT_QUOTES)); $inapall['link_hide_text'] = stripslashes(htmlspecialchars($inapall['link_hide_text'],ENT_QUOTES)); $inapall['comment_open'] = stripslashes(htmlspecialchars($inapall['comment_open'],ENT_QUOTES)); $inapall['comment_hide'] = stripslashes(htmlspecialchars($inapall['comment_hide'],ENT_QUOTES)); $inapall['addcomment_open'] = stripslashes(htmlspecialchars($inapall['addcomment_open'],ENT_QUOTES)); $inapall['addcomment_hide'] = stripslashes(htmlspecialchars($inapall['addcomment_hide'],ENT_QUOTES)); echo << block; echo '
Edit Inap Configutarion

Post Options

Use Options In INAP? (Check this to use the following settings.):
Show text (for posts):
Hide text (for posts):
What Mode do you want to use to split the preview?:
Show HTML in preview?:
Filter post preview as
What background color in hex (#FFFFFF) format do you want the excerpt and content text to have? (YAIEF)
Maximum number of words:
For split mode 2 how many paragraphs would you like to show?

Comment Options

Show text (for comments) :
Hide text (for comments):
Use comment template

Show text (for add comments):
Hide text (for add comments):

Ajax and Effects Options

Use fade effect on posts (built in adds no extra Javascript)?:
Use prototype.js? (Adds 55KB of javascript slowing loading times, so it is not recommeneded unless other plugins use it):
Use scriptaculous for effects? (Will automatically use prototype.js and adds 88kb of javascript slowing page load times):

Scriptaculous Options (only needed if scriptaculous is checked above)

Scriptaculous show comments/add comments effect:
Scriptaculous hide comments/add comments effect:

Wordpress 2.0.x Options (has no effect on wordpress 2.1)

URL to your scriptaculous (v 1.7) directory (relative to your blog directory [should start with '/wp-includes' or '/wp-content']) (required if scriptaculous is checked):
URL to your prototype.js (v 1.5.0) file (relative to your blog directory [should start with '/wp-includes' or '/wp-content']) (needed if use prototype.js is checked but not scriptaculous effects):
'; // // If using scriptaculous for effects, use effects on post content? (turned off incase you want to use the built in fade): // // ?>

Have you found this Plugin useful?
This project is over 35,000 characters long (plus 15,000 in the documentation), and has taken well over 100 hours to code and test THIS version.
If this Plugin has helped you, isn't it worth a little bit of time or money? If you are feeling monetarily generous make a donation.
How much is entirely up to you, but numbers with lots of 0's, a 1 on the left and a decimal point on the right are the best kind. =D

Or if circumstances make a donation impossible, links, refferals and comments are appreciated.

Quick Doc

Now open your index.php (or post.php depending on your theme) in your themes folder. To display posts inline replace the_content or the_excerpt with inap_content or inap_excerpt respectively. These will give you the most basic options and are mirror images of the normal function.

To display comments in-line add <?php do_action('inap_comments'); ?> where you want the comments to appear when they are loaded and add <?php do_action('inap_comments_link'); ?> where you want the show/hide comments link to appear.

To display the add comment box in-line add <?php do_action('inap_addcomments'); ?> where you want the add comment box to appear and add <?php do_action('inap_addcomments_link'); ?> where you want the show/hide add comment box link to appear.

Save the file and upload it to your current theme folder.



Reference
This is not the complete reference, just parts that you may need frequently. Please visit the main INAP page for the latest documentation.

This plugin adds the following tags for the loop (there are multiple ways to do the same thing):
Listed in preferential order.

To show post content:
do_action('inap_post'); <- best if you use the admin panel.
inap_post_s(); <- Accepts string style functions
inap_excerpt();<- Exact duplicate of the_excerpt
inap_content();<- Exact duplicate of the_content
inap_post(); <- Because of the user un-friendliness one of the above is prefered to this one.

To show comment link:
do_action('inap_comments_link');
inap_comments_link();

To show comment content:
do_action('inap_comments');
inap_comments();

To show add comment link:
do_action('inap_addcomments_link');
inap_addcomments_link();

To show add comment box:
do_action('inap_addcomments');
inap_addcomments();

Split Mode:Inap can display the content itself in three ways. Option 1 just splits the post only if there is a <!–more–> tag. Option 2 always splits it after the line break you set (defaults to the first). Option 3 emulates the_excerpt in that it will trim it to a specified number of words. However, if you explicitly add an excerpt to the post it will automatically use that in all cases.

Show HTML:The default is to show the html (1), but if you want html stripped from your previews you can set this to off (0). Srippping HTML may cause some plugins not to work correctly, and may cause display errors.

Should other information be here? Drop me a comment.