Advertisement
Guest User

Untitled

a guest
Jun 20th, 2016
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace PandoraBox
  6. {
  7.     public class CatMainIndexPlugin : IPluginMacro
  8.     {
  9.         Regex _block = new Regex(@"{CATINDEX}(.*?){/CATINDEX}", RegexOptions.Compiled | RegexOptions.Singleline);
  10.        
  11.         public string Execute(string template, PluginMacroArgs args)
  12.         {
  13.             template = _block.Replace(template, delegate(Match match)
  14.             {
  15.                 if(args.I == 0 && args.MacroType == MacroType.CATBLOCK)
  16.                     return match.Groups[1].Value;
  17.                 return "";
  18.             });
  19.             return template;
  20.         }
  21.        
  22.         public ushort Level
  23.         {
  24.             get { return 3; }
  25.         }
  26.        
  27.         public String Name
  28.         {
  29.             get { return "CatMainIndexPlugin: Вывод только на главной индексной странице"; }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement