Feeds:
Posts
Comments

In order to allow developer to use translator instance into validators, Zend Framework 2.2 add a new service call MvcTranslator, as quoted in documentation:

“A new service has also been registered with the MVC, MvcTranslator, which will return this specialized, bridge instance.

Most users should see no issues, as Zend\Validator\ValidatorPluginManager has been modified to use the MvcTranslator service internally, which is how most developers were getting the translator instance into validators in the first place. You will only need to change code if you were manually injecting the instance previously.”

However, we used to set the locale by a manually injected translator to allow users switching to different languages. After upgraded to 2.2.2 or later (the latest version at this time is 2.3.1), the switching languages function is no longer working properly.

In order to make sure function works properly no matter the version is, I updated the code to something like:

    public function setLocale($locale) {
        $sm = $this->getServiceLocator();
        if($sm->has("mvcTranslator")){
            $this->translator = $sm->get('mvcTranslator');
            $this->translator->setLocale($locale);
        }else if($sm->has("Translator")){
            $this->translator = $sm->get('translator');
            $this->translator->setLocale($locale);
        }
    }

I saw the code accidentally.

<?php

/**
 * Entrypoint for main Web SRP using GSP2
 *
 * $Id: search.ros 73448 2011-05-11 18:53:21Z dmorilha $
 * $Source$
 *
 * @package gsp2_project_web
 * @author Jake Rosenberg <jake@yahoo-inc.com>
 */

// <?php
// This is the composite search.ros file that brings includes everything that's needed for the search
// entry point. All you need to do is include this file and add a $_dfactory->run() at the end.

//<?php
require ('/home/y/share/pear/Yahoo/GSP2/Web/Includes/paths.inc');

# php v5.3 and lower don't have the request time available as float
$_ENV['GSP2_REQUEST_TIME_FLOAT'] = microtime(true);

#debug "gsp_apd_trace" apd_set_pprof_trace();

/*debug "gsp_benchmark"
  require($GSP2_PATH . '/Core/Benchmark.php');
  $yprofiler = YBenchmark_Profiler::initialize();
debug*/



#debug "gsp_no_linktrack" ini_set("gsp2_util_linktrack.enabled", false);
#debug "gsp_debug_linktrack" ini_set("gsp2_util_linktrack.debug", GSPLINKTRACK_DEBUG_ALL);
GSPLinkTrack::spaceId("2766679");


yahoo_strict_set_error(E_WARNING);


// <?php

#debug "gsp_benchmark" $yprofiler->enterSection('Core File Inclusion Phase');
/* Include GSP2 core components */
require(GSP2_PATH . '/Core/Class.php');
require(GSP2_PATH . '/Core/ClassUtils.php');
require(GSP2_PATH . '/Core/Debug.php');
require(GSP2_PATH . '/Core/DebugHTML.php');
require(GSP2_PATH . '/Core/Log.php');
require(GSP2_PATH . '/Core/ProviderBase.php');
require(GSP2_PATH . '/Core/ProviderList.php');
require(GSP2_PATH . '/Core/Result.php');
require(GSP2_PATH . '/Core/Skin.php');
require(GSP2_PATH . '/Core/Transformator.php');
require(GSP2_PATH . '/Core/Array.php');
require(GSP2_PATH . '/Core/Content.php');

/* Include GSP2 Utilities */
require(GSP2_PATH . '/Util/Configuration.php');
require(GSP2_PATH . '/Util/Query.php');
require(GSP2_PATH . '/Util/Ads.php');
require(GSP2_PATH . '/Util/Strings.php');
require(GSP2_PATH . '/Util/Preferences.php');
require(GSP2_PATH . '/Util/Urls.php');
require(GSP2_PATH . '/Util/Cache.php');
require(GSP2_PATH . '/Util/UUID.php');
require(GSP2_PATH . '/Util/Bing.php');
require(GSP2_PATH . '/Util/Layout.php');
require(GSP2_PATH . '/DataModel/DataModel.php');
require(GSP2_PATH . '/DataModel/PageModel.php');
require(GSP2_PATH . '/DataModel/DispatchModel.php');
require(GSP2_PATH . '/DataModel/Manipulators/Query.php');
require(GSP2_PATH . '/DataModel/Manipulators/CurlDispatch.php');
require(GSP2_PATH . '/DataModel/Manipulators/YFed2Dispatch.php');
#debug "gsp_benchmark" require(GSP2_PATH . '/DataModel/Manipulators/Benchmark.php');

/* Include GSP2 Providers */
require(GSP2_PATH . '/DispatchLayers/YFed2.php');
require(GSP2_PATH . '/DispatchLayers/CurlMulti.php');
require(GSP2_PATH . '/DispatchLayers/GSM.php');

/* Include Other Utilities */
#require('/home/y/share/pear/YMobile/Util/YMobileViewPrefCookie.inc');


#debug "gsp_benchmark" $yprofiler->leaveSection('Core File Inclusion Phase');

//<?php

#debug "gsp_benchmark" $yprofiler->enterSection('File Inclusion Phase');

/* Include GSP2 Providers */
require(GSP2_PATH . '/Providers/Base/MMSBase.php');
require(GSP2_PATH . '/Providers/Base/Audio.php');
require(GSP2_PATH . '/Providers/Base/AS.php');
require(GSP2_PATH . '/Providers/Base/Begun.php');
require(GSP2_PATH . '/Providers/Base/BOSS.php');
require(GSP2_PATH . '/Providers/Base/BOSSLensV2.php');
require(GSP2_PATH . '/Providers/Base/COKE.php');
require(GSP2_PATH . '/Providers/Base/Collection.php');
require(GSP2_PATH . '/Providers/Base/DomainMatch.php');
require(GSP2_PATH . '/Providers/Base/Gossip.php');
require(GSP2_PATH . '/Providers/Base/Generic.php');
require(GSP2_PATH . '/Providers/Base/Image.php');
require(GSP2_PATH . '/Providers/Base/KKSpeller.php');
require(GSP2_PATH . '/Providers/Base/LayoutLog.php');
require(GSP2_PATH . '/Web/providers/CurveballLayoutLog.php');
require(GSP2_PATH . '/Providers/Base/Malkovich.php');
require(GSP2_PATH . '/Providers/Base/QSS.php');
require(GSP2_PATH . '/Providers/Base/MMSAPI.php');
require(GSP2_PATH . '/Providers/Base/News.php');
require(GSP2_PATH . '/Providers/Base/PivotCache.php');
require(GSP2_PATH . '/Providers/Base/QP.php');
require(GSP2_PATH . '/Providers/Base/QLAS.php');
require(GSP2_PATH . '/Providers/Base/SiteSearch.php');
require(GSP2_PATH . '/Providers/Base/UserSession.php');
require(GSP2_PATH . '/Web/providers/URSA.php');
require(GSP2_PATH . '/Providers/Base/Video.php');
require(GSP2_PATH . '/Providers/Base/VISFacets.php');
require(GSP2_PATH . '/Providers/Base/YPEurope.php');
require(GSP2_PATH . '/Providers/Base/YSM.php');
require(GSP2_PATH . '/Providers/Base/YST.php');
require(GSP2_PATH . '/Providers/Base/FED.php');
require(GSP2_PATH . '/Providers/Base/YSP.php');
require(GSP2_PATH . '/Providers/Base/BOSSLens.php');
require(GSP2_PATH . '/Providers/Base/GSM.php');
require(GSP2_PATH . '/Providers/Base/GSMLPM.php');
require(GSP2_PATH . '/Providers/Base/UNI.php');

