Ejemplo n.º 1
0
 void DeletePlugin(string plugin_file)
 {
     _packages.UninstallPackage(PackagesHelper.PluginFileToPluginId(plugin_file));
 }
Ejemplo n.º 2
0
 void AdminInit(WpApp app)
 {
     // plugins_api
     app.AddFilter("plugins_api", new Func <PhpValue, string, object, PhpValue>(PluginsApi), accepted_args: 3);
     app.AddFilter("delete_plugin", new Action <string>(DeletePlugin));
     app.AddFilter("upgrader_source_selection", new Func <string, PhpValue>(InstallSourceSelection), priority: 0);
     app.AddFilter("activate_plugin", new Action <string>(plugin_file => _packages.ActivatePackage(PackagesHelper.PluginFileToPluginId(plugin_file))));
     app.AddFilter("deactivate_plugin", new Action <string>(plugin_file => _packages.DeactivatePackage(PackagesHelper.PluginFileToPluginId(plugin_file))));
     app.AddFilter("install_plugins_tabs", new Func <PhpArray, PhpArray>(tabs => // remove unsupported tabs
     {
         //tabs.Remove(new IntStringKey("upload"));
         tabs.Remove(new IntStringKey("popular"));
         tabs.Remove(new IntStringKey("recommended"));
         tabs.Remove(new IntStringKey("favorites"));
         tabs["recommended"] = "Premium";
         return(tabs);
     }));
     app.Context.DefineConstant("FS_METHOD", "direct"); // overwrite how installing plugins is handled, skips the fs check
 }
Ejemplo n.º 3
0
 void IWpPlugin.Configure(WpApp app)
 {
     // postpone admin actions
     app.AddFilter("admin_init", new Action(() =>
     {
         // plugins_api
         app.AddFilter("plugins_api", new Func <PhpValue, string, object, PhpValue>(PluginsApi), accepted_args: 3);
         app.AddFilter("themes_api", new Func <PhpValue, string, object, PhpValue>(ThemesApi), accepted_args: 3);
         app.AddFilter("delete_plugin", new Action <string>(DeletePlugin));
         app.AddFilter("upgrader_source_selection", new Func <string, PhpValue>(InstallSourceSelection), priority: 0);
         app.AddFilter("activate_plugin", new Action <string>(plugin_file => _packages.ActivatePackage(PackagesHelper.PluginFileToPluginId(plugin_file))));
         app.AddFilter("deactivate_plugin", new Action <string>(plugin_file => _packages.DeactivatePackage(PackagesHelper.PluginFileToPluginId(plugin_file))));
         app.AddFilter("switch_theme", new Action <string, WP_Theme, WP_Theme>(SwitchTheme), accepted_args: 3);
         app.AddFilter("install_plugins_tabs", new Func <PhpArray, PhpArray>(tabs => // remove unsupported tabs
         {
             //tabs.Remove(new IntStringKey("upload"));
             tabs.Remove(new IntStringKey("popular"));
             tabs.Remove(new IntStringKey("recommended"));
             tabs.Remove(new IntStringKey("favorites"));
             tabs["recommended"] = "Premium";
             return(tabs);
         }));
         // defined in PeachPied.WordPress.Sdk: // app.Context.DefineConstant("FS_METHOD", "direct"); // overwrite how installing plugins is handled, skips the fs check
     }));
 }