| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: Plugin Groups |
| 4 |
* Plugin URI: https://cramer.co.za |
| 5 |
* Description: Organize Plugins in groups |
| 6 |
* Version: 3.0.0 |
| 7 |
* Author: David Cramer |
| 8 |
* Author URI: https://cramer.co.za |
| 9 |
* Text Domain: plugin-groups |
| 10 |
* License: GPL2+ |
| 11 |
* Requires PHP: 7.4 |
| 12 |
* Requires at least: 6.7 |
| 13 |
*/ |
| 14 |
|
| 15 |
// If this file is called directly, abort. |
| 16 |
if ( ! defined( 'WPINC' ) ) { |
| 17 |
die; |
| 18 |
} |
| 19 |
|
| 20 |
// Constants. |
| 21 |
define( 'PLGGRP_PATH', plugin_dir_path( __FILE__ ) ); |
| 22 |
define( 'PLGGRP_CORE', __FILE__ ); |
| 23 |
define( 'PLGGRP_URL', plugin_dir_url( __FILE__ ) ); |
| 24 |
define( 'PLGGRP_SLUG', basename( __DIR__ ) . '/' . basename( __FILE__ ) ); |
| 25 |
define( 'PLGGRP_VERSION', '3.0.0' ); |
| 26 |
/** |
| 27 |
* Check if we're running dev mode. |
| 28 |
*/ |
| 29 |
if ( file_exists( PLGGRP_PATH . '/.dev-server-running' ) ) { |
| 30 |
$domain = filter_var( $_SERVER['HTTP_HOST'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME ); |
| 31 |
if ( str_ends_with( $domain, '.local' ) ) { |
| 32 |
$port = trim( file_get_contents( PLGGRP_PATH . '.dev-server-running' ) ); |
| 33 |
define( 'PLGGRP_DEV_MODE', $port ); |
| 34 |
} |
| 35 |
} |
| 36 |
if ( ! version_compare( PHP_VERSION, '7.4', '>=' ) ) { |
| 37 |
if ( is_admin() ) { |
| 38 |
add_action( 'admin_notices', 'plugin_groups_php_ver' ); |
| 39 |
} |
| 40 |
} else { |
| 41 |
// Includes Plugin_Groups and starts instance. |
| 42 |
include_once PLGGRP_PATH . 'bootstrap.php'; |
| 43 |
} |
| 44 |
|
| 45 |
function plugin_groups_php_ver() { |
| 46 |
|
| 47 |
$message = __( 'Plugin Groups requires PHP version 7.4 or later. We strongly recommend PHP 7.4 or later for security and performance reasons.', 'plugin-groups' ); |
| 48 |
echo sprintf( '<div id="plugin_groups_error" class="error notice notice-error"><p>%s</p></div>', esc_html( $message ) ); |
| 49 |
} |
| 50 |
|