/* Include GSP2 Social Providers */
require(GSP2_PATH . '/Providers/Social/PRS.php');

/* Include Shortcuts Providers */
require(GSP2_PATH . '/Web/providers/Airlines.php');
require(GSP2_PATH . '/Web/providers/Answers.php');
require(GSP2_PATH . '/Web/providers/ATTYP.php');
require(GSP2_PATH . '/Web/providers/AudioMusicWSAPI.php');
require(GSP2_PATH . '/Web/providers/AudioSearchBase.php');
require(GSP2_PATH . '/Web/providers/Autos.php');
require(GSP2_PATH . '/Web/providers/AutosGScore.php');
require(GSP2_PATH . '/Web/providers/Buzzlog.php');
require(GSP2_PATH . '/Web/providers/Coupons.php');
require(GSP2_PATH . '/Web/providers/DynamicAds.php');
require(GSP2_PATH . '/Web/providers/EBay.php');
require(GSP2_PATH . '/Web/providers/FindLocation.php');
require(GSP2_PATH . '/Web/providers/Flickr.php');
require(GSP2_PATH . '/Web/providers/FootballTeam.php');
require(GSP2_PATH . '/Web/providers/GasBuddy.php');
require(GSP2_PATH . '/Web/providers/Golf.php');
require(GSP2_PATH . '/Web/providers/HealthDD.php');
require(GSP2_PATH . '/Web/providers/ImageCache.php');
require(GSP2_PATH . '/Web/providers/InteliusPeople.php');
require(GSP2_PATH . '/Web/providers/IY.php');
require(GSP2_PATH . '/Web/providers/MovieDetails.php');
require(GSP2_PATH . '/Web/providers/Sccs.php');
require(GSP2_PATH . '/Web/providers/Krugle.php');
require(GSP2_PATH . '/Web/providers/IYSuperent.php');
require(GSP2_PATH . '/Web/providers/LocalPhone.php');
require(GSP2_PATH . '/Web/providers/Lyrics.php');
require(GSP2_PATH . '/Web/providers/MapImage.php');
require(GSP2_PATH . '/Web/providers/Maps.php');
require(GSP2_PATH . '/Web/providers/Mortgage.php');
require(GSP2_PATH . '/Web/providers/SSBEMovie.php');
require(GSP2_PATH . '/Web/providers/Movies.php');
require(GSP2_PATH . '/Web/providers/MovieShowtimes.php');
require(GSP2_PATH . '/Web/providers/MusicArtists.php');
require(GSP2_PATH . '/Web/providers/MusicArtistsWS.php');
require(GSP2_PATH . '/Web/providers/NewsLocal.php');
require(GSP2_PATH . '/Web/providers/NewsWow.php');
require(GSP2_PATH . '/Web/providers/Olympics.php');
require(GSP2_PATH . '/Web/providers/People.php');
require(GSP2_PATH . '/Web/providers/Product.php');
require(GSP2_PATH . '/Web/providers/ProductBrand.php');
require(GSP2_PATH . '/Web/providers/ProductBrandWow.php');
require(GSP2_PATH . '/Web/providers/ProductTitle.php');
require(GSP2_PATH . '/Web/providers/ProductWOW.php');
require(GSP2_PATH . '/Web/providers/Recipes.php');
require(GSP2_PATH . '/Web/providers/ShoppingNarrower.php');
require(GSP2_PATH . '/Web/providers/SportsPlayers.php');
require(GSP2_PATH . '/Web/providers/SportsScores.php');
require(GSP2_PATH . '/Web/providers/Traffic.php');
require(GSP2_PATH . '/Web/providers/Trailer.php');
require(GSP2_PATH . '/Web/providers/Translation.php');
require(GSP2_PATH . '/Web/providers/Travel.php');
require(GSP2_PATH . '/Web/providers/TvWow.php');
require(GSP2_PATH . '/Web/providers/Twitter.php');
require(GSP2_PATH . '/Web/providers/Upcoming.php');
require(GSP2_PATH . '/Web/providers/VespaCoupons.php');
require(GSP2_PATH . '/Web/providers/VideoSearch.php');
require(GSP2_PATH . '/Web/providers/Weather.php');
require(GSP2_PATH . '/Web/providers/WorldCup.php');
require(GSP2_PATH . '/Web/providers/YPLocal.php');
require(GSP2_PATH . '/Web/providers/MultiProduct.php');
require(GSP2_PATH . '/Web/providers/ProductDD.php');
require(GSP2_PATH . '/Web/providers/CricketScheduleDD.php');
require(GSP2_PATH . '/Web/providers/CricketScoreDD.php');
require(GSP2_PATH . '/Web/providers/CricketPlayerDD.php');
require(GSP2_PATH . '/Web/providers/TravelDD.php');
require(GSP2_PATH . '/Web/providers/TravelHomeAirport.php');
require(GSP2_PATH . '/Web/providers/AppSearch.php');
require(GSP2_PATH . '/Web/providers/YHSSherpa.php');
require(GSP2_PATH . '/Web/providers/SSMWC.php');
require(GSP2_PATH . '/Web/providers/FacebookActivityFeed.php');
require(GSP2_PATH . '/Web/providers/Shopping.php');
require(GSP2_PATH . '/Web/providers/TopSearchesQP.php');
require(GSP2_PATH . '/Web/providers/Youtube.php');
require(GSP2_PATH . '/Web/providers/YahooVideo.php');
require(GSP2_PATH . '/Web/providers/FinanceTicker.php');
require(GSP2_PATH . '/Web/providers/FinanceNews.php');
require(GSP2_PATH . '/Web/providers/Currency.php');
require(GSP2_PATH . '/Web/providers/SeatGeek.php');
require(GSP2_PATH . '/Web/providers/Spark.php');

/* Include Project DM/Manipulators */
require(GSP2_PATH . '/Web/datamodel/CSSRegistry.php');
require(GSP2_PATH . '/Web/datamodel/Web.php');
require(GSP2_PATH . '/Web/datamodel/Meta.php');
require(GSP2_PATH . '/Web/datamodel/UPS.php');
require(GSP2_PATH . '/Web/datamodel/People.php');
require(GSP2_PATH . '/Web/datamodel/PostPresent.php');
require(GSP2_PATH . '/Web/datamodel/Results.php');
require(GSP2_PATH . '/Web/datamodel/WebResults.php');
require(GSP2_PATH . '/Web/datamodel/ImageResults.php');
require(GSP2_PATH . '/Web/datamodel/SpellResults.php');
require(GSP2_PATH . '/Web/datamodel/SponsoredResults.php');
require(GSP2_PATH . '/Web/datamodel/ViewpointResults.php');
require(GSP2_PATH . '/Web/datamodel/VideoResults.php');
require(GSP2_PATH . '/Web/datamodel/Skin.php');
require(GSP2_PATH . '/Web/datamodel/SlottingMap.php');
require(GSP2_PATH . '/Web/datamodel/Urls.php');
require(GSP2_PATH . '/Web/datamodel/LogModel.php');
require(GSP2_PATH . '/Web/datamodel/SearchModules.php');
require(GSP2_PATH . '/Web/datamodel/Content.php');
require(GSP2_PATH . '/Web/datamodel/Syndication.php');
require(GSP2_PATH . '/Web/datamodel/Pivots.php');
require(GSP2_PATH . '/Web/datamodel/ComponentData.php');
require(GSP2_PATH . '/Web/datamodel/Location.php');
require(GSP2_PATH . '/Web/datamodel/LPMReader.php');

