-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaste-toolkit.php
92 lines (79 loc) · 2.05 KB
/
haste-toolkit.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* Plugin Name: Haste Toolkit
* Plugin URI: https://github.com/HasteDesign/Haste-Toolkit
* Description: Use to add functionalities to be used in plugin or theme, or override the files to make your awesome new plugin.
* Version: 0.0.1
* Author: Haste
* Author URI: https://www.hastedesign.com.br
* License: GPLv2
* Text Domain: haste-toolkit
* Domain Path: languages/
*/
declare( strict_types = 1 );
namespace Haste\Toolkit;
// Prevents direct access
defined( 'ABSPATH' ) || exit;
if ( ! defined( 'HASTE_TOOLKIT_PLUGIN_FILE' ) ) {
define( 'HASTE_TOOLKIT_PLUGIN_FILE', __FILE__ );
}
// Autoload
if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
if ( ! class_exists( 'HasteToolkit' ) ) {
class HasteToolkit {
/**
* Current version number
*
* @var string
* @since 1.0.0
*/
const VERSION = '1.0.0';
/**
* Instance of this class.
*
* @var object
*/
protected static $instance = null;
/**
* Plugin directory path
*
* @var string
*/
private $plugin_dir = null;
/**
* Return the plugin instance.
*/
public static function init() {
$self = new self();
$self->plugin_dir = plugin_dir_path( __FILE__ );
add_action( 'init', array( $self, 'load_textdomain' ) );
add_action( 'init', array( $self, 'includes' ), 0 );
}
/**
* A final check if Haste Toolkit exists before kicking off our Haste Toolkit loading.
* Haste_Toolkit_VERSION is defined at this point.
*
* @since 1.0.0
*/
public function includes() {
require_once $this->plugin_dir . '/functions.php';
}
/**
* Get the plugin url.
*
* @return string
*/
public static function plugin_url() {
return untrailingslashit( plugins_url( '/', HASTE_TOOLKIT_PLUGIN_FILE ) );
}
/**
* Load plugin translation
*/
public function load_textdomain() {
load_plugin_textdomain( 'haste-toolkit', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
}
}
add_action( 'plugins_loaded', array( 'Haste\Toolkit\HasteToolkit', 'init' ) );