Forums

[resolved] [Plugin: ProjectManager] Apostrophes get escaped repeatedly (7 posts)

  1. randyhoyt
    Member
    Posted 2 years ago #

    When I use an apostrophe in a field, the code escapes them with a backslash:

    This plugin's awesome!

    becomes

    This plugin\'s awesome!

    When I edit the content again, though, the backslashes appears. If I change something else and hit save, it becomes:

    This plugin\\\'s awesome

    And this keeps happening indefinitely.

    When the content is loaded on the page, the backslashes should be removed.

    http://wordpress.org/extend/plugins/projectmanager/

  2. Kolja
    Member
    Posted 2 years ago #

    Will check it. Does this problem only occur when using AJAX editing or also normal adding/editing of datasets?

  3. randyhoyt
    Member
    Posted 2 years ago #

    It happens when I add a new dataset and when I edit an existing dataset using the normal editor.

    I just tried it using the AJAX editor, and it actually has a different problem. It adds the backslash but then cuts off everything after that. So this ...

    This plugin's awesome!

    ... becomes ...

    This plugin

  4. randyhoyt
    Member
    Posted 2 years ago #

    I took a stab at fixing this myself. It seems to work fine but -- since I'm not a PHP programmer or anything -- it may break something else.

    ----

    In dataset-form.php, I changed two lines to use HTML encoding for single and double quote marks. (The issue here seems to be that a quote mark in the field gets treated like the end of the attribute in HTML.)

    5. ... $name ...

    5. ... str_replace("\"", """, str_replace("\'", "'", $name)) ...

    and

    26. [blank]

    26. <?php $meta_data[$form_field->id] = str_replace("\"", "&quot;", str_replace("\'", "'", $meta_data[$form_field->id])); ?>

    ----

    I changed quite a few lines in admin.php, wrapping attributes in the stripslashes function to remove the unwanted backslashes.

    510. ... name ...

    510. ... stripslashes($name) ...

    and

    525. $meta_value

    525. stripslashes($meta_value)

    and

    584. [same as 525]

    and

    586. [same as 525]

    ----

    (@koelle, I will email my modified files to you directly. I started from ProjectManager 2.1.)

  5. randyhoyt
    Member
    Posted 2 years ago #

    ProjectManager 2.2 takes care of this. Thanks!

  6. bestillknowgod
    Member
    Posted 2 years ago #

    Randy,

    I'm having the same problem with backslashes appearing before apostrophes.

    I didn't quite follow your fix above. Is the text in each box the code you placed in each line?

    Thanks,

    Robert

  7. randyhoyt
    Member
    Posted 2 years ago #

    The first box for each line number listed the original code, while the second box for each line number listed the change.

    However, I don't think these changes are necessary any more. The latest version of the plugin addresses this. What version are you running?

Topic Closed

This topic has been closed to new replies.

About this Topic