require(GSP2_PATH . '/Web/datamodel/manipulators/Ads.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/AssetPreload.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Bucket.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Configuration.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Collection.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/CSSRegistry.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Debug.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Encoding.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Env.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Session.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Gzip.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Layout.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Locdrop.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/LocdropApache.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Logging.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/LPMReader.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Meta.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/PageLog.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/PostPresentDispatch.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Preferences.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Presentation.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Quickapps.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/People.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Query.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Redirect.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Refiners.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/SiteRefiners.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Results.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Shortcuts.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/ShortcutsFed.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Inadco.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Slideshow.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/SponsoredSearch.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/SearchModules.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/TopSearches.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/UPS.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Urls.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/URSA.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/WholePageExpt.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/YFed2Dispatch.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/YSP.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/YST.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/FED.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/ZRP.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/OpenShortcuts.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/LightWeightSRP.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/entry/404handler.php');
require(GSP2_PATH . '/Web/datamodel/searchmodules/Base.php');
require(GSP2_PATH . '/Web/datamodel/searchmodules/Base_Imported.php');
require(GSP2_PATH . '/Web/datamodel/searchmodules/Base_Media.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/Pivots.php');
require(GSP2_PATH . '/Web/datamodel/utilities/Bing.php');
require(GSP2_PATH . '/Web/datamodel/utilities/BucketLayers.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/SSMWC.php');
require(GSP2_PATH . '/Web/datamodel/manipulators/SSPresent.php');

require(GSP2_PATH . '/Web/datamodel/manipulators/mobile/MobileUtilities.php');

/* Configurators */
require(GSP2_PATH . '/Web/datamodel/configurators/AS.php');
require(GSP2_PATH . '/Web/datamodel/configurators/BOSS.php');
require(GSP2_PATH . '/Web/datamodel/configurators/Begun.php');
require(GSP2_PATH . '/Web/datamodel/configurators/COKE.php');
require(GSP2_PATH . '/Web/datamodel/configurators/DomainMatch.php');
require(GSP2_PATH . '/Web/datamodel/configurators/Gossip.php');
require(GSP2_PATH . '/Web/datamodel/configurators/KKSpell.php');
require(GSP2_PATH . '/Web/datamodel/configurators/LayoutLog.php');
require(GSP2_PATH . '/Web/datamodel/configurators/CurveballLayoutLog.php');
require(GSP2_PATH . '/Web/datamodel/configurators/SearchModules.php');
require(GSP2_PATH . '/Web/datamodel/configurators/SiteSearch.php');
require(GSP2_PATH . '/Web/datamodel/configurators/News.php');
require(GSP2_PATH . '/Web/datamodel/configurators/MultiProductDD.php');
require(GSP2_PATH . '/Web/datamodel/configurators/QP.php');
require(GSP2_PATH . '/Web/datamodel/configurators/QLAS.php');
require(GSP2_PATH . '/Web/datamodel/configurators/QSS.php');
require(GSP2_PATH . '/Web/datamodel/configurators/Tee.php');
require(GSP2_PATH . '/Web/datamodel/configurators/YST.php');
require(GSP2_PATH . '/Web/datamodel/configurators/FED.php');
require(GSP2_PATH . '/Web/datamodel/configurators/YSM.php');
require(GSP2_PATH . '/Web/datamodel/configurators/People.php');
require(GSP2_PATH . '/Web/datamodel/configurators/GSM.php');
require(GSP2_PATH . '/Web/datamodel/configurators/GSMLPM.php');
require(GSP2_PATH . '/Web/datamodel/configurators/URSA.php');
require(GSP2_PATH . '/Web/datamodel/configurators/YHS.php');
require(GSP2_PATH . '/Web/datamodel/configurators/SSMWC.php');
require(GSP2_PATH . '/Web/datamodel/configurators/PivotCache.php');
require(GSP2_PATH . '/Web/datamodel/configurators/UNI.php');

/* Search History */
require(GSP2_PATH . '/Web/datamodel/manipulators/entry/history.php');
require(GSP2_PATH . '/Web/providers/SearchHistory.php');

/* LocDrop */
require('/home/y/share/pear/locdrop_phpext/LocationSignal.php');
require('/home/y/share/pear/locdrop_phpext/LocationReader.php');

//<?php

// US Specific Presentation (new Also Try)
require($GSP2_PATH . '/Web/datamodel/manipulators/intl/us/Presentation.php');

// US Specific Pivot 
require($GSP2_PATH . '/Web/datamodel/manipulators/intl/us/Pivot.php');

// MTV
require(GSP2_PATH . '/Web/datamodel/manipulators/GoogleAds.php');
require(GSP2_PATH . '/Web/datamodel/utilities/Google.php');


#debug "gsp_benchmark" $yprofiler->leaveSection('File Inclusion Phase');


