Plugin for limit the size of the post in the main page in WordPress

The  plugin  for WordPress in order to control the maximum amount of characters displayed for an entry on the main page. If the set limit is surpassed a link to a page with the whole content will appear and the text on the entry will be chopped to that amount of characters, otherwise the content will be showed unchanged.

Installation
1 Download the plugin limit-post.phps to the /wp-content/plugins/ directory
2 Change the name from limit-post.phps to limit-post.php
3 Go into the plugin section on the administration site of wordpress and activate it.
4 Go into your index.php file and change the function the_content() with the_content_limit($max_characters, $link_text) where:
$max_characters: maximum amount of characters shown for an entry in the main page (index.php)
$link_text: text that is used to generate the link to the whole article.

A practical case:
Replace the line < ? the_content()?>  in the index.php file with:
< ? the_content_limit(1000, “Read more”);?>

===
limit-post.phps
===
<?php
/*
Plugin Name: Limit Posts
Plugin URI: http://labitacora.net/comunBlog/limit-post.phps
Description: Limits the displayed text length on the index page entries and generates a link to a page to read the full content if its bigger than the selected maximum length.
Usage: the_content_limit($max_charaters, $more_link)
Version: 1.1
Author: Alfonso Sanchez-Paus Diaz y Julian Simon de Castro
Author URI: http://labitacora.net/
License: GPL
Download URL: http://labitacora.net/comunBlog/limit-post.phps
Make:
    In file index.php
    replace the_content()
    with the_content_limit(1000, “more”)
*/

function the_content_limit($max_char, $more_link_text = ‘(more…)’, $stripteaser = 0, $more_file = ”) {
    $content = get_the_content($more_link_text, $stripteaser, $more_file);
    $content = apply_filters(‘the_content’, $content);
    $content = str_replace(‘]]>’, ‘]]&gt;’, $content);

   if (strlen($_GET[‘p’]) > 0) {
      echo $content;
   }
   else if ((strlen($content)>$max_char) && ($espacio = strpos($content, ” “, $max_char ))) {
        $content = substr($content, 0, $espacio);
        $content = $content;
        echo $content;
        echo “<a href='”;
        the_permalink();
        echo “‘>”.”…”.”</a>”;
        echo “<br><br>”;
        echo “<a href='”;
        the_permalink();
        echo “‘>”.$more_link_text.”</a></p>”;
   }
   else {
      echo $content;
   }
}

?>