Viewing 15 replies - 1 through 15 (of 16 total)
  • Thank you! I’ll make sure Marcus knows about this thread and the patch.

    Thread Starter Daedalon

    (@daedalon)

    Glad to hear of your appreciation, Caimin_nwl. Did you have time to try it out? Was everything all right?

    Thank you! I’ll make sure Marcus knows about this thread and the patch.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    thanks

    one thing that bugs me is the locations-search.php file. it includes a lot of repetetive stuff from events-search.php, practically copy/paste minus the actions and a couple of ids/classes, right?

    wondering if we should split each field into a file within a subfolder, so both events and locations reference the same code and remove redundancy….

    Thread Starter Daedalon

    (@daedalon)

    Yes, it’s copy-paste with some quick changes. Eg. added id="em_search" for the text input to be able to reference it with JS in the submit button, and added class em-locations-search-text-default to the input when its value is default (allows to style it gray when default and black when user-selected). Splitting into separate files for shared code is a good idea. Other things worth considering:

    1. Move the JavaScript of the submit button to main .js file.

    2. Add to that file jQuery code that removes or adds the class em-locations-search-text-default for the text input when the value is changed to default or non-default. Might need to be done in a language-specific .js file created in PHP to allow for default text of different languages.

    Or alternatively do it PHP and JS without jQuery straight in the template file. Downside is that this makes one appearance option not adjustable in the same CSS where everything else is:

    <input id="" class="" type="text" onblur="if (this.value == '') {this.value = 'Search...';this.style.color = 'gray';}" onfocus="if (this.value == 'Search...') {this.value = '';this.style.color = '#000';}" value="Search..." style="color:gray" name="" autocomplete="off"></input>

    3. I’m going to update it to reflect points raised in https://www.ads-software.com/support/topic/sanitization-of-em_search-on-events-list as soon as time permits. Will have to do that for events-search.php as well until the syndication of common code is done.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    this is why we need to make it less redundant, so updates to fields are reflected across the two forms.

    will look into this, although probably won’t be for another couple of updates (the search form sanitization will probably be fixed this week, that’s an important one)

    Thread Starter Daedalon

    (@daedalon)

    Important note: For security reasons, the following replacement should be done in locations-search.php. Find this on line 28:

    value="<?php echo $s; ?>"

    and replace it with

    value="<?php echo htmlspecialchars($s,ENT_QUOTES); ?>"

    The same should be done for any instances of events-search.php your installation has, both the one shipped with plugin core and any customized ones.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    actually, you want to use esc_attr()

    Thread Starter Daedalon

    (@daedalon)

    That has been used by default in templates/forms/event-editor.php for a long time, but while we were testing options to avoid double encoding and the encoding of more characters than necessary, we ended away from that for some reason.

    However, https://codex.www.ads-software.com/Function_Reference/esc_attr states “Encodes the <, >, &, ” and ‘ (less than, greater than, ampersand, double quote and single quote) characters. Will never double encode entities.” According to that it does exactly the same as what we use except that it avoids double encoding. Worse for performance, but convenient and more readable.

    Thanks, Marcus!

    Hey all-

    Have been looking for a locations specific search and much to my delight, I found this thread. Unfortunately, the pastebin links are expired. Are there any new pointers to code that works for a locations search?

    Thread Starter Daedalon

    (@daedalon)

    Marcus, isn’t this part of plugin core by now? I remember you having done some changes towards making event search and location search share code.

    Hi Marcus!

    If it IS an offiial patch, could you somehow tell me how to implement it? It’s not obvious to me yet.

    I was getting ready to pass query vars straight into the SQL code and doing my own radius search what not. Still going through the Event Manager tutorial too….

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    haven’t gotten round to it yet… other things took priority. I’m working on some other location search related stuff on the side so will tackle this during that as well.

    Is there anyway someone could post the cool snippets that have since expired from pastebin? Or how can I implement a zipcode/radius search like this:

    SELECT
    name,
    ((ACOS(SIN( “.$latitude.” * PI() / 180) * SIN(latitude * PI() / 180) + COS(“.$latitude.” * PI() / 180) * COS(latitude * PI() / 180) * COS((“.$longitude.” – longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance
    FROM
    em_locations
    WHERE 1
    AND location = 1
    HAVING distance <= . $radius
    ORDER BY distance ASC
    LIMIT 10

    Is this something I could easily do by creating a locations-search.php template?

    Thread Starter Daedalon

    (@daedalon)

    If you’ll let me know of your email or another way of contacting you, I’ll look into emailing you the templates we currently use for location search. Not sure how productive that is, though, as they might become redundant when the plugin core will include the feature, possibly intended in a more optimal way.

    Regarding a proximity search I’d say you should look into other threads or create a new one, as that goes aside from having a dedicated location search in the first place.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[PATCH] Dedicated location search’ is closed to new replies.