//<?php
//
// define the query map for this entrypoint
//
$SINGLE_URL        = array('input_type' => GSPQueryAnalyzer::INPUT_TYPE_URL,        'data_type' => GSPQueryAnalyzer::DATA_TYPE_SINGLE);
$SINGLE_UNSAFE_RAW = array('input_type' => GSPQueryAnalyzer::INPUT_TYPE_UNSAFE_RAW, 'data_type' => GSPQueryAnalyzer::DATA_TYPE_SINGLE);
$SINGLE_NUMBER     = array('input_type' => GSPQueryAnalyzer::INPUT_TYPE_NUMBER,     'data_type' => GSPQueryAnalyzer::DATA_TYPE_SINGLE);
$SINGLE_STRIPPED   = array('input_type' => GSPQueryAnalyzer::INPUT_TYPE_STRIPPED,   'data_type' => GSPQueryAnalyzer::DATA_TYPE_SINGLE);
$ARRAY_STRIPPED    = array('input_type' => GSPQueryAnalyzer::INPUT_TYPE_STRIPPED,   'data_type' => GSPQueryAnalyzer::DATA_TYPE_ARRAY);
$_query_map =
    array(
          // Primary query parameters
          // Will use 'p' if available,
          // Otherwise will fallback on 'q'
          //
          'p'           => $SINGLE_UNSAFE_RAW,
          'q'           => $SINGLE_UNSAFE_RAW,

          // Assistance Layer
          // rp:    "Real p", used in viewpoint refinements (this is the original query being pivoted around)
          // sado:  Start with assistance tray open?
          // reqvp: Pass as false/zero to disable requesting viewpoint data
          // pqstr: Partial query string: query string in search box when user clicked a Gossip suggestion or Viewpoint concept (see bug #2396580)
          //
          'rp'          => $SINGLE_UNSAFE_RAW,
          'sado'        => $SINGLE_NUMBER,
          'reqvp'       => $SINGLE_STRIPPED,
          // Temporary for Search Assist logging:
          'pqstr'       => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          'gprid'       => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          'sao'         => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          'sac'         => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),

          // Metro Sidebar
          // rc:  "Related Concept": prisma term that was clicked in the sidebar (without the original query)
          // obj: "Object Filter": object clicked in the sidebar
          //
          'rc'          => $SINGLE_UNSAFE_RAW + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          'obj'         => $SINGLE_STRIPPED,

          // AJAX requests
          // pvid: id of the original pageview that makes this ajax request
          // cntxt: contextual parameters to cusomized ajax request
          'pvid'        => $SINGLE_STRIPPED,
          'ctx'         => $ARRAY_STRIPPED,

          // Buzz log article id, used for BuzzLog shortcut
          'gid'         => $SINGLE_NUMBER + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),

          // Disable JavaScript (any truth value)
          'nojs'        => $SINGLE_STRIPPED,

          // Pagination (counts)
          // Begin with result #b, and display n results {e.g.: (b) - (b+n-1) of about x}
          //
          'n'           => $SINGLE_NUMBER,
          'b'           => $SINGLE_NUMBER,

          // Encoding / Output
          // ei:    Input encoding (default: Detect, then fallback on utf8)
          // eo:    Ouptut encoding
          // o:     Content-type override (e.g. 'json', 'html')
          // _cset: Seeded character set detection parameter (using thoth_get_cset_detect())
          //
          'ei'          => $SINGLE_STRIPPED,
          'eo'          => $SINGLE_STRIPPED,
          'o'           => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          '_cset'       => $SINGLE_STRIPPED,

          // Web Search buttons
          // y: "Search"
          // gfr: "Goto First Result"
          //
          'y'           => $SINGLE_STRIPPED,
          'gfr'         => $SINGLE_NUMBER,

          // MSIE redirect flag
          //
          'm'           => $SINGLE_STRIPPED,

          // Search Medium Preference flag
          'mp'          => $SINGLE_STRIPPED,

          /* {{{ adv search params */
          // va: Space delimited list of required words (AND)
          // vo: Space delimited list of desired words (OR)
          // ve: Space delimited list of exluded words (NOT)
          // vp: Exact phrase to look for
          // *_vt: Where to look for the words/phrase
          //     'title', 'url', or 'any'
          //
          // vd: Date restriction: 'all', 'm3'(3mos), 'm6'(6mos), 'y'(year)
          // vs: Site restriction (e.g.: example.com)
          // vst: Set to '0' by "More from this site" link
          // vf: Filetype restriction: See src/configs/base_codes.php for values
          // vc: Country restriction (e.g.: us, ca, mx, etc...)
          // vm: Safe Search: (r)estrictive, (i)mages-only, or (p)ermissive
          // fl: Filter language: 1(Yes) or 0(No)
          // vl: Language Codes
          // tf: Time Filters: 0(Any Time) or 1(Most Recent)
          // btf: Time Refiners: d(Day), w(Week) or m(Month)
          //
          'va'          => $SINGLE_UNSAFE_RAW,
          'va_vt'       => $SINGLE_STRIPPED,
          'vo'          => $SINGLE_UNSAFE_RAW,
          'vo_vt'       => $SINGLE_STRIPPED,
          've'          => $SINGLE_UNSAFE_RAW,
          've_vt'       => $SINGLE_STRIPPED,
          'vp'          => $SINGLE_UNSAFE_RAW,
          'vp_vt'       => $SINGLE_STRIPPED,
          'vd'          => $SINGLE_STRIPPED,
          'vs'          => $ARRAY_STRIPPED,
          'vst'         => $SINGLE_NUMBER,
          'vf'          => $ARRAY_STRIPPED,
          'vc'          => $ARRAY_STRIPPED,
          'vm'          => $SINGLE_STRIPPED,
          'fl'          => $SINGLE_NUMBER,
          'vl'          => $ARRAY_STRIPPED,
          'tf'          => $SINGLE_STRIPPED,
          'btf'         => $SINGLE_STRIPPED,

          // h: 'w'(web) or 'c' or 'C' (directory) - Send by dir.yahoo.com radio buttons
          // r: Category restriction - Only used for passtrough to directory search
          //
          'h'           => $SINGLE_STRIPPED,
          'r'           => $SINGLE_STRIPPED,
          'i'           => $SINGLE_STRIPPED,

          // h: "Directory search radio buttons"
          //

          // Display "duplicates", similar results from a given site (1 or 0)
          'dups'        => $SINGLE_NUMBER,

          // rd: Radio button
          // meta: When rd is set, used to reconstruct parts of previous advanced query
          'rd'          => $SINGLE_STRIPPED,
          'meta'        => $SINGLE_STRIPPED,
          /* advanced search params }}} */

          // YSM Parameters:
          // xargs: Additional parameters passed through to backend
          // pstart: Offset into ad results to begin at
          // type: Merged with fr codes and passed through to backend
          // xa: Signature of p/q, fr, b, xargs & expiry
          'xargs'       => $SINGLE_STRIPPED,
          'pstart'      => $SINGLE_STRIPPED,
          'type'        => $SINGLE_STRIPPED,
          'xa'        	=> $SINGLE_STRIPPED,

          // Suppres rewriter flag
          // to be passed in through for non-rewrite search reqs
          //
          'norw'        => $SINGLE_STRIPPED,

          // "from" parameter, for tracking, revsharing
          //
          'fr'          => $SINGLE_STRIPPED,

          // second "from" parameter for tracking query origin
          //
          'fr2'         => $SINGLE_STRIPPED,

          // "purchased keyword" parameter, for tracking, revsharing
          //
          'pkw'          => $SINGLE_STRIPPED,

          // "adds radio button to srp
          //
          'fp_ip'       => $SINGLE_STRIPPED,

          // spelling state from YST
          //
          'SpellState'  => $SINGLE_STRIPPED,

          // Related Search
          // rs: 'more' or 'all'
          //    Relaxes limits on "Also Try"s which are displayed
          // mrs: 'more' (ZRP's AlsoTry)
          //
          'rs'          => $SINGLE_STRIPPED,
          'mrs'         => $SINGLE_STRIPPED,

          // Enable opening all links in new window
          'nw'         => $SINGLE_NUMBER,

          // Internal Options: Must be in ynet DB
          //
          // debug:       Activate one or more GSPDebugThunks
          // noqt:        Disable Query Triage (any truth value)
          // nofeedback:  Disable feedback module (any truth value)
          // ultdebug:    show link tracking parameters in links
          // QTCaseID:    Passed to Qeury Triage
          // CaseID:      Passed to Qeury Triage
          // Usrole:      Passed to Qeury Triage
          // QTSubmitUrl: Passed to Qeury Triage
          // __ip:        IP to masquerade from
          // __country:   Country to masquerade from
          // __skin:      Override normal skin selection
          // __harmony:   Set to 0 to turn off harmony
          // __cluster:   Set to override cluster configuration
          // __survey:    Set to trigger inline survey when in survey bucket
          // __dummy:     Alternate file to use for specified provider (e.g. __dummy=YST:us/DFR5/flowers/yst.xml)
          // __gsm_host'  Set to override the GSM host used for the request
          // __gsm_lpm_host'  Set to override the GSMLPM host used for the request
          // __gsm_lpm_params'  Set to override the GSMLPM params used for the request
          // __ysm_host'  Set to override the YSM host used for the request
          // __uni_host'  Set to override the UNI host used for the request
          // __qlas_host' Set to override the QLAS host used for the request
          // __qp_host'   Set to override the QP host used for the request
          //
          'debug'             => $ARRAY_STRIPPED,
          'tmpl'              => $SINGLE_STRIPPED, // this is in here for passthru!
          'noqt'              => $SINGLE_STRIPPED,
          'nofeedback'        => $SINGLE_STRIPPED,
          'ultdebug'          => $SINGLE_STRIPPED,
          'QTCaseID'          => $SINGLE_STRIPPED,
          'CaseID'            => $SINGLE_STRIPPED,
          'Usrole'            => $SINGLE_STRIPPED,
          'QTSubmitUrl'       => $SINGLE_STRIPPED,
          'malkhost'          => $SINGLE_STRIPPED,
          'ystproxy'          => $SINGLE_STRIPPED,
          '__ip'              => $SINGLE_STRIPPED,
          '__country'         => $SINGLE_STRIPPED,
          '__skin'            => $SINGLE_STRIPPED,
          '__harmony'         => $SINGLE_STRIPPED,
          '__cluster'         => $SINGLE_STRIPPED,
          '__survey'          => $SINGLE_STRIPPED,
          '__expt'            => $SINGLE_STRIPPED,
          '__dummy'           => $ARRAY_STRIPPED,
          '__gsm_host'        => $SINGLE_STRIPPED,
          '__gsm_lpm_host'    => $SINGLE_STRIPPED,
          '__gsm_lpm_params'  => $SINGLE_STRIPPED,
          '__ysm_host'        => $SINGLE_STRIPPED,
          '__uni_host'        => $SINGLE_STRIPPED,
          '__qlas_host'       => $SINGLE_STRIPPED,
          '__qp_host'         => $SINGLE_STRIPPED,


          // Input LPM - Internal usage, allow LPM Reader to read alternate file
          'slpm'              => $SINGLE_STRIPPED,


          // Shortcut Viewalls (Used by zipcode shortcut only)
          // scview:  When set to 'all', display more zipcodes
          // scview2: When set to 'all', display more states
          'scview'      => $SINGLE_STRIPPED,
          'scview2'     => $SINGLE_STRIPPED,

          // Sub vertical param
          // note: going fwd pls use this for any sub vertical
          // all legacy subverticals will be ported to use vert
          //
          'vert'          => $SINGLE_STRIPPED,

          // State parameters for WOW Movies module
          // editloc: user clicked on Edit link for location
          // locerr:  ulm save was not successful, invalid location
          // nomp:    new open wow movies provider
          //
          'editloc'     => $SINGLE_NUMBER,
          'locerr'      => $SINGLE_NUMBER,
          'nomp'        => $SINGLE_NUMBER,

          // Refiner parameter for TravelWow
          // forces QP to trigger travel
          'rf'          => $SINGLE_STRIPPED,

          // State parameters for TV WOW module
          'tvtz'        => $SINGLE_STRIPPED,

          // Test specific query map entries
          // Please add a comments, contact next to each test query map entry
          // to help clean up after tests stop and dont go into prodn
          'f'                   => $SINGLE_STRIPPED, // contact: weilin@, test: AL

          // Search Monkey
          // smcode: d0 doesn't have JS, d1 user has JS, ds1 user has JS + sent spam report
          // save: numeric code representing preference's save state.
          //       0 success, 5 fail, 7 bcrumb fail
          'smcode'      => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          'save'        => $SINGLE_NUMBER   + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          'yst_url'     => $SINGLE_URL      + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          'mod'         => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),
          '_bcrumb'     => $SINGLE_STRIPPED + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),

          // get cobrand experiece without cobrand account
          '_partner'     => $SINGLE_STRIPPED,

          // Bucket exercise
          'spons_res'	=> $SINGLE_NUMBER,
          'change_reqOrder'	=>	$SINGLE_NUMBER,

          '__sm'        => $ARRAY_STRIPPED,
          'sm'          => $ARRAY_STRIPPED,

          // Distributed Search
          // dmod: tells us what modules to show
          'dmod'        => $SINGLE_STRIPPED,

          // Rais Video AutoPlay
          'rvap'        => $SINGLE_NUMBER,

          // 404handler params
          'url'         => $SINGLE_STRIPPED,
          'qs'          => $SINGLE_STRIPPED,
          'src'         => $SINGLE_STRIPPED,
          'type'        => $SINGLE_STRIPPED,

          // Yahoo Search Protection
          'ysp'         => $SINGLE_NUMBER + array('urlarg' => GSPQueryAnalyzer::URLARG_NEVER),

          // Switch for light weight search
          'light'       => $SINGLE_NUMBER,

          // YHS partner id, pagination (YHS3)
          'partnerid'   => $SINGLE_STRIPPED,
          'YST_b'       => $SINGLE_NUMBER,

          // Freecause specific params
          'tid'         => $SINGLE_STRIPPED,
          'uid'         => $SINGLE_STRIPPED,
          'cuid'        => $SINGLE_STRIPPED,

          // YHS beacon param
          'param1'      => $SINGLE_STRIPPED,
          'param2'      => $SINGLE_STRIPPED,
          'param3'      => $SINGLE_STRIPPED,
          'param4'      => $SINGLE_STRIPPED,

	  // YHS dynamic width SRP
	  'width'       => $SINGLE_NUMBER,

          /* == Location based parameters for Mobile == */
          // Home/Exact location: Used to call QP with location directly instead of IP address
          'hloc'        => $SINGLE_UNSAFE_RAW,
          // Woeid: supplements hloc for providers that only accept woeid
          'woeid'       => $SINGLE_UNSAFE_RAW,
          // Geo-coordinates for geocoder (lat/lon, user input location)
          'geo'         => $SINGLE_UNSAFE_RAW,
          '_geo'         => $SINGLE_UNSAFE_RAW,
          'gps'         => $SINGLE_UNSAFE_RAW,    // Same as geo (Voltron backwards compat)

          // to diff. between a first search and a
          // subsequent search
          'first'       => $SINGLE_UNSAFE_RAW,

          // traffic source
          'tsrc'		=> $SINGLE_UNSAFE_RAW,
          '_tsrc'		=> $SINGLE_UNSAFE_RAW,
          '_lang'       => $SINGLE_UNSAFE_RAW,
          // search entry point
          'sep'        => $SINGLE_UNSAFE_RAW,
          '_sep'        => $SINGLE_UNSAFE_RAW,
          'ver'        => $SINGLE_UNSAFE_RAW,
          '_intl'       => $SINGLE_UNSAFE_RAW,
          '_ybx'        => $SINGLE_UNSAFE_RAW,
          '_slug'       => $SINGLE_UNSAFE_RAW,

          // Params for Native Search app
          'cts'        => $SINGLE_UNSAFE_RAW,
          'ctz'        => $SINGLE_UNSAFE_RAW,
          'yddu'       => $SINGLE_UNSAFE_RAW,

          // Trending Now/Slideshows (force current query into specified pos.)
          '__tts'       => $SINGLE_NUMBER,

          // Prototype Key
          'pt'          => $SINGLE_STRIPPED,

          // Site Search
          // 'sort':     how to sort result (relevancy or time)
          // 'section':  result data type to show (article, photo, video, quote, etc.)
          // 'provider': used Source Refiner to pass selected news source
          // 'age':      used by Filter by Time (time filter)
          // 'sbtn':     Web or vertical search button
          // 'mr':       See more or fewer in source refiner
          'sort'        => $SINGLE_STRIPPED,
          'section'     => $SINGLE_STRIPPED,
          'provider'    => $SINGLE_STRIPPED,
          'age'         => $SINGLE_STRIPPED,
          'rss'         => $SINGLE_NUMBER,    // XXX is this used?
          'sbtn'        => $SINGLE_STRIPPED,
          'mr'          => $SINGLE_STRIPPED,

          // 'datesort': legacy parameter for 'sort=time'
          // 'c':        the legacy parameter of 'section' (images / av)
          'datesort'    => $SINGLE_STRIPPED,
          'c'           => $SINGLE_STRIPPED,

          // Clustering in News Search
          // 'clid': The limited cluster id for getting into drilldown page
          'clid'     => $SINGLE_STRIPPED,

          // Advanced Search in News Search
          // 'pub':      'Published' filter selection: last N days or a range
          // 'timeago':    'Published' in last N days
          // 'smonth':   start month of 'published between'
          // 'emonth':   end month of 'published between'
          // 'sday':     start day of 'published between'
          // 'eday':     end day of 'published between'
          // 'source':   news source restriction
          // 'location': news location restriction
          // 'catfilt':  all news categories or selected ones
          // 'cat':      selected news categories
          // 'dates':    selected news dates period
          // 'bcat':     selected blog categories

          'pub'         => $SINGLE_STRIPPED,
          'timeago'     => $SINGLE_STRIPPED,
          'smonth'      => $SINGLE_STRIPPED,
          'emonth'      => $SINGLE_STRIPPED,
          'sday'        => $SINGLE_STRIPPED,
          'eday'        => $SINGLE_STRIPPED,
          'source'      => $SINGLE_STRIPPED,
          'location'    => $SINGLE_STRIPPED,
          'catfilt'     => $SINGLE_UNSAFE_RAW,
          'cat'         => $ARRAY_STRIPPED,
          'dates'       => $SINGLE_STRIPPED,
          'start_date'  => $SINGLE_STRIPPED,
          'end_date'   	=> $SINGLE_STRIPPED,
          'bcat'        => $SINGLE_STRIPPED,

          // Advanced Search in Shopping Search
          // 'brand':    'Filter by Brand of Merchandise'
          // 'price':    'Filter by Price of Merchandise'
          // 'view':     'Grid View or List View'
          'brand'       => $SINGLE_UNSAFE_RAW,
          'price'       => $SINGLE_STRIPPED,
          'pricemin'    => $SINGLE_STRIPPED,
          'pricemax'    => $SINGLE_STRIPPED,
          'view'        => $SINGLE_STRIPPED,

          // Track off serp partners, used in YHS
          // 'hspart':  partner id, eg:ysb
          // 'hsimp':   product name - sequence id, must have a '-' separator, eg: yhs-xxxx
          'hsimp'       => $SINGLE_STRIPPED,
          'hspart'      => $SINGLE_STRIPPED,
          // debug YHS iframe events
          'yhsdebug'    => $SINGLE_STRIPPED,

          // preview YHS SRP
          'preview'     => $SINGLE_STRIPPED,

          // northstar slotting model
          'sltmod'     => $SINGLE_STRIPPED,

          // don't cache static resource(js/css) to localStorage
          'nocache'    => $SINGLE_NUMBER,

          //for log voice search #Bug:5572108
          'voice'      => $SINGLE_STRIPPED,

          // Supress specific shortcuts
          'suppress'   => $SINGLE_STRIPPED,
          // Disable Locdrop Call
          '__ups'   => $SINGLE_STRIPPED,

          );

