-
Notifications
You must be signed in to change notification settings - Fork 0
/
camp-certificates.php
100 lines (84 loc) · 2.07 KB
/
camp-certificates.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
93
94
95
96
97
98
99
100
<?php
/**
* Plugin Name: CampCertificates
* Plugin URI: http://github.com/wpbrasil/camp-certificates
* Description: Generate certificates for WordCamp attendees.
* Author: Claudio Sanches
* Author URI: http://claudiosmweb.com/
* Version: 1.0.0
* License: GPLv2 or later
* Text Domain: camp-certificates
* Domain Path: languages/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'Camp_Certificates' ) ) :
/**
* Camp Certificates main class.
*/
class Camp_Certificates {
/**
* Plugin version.
*
* @var string
*/
const VERSION = '1.0.0';
/**
* Instance of this class.
*
* @var object
*/
protected static $instance = null;
/**
* Initialize the plugin public actions.
*/
private function __construct() {
// Load plugin text domain.
add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
if ( is_admin() ) {
$this->admin_includes();
}
$this->includes();
}
/**
* Return an instance of this class.
*
* @return object A single instance of this class.
*/
public static function get_instance() {
// If the single instance hasn't been set, set it now.
if ( null == self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
/**
* Load the plugin text domain for translation.
*
* @return void
*/
public function load_plugin_textdomain() {
$locale = apply_filters( 'plugin_locale', get_locale(), 'camp-certificates' );
load_textdomain( 'camp-certificates', trailingslashit( WP_LANG_DIR ) . 'camp-certificates/camp-certificates-' . $locale . '.mo' );
load_plugin_textdomain( 'camp-certificates', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Includes.
*
* @return void
*/
private function includes() {
include_once 'includes/class-camp-certificates-post-types.php';
}
/**
* Admin includes.
*
* @return void
*/
private function admin_includes() {
include_once 'includes/admin/class-camp-certificates-admin.php';
}
}
add_action( 'plugins_loaded', array( 'Camp_Certificates', 'get_instance' ), 0 );
endif;