Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    This is probably caused by the input sanitization that the TablePress Extension performs.
    To relax this, please edit the file tablepress-shortcode-filter-get-parameter/tablepress-shortcode-filter-get-parameter.php
    In that, change line 23 from

    $filter_term = preg_replace( '#[^a-z0-9 ]#i', '', $filter_term );
    

    to

    $filter_term = preg_replace( '#[^a-z0-9 "]#i', '', $filter_term );
    

    Regards,
    Tobias

    • This reply was modified 7 years, 8 months ago by Tobias B?thge.
    Thread Starter nando4

    (@nando4)

    With the other existing changes, I added a quote so it now looks like:

    $filter_term = preg_replace( ‘#[^a-z0-9 “\-\>\&\|]#i’, ”, $filter_term );

    Still can’t pass a quote through. Any other ideas?

    • This reply was modified 7 years, 8 months ago by nando4.
    • This reply was modified 7 years, 8 months ago by nando4.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ah, we need a second change. In the file tablepress-datatables-auto-filter/tablepress-datatables-auto-filter.php please change line 61 from

    $auto_filter_word = preg_replace( '#[^0-9a-zA-Z\.% +-_]#', '', $js_options['datatables_auto_filter'] );
    

    to

    $auto_filter_word = preg_replace( '#[^0-9a-zA-Z\.% +-_"]#', '', $js_options['datatables_auto_filter'] );
    $auto_filter_word = addslashes( $auto_filter_word );
    

    Regards,
    Tobias

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    regarding your current tries: It seems like you already added other letters there as well? Regardless, the changes in the tablepress-datatables-auto-filter.php should make this work.

    Regards,
    Tobias

    Thread Starter nando4

    (@nando4)

    That works. Nice. Though it now includes ALL quotes in the search.

    Is there a way that the search URL can still have single quotes passed as the non-quoted string to search for? Posted URLs to do this search will otherwise cut off parts of the string if not encapsulated in quotes. I’ve explained this by example below:

    Before this mod

    https://egpu.io/external-gpu-implementations-table/?table_filter=”inch Asus”
    search: inch Asus

    Now

    https://egpu.io/external-gpu-implementations-table/?table_filter=”inch Asus”
    search: “inch Asus”

    https://egpu.io/external-gpu-implementations-table/?table_filter=””inch Asus””
    Search: “”inch Asus””

    • This reply was modified 7 years, 8 months ago by nando4.
    • This reply was modified 7 years, 8 months ago by nando4.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    I don’t understand. The examples in your “Now” section look good to me. The URL parameter is passed directly to the JS search.
    In which example are you hoping for other results and which?

    Regards,
    Tobias

    Thread Starter nando4

    (@nando4)

    I had hoped can revert the functionality such that the quoted URL search string does not appear quoted in the search box. This is how it was prior to the modification. Ie:

    https://egpu.io/external-gpu-implementations-table/?table_filter=“inch Asus”
    search: inch Asus

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ok, so you want the " in the URL, but not in the search field?

    But then why do you add them to the URL? Or do you want the results that "inch Asus" delivers by with inch Asus in the search field?

    Regards,
    Tobias

    Thread Starter nando4

    (@nando4)

    Yes, I’d like “”inch Asus”” in the URL to be stripped the first set of quotes and deliver “inch Asus” in the search box. Can that be done?

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    you could probably add something like

    $auto_filter_word = str_replace( '""', '"', $auto_filter_word );
    

    directly above the

    $auto_filter_word = addslashes( $auto_filter_word );
    

    line, but I still don’t really understand why you want this, but that’s ok ??

    Regards,
    Tobias

    Thread Starter nando4

    (@nando4)

    Is there a way to strip ^” and “$ off the string. Ie: starts with ” and ends with “?

    I merely wish the URL string to be encapsulated by quotes, with only the outer quotes stripped and entered into the search box. If the string is quoted twice such as “”string””, then “string” is passed to the search box. if it’s quote once “string”, then string is passed to the search box.

    For my use “inch Asus” and inch Asus returns different lines. The former matches “inch Asus” anywhere as two side-by-side strings, the latter matches inch or Asus appearing anywhere on the line.

    • This reply was modified 7 years, 8 months ago by nando4.
    Thread Starter nando4

    (@nando4)

    The following change stripped the outer quotes as required:

    $auto_filter_word = preg_replace( ‘#[^0-9a-zA-Z\&\|\.% +-_”]#’, ”, $js_options[‘datatables_auto_filter’] );
    $auto_filter_word = preg_replace( ‘/^”/’, ”, $auto_filter_word );
    $auto_filter_word = preg_replace( ‘/”$/’, ”, $auto_filter_word );

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    great! Yes, that’s a good PHP approach to remove the wrapping quotation marks. Nice find!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Thread Starter nando4

    (@nando4)

    Tobias, thank you for your help. Together we pieced a very good solution. I’ve previously highly rated the TablePress plugin and your support ??

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ??

    Best wishes,
    Tobias

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to pass ” (quote) using table_filter URL string search?’ is closed to new replies.