• Resolved randyhoyt

    (@randyhoyt)


    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.

    https://www.ads-software.com/extend/plugins/projectmanager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Will check it. Does this problem only occur when using AJAX editing or also normal adding/editing of datasets?

    Thread Starter randyhoyt

    (@randyhoyt)

    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

    Thread Starter randyhoyt

    (@randyhoyt)

    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.)

    Thread Starter randyhoyt

    (@randyhoyt)

    ProjectManager 2.2 takes care of this. Thanks!

    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

    Thread Starter randyhoyt

    (@randyhoyt)

    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?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: ProjectManager] Apostrophes get escaped repeatedly’ is closed to new replies.