• sp4rky35

    (@sp4rky35)


    Hi,

    I’m trying to use the customoptions in r34ics_display_calendar_exclude_event (up-to-date version of wordpress and ics extension). So my shortcode looks like [ics_calendar url="https://my/calendar/url" view="list" ajax="true" attach="true" color="#1a6c7a33"? count="30" htmltagdate="h5" ?customoptions="filtercity=true"]

    but when printing json_encode($args) in r34ics_display_calendar_exclude_event callback I only get customoptions=1

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author room34

    (@room34)

    Using customoptions does require custom PHP code to interpret the string, but that said, it should be returning the exact value you passed, not just 1. I’ll investigate and issue an update if there’s an issue.

    Thread Starter sp4rky35

    (@sp4rky35)

    Hi, yes, understand the need of custom php code, already had some code that used to be working until … some of the last months updates ??

    Plugin Author room34

    (@room34)

    So this exact shortcode was working until recent updates, when the output of customoptions changed to just 1? If so, that will help pinpoint the issue.

    Thread Starter sp4rky35

    (@sp4rky35)

    Yes ! The exact shortcode that used to work was :

    if($args["customoptions"][0] === "filtercity=true") {

    Thread Starter sp4rky35

    (@sp4rky35)

    I’ve tried to remove the explode call in class-r34ics.php and get the expected value (not split, obviously). Also, I noticed the curlopts has the same behavior, so definitely something with the call to explode

    Thread Starter sp4rky35

    (@sp4rky35)

    So, it’s ok in r34ics_display_calendar_args but seems broken in all other filters.

    Thread Starter sp4rky35

    (@sp4rky35)

    Finally found the issue. It happens only in ajax mode, bug is in r34ics_display_calendar_args

    // Replaces FILTER_SANITIZE_STRING filter, deprecated in PHP 8.1
    $args[$key] = is_string($value) ? htmlspecialchars(strip_tags($value)) : intval($value);

    After the explode, $args[$key] is an Array, so is_string($value) is evaluated to false, and value is converted to integer.

    Plugin Author room34

    (@room34)

    Ah, thanks for the debugging! I’ll get a fix into the next update.

    Plugin Author room34

    (@room34)

    OK, I have a fix ready. It will probably be a few days before the next official release, but I’ve checked in a beta version you can download and use right now. (This fix is the only change between it and the current release version.)

    ics-calendar.10.14.1.5-beta-1.zip

    Thread Starter sp4rky35

    (@sp4rky35)

    I can confirm it fixes the issue, thank you !

    Plugin Author room34

    (@room34)

    Great, thanks for confirming!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to use customoptions, it only returns count of items ?’ is closed to new replies.