unset($SINGLE_URL, $SINGLE_UNSAFE_RAW, $SINGLE_NUMBER, $SINGLE_STRIPPED, $ARRAY_STRIPPED);



// Make changes to the standard query map on a per-intl basis
//





//<?php
//
// set up the factory and blank data model
//

$_DATA = new Web_DataModel;

$_dfactory = new GSPDataModelFactory($_DATA);

//
// ----------- register manipulators ------------------
//

//
// system init phase
//
#debug "gsp_benchmark" $_dfactory->register('benchmark_init_start', new GSPDataManipulator_Benchmark(true, 'System Init phase'));
$_dfactory->register('debug_err',           new Web_DebugManipulator_ErrorHandling);
$_dfactory->register('env_vars',            new Web_EnvManipulator_EnvVariables);
$_dfactory->register('browserSettings',     new Web_SettingsManipulator);
$_dfactory->register('encoding_in',         new Web_EncodingManipulator_Input);
$_dfactory->register('query',               new Web_QueryManipulator($_query_map));
$_dfactory->register('env_internal',        new Web_EnvManipulator_Internal);
$_dfactory->register('meta_basic',          new Web_MetaManipulator_Construct('search', 'Web_MetaModel_Search'));
$_dfactory->register('preconf',             new Web_ConfigManipulator_Search($PACKAGE_DIR));
$_dfactory->register('session',             new Web_SessionManipulator);
$_dfactory->register('ysp',                 new Web_YSPTrackingManipulator);
$_dfactory->register('meta_inter',          new Web_MetaManipulator_InterInit);
$_dfactory->register('multilayer_init',     new Web_MultiLayerBucketManipulator_Init);
$_dfactory->register('env_bucket',          new Web_EnvManipulator_Bucket);
$_dfactory->register('bucket_select',       new Web_BucketSelection_Manipulator);
$_dfactory->register('bucket_reselect',     new Web_BucketReselection);
$_dfactory->register('bucket_model',        new Web_BucketModel_Manipulator);
$_dfactory->register('conf',                new Web_ConfigManipulator_MultiLayer($PACKAGE_DIR));
$_dfactory->register('skin_init',           new Web_SkinInitialization($GSP2_PATH, 'search'));
$_dfactory->register('bucket',              new Web_BucketManipulator);
$_dfactory->register('logmodel',            new Web_LogModelManipulator);
$_dfactory->register('whole_page_expt',     new Web_WholePageExptManipulator);
$_dfactory->register('ups',                 new Web_UPSManipulator);
$_dfactory->register('env_useragent',       new Web_EnvManipulator_UserAgent);
$_dfactory->register('env_mcs',             new Web_EnvManipulator_MCSAnalyzer);
$_dfactory->register('urls',                new Web_UrlsManipulator($_query_map));
$_dfactory->register('redir_mcs',           new Web_RedirectManipulator_MCSAnalyzer);
$_dfactory->register('debug_ana',           new Web_DebugManipulator_SetupAnalyzer);
$_dfactory->register('encoding_out',        new Web_EncodingManipulator_Output);
$_dfactory->register('osc_analyze',         new Web_RedirectManipulator_OSCAnalyzer($PACKAGE_DIR . '/workflows/search/openshortcuts.xml'));
$_dfactory->register('yhs_analyze',         new Web_RedirectManipulator_YHSAnalyzer());
$_dfactory->register('prefs',               new Web_PrefsManipulator(array('safesearch'=>true,'features'=>true)));
$_dfactory->register('light',               new Web_SkinManipulator);
$_dfactory->register('search_modules',      new Web_SearchModulesManipulator);
$_dfactory->register('top_searches',        new Web_TopSearchesManipulator);
$_dfactory->register('results_init',        new Web_ResultsModelManipulator);
$_dfactory->register('predispatch',         new Web_PreDispatchYFed2Manipulator_SRP);
$_dfactory->register('dm_predispatch',      new Web_DispatchCurlMulti_DomainMatchTokenizer);
$_dfactory->register('meta_full',           new Web_MetaManipulator_FullInit);
$_dfactory->register('adult_analyze',       new Web_RedirectManipulator_AdultAnalyzer());
$_dfactory->register('people',              new Web_PeopleManipulator);
$_dfactory->register('sponsor',             new Web_SponsoredSearchManipulator);
$_dfactory->register('sponsor_ysm2',        new Web_SponsoredSearchManipulator_YSM2);
$_dfactory->register('redir_predisp',       new Web_RedirectManipulator_PreDispatch);
$_dfactory->register('gzip',                new Web_GzipManipulator);
$_dfactory->register('info_head',           new Web_PresentManip_InfoHead);
$_dfactory->register('js_error_reporting',  new Web_PresentManip_JSErrorReporting);
$_dfactory->register('assist_present',      new Web_PresentManip_Assist);
$_dfactory->register('ursa_present',        new Web_PresentManip_URA_Assist);
$_dfactory->register('bucketbar_present',   new Web_PresentManip_BucketBar);
$_dfactory->register('pivotbar_present',    new Web_PresentManip_PivotBar);
$_dfactory->register('pagelog',             new Web_PageLogManipulator);
$_dfactory->register('pivots',              new Web_PivotManipulator);

