parseUrl() public method

public parseUrl ( $url )
コード例 #1
0
    /**
     * @param Pap_Db_Visit
     * @return Pap_Contexts_Click
     */
    private function getContextFromParams(Pap_Db_Visit $visit) {
        $context = $this->createContext($visit);

        $getRequest = new Pap_Tracking_Request();
        $getRequest->parseUrl($visit->getGetParams());
        if($getRequest->getAffiliateId() == ''){
            $context->debug('Affiliate Id or Affiliate Id Parameter is missing');
        }
        if ($this->isClickRequest($getRequest)) {
            $context->setRequestObject($getRequest);
            $context->debug('It is click request.');
            return $context;
        }
        $anchorRequest = new Pap_Tracking_Request();
        $anchor = $visit->getAnchor();
        $anchorRequest->parseUrl($anchor);
        if ($this->isClickRequest($anchorRequest)) {
            $context->setRequestObject($anchorRequest);
            $context->debug('It is anchor request, anchor: ' . $anchor);
            return $context;
        }

        if ($anchor != '' && Gpf_Settings::get(Pap_Settings::SUPPORT_SHORT_ANCHOR_LINKING) == Gpf::YES) {
            $user = $this->affiliateRecognizer->getUserById($context, $anchor);
            if ($user == null) {
                $context->debug('User is null, anchor was:' . $anchor);
                return null;
            }
            $shortAnchorRequest = new Pap_Tracking_Request();
            $shortAnchorRequest->parseUrl('?'.Pap_Tracking_Request::getAffiliateClickParamName().'='.$anchor);
            $context->setRequestObject($shortAnchorRequest);
            $context->debug('Short anchor link');
            return $context;
        }

        $context->debug('No click was recognized (normal, anchor or short anchor) - this might be a problem...');
        return null;
    }