Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Extending WordPress with C# Plugins

, 30 May 2012
This article describes how to extend WordPress with plugins written in C# and shows very first C# plugin for this system.
ContentWatchdog_src.zip
ContentWatchdog
ContentWatchDog(MVC3).suo
ContentWatchdog.csproj.vspscc
ContentWatchDog.suo
ContentWatchdog.vssscc
Properties
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.239
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Devsense.WordPress.Plugins.ContentWatchdog
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    #line 3 "..\..\AdminPage.cshtml"
    using System.Web;
    
    #line default
    #line hidden
    
    #line 4 "..\..\AdminPage.cshtml"
    using Devsense.WordPress.Plugins.ContentWatchdog;
    
    #line default
    #line hidden
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.2.0.0")]
    internal partial class AdminPage : PhpRazorTemplateBase<ContentWatchdog>
    {
#line hidden

        public override void Execute()
        {


WriteLiteral("\r\n");




WriteLiteral("\r\n<div class=\"wrap\">\r\n    <h2>");


            
            #line 7 "..\..\AdminPage.cshtml"
   Write(Strings.PluginName);

            
            #line default
            #line hidden
WriteLiteral("</h2>\r\n    <form action=\"");


            
            #line 8 "..\..\AdminPage.cshtml"
             Write(HttpContext.Current.Request.RawUrl);

            
            #line default
            #line hidden
WriteLiteral("\" method=\"post\">\r\n\r\n        <table class=\"form-table\">\r\n            <tr valign=\"t" +
"op\">\r\n                <th scope=\"row\">\r\n                    <label for=\"Email\">");


            
            #line 13 "..\..\AdminPage.cshtml"
                                  Write(Strings.EmailAddress);

            
            #line default
            #line hidden
WriteLiteral("</label>\r\n                </th>\r\n                <td>\r\n                    <input" +
" id=\"Email\" name=\"Email\" type=\"text\" value=\"");


            
            #line 16 "..\..\AdminPage.cshtml"
                                                                 Write(Model.Email);

            
            #line default
            #line hidden
WriteLiteral("\" />\r\n                    <br />\r\n                    ");


            
            #line 18 "..\..\AdminPage.cshtml"
               Write(Strings.EmailDescription);

            
            #line default
            #line hidden
WriteLiteral("\r\n                </td>\r\n            </tr>\r\n            <tr valign=\"top\">\r\n      " +
"          <th scope=\"row\">\r\n                    <label for=\"WatchContent\">");


            
            #line 23 "..\..\AdminPage.cshtml"
                                         Write(Strings.WatchContent);

            
            #line default
            #line hidden
WriteLiteral("</label>\r\n                </th>\r\n                <td>\r\n                    <input" +
" ");


            
            #line 26 "..\..\AdminPage.cshtml"
                       Write(Model.WatchContent ? "checked=\"checked\"" : String.Empty);

            
            #line default
            #line hidden
WriteLiteral(" id=\"WatchContent\" name=\"WatchContent\" type=\"checkbox\" value=\"true\" />\r\n         " +
"       </td>\r\n            </tr>\r\n            <tr valign=\"top\">\r\n                " +
"<th scope=\"row\">\r\n                    <label for=\"MatchWholeWord\">");


            
            #line 31 "..\..\AdminPage.cshtml"
                                           Write(Strings.MatchWholeWord);

            
            #line default
            #line hidden
WriteLiteral("</label>\r\n                </th>\r\n                <td>\r\n                    <input" +
" ");


            
            #line 34 "..\..\AdminPage.cshtml"
                       Write(Model.MatchWholeWord ? "checked=\"checked\"" : String.Empty);

            
            #line default
            #line hidden
WriteLiteral(" id=\"MatchWholeWord\" name=\"MatchWholeWord\" type=\"checkbox\" value=\"true\" />\r\n     " +
"           </td>\r\n            </tr>\r\n            <tr valign=\"top\">\r\n            " +
"    <th scope=\"row\">\r\n                    <label for=\"BadWordsString\">");


            
            #line 39 "..\..\AdminPage.cshtml"
                                           Write(Strings.BadWords);

            
            #line default
            #line hidden
WriteLiteral("</label>\r\n                </th>\r\n                <td>\r\n                    <texta" +
"rea cols=\"45\" id=\"BadWordsString\" name=\"BadWordsString\" rows=\"5\">");


            
            #line 42 "..\..\AdminPage.cshtml"
                                                                                      Write(Model.BadWordsString);

            
            #line default
            #line hidden
WriteLiteral("</textarea>\r\n                    <br />\r\n                    ");


            
            #line 44 "..\..\AdminPage.cshtml"
               Write(Strings.BadWordsDescription);

            
            #line default
            #line hidden
WriteLiteral("\r\n                </td>\r\n            </tr>\r\n        </table>\r\n        <p class=\"s" +
"ubmit\">\r\n            <input type=\"submit\" name=\"Submit\" value=\"Save Changes\" />\r" +
"\n        </p>\r\n\r\n    </form>\r\n</div>\r\n");


        }
    }
}
#pragma warning restore 1591

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0

Share

About the Author

Miloslav Beno
Software Developer DEVSENSE s.r.o
Czech Republic Czech Republic
Miloslav is software developer of open-source PHP compiler & runtime for .NET/Mono called Phalanger and PHP Tools for Visual Studio. He's graduated at Faculty of Mathematics and Physics at Charles University in Prague. Beside of compilers and dynamic languages he is also interested in semantic web technologies. Available on twitter @miloslavbeno
Follow on   Twitter

| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 30 May 2012
Article Copyright 2012 by Miloslav Beno
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid