• So I edited a plugin and now on the Plugins page in the admin panel, where it should normally show the details about the plugin, it instead shows large pieces of the PHP code.

    Help!?

Viewing 6 replies - 1 through 6 (of 6 total)
  • How did you edited it?
    What machine, OS and editor?

    Thread Starter phoenixd

    (@phoenixd)

    Mac OS X / Smultron / MacBook Pro

    And it shows code from the plugin like:
    ', $after = '', $show_pass_post = false, $comment_style = 0) { global $wpdb; $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, comment_type, post_title FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE post_status IN ('publish','static') "; if(!$show_pass_post) $request .= "AND post_password ='' "; $request .= "AND comment_approved = '1' AND comment_type = '' ORDER BY comment_ID DESC LIMIT $no_comments"; $comments = $wpdb->get_results($request); $output = ''; if ($comments) { foreach ($comments as $comment) { $comment_author = stripslashes($comment->comment_author); if ($comment_author == "") $comment_author = "anonymous"; $comment_content = strip_tags($comment->comment_content); $comment_content = stripslashes($comment_content); $words=split(" ",$comment_content); $comment_excerpt = join(" ",array_slice($words,0,$comment_lenth)); $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; if ($comment_style == 1) { $post_title = stripslashes($comment->post_title); $url = $comment->comment_author_url; if (empty($url)) $output .= $before . $comment_author . ' on ' . $post_title . '.' . $after; else $output .= $before . "$comment_author" . ' on ' . $post_title . '.' . $after; } else { $output .= $before . '' . $comment_author . ': ' . $comment_excerpt.'' . $after; } } $output = convert_smilies($output); } else { $output .= $before . "None found" . $after; } echo $output; } ?>" title="Visit plugin homepage">Recent Comments Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/ Description: Retrieves a list of the most recent comments. Version: 1.18 Author: Nick Momrik Author URI: http://mtdewvirus.com/ */ function mdv_recent_comments($no_comments = 10, $comment_lenth = 5, $before = '', $after = '', $show_pass_post = false, $comment_style = 0) { global $wpdb; $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, comment_type, post_title FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE post_status IN ('publish','static') "; if(!$show_pass_post) $request .= "AND post_password ='' "; $request .= "AND comment_approved = '1' AND comment_type = '' ORDER BY comment_ID DESC LIMIT $no_comments"; $comments = $wpdb->get_results($request); $output = ''; if ($comments) { foreach ($comments as $comment) { $comment_author = stripslashes($comment->comment_author); if ($comment_author == "") $comment_author = "anonymous"; $comment_content = strip_tags($comment->comment_content); $comment_content = stripslashes($comment_content); $words=split(" ",$comment_content); $comment_excerpt = join(" ",array_slice($words,0,$comment_lenth)); $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; if ($comment_style == 1) { $post_title = stripslashes($comment->post_title); $url = $comment->comment_author_url; if (empty($url)) $output .= $before . $comment_author . ' on ' . $post_title . '.' . $after; else $output .= $before . "$comment_author" . ' on ' . $post_title . '.' . $after; } else { $output .= $before . '' . $comment_author . ': ' . $comment_excerpt.'' . $after; } } $output = convert_smilies($output); } else { $output .= $before . "None found" . $after; } echo $output; } ?>

    I know what it shows… no need to post a lot of code.
    It is because of your editor’s settings: it saves the file with wrong line breaks!
    Earlier there were a lof of posts about happening the same with themes.

    Thread Starter phoenixd

    (@phoenixd)

    Sorry about that, just wanted to make sure we were on the same page… So the solution is just to use a more basic editor, making sure it doesn’t keep the line breaks, and voila fixed?

    It should keep the linebreaks – but they need to be Unix, not Mac.

    Check if your editor has such a setting to change from Mac breaks (CR) to Unix (LF).

    Thread Starter phoenixd

    (@phoenixd)

    Fixed it.. Just saved it using WP’s built in editor.. and voila. 🙂 Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Plugins Page Showing Code’ is closed to new replies.