public void Configure(IWpApp app) { // // Dashboard: // // add information into Right Now section app.DashboardRightNow(GetDashboardRightNow); // do not allow editing of .php files: app.AddFilter("editable_extensions", new Func <IList, IList>(editable_extensions => { editable_extensions.Remove("php"); return(editable_extensions); })); // TODO: "install_plugins_upload" to customize upload plugin form // TODO: filter query_plugins // // Blogs: // // alter generator metadata app.AddFilter("get_the_generator_xhtml", new Func <string>(() => GeneratorHtml)); // add analytics }
/// <summary> /// Invoked by PHP plugin implementation (peachpie-api.php) to bridge into .NET. /// </summary> public virtual void AppStarted(IWpApp app) { // activate plugins: foreach (var plugin in _plugins) { plugin.Configure(app); } }
/// <summary> /// Invoked by PHP plugin implementation (peachpie-api.php) to bridge into .NET. /// </summary> public virtual void AppStarted(IWpApp app) { // user plugins: foreach (var plugin in _plugins) { plugin.Configure(app); } // builtin plugins: Internal.PeachpieWpPlugin.Instance.Configure(app); }
void IWpPlugin.Configure(IWpApp app) { Action updated = () => { // existing cache records get invalidated LastPostUpdate = DateTime.UtcNow; }; app.AddFilter("save_post", updated); app.AddFilter("wp_insert_comment", updated); // edit_comment // trashed_comment(comment id, comment) // spammed_comment }
/// <summary> /// Hooks onto <c>rightnow_end</c> action to provide additional content to the dashboard summary box. /// </summary> public static void DashboardRightNow(this IWpApp app, Func <string> htmlgetter) => app.AddFilter("rightnow_end", new Action(() => app.Echo(htmlgetter())));
/// <summary> /// Registers <c>the_permalink</c> filter. /// </summary> public static void FilterPermalink(this IWpApp app, the_permalink_filter filter) => app.AddFilter("the_permalink", filter);
/// <summary> /// Registers <c>the_title</c> filter. /// </summary> public static void FilterTitle(this IWpApp app, the_title_filter filter) => app.AddFilter("the_title", filter);
/// <summary> /// Registers <c>the_content</c> filter. /// </summary> public static void FilterContent(this IWpApp app, the_content_filter filter) => app.AddFilter("the_content", filter);