@using System @using System.Collections.Generic @using System.Linq @using System.Text @using RazorEngine.Templating @using RazorEngine.Text @using Templating @using Templating.Models @functions { private Random _rnd = new Random(); string RandomPrice() // random price in range 0.95 - .199.95 { return _rnd.Next(200).ToString() + ".95"; } string RandomTime() { return (DateTime.UtcNow - TimeSpan.FromSeconds(_rnd.Next(84000))).ToString("t"); } string RandomDate() { return (DateTime.UtcNow - TimeSpan.FromHours(_rnd.Next(36000))).ToString("D"); } string RandomDateTimeIso() { return (DateTime.UtcNow - TimeSpan.FromHours(_rnd.Next(36000))).ToString("o"); } string RandomDay() { return (DateTime.UtcNow - TimeSpan.FromHours(_rnd.Next(36000))).ToString("Y"); } string RandomString(int len) { var sb = new StringBuilder(); for (var i = 0; i < len; ++i) { var code = _rnd.Next(52); sb.Append((Char)(code < 26 ? (int)('A') + code : (int)('a') + code)); } return sb.ToString(); } string PickAny(params string[] list) { return Pick(_rnd, list); } string PickAny(Func[] options) { return Pick(_rnd, options); } static string Pick(Random rnd, params string[] list) { return list[rnd.Next(list.Length)]; } static string Pick(Random rnd, Func[] options) { return options[rnd.Next(options.Length)](); } } @{ var date = DateTime.UtcNow.ToString("yyyy-MM-dd"); // usa var randomizer = new Random(Model.Seed); _rnd = new Random(Model.Seed); var rnd1000 = new Random(Model.Seed / 1000); var pageId = randomizer.Next(3000, 14000); var pageUrl = GetValue(ThisPageUrl); var siteUrl = !String.IsNullOrEmpty(pageUrl) ? pageUrl.Substring(0, pageUrl.IndexOf('/', 8)) : ""; var siteTitle = GetValue(UserName); var titleVariants = new Func[] { () => GetValue(Key) + ", " + GetValue(AdditionalKey) + ".", () => GetValue(Key) + " " + GetValue(Dosage) + " " + GetValue(AdditionalKey) + ".", () => GetValue(Key) + " (" + GetValue(Synonym) + ") " + GetValue(AdditionalKey) + "." }; var titleText = Pick(randomizer, titleVariants); var title = new RawString(titleText); var pageTitle = String.IsNullOrEmpty(siteTitle) ? titleText : titleText + " | " + siteTitle; var descrVariants = new Func[] { () => GetValue(AddText(new TextParams{ Words = new IntRange(20, 40)})) + " " + GetValue(Key), () => GetValue(Key) + ", " + GetValue(AddText(new TextParams{ Words = new IntRange(20, 40)})), () => GetValue(AdditionalKey) + ". " + GetValue(AddText(new TextParams{ Words = new IntRange(20, 40)})), () => GetValue(AddText(new TextParams{ Words = new IntRange(20, 40)})) + " " + GetValue(AdditionalKey) + ". " }; var descrText = Pick(randomizer, descrVariants); var descr = new RawString(descrText); var stopWords = new[] { "in", "of", "off", "a", "the", "on", "from", "at", "no", "and", "for", "I", "you", "from", "to", "with" }; var keywordsText = string.Join(", ", titleText.Words() .Where(w => !stopWords.Contains(w.ToLowerInvariant())) .Select(w => w.TrimPunctuation()) .Distinct() .Shuffle(_rnd)) ; var keywords = new RawString(keywordsText); var randomUSCoords = new [] { String.Format("{0}.{1}", _rnd.Next(30, 50), _rnd.Next(10000)), String.Format("{0}.{1}", -_rnd.Next(70, 125), _rnd.Next(10000)), }; var randomUKCoords = new [] { String.Format("{0}.{1}", _rnd.Next(50, 55), _rnd.Next(10000)), String.Format("{0}.{1}", _rnd.Next(0, 5) - 4, _rnd.Next(10000)), }; var coords = randomizer.Next(10) > 2 ? randomUSCoords : randomUKCoords; var textTags = new [] { "b", "pre", "span", "strong" }; var prevLink = Model.Link(new LinkParams() { Kind = LinkType.Internal, Origin = LinkOrigin.Gen }); var nextLink = Model.Link(new LinkParams() { Kind = LinkType.Internal, Origin = LinkOrigin.Gen }); var prevTitle = prevLink != null ? prevLink.Title : null; var prevUrl = prevLink != null ? prevLink.Url : null; var nextTitle = nextLink != null ? nextLink.Title : null; var nextUrl = nextLink != null ? nextLink.Url : null; Func prevPage = @; Func nextPage = @; Func metaLinkPrev = @; Func metaLinkNext = @; var continuePhrase = Pick(rnd1000, new [] { "Read next...", "Continue reading", "Learn more", "Continue...", "Continue", "Find out more"}); Func continueInternal = @@continuePhrase ; Func continueExternal = @@continuePhrase ; // section types var blockParams1 = new BlockParams { Words = new IntRange(90, 160), ProductLinks = new IntRange(0, 1), IntLinks = new IntRange(0, 2), LinksAsHtml = true }; var blockParams2 = new BlockParams { Source = TextSourceId.Text, Words = new IntRange(80, 140), RandomKeys = new IntRange { Min = 0, Max = 2 }, ProductKeys = new IntRange(1, 3), ProductLinks = new IntRange(0, 1), IntLinks = new IntRange(1, 2), RandomLinks = new IntRange(0, 1), LinksAsHtml = true }; var textBlocks = new Func[] { @

@ProductKey

@AddBlock(blockParams1)

, @

@ProductKey

@AddBlock(blockParams1)

, @

@AdditionalKey

@AddBlock(blockParams2)

, @
@{ var numItems = randomizer.Next(0, 2); var itemTag = PickAny(textTags); var caption = (randomizer.Next(1000) < 150) ? Pick(randomizer, "F.A.Q. ", "FAQ ", "Usage ", "Reviews for ", "Useful info on ", "Some advice for ") : ""; }

@caption @Key

@AddText(new TextParams{ Words = new IntRange(60, 120)})

    @for (var i = 0; i < numItems; ++i) {
  • @ProductPageLink @AddText(new TextParams{ Words = new IntRange(10, 30)})
  • }
, }; var r1 = randomizer.Next(6); var r2 = randomizer.Next(6); var r3 = randomizer.Next(6); var r4 = randomizer.Next(6); var r5 = randomizer.Next(6); var tableBlocks = new Func[] { @

@ProductKey

@CommonDescription @CommonText(new IntRange(20, 65))

@if(r1 < 5) { } @if(r2 < 4) { } @if(r3 < 4) { } @if(r4 < 4) { } @if(r5 < 3) { } @{ var rows = randomizer.Next(3, 12); for (var i = 0; i < rows; ++i) { @if(r1 < 5) { } @if(r2 < 4) { } @if(r3 < 4) { } @if(r4 < 4) { } @if(r5 < 3) { } } }
ProductPageCountryCityRecommended price
@Synonym@ProductPageLink@Country@City$@RandomPrice()
, @

@ProductKey

@AddText(new TextParams{ Words = new IntRange(160, 260)}) @Key.

@if(r1 < 4) { } @if(r2 < 3) { } @if(r3 < 5) { } @if(r4 < 5) { } @{ var rows = randomizer.Next(1, 4); for (var i = 0; i < rows; ++i) { @if(r1 < 4) { } @if(r2 < 3) { } @if(r3 < 5) { } @if(r4 < 5) { } } }
Country / @SynonymCityNo Prescription @DosageDetails
@Country / @Dosage@City$@RandomPrice()@ProductPageLink
, }; var listBlocks = new Func[] { @
    @{ var numListItems = randomizer.Next(3, 5); for (var i = 0; i < numListItems; ++i) {
  • @Country - @RandomDate() - $@RandomPrice()
  • } }
, @

@ProductKey

@{ var numItems1 = randomizer.Next(2, 4); var listType = PickAny("A", "a", "I", "", "", "", ""); }
    @for (var i = 0; i < numItems1; ++i) {
  1. @WrapRandomTag(AdditionalKey) - @AddText(new TextParams{ Words = new IntRange(10, 30)})
  2. }
, @
@{ var numItems2 = randomizer.Next(4, 9); var itemTag = PickAny(textTags); }
    @for (var i = 0; i < numItems2; ++i) {
  • @WrapTag(Synonym, itemTag)
  • }
, @
@{ var caption = (randomizer.Next(1000) < 150) ? Pick(randomizer, "Similar to ", "References on ", "F.A.Q. ", "FAQ ", "Usage ", "Reviews for ", "Similar for ", "References on ") : ""; }

@caption @ProductKey

@{ var numItems4 = randomizer.Next(1, 3); var itemTag = PickAny(textTags); }
    @for (var i = 0; i < numItems4; ++i) {
  • @AdditionalKey @AddText(new TextParams{ Words = new IntRange(10, 30)}) @CommonText(new IntRange(15, 35)) @continueExternal(0)
  • }
, @
@{ var suffix = _rnd.Next(1000) < 200 ? PickAny(" Reviews", " known issues", " options", " Pros") : ""; }

@ProductKey @suffix

@{ var numItems4 = randomizer.Next(1, 4); var itemTag = PickAny(textTags); }
    @for (var i = 0; i < numItems4; ++i) {
  • @AdditionalKey @AddText(new TextParams{ Words = new IntRange(10, 20)}) @CommonText(new IntRange(12, 27)) @continueInternal(0)
  • }
}; var sectionGenerator = textBlocks.ToRandomSequence(randomizer).Take(20) .Concat(tableBlocks.ToRandomSequence(randomizer).Take(3)) .Concat(listBlocks.ToRandomSequence(randomizer).Take(4)) .ToRandomSequence(randomizer); Func intLinksList = @
    @{ var numLinksList = randomizer.Next(2, 4); for (var i = 0; i < numLinksList; ++i) { var relLink = Model.Link(new LinkParams() { Kind = LinkType.Internal, Origin = LinkOrigin.Gen }); if (relLink != null) {
  • @relLink.Title
  • } } }