#debug "gsp_benchmark" $_dfactory->register('benchmark_init_end', new GSPDataManipulator_Benchmark(false, 'System Init phase'));

//
// pre-dispatch presentation phase
//

#debug "gsp_benchmark" $_dfactory->register('benchmark_predispatch_present_start', new GSPDataManipulator_Benchmark(true, 'PreDispatch Presentation phase'));
// CSSRegistry must run first.
$_dfactory->register('css_registry',             new Web_PresentManip_CSSRegistry);
$_dfactory->register('header',                   new Web_PresentManip_UnivHeader);
$_dfactory->register('promo_header',             new Web_PresentManip_PromoHeader);
$_dfactory->register('tabs_present',             new Web_PresentManip_Tabs_SRP('web'));
$_dfactory->register('searchbox_present',        new Web_PresentManip_SearchBox);
$_dfactory->register('dateselect_present',       new Web_PresentManip_DateSelect);
$_dfactory->register('l10n_info',                new Web_PresentManip_L10N);

$_dfactory->register('radiobuttons_present',     new Web_PresentManip_RadioButtons);
$_dfactory->register('navlinks_present',         new Web_PresentManip_NavLinks);
$_dfactory->register('filtermsg_present',        new Web_PresentManip_AdvMessaging);
$_dfactory->register('querytriage_present',      new Web_PresentManip_QueryTriage);
$_dfactory->register('logo_present',             new Web_PresentManip_Logo);
$_dfactory->register('page_layout',              new Web_PageLayoutManipulator_Init);
$_dfactory->register('safety_present',           new Web_PresentManip_Safety);
$_dfactory->register('notification_header',      new Web_PresentManip_NotificationHeader);

