tgm-config.php
116 lines
| 1 | <?php |
| 2 | /** |
| 3 | * This file represents an example of the code that themes would use to register |
| 4 | * the required plugins. |
| 5 | * |
| 6 | * It is expected that theme authors would copy and paste this code into their |
| 7 | * functions.php file, and amend to suit. |
| 8 | * |
| 9 | * @see http://tgmpluginactivation.com/configuration/ for detailed documentation. |
| 10 | * |
| 11 | * @package TGM-Plugin-Activation |
| 12 | * @subpackage Example |
| 13 | * @version 2.5.2 |
| 14 | * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer |
| 15 | * @copyright Copyright (c) 2011, Thomas Griffin |
| 16 | * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later |
| 17 | * @link https://github.com/TGMPA/TGM-Plugin-Activation |
| 18 | */ |
| 19 | |
| 20 | add_action( 'tgmpa_register', 'vkb_register_required_plugins' ); |
| 21 | /** |
| 22 | * Register the required plugins for this theme. |
| 23 | * |
| 24 | * In this example, we register five plugins: |
| 25 | * - one included with the TGMPA library |
| 26 | * - two from an external source, one from an arbitrary source, one from a GitHub repository |
| 27 | * - two from the .org repo, where one demonstrates the use of the `is_callable` argument |
| 28 | * |
| 29 | * The variable passed to tgmpa_register_plugins() should be an array of plugin |
| 30 | * arrays. |
| 31 | * |
| 32 | * This function is hooked into tgmpa_init, which is fired within the |
| 33 | * TGM_Plugin_Activation class constructor. |
| 34 | */ |
| 35 | function vkb_register_required_plugins() { |
| 36 | /* |
| 37 | * Array of plugin arrays. Required keys are name and slug. |
| 38 | * If the source is NOT from the .org repo, then source is also required. |
| 39 | */ |
| 40 | $plugins = array( |
| 41 | |
| 42 | // This is an example of how to include a plugin bundled with a theme. |
| 43 | array( |
| 44 | 'name' => 'VK Block Patterns', // The plugin name. |
| 45 | 'slug' => 'vk-block-patterns', // The plugin slug (typically the folder name). |
| 46 | 'required' => false, // If false, the plugin is only 'recommended' instead of required. |
| 47 | ), |
| 48 | ); |
| 49 | |
| 50 | /* |
| 51 | * Array of configuration settings. Amend each line as needed. |
| 52 | * |
| 53 | * TGMPA will start providing localized text strings soon. If you already have translations of our standard |
| 54 | * strings available, please help us make TGMPA even better by giving us access to these translations or by |
| 55 | * sending in a pull-request with .po file(s) with the translations. |
| 56 | * |
| 57 | * Only uncomment the strings in the config array if you want to customize the strings. |
| 58 | */ |
| 59 | $config = array( |
| 60 | 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. |
| 61 | 'default_path' => '', // Default absolute path to bundled plugins. |
| 62 | 'menu' => 'tgmpa-install-plugins', // Menu slug. |
| 63 | 'parent_slug' => 'plugins.php', // Parent menu slug. |
| 64 | 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. |
| 65 | 'has_notices' => true, // Show admin notices or not. |
| 66 | 'dismissable' => true, // If false, a user cannot dismiss the nag message. |
| 67 | 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. |
| 68 | 'is_automatic' => false, // Automatically activate plugins after installation or not. |
| 69 | 'message' => '', // Message to output right before the plugins table. |
| 70 | |
| 71 | 'strings' => array( |
| 72 | 'page_title' => __( 'Install Required Plugins', 'vk-blocks' ), |
| 73 | 'menu_title' => __( 'Install Plugins', 'vk-blocks' ), |
| 74 | // translators: %s = plugin name. |
| 75 | 'installing' => __( 'Installing Plugin: %s', 'vk-blocks' ), |
| 76 | 'oops' => __( 'Something went wrong with the plugin API.', 'vk-blocks' ), |
| 77 | // translators: |
| 78 | 'notice_can_install_required' => _n_noop( 'This plugin requires the following plugin: %1$s.', 'This plugin requires the following plugins: %1$s.', 'vk-blocks' ), |
| 79 | // translators: %s = plugin name. |
| 80 | 'notice_can_install_recommended' => _n_noop( 'This plugin recommends the following plugin: %1$s.<br>Many additional functions are available for free.', 'This plugin recommends the following plugins: %1$s.<br>Many additional functions are available for free.', 'vk-blocks' ), |
| 81 | // translators: %s = plugin name. |
| 82 | 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %1$s plugin.', 'Sorry, but you do not have the correct permissions to install the %1$s plugins.', 'vk-blocks' ), |
| 83 | // translators: %s = plugin name. |
| 84 | 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this plugin: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this plugin: %1$s.', 'vk-blocks' ), |
| 85 | // translators: %s = plugin name. |
| 86 | 'notice_ask_to_update_maybe' => _n_noop( 'There is an update available for: %1$s.', 'There are updates available for the following plugins: %1$s.', 'vk-blocks' ), |
| 87 | // translators: %s = plugin name. |
| 88 | 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %1$s plugin.', 'Sorry, but you do not have the correct permissions to update the %1$s plugins.', 'vk-blocks' ), |
| 89 | // translators: %s = plugin name. |
| 90 | 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'vk-blocks' ), |
| 91 | // translators: %s = plugin name. |
| 92 | 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'vk-blocks' ), |
| 93 | // translators: %s = plugin name. |
| 94 | 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %1$s plugin.', 'Sorry, but you do not have the correct permissions to activate the %1$s plugins.', 'vk-blocks' ), |
| 95 | // translators: %s = plugin name. |
| 96 | 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'vk-blocks' ), |
| 97 | 'update_link' => _n_noop( 'Begin updating plugin', 'Begin updating plugins', 'vk-blocks' ), |
| 98 | 'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'vk-blocks' ), |
| 99 | 'return' => __( 'Return to Required Plugins Installer', 'vk-blocks' ), |
| 100 | 'plugin_activated' => __( 'Plugin activated successfully.', 'vk-blocks' ), |
| 101 | 'activated_successfully' => __( 'The following plugin was activated successfully:', 'vk-blocks' ), |
| 102 | // translators: %s = plugin name. |
| 103 | 'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'vk-blocks' ), |
| 104 | // translators: %s = plugin name. |
| 105 | 'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'vk-blocks' ), |
| 106 | // translators: %s = plugin name. |
| 107 | 'complete' => __( 'All plugins installed and activated successfully. %1$s', 'vk-blocks' ), |
| 108 | // translators: %s = dashboard link. |
| 109 | 'contact_admin' => __( 'Please contact the administrator of this site for help.', 'vk-blocks' ), |
| 110 | 'nag_type' => 'updated', // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'. |
| 111 | ), |
| 112 | ); |
| 113 | |
| 114 | tgmpa( $plugins, $config ); |
| 115 | } |
| 116 |