; Func intLinksInline = @ @{ var numLinksInline = randomizer.Next(1, 5); for (var i = 0; i < numLinksInline; ++i) { var relLink = Model.Link(new LinkParams() { Kind = LinkType.Internal, Origin = LinkOrigin.Gen }); if (relLink != null) { @relLink.Title if (i < numLinksInline - 1) { @(" | ") } } } } ; Func extLinksList = @
    @{ var numLinksList = randomizer.Next(1, 3); for (var i = 0; i < numLinksList; ++i) { var relLink = Model.Link(new LinkParams() { Kind = LinkType.External, Origin = LinkOrigin.Gen }); if (relLink != null) {
  • @relLink.Title
  • } } }
; }
Fatal error: Uncaught Error: Class 'WP_List_Util' not found in /home/www/winnovation.dk/wp-includes/functions.php:5263 Stack trace: #0 /home/www/winnovation.dk/wp-includes/post.php(1615): wp_filter_object_list(Array, Array, 'and', 'name') #1 /home/www/winnovation.dk/wp-content/plugins/wordpress-seo/inc/options/class-wpseo-option-titles.php(223): get_post_types(Array, 'names') #2 /home/www/winnovation.dk/wp-content/plugins/wordpress-seo/inc/options/class-wpseo-option.php(352): WPSEO_Option_Titles->enrich_defaults() #3 /home/www/winnovation.dk/wp-content/plugins/wordpress-seo/inc/options/class-wpseo-option.php(630): WPSEO_Option->get_defaults() #4 /home/www/winnovation.dk/wp-content/plugins/wordpress-seo/inc/options/class-wpseo-option.php(393): WPSEO_Option->array_filter_merge(Array) #5 /home/www/winnovation.dk/wp-includes/class-wp-hook.php(326): WPSEO_Option->get_option(Array) #6 /home/www/winnovation.dk/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #7 /home/www/winnovation.dk/wp-includes/option.php(247 in /home/www/winnovation.dk/wp-includes/functions.php on line 5263