// SkinPreDispatch should run last
$_dfactory->register('skin_predisp',             new Web_SkinPreDispatchPresentation);


#debug "gsp_benchmark" $_dfactory->register('benchmark_predispatch_present_end', new GSPDataManipulator_Benchmark(false, 'PreDispatch Presentation phase'));

//
// dispatch phase
//
$_dfactory->register('dispatch',            new Web_DispatchGSMManipulator($PACKAGE_DIR . '/workflows/search/workflow.xml'));
$_dfactory->register('ads_dispatch',        new Web_AdsManipulator_Dispatch(GSPLinkTrack::spaceid()));
$_dfactory->register('redir_postdisp',      new Web_RedirectManipulator_PostDispatch);
$_dfactory->register('lpmreader_postdisp',  new Web_LPMReaderManipulator_PostDispatch);
$_dfactory->register('meta_postdisp',       new Web_MetaManipulator_PostDispatch);

//
// presentation init phase
//
#debug "gsp_benchmark" $_dfactory->register('benchmark_present_start', new GSPDataManipulator_Benchmark(true, 'Presentation phase'));
$_dfactory->register('highlight_present',        new Web_PresentManip_Highlight);
$_dfactory->register('yst_present',              new Web_PresentManip_ResultsYST);
$_dfactory->register('inadco_present',           new Web_PresentManip_Inadco);
$_dfactory->register('info_present',             new Web_PresentManip_InfoBar('YST'));
$_dfactory->register('sponsor_present',          new Web_PresentManip_SponsoredSearch);
$_dfactory->register('ads_get',                  new Web_AdsManipulator_GetAds);
$_dfactory->register('ditto_present',            new Web_PresentManip_Ditto);
$_dfactory->register('top_searches_present',     new Web_PresentManip_TopSearches);
$_dfactory->register('people_present',           new Web_PresentManip_People);
$_dfactory->register('shortcut_present',         new Web_PresentManip_Shortcuts);
$_dfactory->register('lpmreader_present',        new Web_PresentManip_LPMReader);
$_dfactory->register('refiners_present',         new Web_PresentManip_Refiners);
$_dfactory->register('site_refiners_present',    new Web_PresentManip_Site_Refiners);
$_dfactory->register('preload_assets',           new Web_PresentManip_AssetPreload);
$_dfactory->register('shortcut_tip_present',     new Web_PresentManip_ShortcutTips);
$_dfactory->register('promo_top',                new Web_PresentManip_PromoTop);
$_dfactory->register('messaging_present',        new Web_PresentManip_Messaging);
$_dfactory->register('related_concepts',         new Web_PresentManip_RelatedConcepts);
$_dfactory->register('results_data',             new Web_PresentManip_ResultsData);
$_dfactory->register('sidebar_present',          new Web_PresentManip_Sidebar);
$_dfactory->register('alert_messaging_present',  new Web_PresentManip_Alert_Messaging);
$_dfactory->register('pagination_present',       new Web_PresentManip_Pagination('web'));
$_dfactory->register('dupesmsg_present',         new Web_PresentManip_DupesMessaging);
$_dfactory->register('sponsor_search_present',   new Web_PresentManip_SponsorSearchStyles);
$_dfactory->register('quickapps_present',        new Web_PresentManip_Quickapps);
$_dfactory->register('zrp_present',              new Web_PresentManip_ZRP);
$_dfactory->register('promo_bottom',             new Web_PresentManip_PromoBottom);
$_dfactory->register('promo_middle',             new Web_PresentManip_PromoMiddle);
$_dfactory->register('default_chrome_search',    new Web_PresentManip_DefaultChromeSearch);
$_dfactory->register('promo_footer',             new Web_PresentManip_PromoFooter);
$_dfactory->register('promo_banner',             new Web_PresentManip_PromoBanner);
$_dfactory->register('search_alert_promo_link',  new Web_PresentManip_SearchAlertPromoLink);
$_dfactory->register('footer',                   new Web_PresentManip_Footer);
$_dfactory->register('session_tracking',         new Web_PresentManip_SessionTracking);
$_dfactory->register('footer_js',                new Web_PresentManip_FooterJS);
$_dfactory->register('viewpoint_present',        new Web_PresentManip_Viewpoint);
$_dfactory->register('event_skin_present',       new Web_PresentManip_EventSkin);
$_dfactory->register('adult_filtering',          new Web_PresentManip_AdultFilter);
$_dfactory->register('searchmodules_present',    new Web_PresentManip_SearchModules);
$_dfactory->register('feature_cue_present',      new Web_PresentManip_FeatureCue);
$_dfactory->register('chillingeffect_present',   new Web_PresentManip_ChillingEffects);
// Pivots must run after Shortcuts
$_dfactory->register('pivots_present',           new Web_PresentManip_Pivots);
#debug "gsp_benchmark" $_dfactory->register('benchmark_present_end', new GSPDataManipulator_Benchmark(false, 'Presentation phase'));


//
// ----------- presentation  ------------------
//
$_dfactory->register('skin',                     new Web_SkinPresentation);

