is_compatible_version()) { add_action('admin_notices', [$requirements, 'load_plugin_admin_notices']); return; } /** * Init plugin default constant */ require(__DIR__ . '/functions/default-constants.php'); italystrap_set_default_constant(__FILE__, 'ITALYSTRAP'); $autoload_plugin_files = [ '/vendor/autoload.php', '/vendor/cmb2/cmb2/init.php', '/functions/autoload.php', '/bootstrap.php', '/functions/edd.php', ]; if (did_action('italystrap_plugin_loaded') > 0) { $autoload_plugin_files = []; } foreach ($autoload_plugin_files as $file) { require(__DIR__ . $file); } /** * Fires once ItalyStrap plugin has loaded. * * @since 2.0.0 */ do_action('italystrap_plugin_loaded', null); /** * This filter is used to load your php file right after ItalyStrap plugin is loaded. * The purpose is to have al code in the same scope without using global * with variables provided from this plugin. * * @example * Usage example: * * 1 - First of all you have to have the file/files with some code * that extending this plugins functionality in your plugin path. * 2 - Than you have to activate your plugin. * 3 - And then see the below example. * * add_filter( 'italystrap_require_plugin_files_path', 'add_your_files_path' ); * * function add_your_files_path( array $arg ) { * return array_merge( * $arg, * array( plugin_dir_path( __FILE__ ) . 'my-dir/my-file.php' ) * ); * } * * @example * Another example: * add_filter( 'italystrap_require_plugin_files_path', function ( $files_path ) { * * $files_path[] = PLUGIN_PATH . 'bootstrap.php'; * * return $files_path; * } ); * * Important: * Remeber that the file you want to load just after ItalyStrap plugin * has not to be required/included from your plugin because * you will get an error 'You can't redeclare...'. * * @since 2.0.0 * * @deprecated 4.0.0 Do not use this hook * * @var array */ $plugin_files_path = apply_filters('italystrap_require_plugin_files_path', []); if (! empty($plugin_files_path)) { foreach ((array) $plugin_files_path as $key => $plugin_file_path) { if (! file_exists($plugin_file_path)) { continue; } require($plugin_file_path); } /** * Fires once ItalyStrap Child plugin has loaded. * * @since 2.0.0 */ do_action('italystrap_child_plugin_loaded', null); } /** * To do * * @todo Agganciare init all'azione plugin_loaded * (forse plugin_loaded è troppo presto, valutare se usare init direttamente) * che in questo modo sarà possibile eventualmente fare un remove_actions se necessario * (normalmente con plugin premium) */