Beispiel #1
0
        internal static bool FilterObjectAdWordsWithoutInit(Business.DataObject item)
        {
            userWantsFiltering = AdWordHelper.UserWantsAds(item.UserID.Value);

            bool hasItemChanged = false;

            // Check if the current object has to be filtered for ad words
            if (adWordFilterObjects.ContainsKey(item.GetType().ToString()))
            {
                AdWordHelper.ResetCampaignObjects(item.ObjectID.Value);
                hasItemChanged = FilterObjectProperties(item, adWordFilters, adWordFilterObjects);
            }
            return(hasItemChanged);
        }
Beispiel #2
0
        public string Process(string value, Type type, FilterObjectTypes filterObjectType, Guid objectId, Guid userId)
        {
            this.objectId = objectId;
            string processedValue = value;

            value = "<DUMMY_TAG>" + value + "</DUMMY_TAG>";

            if (!AdWordHelper.CreditsLeft(campaignId, action))
            {
                return(processedValue);
            }

            switch (action)
            {
            case AdWordFilterActions.Link:
                if (regex.IsMatch(value))
                {
                    linkCounter    = 0;
                    processedValue = regex.Replace(value, linkMatchEvaluator);
                    processedValue = Regex.Replace(processedValue, "</{0,1}DUMMY_TAG>", "", RegexOptions.IgnoreCase);
                    AdWordHelper.AddToCampaignObjects(campaignId, objectId, word, linkCounter);
                }
                break;

            case AdWordFilterActions.Popup:
                if (regex.IsMatch(value))
                {
                    linkCounter    = 0;
                    processedValue = regex.Replace(value, popupMatchEvaluator);
                    processedValue = Regex.Replace(processedValue, "</{0,1}DUMMY_TAG>", "", RegexOptions.IgnoreCase);
                    AdWordHelper.AddToCampaignObjects(campaignId, objectId, word, linkCounter);
                }
                break;
            }

            return(processedValue);
        }