Support » Plugins » Joel’s Acronym Replacer Problem

  • I am trying to use the option that makes the replacer case sensitive. When I upload the file, I get an error that tells me I have an unexpected $ on line 187, but line 187 doesn’t have a $. Here is the bottom of the file:

    $text = ” $text “;
    foreach($acronym_acronym as $acronym => $description) {

    /* For advanced users, there are several possible regular expressions here….
    * The safest, “default” one is at the top …
    * You (or I) may choose to use one of the others!
    * Pick whichever you want, and make SURE there is only one that isn’t preceded by slashes: //
    */
    // NEW DEFAULT
    // ANOTHER ATTEMPT (v2.8)
    /// $text = preg_replace(“|(?!<[^<>]*?)(?<![?./&])\b$acronym\b(?!:)(?![^<>]*?>)|imsU”,”$acronym” , $text);

    // DEFAULT:
    // OLD DEFAULT: CONSERVATIVE ****************************************************************************************
    /// $text = preg_replace(“|([\s\>])$acronym([\s\<\.,;:\\/\-])|imsU” , “$1$acronym$2” , $text);

    // NEW DEFAULT: MORE DARING *****************************************************************************************
    /// $text = preg_replace(“|([^./?&]\b)$acronym(\b[^:])|imsU” , “$1$acronym$2” , $text);
    //do it twice, in case they used the same acronym in their title and alt tag…
    /// $text = preg_replace(“|(<[A-Za-z]+[^>]*)$acronym([^>]*>)|imsU” , “$1$acronym$2” , $text);
    /// $text = preg_replace(“|(<[A-Za-z]+[^>]*)$acronym([^>]*>)|imsU” , “$1$acronym$2” , $text);
    /// $text = preg_replace(“|(<[A-Za-z]+[^>]*)$acronym([^>]*>)|imsU” , “$1$acronym$2” , $text);

    // SAME AS ABOVE, but CASE SENSITIVE ********************************************************************************
    $text = preg_replace(“|([^./]\b)$acronym(\b[^:])|msU” , “$1$acronym$2” , $text);
    $text = preg_replace(“|(<[A-Za-z]* [^>]*)$acronym([^<]*>)|msU” , “$1$acronym$2” , $text);

    // BY REQUEST: if you UNCOMMENT the last commented line here: *******************************************************
    // acronyms wrapped in dollar signs will just be unwrapped: *********************************************
    // So: $AOL$ will become AOL, without the AOL *****************
    // $text = preg_replace(“|[$]$acronym[$]|imsU” , “$acronym” , $text);
    }
    return trim( $text );
    }

    add_filter(‘the_content’, ‘acronyms’, 18);
    add_filter(‘comment_text’, ‘acronyms’, 18);

    ?>

    So, any ideas on how to fix this and have the case sensitive replacer work?

    Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Joel’s Acronym Replacer Problem’ is closed to new replies.