-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathredq-event.php
More file actions
131 lines (110 loc) · 3.82 KB
/
redq-event.php
File metadata and controls
131 lines (110 loc) · 3.82 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
/*
Plugin Name: RedQ Events
Plugin URI: https://github.com/RedQ/RedQ-Events
Description: Event Management System. Buy sell event tickets online with WooCommerce
Version: 1.0.4
Author: RedQ Team
Author URI: http://www.redqteam.com/
License: GPLv2 or later
Domain Path: /languages
Text Domain: redq-events
*/
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Check if WooCommerce is active
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
/**
* RQ Events class
*/
class RQ_Events {
/**
* Constructor
*/
public function __construct() {
define( 'RQ_EVENTS_VERSION', '1.0.4' );
define( 'RQ_EVENTS_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' );
define( 'RQ_EVENTS_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
define( 'RQ_EVENTS_MAIN_FILE', __FILE__ );
add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'event_form_styles' ) );
if ( is_admin() ) {
$this->admin_includes();
}
add_action( 'woocommerce_loaded', array( $this, 'includes' ) );
add_action( 'init', array( $this, 'init_post_types' ) );
// Init core classes
include( 'includes/class-rq-events-cart.php' );
include( 'includes/class-rq-events-ajax.php' );
}
/**
* Load Classes
*/
public function includes() {
include( 'includes/rq-events-functions.php' );
include( 'includes/class-wc-product-event.php' );
include( 'includes/class-rq-event-form.php' );
include( 'includes/class-rq-events-widgets.php' );
}
/**
* Include admin
*/
public function admin_includes() {
include( 'includes/admin/class-rq-events-admin.php' );
}
/**
* Localisation
*/
public function load_plugin_textdomain() {
$locale = apply_filters( 'plugin_locale', get_locale(), 'redq-events' );
$dir = trailingslashit( WP_LANG_DIR );
load_textdomain( 'redq-events', $dir . 'redq-events/redq-events-' . $locale . '.mo' );
load_plugin_textdomain( 'redq-events', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Init post types
*/
public function init_post_types() {
register_post_type( 'event_ticket',
apply_filters( 'redq_register_post_type_event_ticket',
array(
'label' => __( 'Ticket Type', 'redq-events' ),
'public' => true,
'hierarchical' => false,
'supports' => false
)
)
);
}
/**
* Frontend event form scripts
*/
public function event_form_styles() {
wp_enqueue_style( 'rq-events-styles', RQ_EVENTS_PLUGIN_URL . '/assets/css/frontend.css', null, RQ_EVENTS_VERSION );
}
}
$GLOBALS['rq_events'] = new RQ_Events();
} else {
function rq_events_admin_notice() { ?>
<div class="error">
<p><?php _e( 'Please Install WooCommerce First before activating this Plugin. You can download WooCommerce from <a href="http://wordpress.org/plugins/woocommerce/">here</a>.', 'redq-events' ); ?></p>
</div>
<?php }
add_action( 'admin_notices', 'rq_events_admin_notice' );
}