Plugin Directory

Changeset 741552


Ignore:
Timestamp:
07/16/2013 09:16:24 AM (13 years ago)
Author:
Travelgrove
Message:
  • subID moved to GET parameter when box loaded through JavaScript
Location:
travel-search/tags/1.2.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • travel-search/tags/1.2.5/classes/tgSearchboxesRenderer.class.php

    r723445 r741552  
    1414    private $defaultSize        = '300x250';
    1515    private $defaultSelectedTab = 'flights';
    16     private $subID          = '106';
     16    private $subID;
     17    /*  added to be able to compare if default subID is in use or not | Tibi | 2013-Jul-10  */
     18    private $defaultSubID       = '106';
    1719    private $defaultAlignment   = 'alignnone';
    1820
     
    3335        $this->atts     = $atts;
    3436        /** make the subID hookable - only for internal uses    */
    35         $this->subID        = apply_filters('tg_searchboxes_subID', $this->subID);
     37        $this->subID        = apply_filters('tg_searchboxes_subID', $this->defaultSubID);
    3638        /** current number of boxes needed for incremental IDs for inputs / labels  */
    3739        self::$nrOfBoxes++;
     
    5961            $queryString.= '&'. urlencode($name) .'='. urlencode($value);
    6062        }
     63       
     64        /*  @note   subID comparison to default subID added because subID was not transfered to the JS file and custom subID was lost when SB loaded from JS
     65            @date   2013-JUL-10
     66            @author Tibi    */
     67        if ($this->defaultSubID!=$this->subID)
     68            $queryString    .= '&subID='. (int)$this->subID;
     69       
    6170        $queryString    .= '&tgsbPlaceholder=tgsb_'.self::$nrOfBoxes;
    6271        //the link to the javascript file (php that generates JS code)
  • travel-search/tags/1.2.5/controllers/controller-frontend.php

    r724002 r741552  
    7373        $currentIndex++;
    7474    }
     75   
     76    /** @note   If we get a subID via GET parameter, we have to use that subID | for the filter using priority of 20 - this should be enough to make sure no other filters were registered after this filter
     77        @date   2013-JUL-10
     78        @author Tibi    */
     79    if ($req['subID']) {
     80        $this->javascriptSubID  = $req['subID'];
     81        add_filter('tg_searchboxes_subID', array($this, 'set_javascript_subid'), 20);
     82    };
    7583       
    7684    // building up shortcode
     
    105113    // exiting the script to prevent any other output
    106114    exit();
     115}
     116
     117/** @note   used to set the subID got via GET parameter if searchbox is loaded via JS | binded to `tg_searchboxes_subID` filter
     118    @date   2013-JUL-10
     119    @author Tibi    */
     120public function set_javascript_subid($defSubId){
     121    return $this->javascriptSubID ? $this->javascriptSubID : $defSubId;
    107122}
    108123
Note: See TracChangeset for help on using the changeset viewer.