1
|
|
|
<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2
|
|
|
/** |
3
|
|
|
* Event Espresso |
4
|
|
|
* |
5
|
|
|
* Event Registration and Management Plugin for WordPress |
6
|
|
|
* |
7
|
|
|
* @ package Event Espresso |
8
|
|
|
* @ author Seth Shoultes |
9
|
|
|
* @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
10
|
|
|
* @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
11
|
|
|
* @ link http://www.eventespresso.com |
12
|
|
|
* @ version 4.0 |
13
|
|
|
* |
14
|
|
|
* ------------------------------------------------------------------------ |
15
|
|
|
* |
16
|
|
|
* EED_Venues_Archive |
17
|
|
|
* |
18
|
|
|
* @package Event Espresso |
19
|
|
|
* @subpackage /modules/venues_archive/ |
20
|
|
|
* @author Brent Christensen |
21
|
|
|
* |
22
|
|
|
* ------------------------------------------------------------------------ |
23
|
|
|
*/ |
24
|
|
|
class EED_Venues_Archive extends EED_Module { |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return EED_Venues_Archive |
28
|
|
|
*/ |
29
|
|
|
public static function instance() { |
30
|
|
|
return parent::get_instance( __CLASS__ ); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* set_hooks - for hooking into EE Core, other modules, etc |
35
|
|
|
* |
36
|
|
|
* @access public |
37
|
|
|
* @return void |
38
|
|
|
*/ |
39
|
|
|
public static function set_hooks() { |
40
|
|
|
EE_Config::register_route( 'venues', 'Venues_Archive', 'run' ); |
41
|
|
|
// EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' ); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
46
|
|
|
* |
47
|
|
|
* @access public |
48
|
|
|
* @return void |
49
|
|
|
*/ |
50
|
|
|
public static function set_hooks_admin() { |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
|
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* run - initial module setup |
57
|
|
|
* |
58
|
|
|
* @access public |
59
|
|
|
* @param \WP $WP |
60
|
|
|
*/ |
61
|
|
|
public function run( $WP ) { |
62
|
|
|
// check what template is loaded |
63
|
|
|
add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
64
|
|
|
add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* template_include |
71
|
|
|
* |
72
|
|
|
* @access public |
73
|
|
|
* @param string $template |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
public function template_include( $template ) { |
77
|
|
|
// not a custom template? |
78
|
|
|
if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_venues.php' ) { |
79
|
|
|
EEH_Template::load_espresso_theme_functions(); |
80
|
|
|
// then add extra event data via hooks |
81
|
|
|
add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
82
|
|
|
// don't know if theme uses the_excerpt |
83
|
|
|
add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
84
|
|
|
// or the_content |
85
|
|
|
add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
86
|
|
|
// don't display entry meta because the existing theme will take care of that |
87
|
|
|
add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
88
|
|
|
} |
89
|
|
|
return $template; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* the_title |
96
|
|
|
* |
97
|
|
|
* @access public |
98
|
|
|
* @param string $title |
99
|
|
|
* @return string |
100
|
|
|
*/ |
101
|
|
|
public function the_title( $title = '' ) { |
102
|
|
|
return $title; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* venue_details |
108
|
|
|
* |
109
|
|
|
* @access public |
110
|
|
|
* @param string $content |
111
|
|
|
* @return string |
112
|
|
|
*/ |
113
|
|
|
public function venue_details( $content ) { |
114
|
|
|
global $post; |
115
|
|
|
if ( |
116
|
|
|
$post->post_type == 'espresso_venues' |
117
|
|
|
&& ! post_password_required() |
118
|
|
|
) { |
119
|
|
|
// since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
120
|
|
|
// it uses the_content() for displaying the $post->post_content |
121
|
|
|
// so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
122
|
|
|
// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
123
|
|
|
remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
124
|
|
|
remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
125
|
|
|
// add filters we want |
126
|
|
|
add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
127
|
|
|
add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
128
|
|
|
// now load our template |
129
|
|
|
$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
130
|
|
|
//now add our filter back in, plus some others |
131
|
|
|
add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
132
|
|
|
add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
133
|
|
|
// remove other filters we added so they won't get applied to the next post |
134
|
|
|
remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
135
|
|
|
remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
136
|
|
|
// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
137
|
|
|
} |
138
|
|
|
return ! empty( $template ) ? $template : $content; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
|
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* venue_location |
145
|
|
|
* |
146
|
|
|
* @access public |
147
|
|
|
* @param string $content |
148
|
|
|
* @return string |
149
|
|
|
*/ |
150
|
|
|
public function venue_location( $content ) { |
151
|
|
|
return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
|
155
|
|
|
|
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* wp_enqueue_scripts |
159
|
|
|
* |
160
|
|
|
* @access public |
161
|
|
|
* @return void |
162
|
|
|
*/ |
163
|
|
|
public function wp_enqueue_scripts() { |
164
|
|
|
// get some style |
165
|
|
|
if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
166
|
|
|
// first check theme folder |
167
|
|
View Code Duplication |
if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
168
|
|
|
wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
169
|
|
|
} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
170
|
|
|
wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
171
|
|
|
} |
172
|
|
|
wp_enqueue_style( $this->theme ); |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
|
177
|
|
|
|
178
|
|
|
|
179
|
|
|
} |
180
|
|
|
// End of file EED_Venues_Archive.module.php |
181
|
|
|
// Location: /modules/venues_archive/EED_Venues_Archive.module.php |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.