-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gp-project-icon.php
78 lines (64 loc) · 2.16 KB
/
gp-project-icon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* GP Project Icon
*
* @package GP_Project_Icon
* @link https://github.com/pedro-mendonca/GP-Project-Icon
* @author Pedro Mendonça
* @copyright 2024 Pedro Mendonça
* @license GPL-2.0-or-later
*
* @wordpress-plugin
* Plugin Name: GP Project Icon
* Plugin URI: https://wordpress.org/plugins/gp-project-icon/
* Description: This GlotPress plugin allows you to add icons to your projects.
* Version: 1.0.1
* Requires at least: 5.3
* Tested up to: 6.7
* Requires PHP: 7.4
* Requires Plugins: glotpress
* Author: Pedro Mendonça
* Author URI: https://profiles.wordpress.org/pedromendonca/
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: gp-project-icon
* Domain Path: /languages
*/
namespace GP_Project_Icon;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Check if get_plugin_data() function exists.
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// Get the plugin headers data.
$gp_project_icon_data = get_plugin_data( __FILE__, false, false );
// Set the plugin version.
if ( ! defined( 'GP_PROJECT_ICON_VERSION' ) ) {
define( 'GP_PROJECT_ICON_VERSION', $gp_project_icon_data['Version'] );
}
// Set the plugin required PHP version. Needed for PHP compatibility check for WordPress < 5.1.
if ( ! defined( 'GP_PROJECT_ICON_REQUIRED_PHP' ) ) {
define( 'GP_PROJECT_ICON_REQUIRED_PHP', $gp_project_icon_data['RequiresPHP'] );
}
// Set the plugin URL.
define( 'GP_PROJECT_ICON_DIR_URL', plugin_dir_url( __FILE__ ) );
// Set the plugin filesystem path.
define( 'GP_PROJECT_ICON_DIR_PATH', plugin_dir_path( __FILE__ ) );
// Set the plugin file path.
define( 'GP_PROJECT_ICON_FILE', plugin_basename( __FILE__ ) );
// Include Composer autoload.
require_once GP_PROJECT_ICON_DIR_PATH . 'vendor/autoload.php';
/**
* Initialize the plugin.
*
* @since 1.0.0
*
* @return void
*/
function gp_project_icon_init() {
new Project_Icon();
}
add_action( 'gp_init', __NAMESPACE__ . '\gp_project_icon_init' );