//
// ----------- post-presentation curl_multi dispatch ------------------
//
// Must run first in this section.
$_dfactory->register('postpresent_curlmulti_predispatch', new Web_PostPresentManipulator);

// Custom things run in between.
$_dfactory->register('pivotcache_set',  new Web_PivotCacheManipulator);

// Must run last in this section.
$_dfactory->register('postpresent_curlmulti_dispatch', new Web_PostPresentDispatch);

//
// -- URSA --------
//
$_dfactory->register('ursa',            new Web_URSAManipulator);

//
// ----------- layout feedback ------------------
//
$_dfactory->register('predispatch_postpresent',  new Web_PreDispatchYFed2Manipulator_PostPresent);
$_dfactory->register('dispatch_postpresent',     new Web_DispatchYFed2Manipulator($PACKAGE_DIR . '/workflows/layoutlog/workflow.xml'));

//
// data logging phase
//
$_dfactory->register('logging',                  new Web_LoggingManipulator);
$_dfactory->register('pagelog_footer',           new Web_PageLogFooterManipulator);


// Last chance to change the entry point for intls
//
//<?php


//
// ----------- register manipulators -----------
//
$_dfactory->reRegister('messaging_present',    new Web_PresentManip_Messaging_US);
$_dfactory->reRegister('pivots_present',     new Web_PresentManip_Pivots_US);
$_dfactory->registerBefore('footer_js','google_adsense_ads',     new Web_GoogleAdsManipulator_GetAds);





// For intls with light weight SRP


$_dfactory->run();

Continue Reading »

Twitter Typeahead is a fast and effective auto-complete jQuery plugin for form filling.

Twitter Typeahead 插件是一個jQuery 插件,用作快速而有效率的自動填表工具。

In desktop computer, this plugin (Twitter Typeahead) works properly. However, when this plugin is run on a mobile computer, it cannot detect the “blur” event properly. The suggested text cannot be closed when you click outside the suggestion box.

在正常的桌面電腦上,這個Twitter Typeahead插件能正常地運作。可是,一旦放在手機的瀏覽器上運行,卻因無法捕捉到“blur”的事件。如果輕觸瀏覽器的其他地方,無法可以正常關閉“提示列”。

One of the possible method is add a close button “x” to close the suggestion list. I’ve done an ugly example illustrate this: typeahead with close button “x”

其中一個可行的方法,就是在提示清單上加入一個關閉的按鈕”x”,小弟做了個核突的版本:typeahead with close button “x”

只要您修改第849行,
What you need to do is to change line 849:

 dropdown: '<span class="tt-dropdown-menu"></span>'

換成以下,
To

 dropdown: '<span class="tt-dropdown-menu"><a class="tt-dropdown-close" onclick="$(this).closest(\'span\').hide()">x</a></span>'

還有,只要修改CSS就能改善畫面。
If you feel this screen is ugly, what you need is to add CSS file.

如果您在使用Google DoubleClick for publsher(DFP Ad,Google 提供的公開的點擊廣告統計)來管理您自己網站的廣告。在時發覺看不到廣告時,總想找出問題的原因。Google DoubleClick for publisher所使用的程式碼叫做Google Publisher Tag,在運行過程中,會將所發生的問題的時間、狀況記錄下來。

If you are using “Google DoubleClick for publisher” to manage your own advertisement in your website, sometimes you may want to find out the reasons behind when your ads don’t work. The library for managing “Google DoubleClick for Publisher” is called “Google Publisher Tag”. During the operation of “Google Publisher Tag”, every error will be logged into its own logging system.

要如何查看Google Publisher Tag的運行的記錄呢?它放置在googletag.getEventLog().H之內。

The “Google Publisher Tag” store the event log in googletag.getEventLog().H

用Google Chrome打開Console打入以下的指令:
Use google chrome and turn on the “Console” and enter the following command:

console.log(googletag.getEventLog().H.join('\n'));

Google Publisher Tag Log

If you have installed mac port, it’s normal to install python and django under macport.

如果你安裝了macport,很自然地,你希望用macport去安裝python及django。

The latest python installed by macport should be 2.7.3, thus command for installation of python and django are:

由於在macport之下最新的python的版本是2.7.3。故此在macport下安裝python及django的指令:

sudo port install python
sudo port install py27-django

If you have installed previous version of python through macport, you should make sure which one is active, you can use the following command to check:

如果你之前曾用過macport安裝舊版本的python,你可以用以下的指令查看那一個版本才是預設的。

port select --list python

The result should be similar to the following:
如果會跟以下的差不多:

Available versions for python:
	none (active)
	python25-apple
	python26-apple
	python27
	python27-apple

If you want to ask macport to select the python 2.7.3 provided by macport as default python interpreter, you should use the following command:

如果你想指定用macport所提供的python 2.7,你需要用到以下的指令:

sudo port select python python27

If you want to see if you have set the active python interpreter correctly, type the following command to check the path of python:

如果你想測試之前能否成功地指定python interpreter,可以用以下的指令查看python的路徑:

which python

If you selected macport’s python, the path should be:
如果你選的是macport所提供的python,應看到以下的結果:

/opt/local/bin/python

Try to repeat the previous steps if you find the path is different.
如果你發現python的路徑不相同,請重覆以上的步驟。

Now, please check your path to django-admin.py:
現在請查看django-admin.py的路徑,

which django-admin.py

In my computer, the result is:
在我的電腦,django-admin的位置是:

/usr/local/bin/django-admin.py

If you execute django-admin.py, you will find out that python cannot find django.core. The problem is caused from the first line of django-admin.py

如果你執行django-admin.py你會發現python找不到django.core。問題源於django-admin.py的第一句。

#!/usr/bin/python
from django.core import management

if __name__ == "__main__":
    management.execute_from_command_line()

The first line tell shell to use the python installed by mac os instead of using the python provided by macport. Thus, we should use the following command to change the first line:
第一句告知shell使用由mac os所提供的python而不是macport 所提供的python。所以我們須用以下的指令更改第一句:

sudo nano /usr/local/bin/django-admin.py

The updated source code should look like:
更改後的django-admin.py應該是:

#!/opt/local/bin/python
from django.core import management

if __name__ == "__main__":
    management.execute_from_command_line()

Then, you can ran django-admin.py properly.
之後,你就可以正常地運行django-admin.py

However, next time if you update django, please repeat the process again.
下次你更新django時,請重覆整個步驟。

One of my colleague using Internet Explorer 10 to emulate IE 8 Standard mode. During calling slice() method for a String object. It shows the error “slice not found in object”.

我有位同事用Internet Explorer 10去模擬IE 8標準模式。在一句指令中,字串物件上執行slice()方法時,卻發生了問題,Internet Explorer顯示”slice not found in object”

This problem in weird since in microsoft website, it stated that string’s slice method is existed in all versions. (http://msdn.microsoft.com/en-us/library/ie/s4esdbwz(v=vs.94).aspx)
這是個奇怪的情況,因為在微軟的網站內寫著所有版本Internet Explorer都有String slice。

In order to avoid any similar problem, I wrote a custom slice() method whenever slice() is not found as default:
為了避免這問題,我寫了一段指令,當發現在字串物件中找不到slice()時,會用一個自訂的slice()方法.

if(typeof String.prototype["slice"]==="undefined"){String.prototype.slice=function(s,e){var l=this.length;return this.substr(s=s<0?l+s:s,typeof e==='number'?(e<0?l+e:e)-s:l-s)}}